avcodec/mjpegenc_common: do not ignore the color_range field
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 10 Aug 2015 15:35:31 +0000 (17:35 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 10 Aug 2015 15:48:43 +0000 (17:48 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mjpegenc_common.c

index 2fccae3..64e1425 100644 (file)
@@ -145,9 +145,10 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
         AV_WB16(ptr, size);
     }
 
-    if (avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
-        avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
-        avctx->pix_fmt == AV_PIX_FMT_YUV444P) {
+    if (((avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
+          avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
+          avctx->pix_fmt == AV_PIX_FMT_YUV444P) && avctx->color_range != AVCOL_RANGE_JPEG)
+        || avctx->color_range == AVCOL_RANGE_MPEG) {
         put_marker(p, COM);
         flush_put_bits(p);
         ptr = put_bits_ptr(p);