[FFmpeg-cvslog] Fix decoding of 2/4 bpp Tiff samples.

Carl Eugen Hoyos git at videolan.org
Wed Sep 7 01:11:32 CEST 2011


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Wed Sep  7 00:17:02 2011 +0200| [d898ab90901525f048baa58173b62eebc6791807] | committer: Carl Eugen Hoyos

Fix decoding of 2/4 bpp Tiff samples.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d898ab90901525f048baa58173b62eebc6791807
---

 libavcodec/tiff.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 1997e54..e2c80ef 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[i] = i * 255 / ((1<<s->bpp) - 1) * 0x010101;
         }
     }
     return 0;
@@ -615,7 +615,7 @@ static int decode_frame(AVCodecContext *avctx,
         src = s->picture.data[0];
         for(j = 0; j < s->height; j++){
             for(i = 0; i < s->picture.linesize[0]; i++)
-                src[i] = 255 - src[i];
+                src[i] = (s->avctx->pix_fmt == PIX_FMT_PAL8 ? (1<<s->bpp) - 1 : 255) - src[i];
             src += s->picture.linesize[0];
         }
     }



More information about the ffmpeg-cvslog mailing list