[FFmpeg-devel,17/24] avcodec/h264_slice: do not use YUVJ pixel formats

Submitted by Paul B Mahol on May 1, 2018, 7:40 p.m.

Details

Message ID 20180501194013.9552-17-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol May 1, 2018, 7:40 p.m.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/h264_slice.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d71ddbe9ba..65e2bae52a 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))