Fix upside-down picture for BGR24 images (fixes pig-loco-rgb.avi)
authorJindřich Makovička <makovick@gmail.com>
Fri, 8 Apr 2005 21:34:48 +0000 (21:34 +0000)
committerRoberto Togni <r_togni@tiscali.it>
Fri, 8 Apr 2005 21:34:48 +0000 (21:34 +0000)
Patch by Jindrich Makovicka

Originally committed as revision 4112 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/loco.c

index a012554..6f90c1e 100644 (file)
@@ -195,14 +195,14 @@ static int decode_frame(AVCodecContext *avctx,
                                     p->linesize[1], buf, buf_size, 1);
         break;
     case LOCO_CRGB: case LOCO_RGB:
-        decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 3);
+        decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1), avctx->width, avctx->height,
+                                    -p->linesize[0], buf, buf_size, 3);
         buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + 1, avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 3);
+        decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 1, avctx->width, avctx->height,
+                                    -p->linesize[0], buf, buf_size, 3);
         buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + 2, avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 3);
+        decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 2, avctx->width, avctx->height,
+                                    -p->linesize[0], buf, buf_size, 3);
         break;
     case LOCO_RGBA:
         decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,