[Ffmpeg-devel] libswscale and vertically flipped images

Luca Abeni lucabe72
Thu Jan 11 16:45:28 CET 2007

Hi Michael,

On Tue, 2007-01-09 at 21:18 +0100, Michael Niedermayer wrote:
> > My understanding is that the only difference between sws_scale() and
> > sws_scale_ordered() should be that the second one does not reorder the U
> > and V planes 
> yes
> > (but since mplayer always provides ordered planes to
> > libswscale, it should be useless to have both sws_scale() and
> > sws_scale_ordered()).
> yes, seems so ...
> > So, I would be tempted to say that introducing
> > support for negative line sizes in sws_scale_ordered() only was an
> > error... And that such code should be copied in sws_scale() too.
> yes
> and one of them, as they are identical then could be marked deprecated
Ok. I while doing this, I initially wanted to do some cleanup of this
code, but then I decided to go for the simplest patch. If cleanups are
needed, we can do them later.

The first attached patch adds support for negative linesizes in
sws_scale() (using the sws_scale_ordered() code), and the second one
deprecates sws_scale_ordered(). In the next days, I'll provide a patch
removing all the sws_scale_ordered() calls from mplayer.

BTW: I had an avi file that showed the problem by causing a negative
linesize, but I cannot find it anymore (or maybe some code changed in
the meanwhile)... The only way I can trigger the "vertical flip" problem
right now is by using .mtv files, after removing the last commit in
So, I do not know if I should apply the patches now, or I should wait
until someone provides a file that can reproduce the problem.

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sws_negative_linesize-2.diff
Type: text/x-patch
Size: 1600 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070111/94516a16/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deprecate_sws_scale_ordered-1.diff
Type: text/x-patch
Size: 993 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070111/94516a16/attachment-0001.bin>

More information about the ffmpeg-devel mailing list