[FFmpeg-devel] [PATCH] Generic sine window init function
Robert Swain
robert.swain
Sat Jun 21 22:02:35 CEST 2008
Hello,
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
0.00000011920928955078125.
Also, off topic, should that sqrt(2.0) be switched for M_SQRT2?
Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20080621-2100-ff_sine_window_init.diff
Type: text/x-diff
Size: 2817 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080621/516cdaab/attachment.diff>
More information about the ffmpeg-devel
mailing list