[FFmpeg-devel] [PATCH 08/22] lavf/vpp_qsv: pass scaling mode to the SDK

Haihao Xiang haihao.xiang at intel.com
Fri May 14 07:53:46 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 c9a7b0ceb9..fd45c4f352 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -43,9 +43,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;
@@ -58,6 +59,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:
@@ -97,6 +101,8 @@ typedef struct VPPContext{
     char *cx, *cy, *cw, *ch;
     char *ow, *oh;
     char *output_format_str;
+
+    int scaling_mode;
 } VPPContext;
 
 static const AVOption options[] = {
@@ -483,6 +489,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.25.1



More information about the ffmpeg-devel mailing list