[FFmpeg-devel] [PATCH 5/5] lavc/qsvenc: add an option set MB numbers of each slice

Zhong Li zhong.li at intel.com
Thu Oct 25 15:36:11 EEST 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 fffca65..40dfaa6 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -651,6 +651,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 9aebc2a..cc28f4f 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 893a737..44f2fe0 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_INT, { .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