# HG changeset patch # User michael # Date 1235230376 0 # Node ID 80720c5427a0a77c9d72744a389882ba8460cf2d # Parent 5a3426d7d0534bdba1a2544b6f1322ab350fc691 Fix raw rgb/bgr vertical flip in avi based on info from http://www.fourcc.org/fccbihgt.php. partially fixes issue862. diff -r 5a3426d7d053 -r 80720c5427a0 rawdec.c --- 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'))