[Ffmpeg-devel] Re: BUG: AC3 encode volume is low

Benjamin Larsson banan
Mon Apr 10 16:14:11 CEST 2006

Justin Ruggles wrote:

>IMO, neither ac3's MDCT formula nor FFmpeg's implementation of it is
>dodgy.  You're right, though, that there was never any consensus on a
>resolution to the issue and no fix was ever committed.  I still haven't
>changed my opinion on the matter, although there is one thing that I am
>not 100% sure about...
>Why does the MDCT output to a 32-bit int instead of 16-bit?  Isn't it
>just a signed 15-bit fixed-point implementation of the formula in the
>spec?  I can't find where the output coefficients would need to be more
>than a 16-bit signed integer.
>>From what I can tell from the MDCT code, and from the fix15() function,
>the output coefficients should have a range of -32767 to 32767.  Thus,
>the abs(av_log2(mdct_coeff)) would have a range of 0 to 14.  Looking at
>the code that calculates the exponent based on the MDCT coefficient, (23
>- v) would have a range of 23 to 9.  In order to get the desired
>exponent range of 0 to 24, the value of exp_samples, which is generated
>during normalization, would have to have a minimum value of -9.
>The current code generates a minimum value for exp_samples of -8.  To
>me, changing the normalization code to generate a minimum value of -9
>seems to be the proper solution.
>I don't think I ever submitted this in its own patch way back when, so
>I'll go ahead and do it now.  I hope I'm doing the regression test
>checksums correctly...I've never really used regression tests before.
Patch applied and regressions test passed on amd64.

Benjamin Larsson

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

More information about the ffmpeg-devel mailing list