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

Michael Niedermayer michaelni
Mon Oct 15 19:50:25 CEST 2007


On Mon, Oct 15, 2007 at 05:11:23PM +0100, Ian Caulfield wrote:
> On 15/10/2007, Michael Niedermayer <michaelni at gmx.at> wrote:
> > Hi
> >
> > On Mon, Oct 15, 2007 at 12:42:25PM +0100, Ian Caulfield wrote:
> > > On 14/10/2007, Michael Niedermayer <michaelni at gmx.at> wrote:
> > > >
> > > > > +/** Get a number of bits from a bitstream, updating a running CRC in the process */
> > > > > +
> > > > > +static av_always_inline unsigned int get_bits_crc(GetBitContext *gbp, int bit_count, uint8_t *crctab, uint8_t *crc)
> > > > > +{
> > > > > +    uint8_t crcval = *crc;
> > > > > +    unsigned int data;
> > > > > +    data = get_bits_long(gbp, bit_count);
> > > > > +    while (bit_count > 8) {
> > > > > +        crcval = crctab[crcval] ^ ((data >> (bit_count - 8)) & 0xff);
> > > > > +        bit_count -= 8;
> > > > > +    }
> > > > > +    *crc = (crcval << bit_count)
> > > > > +            ^ crctab[crcval >> (8 - bit_count)]
> > > > > +            ^ (data & ((1 << bit_count) - 1));
> > > > > +    return data;
> > > > > +}
> > > >
> > > > please use the normal get_bits*() and av_crc() once over the whole data
> > > >
> > >
> > > Is it possible to use av_crc on fractional bytes?
> >
> > is the area over which the crc is calculated not a multiple of 8bits ?
> 
> Not in this case - this header is usually 125 or 149 bits long, and
> doesn't start on a byte boundary.

just "filling" the first bits which arent part of the header with 0 should
work as long as the end is on a byte boundary


> 
> What do you suggest I call the not-CRC that MLP uses (the difference
> being that the order of the table lookup and XOR are swapped)?

MLP-checksum maybe
also its all fine to call it crc as long as it is one, that is
before that funky xor
also my complaint was only about that comment claiming that the used checksum
would be a a crc just different from what libavutil implements

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071015/83b98829/attachment.pgp>



More information about the ffmpeg-devel mailing list