diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-18 11:17:24 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-18 11:17:24 +0200 |
commit | 624495eaec82eeef214bef24588602602173e096 (patch) | |
tree | 23ae9671fbfcd9c8ceb6caea24724d6dc1ca79cf | |
parent | dist (diff) | |
download | crt-calibrator-1.1.tar.gz crt-calibrator-1.1.tar.bz2 crt-calibrator-1.1.tar.xz |
Get the proper middle of the gamma ramp when calculating the gamma correction1.1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/gamma.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gamma.c b/src/gamma.c index f0dc05b..79a50f7 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -37,6 +37,12 @@ void gamma_analyse(size_t stops, const uint16_t* restrict ramp, double* restrict *contrast = max = (double)(ramp[stops - 1]) / (double)0xFFFF; middle = (double)(ramp[stops / 2]) / (double)0xFFFF; + if (stops % 2 == 0) + { + middle += (double)(ramp[stops / 2 - 1]) / (double)0xFFFF; + middle /= (double)2; + } + middle = (middle - min) / (max - min); *gamma = -log((double)2) / log(middle); } |