[v2,2/2] qsv/h264enc: fix cavlc option setting useless issue

Message ID 1511799598-5970-2-git-send-email-zhong.li@intel.com
State New
Headers show

Commit Message

Li, Zhong Nov. 27, 2017, 4:19 p.m.
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 -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@intel.com>
---
 libavcodec/qsvenc.c      | 2 +-
 libavcodec/qsvenc_h264.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Maxym Dmytrychenko Nov. 24, 2017, 8:25 a.m. | #1
this looks clear and touches only relevant implementation, will take care
shortly.

On Mon, Nov 27, 2017 at 5:19 PM, Zhong Li <zhong.li@intel.com> wrote:

> 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 -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@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 eeccc50..9db9eb3 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -547,7 +547,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          if (avctx->codec_id == AV_CODEC_ID_H264) {
>  #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 62f1909..1365fac 100644
> --- a/libavcodec/qsvenc_h264.c
> +++ b/libavcodec/qsvenc_h264.c
> @@ -107,7 +107,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
>
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index eeccc50..9db9eb3 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -547,7 +547,7 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         if (avctx->codec_id == AV_CODEC_ID_H264) {
 #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 62f1909..1365fac 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -107,7 +107,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