Commit 909678c7 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

grayscale mjpeg decoding support based upon a patch by (Leon Bottou (leonb))

Originally committed as revision 2687 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8f2ab833
...@@ -1052,8 +1052,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -1052,8 +1052,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
case 0x11: case 0x11:
if(s->rgb){ if(s->rgb){
s->avctx->pix_fmt = PIX_FMT_RGBA32; s->avctx->pix_fmt = PIX_FMT_RGBA32;
}else }else if(s->nb_components==3)
s->avctx->pix_fmt = PIX_FMT_YUV444P; s->avctx->pix_fmt = PIX_FMT_YUV444P;
else
s->avctx->pix_fmt = PIX_FMT_GRAY8;
break; break;
case 0x21: case 0x21:
s->avctx->pix_fmt = PIX_FMT_YUV422P; s->avctx->pix_fmt = PIX_FMT_YUV422P;
...@@ -1372,7 +1374,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s) ...@@ -1372,7 +1374,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
return -1; return -1;
} }
/* XXX: only interleaved scan accepted */ /* XXX: only interleaved scan accepted */
if (nb_components != 3) if (nb_components != s->nb_components)
{ {
dprintf("decode_sos: components(%d) mismatch\n", nb_components); dprintf("decode_sos: components(%d) mismatch\n", nb_components);
return -1; return -1;
......
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