[FFmpeg-devel] [PATCH] lavc/vaapi_encode: disable ICQ mode when enabling low power

Li, Zhong zhong.li at intel.com
Wed May 22 04:48:48 EEST 2019


> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Linjie Fu
> Sent: Wednesday, May 22, 2019 4:31 AM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Fu, Linjie <linjie.fu at intel.com>
> Subject: [FFmpeg-devel] [PATCH] lavc/vaapi_encode: disable ICQ mode
> when enabling low power
> 
> ICQ mode is not supported in low power mode and should be disabled.
> 
> For H264, Driver supports RC modes CQP, CBR, VBR, QVBR.
> For HEVC, Driver supports RC modes CQP, CBR, VBR, ICQ, QVBR.
> 
> ICQ is not exposed while working on low power mode for h264_vaapi, but
> will trigger issues for hevc_vaapi.
> 
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
> See https://github.com/intel/media-driver/issues/618 for details.
> And patch for HEVC low power(ICL+):
> https://github.com/intel-media-ci/ffmpeg/pull/42
> 
>  libavcodec/vaapi_encode.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index
> 2dda451..55ab919 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -1371,6 +1371,7 @@ static av_cold int
> vaapi_encode_init_rate_control(AVCodecContext *avctx)
>      // * If bitrate and maxrate are set and have the same value, try CBR.
>      // * If a bitrate is set, try AVBR, then VBR, then CBR.
>      // * If no bitrate is set, try ICQ, then CQP.
> +    // * If low power is set, ICQ is not supported.
> 
>  #define TRY_RC_MODE(mode, fail) do { \
>          rc_mode = &vaapi_encode_rc_modes[mode]; \ @@ -1405,7
> +1406,8 @@ static av_cold int
> vaapi_encode_init_rate_control(AVCodecContext *avctx)
>          TRY_RC_MODE(RC_MODE_QVBR, 0);
> 
>      if (avctx->global_quality > 0) {
> -        TRY_RC_MODE(RC_MODE_ICQ, 0);
> +        if (!ctx->low_power)
> +            TRY_RC_MODE(RC_MODE_ICQ, 0);
>          TRY_RC_MODE(RC_MODE_CQP, 0);
>      }
> 
> @@ -1417,7 +1419,8 @@ static av_cold int
> vaapi_encode_init_rate_control(AVCodecContext *avctx)
>          TRY_RC_MODE(RC_MODE_VBR, 0);
>          TRY_RC_MODE(RC_MODE_CBR, 0);
>      } else {
> -        TRY_RC_MODE(RC_MODE_ICQ, 0);
> +        if (!ctx->low_power)
> +            TRY_RC_MODE(RC_MODE_ICQ, 0);

Is it possible ICQ mode can be supported in future (new driver/HW version)? 
I would like to see avoid hard-coded workaround. 
If there is any driver limitation, would better to query driver capability firstly and then disable a feature if it is not supported.



More information about the ffmpeg-devel mailing list