[vlc-commits] adjust: convert hue from [0..360] integer to [-180..+180] float

Rémi Denis-Courmont git at videolan.org
Tue Aug 19 21:17:02 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 19 21:38:41 2014 +0300| [94ca70d4d341dd53729fbbe27fcd78eed82b78d6] | committer: Rémi Denis-Courmont

adjust: convert hue from [0..360] integer to [-180..+180] float

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=94ca70d4d341dd53729fbbe27fcd78eed82b78d6
---

 lib/media_player.c            |    2 +-
 lib/video.c                   |    2 +-
 modules/video_filter/adjust.c |   12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index c2bb7c2..f234b57 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -556,7 +556,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
 
     var_Create (mp, "contrast", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
     var_Create (mp, "brightness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
-    var_Create (mp, "hue", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
+    var_Create (mp, "hue", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
     var_Create (mp, "saturation", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
     var_Create (mp, "gamma", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
 
diff --git a/lib/video.c b/lib/video.c
index 3f3d19a..5b89fd6 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -869,7 +869,7 @@ adjust_option_bynumber( unsigned option )
         { "adjust",     0 },
         { "contrast",   VLC_VAR_FLOAT },
         { "brightness", VLC_VAR_FLOAT },
-        { "hue",        VLC_VAR_INTEGER },
+        { "hue",        VLC_VAR_FLOAT },
         { "saturation", VLC_VAR_FLOAT },
         { "gamma",      VLC_VAR_FLOAT },
     };
diff --git a/modules/video_filter/adjust.c b/modules/video_filter/adjust.c
index 725a683..eb28fe7 100644
--- a/modules/video_filter/adjust.c
+++ b/modules/video_filter/adjust.c
@@ -91,7 +91,7 @@ vlc_module_begin ()
     add_float_with_range( "brightness", 1.0, 0.0, 2.0,
                            LUM_TEXT, LUM_LONGTEXT, false )
         change_safe()
-    add_integer_with_range( "hue", 0, 0, 360,
+    add_float_with_range( "hue", 0, -180., +180.,
                             HUE_TEXT, HUE_LONGTEXT, false )
         change_safe()
     add_float_with_range( "saturation", 1.0, 0.0, 3.0,
@@ -121,7 +121,7 @@ struct filter_sys_t
     vlc_mutex_t lock;
     double     f_contrast;
     double     f_brightness;
-    int        i_hue;
+    float      f_hue;
     double     f_saturation;
     double     f_gamma;
     bool       b_brightness_threshold;
@@ -158,7 +158,7 @@ static int Create( vlc_object_t *p_this )
 
     p_sys->f_contrast = var_CreateGetFloatCommand( p_filter, "contrast" );
     p_sys->f_brightness = var_CreateGetFloatCommand( p_filter, "brightness" );
-    p_sys->i_hue = var_CreateGetIntegerCommand( p_filter, "hue" );
+    p_sys->f_hue = var_CreateGetFloatCommand( p_filter, "hue" );
     p_sys->f_saturation = var_CreateGetFloatCommand( p_filter, "saturation" );
     p_sys->f_gamma = var_CreateGetFloatCommand( p_filter, "gamma" );
     p_sys->b_brightness_threshold =
@@ -254,7 +254,7 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
     vlc_mutex_lock( &p_sys->lock );
     i_cont = (int)( p_sys->f_contrast * 255 );
     i_lum = (int)( (p_sys->f_brightness - 1.0)*255 );
-    f_hue = (float)( p_sys->i_hue * M_PI / 180 );
+    f_hue = p_sys->f_hue * (float)(M_PI / 180.);
     i_sat = (int)( p_sys->f_saturation * 256 );
     f_gamma = 1.0 / p_sys->f_gamma;
     b_thres = p_sys->b_brightness_threshold;
@@ -415,7 +415,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
     vlc_mutex_lock( &p_sys->lock );
     i_cont = (int)( p_sys->f_contrast * 255 );
     i_lum = (int)( (p_sys->f_brightness - 1.0)*255 );
-    f_hue = (float)( p_sys->i_hue * M_PI / 180 );
+    f_hue = p_sys->f_hue * (float)(M_PI / 180.);
     i_sat = (int)( p_sys->f_saturation * 256 );
     f_gamma = 1.0 / p_sys->f_gamma;
     b_thres = p_sys->b_brightness_threshold;
@@ -550,7 +550,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
     else if( !strcmp( psz_var, "brightness" ) )
         p_sys->f_brightness = newval.f_float;
     else if( !strcmp( psz_var, "hue" ) )
-        p_sys->i_hue = newval.i_int;
+        p_sys->f_hue = newval.f_float;
     else if( !strcmp( psz_var, "saturation" ) )
         p_sys->f_saturation = newval.f_float;
     else if( !strcmp( psz_var, "gamma" ) )



More information about the vlc-commits mailing list