]> git.sesse.net Git - ffmpeg/commitdiff
grayscale mjpeg decoding support based upon a patch by (Leon Bottou (leonb))
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Jan 2004 19:54:12 +0000 (19:54 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Jan 2004 19:54:12 +0000 (19:54 +0000)
Originally committed as revision 2687 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mjpeg.c

index a8dbc2bbd444ff6f2997b75a201adac35e3c0a78..eeb177399c06c130a432a70b0c2742851b82df54 100644 (file)
@@ -1052,8 +1052,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
     case 0x11:
         if(s->rgb){
             s->avctx->pix_fmt = PIX_FMT_RGBA32;
-        }else
+        }else if(s->nb_components==3)
             s->avctx->pix_fmt = PIX_FMT_YUV444P;
+        else
+            s->avctx->pix_fmt = PIX_FMT_GRAY8;
         break;
     case 0x21:
         s->avctx->pix_fmt = PIX_FMT_YUV422P;
@@ -1372,7 +1374,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
        return -1;
     }
     /* XXX: only interleaved scan accepted */
-    if (nb_components != 3)
+    if (nb_components != s->nb_components)
     {
        dprintf("decode_sos: components(%d) mismatch\n", nb_components);
         return -1;