Commit ec33f59f authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mjpegdec: Support pix_fmt_id== 0x42111100

Fixes: 538782_300.jpg
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent cf3a038f
...@@ -494,9 +494,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) ...@@ -494,9 +494,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->upscale_v = 2 << (pix_fmt_id == 0x22121100); s->upscale_v = 2 << (pix_fmt_id == 0x22121100);
break; break;
case 0x22111100: case 0x22111100:
case 0x42111100:
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P;
else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
if (pix_fmt_id == 0x42111100) {
s->upscale_h = 6;
s->chroma_height = s->height / 2;
}
break; break;
case 0x41111100: case 0x41111100:
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P; if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P;
...@@ -2060,14 +2065,19 @@ the_end: ...@@ -2060,14 +2065,19 @@ the_end:
avctx->pix_fmt == AV_PIX_FMT_YUVJ440P || avctx->pix_fmt == AV_PIX_FMT_YUVJ440P ||
avctx->pix_fmt == AV_PIX_FMT_YUV440P || avctx->pix_fmt == AV_PIX_FMT_YUV440P ||
avctx->pix_fmt == AV_PIX_FMT_YUVA444P || avctx->pix_fmt == AV_PIX_FMT_YUVA444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
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);
for (p = 1; p<4; p++) { for (p = 1; p<4; p++) {
uint8_t *line = s->picture_ptr->data[p]; uint8_t *line = s->picture_ptr->data[p];
int w;
if (!(s->upscale_h & (1<<p))) if (!(s->upscale_h & (1<<p)))
continue; continue;
w = s->width >> hshift;
for (i = 0; i < s->chroma_height; i++) { for (i = 0; i < s->chroma_height; i++) {
for (index = s->width - 1; index; index--) for (index = w - 1; index; index--)
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1; line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
line += s->linesize[p]; line += s->linesize[p];
} }
......
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