Commit e8058b85 authored by melanson's avatar melanson

correctly deal with the alpha channel in 32-bit QT RLE (courtesy of John

Koleszar <jkoleszar at on2.com>)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4743 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 217fc328
...@@ -411,7 +411,7 @@ static void qtrle_decode_32bpp(QtrleContext *s) ...@@ -411,7 +411,7 @@ static void qtrle_decode_32bpp(QtrleContext *s)
int rle_code; int rle_code;
int row_ptr, pixel_ptr; int row_ptr, pixel_ptr;
int row_inc = s->frame.linesize[0]; int row_inc = s->frame.linesize[0];
unsigned char r, g, b; unsigned char a, r, g, b;
unsigned int argb; unsigned int argb;
unsigned char *rgb = s->frame.data[0]; unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height; int pixel_limit = s->frame.linesize[0] * s->avctx->height;
...@@ -455,11 +455,11 @@ static void qtrle_decode_32bpp(QtrleContext *s) ...@@ -455,11 +455,11 @@ static void qtrle_decode_32bpp(QtrleContext *s)
/* decode the run length code */ /* decode the run length code */
rle_code = -rle_code; rle_code = -rle_code;
CHECK_STREAM_PTR(4); CHECK_STREAM_PTR(4);
stream_ptr++; /* skip the alpha (?) byte */ a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++]; r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++]; g = s->buf[stream_ptr++];
b = 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); CHECK_PIXEL_PTR(rle_code * 4);
...@@ -473,11 +473,11 @@ static void qtrle_decode_32bpp(QtrleContext *s) ...@@ -473,11 +473,11 @@ static void qtrle_decode_32bpp(QtrleContext *s)
/* copy pixels directly to output */ /* copy pixels directly to output */
while (rle_code--) { while (rle_code--) {
stream_ptr++; /* skip the alpha (?) byte */ a = s->buf[stream_ptr++];
r = s->buf[stream_ptr++]; r = s->buf[stream_ptr++];
g = s->buf[stream_ptr++]; g = s->buf[stream_ptr++];
b = 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; *(unsigned int *)(&rgb[pixel_ptr]) = argb;
pixel_ptr += 4; pixel_ptr += 4;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment