[FFmpeg-devel] [PATCH 19/27] avcodec/mjpegenc: remove usage of YUVJ pixel formats

Paul B Mahol onemda at gmail.com
Sat Dec 9 17:38:11 EET 2017


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/mjpegenc.c        | 6 ++++--
 libavcodec/mjpegenc_common.c | 2 +-
 libavcodec/mpegvideo_enc.c   | 8 +-------
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index d2fcb8e191..9602a6fe64 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -415,8 +415,9 @@ 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_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE
+        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
     },
+    .color_range    = AVCOL_RANGE_JPEG,
     .priv_class     = &mjpeg_class,
 };
 #endif
@@ -439,8 +440,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_NONE
     },
+    .color_range    = AVCOL_RANGE_JPEG,
     .priv_class     = &amv_class,
 };
 #endif
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 31868c9bed..4ecc05bc09 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -232,7 +232,7 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4
         vsample[1] = hsample[1] =
         vsample[2] = hsample[2] =
         vsample[3] = hsample[3] = 1;
-    } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P || avctx->pix_fmt == AV_PIX_FMT_YUVJ444P) {
+    } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P) {
         vsample[0] = vsample[1] = vsample[2] = 2;
         hsample[0] = hsample[1] = hsample[2] = 1;
     } else {
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index f1f4989231..20830887dc 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -306,10 +306,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
     case AV_CODEC_ID_AMV:
         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 &&
+        if ((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_YUV444P)))
@@ -334,15 +331,12 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
     }
 
     switch (avctx->pix_fmt) {
-    case AV_PIX_FMT_YUVJ444P:
     case AV_PIX_FMT_YUV444P:
         s->chroma_format = CHROMA_444;
         break;
-    case AV_PIX_FMT_YUVJ422P:
     case AV_PIX_FMT_YUV422P:
         s->chroma_format = CHROMA_422;
         break;
-    case AV_PIX_FMT_YUVJ420P:
     case AV_PIX_FMT_YUV420P:
     default:
         s->chroma_format = CHROMA_420;
-- 
2.11.0



More information about the ffmpeg-devel mailing list