PROP_FORCE_ASPECT_RATIO,
PROP_DEINTERLACE_MODE,
PROP_DEINTERLACE_METHOD,
- PROP_NOISE_REDUCTION
+ PROP_NOISE_REDUCTION,
+ PROP_SHARPENING
};
/* the capabilities of the inputs and outputs.
}
static void
+gst_vdp_vpp_set_attribute_float (GstVdpVideoPostProcess * vpp,
+ VdpVideoMixerAttribute attribute, gfloat value)
+{
+ VdpVideoMixerAttribute attributes[1];
+ const void *attribute_values[1];
+ VdpStatus status;
+
+ attributes[0] = attribute;
+ attribute_values[0] = &value;
+
+ status =
+ vpp->device->vdp_video_mixer_set_attribute_values (vpp->mixer, 1,
+ attributes, attribute_values);
+ if (status != VDP_STATUS_OK) {
+ GST_WARNING_OBJECT (vpp,
+ "Couldn't set noise reduction level on mixer, "
+ "error returned from vdpau was: %s",
+ vpp->device->vdp_get_error_string (status));
+ }
+}
+
+static void
gst_vdp_vpp_activate_feature (GstVdpVideoPostProcess * vpp,
VdpVideoMixerFeature feature, gboolean activate)
{
}
if (vpp->noise_reduction > 0.0)
features[n_features++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
+ if (vpp->sharpening != 0.0)
+ features[n_features++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
status =
device->vdp_video_mixer_create (device->device, n_features, features,
vpp->device = g_object_ref (device);
if (vpp->noise_reduction > 0.0) {
- VdpVideoMixerAttribute attributes[1];
- const void *attribute_values[1];
-
- attributes[0] = VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL;
- attribute_values[0] = &vpp->noise_reduction;
-
- status =
- vpp->device->vdp_video_mixer_set_attribute_values (vpp->mixer, 1,
- attributes, attribute_values);
- if (status != VDP_STATUS_OK) {
- GST_WARNING_OBJECT (vpp, "Couldn't set noise reduction level on mixer, "
- "error returned from vdpau was: %s",
- vpp->device->vdp_get_error_string (status));
- }
+ gst_vdp_vpp_set_attribute_float (vpp,
+ VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL, vpp->noise_reduction);
+ }
+ if (vpp->sharpening != 0.0) {
+ gst_vdp_vpp_set_attribute_float (vpp,
+ VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL, vpp->sharpening);
}
return GST_FLOW_OK;
case PROP_NOISE_REDUCTION:
g_value_set_boolean (value, vpp->noise_reduction);
break;
+ case PROP_SHARPENING:
+ g_value_set_float (value, vpp->sharpening);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
break;
if (vpp->device) {
- VdpVideoMixerAttribute attributes[1];
- const void *attribute_values[1];
- VdpStatus status;
-
if (vpp->noise_reduction == 0.0)
gst_vdp_vpp_activate_feature (vpp,
VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION, FALSE);
gst_vdp_vpp_activate_feature (vpp,
VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION, TRUE);
- attributes[0] = VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL;
- attribute_values[0] = &vpp->noise_reduction;
-
- status =
- vpp->device->vdp_video_mixer_set_attribute_values (vpp->mixer, 1,
- attributes, attribute_values);
- if (status != VDP_STATUS_OK) {
- GST_WARNING_OBJECT (vpp,
- "Couldn't set noise reduction level on mixer, "
- "error returned from vdpau was: %s",
- vpp->device->vdp_get_error_string (status));
- }
+ gst_vdp_vpp_set_attribute_float (vpp,
+ VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL,
+ vpp->noise_reduction);
+ }
+ break;
+ }
+ case PROP_SHARPENING:
+ {
+ gfloat old_value;
+
+ old_value = vpp->sharpening;
+ vpp->sharpening = g_value_get_float (value);
+ if (vpp->sharpening == old_value)
+ break;
+
+ if (vpp->device) {
+ if (vpp->sharpening == 0.0)
+ gst_vdp_vpp_activate_feature (vpp,
+ VDP_VIDEO_MIXER_FEATURE_SHARPNESS, FALSE);
+
+ if (old_value == 0.0)
+ gst_vdp_vpp_activate_feature (vpp,
+ VDP_VIDEO_MIXER_FEATURE_SHARPNESS, TRUE);
+
+ gst_vdp_vpp_set_attribute_float (vpp,
+ VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL, vpp->sharpening);
}
break;
}
"The amount of noise reduction that should be done", 0.0, 1.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_SHARPENING,
+ g_param_spec_float ("sharpening", "Sharpening",
+ "The amount of sharpening or blurring to be applied", -1.0, 1.0, 0.0,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
gstelement_class->change_state = gst_vdp_vpp_change_state;
}
vpp->method = GST_VDP_DEINTERLACE_METHOD_BOB;
vpp->noise_reduction = 0.0;
+ vpp->sharpening = 0.0;
/* SRC PAD */
vpp->srcpad = gst_pad_new_from_static_template (&src_template, "src");