Commit 42434157 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mjpegdec: Support some subsampled GBR variants

Fixes Ticket4045
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 0b75b6c3
...@@ -492,15 +492,29 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -492,15 +492,29 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
case 0x14121200: case 0x14121200:
case 0x22211100: case 0x22211100:
case 0x22112100: case 0x22112100:
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P; if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') {
else if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
goto unk_pixfmt; else
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; goto unk_pixfmt;
s->upscale_v |= 3;
} else {
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P;
else
goto unk_pixfmt;
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
}
break; break;
case 0x21111100: case 0x21111100:
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') {
else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; else
goto unk_pixfmt;
s->upscale_h |= 3;
} else {
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
}
break; break;
case 0x22121100: case 0x22121100:
case 0x22111200: case 0x22111200:
...@@ -2094,6 +2108,7 @@ the_end: ...@@ -2094,6 +2108,7 @@ the_end:
avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P16|| avctx->pix_fmt == AV_PIX_FMT_YUV420P16||
avctx->pix_fmt == AV_PIX_FMT_GBRP ||
avctx->pix_fmt == AV_PIX_FMT_GBRAP avctx->pix_fmt == AV_PIX_FMT_GBRAP
); );
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
...@@ -2132,6 +2147,7 @@ the_end: ...@@ -2132,6 +2147,7 @@ the_end:
avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
avctx->pix_fmt == AV_PIX_FMT_YUVA444P || avctx->pix_fmt == AV_PIX_FMT_YUVA444P ||
avctx->pix_fmt == AV_PIX_FMT_GBRP ||
avctx->pix_fmt == AV_PIX_FMT_GBRAP avctx->pix_fmt == AV_PIX_FMT_GBRAP
); );
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
......
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