[FFmpeg-devel] [PATCH]Fix palette in ipmovie

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Dec 24 03:15:08 CET 2011


Hi!

Attached patch fixes the palette in interplay files.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 24dc24b..db4ef5e 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -450,13 +450,15 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
                 break;
             }
             j = 4;  /* offset of first palette data */
+            s->palette[0] = 0xFF << 24;
             for (i = first_color; i <= last_color; i++) {
                 /* the palette is stored as a 6-bit VGA palette, thus each
                  * component is shifted up to a 8-bit range */
                 r = scratch[j++] * 4;
                 g = scratch[j++] * 4;
                 b = scratch[j++] * 4;
-                s->palette[i] = (r << 16) | (g << 8) | (b);
+                s->palette[i] = (0xFF << 24) | (r << 16) | (g << 8) | (b);
+                s->palette[i] |= s->palette[i] >> 6 & 0x30303;
             }
             s->has_palette = 1;
             break;


More information about the ffmpeg-devel mailing list