summaryrefslogtreecommitdiff
path: root/libavfilter/vf_vpp_qsv.c
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2023-01-30 09:37:19 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2023-02-03 10:27:58 +0800
commitb92028346c35dad837dd1160930435d88bd838b5 (patch)
tree92ccaeb8d667be2e80eb6aec0e1f1ac1a4600c62 /libavfilter/vf_vpp_qsv.c
parenta48c95d3c9c404c9139f7fc4eb7ae8bdf6fe0eaa (diff)
downloadffmpeg-b92028346c35dad837dd1160930435d88bd838b5.tar.gz
lavfi/deinterlace_qsv: re-use VPPContext for deinterlace_qsv filter
QSVDeintContext and VPPContext have the same base context, and all features in deinterlace_qsv are implemented in vpp_qsv filter, so deinterlace_qsv can be taken as a special case of vpp_qsv filter, and we may use VPPContext with a different option array, preinit callback and support pixel formats to implement deinterlace_qsv, then remove QSVDeintContext. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Diffstat (limited to 'libavfilter/vf_vpp_qsv.c')
-rw-r--r--libavfilter/vf_vpp_qsv.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index aac0a234c3..010b69943a 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -752,3 +752,28 @@ static av_cold int qsvscale_preinit(AVFilterContext *ctx)
DEFINE_QSV_FILTER(qsvscale, scale, "scaling and format conversion", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV));
#endif
+
+#if CONFIG_DEINTERLACE_QSV_FILTER
+
+static const AVOption qsvdeint_options[] = {
+ { "mode", "set deinterlace mode", OFFSET(deinterlace), AV_OPT_TYPE_INT, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
+ { "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
+ { "advanced", "Motion adaptive algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
+
+ { NULL },
+};
+
+static av_cold int qsvdeint_preinit(AVFilterContext *ctx)
+{
+ VPPContext *vpp = ctx->priv;
+
+ vpp_preinit(ctx);
+ vpp->has_passthrough = 0;
+ vpp->field_rate = 1;
+
+ return 0;
+}
+
+DEFINE_QSV_FILTER(qsvdeint, deinterlace, "deinterlacing", FILTER_SINGLE_PIXFMT(AV_PIX_FMT_QSV))
+
+#endif