[FFmpeg-devel] [PATCH 2/3] qsv/h264enc: fix cavlc option setting useless issue

Zhong Li zhong.li at intel.com
Mon Nov 13 11:29:59 EET 2017


No matter cavlc option is set to 0 or 1, the output bitstream is always
cabac mode.
Reproduce: -y -s widthxheight -i widthxheight.yuv -vcodec h264_qsv
-b:v 2000k -maxrate 2000k -look_ahead 0 -cavlc 1 test.h264
Then check the entropy_coding_mode_flag of the encoded bitstream
It is due to the dulicate option "coder" (which should be deprecated) is set to cabac

Signed-off-by: Zhong Li <zhong.li at intel.com>
---
 libavcodec/qsvenc.c      | 2 +-
 libavcodec/qsvenc_h264.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 2bc19f5..2259a79 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -534,7 +534,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         q->extco.Header.BufferSz      = sizeof(q->extco);
 #if FF_API_CODER_TYPE
 FF_DISABLE_DEPRECATION_WARNINGS
-        if (avctx->coder_type != 0)
+        if (avctx->coder_type >= 0)
             q->cavlc = avctx->coder_type == FF_CODER_TYPE_VLC;
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 0aaf672..3242062 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -155,7 +155,9 @@ static const AVCodecDefault qsv_enc_defaults[] = {
     // same as the x264 default
     { "g",         "250"   },
     { "bf",        "3"     },
-    { "coder",     "ac"    },
+#if FF_API_CODER_TYPE
+    { "coder",     "-1"    },
+#endif
 
     { "flags",     "+cgop" },
 #if FF_API_PRIVATE_OPT
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list