[FFmpeg-devel] BFI video decoder

Michael Niedermayer michaelni
Fri Apr 18 00:00:44 CEST 2008


On Fri, Apr 18, 2008 at 03:25:59AM +0530, Sisir Koppaka wrote:
> Updated patch attached
> 
> On Fri, Apr 18, 2008 at 3:12 AM, Michael Niedermayer <michaelni at gmx.at>
[...]
> >
> > [...]
> > > +    uint8_t *src, *dst_offset, *frame_end = bfi->dst + avctx->width *
> > avctx->height, colour1, colour2;
> > [...]
> > > +        unsigned int byte = *buf++, code = byte >> 6, length = byte &
> > ~0xC0, offset;
> >
> > These would be more readable if they where not on a single line.
> >
> Done
[...]
> +    /* Set frame parameters and palette, if necessary */
> +    if (!avctx->frame_number) {
> +        bfi->frame.pict_type = FF_I_TYPE;
> +        bfi->frame.key_frame = 1;
> +        /* Setting the palette */
> +        if(avctx->extradata_size>768) {
> +            av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n");
> +            return -1;
> +        }
> +        pal = (uint32_t *) bfi->frame.data[1];
> +        for (i = 0; i < avctx->extradata_size / 3; i++) {
> +            int shift = 16;
> +            *pal = 0;
> +            for (j = 0; j < 3; j++, shift -= 8)
> +                *pal +=
> +                    ((avctx->extradata[i * 3 + j] << 2) |
> +                    (avctx->extradata[i * 3 + j] >> 4)) << shift;
> +            pal++;
> +        }
> +        bfi->frame.palette_has_changed = 1;
> +    } else {
> +        bfi->frame.pict_type = FF_P_TYPE;
> +        bfi->frame.key_frame = 0;
> +    }
> +
> +    buf += 4; //Unpacked size, not required.
> +    

trailing whitespace


> +    while (dst != frame_end) {
> +        static const uint8_t lentab[4]={0,2,0,1};
> +        unsigned int byte = *buf++, offset;

> +        unsigned int code = byte >> 6, length = byte & ~0xC0;

that would be more readable on 2 lines


> +
> +        /* Get length and offset(if required) */
> +        if (length == 0) {
> +            if (code == 1) {
> +                length = bytestream_get_byte(&buf);
> +                offset = bytestream_get_le16(&buf);
> +            } else {
> +                length = bytestream_get_le16(&buf);

> +                if (code == 2 && length == 0) {
> +                    break;
> +                }

superflous {}


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

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- 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/20080418/4917e49c/attachment.pgp>



More information about the ffmpeg-devel mailing list