aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2005-12-14 08:02:03 +0000
committerMike Melanson <mike@multimedia.cx>2005-12-14 08:02:03 +0000
commite84a0475257a230828160a327beb7e4b48f79359 (patch)
tree9ffc0cc682d19c5338b8c5e9caa3e35ce376025c
parent0c3ee78f91486919acee57e9f6220dd4e2b611c9 (diff)
downloadffmpeg-e84a0475257a230828160a327beb7e4b48f79359.tar.gz
correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John
Koleszar <jkoleszar at on2.com>) Originally committed as revision 4743 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/qtrle.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index c5161c0774..262dc0e3b5 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -411,7 +411,7 @@ static void qtrle_decode_32bpp(QtrleContext *s)
int rle_code;
int row_ptr, pixel_ptr;
int row_inc = s->frame.linesize[0];
- unsigned char r, g, b;
+ unsigned char a, r, g, b;
unsigned int argb;
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
@@ -455,11 +455,11 @@ static void qtrle_decode_32bpp(QtrleContext *s)
/* decode the run length code */
rle_code = -rle_code;
CHECK_STREAM_PTR(4);
- stream_ptr++; /* skip the alpha (?) byte */
+ a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++];
b = s->buf[stream_ptr++];
- argb = (r << 16) | (g << 8) | (b << 0);
+ argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
CHECK_PIXEL_PTR(rle_code * 4);
@@ -473,11 +473,11 @@ static void qtrle_decode_32bpp(QtrleContext *s)
/* copy pixels directly to output */
while (rle_code--) {
- stream_ptr++; /* skip the alpha (?) byte */
+ a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++];
b = s->buf[stream_ptr++];
- argb = (r << 16) | (g << 8) | (b << 0);
+ argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
*(unsigned int *)(&rgb[pixel_ptr]) = argb;
pixel_ptr += 4;
}