[FFmpeg-devel] [PATCH] MLP/TrueHD decoder
Ian Caulfield
ian.caulfield
Wed Oct 17 14:31:19 CEST 2007
New version of mlp parser patch attached.
On 15/10/2007, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Oct 15, 2007 at 12:26:02PM +0100, Ian Caulfield wrote:
> > New parser patch attached, I've tried to addess everyone's comments.
> [...]
> > +static int truehd_channels(int chanmap)
>
> for(i=0; i<13; i++)
> channels += chan_count[i] * ((chanmap>>i)&1);
>
Fixed
>
> [...]
> > + // The MLP crc is calculated differently to av_crc, hence the need to
> > + // XOR in the last two bytes instead of including them in the CRC
>
> i say it again MLP does NOT calculate CRCs differently it calculates them
> incorrect
> this is like saying r*3 is a different way of finding the circumference of the
> circle, it is not differnt its just wrong
>
> CRCs are shortened cyclic codes (see any book about CRCs, maybe even
> wikipedia) what MLP stores are NOT shortened cyclic codes hence not CRCs!
> that is unless AV_RL16(buf+24) or AV_RL16(buf+26) is a constant
>
Renamed to checksum
> > + if (pc->bytes_left == 0) {
> > + // Find length of this packet
> > +
> > + for (i = 0; (pc->state & 0x10000) == 0 && i < buf_size; i++)
> > + {
> > + pc->state = (pc->state << 8) | buf[i];
> > + }
> > +
> > + if ((pc->state & 0x10000) == 0)
> > + {
> > + ff_combine_frame(&pc->pc, END_NOT_FOUND, &buf, &buf_size);
> > + return buf_size;
> > + }
>
> the {} placement is inconsistant
Fixed
>
> > + init_get_bits(&bits, buf + 4, (buf_size - 4) * 8);
> > + if (ff_mlp_read_major_sync(NULL, &mh, &bits, buf + 4, buf_size - 4) < 0) {
>
> please dont pass 2 redundant things, here its a pointer to the buffer
> and a GetBitContext
>
Fixed
>
> > + pc->in_sync = 0;
> > + pc->state = 0;
> > + return -1;
>
> duplicate, a goto no_sync could be used ...
>
Fixed
Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mlp_parse.patch
Type: text/x-diff
Size: 12788 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071017/46d1c611/attachment.patch>
More information about the ffmpeg-devel
mailing list