[FFmpeg-devel] [PATCH] Video decoder and demuxer for AMV files
Wed Sep 26 12:18:27 CEST 2007
2007/9/26, Aurelien Jacobs <aurel at gnuage.org>:
> Vladimir Voroshilov wrote:
> > I forget to say that resulting image is flipped upside-down.
> > Please anybody help me with fixing this.
> Short answer: negative stride
> Longer answer: Look at this code from mjpeg_decode_scan():
> ptr = s->picture.data[c] +
> (((s->linesize[c] * (v * mb_y + y) * 8) +
> (h * mb_x + x) * 8) >> s->avctx->lowres);
> To flip the image upside-down, s->picture.data[c] need to be
> replaced by a pointer to (s->picture.data[c] + size of the image
> buffer - size of one line), and s->linesize[c] must be negative.
> That's the basic principle. You will probably need to do other
> small related changes. And ensure that the code still behave
> the same way as it does now for other mjpeg codecs.
Thanks you for info!
I modified mjpeg_decode_scan routine.
Now decoder produces correct (not flipped) picture.
All code enclosed into codec id check, thus there should not be any
problems with other mjpeg codecs.
Updated patch is attached.
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2862 bytes
Desc: not available
More information about the ffmpeg-devel