[FFmpeg-devel] [PATCH] updated LGPL AC-3 decoder

Justin Ruggles justinruggles
Tue May 8 02:59:13 CEST 2007

Michael Niedermayer wrote:
> Hi
> On Sun, May 06, 2007 at 06:49:00PM -0400, Justin Ruggles wrote:
> [...]
>>>>+    /* convert float to 16-bit integer */
>>>>+    for(ch=0; ch<ctx->out_channels; ch++) {
>>>>+        for(i=0; i<256; i++) {
>>>>+            ctx->output[ch][i] = ctx->output[ch][i] * ctx->mul_bias +
>>>>+                                 ctx->add_bias;
>>>>+        }
>>>>+        ctx->dsp.float_to_int16(ctx->int_output[ch], ctx->output[ch], 256);
>>>this isnt exactly ideal
>>>the bias should be applied in some more efficient way like multiplying some
>>>scaling coefficients, allthough i dunno if thats possible in AC3 ...
>>I changed it so that the bias is multiplied in before the IMDCT along
>>with the dialogue normalization and dynamic range compression.
>>On top of your suggestions, I also did several other changes.  I added
>>dialogue normalization, put in some references to the specs in various
>>places, fixed some bugs, simplified a few things, added more checks for
>>error conditions, and removed some unused variables.
>>I still can't figure out why the 5.1 decoding is so much slower than
>>liba52.  My guess is the downmixing, but it might be other things as
>>well.  Stereo decoding is pretty much the same speed on my system as
>>liba52, but 5.1 decoding takes twice as long...
> you mean 5.1 with downmixing to stereo or true 5.1 ?
> the downmixing should be done before the imdct, that way you dont need to
> do the imdct on 6 channels but rather just on 2 (i didnt check where the
> downmix is done exactly but its just IIRC ...)

I forgot to reply to this part in the last email...it's been a long day.
 That would make sense to do the downmixing before the IMDCT.  I'll try
it out.  It is only the decoding from 5.1 to stereo that is slower.
Straight 5.1 AC3 to 6-channel wav is near enough the same speed as liba52.


More information about the ffmpeg-devel mailing list