[FFmpeg-devel] [PATCH] lavc/vaapi_encode: disable ICQ mode when enabling low power
Fu, Linjie
linjie.fu at intel.com
Tue May 28 10:58:20 EEST 2019
> -----Original Message-----
> From: Li, Zhong
> Sent: Wednesday, May 22, 2019 09:49
> To: FFmpeg development discussions and patches <ffmpeg-
> devel at ffmpeg.org>
> Cc: Fu, Linjie <linjie.fu at intel.com>
> Subject: RE: [FFmpeg-devel] [PATCH] lavc/vaapi_encode: disable ICQ mode
> when enabling low power
>
> > 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.
You are right, hard-coded should be avoided.
As to this, if ICQ mode is not supported by low_power mode, it shouldn't have
returned such support in the query for LP va_entrypoint.
- Linjie
More information about the ffmpeg-devel
mailing list