[FFmpeg-devel] [PATCH] iff: support transparency

Peter Ross pross at xvid.org
Sat Jan 14 05:25:14 CET 2012


Fixes ticket 707.

Patch by Carl Eugen Hoyos.
---
 libavcodec/iff.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 7a11d43..c0e4eb4 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -165,6 +165,9 @@ static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
             pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample);
         }
     }
+    if (s->masking == MASK_HAS_TRANSPARENT_COLOR &&
+        s->transparency < 1 << avctx->bits_per_coded_sample)
+        pal[s->transparency] &= 0xFFFFFF;
     return 0;
 }
 
@@ -216,10 +219,7 @@ static int extract_header(AVCodecContext *const avctx,
         s->flags        = bytestream_get_byte(&buf);
         s->transparency = bytestream_get_be16(&buf);
         s->masking      = bytestream_get_byte(&buf);
-        if (s->masking == MASK_HAS_TRANSPARENT_COLOR) {
-            av_log(avctx, AV_LOG_ERROR, "Transparency not supported\n");
-            return AVERROR_PATCHWELCOME;
-        } else if (s->masking != MASK_NONE) {
+        if (s->masking != MASK_NONE && s->masking != MASK_HAS_TRANSPARENT_COLOR) {
             av_log(avctx, AV_LOG_ERROR, "Masking not supported\n");
             return AVERROR_PATCHWELCOME;
         }
-- 
1.7.5.4

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120114/1b0994d9/attachment.asc>


More information about the ffmpeg-devel mailing list