diff mbox series

[FFmpeg-devel,v3,08/22] lavfi/vpp_qsv: pass scaling mode to the SDK

Message ID 20210615061403.1576282-9-haihao.xiang@intel.com
State New
Headers show
Series clean-up QSV filters
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Xiang, Haihao June 15, 2021, 6:13 a.m. UTC
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 mbox series

Patch

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