aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-09-07 00:17:02 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-09-07 01:10:14 +0200
commitd898ab90901525f048baa58173b62eebc6791807 (patch)
tree5c876f79d0d19975f0d469a8300b3dfad3a40e6b
parentf863cdef813e51d5850e2386618feafe197f06f4 (diff)
downloadffmpeg-d898ab90901525f048baa58173b62eebc6791807.tar.gz
Fix decoding of 2/4 bpp Tiff samples.
-rw-r--r--libavcodec/tiff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 1997e54ef7..e2c80eff82 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];
}
}