aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-10 18:40:46 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-10 18:40:46 +0200
commit61b9ce00a30c8bb261678d9c210a06b5eefaed7a (patch)
tree27140aa41bced772346eb6eaa2da55049b1eac17 /libavcodec/tiff.c
parent78eaaa857e95fa5542dc008c8ad3664e6ab6801a (diff)
parent2597a842a0a2c7e8aa76f32733d27bf64817ae86 (diff)
downloadffmpeg-61b9ce00a30c8bb261678d9c210a06b5eefaed7a.tar.gz
Merge commit '2597a842a0a2c7e8aa76f32733d27bf64817ae86'
* commit '2597a842a0a2c7e8aa76f32733d27bf64817ae86': tiff: Improve grayscale support Conflicts: libavcodec/tiff.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 5c9823a657..7dab18466c 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -572,8 +572,7 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
static int init_image(TiffContext *s, ThreadFrame *frame)
{
- int i, ret;
- uint32_t *pal;
+ int ret;
switch (s->planar * 1000 + s->bpp * 10 + s->bppcount) {
case 11:
@@ -584,7 +583,7 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
case 21:
case 41:
case 81:
- s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ s->avctx->pix_fmt = s->palette_is_set ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8;
break;
case 243:
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {
@@ -651,14 +650,7 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
if ((ret = ff_thread_get_buffer(s->avctx, frame, 0)) < 0)
return ret;
if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
- if (s->palette_is_set) {
- memcpy(frame->f->data[1], s->palette, sizeof(s->palette));
- } else {
- /* make default grayscale pal */
- pal = (uint32_t *) frame->f->data[1];
- for (i = 0; i < 1<<s->bpp; i++)
- pal[i] = 0xFFU << 24 | i * 255 / ((1<<s->bpp) - 1) * 0x010101;
- }
+ memcpy(frame->f->data[1], s->palette, sizeof(s->palette));
}
return 0;
}