[FFmpeg-cvslog] iff: set ham palette alpha to 0xFF

Peter Ross git at videolan.org
Mon Jul 23 14:06:53 CEST 2012


ffmpeg | branch: master | Peter Ross <pross at xvid.org> | Mon Jul 23 14:04:47 2012 +0200| [cc12a94c364fca9c371c3e5da7a462655c7e1f2d] | committer: Carl Eugen Hoyos

iff: set ham palette alpha to 0xFF

This addresses the problem that some HAM pictures were decoded with
complete transparency as described in the 'iff: ANIM suppport ' thread
on ffmpeg-devel. The decoder was already setting alpha correctly for
CMAP palettes, just not HAM palettes.

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

 libavcodec/iff.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 57ce570..6f11f58 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -280,25 +280,25 @@ static int extract_header(AVCodecContext *const avctx,
                 // prefill with black and palette and set HAM take direct value mask to zero
                 memset(s->ham_palbuf, 0, (1 << s->ham) * 2 * sizeof (uint32_t));
                 for (i=0; i < count; i++) {
-                    s->ham_palbuf[i*2+1] = AV_RL24(palette + i*3);
+                    s->ham_palbuf[i*2+1] = 0xFF000000 | AV_RL24(palette + i*3);
                 }
                 count = 1 << s->ham;
             } else { // HAM with grayscale color palette
                 count = 1 << s->ham;
                 for (i=0; i < count; i++) {
-                    s->ham_palbuf[i*2]   = 0; // take direct color value from palette
-                    s->ham_palbuf[i*2+1] = av_le2ne32(gray2rgb((i * 255) >> s->ham));
+                    s->ham_palbuf[i*2]   = 0xFF000000; // take direct color value from palette
+                    s->ham_palbuf[i*2+1] = 0xFF000000 | av_le2ne32(gray2rgb((i * 255) >> s->ham));
                 }
             }
             for (i=0; i < count; i++) {
                 uint32_t tmp = i << (8 - s->ham);
                 tmp |= tmp >> s->ham;
-                s->ham_palbuf[(i+count)*2]     = 0x00FFFF; // just modify blue color component
-                s->ham_palbuf[(i+count*2)*2]   = 0xFFFF00; // just modify red color component
-                s->ham_palbuf[(i+count*3)*2]   = 0xFF00FF; // just modify green color component
-                s->ham_palbuf[(i+count)*2+1]   = tmp << 16;
-                s->ham_palbuf[(i+count*2)*2+1] = tmp;
-                s->ham_palbuf[(i+count*3)*2+1] = tmp << 8;
+                s->ham_palbuf[(i+count)*2]     = 0xFF00FFFF; // just modify blue color component
+                s->ham_palbuf[(i+count*2)*2]   = 0xFFFFFF00; // just modify red color component
+                s->ham_palbuf[(i+count*3)*2]   = 0xFFFF00FF; // just modify green color component
+                s->ham_palbuf[(i+count)*2+1]   = 0xFF000000 | tmp << 16;
+                s->ham_palbuf[(i+count*2)*2+1] = 0xFF000000 | tmp;
+                s->ham_palbuf[(i+count*3)*2+1] = 0xFF000000 | tmp << 8;
             }
             if (s->masking == MASK_HAS_MASK) {
                 for (i = 0; i < ham_count; i++)



More information about the ffmpeg-cvslog mailing list