aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamma.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-08 01:34:43 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-08 01:34:43 +0200
commit6e10b5d8eae9424b831b673e2ec63e9a64ecfe86 (patch)
treec8110ec031fbddc330776b960f659d8030f19d0d /src/gamma.c
parentdoc (diff)
downloadcrt-calibrator-6e10b5d8eae9424b831b673e2ec63e9a64ecfe86.tar.gz
crt-calibrator-6e10b5d8eae9424b831b673e2ec63e9a64ecfe86.tar.bz2
crt-calibrator-6e10b5d8eae9424b831b673e2ec63e9a64ecfe86.tar.xz
warnings + add state.c
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/gamma.c')
-rw-r--r--src/gamma.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gamma.c b/src/gamma.c
index 66f2f38..660c013 100644
--- a/src/gamma.c
+++ b/src/gamma.c
@@ -38,7 +38,7 @@ void gamma_analyse(size_t stops, const uint16_t* restrict ramp, double* restrict
middle = (double)(ramp[stops / 2]) / (double)0xFFFF;
middle = (middle - min) / (max - min);
- *gamma = log(2.0) / log(middle);
+ *gamma = log((double)2) / log(middle);
}
@@ -55,7 +55,7 @@ void gamma_generate(size_t stops, uint16_t* restrict ramp, double gamma,
double contrast, double brightness)
{
double diff = contrast - brightness;
- double gamma_ = 1.0 / gamma;
+ double gamma_ = (double)1 / gamma;
size_t i;
int32_t y;
double y_;
@@ -67,7 +67,7 @@ void gamma_generate(size_t stops, uint16_t* restrict ramp, double gamma,
y = (int32_t)(y * 0xFFFF);
if (y < 0x0000) y = 0x0000;
if (y > 0xFFFF) y = 0xFFFF;
- ramp[i] = y;
+ ramp[i] = (uint16_t)y;
}
}