diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-03-12 10:53:21 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-03-16 23:31:30 +0100 |
commit | 1c1fbc70cae44c10af8ff865826e31c17bc9f347 (patch) | |
tree | 1864a3ecaae5572f2cab9657cf1d76cea0b8788a | |
parent | 6612a03d7470af4aa6b8aa313b1eff013691d181 (diff) | |
download | ffmpeg-1c1fbc70cae44c10af8ff865826e31c17bc9f347.tar.gz |
mjpeg: set color_range
-rw-r--r-- | libavcodec/mjpegdec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 8210fd3f00..b1192c58c0 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -338,8 +338,10 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) case 0x11111100: if (s->rgb) s->avctx->pix_fmt = AV_PIX_FMT_BGRA; - else + else { s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; + s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; + } assert(s->nb_components == 3); break; case 0x11000000: @@ -347,12 +349,15 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) break; case 0x12111100: s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P; + s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x21111100: s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; + s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22111100: s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; + s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; default: av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id); |