changeset 8993:80720c5427a0 libavcodec

Fix raw rgb/bgr vertical flip in avi based on info from http://www.fourcc.org/fccbihgt.php. partially fixes issue862.
author michael
date Sat, 21 Feb 2009 15:32:56 +0000
parents 5a3426d7d053
children 206d0cfa3163
files rawdec.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rawdec.c	Fri Feb 20 22:00:41 2009 +0000
+++ b/rawdec.c	Sat Feb 21 15:32:56 2009 +0000
@@ -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 @@
     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 @@
         avctx->palctrl->palette_changed = 0;
     }
 
+    if(context->flip)
     flip(avctx, picture);
 
     if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2'))