]> git.sesse.net Git - ffmpeg/commitdiff
qsvenc: Add VDENC support for H264 and HEVC
authorLinjie Fu <linjie.fu@intel.com>
Mon, 5 Nov 2018 02:28:59 +0000 (10:28 +0800)
committerLuca Barbato <lu_zero@gentoo.org>
Tue, 13 Nov 2018 16:36:04 +0000 (16:36 +0000)
Add VDENC(lowpower mode) support for QSV h264 and HEVC

It's an experimental function(like lowpower in vaapi) with
some limitations:
- CBR/VBR require HuC which should be explicitly loaded via i915
module parameter(i915.enable_guc=2 for linux kerner version >= 4.16)
- HEVC VDENC was supported >= ICE LAKE

use option "-low_power 1" to enable VDENC.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
libavcodec/qsvenc.c
libavcodec/qsvenc.h
libavcodec/qsvenc_h264.c
libavcodec/qsvenc_hevc.c

index 17a0559f36a46357aade6dd99503111d12b9e35a..16d6e79e2bfba60a89295397a0b2f315ad63b070 100644 (file)
@@ -472,6 +472,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         }
     }
 
+#if QSV_HAVE_VDENC
+    q->param.mfx.LowPower           = q->low_power ? MFX_CODINGOPTION_ON:MFX_CODINGOPTION_OFF;
+#endif
     q->param.mfx.CodecProfile       = q->profile;
     q->param.mfx.TargetUsage        = avctx->compression_level;
     q->param.mfx.GopPicSize         = FFMAX(0, avctx->gop_size);
index 2d83c7b1af5406e4f4f264e08c8704fabcb3beb8..b74b977e88d21ba31a88919f94262f429ebcd6ce 100644 (file)
@@ -44,6 +44,7 @@
 #define QSV_HAVE_LA     QSV_VERSION_ATLEAST(1, 7)
 #define QSV_HAVE_LA_DS  QSV_VERSION_ATLEAST(1, 8)
 #define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11)
+#define QSV_HAVE_VDENC  QSV_VERSION_ATLEAST(1, 15)
 
 #if defined(_WIN32)
 #define QSV_HAVE_AVBR   QSV_VERSION_ATLEAST(1, 3)
@@ -159,6 +160,7 @@ typedef struct QSVEncContext {
     int int_ref_cycle_size;
     int int_ref_qp_delta;
     int recovery_point_sei;
+    int low_power;
 
 #if QSV_HAVE_MF
     int mfmode;
index 164f57332f8d4de9c3efe03184f39426d8c2b450..795e27c002c5555f5341f52df5bfdcce9a272fae 100644 (file)
@@ -101,6 +101,9 @@ static const AVOption options[] = {
     { "off"    , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_DISABLED }, INT_MIN, INT_MAX,     VE, "mfmode" },
     { "auto"   , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_AUTO     }, INT_MIN, INT_MAX,     VE, "mfmode" },
 #endif
+#if QSV_HAVE_VDENC
+    { "low_power", "enable low power mode (experimental, many limitations by mfx version, HW platform, BRC modes, etc.", OFFSET(qsv.low_power), AV_OPT_TYPE_INT, { .i64 =  0 }, 0, 1, VE},
+#endif
 
     { NULL },
 };
index 471d1748737f25c2887c13b4d1ba92e6060b3e71..cba671bb90d78cfaf8433b14209cf9c69822a94a 100644 (file)
@@ -238,6 +238,9 @@ static const AVOption options[] = {
     { "main",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN    }, INT_MIN, INT_MAX,     VE, "profile" },
     { "main10",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN10  }, INT_MIN, INT_MAX,     VE, "profile" },
     { "mainsp",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAINSP  }, INT_MIN, INT_MAX,     VE, "profile" },
+#if QSV_HAVE_VDENC
+    { "low_power", "enable low power mode (experimental, many limitations by mfx version, HW platform, BRC modes, etc.", OFFSET(qsv.low_power), AV_OPT_TYPE_INT, { .i64 =  0 },  0,  1, VE },
+#endif
 
     { NULL },
 };