summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-31 04:49:33 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-31 04:54:26 +0100
commit4392b3d11e9f4b89a53f001ea8576e7da7801b08 (patch)
tree735bc5e0c82db15ddab688edd0d47068d93a3e09 /libavcodec/tiff.c
parent5500e65342a2afc5caa8fe38496aa1a3b1f28cbc (diff)
downloadffmpeg-4392b3d11e9f4b89a53f001ea8576e7da7801b08.tar.gz
tiffdec: hotfix for fate failure.
Only use pal8 as output if the file has a palette or more than 2 colors. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index c313bd7e4a..b353677087 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -161,7 +161,11 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
}
src = zbuf;
for(line = 0; line < lines; line++){
- horizontal_fill(s->bpp, dst, 1, src, 0, width, 0);
+ if(s->bpp < 8 && s->avctx->pix_fmt == PIX_FMT_PAL8){
+ horizontal_fill(s->bpp, dst, 1, src, 0, width, 0);
+ }else{
+ memcpy(dst, src, width);
+ }
dst += stride;
src += width;
}
@@ -202,7 +206,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts);
break;
}
- if (s->bpp < 8)
+ if (s->bpp < 8 && s->avctx->pix_fmt == PIX_FMT_PAL8)
for (line = 0; line < lines; line++) {
horizontal_fill(s->bpp, dst, 1, dst, 0, width, 0);
dst += stride;
@@ -258,7 +262,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width);
return -1;
}
- if (s->bpp < 8)
+ if (s->bpp < 8 && s->avctx->pix_fmt == PIX_FMT_PAL8)
horizontal_fill(s->bpp, dst, 1, dst, 0, width, 0);
break;
}
@@ -274,6 +278,10 @@ static int init_image(TiffContext *s)
switch (s->bpp * 10 + s->bppcount) {
case 11:
+ if (!s->palette_is_set) {
+ s->avctx->pix_fmt = PIX_FMT_MONOBLACK;
+ break;
+ }
case 21:
case 41:
case 81: