changeset 30316:93e7fdf664a7

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.
author stefano
date Sun, 17 Jan 2010 23:00:01 +0000
parents 826b65c76d03
children 67b85934c374
files libswscale/swscale.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Sun Jan 17 19:26:35 2010 +0000
+++ b/libswscale/swscale.c	Sun Jan 17 23:00:01 2010 +0000
@@ -2035,7 +2035,7 @@
     if (!usePal(srcFormat))
         av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
                sws_format_name(srcFormat), sws_format_name(dstFormat));
-
+    else {
     switch(dstFormat) {
     case PIX_FMT_RGB32  : conv = palette8topacked32; break;
     case PIX_FMT_BGR32  : conv = palette8topacked32; break;
@@ -2046,8 +2046,9 @@
     default: av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
                     sws_format_name(srcFormat), sws_format_name(dstFormat)); break;
     }
-
-
+    }
+
+    if (conv)
     for (i=0; i<srcSliceH; i++) {
         conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb);
         srcPtr+= srcStride[0];