findMinMaxPercentile(): clamp minOut and maxOut, #5030

This commit is contained in:
heckflosse 2018-11-29 13:51:04 +01:00
parent 15c18325c0
commit b63b411bee
1 changed files with 2 additions and 0 deletions

View File

@ -172,6 +172,7 @@ void findMinMaxPercentile(const float* data, size_t size, float minPrct, float&
// go back to original range
minOut /= scale;
minOut += minVal;
minOut = rtengine::LIM(minOut, minVal, maxVal);
// find (maxPrct*size) smallest value
const float threshmax = maxPrct * size;
@ -190,6 +191,7 @@ void findMinMaxPercentile(const float* data, size_t size, float minPrct, float&
// go back to original range
maxOut /= scale;
maxOut += minVal;
maxOut = rtengine::LIM(maxOut, minVal, maxVal);
}
void buildBlendMask(float** luminance, float **blend, int W, int H, float &contrastThreshold, float amount, bool autoContrast) {