Removed StopWatches and corrected some bugs from latest commit
This commit is contained in:
@@ -37,8 +37,6 @@
|
||||
#include "opthelper.h"
|
||||
#include "cplx_wavelet_dec.h"
|
||||
#include "median.h"
|
||||
#define BENCHMARK
|
||||
#include "StopWatch.h"
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
@@ -427,7 +425,6 @@ enum nrquality {QUALITY_STANDARD, QUALITY_HIGH};
|
||||
|
||||
SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &chaut, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &nresi, float &highresi)
|
||||
{
|
||||
BENCHFUN
|
||||
//#ifdef _DEBUG
|
||||
MyTime t1e, t2e;
|
||||
t1e.set();
|
||||
@@ -594,15 +591,11 @@ BENCHFUN
|
||||
LUTf gamcurve(65536, LUT_CLIP_BELOW);
|
||||
float gamslope = exp(log(static_cast<double>(gamthresh)) / gam) / gamthresh;
|
||||
|
||||
MyTime t1e, t2e;
|
||||
t1e.set();
|
||||
if (denoiseMethodRgb) {
|
||||
Color::gammaf2lut(gamcurve, gam, gamthresh, gamslope, 65535.f, 32768.f);
|
||||
} else {
|
||||
Color::gammanf2lut(gamcurve, gam, 65535.f, 32768.f);
|
||||
}
|
||||
t2e.set();
|
||||
printf("gamcurve performed in %d usec:\n", t2e.etime(t1e));
|
||||
|
||||
// inverse gamma transform for output data
|
||||
float igam = 1.f / gam;
|
||||
@@ -611,16 +604,11 @@ BENCHFUN
|
||||
|
||||
LUTf igamcurve(65536, LUT_CLIP_BELOW);
|
||||
|
||||
MyTime t11e, t21e;
|
||||
t11e.set();
|
||||
|
||||
if (denoiseMethodRgb) {
|
||||
Color::gammaf2lut(igamcurve, igam, igamthresh, igamslope, 32768.f, 65535.f);
|
||||
} else {
|
||||
Color::gammanf2lut(igamcurve, igam, 32768.f, 65535.f);
|
||||
}
|
||||
t21e.set();
|
||||
printf("igamcurve performed in %d usec:\n", t21e.etime(t11e));
|
||||
|
||||
const float gain = pow (2.0f, float(expcomp));
|
||||
float noisevar_Ldetail = SQR(static_cast<float>(SQR(100. - dnparams.Ldetail) + 50.*(100. - dnparams.Ldetail)) * TS * 0.5f);
|
||||
@@ -821,7 +809,6 @@ BENCHFUN
|
||||
{static_cast<float>(wprof[2][0]), static_cast<float>(wprof[2][1]), static_cast<float>(wprof[2][2])}
|
||||
};
|
||||
|
||||
|
||||
// begin tile processing of image
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel num_threads(numthreads) if (numthreads>1)
|
||||
@@ -3000,18 +2987,12 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_infoGamCurve(const procparams::Dir
|
||||
|
||||
bool denoiseMethodRgb = (dnparams.dmethod == "RGB");
|
||||
|
||||
MyTime t1e, t2e;
|
||||
t1e.set();
|
||||
|
||||
if (denoiseMethodRgb) {
|
||||
gamslope = exp(log(static_cast<double>(gamthresh)) / gam) / gamthresh;
|
||||
Color::gammaf2lut(gamcurve, gam, gamthresh, gamslope, 65535.f, 32768.f);
|
||||
} else {
|
||||
Color::gammanf2lut(gamcurve, gam, 65535.f, 32768.f);
|
||||
}
|
||||
t2e.set();
|
||||
printf("gamcurve in RGB_denoise_infoGamCurve performed in %d usec:\n", t2e.etime(t1e));
|
||||
|
||||
}
|
||||
|
||||
void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc)
|
||||
|
||||
@@ -191,9 +191,6 @@ void Crop::update (int todo)
|
||||
parent->ipf.Tile_calc (tilesize, overlap, kall, widIm, heiIm, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip);
|
||||
kall = 0;
|
||||
|
||||
float *ch_M = new float [9];//allocate memory
|
||||
float *max_r = new float [9];
|
||||
float *max_b = new float [9];
|
||||
float *min_b = new float [9];
|
||||
float *min_r = new float [9];
|
||||
float *lumL = new float [9];
|
||||
@@ -462,9 +459,9 @@ void Crop::update (int todo)
|
||||
|
||||
//printf("DCROP skip=%d cha=%f red=%f bl=%f redM=%f bluM=%f chrom=%f sigm=%f lum=%f\n",skip, chaut,redaut,blueaut, maxredaut, maxblueaut, chromina, sigma, lumema);
|
||||
Nb[hcr * 3 + wcr] = nb;
|
||||
ch_M[hcr * 3 + wcr] = pondcorrec * chaut;
|
||||
max_r[hcr * 3 + wcr] = pondcorrec * maxredaut;
|
||||
max_b[hcr * 3 + wcr] = pondcorrec * maxblueaut;
|
||||
parent->denoiseInfoStore.ch_M[hcr * 3 + wcr] = pondcorrec * chaut;
|
||||
parent->denoiseInfoStore.max_r[hcr * 3 + wcr] = pondcorrec * maxredaut;
|
||||
parent->denoiseInfoStore.max_b[hcr * 3 + wcr] = pondcorrec * maxblueaut;
|
||||
min_r[hcr * 3 + wcr] = pondcorrec * minredaut;
|
||||
min_b[hcr * 3 + wcr] = pondcorrec * minblueaut;
|
||||
lumL[hcr * 3 + wcr] = lumema;
|
||||
@@ -524,20 +521,20 @@ void Crop::update (int todo)
|
||||
int lissage = settings->leveldnliss;
|
||||
|
||||
for (int k = 0; k < 9; k++) {
|
||||
float maxmax = max(max_r[k], max_b[k]);
|
||||
parent->ipf.calcautodn_info (ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k]);
|
||||
float maxmax = max(parent->denoiseInfoStore.max_r[k], parent->denoiseInfoStore.max_b[k]);
|
||||
parent->ipf.calcautodn_info (parent->denoiseInfoStore.ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k]);
|
||||
// printf("ch_M=%f delta=%f\n",ch_M[k], delta[k]);
|
||||
}
|
||||
|
||||
for (int k = 0; k < 9; k++) {
|
||||
if(max_r[k] > max_b[k]) {
|
||||
if(parent->denoiseInfoStore.max_r[k] > parent->denoiseInfoStore.max_b[k]) {
|
||||
Max_R[k] = (delta[k]) / ((autoNRmax * multip * adjustr * lowdenoise) / 2.f);
|
||||
Min_B[k] = -(ch_M[k] - min_b[k]) / (autoNRmax * multip * adjustr * lowdenoise);
|
||||
Min_B[k] = -(parent->denoiseInfoStore.ch_M[k] - min_b[k]) / (autoNRmax * multip * adjustr * lowdenoise);
|
||||
Max_B[k] = 0.f;
|
||||
Min_R[k] = 0.f;
|
||||
} else {
|
||||
Max_B[k] = (delta[k]) / ((autoNRmax * multip * adjustr * lowdenoise) / 2.f);
|
||||
Min_R[k] = - (ch_M[k] - min_r[k]) / (autoNRmax * multip * adjustr * lowdenoise);
|
||||
Min_R[k] = - (parent->denoiseInfoStore.ch_M[k] - min_r[k]) / (autoNRmax * multip * adjustr * lowdenoise);
|
||||
Min_B[k] = 0.f;
|
||||
Max_R[k] = 0.f;
|
||||
}
|
||||
@@ -545,7 +542,7 @@ void Crop::update (int todo)
|
||||
|
||||
for (int k = 0; k < 9; k++) {
|
||||
// printf("ch_M= %f Max_R=%f Max_B=%f min_r=%f min_b=%f\n",ch_M[k],Max_R[k], Max_B[k],Min_R[k], Min_B[k]);
|
||||
chM += ch_M[k];
|
||||
chM += parent->denoiseInfoStore.ch_M[k];
|
||||
MaxBMoy += Max_B[k];
|
||||
MaxRMoy += Max_R[k];
|
||||
MinRMoy += Min_R[k];
|
||||
@@ -644,7 +641,7 @@ void Crop::update (int todo)
|
||||
int kall = 0;
|
||||
|
||||
float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi;
|
||||
parent->ipf.RGB_denoise(kall, origCrop, origCrop, calclum, ch_M, max_r, max_b, parent->imgsrc->isRAW(), /*Roffset,*/ denoiseParams, parent->imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
|
||||
parent->ipf.RGB_denoise(kall, origCrop, origCrop, calclum, parent->denoiseInfoStore.ch_M, parent->denoiseInfoStore.max_r, parent->denoiseInfoStore.max_b, parent->imgsrc->isRAW(), /*Roffset,*/ denoiseParams, parent->imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
|
||||
|
||||
if (parent->adnListener) {
|
||||
parent->adnListener->noiseChanged(nresi, highresi);
|
||||
@@ -665,9 +662,6 @@ void Crop::update (int todo)
|
||||
|
||||
parent->imgsrc->convertColorSpace(origCrop, params.icm, parent->currWB);
|
||||
|
||||
delete [] ch_M;
|
||||
delete [] max_r;
|
||||
delete [] max_b;
|
||||
delete [] min_r;
|
||||
delete [] min_b;
|
||||
delete [] lumL;
|
||||
|
||||
@@ -326,11 +326,13 @@ public:
|
||||
return imgsrc;
|
||||
}
|
||||
|
||||
class denoiseinfostore {
|
||||
public:
|
||||
bool valid;
|
||||
struct {
|
||||
float chM;
|
||||
float max_r[9];
|
||||
float max_b[9];
|
||||
float ch_M[9];
|
||||
bool valid = false;
|
||||
|
||||
denoiseinfostore() : valid(false) {};
|
||||
} denoiseInfoStore;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user