[FFmpeg-devel] [PATCH] MLP/TrueHD decoder

Ian Caulfield ian.caulfield
Mon Oct 15 13:26:02 CEST 2007


New parser patch attached, I've tried to addess everyone's comments.


On 13/10/2007, Michael Niedermayer <michaelni at gmx.at> wrote:
>
> this doesnt look speed critical, so why is it inline?
>

Fixed


>
> the {} are placed inconsistant
>

Fixed


> > +
> > +    crc = av_crc(crc_2D, 0, buf, 24) ^ AV_RL16(buf+24);
> > +    if (crc != AV_RL16(buf+26))
> > +    {
> > +        av_log(log, AV_LOG_ERROR, "Major sync info header CRC error\n");
> > +        return -1;
> > +    }
>
> i would rather write
> crc = av_crc(crc_2D, 0, buf, 24);
> if (crc != (AV_RL16(buf+26) ^ AV_RL16(buf+24)))
>

I did it like this because of the retarded way that the MLP crc's
don't quite match av_crc - the crc variable represents the CRC
calculated over the first 26 bytes. I've added a comment to explain
this.

>
> if bb
> else if ba
> else return -1
>

Fixed

> in the i<7 case buf + i - 7 will point outside of the array
>
> also the parser looks messy, maybe using ff_combine_frame() would help?

OK, I've rewritten the parser to use ff_combine_frame - it's less
messy, but still not as clean as most parsers. I guess only having
sync words in a few of the packets doesn't help.

Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mlp_parse.patch
Type: text/x-diff
Size: 12722 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071015/63240806/attachment.patch>



More information about the ffmpeg-devel mailing list