mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
vdpauvideopostprocess: add sharpening property
This commit is contained in:
parent
1aea922f3c
commit
a7ea771f36
2 changed files with 67 additions and 30 deletions
|
@ -67,7 +67,8 @@ enum
|
||||||
PROP_FORCE_ASPECT_RATIO,
|
PROP_FORCE_ASPECT_RATIO,
|
||||||
PROP_DEINTERLACE_MODE,
|
PROP_DEINTERLACE_MODE,
|
||||||
PROP_DEINTERLACE_METHOD,
|
PROP_DEINTERLACE_METHOD,
|
||||||
PROP_NOISE_REDUCTION
|
PROP_NOISE_REDUCTION,
|
||||||
|
PROP_SHARPENING
|
||||||
};
|
};
|
||||||
|
|
||||||
/* the capabilities of the inputs and outputs.
|
/* the capabilities of the inputs and outputs.
|
||||||
|
@ -135,6 +136,28 @@ gst_vdp_deinterlace_modes_get_type (void)
|
||||||
return deinterlace_modes_type;
|
return deinterlace_modes_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
gst_vdp_vpp_activate_feature (GstVdpVideoPostProcess * vpp,
|
gst_vdp_vpp_activate_feature (GstVdpVideoPostProcess * vpp,
|
||||||
VdpVideoMixerFeature feature, gboolean activate)
|
VdpVideoMixerFeature feature, gboolean activate)
|
||||||
|
@ -378,6 +401,8 @@ gst_vdp_vpp_create_mixer (GstVdpVideoPostProcess * vpp, GstVdpDevice * device)
|
||||||
}
|
}
|
||||||
if (vpp->noise_reduction > 0.0)
|
if (vpp->noise_reduction > 0.0)
|
||||||
features[n_features++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
|
features[n_features++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
|
||||||
|
if (vpp->sharpening != 0.0)
|
||||||
|
features[n_features++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
|
||||||
|
|
||||||
status =
|
status =
|
||||||
device->vdp_video_mixer_create (device->device, n_features, features,
|
device->vdp_video_mixer_create (device->device, n_features, features,
|
||||||
|
@ -393,20 +418,12 @@ gst_vdp_vpp_create_mixer (GstVdpVideoPostProcess * vpp, GstVdpDevice * device)
|
||||||
vpp->device = g_object_ref (device);
|
vpp->device = g_object_ref (device);
|
||||||
|
|
||||||
if (vpp->noise_reduction > 0.0) {
|
if (vpp->noise_reduction > 0.0) {
|
||||||
VdpVideoMixerAttribute attributes[1];
|
gst_vdp_vpp_set_attribute_float (vpp,
|
||||||
const void *attribute_values[1];
|
VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL, vpp->noise_reduction);
|
||||||
|
}
|
||||||
attributes[0] = VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL;
|
if (vpp->sharpening != 0.0) {
|
||||||
attribute_values[0] = &vpp->noise_reduction;
|
gst_vdp_vpp_set_attribute_float (vpp,
|
||||||
|
VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL, vpp->sharpening);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
@ -838,6 +855,9 @@ gst_vdp_vpp_get_property (GObject * object, guint property_id, GValue * value,
|
||||||
case PROP_NOISE_REDUCTION:
|
case PROP_NOISE_REDUCTION:
|
||||||
g_value_set_boolean (value, vpp->noise_reduction);
|
g_value_set_boolean (value, vpp->noise_reduction);
|
||||||
break;
|
break;
|
||||||
|
case PROP_SHARPENING:
|
||||||
|
g_value_set_float (value, vpp->sharpening);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -886,10 +906,6 @@ gst_vdp_vpp_set_property (GObject * object, guint property_id,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (vpp->device) {
|
if (vpp->device) {
|
||||||
VdpVideoMixerAttribute attributes[1];
|
|
||||||
const void *attribute_values[1];
|
|
||||||
VdpStatus status;
|
|
||||||
|
|
||||||
if (vpp->noise_reduction == 0.0)
|
if (vpp->noise_reduction == 0.0)
|
||||||
gst_vdp_vpp_activate_feature (vpp,
|
gst_vdp_vpp_activate_feature (vpp,
|
||||||
VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION, FALSE);
|
VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION, FALSE);
|
||||||
|
@ -898,18 +914,32 @@ gst_vdp_vpp_set_property (GObject * object, guint property_id,
|
||||||
gst_vdp_vpp_activate_feature (vpp,
|
gst_vdp_vpp_activate_feature (vpp,
|
||||||
VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION, TRUE);
|
VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION, TRUE);
|
||||||
|
|
||||||
attributes[0] = VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL;
|
gst_vdp_vpp_set_attribute_float (vpp,
|
||||||
attribute_values[0] = &vpp->noise_reduction;
|
VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL,
|
||||||
|
vpp->noise_reduction);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROP_SHARPENING:
|
||||||
|
{
|
||||||
|
gfloat old_value;
|
||||||
|
|
||||||
status =
|
old_value = vpp->sharpening;
|
||||||
vpp->device->vdp_video_mixer_set_attribute_values (vpp->mixer, 1,
|
vpp->sharpening = g_value_get_float (value);
|
||||||
attributes, attribute_values);
|
if (vpp->sharpening == old_value)
|
||||||
if (status != VDP_STATUS_OK) {
|
break;
|
||||||
GST_WARNING_OBJECT (vpp,
|
|
||||||
"Couldn't set noise reduction level on mixer, "
|
if (vpp->device) {
|
||||||
"error returned from vdpau was: %s",
|
if (vpp->sharpening == 0.0)
|
||||||
vpp->device->vdp_get_error_string (status));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -975,6 +1005,11 @@ gst_vdp_vpp_class_init (GstVdpVideoPostProcessClass * klass)
|
||||||
"The amount of noise reduction that should be done", 0.0, 1.0, 0.0,
|
"The amount of noise reduction that should be done", 0.0, 1.0, 0.0,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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;
|
gstelement_class->change_state = gst_vdp_vpp_change_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,6 +1024,7 @@ gst_vdp_vpp_init (GstVdpVideoPostProcess * vpp,
|
||||||
vpp->method = GST_VDP_DEINTERLACE_METHOD_BOB;
|
vpp->method = GST_VDP_DEINTERLACE_METHOD_BOB;
|
||||||
|
|
||||||
vpp->noise_reduction = 0.0;
|
vpp->noise_reduction = 0.0;
|
||||||
|
vpp->sharpening = 0.0;
|
||||||
|
|
||||||
/* SRC PAD */
|
/* SRC PAD */
|
||||||
vpp->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
vpp->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
||||||
|
|
|
@ -83,6 +83,7 @@ struct _GstVdpVideoPostProcess
|
||||||
GstVdpDeinterlaceMethods method;
|
GstVdpDeinterlaceMethods method;
|
||||||
|
|
||||||
gfloat noise_reduction;
|
gfloat noise_reduction;
|
||||||
|
gfloat sharpening;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVdpVideoPostProcessClass
|
struct _GstVdpVideoPostProcessClass
|
||||||
|
|
Loading…
Reference in a new issue