[FFmpeg-devel] [PATCH v4 08/21] lavfi/vpp_qsv: pass scaling mode to the SDK

Haihao Xiang haihao.xiang at intel.com
Thu Jul 29 08:24:56 EEST 2021


After this patch, the scaling mode will be passed to the SDK when the
scaling mode is not equal to the default mode. This is in preparation
for re-using VPPContext for scale_qsv filter
---
 libavfilter/vf_vpp_qsv.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 0c2614c95f..96908556f9 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -42,9 +42,10 @@
 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
 
 /* number of video enhancement filters */
-#define ENH_FILTERS_COUNT (7)
+#define ENH_FILTERS_COUNT (8)
 #define QSV_HAVE_ROTATION  QSV_VERSION_ATLEAST(1, 17)
 #define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19)
+#define QSV_HAVE_SCALING   QSV_VERSION_ATLEAST(1, 19)
 
 typedef struct VPPContext{
     QSVVPPContext qsv;
@@ -57,6 +58,9 @@ typedef struct VPPContext{
     mfxExtVPPProcAmp procamp_conf;
     mfxExtVPPRotation rotation_conf;
     mfxExtVPPMirroring mirroring_conf;
+#if QSV_HAVE_SCALING
+    mfxExtVPPScaling scaling_conf;
+#endif
 
     /**
      * New dimensions. Special values are:
@@ -96,6 +100,8 @@ typedef struct VPPContext{
     char *cx, *cy, *cw, *ch;
     char *ow, *oh;
     char *output_format_str;
+
+    int scaling_mode;
 } VPPContext;
 
 static const AVOption options[] = {
@@ -482,6 +488,17 @@ static int config_output(AVFilterLink *outlink)
 #endif
     }
 
+    if (vpp->scaling_mode) {
+#ifdef QSV_HAVE_SCALING
+        INIT_MFX_EXTBUF(scaling_conf, MFX_EXTBUFF_VPP_SCALING);
+        SET_MFX_PARAM_FIELD(scaling_conf, ScalingMode, vpp->scaling_mode);
+#else
+        av_log(ctx, AV_LOG_WARNING, "The scaling_mode option is "
+            "not supported with this MSDK version.\n");
+        vpp->scaling_mode = 0;
+#endif
+    }
+
 #undef INIT_MFX_EXTBUF
 #undef SET_MFX_PARAM_FIELD
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list