aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-13 03:54:11 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-13 03:54:11 +0200
commita64d6d5152189fce84bded8c73af5b49d6657cce (patch)
tree1bce125c970a611818911b5760403e6652b930e4
parentb9b2f9d218bad3001edc64704865987fd7cf7dca (diff)
parent345a96c327e8f2a8077189af9f5e8d2b3f4ad5fe (diff)
downloadffmpeg-a64d6d5152189fce84bded8c73af5b49d6657cce.tar.gz
Merge commit '345a96c327e8f2a8077189af9f5e8d2b3f4ad5fe'
* commit '345a96c327e8f2a8077189af9f5e8d2b3f4ad5fe': tiffdec: remove an unneeded variable Conflicts: libavcodec/tiff.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/tiff.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index c5891d4d70..d864521b36 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -595,7 +595,6 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
int i, start;
int j, k, pos;
int ret;
- uint32_t *pal;
double *dp;
ret = ff_tread_tag(&s->gb, s->le, &tag, &type, &count, &start);
@@ -781,20 +780,23 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
s->fill_order = value - 1;
break;
case TIFF_PAL: {
- pal = (uint32_t *) s->palette;
+ GetByteContext pal_gb[3];
off = type_sizes[type];
if (count / 3 > 256 ||
bytestream2_get_bytes_left(&s->gb) < count / 3 * off * 3)
return AVERROR_INVALIDDATA;
+ pal_gb[0] = pal_gb[1] = pal_gb[2] = s->gb;
+ bytestream2_skip(&pal_gb[1], count / 3 * off);
+ bytestream2_skip(&pal_gb[2], count / 3 * off * 2);
+
off = (type_sizes[type] - 1) << 3;
- for (k = 2; k >= 0; k--) {
- for (i = 0; i < count / 3; i++) {
- if (k == 2)
- pal[i] = 0xFFU << 24;
- j = (ff_tget(&s->gb, type, s->le) >> off) << (k * 8);
- pal[i] |= j;
- }
+ for (i = 0; i < count / 3; i++) {
+ uint32_t p = 0xFF000000;
+ p |= (ff_tget(&pal_gb[0], type, s->le) >> off) << 16;
+ p |= (ff_tget(&pal_gb[1], type, s->le) >> off) << 8;
+ p |= ff_tget(&pal_gb[2], type, s->le) >> off;
+ s->palette[i] = p;
}
s->palette_is_set = 1;
break;