[FFmpeg-devel] [PATCH] Video decoder and demuxer for AMV files
Vladimir Voroshilov
voroshil
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.
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amv_codec_ffmpeg3.patch
Type: text/x-diff
Size: 2862 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070926/76703b9e/attachment.patch>
More information about the ffmpeg-devel
mailing list