use a bezier curve to get the brightness percent
This commit is contained in:
parent
35ac14a0ea
commit
607dff0396
1 changed files with 8 additions and 1 deletions
|
|
@ -55,6 +55,13 @@ int read_int(FILE *fp)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float bezier(float t)
|
||||||
|
{
|
||||||
|
const float B = 0.66;
|
||||||
|
const float D = 0.28;
|
||||||
|
return 3*B*t+(3*D-6*B)*t*t+(1+3*B-3*D)*t*t*t;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: add some command line options like:
|
// TODO: add some command line options like:
|
||||||
// -v: verbose/logging
|
// -v: verbose/logging
|
||||||
// -c file; specify a config file
|
// -c file; specify a config file
|
||||||
|
|
@ -123,7 +130,7 @@ int main (void)
|
||||||
for (int i = 0; i < MEDIAN_SAMPLES; i++) {
|
for (int i = 0; i < MEDIAN_SAMPLES; i++) {
|
||||||
luminance += luminance_samples[i] / MEDIAN_SAMPLES;
|
luminance += luminance_samples[i] / MEDIAN_SAMPLES;
|
||||||
}
|
}
|
||||||
luminance_percent = MIN(luminance/max_luminance, 1.0);
|
luminance_percent = bezier(MIN(luminance/max_luminance, 1.0));
|
||||||
|
|
||||||
brightness_old = brightness_target;
|
brightness_old = brightness_target;
|
||||||
brightness_target = MAX((int)(luminance_percent * max_brightness), min_brightness);
|
brightness_target = MAX((int)(luminance_percent * max_brightness), min_brightness);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue