OSDN Git Service

sunrast: Add support for gray8 decoding.
authorAneesh Dogra <lionaneesh@gmail.com>
Sat, 11 Feb 2012 05:12:45 +0000 (10:42 +0530)
committerRonald S. Bultje <rsbultje@gmail.com>
Sat, 11 Feb 2012 19:05:43 +0000 (11:05 -0800)
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavcodec/sunrast.c

index 601ba6e..f03f24c 100644 (file)
@@ -112,7 +112,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
             avctx->pix_fmt = PIX_FMT_MONOWHITE;
             break;
         case 8:
-            avctx->pix_fmt = PIX_FMT_PAL8;
+            avctx->pix_fmt = maplength ? PIX_FMT_PAL8 : PIX_FMT_GRAY8;
             break;
         case 24:
             avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
@@ -140,13 +140,9 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
     if (depth != 8 && maplength) {
         av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");
 
-    } else if (depth == 8) {
+    } else if (maplength) {
         unsigned int len = maplength / 3;
 
-        if (!maplength) {
-            av_log(avctx, AV_LOG_ERROR, "colormap expected\n");
-            return -1;
-        }
         if (maplength % 3 || maplength > 768) {
             av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
             return -1;