[FFmpeg-devel] [PATCH] Fix Raw rgb/bgr Vertical Flip in AviSynth
Mon Aug 31 10:23:49 CEST 2009
On Sun, Aug 30, 2009 at 08:19:21PM -0700, Josh Harris wrote:
> on 8/29/2009 5:46 AM Reimar D?ffinger wrote:
> > On Sun, Aug 23, 2009 at 11:39:50PM -0700, Josh Harris wrote:
> >> + 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);
> >> + }
> > Why all the mess? It seems to me that extradata is never set, so why use
> > realloc etc.? Similar to r19698 should be enough I think.
> To be honest, I don't know...Code was commited (r17475) to
> libavformat/avidec.c to handle this for AVIs (
> ) on 2009-02-21 and it was written using codec_tag and realloc. I just
> copied it from there.
Yes, but avidec is avidec. It already has extradata. Mindlessly copying
code is rarely going to give good results. Or to say it differently: if
you want to copy, please copy from mtv.c
> >> + st->codec->height = FFABS(st->codec->height);
> > Is there a sample for that (height < 0)?
> For AviSynth scripts, not that I know of, so I guess the FFABS line can
> be considered unnecessary but it seems like good practice to leave it
> in. The problem is that the code commited in r17475 to
> libavcodec/rawdec.c assumes TopDown for raw RGB data unless
> st->codec->extradata is set with BottomUp. This means that AviSynth
> RGB24 and RGB32 scripts are currently being decoded upside down.
Which seems to have nothing at all to do with height < 0? There is no
question that you can add and FFABS, but besides that it should be done
where st->codec->height is assigned instead of with an extra line of
code, "can" alone is hardly a good reason to "do".
More information about the ffmpeg-devel