diff options
Diffstat (limited to 'src/ipa/simple/algorithms/lut.cpp')
-rw-r--r-- | src/ipa/simple/algorithms/lut.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index 644b4f84..9744e773 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -63,15 +63,18 @@ void Lut::prepare(IPAContext &context, const unsigned int gammaTableSize = gammaTable.size(); for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { - const unsigned int div = static_cast<double>(DebayerParams::kRGBLookupSize) * - 256 / gammaTableSize; + const double div = static_cast<double>(DebayerParams::kRGBLookupSize) / + gammaTableSize; /* Apply gamma after gain! */ unsigned int idx; - idx = std::min({ i * gains.red / div, gammaTableSize - 1 }); + idx = std::min({ static_cast<unsigned int>(i * gains.red / div), + gammaTableSize - 1 }); params->red[i] = gammaTable[idx]; - idx = std::min({ i * gains.green / div, gammaTableSize - 1 }); + idx = std::min({ static_cast<unsigned int>(i * gains.green / div), + gammaTableSize - 1 }); params->green[i] = gammaTable[idx]; - idx = std::min({ i * gains.blue / div, gammaTableSize - 1 }); + idx = std::min({ static_cast<unsigned int>(i * gains.blue / div), + gammaTableSize - 1 }); params->blue[i] = gammaTable[idx]; } } |