From ff862be5ed2d7d6799ee23e04c5fbee0c1e1f987 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 Jul 2003 00:49:46 +0000 Subject: [PATCH] ati vcr2 uv swap Originally committed as revision 2084 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpeg12.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 46c0162588..62734b4778 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1791,6 +1791,12 @@ static void mpeg_decode_extension(AVCodecContext *avctx, } } +static void exchange_uv(AVFrame *f){ + uint8_t *t= f->data[1]; + f->data[1]= f->data[2]; + f->data[2]= t; +} + #define DECODE_SLICE_FATAL_ERROR -2 #define DECODE_SLICE_ERROR -1 #define DECODE_SLICE_OK 0 @@ -1945,8 +1951,14 @@ static int mpeg_decode_slice(AVCodecContext *avctx, MPV_decode_mb(s, s->block); if (++s->mb_x >= s->mb_width) { + if(s->avctx->codec_tag == ff_get_fourcc("VCR2")) + exchange_uv((AVFrame*)s->current_picture_ptr); + ff_draw_horiz_band(s, 16*s->mb_y, 16); + if(s->avctx->codec_tag == ff_get_fourcc("VCR2")) + exchange_uv((AVFrame*)s->current_picture_ptr); + s->mb_x = 0; s->mb_y++; @@ -2033,6 +2045,9 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) ff_print_debug_info(s, s->last_picture_ptr); } } + if(s->avctx->codec_tag == ff_get_fourcc("VCR2")) + exchange_uv(pict); + return 1; } else { return 0; @@ -2164,6 +2179,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx) s->width = avctx->width; s->height = avctx->height; avctx->has_b_frames= 0; //true? + s->low_delay= 1; s->avctx = avctx; if (MPV_common_init(s) < 0)