[FFmpeg-devel] [PATCH] avformat/avidec: ensure that palette does not contain the BottomUp info.

Benoit Fouet benoit.fouet at free.fr
Tue Sep 23 10:19:17 CEST 2014


Hi,

----- Mail original -----
> Hi,
> 
> ----- Mail original -----
> 
> [...]
> 
> > > > >  avienc.c |    7 +++++++
> > > > >  1 file changed, 7 insertions(+)
> > > > > 8ae96276e07eb00474ab2115f9ff9c3d0f690723  avienc.diff
> > > > > diff --git a/libavformat/avienc.c b/libavformat/avienc.c
> > > > > index c9d8b7f..2855293 100644
> > > > > --- a/libavformat/avienc.c
> > > > > +++ b/libavformat/avienc.c
> > > > > @@ -299,6 +299,13 @@ static int
> > > > > avi_write_header(AVFormatContext
> > > > > *s)
> > > > >          avio_wl32(pb, au_ssize); /* sample size */
> > > > >          avio_wl32(pb, 0);
> > > > >          avio_wl16(pb, enc->width);
> > > > > +        if (   enc->extradata_size >= 9
> > > > > +            && !memcmp(enc->extradata + enc->extradata_size
> > > > > -
> > > > > 9,
> > > > > "BottomUp", 9)) {
> > > > > +            enc->height = -enc->height;
> > > > 
> > > > i think its safer not to change AVCodecContext.height and just
> > > > change
> > > > the in the bitstream stored value instead
> > > > 
> > > 
> > > The issue when doing this is that the BITMAPINFOHEADER is wrong.
> > > So the image is still flipped.
> > 
> > Well then you need a local variable/array or value in the avi muxer
> > context. values in AVCodecContext shouldnt really be randomly
> > be overwritten by the muxer
> > 
> 
> The only thing that is needed is to extend ff_put_bmp_header, so that
> it can be asked to negate height in the BITMAPINFOHEADER header.
> Would that be OK?
> 

Here is a patch to illustrate this...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-riffenc-extend-ff_put_bmp_header-to-be-able.patch
Type: text/x-patch
Size: 5742 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140923/6268e867/attachment.bin>


More information about the ffmpeg-devel mailing list