[FFmpeg-devel] [PATCH]Fix tiff grayscale palette

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Aug 29 09:42:37 CEST 2011


Hi!

Fixes ticket 417.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 1997e54..ab67ea5 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -294,8 +294,8 @@ static int init_image(TiffContext *s)
         } else {
             /* make default grayscale pal */
             pal = (uint32_t *) s->picture.data[1];
-            for (i = 0; i < 256; i++)
-                pal[i] = i * 0x010101;
+            for (i = 0; i < 1<<s->bpp; i++)
+                pal[256 - (1<<s->bpp) + i] = i * 255 / ((1<<s->bpp) - 1) * 0x010101;
         }
     }
     return 0;


More information about the ffmpeg-devel mailing list