PROP_DEINTERLACING = GST_VAAPI_FILTER_OP_DEINTERLACING,
PROP_SCALING = GST_VAAPI_FILTER_OP_SCALING,
PROP_VIDEO_DIRECTION = GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
+#ifndef GST_REMOVE_DEPRECATED
PROP_SKINTONE = GST_VAAPI_FILTER_OP_SKINTONE,
+#endif
+ PROP_SKINTONE_LEVEL = GST_VAAPI_FILTER_OP_SKINTONE_LEVEL,
N_PROPERTIES
};
GST_TYPE_VIDEO_ORIENTATION_METHOD,
DEFAULT_VIDEO_DIRECTION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+#ifndef GST_REMOVE_DEPRECATED
/**
* GstVaapiFilter:skin-tone-enhancement:
*
"Skin tone enhancement",
"Apply the skin tone enhancement algorithm",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+#endif
+
+ /**
+ * GstVaapiFilter:skin-tone-enhancement-level:
+ *
+ * Apply the skin tone enhancement algorithm with specified value.
+ */
+ g_properties[PROP_SKINTONE_LEVEL] =
+ g_param_spec_uint ("skin-tone-enhancement-level",
+ "Skin tone enhancement level",
+ "Apply the skin tone enhancement algorithm with specified level", 0, 9, 3,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
}
static void
op_data->va_cap_size = sizeof (VAProcFilterCap);
op_data->va_buffer_size = sizeof (VAProcFilterParameterBuffer);
break;
+#ifndef GST_REMOVE_DEPRECATED
case GST_VAAPI_FILTER_OP_SKINTONE:
+#endif
+ case GST_VAAPI_FILTER_OP_SKINTONE_LEVEL:
op_data->va_type = VAProcFilterSkinToneEnhancement;
op_data->va_buffer_size = sizeof (VAProcFilterParameterBuffer);
break;
return success;
}
-/* Update skin tone enhancement */
+/* Update skin tone enhancement level */
static gboolean
-op_set_skintone_unlocked (GstVaapiFilter * filter,
- GstVaapiFilterOpData * op_data, gboolean value)
+op_set_skintone_level_unlocked (GstVaapiFilter * filter,
+ GstVaapiFilterOpData * op_data, guint value)
{
VAProcFilterParameterBuffer *buf;
if (!op_data || !op_ensure_buffer (filter, op_data))
return FALSE;
- op_data->is_enabled = value;
- if (!op_data->is_enabled)
- return TRUE;
+ op_data->is_enabled = 1;
buf = vaapi_map_buffer (filter->va_display, op_data->va_buffer);
if (!buf)
return FALSE;
buf->type = op_data->va_type;
- buf->value = 0;
+ buf->value = value;
vaapi_unmap_buffer (filter->va_display, op_data->va_buffer, NULL);
return TRUE;
}
+static inline gboolean
+op_set_skintone_level (GstVaapiFilter * filter,
+ GstVaapiFilterOpData * op_data, guint value)
+{
+ gboolean success = FALSE;
+
+ GST_VAAPI_DISPLAY_LOCK (filter->display);
+ success = op_set_skintone_level_unlocked (filter, op_data, value);
+ GST_VAAPI_DISPLAY_UNLOCK (filter->display);
+ return success;
+}
+
+#ifndef GST_REMOVE_DEPRECATED
+/* Update skin tone enhancement */
+static gboolean
+op_set_skintone_unlocked (GstVaapiFilter * filter,
+ GstVaapiFilterOpData * op_data, gboolean value)
+{
+ if (!op_data)
+ return FALSE;
+
+ if (!value) {
+ op_data->is_enabled = 0;
+ return TRUE;
+ }
+
+ return op_set_skintone_level_unlocked (filter, op_data, 3);
+}
+
static inline gboolean
op_set_skintone (GstVaapiFilter * filter, GstVaapiFilterOpData * op_data,
gboolean enhance)
GST_VAAPI_DISPLAY_UNLOCK (filter->display);
return success;
}
+#endif
static gboolean
deint_refs_set (GArray * refs, GstVaapiSurface ** surfaces, guint num_surfaces)
case GST_VAAPI_FILTER_OP_SCALING:
return gst_vaapi_filter_set_scaling (filter, value ?
g_value_get_enum (value) : DEFAULT_SCALING);
+#ifndef GST_REMOVE_DEPRECATED
case GST_VAAPI_FILTER_OP_SKINTONE:
return op_set_skintone (filter, op_data,
(value ? g_value_get_boolean (value) :
G_PARAM_SPEC_BOOLEAN (op_data->pspec)->default_value));
+#endif
+ case GST_VAAPI_FILTER_OP_SKINTONE_LEVEL:
+ return op_set_skintone_level (filter, op_data,
+ (value ? g_value_get_uint (value) :
+ G_PARAM_SPEC_UINT (op_data->pspec)->default_value));
case GST_VAAPI_FILTER_OP_VIDEO_DIRECTION:
return gst_vaapi_filter_set_video_direction (filter, value ?
g_value_get_enum (value) : DEFAULT_VIDEO_DIRECTION);
return TRUE;
}
+#ifndef GST_REMOVE_DEPRECATED
/**
* gst_vaapi_filter_set_skintone:
* @filter: a #GstVaapiFilter
return op_set_skintone (filter,
find_operation (filter, GST_VAAPI_FILTER_OP_SKINTONE), enhance);
}
+#endif
+
+/**
+ * gst_vaapi_filter_set_skintone_level:
+ * @filter: a #GstVaapiFilter
+ * @value: the value if enable the skin tone enhancement algorithm
+ *
+ * Applies the skin tone enhancement algorithm with specifled value.
+ *
+ * Return value: %TRUE if the operation is supported, %FALSE
+ * otherwise.
+ **/
+gboolean
+gst_vaapi_filter_set_skintone_level (GstVaapiFilter * filter, guint value)
+{
+ g_return_val_if_fail (filter != NULL, FALSE);
+
+ return op_set_skintone_level (filter,
+ find_operation (filter, GST_VAAPI_FILTER_OP_SKINTONE_LEVEL), value);
+}
/**
* gst_vaapi_filter_set_video_direction:
return DEFAULT_SCALING;
}
+#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter)
{
return FALSE;
}
+#endif
+
+guint
+gst_vaapi_filter_get_skintone_level_default (GstVaapiFilter * filter)
+{
+ g_return_val_if_fail (filter != NULL, FALSE);
+
+ return 3;
+}
GstVideoOrientationMethod
gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter)
* @GST_VAAPI_FILTER_OP_VIDEO_DIRECTION: Change video direction
* (#GstVideoOrientationMethod).
* @GST_VAAPI_FILTER_OP_SKINTONE: Skin tone enhancement (bool).
+ * @GST_VAAPI_FILTER_OP_SKINTONE_LEVEL: Skin tone enhancement (uint).
*
* The set of operations that could be applied to the filter.
*/
GST_VAAPI_FILTER_OP_DEINTERLACING,
GST_VAAPI_FILTER_OP_SCALING,
GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
+#ifndef GST_REMOVE_DEPRECATED
GST_VAAPI_FILTER_OP_SKINTONE,
+#endif
+ GST_VAAPI_FILTER_OP_SKINTONE_LEVEL,
} GstVaapiFilterOp;
/**
GstVideoOrientationMethod
gst_vaapi_filter_get_video_direction (GstVaapiFilter * filter);
+#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_vaapi_filter_set_skintone (GstVaapiFilter * filter,
gboolean enhance);
+#endif
+
+gboolean
+gst_vaapi_filter_set_skintone_level (GstVaapiFilter * filter, guint value);
gfloat
gst_vaapi_filter_get_denoising_level_default (GstVaapiFilter * filter);
GstVideoOrientationMethod
gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter);
+#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter);
+#endif
+
+guint
+gst_vaapi_filter_get_skintone_level_default (GstVaapiFilter * filter);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiFilter, gst_object_unref)
PROP_CROP_RIGHT,
PROP_CROP_TOP,
PROP_CROP_BOTTOM,
+#ifndef GST_REMOVE_DEPRECATED
PROP_SKIN_TONE_ENHANCEMENT,
+#endif
+ PROP_SKIN_TONE_ENHANCEMENT_LEVEL,
};
#define GST_VAAPI_TYPE_DEINTERLACE_MODE \
if (!postproc->has_vpp)
return FALSE;
- for (i = GST_VAAPI_FILTER_OP_DENOISE; i <= GST_VAAPI_FILTER_OP_SKINTONE; i++) {
+ for (i = GST_VAAPI_FILTER_OP_DENOISE;
+ i <= GST_VAAPI_FILTER_OP_SKINTONE_LEVEL; i++) {
op_flag = (filter_flag >> i) & 1;
if (op_flag)
return TRUE;
| postproc->crop_bottom) == 0)
postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_CROP);
- if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_SKINTONE) {
- if (!gst_vaapi_filter_set_skintone (postproc->filter,
- postproc->skintone_enhance))
+ if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_SKINTONE_LEVEL) {
+ if (!gst_vaapi_filter_set_skintone_level (postproc->filter,
+ postproc->skintone_value))
return FALSE;
- if (gst_vaapi_filter_get_skintone_default (postproc->filter) ==
- postproc->skintone_enhance)
- postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_SKINTONE);
+ if (gst_vaapi_filter_get_skintone_level_default (postproc->filter) ==
+ postproc->skintone_value)
+ postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_SKINTONE_LEVEL);
+
+#ifndef GST_REMOVE_DEPRECATED
+ /*
+ * When use skin tone level property, disable old skin tone property always
+ */
+ postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_SKINTONE);
+#endif
+ } else {
+#ifndef GST_REMOVE_DEPRECATED
+ if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_SKINTONE) {
+ if (!gst_vaapi_filter_set_skintone (postproc->filter,
+ postproc->skintone_enhance))
+ return FALSE;
+
+ if (gst_vaapi_filter_get_skintone_default (postproc->filter) ==
+ postproc->skintone_enhance)
+ postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_SKINTONE);
+ }
+#endif
}
return TRUE;
postproc->video_direction = g_value_get_enum (value);
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION;
break;
+#ifndef GST_REMOVE_DEPRECATED
case PROP_SKIN_TONE_ENHANCEMENT:
postproc->skintone_enhance = g_value_get_boolean (value);
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_SKINTONE;
break;
+#endif
+ case PROP_SKIN_TONE_ENHANCEMENT_LEVEL:
+ postproc->skintone_value = g_value_get_uint (value);
+ postproc->flags |= GST_VAAPI_POSTPROC_FLAG_SKINTONE_LEVEL;
+ break;
case PROP_CROP_LEFT:
postproc->crop_left = g_value_get_uint (value);
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_CROP;
case PROP_VIDEO_DIRECTION:
g_value_set_enum (value, postproc->video_direction);
break;
+#ifndef GST_REMOVE_DEPRECATED
case PROP_SKIN_TONE_ENHANCEMENT:
g_value_set_boolean (value, postproc->skintone_enhance);
break;
+#endif
+ case PROP_SKIN_TONE_ENHANCEMENT_LEVEL:
+ g_value_set_uint (value, postproc->skintone_value);
+ break;
case PROP_CROP_LEFT:
g_value_set_uint (value, postproc->crop_left);
break;
g_object_class_install_property (object_class,
PROP_VIDEO_DIRECTION, filter_op->pspec);
+#ifndef GST_REMOVE_DEPRECATED
/**
* GstVaapiPostproc:skin-tone-enhancement:
*
if (filter_op)
g_object_class_install_property (object_class,
PROP_SKIN_TONE_ENHANCEMENT, filter_op->pspec);
+#endif
+
+ /**
+ * GstVaapiPostproc:skin-tone-enhancement-setting:
+ *
+ * Apply the skin tone enhancement algorithm with specified value.
+ */
+ filter_op = find_filter_op (filter_ops, GST_VAAPI_FILTER_OP_SKINTONE_LEVEL);
+ if (filter_op)
+ g_object_class_install_property (object_class,
+ PROP_SKIN_TONE_ENHANCEMENT_LEVEL, filter_op->pspec);
g_ptr_array_unref (filter_ops);
}
*var = pspec->default_value;
}
+static void
+skintone_set_default_value (GstVaapiPostproc * postproc, GPtrArray * filter_ops)
+{
+ GstVaapiFilterOpInfo *filter_op;
+ GParamSpecUInt *pspec;
+
+ filter_op = find_filter_op (filter_ops, GST_VAAPI_FILTER_OP_SKINTONE_LEVEL);
+ if (!filter_op)
+ return;
+ pspec = G_PARAM_SPEC_UINT (filter_op->pspec);
+ postproc->skintone_value = pspec->default_value;
+}
+
static void
gst_vaapipostproc_init (GstVaapiPostproc * postproc)
{
if (filter_ops) {
for (i = GST_VAAPI_FILTER_OP_HUE; i <= GST_VAAPI_FILTER_OP_CONTRAST; i++)
cb_set_default_value (postproc, filter_ops, i);
+
+ skintone_set_default_value (postproc, filter_ops);
g_ptr_array_unref (filter_ops);
}
* @GST_VAAPI_POSTPROC_FLAG_SCALE: Video scaling mode.
* @GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION: Video rotation and flip/mirroring.
* @GST_VAAPI_POSTPROC_FLAG_SKINTONE: Skin tone enhancement.
+ * @GST_VAAPI_POSTPROC_FLAG_SKINTONE_LEVEL: Skin tone enhancement with value.
*
* The set of operations that are to be performed for each frame.
*/
GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION =
1 << GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
GST_VAAPI_POSTPROC_FLAG_CROP = 1 << GST_VAAPI_FILTER_OP_CROP,
+#ifndef GST_REMOVE_DEPRECATED
GST_VAAPI_POSTPROC_FLAG_SKINTONE = 1 << GST_VAAPI_FILTER_OP_SKINTONE,
+#endif
+ GST_VAAPI_POSTPROC_FLAG_SKINTONE_LEVEL =
+ 1 << GST_VAAPI_FILTER_OP_SKINTONE_LEVEL,
/* Additional custom flags */
GST_VAAPI_POSTPROC_FLAG_CUSTOM = 1 << 20,
gfloat contrast;
gboolean skintone_enhance;
+ guint skintone_value;
gboolean forward_crop;
guint get_va_surfaces:1;