mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
filter: add support for sharpening.
Sharpening is configured with a float value. The supported range is -1.0 .. 1.0 with 0.0 being the default, and that means no sharpening operation at all. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
22f55bd513
commit
a854768a80
3 changed files with 44 additions and 0 deletions
|
@ -388,6 +388,7 @@ gst_vaapi_filter_set_operation
|
|||
gst_vaapi_filter_set_format
|
||||
gst_vaapi_filter_set_cropping_rectangle
|
||||
gst_vaapi_filter_set_denoising_level
|
||||
gst_vaapi_filter_set_sharpening_level
|
||||
<SUBSECTION Standard>
|
||||
GST_VAAPI_FILTER
|
||||
</SECTION>
|
||||
|
|
|
@ -183,6 +183,7 @@ enum {
|
|||
PROP_FORMAT = GST_VAAPI_FILTER_OP_FORMAT,
|
||||
PROP_CROP = GST_VAAPI_FILTER_OP_CROP,
|
||||
PROP_DENOISE = GST_VAAPI_FILTER_OP_DENOISE,
|
||||
PROP_SHARPEN = GST_VAAPI_FILTER_OP_SHARPEN,
|
||||
|
||||
N_PROPERTIES
|
||||
};
|
||||
|
@ -229,6 +230,19 @@ init_properties(void)
|
|||
"The level of denoising to apply",
|
||||
0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* GstVaapiFilter:sharpen:
|
||||
*
|
||||
* The level of sharpening to apply for positive values, or the
|
||||
* level of blurring for negative values.
|
||||
*/
|
||||
g_properties[PROP_SHARPEN] =
|
||||
g_param_spec_float("sharpen",
|
||||
"Sharpening Level",
|
||||
"The level of sharpening/blurring to apply",
|
||||
-1.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -271,6 +285,11 @@ op_data_new(GstVaapiFilterOp op, GParamSpec *pspec)
|
|||
op_data->va_cap_size = sizeof(VAProcFilterCap);
|
||||
op_data->va_buffer_size = sizeof(VAProcFilterParameterBuffer);
|
||||
break;
|
||||
case GST_VAAPI_FILTER_OP_SHARPEN:
|
||||
op_data->va_type = VAProcFilterSharpening;
|
||||
op_data->va_cap_size = sizeof(VAProcFilterCap);
|
||||
op_data->va_buffer_size = sizeof(VAProcFilterParameterBuffer);
|
||||
break;
|
||||
default:
|
||||
g_assert(0 && "unsupported operation");
|
||||
goto error;
|
||||
|
@ -862,6 +881,7 @@ gst_vaapi_filter_set_operation(GstVaapiFilter *filter, GstVaapiFilterOp op,
|
|||
return gst_vaapi_filter_set_cropping_rectangle(filter, value ?
|
||||
g_value_get_boxed(value) : NULL);
|
||||
case GST_VAAPI_FILTER_OP_DENOISE:
|
||||
case GST_VAAPI_FILTER_OP_SHARPEN:
|
||||
return op_set_generic(filter, op_data,
|
||||
(value ? g_value_get_float(value) :
|
||||
G_PARAM_SPEC_FLOAT(op_data->pspec)->default_value));
|
||||
|
@ -1093,3 +1113,21 @@ gst_vaapi_filter_set_denoising_level(GstVaapiFilter *filter, gfloat level)
|
|||
return op_set_generic(filter,
|
||||
find_operation(filter, GST_VAAPI_FILTER_OP_DENOISE), level);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_filter_set_sharpening_level:
|
||||
* @filter: a #GstVaapiFilter
|
||||
* @level: the sharpening factor
|
||||
*
|
||||
* Enables noise reduction with the specified factor.
|
||||
*
|
||||
* Return value: %TRUE if the operation is supported, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
gst_vaapi_filter_set_sharpening_level(GstVaapiFilter *filter, gfloat level)
|
||||
{
|
||||
g_return_val_if_fail(filter != NULL, FALSE);
|
||||
|
||||
return op_set_generic(filter,
|
||||
find_operation(filter, GST_VAAPI_FILTER_OP_SHARPEN), level);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ typedef struct _GstVaapiFilterOpInfo GstVaapiFilterOpInfo;
|
|||
* @GST_VAAPI_FILTER_OP_FORMAT: Force output pixel format (#GstVideoFormat).
|
||||
* @GST_VAAPI_FILTER_OP_CROP: Crop source surface (#GstVaapiRectangle).
|
||||
* @GST_VAAPI_FILTER_OP_DENOISE: Noise reduction (float).
|
||||
* @GST_VAAPI_FILTER_OP_SHARPEN: Sharpening (float).
|
||||
*
|
||||
* The set of operations that could be applied to the filter.
|
||||
*/
|
||||
|
@ -41,6 +42,7 @@ typedef enum {
|
|||
GST_VAAPI_FILTER_OP_FORMAT = 1,
|
||||
GST_VAAPI_FILTER_OP_CROP,
|
||||
GST_VAAPI_FILTER_OP_DENOISE,
|
||||
GST_VAAPI_FILTER_OP_SHARPEN,
|
||||
} GstVaapiFilterOp;
|
||||
|
||||
/**
|
||||
|
@ -112,4 +114,7 @@ gst_vaapi_filter_set_cropping_rectangle(GstVaapiFilter *filter,
|
|||
gboolean
|
||||
gst_vaapi_filter_set_denoising_level(GstVaapiFilter *filter, gfloat level);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_filter_set_sharpening_level(GstVaapiFilter *filter, gfloat level);
|
||||
|
||||
#endif /* GST_VAAPI_FILTER_H */
|
||||
|
|
Loading…
Reference in a new issue