Discussion:
[libav-devel] [PATCH 1/2] lavc/qsvenc: add detail options for MFE mode
Zhong Li
2018-05-04 22:06:51 UTC
Permalink
Not convenient if using numerals to set MFE mode. It is ambiguous
and misleading (e.g: user may misunderstand setting mfmode to 1 is to
enable MFE but actually it is to disable MFE, and set it to be 5 or above is meaningless).

Signed-off-by: Zhong Li <***@intel.com>
---
libavcodec/qsvenc_h264.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index ae00ff8..7f3fd5a 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -94,7 +94,11 @@ static const AVOption options[] = {
{ "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE},

#if QSV_HAVE_MF
- { "mfmode", "Multi-Frame Mode", OFFSET(qsv.mfmode), AV_OPT_TYPE_INT, { .i64 = MFX_MF_AUTO }, 0, INT_MAX, VE },
+ { "mfmode", "Multi-Frame Mode", OFFSET(qsv.mfmode), AV_OPT_TYPE_INT, { .i64 = MFX_MF_AUTO }, MFX_MF_DEFAULT, MFX_MF_MANUAL, VE, "mfmode"},
+ { "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_DEFAULT }, INT_MIN, INT_MAX, VE, "mfmode" },
+ { "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" },
#endif

{ NULL },
--
2.7.4
Zhong Li
2018-05-04 22:06:52 UTC
Permalink
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 <***@intel.com>
---
libavcodec/qsvenc.c | 1 +
libavcodec/qsvenc.h | 1 +
libavcodec/qsvenc_h264.c | 2 ++
3 files changed, 4 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index a8b446c..9dd1699 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -666,6 +666,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 a7fc57b..2b1a349 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -163,6 +163,7 @@ typedef struct QSVEncContext {

#if QSV_HAVE_MF
int mfmode;
+ int mf_max_num;
#endif
char *load_plugins;
} QSVEncContext;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 7f3fd5a..aa40f8e 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -99,6 +99,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 },
--
2.7.4
Maxym Dmytrychenko
2018-05-07 09:22:58 UTC
Permalink
looks ok for me as well
Post by Zhong Li
Maximum number of frames to be used for combining.
Each encoder in joined sessions has to be initialized with the same value.
---
libavcodec/qsvenc.c | 1 +
libavcodec/qsvenc.h | 1 +
libavcodec/qsvenc_h264.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index a8b446c..9dd1699 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -666,6 +666,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 a7fc57b..2b1a349 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -163,6 +163,7 @@ typedef struct QSVEncContext {
#if QSV_HAVE_MF
int mfmode;
+ int mf_max_num;
#endif
char *load_plugins;
} QSVEncContext;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 7f3fd5a..aa40f8e 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -99,6 +99,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 },
--
2.7.4
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
Li, Zhong
2018-05-07 10:47:25 UTC
Permalink
Thanks for your quick response. : )
-----Original Message-----
Maxym Dmytrychenko
Sent: Monday, May 7, 2018 5:23 PM
Subject: Re: [libav-devel] [PATCH 2/2] lavc/qsvenc: add mf_max_num option
for MFE
looks ok for me as well
Post by Zhong Li
Maximum number of frames to be used for combining.
Each encoder in joined sessions has to be initialized with the same value.
---
libavcodec/qsvenc.c | 1 +
libavcodec/qsvenc.h | 1 +
libavcodec/qsvenc_h264.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
a8b446c..9dd1699 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -666,6 +666,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
a7fc57b..2b1a349 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -163,6 +163,7 @@ typedef struct QSVEncContext {
#if QSV_HAVE_MF
int mfmode;
+ int mf_max_num;
#endif
char *load_plugins;
} QSVEncContext;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index
7f3fd5a..aa40f8e 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -99,6 +99,8 @@ static const AVOption options[] = {
{ "off" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
MFX_MF_DISABLED },
Post by Zhong Li
INT_MIN, INT_MAX, VE, "mfmode" },
{ "auto" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
MFX_MF_AUTO },
Post by Zhong Li
INT_MIN, INT_MAX, VE, "mfmode" },
{ "manual" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
MFX_MF_MANUAL },
Post by Zhong Li
INT_MIN, INT_MAX, VE, "mfmode" },
+
+ { "mf_max_num", "Maximum frame number of Multi-Frame
encoding",
Post by Zhong Li
OFFSET(qsv.mf_max_num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, VE},
#endif
{ NULL },
--
2.7.4
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
Luca Barbato
2018-05-04 09:26:20 UTC
Permalink
The set looks fine, I would add a alias for "on" as "manual" for
usability but beside that looks fine to me.
Luca Barbato
2018-05-07 11:50:21 UTC
Permalink
Thanks for review. : )
No problem :)
Do you need me to update it, or you can help to add the alias when you merge it?
+ { "on" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_MF_MANUAL },
INT_MIN, INT_MAX, VE, "mfmode" },

Folded in, I'd push this evening.

lu
Loading...