- flip(avctx, picture);
-
- if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2'))
- {
- // swap fields
- unsigned char *tmp = picture->data[1];
- picture->data[1] = picture->data[2];
- picture->data[2] = tmp;
+ if (pal) {
+ memcpy(frame->data[1], pal, AVPALETTE_SIZE);
+ frame->palette_has_changed = 1;
+ }
+ }
+ if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
+ frame->linesize[0] = (frame->linesize[0]+3)&~3;
+
+ if(context->flip)
+ flip(avctx, picture);
+
+ if ( avctx->codec_tag == MKTAG('Y', 'V', '1', '2')
+ || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9'))
+ FFSWAP(uint8_t *, picture->data[1], picture->data[2]);
+
+ if(avctx->codec_tag == AV_RL32("yuv2") &&
+ avctx->pix_fmt == PIX_FMT_YUYV422) {
+ int x, y;
+ uint8_t *line = picture->data[0];
+ for(y = 0; y < avctx->height; y++) {
+ for(x = 0; x < avctx->width; x++)
+ line[2*x + 1] ^= 0x80;
+ line += picture->linesize[0];
+ }