[Ffmpeg-devel] [PATCH] mtv demuxer genesis
Aurelien Jacobs
aurel
Sun Oct 8 23:07:51 CEST 2006
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 ?
> + /* 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
> + {
> + 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 ??)
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
More information about the ffmpeg-devel
mailing list