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

2019-05-28 Thread Fu, Linjie
> -Original Message-
> From: Li, Zhong
> Sent: Wednesday, May 22, 2019 09:49
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Fu, Linjie 
> Subject: RE: [FFmpeg-devel] [PATCH] lavc/vaapi_encode: disable ICQ mode
> when enabling low power
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > Of Linjie Fu
> > Sent: Wednesday, May 22, 2019 4:31 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Fu, Linjie 
> > 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 
> > ---
> > 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 = _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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

2019-05-21 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Linjie Fu
> Sent: Wednesday, May 22, 2019 4:31 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie 
> 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 
> ---
> 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 = _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.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

2019-05-21 Thread Linjie Fu
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 
---
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 = _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);
 TRY_RC_MODE(RC_MODE_CQP, 0);
 }
 
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".