summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/va/gstvafilter.c123
-rw-r--r--sys/va/gstvafilter.h11
2 files changed, 134 insertions, 0 deletions
diff --git a/sys/va/gstvafilter.c b/sys/va/gstvafilter.c
index d5c716d7d..a033e125c 100644
--- a/sys/va/gstvafilter.c
+++ b/sys/va/gstvafilter.c
@@ -699,6 +699,129 @@ gst_va_filter_install_properties (GstVaFilter * self, GObjectClass * klass)
return TRUE;
}
+/**
+ * GstVaDeinterlaceMethods:
+ * @GST_VA_DEINTERLACE_BOB: Interpolating missing lines by using the
+ * adjacent lines.
+ * @GST_VA_DEINTERLACE_WEAVE: Show both fields per frame. (don't use)
+ * @GST_VA_DEINTERLACE_ADAPTIVE: Interpolating missing lines by using
+ * spatial/temporal references.
+ * @GST_VA_DEINTERLACE_COMPENSATED: Recreating missing lines by using
+ * motion vector.
+ *
+ * Since: 1.20
+ */
+/* *INDENT-OFF* */
+static const GEnumValue di_desc[] = {
+ [GST_VA_DEINTERLACE_BOB] =
+ { VAProcDeinterlacingBob,
+ "Bob: Interpolating missing lines by using the adjacent lines.", "bob" },
+ [GST_VA_DEINTERLACE_WEAVE] =
+ { VAProcDeinterlacingWeave, "Weave: Show both fields per frame. (don't use)",
+ "weave" },
+ [GST_VA_DEINTERLACE_ADAPTIVE] =
+ { VAProcDeinterlacingMotionAdaptive,
+ "Adaptive: Interpolating missing lines by using spatial/temporal references.",
+ "adaptive" },
+ [GST_VA_DEINTERLACE_COMPENSATED] =
+ { VAProcDeinterlacingMotionCompensated,
+ "Compensation: Recreating missing lines by using motion vector.",
+ "compensated" },
+};
+/* *INDENT-ON* */
+
+static GType
+gst_va_deinterlace_methods_get_type (guint num_caps,
+ const VAProcFilterCapDeinterlacing * caps)
+{
+ guint i, j = 0;
+ static GType deinterlace_methods_type = 0;
+ static GEnumValue methods_types[VAProcDeinterlacingCount];
+
+ if (deinterlace_methods_type > 0)
+ return deinterlace_methods_type;
+
+ for (i = 0; i < num_caps; i++) {
+ if (caps[i].type > VAProcDeinterlacingNone
+ && caps[i].type < VAProcDeinterlacingCount)
+ methods_types[j++] = di_desc[caps[i].type];
+ }
+
+ /* *INDENT-OFF* */
+ methods_types[j] = (GEnumValue) { 0, NULL, NULL };
+ /* *INDENT-ON* */
+
+ deinterlace_methods_type = g_enum_register_static ("GstVaDeinterlaceMethods",
+ (const GEnumValue *) methods_types);
+
+ return deinterlace_methods_type;
+}
+
+gboolean
+gst_va_filter_install_deinterlace_properties (GstVaFilter * self,
+ GObjectClass * klass)
+{
+ GType type;
+ guint i;
+ const GParamFlags common_flags = G_PARAM_READWRITE
+ | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_PLAYING;
+
+ g_return_val_if_fail (GST_IS_VA_FILTER (self), FALSE);
+
+ if (!gst_va_filter_is_open (self))
+ return FALSE;
+
+ if (!gst_va_filter_ensure_filters (self))
+ return FALSE;
+
+ for (i = 0; i < self->available_filters->len; i++) {
+ const struct VaFilter *filter =
+ &g_array_index (self->available_filters, struct VaFilter, i);
+
+ if (filter->type == VAProcFilterDeinterlacing) {
+ guint i, default_method = 0;
+ const VAProcFilterCapDeinterlacing *caps = filter->caps.deint;
+ if (!caps)
+ break;
+
+ /* use the first method in the list as default */
+ for (i = 0; i < filter->num_caps; i++) {
+ if (caps[i].type > VAProcDeinterlacingNone
+ && caps[i].type < VAProcDeinterlacingCount) {
+ default_method = caps[i].type;
+ break;
+ }
+ }
+
+ if (default_method == 0)
+ break;
+
+ type = gst_va_deinterlace_methods_get_type (filter->num_caps, caps);
+ gst_type_mark_as_plugin_api (type, 0);
+
+ /**
+ * GstVaDeinterlace:method
+ *
+ * Selects the different deinterlacing algorithms that can be used.
+ *
+ * It depends on the driver the number of available algorithms,
+ * and they provide different quality and different processing
+ * consumption.
+ *
+ * Since: 1.20
+ */
+ g_object_class_install_property (klass,
+ GST_VA_FILTER_PROP_DEINTERLACE_METHOD,
+ g_param_spec_enum ("method", "Method", "Deinterlace Method",
+ type, default_method, common_flags));
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
gboolean
gst_va_filter_has_filter (GstVaFilter * self, VAProcFilterType type)
{
diff --git a/sys/va/gstvafilter.h b/sys/va/gstvafilter.h
index fa3b5843b..d5a698992 100644
--- a/sys/va/gstvafilter.h
+++ b/sys/va/gstvafilter.h
@@ -31,6 +31,13 @@ G_BEGIN_DECLS
#define GST_TYPE_VA_FILTER (gst_va_filter_get_type())
G_DECLARE_FINAL_TYPE (GstVaFilter, gst_va_filter, GST, VA_FILTER, GstObject)
+typedef enum {
+ GST_VA_DEINTERLACE_BOB = VAProcDeinterlacingBob,
+ GST_VA_DEINTERLACE_WEAVE = VAProcDeinterlacingWeave,
+ GST_VA_DEINTERLACE_ADAPTIVE = VAProcDeinterlacingMotionAdaptive,
+ GST_VA_DEINTERLACE_COMPENSATED = VAProcDeinterlacingMotionCompensated,
+} GstVaDeinterlaceMethods;
+
enum {
GST_VA_FILTER_PROP_DENOISE = 1,
GST_VA_FILTER_PROP_SHARPEN,
@@ -44,6 +51,7 @@ enum {
GST_VA_FILTER_PROP_AUTO_BRIGHTNESS,
GST_VA_FILTER_PROP_AUTO_CONTRAST,
GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH,
+ GST_VA_FILTER_PROP_DEINTERLACE_METHOD,
GST_VA_FILTER_PROP_LAST
};
@@ -66,6 +74,9 @@ gboolean gst_va_filter_has_filter (GstVaFilter * self,
VAProcFilterType type);
gboolean gst_va_filter_install_properties (GstVaFilter * self,
GObjectClass * klass);
+gboolean gst_va_filter_install_deinterlace_properties
+ (GstVaFilter * self,
+ GObjectClass * klass);
gboolean gst_va_filter_set_orientation (GstVaFilter * self,
GstVideoOrientationMethod orientation);
GstVideoOrientationMethod gst_va_filter_get_orientation (GstVaFilter * self);