changeset 21922:277f0943aa4e

Interlaced gif support
author reimar
date Tue, 16 Jan 2007 07:12:32 +0000
parents e4265d11dc37
children 1658f7d97b27
files libmpdemux/demux_gif.c
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_gif.c	Tue Jan 16 07:05:28 2007 +0000
+++ b/libmpdemux/demux_gif.c	Tue Jan 16 07:12:32 2007 +0000
@@ -167,8 +167,26 @@
       priv->palette[(y * 4) + 3] = 0;
     }
 
-    memcpy_transp_pic(dest, buf, w, h, priv->w, gif->Image.Width,
-                      transparency, transparent_col);
+    if (gif->Image.Interlace) {
+      uint8_t *s = buf;
+      memcpy_transp_pic(dest, s, w, h >> 3,
+                        priv->w << 3, gif->Image.Width,
+                        transparency, transparent_col);
+      s += (h >> 3) * w;
+      memcpy_transp_pic(dest + (gif->Image.Width << 2), s, w, h >> 3,
+                        priv->w << 3, gif->Image.Width,
+                        transparency, transparent_col);
+      s += (h >> 3) * w;
+      memcpy_transp_pic(dest + (gif->Image.Width << 1), s, w, h >> 2,
+                        priv->w << 2, gif->Image.Width,
+                        transparency, transparent_col);
+      s += (h >> 2) * w;
+      memcpy_transp_pic(dest + gif->Image.Width, s, w, h >> 1,
+                        priv->w << 1, gif->Image.Width,
+                        transparency, transparent_col);
+    } else
+      memcpy_transp_pic(dest, buf, w, h, priv->w, gif->Image.Width,
+                        transparency, transparent_col);
 
     if (refmode == 1) memcpy(priv->refimg, dp->buffer, priv->w * priv->h);
     if (refmode == 2 && priv->useref) {