[FFmpeg-cvslog] tiffdec: use correct data type for palette entries and set alpha to 0xFF

Justin Ruggles git at videolan.org
Sun Apr 13 02:05:17 CEST 2014


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sat Sep 28 12:20:19 2013 -0400| [58bc38a5f224d29b79338200459792c765c25fd5] | committer: Justin Ruggles

tiffdec: use correct data type for palette entries and set alpha to 0xFF

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58bc38a5f224d29b79338200459792c765c25fd5
---

 libavcodec/tiff.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9f8bc60b..382f72c 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -321,7 +321,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
                            const uint8_t *buf, const uint8_t *end_buf)
 {
     unsigned tag, type, count, off, value = 0;
-    int i, j;
+    int i;
     uint32_t *pal;
     const uint8_t *rp, *gp, *bp;
 
@@ -527,10 +527,11 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
         bp  = buf + count / 3 * off * 2;
         off = (type_sizes[type] - 1) << 3;
         for (i = 0; i < count / 3; i++) {
-            j      = (tget(&rp, type, s->le) >> off) << 16;
-            j     |= (tget(&gp, type, s->le) >> off) << 8;
-            j     |= tget(&bp, type, s->le) >> off;
-            pal[i] = j;
+            uint32_t p = 0xFF000000;
+            p |= (tget(&rp, type, s->le) >> off) << 16;
+            p |= (tget(&gp, type, s->le) >> off) << 8;
+            p |=  tget(&bp, type, s->le) >> off;
+            pal[i] = p;
         }
         s->palette_is_set = 1;
         break;



More information about the ffmpeg-cvslog mailing list