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

Linjie Fu linjie.fu at intel.com
Tue May 21 23:31:20 EEST 2019


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);
         TRY_RC_MODE(RC_MODE_CQP, 0);
     }
 
-- 
2.7.4



More information about the ffmpeg-devel mailing list