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

Ian Caulfield ian.caulfield
Mon Oct 15 18:11:23 CEST 2007


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.

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)?

Ian




More information about the ffmpeg-devel mailing list