mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
vaapipostproc: Use level value for skin-tone-enhancement filter.
Currently the parameter of skin-tone-enhancement filter is forced to zero. In fact it could be set different value by the user. So create a new property named as "skin-tone-enhancement-level" for accepting the used defined parameter value. At the same time, skin-tone-enhancement is marked as deprecated. When skin-tone-enhancement-level is set, skin-tone-enhancement will be ignored.
This commit is contained in:
parent
f67ec886a3
commit
4c87644914
4 changed files with 179 additions and 14 deletions
|
@ -330,7 +330,10 @@ enum
|
||||||
PROP_DEINTERLACING = GST_VAAPI_FILTER_OP_DEINTERLACING,
|
PROP_DEINTERLACING = GST_VAAPI_FILTER_OP_DEINTERLACING,
|
||||||
PROP_SCALING = GST_VAAPI_FILTER_OP_SCALING,
|
PROP_SCALING = GST_VAAPI_FILTER_OP_SCALING,
|
||||||
PROP_VIDEO_DIRECTION = GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
|
PROP_VIDEO_DIRECTION = GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
PROP_SKINTONE = GST_VAAPI_FILTER_OP_SKINTONE,
|
PROP_SKINTONE = GST_VAAPI_FILTER_OP_SKINTONE,
|
||||||
|
#endif
|
||||||
|
PROP_SKINTONE_LEVEL = GST_VAAPI_FILTER_OP_SKINTONE_LEVEL,
|
||||||
|
|
||||||
N_PROPERTIES
|
N_PROPERTIES
|
||||||
};
|
};
|
||||||
|
@ -465,6 +468,7 @@ init_properties (void)
|
||||||
GST_TYPE_VIDEO_ORIENTATION_METHOD,
|
GST_TYPE_VIDEO_ORIENTATION_METHOD,
|
||||||
DEFAULT_VIDEO_DIRECTION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
DEFAULT_VIDEO_DIRECTION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
/**
|
/**
|
||||||
* GstVaapiFilter:skin-tone-enhancement:
|
* GstVaapiFilter:skin-tone-enhancement:
|
||||||
*
|
*
|
||||||
|
@ -474,6 +478,18 @@ init_properties (void)
|
||||||
"Skin tone enhancement",
|
"Skin tone enhancement",
|
||||||
"Apply the skin tone enhancement algorithm",
|
"Apply the skin tone enhancement algorithm",
|
||||||
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
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
|
static void
|
||||||
|
@ -523,7 +539,10 @@ op_data_new (GstVaapiFilterOp op, GParamSpec * pspec)
|
||||||
op_data->va_cap_size = sizeof (VAProcFilterCap);
|
op_data->va_cap_size = sizeof (VAProcFilterCap);
|
||||||
op_data->va_buffer_size = sizeof (VAProcFilterParameterBuffer);
|
op_data->va_buffer_size = sizeof (VAProcFilterParameterBuffer);
|
||||||
break;
|
break;
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
case GST_VAAPI_FILTER_OP_SKINTONE:
|
case GST_VAAPI_FILTER_OP_SKINTONE:
|
||||||
|
#endif
|
||||||
|
case GST_VAAPI_FILTER_OP_SKINTONE_LEVEL:
|
||||||
op_data->va_type = VAProcFilterSkinToneEnhancement;
|
op_data->va_type = VAProcFilterSkinToneEnhancement;
|
||||||
op_data->va_buffer_size = sizeof (VAProcFilterParameterBuffer);
|
op_data->va_buffer_size = sizeof (VAProcFilterParameterBuffer);
|
||||||
break;
|
break;
|
||||||
|
@ -1023,29 +1042,56 @@ op_set_deinterlace (GstVaapiFilter * filter, GstVaapiFilterOpData * op_data,
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update skin tone enhancement */
|
/* Update skin tone enhancement level */
|
||||||
static gboolean
|
static gboolean
|
||||||
op_set_skintone_unlocked (GstVaapiFilter * filter,
|
op_set_skintone_level_unlocked (GstVaapiFilter * filter,
|
||||||
GstVaapiFilterOpData * op_data, gboolean value)
|
GstVaapiFilterOpData * op_data, guint value)
|
||||||
{
|
{
|
||||||
VAProcFilterParameterBuffer *buf;
|
VAProcFilterParameterBuffer *buf;
|
||||||
|
|
||||||
if (!op_data || !op_ensure_buffer (filter, op_data))
|
if (!op_data || !op_ensure_buffer (filter, op_data))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
op_data->is_enabled = value;
|
op_data->is_enabled = 1;
|
||||||
if (!op_data->is_enabled)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
buf = vaapi_map_buffer (filter->va_display, op_data->va_buffer);
|
buf = vaapi_map_buffer (filter->va_display, op_data->va_buffer);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
buf->type = op_data->va_type;
|
buf->type = op_data->va_type;
|
||||||
buf->value = 0;
|
buf->value = value;
|
||||||
vaapi_unmap_buffer (filter->va_display, op_data->va_buffer, NULL);
|
vaapi_unmap_buffer (filter->va_display, op_data->va_buffer, NULL);
|
||||||
return TRUE;
|
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
|
static inline gboolean
|
||||||
op_set_skintone (GstVaapiFilter * filter, GstVaapiFilterOpData * op_data,
|
op_set_skintone (GstVaapiFilter * filter, GstVaapiFilterOpData * op_data,
|
||||||
gboolean enhance)
|
gboolean enhance)
|
||||||
|
@ -1057,6 +1103,7 @@ op_set_skintone (GstVaapiFilter * filter, GstVaapiFilterOpData * op_data,
|
||||||
GST_VAAPI_DISPLAY_UNLOCK (filter->display);
|
GST_VAAPI_DISPLAY_UNLOCK (filter->display);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
deint_refs_set (GArray * refs, GstVaapiSurface ** surfaces, guint num_surfaces)
|
deint_refs_set (GArray * refs, GstVaapiSurface ** surfaces, guint num_surfaces)
|
||||||
|
@ -1441,10 +1488,16 @@ gst_vaapi_filter_set_operation (GstVaapiFilter * filter, GstVaapiFilterOp op,
|
||||||
case GST_VAAPI_FILTER_OP_SCALING:
|
case GST_VAAPI_FILTER_OP_SCALING:
|
||||||
return gst_vaapi_filter_set_scaling (filter, value ?
|
return gst_vaapi_filter_set_scaling (filter, value ?
|
||||||
g_value_get_enum (value) : DEFAULT_SCALING);
|
g_value_get_enum (value) : DEFAULT_SCALING);
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
case GST_VAAPI_FILTER_OP_SKINTONE:
|
case GST_VAAPI_FILTER_OP_SKINTONE:
|
||||||
return op_set_skintone (filter, op_data,
|
return op_set_skintone (filter, op_data,
|
||||||
(value ? g_value_get_boolean (value) :
|
(value ? g_value_get_boolean (value) :
|
||||||
G_PARAM_SPEC_BOOLEAN (op_data->pspec)->default_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:
|
case GST_VAAPI_FILTER_OP_VIDEO_DIRECTION:
|
||||||
return gst_vaapi_filter_set_video_direction (filter, value ?
|
return gst_vaapi_filter_set_video_direction (filter, value ?
|
||||||
g_value_get_enum (value) : DEFAULT_VIDEO_DIRECTION);
|
g_value_get_enum (value) : DEFAULT_VIDEO_DIRECTION);
|
||||||
|
@ -1985,6 +2038,7 @@ gst_vaapi_filter_set_scaling (GstVaapiFilter * filter,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_filter_set_skintone:
|
* gst_vaapi_filter_set_skintone:
|
||||||
* @filter: a #GstVaapiFilter
|
* @filter: a #GstVaapiFilter
|
||||||
|
@ -2003,6 +2057,26 @@ gst_vaapi_filter_set_skintone (GstVaapiFilter * filter, gboolean enhance)
|
||||||
return op_set_skintone (filter,
|
return op_set_skintone (filter,
|
||||||
find_operation (filter, GST_VAAPI_FILTER_OP_SKINTONE), enhance);
|
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:
|
* gst_vaapi_filter_set_video_direction:
|
||||||
|
@ -2124,6 +2198,7 @@ gst_vaapi_filter_get_scaling_default (GstVaapiFilter * filter)
|
||||||
return DEFAULT_SCALING;
|
return DEFAULT_SCALING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter)
|
gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter)
|
||||||
{
|
{
|
||||||
|
@ -2131,6 +2206,15 @@ gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter)
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
guint
|
||||||
|
gst_vaapi_filter_get_skintone_level_default (GstVaapiFilter * filter)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (filter != NULL, FALSE);
|
||||||
|
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
GstVideoOrientationMethod
|
GstVideoOrientationMethod
|
||||||
gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter)
|
gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter)
|
||||||
|
|
|
@ -51,6 +51,7 @@ typedef struct _GstVaapiFilterOpInfo GstVaapiFilterOpInfo;
|
||||||
* @GST_VAAPI_FILTER_OP_VIDEO_DIRECTION: Change video direction
|
* @GST_VAAPI_FILTER_OP_VIDEO_DIRECTION: Change video direction
|
||||||
* (#GstVideoOrientationMethod).
|
* (#GstVideoOrientationMethod).
|
||||||
* @GST_VAAPI_FILTER_OP_SKINTONE: Skin tone enhancement (bool).
|
* @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.
|
* The set of operations that could be applied to the filter.
|
||||||
*/
|
*/
|
||||||
|
@ -66,7 +67,10 @@ typedef enum {
|
||||||
GST_VAAPI_FILTER_OP_DEINTERLACING,
|
GST_VAAPI_FILTER_OP_DEINTERLACING,
|
||||||
GST_VAAPI_FILTER_OP_SCALING,
|
GST_VAAPI_FILTER_OP_SCALING,
|
||||||
GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
|
GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
GST_VAAPI_FILTER_OP_SKINTONE,
|
GST_VAAPI_FILTER_OP_SKINTONE,
|
||||||
|
#endif
|
||||||
|
GST_VAAPI_FILTER_OP_SKINTONE_LEVEL,
|
||||||
} GstVaapiFilterOp;
|
} GstVaapiFilterOp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -259,9 +263,14 @@ gst_vaapi_filter_set_video_direction (GstVaapiFilter * filter,
|
||||||
GstVideoOrientationMethod
|
GstVideoOrientationMethod
|
||||||
gst_vaapi_filter_get_video_direction (GstVaapiFilter * filter);
|
gst_vaapi_filter_get_video_direction (GstVaapiFilter * filter);
|
||||||
|
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_filter_set_skintone (GstVaapiFilter * filter,
|
gst_vaapi_filter_set_skintone (GstVaapiFilter * filter,
|
||||||
gboolean enhance);
|
gboolean enhance);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_filter_set_skintone_level (GstVaapiFilter * filter, guint value);
|
||||||
|
|
||||||
gfloat
|
gfloat
|
||||||
gst_vaapi_filter_get_denoising_level_default (GstVaapiFilter * filter);
|
gst_vaapi_filter_get_denoising_level_default (GstVaapiFilter * filter);
|
||||||
|
@ -287,8 +296,13 @@ gst_vaapi_filter_get_scaling_default (GstVaapiFilter * filter);
|
||||||
GstVideoOrientationMethod
|
GstVideoOrientationMethod
|
||||||
gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter);
|
gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter);
|
||||||
|
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter);
|
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
|
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiFilter, gst_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiFilter, gst_object_unref)
|
||||||
|
|
|
@ -127,7 +127,10 @@ enum
|
||||||
PROP_CROP_RIGHT,
|
PROP_CROP_RIGHT,
|
||||||
PROP_CROP_TOP,
|
PROP_CROP_TOP,
|
||||||
PROP_CROP_BOTTOM,
|
PROP_CROP_BOTTOM,
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
PROP_SKIN_TONE_ENHANCEMENT,
|
PROP_SKIN_TONE_ENHANCEMENT,
|
||||||
|
#endif
|
||||||
|
PROP_SKIN_TONE_ENHANCEMENT_LEVEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GST_VAAPI_TYPE_DEINTERLACE_MODE \
|
#define GST_VAAPI_TYPE_DEINTERLACE_MODE \
|
||||||
|
@ -519,7 +522,8 @@ check_filter_update (GstVaapiPostproc * postproc)
|
||||||
if (!postproc->has_vpp)
|
if (!postproc->has_vpp)
|
||||||
return FALSE;
|
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;
|
op_flag = (filter_flag >> i) & 1;
|
||||||
if (op_flag)
|
if (op_flag)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -628,14 +632,33 @@ update_filter (GstVaapiPostproc * postproc)
|
||||||
| postproc->crop_bottom) == 0)
|
| postproc->crop_bottom) == 0)
|
||||||
postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_CROP);
|
postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_CROP);
|
||||||
|
|
||||||
if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_SKINTONE) {
|
if (postproc->flags & GST_VAAPI_POSTPROC_FLAG_SKINTONE_LEVEL) {
|
||||||
if (!gst_vaapi_filter_set_skintone (postproc->filter,
|
if (!gst_vaapi_filter_set_skintone_level (postproc->filter,
|
||||||
postproc->skintone_enhance))
|
postproc->skintone_value))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (gst_vaapi_filter_get_skintone_default (postproc->filter) ==
|
if (gst_vaapi_filter_get_skintone_level_default (postproc->filter) ==
|
||||||
postproc->skintone_enhance)
|
postproc->skintone_value)
|
||||||
postproc->flags &= ~(GST_VAAPI_POSTPROC_FLAG_SKINTONE);
|
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;
|
return TRUE;
|
||||||
|
@ -1969,10 +1992,16 @@ gst_vaapipostproc_set_property (GObject * object,
|
||||||
postproc->video_direction = g_value_get_enum (value);
|
postproc->video_direction = g_value_get_enum (value);
|
||||||
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION;
|
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION;
|
||||||
break;
|
break;
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
case PROP_SKIN_TONE_ENHANCEMENT:
|
case PROP_SKIN_TONE_ENHANCEMENT:
|
||||||
postproc->skintone_enhance = g_value_get_boolean (value);
|
postproc->skintone_enhance = g_value_get_boolean (value);
|
||||||
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_SKINTONE;
|
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_SKINTONE;
|
||||||
break;
|
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:
|
case PROP_CROP_LEFT:
|
||||||
postproc->crop_left = g_value_get_uint (value);
|
postproc->crop_left = g_value_get_uint (value);
|
||||||
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_CROP;
|
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_CROP;
|
||||||
|
@ -2049,9 +2078,14 @@ gst_vaapipostproc_get_property (GObject * object,
|
||||||
case PROP_VIDEO_DIRECTION:
|
case PROP_VIDEO_DIRECTION:
|
||||||
g_value_set_enum (value, postproc->video_direction);
|
g_value_set_enum (value, postproc->video_direction);
|
||||||
break;
|
break;
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
case PROP_SKIN_TONE_ENHANCEMENT:
|
case PROP_SKIN_TONE_ENHANCEMENT:
|
||||||
g_value_set_boolean (value, postproc->skintone_enhance);
|
g_value_set_boolean (value, postproc->skintone_enhance);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
case PROP_SKIN_TONE_ENHANCEMENT_LEVEL:
|
||||||
|
g_value_set_uint (value, postproc->skintone_value);
|
||||||
|
break;
|
||||||
case PROP_CROP_LEFT:
|
case PROP_CROP_LEFT:
|
||||||
g_value_set_uint (value, postproc->crop_left);
|
g_value_set_uint (value, postproc->crop_left);
|
||||||
break;
|
break;
|
||||||
|
@ -2346,6 +2380,7 @@ gst_vaapipostproc_class_init (GstVaapiPostprocClass * klass)
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_VIDEO_DIRECTION, filter_op->pspec);
|
PROP_VIDEO_DIRECTION, filter_op->pspec);
|
||||||
|
|
||||||
|
#ifndef GST_REMOVE_DEPRECATED
|
||||||
/**
|
/**
|
||||||
* GstVaapiPostproc:skin-tone-enhancement:
|
* GstVaapiPostproc:skin-tone-enhancement:
|
||||||
*
|
*
|
||||||
|
@ -2355,6 +2390,17 @@ gst_vaapipostproc_class_init (GstVaapiPostprocClass * klass)
|
||||||
if (filter_op)
|
if (filter_op)
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_SKIN_TONE_ENHANCEMENT, filter_op->pspec);
|
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);
|
g_ptr_array_unref (filter_ops);
|
||||||
}
|
}
|
||||||
|
@ -2394,6 +2440,19 @@ cb_set_default_value (GstVaapiPostproc * postproc, GPtrArray * filter_ops,
|
||||||
*var = pspec->default_value;
|
*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
|
static void
|
||||||
gst_vaapipostproc_init (GstVaapiPostproc * postproc)
|
gst_vaapipostproc_init (GstVaapiPostproc * postproc)
|
||||||
{
|
{
|
||||||
|
@ -2420,6 +2479,8 @@ gst_vaapipostproc_init (GstVaapiPostproc * postproc)
|
||||||
if (filter_ops) {
|
if (filter_ops) {
|
||||||
for (i = GST_VAAPI_FILTER_OP_HUE; i <= GST_VAAPI_FILTER_OP_CONTRAST; i++)
|
for (i = GST_VAAPI_FILTER_OP_HUE; i <= GST_VAAPI_FILTER_OP_CONTRAST; i++)
|
||||||
cb_set_default_value (postproc, filter_ops, i);
|
cb_set_default_value (postproc, filter_ops, i);
|
||||||
|
|
||||||
|
skintone_set_default_value (postproc, filter_ops);
|
||||||
g_ptr_array_unref (filter_ops);
|
g_ptr_array_unref (filter_ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ typedef enum
|
||||||
* @GST_VAAPI_POSTPROC_FLAG_SCALE: Video scaling mode.
|
* @GST_VAAPI_POSTPROC_FLAG_SCALE: Video scaling mode.
|
||||||
* @GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION: Video rotation and flip/mirroring.
|
* @GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION: Video rotation and flip/mirroring.
|
||||||
* @GST_VAAPI_POSTPROC_FLAG_SKINTONE: Skin tone enhancement.
|
* @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.
|
* The set of operations that are to be performed for each frame.
|
||||||
*/
|
*/
|
||||||
|
@ -105,7 +106,11 @@ typedef enum
|
||||||
GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION =
|
GST_VAAPI_POSTPROC_FLAG_VIDEO_DIRECTION =
|
||||||
1 << GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
|
1 << GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
|
||||||
GST_VAAPI_POSTPROC_FLAG_CROP = 1 << GST_VAAPI_FILTER_OP_CROP,
|
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,
|
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 */
|
/* Additional custom flags */
|
||||||
GST_VAAPI_POSTPROC_FLAG_CUSTOM = 1 << 20,
|
GST_VAAPI_POSTPROC_FLAG_CUSTOM = 1 << 20,
|
||||||
|
@ -182,6 +187,7 @@ struct _GstVaapiPostproc
|
||||||
gfloat contrast;
|
gfloat contrast;
|
||||||
|
|
||||||
gboolean skintone_enhance;
|
gboolean skintone_enhance;
|
||||||
|
guint skintone_value;
|
||||||
gboolean forward_crop;
|
gboolean forward_crop;
|
||||||
|
|
||||||
guint get_va_surfaces:1;
|
guint get_va_surfaces:1;
|
||||||
|
|
Loading…
Reference in a new issue