[FFmpeg-devel] [PATCH 16/23] avcodec/h264_slice: do not use YUVJ pixel formats

Paul B Mahol onemda at gmail.com
Tue Dec 12 15:56:14 EET 2017


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/h264_slice.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index aad5484588..a75ab08c29 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -820,15 +820,10 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
         if (CHROMA444(h)) {
             if (h->avctx->colorspace == AVCOL_SPC_RGB)
                 *fmt++ = AV_PIX_FMT_GBRP;
-            else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
-                *fmt++ = AV_PIX_FMT_YUVJ444P;
             else
                 *fmt++ = AV_PIX_FMT_YUV444P;
         } else if (CHROMA422(h)) {
-            if (h->avctx->color_range == AVCOL_RANGE_JPEG)
-                *fmt++ = AV_PIX_FMT_YUVJ422P;
-            else
-                *fmt++ = AV_PIX_FMT_YUV422P;
+            *fmt++ = AV_PIX_FMT_YUV422P;
         } else {
 #if CONFIG_H264_DXVA2_HWACCEL
             *fmt++ = AV_PIX_FMT_DXVA2_VLD;
@@ -845,8 +840,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
 #endif
             if (h->avctx->codec->pix_fmts)
                 choices = h->avctx->codec->pix_fmts;
-            else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
-                *fmt++ = AV_PIX_FMT_YUVJ420P;
             else
                 *fmt++ = AV_PIX_FMT_YUV420P;
         }
@@ -992,17 +985,6 @@ fail:
     return ret;
 }
 
-static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
-{
-    switch (a) {
-    case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
-    case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
-    case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
-    default:
-        return a;
-    }
-}
-
 static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_slice)
 {
     const SPS *sps;
@@ -1047,7 +1029,7 @@ static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_sl
                      || h->mb_height != sps->mb_height
                     ));
     if (h->avctx->pix_fmt == AV_PIX_FMT_NONE
-        || (non_j_pixfmt(h->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h, 0))))
+        || (h->avctx->pix_fmt != get_pixel_format(h, 0)))
         must_reinit = 1;
 
     if (first_slice && av_cmp_q(sps->sar, h->avctx->sample_aspect_ratio))
-- 
2.11.0



More information about the ffmpeg-devel mailing list