[FFmpeg-devel] [PATCH] updated LGPL AC-3 decoder
Michael Niedermayer
michaelni
Mon May 7 14:46:02 CEST 2007
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 ...)
[...]
> + /* the rest of the bsi. read twice for dual mono mode. */
> + for(i=0; i<=(ctx->acmod == AC3_ACMOD_DUALMONO); i++) {
> + ctx->dialnorm[i] = dialnorm_tbl[get_bits(gb, 5)]; // dialogue normalization
> + if(get_bits1(gb))
> + skip_bits(gb, 8); // skip compression gain
> + if(get_bits1(gb))
> + skip_bits(gb, 8); // skip language code
> + if(get_bits1(gb))
> + skip_bits(gb, 7); // skip audio production information
> + } while(i--);
hmm for(){}while(); ?
and patch looks ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070507/64fbbed7/attachment.pgp>
More information about the ffmpeg-devel
mailing list