[FFmpeg-devel] [PATCH 12/24] avcodec/mjpegenc: add support for non-YUVJ formats

Paul B Mahol onemda at gmail.com
Tue May 1 22:40:01 EEST 2018


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/mjpegenc.c      | 5 ++++-
 libavcodec/mpegvideo_enc.c | 3 +--
 tests/lavf-regression.sh   | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index d2fcb8e191..c31985efd3 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -415,8 +415,10 @@ AVCodec ff_mjpeg_encoder = {
     .close          = ff_mpv_encode_end,
     .capabilities   = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
     .pix_fmts       = (const enum AVPixelFormat[]) {
+        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
         AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE
     },
+    .color_ranges   = (const enum AVColorRange[]){AVCOL_RANGE_JPEG, AVCOL_RANGE_MPEG, AVCOL_RANGE_UNSPECIFIED},
     .priv_class     = &mjpeg_class,
 };
 #endif
@@ -439,8 +441,9 @@ AVCodec ff_amv_encoder = {
     .encode2        = amv_encode_picture,
     .close          = ff_mpv_encode_end,
     .pix_fmts       = (const enum AVPixelFormat[]) {
-        AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
+        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
     },
+    .color_ranges   = (const enum AVColorRange[]){AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED},
     .priv_class     = &amv_class,
 };
 #endif
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 2e7950c64d..76aa675685 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -315,8 +315,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
               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 ||
+        else if ((avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
                   avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
                   avctx->pix_fmt == AV_PIX_FMT_YUV444P))
             format_supported = 1;
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
index 45c877e4ac..b03d5ac2e7 100755
--- a/tests/lavf-regression.sh
+++ b/tests/lavf-regression.sh
@@ -376,7 +376,7 @@ do_audio_only rso
 fi
 
 if [ -n "$do_smjpeg" ] ; then
-do_lavf smjpeg "" "-f smjpeg"
+do_lavf smjpeg "" "-vf format=yuv420p:pc -f smjpeg"
 fi
 
 if [ -n "$do_sox" ] ; then
-- 
2.11.0



More information about the ffmpeg-devel mailing list