Commit 731316e5 authored by stefano's avatar stefano

Make the pal2rgbWrapper set and use the converter in pal2rgbWrapper

only if the input format is paletted.

Fix potential crashes/weirdness if the input format is non-paletted.


git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@30358 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 98634327
...@@ -2035,7 +2035,7 @@ static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], ...@@ -2035,7 +2035,7 @@ static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[],
if (!usePal(srcFormat)) if (!usePal(srcFormat))
av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat)); sws_format_name(srcFormat), sws_format_name(dstFormat));
else {
switch(dstFormat) { switch(dstFormat) {
case PIX_FMT_RGB32 : conv = palette8topacked32; break; case PIX_FMT_RGB32 : conv = palette8topacked32; break;
case PIX_FMT_BGR32 : conv = palette8topacked32; break; case PIX_FMT_BGR32 : conv = palette8topacked32; break;
...@@ -2046,8 +2046,9 @@ static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], ...@@ -2046,8 +2046,9 @@ static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[],
default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat)); break; sws_format_name(srcFormat), sws_format_name(dstFormat)); break;
} }
}
if (conv)
for (i=0; i<srcSliceH; i++) { for (i=0; i<srcSliceH; i++) {
conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb); conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb);
srcPtr+= srcStride[0]; srcPtr+= srcStride[0];
......
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