summaryrefslogtreecommitdiffstats
path: root/gst/videofilter/gstvideobalance.c
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2004-01-14 23:01:49 +0000
committerJulien Moutte <julien@moutte.net>2004-01-14 23:01:49 +0000
commit185fa362d692c262d3e0fc21459cf1c448783b9f (patch)
tree2a1db58fb59a34d2c4ae4180375ef6d6564980fb /gst/videofilter/gstvideobalance.c
parent1513f05bc7cef6abc01e262b12d728b38ca7a121 (diff)
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS: 2004-01-14 Julien MOUTTE <julien@moutte.net> * gst/videofilter/gstvideobalance.c: (gst_videobalance_init), (gst_videobalance_colorbalance_set_value), (gst_videobalance_colorbalance_get_value): Fixing videobalance ranges for colorbalance interface implementation. * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get), (gst_ximagesink_set_property), (gst_ximagesink_get_property), (gst_ximagesink_dispose), (gst_ximagesink_init), (gst_ximagesink_class_init): Adding DISPLAY property. * sys/ximage/ximagesink.h: Adding display_name to store display. * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get), (gst_xvimagesink_set_property), (gst_xvimagesink_get_property), (gst_xvimagesink_dispose), (gst_xvimagesink_init), (gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance properties (they still need polishing though for gst-launch use : no xcontext yet, i ll do that tomorrow). * sys/xvimage/xvimagesink.h: Adding display_name to store display.
Diffstat (limited to 'gst/videofilter/gstvideobalance.c')
-rw-r--r--gst/videofilter/gstvideobalance.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gst/videofilter/gstvideobalance.c b/gst/videofilter/gstvideobalance.c
index 766cc928..590f92ba 100644
--- a/gst/videofilter/gstvideobalance.c
+++ b/gst/videofilter/gstvideobalance.c
@@ -215,8 +215,8 @@ gst_videobalance_init (GTypeInstance *instance, gpointer g_class)
channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
channel->label = g_strdup (channels[i]);
- channel->min_value = G_MININT;
- channel->max_value = G_MAXINT;
+ channel->min_value = -1000;
+ channel->max_value = 1000;
videobalance->channels = g_list_append (videobalance->channels,
channel);
@@ -263,13 +263,13 @@ gst_videobalance_colorbalance_set_value (GstColorBalance *balance,
g_return_if_fail (channel->label != NULL);
if (!g_ascii_strcasecmp (channel->label, "HUE"))
- vb->hue = (value - G_MININT) * 2 / ((double) G_MAXINT - G_MININT) - 1;
+ vb->hue = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
else if (!g_ascii_strcasecmp (channel->label, "SATURATION"))
- vb->saturation = (value - G_MININT) * 2 / ((double) G_MAXINT - G_MININT);
+ vb->saturation = (value + 1000.0) * 2.0 / 2000.0;
else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS"))
- vb->brightness = (value - G_MININT) * 2 / ((double) G_MAXINT - G_MININT) - 1;
+ vb->brightness = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
else if (!g_ascii_strcasecmp (channel->label, "CONTRAST"))
- vb->contrast = (value - G_MININT) * 2 / ((double) G_MAXINT - G_MININT);
+ vb->contrast = (value + 1000.0) * 2.0 / 2000.0;
}
static gint
@@ -284,13 +284,13 @@ gst_videobalance_colorbalance_get_value (GstColorBalance *balance,
g_return_val_if_fail (channel->label != NULL, 0);
if (!g_ascii_strcasecmp (channel->label, "HUE"))
- value = (vb->hue + 1) * ((double) G_MAXINT - G_MININT) / 2 + G_MININT;
+ value = (vb->hue + 1) * 2000.0 / 2.0 - 1000.0;
else if (!g_ascii_strcasecmp (channel->label, "SATURATION"))
- value = vb->saturation * ((double) G_MAXINT - G_MININT) / 2 + G_MININT;
+ value = vb->saturation * 2000.0 / 2.0 - 1000.0;
else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS"))
- value = (vb->brightness + 1) * ((double) G_MAXINT - G_MININT) / 2 + G_MININT;
+ value = (vb->brightness + 1) * 2000.0 / 2.0 - 1000.0;
else if (!g_ascii_strcasecmp (channel->label, "CONTRAST"))
- value = vb->contrast * ((double) G_MAXINT - G_MININT) / 2 + G_MININT;
+ value = vb->contrast * 2000.0 / 2.0 - 1000.0;
return value;
}