[FFmpeg-devel] [PATCH] Move Kaiser-Bessel Derived window to mdct.c

Michael Niedermayer michaelni
Sat Jan 12 16:30:12 CET 2008


On Sat, Jan 12, 2008 at 03:12:28PM +0000, Robert Swain wrote:
> Hello,
> 
> On 11/01/2008, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Fri, Jan 11, 2008 at 11:02:05PM +0000, Robert Swain wrote:
> > > On 11/01/2008, Michael Niedermayer <michaelni at gmx.at> wrote:
> > > > On Fri, Jan 11, 2008 at 12:53:10PM +0000, Robert Swain wrote:
> > > > > + * @param iter      iterations for Bessel I0 approximation
> > > > >   */
> > > > > -void ff_kbd_window_init(float *window)
> > > > > +void ff_kbd_window_init(float *window, float alpha, int n, int iter)
> > > > >  {
> > > >
> > > > iam for hardcoding the iterations
> > >
> > > I suppose I should test how many iterations are required to achieve
> > > the maximum precision of float, right?
> >
> > thats an option
> 
> I've had a bit of a think about this and I see three options:
> 
> - Calculate an estimate of the error and decide the number of
> iterations dynamically based on that and a specified error threshold.
> 
> Testing with the various alpha, n for aac.c and ac3dec.c showed the
> limit of float precision of the final window coefficients was reached
> in no more than 25 iterations.
> - Hard code to 50 iterations to be super safe.
> - Use a #define using 50 iterations to be super safe but allow easy
> alteration if we find this number at all problematic.
> 
> I chose to use the #define in the attached patch. Comments welcome.
> 
> I also tested using float versus double for local variables using the
> same technique (stopping when the current coefficients are the same as
> the last iteration) and found the difference in the values reached
> between float and double occurred after ~5 decimal places. I didn't
> know if this was significant or not. So I've left this for the moment.

5 correct decimal places:
65536 * 0.000009 = 0.589824
so id say using floats is not exactly something id consider a good idea
the doubles dont cost anything. While floats would limit the output to
about 16bit precission.

and patch ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080112/2f06f8e0/attachment.pgp>



More information about the ffmpeg-devel mailing list