Division by zero in Raw Whitepoint Correction, reported by cppcheck, no Issue

This commit is contained in:
Ingo
2014-09-01 11:20:24 +02:00
parent 79dc8c97de
commit 1432ca1fc2

View File

@@ -113,7 +113,7 @@ void RawImageSource::processRawWhitepoint(float expos, float preser) {
if(expos>1){
// Positive exposure
K = (float) maxVal / expos*exp(-preser*log(2.0));
for (int j=0;j<=maxVal;j++)
for (int j=max(1,(int)K);j<=maxVal;j++)
lut[(int)j]=(((float)maxVal-K*expos)/((float)maxVal-K)*(j-maxVal)+(float) maxVal) / j;
} else {
// Negative exposure