Commit eebb0e83 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

vdpau: switch hue to float

parent 94ca70d4
......@@ -84,19 +84,22 @@ static int SaturationCallback(vlc_object_t *obj, const char *varname,
return VLC_SUCCESS;
}
static float vlc_to_vdp_hue(int hue)
static float vlc_to_vdp_hue(float hue)
{
hue %= 360;
if (hue > 180)
hue -= 360;
return (float)hue * (float)(M_PI / 180.);
float dummy;
hue /= 360.f;
hue = modff(hue, &dummy);
if (hue > .5f)
hue -= 1.f;
return hue * (float)(2. * M_PI);
}
static int HueCallback(vlc_object_t *obj, const char *varname,
vlc_value_t prev, vlc_value_t cur, void *data)
{
vlc_atomic_store_float(data, vlc_to_vdp_hue(cur.i_int));
vlc_atomic_store_float(data, vlc_to_vdp_hue(cur.f_float));
(void) obj; (void) varname; (void) prev;
return VLC_SUCCESS;
}
......@@ -158,7 +161,7 @@ static int Open(vlc_object_t *obj)
&sys->saturation);
vlc_atomic_init_float(&sys->saturation, vlc_to_vdp_saturation(f));
i = var_CreateGetIntegerCommand(filter, "hue");
i = var_CreateGetFloatCommand(filter, "hue");
var_AddCallback(filter, "hue", HueCallback, &sys->hue);
vlc_atomic_init_float(&sys->hue, vlc_to_vdp_hue(i));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment