[Ffmpeg-devel] [PATCH] mtv demuxer genesis

Reynaldo H. Verdejo Pinochet reynaldo
Mon Oct 9 00:34:10 CEST 2006


On Sun, Oct 08, 2006 at 11:07:51PM +0200, Aurelien Jacobs wrote:
> On Sun, 8 Oct 2006 04:04:14 -0400
> "Reynaldo H. Verdejo Pinochet" <reynaldo at opendot.cl> wrote:
> 
> > This is my first attempt at writing a lavf demuxer so any comment
> > will be more than welcome, im sure there are a lot of improvements
> > and corrections to be made to the code.
> > 
> > +#define LE_24(x) ((((uint8_t*)(x))[2] << 16) | (((uint8_t*)(x))[1] << 8) | \
> > +((uint8_t*)(x))[0])
> 
> What about putting this along with LE_32 in avcodec.h ?
> 

Sounds like the right thing to do. 

> > +        /* buffer is GGGRRRR BBBBBGGG 
> > +         * and we need RRRRRGGG GGGBBBBB
> > +         * for PIX_FMT_RGB565 so here we
> > +         * just swap bytes as they come
> > +         */
> > +
> > +        for(i=0;i<chunk_size-1;i++)
>                                  ^^^^^ this should read i+=2 I guess

funny i didnt noticed it earlier, thanks, youre right.

> > +        {
> > +            tmp = *(buffer+i);
> > +            *(buffer+i) = *(buffer+i+1);
> > +            *(buffer+i+1) = tmp;
> > +        }
> > +
> > +        memcpy(pkt->data, buffer, chunk_size);
> 
> There's probably a better way to do this. (add a new PIX_FMT ??)

I already though about it but as I dindnt wanted to make this to depend on 
the commiting of a new pix_fmt patch ... anyway, guess i can do that
latter, this transformation isnt even endian safe.

> At least you could do something like this to avoid one copy:
> 
> +        ptr = pkt->data;
> +        for(i=0;i<chunk_size-1;i+=2)
> +        {
> +            *(ptr+i) = *(buffer+i+1);
> +            *(ptr+i+1) = *(buffer+i);
> +        }
> 
> Aurel

Thanks for your time Aurel.

Best regards

	Reynaldo
-------------- 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/20061008/2d1b3362/attachment.pgp>



More information about the ffmpeg-devel mailing list