Fix all warnings in improcfun.cc

This commit is contained in:
heckflosse 2017-03-31 14:28:12 +02:00
parent 21b1a34c24
commit 096bbeaf78
3 changed files with 25 additions and 65 deletions

View File

@ -599,7 +599,7 @@ public:
vint sumv = (vint)ZEROV; vint sumv = (vint)ZEROV;
vfloat avgv = ZEROV; vfloat avgv = ZEROV;
for(; i < size - 3; i += 4) { for(; i < static_cast<int>(size) - 3; i += 4) {
vint datav = _mm_loadu_si128((__m128i*)&data[i]); vint datav = _mm_loadu_si128((__m128i*)&data[i]);
sumv += datav; sumv += datav;
avgv += iv * _mm_cvtepi32_ps(datav); avgv += iv * _mm_cvtepi32_ps(datav);
@ -611,7 +611,7 @@ public:
avg = vhadd(avgv); avg = vhadd(avgv);
#endif #endif
for (; i < size; i++) { for (; i < static_cast<int>(size); i++) {
T val = data[i]; T val = data[i];
sum += val; sum += val;
avg += i * val; avg += i * val;

View File

@ -246,9 +246,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
//end preparate histogram //end preparate histogram
int width = lab->W, height = lab->H; int width = lab->W, height = lab->H;
float minQ = 10000.f; float minQ = 10000.f;
float minM = 10000.f;
float maxQ = -1000.f; float maxQ = -1000.f;
float maxM = -1000.f;
float w_h; float w_h;
float a_w; float a_w;
float c_; float c_;
@ -256,9 +254,9 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
double Yw; double Yw;
Yw = 1.0; Yw = 1.0;
double Xw, Zw; double Xw, Zw;
double f, c, nc, yb, la, xw, yw, zw, f2, c2, nc2, yb2, la2; double f, c, nc, yb = 0., la, xw, yw, zw, f2 = 0., c2 = 0., nc2 = 0., yb2 = 0., la2;
double fl, n, nbb, ncb, aw; double fl, n, nbb, ncb, aw;
double xwd, ywd, zwd; double xwd = 0., ywd, zwd = 0.;
int alg = 0; int alg = 0;
bool algepd = false; bool algepd = false;
float sum = 0.f; float sum = 0.f;
@ -1199,9 +1197,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
float t_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[1]) / 100.0f; float t_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[1]) / 100.0f;
float b_r = static_cast<float>(params->dirpyrequalizer.hueskin.value[2]) / 100.0f; float b_r = static_cast<float>(params->dirpyrequalizer.hueskin.value[2]) / 100.0f;
float t_r = static_cast<float>(params->dirpyrequalizer.hueskin.value[3]) / 100.0f; float t_r = static_cast<float>(params->dirpyrequalizer.hueskin.value[3]) / 100.0f;
int choice = 0;
bool alread = false;
float artifact = (float) settings->artifact_cbdl; float artifact = (float) settings->artifact_cbdl;
if(artifact > 6.f) { if(artifact > 6.f) {
@ -1216,7 +1212,6 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
float chrom = 50.f; float chrom = 50.f;
{ {
ImProcFunctions::badpixcam (ncie, artifact, 5, 2 , b_l, t_l, t_r, b_r, params->dirpyrequalizer.skinprotect , chrom, hotbad); //enabled remove artifacts for cbDL ImProcFunctions::badpixcam (ncie, artifact, 5, 2 , b_l, t_l, t_r, b_r, params->dirpyrequalizer.skinprotect , chrom, hotbad); //enabled remove artifacts for cbDL
alread = true;
} }
} }
} }
@ -1479,7 +1474,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int
float Yw; float Yw;
Yw = 1.0; Yw = 1.0;
double Xw, Zw; double Xw, Zw;
float f, nc, yb, la, c, xw, yw, zw, f2, c2, nc2, yb2; float f, nc, yb = 0.f, la, c, xw, yw, zw, f2, c2 = 1.f, nc2, yb2;
float fl, n, nbb, ncb, aw; //d float fl, n, nbb, ncb, aw; //d
float xwd, ywd, zwd; float xwd, ywd, zwd;
int alg = 0; int alg = 0;
@ -1658,24 +1653,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int
// extracting datas from 'params' to avoid cache flush (to be confirmed) // extracting datas from 'params' to avoid cache flush (to be confirmed)
const ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode; const ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode;
const bool hasColCurve1 = bool(customColCurve1); const bool hasColCurve1 = bool(customColCurve1);
bool t1L = false; const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_LIGHT;
bool t1B = false;
if (hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_LIGHT) {
t1L = true;
}
if(hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) {
t1B = true;
}
const ColorAppearanceParams::eTCModeId curveMode2 = params->colorappearance.curveMode2; const ColorAppearanceParams::eTCModeId curveMode2 = params->colorappearance.curveMode2;
const bool hasColCurve2 = bool(customColCurve2); const bool hasColCurve2 = bool(customColCurve2);
bool t2B = false;
if(hasColCurve2 && curveMode2 == ColorAppearanceParams::TC_MODE_BRIGHT) {
t2B = true;
}
const ColorAppearanceParams::eCTCModeId curveMode3 = params->colorappearance.curveMode3; const ColorAppearanceParams::eCTCModeId curveMode3 = params->colorappearance.curveMode3;
const bool hasColCurve3 = bool(customColCurve3); const bool hasColCurve3 = bool(customColCurve3);
@ -2472,10 +2453,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int
// gamut control in Lab mode; I must study how to do with cIECAM only // gamut control in Lab mode; I must study how to do with cIECAM only
if(gamu == 1) { if(gamu == 1) {
float HH, Lprov1, Chprov1; float Lprov1, Chprov1;
Lprov1 = Ll / 327.68f; Lprov1 = Ll / 327.68f;
Chprov1 = sqrtf(SQR(aa) + SQR(bb)) / 327.68f; Chprov1 = sqrtf(SQR(aa) + SQR(bb)) / 327.68f;
HH = xatan2f(bb, aa);
float2 sincosval; float2 sincosval;
if(Chprov1 == 0.0f) { if(Chprov1 == 0.0f) {
@ -2953,9 +2933,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
BENCHFUN BENCHFUN
Imagefloat *tmpImage = nullptr; Imagefloat *tmpImage = nullptr;
// NOTE: We're getting all 3 pointers here, but this function may not need them all, so one could optimize this
Imagefloat* editImgFloat = nullptr; Imagefloat* editImgFloat = nullptr;
LabImage* editLab = nullptr;
PlanarWhateverData<float>* editWhatever = nullptr; PlanarWhateverData<float>* editWhatever = nullptr;
EditUniqueID editID = pipetteBuffer ? pipetteBuffer->getEditID() : EUID_None; EditUniqueID editID = pipetteBuffer ? pipetteBuffer->getEditID() : EUID_None;
@ -2966,7 +2944,6 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
break; break;
case (BT_LABIMAGE): case (BT_LABIMAGE):
editLab = pipetteBuffer->getLabBuffer();
break; break;
case (BT_SINGLEPLANE_FLOAT): case (BT_SINGLEPLANE_FLOAT):
@ -3274,9 +3251,6 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
tmpImage = new Imagefloat(working->getWidth(), working->getHeight()); tmpImage = new Imagefloat(working->getWidth(), working->getHeight());
} }
int W = working->getWidth();
int H = working->getHeight();
// For tonecurve histogram // For tonecurve histogram
int toneCurveHistSize = histToneCurve ? histToneCurve.getSize() : 0; int toneCurveHistSize = histToneCurve ? histToneCurve.getSize() : 0;
int histToneCurveCompression; int histToneCurveCompression;
@ -3310,7 +3284,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
int tH; int tH;
// Allocating buffer for the PipetteBuffer // Allocating buffer for the PipetteBuffer
float *editIFloatTmpR, *editIFloatTmpG, *editIFloatTmpB, *editWhateverTmp; float *editIFloatTmpR = nullptr, *editIFloatTmpG = nullptr, *editIFloatTmpB = nullptr, *editWhateverTmp = nullptr;
if (editImgFloat) { if (editImgFloat) {
editIFloatBuffer = (char *) malloc(3 * sizeof(float) * TS * TS + 20 * 64 + 63); editIFloatBuffer = (char *) malloc(3 * sizeof(float) * TS * TS + 20 * 64 + 63);
@ -3952,7 +3926,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
else if (params->colorToning.method == "Lab" && opautili) { else if (params->colorToning.method == "Lab" && opautili) {
int algm = 0; int algm = 0;
bool twocol = true;//true=500 color false=2 color bool twocol = true;//true=500 color false=2 color
int metchrom; int metchrom = 0;
if (params->colorToning.twocolor == "Std" ) { if (params->colorToning.twocolor == "Std" ) {
metchrom = 0; metchrom = 0;
@ -3968,7 +3942,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
twocol = false; twocol = false;
} }
float iplow, iphigh; float iplow = 0.f, iphigh = 0.f;
if(!twocol) { if(!twocol) {
iplow = (float)ctColorCurve.low; iplow = (float)ctColorCurve.low;
@ -5205,8 +5179,6 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
Color::rgb2hsv(r, g, b, h, s, v); Color::rgb2hsv(r, g, b, h, s, v);
float ksat = 1.f; float ksat = 1.f;
float ksatlow = 1.f; float ksatlow = 1.f;
float s_0 = 0.55f;
float s_1 = 0.85f;
/* /*
if(mode==0) {//color if(mode==0) {//color
if(s < s_0) ksat=SQR((1.f/s_0)*s); if(s < s_0) ksat=SQR((1.f/s_0)*s);
@ -5223,7 +5195,7 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
float aa, bb, cc; float aa, bb, cc;
//fixed value of reducac =0.4; //fixed value of reducac =0.4;
secondeg_end (reducac, iplow, aa, bb, cc); secondeg_end (reducac, iplow, aa, bb, cc);
float aab, bbb, ccb; float aab, bbb;
secondeg_begin (0.7f, iplow, aab, bbb); secondeg_begin (0.7f, iplow, aab, bbb);
@ -5458,9 +5430,6 @@ SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBu
// lhskcurve.dump("lh_curve"); // lhskcurve.dump("lh_curve");
//init Flatcurve for C=f(H) //init Flatcurve for C=f(H)
// NOTE: We're getting all 3 pointers here, but this function may not need them all, so one could optimize this
Imagefloat* editImgFloat = nullptr;
LabImage* editLab = nullptr;
PlanarWhateverData<float>* editWhatever = nullptr; PlanarWhateverData<float>* editWhatever = nullptr;
EditUniqueID editID = EUID_None; EditUniqueID editID = EUID_None;
bool editPipette = false; bool editPipette = false;
@ -5473,11 +5442,9 @@ SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBu
switch (pipetteBuffer->getDataProvider()->getCurrSubscriber()->getPipetteBufferType()) { switch (pipetteBuffer->getDataProvider()->getCurrSubscriber()->getPipetteBufferType()) {
case (BT_IMAGEFLOAT): case (BT_IMAGEFLOAT):
editImgFloat = pipetteBuffer->getImgFloatBuffer();
break; break;
case (BT_LABIMAGE): case (BT_LABIMAGE):
editLab = pipetteBuffer->getLabBuffer();
break; break;
case (BT_SINGLEPLANE_FLOAT): case (BT_SINGLEPLANE_FLOAT):
@ -6404,7 +6371,6 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w
float sca = params->epd.scale; float sca = params->epd.scale;
float gamm = params->epd.gamma; float gamm = params->epd.gamma;
float rew = params->epd.reweightingIterates; float rew = params->epd.reweightingIterates;
unsigned int i, N = Wid * Hei;
float Qpro = ( 4.0 / c_) * ( a_w + 4.0 ) ; //estimate Q max if J=100.0 float Qpro = ( 4.0 / c_) * ( a_w + 4.0 ) ; //estimate Q max if J=100.0
float *Qpr = ncie->Q_p[0]; float *Qpr = ncie->Q_p[0];
@ -6519,7 +6485,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
float *L = lab->L[0]; float *L = lab->L[0];
float *a = lab->a[0]; float *a = lab->a[0];
float *b = lab->b[0]; float *b = lab->b[0];
unsigned int i, N = lab->W * lab->H; size_t N = lab->W * lab->H;
EdgePreservingDecomposition epd(lab->W, lab->H); EdgePreservingDecomposition epd(lab->W, lab->H);
//Due to the taking of logarithms, L must be nonnegative. Further, scale to 0 to 1 using nominal range of L, 0 to 15 bit. //Due to the taking of logarithms, L must be nonnegative. Further, scale to 0 to 1 using nominal range of L, 0 to 15 bit.
@ -6531,7 +6497,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
float lmaxL = 0.f; float lmaxL = 0.f;
#pragma omp for #pragma omp for
for(i = 0; i < N; i++) { for(size_t i = 0; i < N; i++) {
if(L[i] < lminL) { if(L[i] < lminL) {
lminL = L[i]; lminL = L[i];
} }
@ -6542,15 +6508,15 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
} }
#pragma omp critical #pragma omp critical
{
if(lminL < minL) {
minL = lminL;
}
if(lminL < minL) { if(lmaxL > maxL) {
minL = lminL; maxL = lmaxL;
}
} }
if(lmaxL > maxL) {
maxL = lmaxL;
}
} }
if(minL > 0.0f) { if(minL > 0.0f) {
@ -6559,7 +6525,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
#pragma omp parallel for #pragma omp parallel for
for(i = 0; i < N; i++) for(size_t i = 0; i < N; ++i)
//{L[i] = (L[i] - minL)/32767.0f; //{L[i] = (L[i] - minL)/32767.0f;
{ {
L[i] = (L[i] - minL) / maxL; L[i] = (L[i] - minL) / maxL;
@ -6594,7 +6560,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
#pragma omp parallel for // removed schedule(dynamic,10) #pragma omp parallel for // removed schedule(dynamic,10)
#endif #endif
for(int ii = 0; ii < N; ii++) { for(size_t ii = 0; ii < N; ++ii) {
a[ii] *= s; a[ii] *= s;
b[ii] *= s; b[ii] *= s;
L[ii] = L[ii] * maxL * (1.f / gamm) + minL; L[ii] = L[ii] * maxL * (1.f / gamm) + minL;
@ -6730,7 +6696,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
// compute clipping points based on the original histograms (linear, without exp comp.) // compute clipping points based on the original histograms (linear, without exp comp.)
int clipped = 0; unsigned int clipped = 0;
int rawmax = (imax) - 1; int rawmax = (imax) - 1;
while (histogram[rawmax] + clipped <= 0 && rawmax > 1) { while (histogram[rawmax] + clipped <= 0 && rawmax > 1) {
@ -6739,17 +6705,15 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
} }
//compute clipped white point //compute clipped white point
int clippable = (int)(sum * clip / 100.f ); unsigned int clippable = (int)(sum * clip / 100.f );
int somm = sum;
clipped = 0; clipped = 0;
int whiteclip = (imax) - 1; int whiteclip = (imax) - 1;
while (whiteclip > 1 && histogram[whiteclip] + clipped <= clippable) { while (whiteclip > 1 && (histogram[whiteclip] + clipped) <= clippable) {
clipped += histogram[whiteclip]; clipped += histogram[whiteclip];
whiteclip--; whiteclip--;
} }
int clipwh = clipped;
//compute clipped black point //compute clipped black point
clipped = 0; clipped = 0;
int shc = 0; int shc = 0;
@ -6759,8 +6723,6 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
shc++; shc++;
} }
int clipbl = clipped;
//rescale to 65535 max //rescale to 65535 max
rawmax <<= histcompr; rawmax <<= histcompr;
whiteclip <<= histcompr; whiteclip <<= histcompr;
@ -6776,7 +6738,6 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
//compute exposure compensation as geometric mean of the amount that //compute exposure compensation as geometric mean of the amount that
//sets the mean or median at middle gray, and the amount that sets the estimated top //sets the mean or median at middle gray, and the amount that sets the estimated top
//of the histogram at or near clipping. //of the histogram at or near clipping.
float expo = log(midgray * scale / (ave - shc + midgray * shc));
//float expcomp1 = (log(/*(median/ave)*//*(hidev/lodev)*/midgray*scale/(ave-shc+midgray*shc))+log((hidev/lodev)))/log(2.f); //float expcomp1 = (log(/*(median/ave)*//*(hidev/lodev)*/midgray*scale/(ave-shc+midgray*shc))+log((hidev/lodev)))/log(2.f);
float expcomp1 = (log(/*(median/ave)*//*(hidev/lodev)*/midgray * scale / (ave - shc + midgray * shc))) / log(2.f); float expcomp1 = (log(/*(median/ave)*//*(hidev/lodev)*/midgray * scale / (ave - shc + midgray * shc))) / log(2.f);
float expcomp2; float expcomp2;

View File

@ -82,7 +82,6 @@ SSEFUNCTION void ImProcFunctions::impulse_nr (LabImage* lab, double thresh)
#ifdef __SSE2__ #ifdef __SSE2__
vfloat hfnbravev, hpfabsv; vfloat hfnbravev, hpfabsv;
vfloat impthrDiv24v = F2V( impthrDiv24 ); vfloat impthrDiv24v = F2V( impthrDiv24 );
vfloat onev = F2V( 1.0f );
#endif #endif
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp for #pragma omp for