[FFmpeg-devel] [PATCH] Generic sine window init function
Sat Jun 21 22:02:35 CEST 2008
A few of the MDCT codecs (AAC, IMC, COOK, Nellymoser) use sine windows
so it would make sense to share the sine window initialisation code
between them as the . I have attached a patch for this. If there are
other codecs that can use this that I've missed, let me know.
It is probably noteworthy that the tables for functions that normalise
the window coefficients may differ from the direct calculation due to
loss of precision during intermediate stages. For example, in imc.c:
+ ff_sine_window_init(q->mdct_sine_window, 2*COEFFS);
for(i = 0; i < COEFFS; i++)
- q->mdct_sine_window[i] = sin((i + 0.5) / 512.0 * M_PI) * sqrt(2.0);
+ q->mdct_sine_window[i] *= sqrt(2.0);
mdct_sine_window is a float array so the sin() part of the calculation
is limited to float precision in ff_sine_window_init and is then
normalised with the sqrt(2.0) after. Is this a problem or is the
difference insignificant? For the above case the maximum deviation was
Also, off topic, should that sqrt(2.0) be switched for M_SQRT2?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2817 bytes
Desc: not available
More information about the ffmpeg-devel