[Ffmpeg-devel] [PATCH][RFC] ac3enc window generation

Benjamin Larsson banan
Thu Apr 20 18:48:14 CEST 2006

Michael Niedermayer wrote:

>On Thu, Apr 20, 2006 at 02:54:34PM +0000, Benjamin Larsson wrote:
>>The following patch generates the ac3 window used by the ac3 encoder.
>>The patch is based on code posted by Justin Ruggles. This also gives the
>>opportunity to use a diffrent rounding for the mdct window
>>(truncating/rounding/whatever, truncation is used now). The attached
>>octave script gives the following values for me:
>>max_rounderror =  3.8178e-05
>>max_floorerror =  7.3856e-05
>>round_bits = 14.677
>>floor_bits = 13.725
>>roundsse =  7.3792e-08
>>floorsse =  4.6057e-07
>>>From these values one can see that rounding gives lower error on
>>average. But from the resulting plot one can see that truncation results
>>in the gain to always be under 1 while rounding results in the gain to
>>be centered around 1. So with rounding one would get a (very) slightly
>>lower error but the window gain could overflow the result in (very)
>>extream situations.
>>So, apply with/without rounding or patch rejected.
>assuming i understand everything the problem is that
>the window when shifted squared and summed must be <= 1
Yes, the Princen-Bradley condition (http://en.wikipedia.org/wiki/MDCT).

>so the solution would be not to round the values independantly but
>to choose the pairs so that their summed squares are <=1 and the
>error is minimized
>so simply try a few pairs surounding the rounded one and choose the
I thought about this but trying diffrent pairs surrounding the rounded
value could result in the window beeing non smooth. And I'm pretty sure
that a non smooth window is more worse then a small rounding error. So I
think the choise is between flooring or round to nearest.

Benjamin Larsson

"incorrect information" is an oxymoron. Information is, by definition, factual, correct.

More information about the ffmpeg-devel mailing list