* [FFmpeg-devel] [PATCH] qsvenc_{hevc,h264}: add scenario option
@ 2022-08-12 4:52 Xiang, Haihao
2022-08-16 10:32 ` Anton Khirnov
0 siblings, 1 reply; 3+ messages in thread
From: Xiang, Haihao @ 2022-08-12 4:52 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Haihao Xiang
From: Haihao Xiang <haihao.xiang@intel.com>
User may get better experience after providing corresponding senario hint
to encoder for the encoding session. See [1] for scenario support in the
SDK
[1]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#scenarioinfo
---
doc/encoders.texi | 30 ++++++++++++++++++++++++++++++
libavcodec/qsvenc.c | 3 +++
libavcodec/qsvenc.h | 13 +++++++++++++
libavcodec/qsvenc_h264.c | 1 +
libavcodec/qsvenc_hevc.c | 1 +
5 files changed, 48 insertions(+)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 6d73f74196..1a7e34a272 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3503,6 +3503,21 @@ Maximum video quantizer scale for B frame.
@item @var{min_qp_b}
Minimum video quantizer scale for B frame.
+
+@item @var{scenario}
+Provides a hint to encoder about the scenario for the encoding session.
+@table @samp
+@item unknown
+@item displayremoting
+@item videoconference
+@item archive
+@item livestreaming
+@item cameracapture
+@item videosurveillance
+@item gamestreaming
+@item remotegaming
+@end table
+
@end table
@subsection HEVC Options
@@ -3644,6 +3659,21 @@ Maximum video quantizer scale for B frame.
@item @var{min_qp_b}
Minimum video quantizer scale for B frame.
+
+@item @var{scenario}
+Provides a hint to encoder about the scenario for the encoding session.
+@table @samp
+@item unknown
+@item displayremoting
+@item videoconference
+@item archive
+@item livestreaming
+@item cameracapture
+@item videosurveillance
+@item gamestreaming
+@item remotegaming
+@end table
+
@end table
@subsection MPEG2 Options
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 4831640868..fc9a59c483 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -337,6 +337,7 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
av_log(avctx, AV_LOG_VERBOSE, "LowDelayBRC: %s\n", print_threestate(co3->LowDelayBRC));
av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSizeI: %d; ", co3->MaxFrameSizeI);
av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSizeP: %d\n", co3->MaxFrameSizeP);
+ av_log(avctx, AV_LOG_VERBOSE, "ScenarioInfo: %"PRId16"\n", co3->ScenarioInfo);
}
if (exthevctiles) {
@@ -924,6 +925,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->extco3.MaxFrameSizeI = q->max_frame_size_i;
if (q->max_frame_size_p >= 0)
q->extco3.MaxFrameSizeP = q->max_frame_size_p;
+
+ q->extco3.ScenarioInfo = q->scenario;
}
if (avctx->codec_id == AV_CODEC_ID_HEVC) {
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index d35a1318f2..53c0955e87 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -111,6 +111,18 @@
{ "max_qp_b", "Maximum video quantizer scale for B frame", OFFSET(qsv.max_qp_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE}, \
{ "min_qp_b", "Minimum video quantizer scale for B frame", OFFSET(qsv.min_qp_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE},
+#define QSV_OPTION_SCENARIO \
+{ "scenario", "A hint to encoder about the scenario for the encoding session", OFFSET(qsv.scenario), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, VE, "scenario" }, \
+{ "unknown", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_UNKNOWN }, .flags = VE, "scenario" }, \
+{ "displayremoting", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_DISPLAY_REMOTING }, .flags = VE, "scenario" }, \
+{ "videoconference", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_VIDEO_CONFERENCE }, .flags = VE, "scenario" }, \
+{ "archive", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_ARCHIVE }, .flags = VE, "scenario" }, \
+{ "livestreaming", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_LIVE_STREAMING }, .flags = VE, "scenario" }, \
+{ "cameracapture", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_CAMERA_CAPTURE }, .flags = VE, "scenario" }, \
+{ "videosurveillance", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_VIDEO_SURVEILLANCE }, .flags = VE, "scenario" }, \
+{ "gamestreaming", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_GAME_STREAMING }, .flags = VE, "scenario" }, \
+{ "remotegaming", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCENARIO_REMOTE_GAMING }, .flags = VE, "scenario" },
+
extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];
typedef int SetEncodeCtrlCB (AVCodecContext *avctx,
@@ -179,6 +191,7 @@ typedef struct QSVEncContext {
int max_frame_size_p;
int max_slice_size;
int dblk_idc;
+ int scenario;
int tile_cols;
int tile_rows;
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index ad9cf629df..a0dc31e24a 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -114,6 +114,7 @@ static const AVOption options[] = {
QSV_OPTION_DBLK_IDC
QSV_OPTION_LOW_DELAY_BRC
QSV_OPTION_MAX_MIN_QP
+ QSV_OPTION_SCENARIO
{ "cavlc", "Enable CAVLC", OFFSET(qsv.cavlc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
#if QSV_HAVE_VCM
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index e11f5dec4a..a46df18a09 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -233,6 +233,7 @@ static const AVOption options[] = {
QSV_OPTION_DBLK_IDC
QSV_OPTION_LOW_DELAY_BRC
QSV_OPTION_MAX_MIN_QP
+ QSV_OPTION_SCENARIO
{ "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE, "idr_interval" },
{ "begin_only", "Output an IDR-frame only at the beginning of the stream", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] qsvenc_{hevc,h264}: add scenario option
2022-08-12 4:52 [FFmpeg-devel] [PATCH] qsvenc_{hevc,h264}: add scenario option Xiang, Haihao
@ 2022-08-16 10:32 ` Anton Khirnov
2022-08-17 4:34 ` Xiang, Haihao
0 siblings, 1 reply; 3+ messages in thread
From: Anton Khirnov @ 2022-08-16 10:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Haihao Xiang
Quoting Xiang, Haihao (2022-08-12 06:52:53)
> +#define QSV_OPTION_SCENARIO \
> +{ "scenario", "A hint to encoder about the scenario for the encoding session", OFFSET(qsv.scenario), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, VE, "scenario" }, \
The default should probably be one of the MFX_SCENARIO flags (unknown
makes most sense I suppose) rather than 0.
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] qsvenc_{hevc,h264}: add scenario option
2022-08-16 10:32 ` Anton Khirnov
@ 2022-08-17 4:34 ` Xiang, Haihao
0 siblings, 0 replies; 3+ messages in thread
From: Xiang, Haihao @ 2022-08-17 4:34 UTC (permalink / raw)
To: anton, ffmpeg-devel
On Tue, 2022-08-16 at 12:32 +0200, Anton Khirnov wrote:
> Quoting Xiang, Haihao (2022-08-12 06:52:53)
> > +#define QSV_OPTION_SCENARIO \
> > +{ "scenario", "A hint to encoder about the scenario for the encoding
> > session", OFFSET(qsv.scenario), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, VE,
> > "scenario" }, \
>
> The default should probably be one of the MFX_SCENARIO flags (unknown
> makes most sense I suppose) rather than 0.
>
Thanks for the comment, I'll change it to MFX_SCENARIO_UNKNOWN.
BRs
Haihao
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-17 4:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 4:52 [FFmpeg-devel] [PATCH] qsvenc_{hevc,h264}: add scenario option Xiang, Haihao
2022-08-16 10:32 ` Anton Khirnov
2022-08-17 4:34 ` Xiang, Haihao
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git