|
From: <le...@gr...> - 2004-05-28 13:37:55
|
Le 28 mai 04, =E0 15:28, Christian Schoenebeck a =E9crit : > Es geschah am Donnerstag, 27. Mai 2004 23:36 als St=E9phane LETZ = schrieb: >> On 27 mai 04, at 23:08, be...@ga... wrote: >>> The offending code (probably due to a cut'n paste error) >>> is in line 199 of Voice.h >>> >>> pOutputLeft[i++] +=3D this->FilterRight.Apply(&bq_base, &bq_main, >>> effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * >>> pos_fract + x0)); >>> >>> It should be >>> pOutputRight[i++] +=3D .... >>> >>> Stephane spotted this problem and told me about it on IRC, he said >>> tried a patch that speeds up things a bit >>> (reading pSrc[0]..pSrc[7] in one rush in variables and then >>> use these variable for the stereo cubic interpolator. >>> He said on PPC its faster. >>> >>> Perhaps it makes sense to commit it ? Christian ? >>> (I sent a copy of the diff to Christian). >> >> What really speedup is the use of float instead of double (3.0f=20 >> instead >> of 3.0 and so on..) *if* computing in double is not required of=20 >> course. >> But this must be tested on X86 before committing. > > What do you mean with "if" computing? Using the 3 instead of explicit 3.0f cause float to double conversion=20= everywhere and consume some CPU. If double precision is not required,=20 then using float explicitely is better. > > The patch looks ok, except: > > inline void InterpolateOneStep_Mono(sample_t* pSrc, int&=20= > i, > [snip] > - float a =3D (3 * (x0 - x1) - xm1 + x2) / 2; > - float b =3D 2 * x1 + xm1 - (5 * x0 + x2) / 2; > - float c =3D (x1 - xm1) / 2; > + float a =3D (3.0 * (x0 - x1) - xm1 + x2) * = 0.5f; > + float b =3D 2.0 * x1 + xm1 - (5.0 * x0 + x2) *=20= > 0.5f; > + float c =3D (x1 - xm1) * 0.5f; > > Intended? Why not: > > + float a =3D (3.0f * (x0 - x1) - xm1 + x2) * = 0.5f; > + float b =3D 2.0f * x1 + xm1 - (5.0f * x0 + x2) = *=20 > 0.5f; > + float c =3D (x1 - xm1) * 0.5f; > A mistake.. Yes 2.0f instead of 2.0. > And the patch works of course for x86 and also fixes the 'only left=20 > channel' > bug. > > CU > Christian Stephane |