diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-25 06:32:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-25 06:32:45 +0200 |
commit | 034fc7bf129152b94958f4b74b9c81590350ce59 (patch) | |
tree | df83c0f966ce07a832588a54dca4e57ba97575be /libavcodec/tiff.c | |
parent | d1adad3cca407f493c3637e20ecd4f7124e69212 (diff) | |
parent | 9bbd6a4cd89da4bfc9fd36fea5777a539a542b40 (diff) | |
download | ffmpeg-034fc7bf129152b94958f4b74b9c81590350ce59.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
configure: enable memalign_hack automatically when needed
swscale: unbreak the build on non-x86 systems.
swscale: remove if(bitexact) branch from functions.
swscale: remove if(canMMX2BeUsed) conditional.
swscale: remove swScale_{c,MMX,MMX2} duplication.
swscale: use emms_c().
Move emms_c() from libavcodec to libavutil.
tiff: set palette in the context when specified in TIFF_PAL tag
rtsp: use strtoul to parse rtptime and seq values.
pgssubdec: fix incorrect colors.
dvdsubdec: fix incorrect colors.
ape: Allow demuxing of files with metadata tags.
swscale: remove dead macro WRITEBGR24OLD.
swscale: remove AMD3DNOW "optimizations".
swscale: remove duplicate code in ppc/ subdirectory.
swscale: remove duplicated x86/ functions.
swscale: force --enable-runtime-cpudetect and remove SWS_CPU_CAPS_*.
vsrc_buffer.h: add file doxy
vsrc_buffer: tweak error message in init()
msmpeg4: reindent.
...
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r-- | libavcodec/tiff.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 683527bedf..c97cb94413 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -39,6 +39,8 @@ typedef struct TiffContext { int width, height; unsigned int bpp, bppcount; + uint32_t palette[256]; + int palette_is_set; int le; enum TiffCompr compr; int invert; @@ -255,11 +257,15 @@ static int init_image(TiffContext *s) av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - if (s->bpp == 8 && s->picture.data[1]){ - /* make default grayscale pal */ - pal = (uint32_t *) s->picture.data[1]; - for (i = 0; i < 256; i++) - pal[i] = i * 0x010101; + if (s->avctx->pix_fmt == PIX_FMT_PAL8) { + if (s->palette_is_set) { + memcpy(s->picture.data[1], s->palette, sizeof(s->palette)); + } else { + /* make default grayscale pal */ + pal = (uint32_t *) s->picture.data[1]; + for (i = 0; i < 256; i++) + pal[i] = i * 0x010101; + } } return 0; } @@ -442,11 +448,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t * s->fill_order = value - 1; break; case TIFF_PAL: - if(s->avctx->pix_fmt != PIX_FMT_PAL8){ - av_log(s->avctx, AV_LOG_ERROR, "Palette met but this is not palettized format\n"); - return -1; - } - pal = (uint32_t *) s->picture.data[1]; + pal = (uint32_t *) s->palette; off = type_sizes[type]; rp = buf; gp = buf + count / 3 * off; @@ -459,6 +461,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t * j |= tget(&bp, type, s->le) >> off; pal[i] = j; } + s->palette_is_set = 1; break; case TIFF_PLANAR: if(value == 2){ |