aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-31 17:04:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-03-31 17:47:04 +0200
commit559c8b9ee9659e295ffabb81e0d4623ff57e95e6 (patch)
treeae43396adbf57c68b9ad2c9b1c7b70815c5a2d48 /libavcodec/mjpegdec.c
parent798490812a05471862629b7250674a24575d1291 (diff)
downloadffmpeg-559c8b9ee9659e295ffabb81e0d4623ff57e95e6.tar.gz
avcodec/mjpegdec: support subsampled 420 CMYK
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 43bec98e13..47017ef6ba 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -408,6 +408,19 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
}
av_assert0(s->nb_components == 4);
break;
+ case 0x22111122:
+ if (s->adobe_transform == 0 && s->bits <= 8) {
+ s->avctx->pix_fmt = AV_PIX_FMT_GBRAP;
+ s->upscale_v = 6;
+ s->upscale_h = 6;
+ s->chroma_height = s->height;
+ } else {
+ if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
+ else s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P16;
+ s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
+ }
+ av_assert0(s->nb_components == 4);
+ break;
case 0x12121100:
case 0x22122100:
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
@@ -2039,7 +2052,9 @@ the_end:
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
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_GBRAP
+ );
for (p = 1; p<4; p++) {
uint8_t *line = s->picture_ptr->data[p];
if (!(s->upscale_h & (1<<p)))
@@ -2056,7 +2071,9 @@ the_end:
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
- avctx->pix_fmt == AV_PIX_FMT_YUV422P);
+ avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
+ avctx->pix_fmt == AV_PIX_FMT_GBRAP
+ );
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
for (p = 1; p < 4; p++) {
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[p])[(s->height - 1) * s->linesize[p]];