> Le 19 déc. 2020 à 18:58, Oleg Nesterov <o...@redhat.com> a écrit :
> 
> On 12/19, Dario Sanfilippo wrote:
>> 
>>> And this probably means that Dario was right, and the problem was caused
>>> by quantisation.
>>> 
>>> Because IIUC in theory (and unless you modulate HPFfreq) these 3 filters
>>> 
>>>        fi.highpass(2, f)
>>>        fi.svf.hp(f, 1/sqrt(2))
>>>        svf2blti(f, 1/sqrt(2), 1) : ba.selectn(10,1)
>>> 
>>> should have the same transfer function / impulse response.
>>> 
>> 
>> The IR of the filters with -double is the following, with a 20 Hz CF:
>> 
>> Darios-MBP:edgeofchaos dariosanfilippo1$ ./test_hp -sr 96000 -s 9600 -n 1
>> 
>> channel 1, channel 2, channel 3
>> -1.4107325142354377e-11, -1.4107325144178732e-11, -1.4107325144183914e-11
>> 
>> I thought that our SVF filters might have had exactly the same
>> calculations,
> 
> Why?? No, the math obviously differs.
> 
>> but there's still some difference in the response.
> 
> Of course they differ! although I guess the numbers should be close...
> 
> Let me repeat, IIUC they should be equivalent _IN THEORY_. OK, let me
> inspect your implementation of bp filter. maxima code:
> 
>       (%i1) E: [
>               bp = s1/z + v1,
>               v1 = hp * g,
>               v2 = bp * g,
>               hp = (in - 2 * (1/(2*q)) * s1/z - g * s1/z - s2/z)/(1 + 2 * 
> (1/(2*q)) * g + g * g),
> 
>               lp = s2/z + v2,
> 
>               s1 = v1 + bp,
>               s2 = v2 + lp]$
> 
>       (%i2) solve(E, [bp,v1,v2,hp,lp,s1,s2])$
> 
>       (%i3) facsum(ratsimp(%[1][1])/in,z);
>                                                2
>                bp                         g q z  - g q
>       (%o3)    ── = ────────────────────────────────────────────────────────
>                in     2             2                            2
>                     (g  q + q + g) z  + 2 (g - 1) (g + 1) q z + g  q + q - g
> 
> 
> Now, lets do the same with svf.bp:
> 
> 
>       (%i1) S1: ic1eq = 2*v1 - ic1eq/z $
>       (%i2) S2: ic2eq = 2*v2 - ic2eq/z $
>       (%i3) V1: v1 = (ic1eq/z + g *(v0-ic2eq/z)) / gk $
>       (%i4) V2: v2 =  ic2eq/z + g * v1 $
>       (%i5) solve([V1,V2,S1,S2], [v1,v2, ic1eq,ic2eq])$
>       (%i6) %[1][1]/v0, gk = (1 + g*(g+1/q))$
>       (%i7) facsum(ratsimp(%),z);
>                                                2
>                v1                         g q z  - g q
>       (%o7)    ── = ────────────────────────────────────────────────────────
>                v0     2             2                            2
>                     (g  q + q + g) z  + 2 (g - 1) (g + 1) q z + g  q + q - g
> 
> See? Both have the _same_ transfer function. But of course, this does
> NOT mean that the numerical output should be the same.
> 
>> I used
>> Pirkle,
> 
> where can I read it?
> 
>> which text did you use?
> 
> See the comments above svf() in filters.lib:
> 
>       https://cytomic.com/files/dsp/SvfLinearTrapOptimised2.pdf
> 
>> If I run faustbench -double on your filter and mine, I get the following
>> results:
>> 
>> yours: Best value is : 1176.06 with -double -vec -fun -lv 0 -vs 128
>> mine: Best value is : 1324.58 with -double -vec -fun -lv 0 -vs 64
>> 
>> If I'm not wrong, a higher value indicates a faster DSP, but that's for
>> some specific settings.
> 
> Cough ;) I never used faustbench and I don't know what does it do.
> 
> So I used "faust -a bench.cpp" to compare
> 
>       F = 50;
>       process = svf.hp(F, 1/sqrt(2));
> 
> with
> 
>       F = 50;
>       process = (svf2blti(F, 1/sqrt(2), 1) : ba.selectn(10,1));
> 
> svf-bench, 3 runs:
> 
>       66.2247 264.899 MB/s inputs     264.899 MB/s outputs    65.3919 38.1911
>       66.1178 264.471 MB/s inputs     264.471 MB/s outputs    65.5512 52.7835
>       66.2247 264.899 MB/s inputs     264.899 MB/s outputs    65.5196 52.4456
> 
> blti-bench, 3 runs:
> 
>       56.3024 225.21  MB/s inputs     225.21  MB/s outputs    55.845  31.9875
>       56.3799 225.52  MB/s inputs     225.52  MB/s outputs    55.89   51.3927
>       56.3799 225.52  MB/s inputs     225.52  MB/s outputs    55.8713 30.0734
> 
> svf looks a bit faster, but I do not know if we can trust the numbers above.
> In any case, I bet they should be close performance-wise.
> 
> Oleg.
> 

faustbench (and faustbench-llvm) are described here:

https://github.com/grame-cncm/faust/tree/master-dev/tools/benchmark

Then use the same benchmark code than bench.cpp (our rather similar), but both 
of them explore the different compilation parameters and keep the best one. So 
different implementation may differ regarding how the C++ compiler can 
auto-vectorise the code in -vec mode.

Stéphane 



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to