# HG changeset patch # User michael # Date 1235230376 0 # Node ID a36f9f2eefcb9f7245a50eb94b39b66332f6fad9 # Parent 629bcd779fb8353ada296501249be991af21248b Fix raw rgb/bgr vertical flip in avi based on info from http://www.fourcc.org/fccbihgt.php. partially fixes issue862. diff -r 629bcd779fb8 -r a36f9f2eefcb avidec.c --- a/avidec.c Sat Feb 21 14:40:19 2009 +0000 +++ b/avidec.c Sat Feb 21 15:32:56 2009 +0000 @@ -451,7 +451,7 @@ } get_le32(pb); /* size */ st->codec->width = get_le32(pb); - st->codec->height = get_le32(pb); + st->codec->height = (int32_t)get_le32(pb); get_le16(pb); /* panes */ st->codec->bits_per_coded_sample= get_le16(pb); /* depth */ tag1 = get_le32(pb); @@ -499,6 +499,15 @@ st->codec->codec_tag = tag1; st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); st->need_parsing = AVSTREAM_PARSE_HEADERS; // This is needed to get the pict type which is necessary for generating correct pts. + + if(st->codec->codec_tag==0 && st->codec->height > 0 && st->codec->extradata_size < 1U<<30){ + st->codec->extradata_size+= 9; + st->codec->extradata= av_realloc(st->codec->extradata, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + if(st->codec->extradata) + memcpy(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9); + } + st->codec->height= FFABS(st->codec->height); + // url_fskip(pb, size - 5 * 4); break; case CODEC_TYPE_AUDIO: diff -r 629bcd779fb8 -r a36f9f2eefcb riff.c --- a/riff.c Sat Feb 21 14:40:19 2009 +0000 +++ b/riff.c Sat Feb 21 15:32:56 2009 +0000 @@ -368,7 +368,8 @@ { put_le32(pb, 40 + enc->extradata_size); /* size */ put_le32(pb, enc->width); - put_le32(pb, enc->height); + //We always store RGB TopDown + put_le32(pb, enc->codec_tag ? enc->height : -enc->height); put_le16(pb, 1); /* planes */ put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */