[FFmpeg-devel] [PATCH v2 4/6] avcodec/libsvtav1: Fix CQP mode doesn't work as expection

Jan Ekström jeebjp at gmail.com
Sat Sep 25 15:06:23 EEST 2021


On Sat, Sep 18, 2021 at 4:27 AM <lance.lmwang at gmail.com> wrote:
>
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---

Commit message should probably be something along the lines of

"""
avcodec/libsvtav1: properly enforce CQP mode when set in wrapper

SVT-AV1 seems to have switched their default from CQP to CRF in February,
so enforce the controlling option accordingly.
"""

>  libavcodec/libsvtav1.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index 0dc25ca..b029e01 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -208,6 +208,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
>      if (param->rate_control_mode) {
>          param->max_qp_allowed       = avctx->qmax;
>          param->min_qp_allowed       = avctx->qmin;
> +    } else {
> +        param->enable_tpl_la = 0; /* CQP need turn off enable_tp_la */

As the default changing in the underlying library has now shown us, I
think (for now) it's better to move this next to
param->rate_control_mode earlier in the function, and then do
something like:

param->enable_tpl_la = !!param->rate_control_mode;

(I would have utilized param->enable_tpl_la = param->rate_control_mode
== SVTAV1_RC_MODE_CQP;` but alas SVT-AV1 does not have such
enums/defines that make such things more readable).

This way the parameter is set correctly no matter if the default is
switched over at SVT-AV1. In the future the wrapper can be reworked so
that by default SVT-AV1's own rate control defaults are utilized, and
then if either bit rate or cqp or something like that is set, we can
start enforcing that.

Jan


More information about the ffmpeg-devel mailing list