[FFmpeg-cvslog] avfilter/vf_vpp_qsv: add scale mode option
Fei Wang
git at videolan.org
Tue Aug 3 17:41:48 EEST 2021
ffmpeg | branch: master | Fei Wang <fei.w.wang at intel.com> | Wed Feb 24 09:41:58 2021 +0800| [8b83dad82512a6948b63408f964463b063ad24c9] | committer: Linjie Fu
avfilter/vf_vpp_qsv: add scale mode option
The option allow user to set diffenent scaling mode from
auto/low-power/high-quality.
More details:
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxExtVPPScaling
Signed-off-by: Fei Wang <fei.w.wang at intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b83dad82512a6948b63408f964463b063ad24c9
---
libavfilter/vf_vpp_qsv.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 11ee490935..f2309ed9d9 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -43,8 +43,9 @@
/* number of video enhancement filters */
#define ENH_FILTERS_COUNT (7)
-#define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17)
-#define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19)
+#define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17)
+#define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19)
+#define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19)
typedef struct VPPContext{
const AVClass *class;
@@ -59,6 +60,9 @@ typedef struct VPPContext{
mfxExtVPPProcAmp procamp_conf;
mfxExtVPPRotation rotation_conf;
mfxExtVPPMirroring mirroring_conf;
+#ifdef QSV_HAVE_SCALING_CONFIG
+ mfxExtVPPScaling scale_conf;
+#endif
int out_width;
int out_height;
@@ -83,6 +87,8 @@ typedef struct VPPContext{
int rotate; /* rotate angle : [0, 90, 180, 270] */
int hflip; /* flip mode : 0 = off, 1 = HORIZONTAL flip */
+ int scale_mode; /* scale mode : 0 = auto, 1 = low power, 2 = high quality */
+
/* param for the procamp */
int procamp; /* enable procamp */
float hue;
@@ -132,6 +138,7 @@ static const AVOption options[] = {
{ "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
{ "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS },
+ { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" },
{ NULL }
};
@@ -459,6 +466,20 @@ static int config_output(AVFilterLink *outlink)
#endif
}
+ if (inlink->w != outlink->w || inlink->h != outlink->h) {
+#ifdef QSV_HAVE_SCALING_CONFIG
+ memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling));
+ vpp->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING;
+ vpp->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling);
+ vpp->scale_conf.ScalingMode = vpp->scale_mode;
+
+ param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf;
+#else
+ av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is "
+ "not supported with this MSDK version.\n");
+#endif
+ }
+
if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format)
More information about the ffmpeg-cvslog
mailing list