[FFmpeg-devel] [PATCH v4 7/9] lavc/qsvenc: add an option to set MB numbers of each slice

Zhong Li zhong.li at intel.com
Thu Nov 29 10:29:05 EET 2018


This option specifies suggested macroblocks numbers in each slice.
MSDK may adjust it based on platform capability.
And slice_number will be ignored if this option set to a non-zero
value.

Signed-off-by: Zhong Li <zhong.li at intel.com>
---
 libavcodec/qsvenc.c      | 1 +
 libavcodec/qsvenc.h      | 1 +
 libavcodec/qsvenc_h264.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index c2e7030..ba74821 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -655,6 +655,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #if QSV_VERSION_ATLEAST(1, 8)
             q->extco2.LookAheadDS = q->look_ahead_downsampling;
             q->extco2.RepeatPPS   = q->repeat_pps ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
+            q->extco2.NumMbPerSlice = q->num_mb_per_slice;
 
 #if FF_API_PRIVATE_OPT
 FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 4316a10..c2aa88e 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -163,6 +163,7 @@ typedef struct QSVEncContext {
     int recovery_point_sei;
 
     int repeat_pps;
+    int num_mb_per_slice;
 
     int a53_cc;
 
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 13217b4..693a9e3 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -156,6 +156,7 @@ static const AVOption options[] = {
 #endif
 
     { "repeat_pps", "repeat pps for every frame", OFFSET(qsv.repeat_pps), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+    { "num_mb_per_slice","Suggested macroblocks numbers of each slice", OFFSET(qsv.num_mb_per_slice), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
 
     { NULL },
 };
-- 
2.7.4



More information about the ffmpeg-devel mailing list