totem r5539 - in trunk: . src/backend
- From: tpm svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5539 - in trunk: . src/backend
- Date: Thu, 7 Aug 2008 11:35:23 +0000 (UTC)
Author: tpm
Date: Thu Aug 7 11:35:22 2008
New Revision: 5539
URL: http://svn.gnome.org/viewvc/totem?rev=5539&view=rev
Log:
Patch by: David Schleef <ds schleef org>
* src/backend/bacon-video-widget-gst-0.10.c:
(bacon_video_widget_get_video_property),
(bacon_video_widget_set_video_property)::
Fix rounding errors when converting colorbalance values to/from
a different value range. Should fix drift in colour balance.
(Closes: #545566, #537889)
Modified:
trunk/ChangeLog
trunk/src/backend/bacon-video-widget-gst-0.10.c
Modified: trunk/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-gst-0.10.c (original)
+++ trunk/src/backend/bacon-video-widget-gst-0.10.c Thu Aug 7 11:35:22 2008
@@ -58,6 +58,7 @@
#include <time.h>
#include <string.h>
#include <stdio.h>
+#include <math.h>
/* gtk+/gnome */
#include <gdk/gdkx.h>
@@ -3708,8 +3709,9 @@
GST_DEBUG ("channel %s: cur=%d, min=%d, max=%d", found_channel->label,
cur, found_channel->min_value, found_channel->max_value);
- ret = ((double) cur - found_channel->min_value) * 65535 /
- ((double) found_channel->max_value - found_channel->min_value);
+ ret = floor (0.5 +
+ ((double) cur - found_channel->min_value) * 65535 /
+ ((double) found_channel->max_value - found_channel->min_value));
GST_DEBUG ("channel %s: returning value %d", found_channel->label, ret);
g_object_unref (found_channel);
@@ -3782,8 +3784,10 @@
if (found_channel && GST_IS_COLOR_BALANCE_CHANNEL (found_channel))
{
- int i_value = value * ((double) found_channel->max_value -
- found_channel->min_value) / 65535 + found_channel->min_value;
+ int i_value;
+
+ i_value = floor (0.5 + value * ((double) found_channel->max_value -
+ found_channel->min_value) / 65535 + found_channel->min_value);
GST_DEBUG ("channel %s: set to %d/65535", found_channel->label, value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]