diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index 3e1cea6..64793db 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -93,7 +93,12 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
             avctx->pix_fmt = PIX_FMT_MONOWHITE;
             break;
         case 8:
-            avctx->pix_fmt = PIX_FMT_PAL8;
+            /*
+            if(!grayscale)
+                avctx->pix_fmt = PIX_FMT_PAL8;
+            else
+            */
+                avctx->pix_fmt = PIX_FMT_GRAY8;
             break;
         case 24:
             avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
@@ -121,8 +126,8 @@ 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) {
-        unsigned int len = maplength / 3;
+    } else if (depth == 8 /*&& !grayscale */) {
+/*        unsigned int len = maplength / 3;
 
         if (!maplength) {
             av_log(avctx, AV_LOG_ERROR, "colormap expected\n");
@@ -136,6 +141,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
         ptr = p->data[1];
         for (x=0; x<len; x++, ptr+=4)
             *(uint32_t *)ptr = (0xFF<<24) + (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
+*/
     }
 
     buf += maplength;
