From: Zhao Halley Date: Wed, 17 Jul 2013 09:37:16 +0000 (+0800) Subject: filter: add support for sharpening. X-Git-Tag: 1.19.3~503^2~2479 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a854768a8091ffa700f4e542690a9dd02066634b;p=platform%2Fupstream%2Fgstreamer.git 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 --- diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index 0fb0c82..049f8f7 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -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 GST_VAAPI_FILTER diff --git a/gst-libs/gst/vaapi/gstvaapifilter.c b/gst-libs/gst/vaapi/gstvaapifilter.c index d27a77f..d6e84a4 100644 --- a/gst-libs/gst/vaapi/gstvaapifilter.c +++ b/gst-libs/gst/vaapi/gstvaapifilter.c @@ -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); +} diff --git a/gst-libs/gst/vaapi/gstvaapifilter.h b/gst-libs/gst/vaapi/gstvaapifilter.h index af6688a..977d929 100644 --- a/gst-libs/gst/vaapi/gstvaapifilter.h +++ b/gst-libs/gst/vaapi/gstvaapifilter.h @@ -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 */