mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
videofilter: avoid holding object lock when calling basetransform function
This commit is contained in:
parent
a34cbc7637
commit
1ed37c8229
2 changed files with 21 additions and 15 deletions
|
@ -162,8 +162,8 @@ gst_gamma_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
val);
|
||||
GST_OBJECT_LOCK (gamma);
|
||||
gamma->gamma = val;
|
||||
gst_gamma_calculate_tables (gamma);
|
||||
GST_OBJECT_UNLOCK (gamma);
|
||||
gst_gamma_calculate_tables (gamma);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -194,20 +194,23 @@ gst_gamma_calculate_tables (GstGamma * gamma)
|
|||
gint n;
|
||||
gdouble val;
|
||||
gdouble exp;
|
||||
gboolean passthrough = FALSE;
|
||||
|
||||
GST_OBJECT_LOCK (gamma);
|
||||
if (gamma->gamma == 1.0) {
|
||||
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (gamma), TRUE);
|
||||
return;
|
||||
passthrough = TRUE;
|
||||
} else {
|
||||
exp = 1.0 / gamma->gamma;
|
||||
for (n = 0; n < 256; n++) {
|
||||
val = n / 255.0;
|
||||
val = pow (val, exp);
|
||||
val = 255.0 * val;
|
||||
gamma->gamma_table[n] = (guint8) floor (val + 0.5);
|
||||
}
|
||||
}
|
||||
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (gamma), FALSE);
|
||||
GST_OBJECT_UNLOCK (gamma);
|
||||
|
||||
exp = 1.0 / gamma->gamma;
|
||||
for (n = 0; n < 256; n++) {
|
||||
val = n / 255.0;
|
||||
val = pow (val, exp);
|
||||
val = 255.0 * val;
|
||||
gamma->gamma_table[n] = (guint8) floor (val + 0.5);
|
||||
}
|
||||
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (gamma), passthrough);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -156,13 +156,16 @@ gst_video_balance_is_passthrough (GstVideoBalance * videobalance)
|
|||
static void
|
||||
gst_video_balance_update_properties (GstVideoBalance * videobalance)
|
||||
{
|
||||
gboolean passthrough = gst_video_balance_is_passthrough (videobalance);
|
||||
gboolean passthrough;
|
||||
GstBaseTransform *base = GST_BASE_TRANSFORM (videobalance);
|
||||
|
||||
gst_base_transform_set_passthrough (base, passthrough);
|
||||
|
||||
GST_OBJECT_LOCK (videobalance);
|
||||
passthrough = gst_video_balance_is_passthrough (videobalance);
|
||||
if (!passthrough)
|
||||
gst_video_balance_update_tables (videobalance);
|
||||
GST_OBJECT_UNLOCK (videobalance);
|
||||
|
||||
gst_base_transform_set_passthrough (base, passthrough);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -713,8 +716,8 @@ gst_video_balance_set_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
}
|
||||
|
||||
gst_video_balance_update_properties (balance);
|
||||
GST_OBJECT_UNLOCK (balance);
|
||||
gst_video_balance_update_properties (balance);
|
||||
|
||||
if (label) {
|
||||
GstColorBalanceChannel *channel =
|
||||
|
|
Loading…
Reference in a new issue