Make some more files cppcheck clean (#6133)

* Make some more files cppcheck clean

* revert change of dcrop.cc from last commit

* Replace calculation: y = pow(x, 1/ (2.f * 2.f)) by y = sqrt(sqrt(x))

* Revert "Replace calculation: y = pow(x, 1/ (2.f * 2.f)) by y = sqrt(sqrt(x))"

This reverts commit d639c67249f1723fa9f9e55e0442afcb862eba91.
This commit is contained in:
Ingo Weyrich 2021-02-24 22:39:23 +01:00 committed by GitHub
parent 7a2463a81a
commit f727477710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 40 deletions

View File

@ -65,7 +65,7 @@ public:
virtual void onDestroy() = 0; virtual void onDestroy() = 0;
}; };
Cache(unsigned long _size, Hook* _hook = nullptr) : explicit Cache(unsigned long _size, Hook* _hook = nullptr) :
store_size(_size), store_size(_size),
hook(_hook) hook(_hook)
{ {

View File

@ -1132,7 +1132,6 @@ void Crop::update(int todo)
/* /*
if (params.icm.workingTRC == "Custom") { //exec TRC IN free if (params.icm.workingTRC == "Custom") { //exec TRC IN free
const Glib::ustring profile = params.icm.workingProfile; const Glib::ustring profile = params.icm.workingProfile;
if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") { if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") {
const int cw = baseCrop->getWidth(); const int cw = baseCrop->getWidth();
const int ch = baseCrop->getHeight(); const int ch = baseCrop->getHeight();
@ -1159,22 +1158,6 @@ void Crop::update(int todo)
} }
} }
/*xref=000;yref=000;
if (colortest && cropw>115 && croph>115)
for(int j=1;j<5;j++){
xref+=j*30;yref+=j*30;
if (settings->verbose) {
printf("after rgbProc RGB Xr%i Yr%i Skip=%d R=%f G=%f B=%f \n",xref,yref,skip,
baseCrop->r[(int)(xref/skip)][(int)(yref/skip)]/256,
baseCrop->g[(int)(xref/skip)][(int)(yref/skip)]/256,
baseCrop->b[(int)(xref/skip)][(int)(yref/skip)]/256);
printf("after rgbProc Lab Xr%i Yr%i Skip=%d l=%f a=%f b=%f \n",xref,yref,skip,
laboCrop->L[(int)(xref/skip)][(int)(yref/skip)]/327,
laboCrop->a[(int)(xref/skip)][(int)(yref/skip)]/327,
laboCrop->b[(int)(xref/skip)][(int)(yref/skip)]/327);
}
}*/
// apply luminance operations // apply luminance operations
if (todo & (M_LUMINANCE + M_COLOR)) { // if (todo & (M_LUMINANCE + M_COLOR)) { //
//I made a little change here. Rather than have luminanceCurve (and others) use in/out lab images, we can do more if we copy right here. //I made a little change here. Rather than have luminanceCurve (and others) use in/out lab images, we can do more if we copy right here.

View File

@ -322,7 +322,7 @@ void ImProcFunctions::impulse_nrcam (CieImage* ncie, double thresh, float **buff
hfnbrave += fabs(ncie->sh_p[i1][j1] - lpf[i1][j1]); hfnbrave += fabs(ncie->sh_p[i1][j1] - lpf[i1][j1]);
} }
impish[i][j] = (hpfabs > ((hfnbrave - hpfabs) * impthrDiv24)); impish[i][j] = static_cast<float>(hpfabs > ((hfnbrave - hpfabs) * impthrDiv24));
} }
#ifdef __SSE2__ #ifdef __SSE2__
@ -353,7 +353,7 @@ void ImProcFunctions::impulse_nrcam (CieImage* ncie, double thresh, float **buff
hfnbrave += fabs(ncie->sh_p[i1][j1] - lpf[i1][j1]); hfnbrave += fabs(ncie->sh_p[i1][j1] - lpf[i1][j1]);
} }
impish[i][j] = (hpfabs > ((hfnbrave - hpfabs) * impthrDiv24)); impish[i][j] = static_cast<float>(hpfabs > ((hfnbrave - hpfabs) * impthrDiv24));
} }
for (; j < width; j++) { for (; j < width; j++) {
@ -365,7 +365,7 @@ void ImProcFunctions::impulse_nrcam (CieImage* ncie, double thresh, float **buff
hfnbrave += fabs(ncie->sh_p[i1][j1] - lpf[i1][j1]); hfnbrave += fabs(ncie->sh_p[i1][j1] - lpf[i1][j1]);
} }
impish[i][j] = (hpfabs > ((hfnbrave - hpfabs) * impthrDiv24)); impish[i][j] = static_cast<float>(hpfabs > ((hfnbrave - hpfabs) * impthrDiv24));
} }
} }
} }

View File

@ -96,7 +96,8 @@ inline void copyAndClamp(const LabImage *src, unsigned char *dst, const double r
gbuffer[j] = Color::gamma2curve[G]; gbuffer[j] = Color::gamma2curve[G];
bbuffer[j] = Color::gamma2curve[B]; bbuffer[j] = Color::gamma2curve[B];
} }
for (int j = 0; j < W; ++j) {
for (j = 0; j < W; ++j) {
dst[ix++] = uint16ToUint8Rounded(rbuffer[j]); dst[ix++] = uint16ToUint8Rounded(rbuffer[j]);
dst[ix++] = uint16ToUint8Rounded(gbuffer[j]); dst[ix++] = uint16ToUint8Rounded(gbuffer[j]);
dst[ix++] = uint16ToUint8Rounded(bbuffer[j]); dst[ix++] = uint16ToUint8Rounded(bbuffer[j]);

View File

@ -543,8 +543,8 @@ BENCHFUN
// calculate contrast based blend factors to reduce sharpening in regions with low contrast // calculate contrast based blend factors to reduce sharpening in regions with low contrast
JaggedArray<float> blend(W, H); JaggedArray<float> blend(W, H);
float contrast = params->sharpenMicro.contrast / 100.0; float contrastThreshold = params->sharpenMicro.contrast / 100.0;
buildBlendMask(luminance, blend, W, H, contrast); buildBlendMask(luminance, blend, W, H, contrastThreshold);
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel #pragma omp parallel

View File

@ -1182,30 +1182,28 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
float* noisevarhue = new float[GHL * GWL]; float* noisevarhue = new float[GHL * GWL];
int GW2L = (GWL + 1) / 2; int GW2L = (GWL + 1) / 2;
float nvlh[13] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.7f, 0.5f}; //high value constexpr float nvlh[13] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.7f, 0.5f}; //high value
float nvll[13] = {0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.35f, 0.4f, 0.45f, 0.7f, 0.8f, 1.f, 1.f, 1.f}; //low value constexpr float nvll[13] = {0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.35f, 0.4f, 0.45f, 0.7f, 0.8f, 1.f, 1.f, 1.f}; //low value
float seuillow = 3000.f;//low constexpr float seuillow = 3000.f;//low
float seuilhigh = 18000.f;//high constexpr float seuilhigh = 18000.f;//high
int i = 10 - cp.ballum; const int index = 10 - cp.ballum;
float ac = (nvlh[i] - nvll[i]) / (seuillow - seuilhigh); const float ac = (nvlh[index] - nvll[index]) / (seuillow - seuilhigh);
float bc = nvlh[i] - seuillow * ac; const float bc = nvlh[index] - seuillow * ac;
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for #pragma omp parallel for
#endif #endif
for (int ir = 0; ir < GHL; ir++) for (int ir = 0; ir < GHL; ir++)
for (int jr = 0; jr < GWL; jr++) { for (int jr = 0; jr < GWL; jr++) {
float lN = labco->L[ir][jr]; float lN = labco->L[ir][jr];
if (lN < seuillow) { if (lN < seuillow) {
noisevarlum[(ir >> 1)*GW2L + (jr >> 1)] = nvlh[i]; noisevarlum[(ir >> 1)*GW2L + (jr >> 1)] = nvlh[index];
} else if (lN < seuilhigh) { } else if (lN < seuilhigh) {
noisevarlum[(ir >> 1)*GW2L + (jr >> 1)] = ac * lN + bc; noisevarlum[(ir >> 1)*GW2L + (jr >> 1)] = ac * lN + bc;
} else { } else {
noisevarlum[(ir >> 1)*GW2L + (jr >> 1)] = nvll[i]; noisevarlum[(ir >> 1)*GW2L + (jr >> 1)] = nvll[index];
} }
} }
@ -2265,11 +2263,7 @@ void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const
absciss = asig * std::fabs(tempwav) + bsig; absciss = asig * std::fabs(tempwav) + bsig;
} else { } else {
absciss = amean * std::fabs(tempwav); absciss = amean * std::fabs(tempwav);
float k = sig; float abs = pow(2.f * absciss, (1.f / SQR(sig)));
if(sig > 1.f) {
k = SQR(sig);
}
float abs = pow(2.f * absciss, (1.f / k));
absciss = 0.5f * abs; absciss = 0.5f * abs;
} }
float kc = wavguid.getVal(absciss) -1.f; float kc = wavguid.getVal(absciss) -1.f;