[FFmpeg-devel,2/2] lavc/qsvenc: add mf_max_num option for MFE

Submitted by Zhong Li on May 4, 2018, 10:11 p.m.

Details

Message ID 1525471900-3645-2-git-send-email-zhong.li@intel.com
State New
Headers show

Commit Message

Zhong Li May 4, 2018, 10:11 p.m.
Maximum number of frames to be used for combining.
Each encoder in joined sessions has to be initialized with the same value.

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

Patch hide | download patch | download mbox

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 3ce5ffe..e58fdc2 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -661,6 +661,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
                 q->extmfp.Header.BufferSz     = sizeof(q->extmfp);
 
                 q->extmfp.MFMode = q->mfmode;
+                q->extmfp.MaxNumFrames = q->mf_max_num;
                 av_log(avctx,AV_LOG_VERBOSE,"MFMode:%d\n", q->extmfp.MFMode);
                 q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extmfp;
             }
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index d482722..76c8106 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -166,6 +166,7 @@  typedef struct QSVEncContext {
 
 #if QSV_HAVE_MF
     int mfmode;
+    int mf_max_num;
 #endif
     char *load_plugins;
     SetEncodeCtrlCB *set_encode_ctrl_cb;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 5278a04..bee10b2 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -151,6 +151,8 @@  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" },
     { "manual" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_MANUAL   }, INT_MIN, INT_MAX,     VE, "mfmode" },
+
+    { "mf_max_num", "Maximum frame number of Multi-Frame encoding", OFFSET(qsv.mf_max_num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE},
 #endif
 
     { NULL },