summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2021-08-12 10:33:56 +0800
committerJames Almer <jamrial@gmail.com>2021-08-12 22:25:11 -0300
commit115f5e803502451ac64fa698730923299e5acc4e (patch)
treebe9de02974861c9fbb281699177495483691f379 /libavcodec
parent21c7df0d22dc83b748659cb3068729944ff57095 (diff)
lavc/qsvenc: allows the SDK runtime to choose LowPower/non-LowPower modes
The SDK supports LowPower and non-LowPower modes, but some features are available only under one of the two modes. Currently non-LowPower mode is always chosen in FFmpeg if the mode is not set to LowPower explicitly. User will experience some SDK errors if a LowPower related feature is specified but the mode is not set to LowPower. With this patch, the mode is set to unknown by default in FFmpeg, the SDK is able to choose a workable mode for the specified features. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/qsvenc.c6
-rw-r--r--libavcodec/qsvenc.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index e7e65ebfcf..50ec7065ca 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -514,7 +514,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
}
}
- if (q->low_power) {
+ if (q->low_power == 1) {
#if QSV_HAVE_VDENC
q->param.mfx.LowPower = MFX_CODINGOPTION_ON;
#else
@@ -523,7 +523,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->low_power = 0;
q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
#endif
- } else
+ } else if (q->low_power == -1)
+ q->param.mfx.LowPower = MFX_CODINGOPTION_UNKNOWN;
+ else
q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
q->param.mfx.CodecProfile = q->profile;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index ba20b6f906..31516b8e55 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -96,7 +96,7 @@
{ "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \
-{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\
+{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, VE},\
extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];