summaryrefslogtreecommitdiff
path: root/libavcodec/rawdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-02-21 15:32:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-02-21 15:32:56 +0000
commit31f2616db86fb50174bc053f26c14db7c03e3685 (patch)
tree1180636eeb907844f448218c42799300be27e09d /libavcodec/rawdec.c
parent431ac290461df62b0e982e88163377080e5bf290 (diff)
Fix raw rgb/bgr vertical flip in avi based on info from http://www.fourcc.org/fccbihgt.php.
partially fixes issue862. Originally committed as revision 17475 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 22bc13daf8..f18a2c58d6 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -30,6 +30,7 @@
typedef struct RawVideoContext {
unsigned char * buffer; /* block of memory for holding one frame */
int length; /* number of bytes in buffer */
+ int flip;
AVFrame pic; ///< AVCodecContext.coded_frame
} RawVideoContext;
@@ -85,14 +86,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
if (!context->buffer)
return -1;
+ if(avctx->extradata_size >= 9 && !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9))
+ context->flip=1;
+
return 0;
}
static void flip(AVCodecContext *avctx, AVPicture * picture){
- if(!avctx->codec_tag && avctx->bits_per_coded_sample && picture->linesize[2]==0){
picture->data[0] += picture->linesize[0] * (avctx->height-1);
picture->linesize[0] *= -1;
- }
}
static int raw_decode(AVCodecContext *avctx,
@@ -131,6 +133,7 @@ static int raw_decode(AVCodecContext *avctx,
avctx->palctrl->palette_changed = 0;
}
+ if(context->flip)
flip(avctx, picture);
if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2'))