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

Robert Swain robert.swain
Sat Jan 12 16:12:28 CET 2008


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20080112-kaiser_flexibility.diff
Type: text/x-diff
Size: 2222 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080112/b79d60a8/attachment.diff>

More information about the ffmpeg-devel mailing list