Merge commit 'd7705be9617ed691c7a2924a2088de2d96f38af1'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Jun 2014 00:57:08 +0000 (02:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Jun 2014 00:57:08 +0000 (02:57 +0200)
* commit 'd7705be9617ed691c7a2924a2088de2d96f38af1':
  mpegvideoenc: check color_range

Conflicts:
libavcodec/mpegvideo_enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/mpegvideo_enc.c

@@@ -260,14 -243,21 +260,25 @@@ av_cold int ff_MPV_encode_init(AVCodecC
          }
          break;
      case AV_CODEC_ID_MJPEG:
-         if (avctx->pix_fmt != AV_PIX_FMT_YUVJ420P &&
-             avctx->pix_fmt != AV_PIX_FMT_YUVJ422P &&
-             avctx->pix_fmt != AV_PIX_FMT_YUVJ444P &&
-             ((avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
-               avctx->pix_fmt != AV_PIX_FMT_YUV422P &&
-               avctx->pix_fmt != AV_PIX_FMT_YUV444P) ||
-              avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)) {
 +    case AV_CODEC_ID_AMV:
 -              avctx->pix_fmt == AV_PIX_FMT_YUV422P)))
+         format_supported = 0;
+         /* JPEG color space */
+         if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
+             avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
++            avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
+             (avctx->color_range == AVCOL_RANGE_JPEG &&
+              (avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
 -                  avctx->pix_fmt == AV_PIX_FMT_YUV422P))
++              avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
++              avctx->pix_fmt == AV_PIX_FMT_YUV444P)))
+             format_supported = 1;
+         /* MPEG color space */
+         else if (avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL &&
+                  (avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
++                  avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
++                  avctx->pix_fmt == AV_PIX_FMT_YUV444P))
+             format_supported = 1;
+         if (!format_supported) {
              av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
              return -1;
          }