Merge pull request #2973 from Beep6581/waveletcrashfix
RT crashes when using wavelet on completely overexposed image, fixes …
This commit is contained in:
@@ -1377,8 +1377,17 @@ void ImProcFunctions::Aver( float * RESTRICT DataList, int datalen, float &aver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(countP > 0) {
|
||||||
averagePlus = averaP / countP;
|
averagePlus = averaP / countP;
|
||||||
|
} else {
|
||||||
|
averagePlus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(countN > 0) {
|
||||||
averageNeg = averaN / countN;
|
averageNeg = averaN / countN;
|
||||||
|
} else {
|
||||||
|
averageNeg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1403,8 +1412,17 @@ void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float aver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(countP > 0) {
|
||||||
sigmaPlus = sqrt(variP / countP);
|
sigmaPlus = sqrt(variP / countP);
|
||||||
|
} else {
|
||||||
|
sigmaPlus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(countN > 0) {
|
||||||
sigmaNeg = sqrt(variN / countN);
|
sigmaNeg = sqrt(variN / countN);
|
||||||
|
} else {
|
||||||
|
sigmaNeg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2516,7 +2534,7 @@ void ImProcFunctions::calckoe(float ** WavCoeffs_LL, struct cont_params cp, floa
|
|||||||
void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp,
|
void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp,
|
||||||
int W_L, int H_L, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL)
|
int W_L, int H_L, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL)
|
||||||
{
|
{
|
||||||
if(cp.diagcurv && cp.finena) {//curve
|
if(cp.diagcurv && cp.finena && MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f ) { //curve
|
||||||
float insigma = 0.666f; //SD
|
float insigma = 0.666f; //SD
|
||||||
float logmax = log(MaxP[level]); //log Max
|
float logmax = log(MaxP[level]); //log Max
|
||||||
float rapX = (mean[level] + sigma[level]) / MaxP[level]; //rapport between sD / max
|
float rapX = (mean[level] + sigma[level]) / MaxP[level]; //rapport between sD / max
|
||||||
@@ -2530,6 +2548,7 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0,
|
|||||||
#ifdef _RT_NESTED_OPENMP
|
#ifdef _RT_NESTED_OPENMP
|
||||||
#pragma omp parallel for schedule(dynamic, W_L * 16) num_threads(wavNestedLevels) if(wavNestedLevels>1)
|
#pragma omp parallel for schedule(dynamic, W_L * 16) num_threads(wavNestedLevels) if(wavNestedLevels>1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < W_L * H_L; i++) {
|
for (int i = 0; i < W_L * H_L; i++) {
|
||||||
float absciss;
|
float absciss;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user