changeset 21885:d885d65e8dc8

Simplify gif demuxer by using memcpy_pic
author reimar
date Sat, 13 Jan 2007 11:44:36 +0000
parents 7484e767c53d
children 84b9d245ee06
files libmpdemux/demux_gif.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_gif.c	Sat Jan 13 11:40:05 2007 +0000
+++ b/libmpdemux/demux_gif.c	Sat Jan 13 11:44:36 2007 +0000
@@ -17,6 +17,7 @@
 #include "stheader.h"
 
 #include <gif_lib.h>
+#include "libvo/fastmemcpy.h"
 typedef struct {
   int current_pts;
   unsigned char *palette;
@@ -125,6 +126,7 @@
     int t = FFMAX(FFMIN(gif->Image.Top, priv->h), 0);
     int w = FFMAX(FFMIN(gif->Image.Width, priv->w - l), 0);
     int h = FFMAX(FFMIN(gif->Image.Height, priv->h - t), 0);
+    unsigned char *dest = dp->buffer + priv->w * t + l;
 
     // copy the palette
     for (y = 0; y < cnt; y++) {
@@ -134,14 +136,7 @@
 	priv->palette[(y * 4) + 3] = 0;
     }
 
-    for (y = 0; y < h; y++) {
-      unsigned char *drow = dp->buffer;
-      unsigned char *gbuf = buf + (y * gif->Image.Width);
-
-      drow += priv->w * (y + t) + l;
-
-      memcpy(drow, gbuf, w);
-    }
+    memcpy_pic(dest, buf, w, h, priv->w, gif->Image.Width);
   }
 
   free(buf);