[FFmpeg-devel] [PATCH] Fix Raw rgb/bgr Vertical Flip in AviSynth

Michael Niedermayer michaelni
Mon Aug 24 12:20:08 CEST 2009


On Sun, Aug 23, 2009 at 11:39:50PM -0700, Josh Harris wrote:
> On Sat, 21 Feb 2009 15:32:56 +0000 (15:32 +0000) a patch was committed:
> "Fix raw rgb/bgr vertical flip in avi based on info from
> fourcc.org/fccbihgt.php. partially fixes issue862."  This has broken RGB
> input from Avisynth files, as they are now decoded upside down.  Taking
> some code from libavformat/avidec.c and applying it to
> libavformat/avisynth.c seems to fix the issue.
> 
> The problem can be demonstrated with the following (it will produce an
> avi with the video flipped vertically):
> ffmpeg -i bars.avs -vcodec rawvideo -pix_fmt bgr24 bars_bgr24.avi
> 
> bars.avs is a script with:
> ColorBars(320,240).KillAudio().ConvertToRGB24().Trim(0,29)
> 
> A patch for libavformat/avisynth.c is attached.
> 
> Issue862 can be viewed here:
> http://roundup.ffmpeg.org/roundup/ffmpeg/issue862
> 
> The original commit for issue862 can be viewed here:
> http://git.ffmpeg.org/?p=ffmpeg;a=commit;h=cc20568d95771d82b3c19da1779c59d4d84cf6fb
> 

>  avisynth.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> efcd8a5b3539b2482b916af8f3263268bcaa5e70  avisynth_r19254_rgb_flip.diff
> Index: libavformat/avisynth.c
> ===================================================================
> --- libavformat/avisynth.c	(revision 19254)
> +++ libavformat/avisynth.c	(working copy)
> @@ -124,6 +124,14 @@
>                    st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression);
>  
>                    st->duration = stream->info.dwLength;
> +
> +                  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);
>                  }
>                else
>                  {

your new code is indenteted differently than the existing
except that id say it does look ok

though it seems we lack a maintainer for this file, i have no means to test
this code so iam definitly not a good choice as maintainer for it ...
volunteers are welcome

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090824/f448d77b/attachment.pgp>



More information about the ffmpeg-devel mailing list