Some fixes for Noise Reduction, Issue 2557 #23

This commit is contained in:
Ingo
2014-11-13 12:24:35 +01:00
parent d1be190be3
commit e16b36303f
16 changed files with 248 additions and 218 deletions

View File

@@ -235,7 +235,7 @@ HISTORY_MSG_15;L*a*b* - Contrast
HISTORY_MSG_16;-
HISTORY_MSG_17;-
HISTORY_MSG_18;-
HISTORY_MSG_19;L* curve
HISTORY_MSG_19;L*a*b* - L* curve
HISTORY_MSG_20;Sharpening
HISTORY_MSG_21;USM - Radius
HISTORY_MSG_22;USM - Amount
@@ -312,8 +312,8 @@ HISTORY_MSG_92;NR - Gamma
HISTORY_MSG_93;CbDL - Value
HISTORY_MSG_94;Contrast by Detail Levels
HISTORY_MSG_95;L*a*b* - Chromaticity
HISTORY_MSG_96;a* curve
HISTORY_MSG_97;b* curve
HISTORY_MSG_96;L*a*b* - a* curve
HISTORY_MSG_97;L*a*b* - b* curve
HISTORY_MSG_98;Demosaicing method
HISTORY_MSG_99;Hot pixel filter
HISTORY_MSG_100;RGB Saturation
@@ -461,9 +461,9 @@ HISTORY_MSG_242;VF - Roundness
HISTORY_MSG_243;VC - Radius
HISTORY_MSG_244;VC - Strength
HISTORY_MSG_245;VC - Center
HISTORY_MSG_246;CL curve
HISTORY_MSG_247;LH curve
HISTORY_MSG_248;HH curve
HISTORY_MSG_246;L*a*b* - CL curve
HISTORY_MSG_247;L*a*b* - LH curve
HISTORY_MSG_248;L*a*b* - HH curve
HISTORY_MSG_249;CbDL - Threshold
HISTORY_MSG_250;NR - Enhanced
HISTORY_MSG_251;B&W - Algorithm
@@ -473,33 +473,33 @@ HISTORY_MSG_254;CbDL - Skin hue
HISTORY_MSG_255;NR - Median filter
HISTORY_MSG_256;NR - Median type
HISTORY_MSG_257;Color Toning
HISTORY_MSG_258;Color Toning - Color
HISTORY_MSG_259;Color Toning - Opacity
HISTORY_MSG_260;Color Toning - a*[b*] opacity
HISTORY_MSG_261;Color Toning - Method
HISTORY_MSG_262;Color Toning - b* opacity
HISTORY_MSG_263;Color Toning - Shadows - Red
HISTORY_MSG_264;Color Toning - Shadows - Green
HISTORY_MSG_265;Color Toning - Shadows - Blue
HISTORY_MSG_266;Color Toning - Mid - Red
HISTORY_MSG_267;Color Toning - Mid - Green
HISTORY_MSG_268;Color Toning - Mid - Blue
HISTORY_MSG_269;Color Toning - High - Red
HISTORY_MSG_270;Color Toning - High - Green
HISTORY_MSG_271;Color Toning - High - Blue
HISTORY_MSG_272;Color Toning - Balance
HISTORY_MSG_273;Color Toning - Reset
HISTORY_MSG_274;Color Toning - Sat. Shadows
HISTORY_MSG_275;Color Toning - Sat. Highlights
HISTORY_MSG_276;Color Toning - Opacity
HISTORY_MSG_258;CT - Color curve
HISTORY_MSG_259;CT - Opacity curve
HISTORY_MSG_260;CT - a*[b*] opacity
HISTORY_MSG_261;CT - Method
HISTORY_MSG_262;CT - b* opacity
HISTORY_MSG_263;CT - Shadows - Red
HISTORY_MSG_264;CT - Shadows - Green
HISTORY_MSG_265;CT - Shadows - Blue
HISTORY_MSG_266;CT - Mid - Red
HISTORY_MSG_267;CT - Mid - Green
HISTORY_MSG_268;CT - Mid - Blue
HISTORY_MSG_269;CT - High - Red
HISTORY_MSG_270;CT - High - Green
HISTORY_MSG_271;CT - High - Blue
HISTORY_MSG_272;CT - Balance
HISTORY_MSG_273;CT - Reset
HISTORY_MSG_274;CT - Sat. Shadows
HISTORY_MSG_275;CT - Sat. Highlights
HISTORY_MSG_276;CT - Opacity
HISTORY_MSG_277;--unused--
HISTORY_MSG_278;Color Toning - Preserve luminance
HISTORY_MSG_279;Color Toning - Shadows
HISTORY_MSG_280;Color Toning - Highlights
HISTORY_MSG_281;Color Toning - Sat. strength
HISTORY_MSG_282;Color Toning - Sat. threshold
HISTORY_MSG_283;Color Toning - Strength
HISTORY_MSG_284;Color Toning - Auto sat. protection
HISTORY_MSG_278;CT - Preserve luminance
HISTORY_MSG_279;CT - Shadows
HISTORY_MSG_280;CT - Highlights
HISTORY_MSG_281;CT - Sat. strength
HISTORY_MSG_282;CT - Sat. threshold
HISTORY_MSG_283;CT - Strength
HISTORY_MSG_284;CT - Auto sat. protection
HISTORY_MSG_285;NR - Median - Method
HISTORY_MSG_286;NR - Median - Type
HISTORY_MSG_287;NR - Median - Iterations
@@ -511,14 +511,14 @@ HISTORY_MSG_292;Black Level - Blue
HISTORY_MSG_293;Film Simulation
HISTORY_MSG_294;Film Simulation - Strength
HISTORY_MSG_295;Film Simulation - Film
HISTORY_MSG_296;NR - Modulate luminance
HISTORY_MSG_296;NR - Luminance curve
HISTORY_MSG_297;NR - Quality
HISTORY_MSG_298;Dead pixel filter
HISTORY_MSG_299;NR - Chrominance curve
HISTORY_MSG_300;-
HISTORY_MSG_301;NR - Luma control
HISTORY_MSG_302;NR - Chroma method
HISTORY_MSG_303;-
HISTORY_MSG_303;NR - Chroma method
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b>
HISTORY_SNAPSHOTS;Snapshots
@@ -1171,7 +1171,6 @@ TP_DIRPYRDENOISE_77;7×7 (slow)
TP_DIRPYRDENOISE_99;9x9 (very slow)
TP_DIRPYRDENOISE_ABM;Chroma only
TP_DIRPYRDENOISE_AUTO;Automatic global
TP_DIRPYRDENOISE_AUTO;Auto chroma
TP_DIRPYRDENOISE_AUTO_TOOLTIP;Try to evaluate chroma noise\nBe careful, this calculation is average, and is quite subjective !
TP_DIRPYRDENOISE_AUT;Automatic global
TP_DIRPYRDENOISE_BLUE;Chrominance - Blue-Yellow
@@ -1197,7 +1196,7 @@ TP_DIRPYRDENOISE_LCURVE;Luminance curve
TP_DIRPYRDENOISE_LDETAIL;Luminance - Detail
TP_DIRPYRDENOISE_LM;Luminance only
TP_DIRPYRDENOISE_LPLABM;Weighted L* (little) + a*b* (normal)
TP_DIRPYRDENOISE_LTYPE;Luminance type
TP_DIRPYRDENOISE_LTYPE;Luminance control
TP_DIRPYRDENOISE_LUMAFR;Luminance
TP_DIRPYRDENOISE_LUMAFR_TOOLTIP;Wavelet on luminance and Fourier transform for luminance detail
TP_DIRPYRDENOISE_LUMA;Luminance

View File

@@ -247,12 +247,25 @@ void ImProcFunctions::Tile_calc (int tilesize, int overlap, int kall, int imwidt
// printf("Nw=%d NH=%d tileW=%d tileH=%d\n",numtiles_W,numtiles_H,tileWskip,tileHskip);
}
void ImProcFunctions::RGB_denoise(int kall, int trafx, int trafy, int trafw, int trafh, int widIm, int heiIm, Imagefloat * src, Imagefloat * dst,Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp, const NoisCurve & dnNoisCurve, bool lldenoiseutili, const NoisCCcurve & dnNoisCCcurve, bool ccdenoiseutili, float &chaut, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &nresi, float &highresi)
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 procparams::DefringeParams & defringe, const double expcomp, const NoisCurve & dnNoisCurve, bool lldenoiseutili, const NoisCCcurve & dnNoisCCcurve, bool ccdenoiseutili, float &chaut, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &nresi, float &highresi)
{
//#ifdef _DEBUG
MyTime t1e,t2e;
t1e.set();
//#endif
if (dnparams.luma==0 && dnparams.chroma==0 && !dnparams.median && !dnNoisCurve && !dnNoisCCcurve) {
//nothing to do; copy src to dst or do nothing in case src == dst
if(src != dst)
memcpy(dst->data,src->data,dst->width*dst->height*3*sizeof(float));
if(calclum) {
delete calclum;
calclum = NULL;
}
return;
}
static MyMutex FftwMutex;
MyMutex::MyLock lock(FftwMutex);
int hei,wid;
@@ -317,12 +330,6 @@ void ImProcFunctions::Tile_calc (int tilesize, int overlap, int kall, int imwidt
const short int imheight=src->height, imwidth=src->width;
// printf("imW=%d imH=%d\n",imwidth,imheight);
// printf("Chroma=%f\n", dnparams.chroma);
if (dnparams.luma==0 && dnparams.chroma==0 && !dnparams.median ) {
//nothing to do; copy src to dst or do nothing in case src == dst
if(src != dst)
memcpy(dst->data,src->data,dst->width*dst->height*3*sizeof(float));
return;
}
Qhigh=1.0f;
if(dnparams.smethod=="shalbi") Qhigh=1.f/(float) settings->nrhigh;
if (dnparams.luma!=0 || dnparams.chroma!=0 || dnparams.methodmed=="Lab" || dnparams.methodmed=="Lonly" ) {
@@ -2574,12 +2581,20 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_L, float **
}
// printf("chro=%f maxc=%f sigma=%f max2sigma=%f lum=%f\n",chro/(nc),maxchro, sqrt(dev/nc), (chro/(nc))+ 2.f*sqrt(dev/nc), lume/nL);
if(nc>0) {
chromina=chro/nc;
sigma=sqrt(dev/nc);
nsknc=(float)nsk/(float)nc;
} else {
nsknc=(float)nsk;
}
if(nL>0) {
lumema=lume/nL;
sigma_L=sqrt(devL/nL);
}
if(nry>0)
redyel=red_yel/nry;
nsknc=(float)nsk/(float)nc;
if(nsk>0)
skinc=skin_c/nsk;
@@ -2776,6 +2791,13 @@ void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int l
void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat * dst,Imagefloat * provicalc, bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp, const NoisCurve & dnNoisCurve, bool lldenoiseutili, const NoisCCcurve & dnNoisCCcurve, bool ccdenoiseutili, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, float &nresi, float &highresi, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc)
{
// StopWatch Stop1("RGB_denoise_info");
if (dnparams.luma==0 && dnparams.chroma==0 && !dnparams.median ) {
//nothing to do; copy src to dst or do nothing in case src == dst
return;
}
int hei,wid;
// float LLum,AAum,BBum;
float** lumcalc;
@@ -2822,12 +2844,6 @@ void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int l
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const short int imheight=src->height, imwidth=src->width;
if (dnparams.luma==0 && dnparams.chroma==0 && !dnparams.median ) {
//nothing to do; copy src to dst or do nothing in case src == dst
if(src != dst)
memcpy(dst->data,src->data,dst->width*dst->height*3*sizeof(float));
return;
}
if (dnparams.luma!=0 || dnparams.chroma!=0 || dnparams.methodmed=="Lab" || dnparams.methodmed=="Lonly" ) {
perf=false;

View File

@@ -32,7 +32,7 @@ namespace rtengine {
extern const Settings* settings;
Crop::Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider)
Crop::Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow)
: EditBuffer(editDataProvider), origCrop(NULL), laboCrop(NULL), labnCrop(NULL),
cropImg(NULL), cbuf_real(NULL), cshmap(NULL), transCrop(NULL), cieCrop(NULL), cbuffer(NULL),
updating(false), newUpdatePending(false), skip(10),
@@ -41,7 +41,7 @@ Crop::Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider)
rqcropx(0), rqcropy(0), rqcropw(-1), rqcroph(-1),
borderRequested(32), upperBorder(0), leftBorder(0),
cropAllocated(false),
cropImageListener(NULL), parent(parent)
cropImageListener(NULL), parent(parent), isDetailWindow(isDetailWindow)
{
parent->crops.push_back (this);
}
@@ -161,7 +161,7 @@ void Crop::update (int todo) {
int skipP=1;//force Skip for noise evaluation
Imagefloat *calclum;//for Luminance denoise curve
Imagefloat *calclum = NULL;//for Luminance denoise curve
NoisCurve dnNoisCurve;
NoisCCcurve dnNoisCCcurve;
bool lldenoiseutili=false;
@@ -286,6 +286,7 @@ void Crop::update (int todo) {
PreviewProps pp (trafx, trafy, trafw*skip, trafh*skip, skip);
parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.icm, params.raw );
if((!isDetailWindow) && parent->adnListener && skip==1 && params.dirpyrDenoise.enabled) {
float lowdenoise=1.f;
int levaut=settings->leveldnaut;
if(levaut==1) //Standard
@@ -351,8 +352,8 @@ void Crop::update (int todo) {
parent->ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope);
parent->ipf.RGB_denoise_info(provi, provi, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, params.defringe, parent->imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut,nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc);
printf("redy=%f skin=%f pcskin=%f\n",redyel, skinc,nsknc);
printf("DCROP skip=%d cha=%4.0f Nb=%d red=%4.0f bl=%4.0f redM=%4.0f bluM=%4.0f L=%4.0f sigL=%4.0f Ch=%4.0f Si=%4.0f\n",skip, chaut,Nb, redaut,blueaut, maxredaut, maxblueaut, lumema, sigma_L, chromina, sigma);
// printf("redy=%f skin=%f pcskin=%f\n",redyel, skinc,nsknc);
// printf("DCROP skip=%d cha=%4.0f Nb=%d red=%4.0f bl=%4.0f redM=%4.0f bluM=%4.0f L=%4.0f sigL=%4.0f Ch=%4.0f Si=%4.0f\n",skip, chaut,Nb, redaut,blueaut, maxredaut, maxblueaut, lumema, sigma_L, chromina, sigma);
float multip=1.f;
if(!parent->imgsrc->isRAW()) multip=2.f;//take into account gamma for TIF / JPG approximate value...not good for gamma=1
@@ -379,11 +380,11 @@ void Crop::update (int todo) {
params.dirpyrDenoise.chroma=chaut/(autoNR*multip*adjustr*lowdenoise);
params.dirpyrDenoise.redchro=maxr;
params.dirpyrDenoise.bluechro=maxb;
if(parent->adnListener) parent->adnListener->chromaChanged(params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro);
parent->adnListener->chromaChanged(params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro);
delete provi;
}
}
}
if((settings->leveldnautsimpl==1 && params.dirpyrDenoise.Cmethod=="AUT") || (settings->leveldnautsimpl==0 && params.dirpyrDenoise.C2method=="AUTO")) {
@@ -408,7 +409,7 @@ void Crop::update (int todo) {
LUTf gamcurve(65536,0);
float gam, gamthresh, gamslope;
parent->ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope);
int Nb;
int Nb[9];
#pragma omp parallel
{
@@ -439,12 +440,14 @@ void Crop::update (int todo) {
//float maxr=0.f;
//float maxb=0.f;
float pondcorrec=1.0f;
float chaut, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc;
chaut=0.f;redaut=0.f; blueaut=0.f; maxredaut=0.f; maxblueaut=0.f;chromina=0.f; sigma=0.f;
parent->ipf.RGB_denoise_info(provi, provi, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, params.defringe, parent->imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc);
float chaut=0.f, redaut=0.f, blueaut=0.f, maxredaut=0.f, maxblueaut=0.f, minredaut=0.f, minblueaut=0.f, nresi=0.f, highresi=0.f, chromina=0.f, sigma=0.f, lumema=0.f, sigma_L=0.f, redyel=0.f, skinc=0.f, nsknc=0.f;
int nb=0;
// chaut=0.f;redaut=0.f; blueaut=0.f; maxredaut=0.f; maxblueaut=0.f; chromina=0.f; sigma=0.f;
parent->ipf.RGB_denoise_info(provi, provi, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, params.defringe, parent->imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc);
//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;
@@ -497,7 +500,7 @@ void Crop::update (int todo) {
int lissage=settings->leveldnliss;
for(int k=0;k<9;k++) {
maxmax=max(max_r[k],max_b[k]);
parent->ipf.calcautodn_info (ch_M[k], delta[k], Nb, levaut, maxmax,lumL[k],chromC[k], mode, lissage, ry[k], sk[k], pcsk[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]);
// printf("ch_M=%f delta=%f\n",ch_M[k], delta[k]);
}
for(int k=0;k<9;k++) {
@@ -549,11 +552,13 @@ void Crop::update (int todo) {
maxr=MinRMoy + (MinR-MinRMoy)*0.66f;
}
printf("DCROP skip=%d cha=%f red=%f bl=%f \n",skip, chM,maxr,maxb);
// printf("DCROP skip=%d cha=%f red=%f bl=%f \n",skip, chM,maxr,maxb);
params.dirpyrDenoise.chroma=chM/(autoNR*multip*adjustr);
params.dirpyrDenoise.redchro=maxr;
params.dirpyrDenoise.bluechro=maxb;
if(parent->adnListener) parent->adnListener->chromaChanged(params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro);
if(parent->adnListener) {
parent->adnListener->chromaChanged(params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro);
}
}
if (settings->verbose) {
t2aue.set();
@@ -571,6 +576,12 @@ void Crop::update (int todo) {
if(params.dirpyrDenoise.Lmethod=="CUR") params.dirpyrDenoise.luma=0.5f;//very small value to init process - select curve or slider
if(params.dirpyrDenoise.Lmethod=="SLI") lldenoiseutili=false;
if(!lldenoiseutili)
dnNoisCurve.Reset();
if(!ccdenoiseutili)
dnNoisCCcurve.Reset();
if((lldenoiseutili || ccdenoiseutili ) && skip==1 && params.dirpyrDenoise.enabled) {//only allocate memory if enabled and skip
calclum = new Imagefloat (cropw, croph);//for Luminance denoise curve
if(origCrop != calclum)
@@ -585,7 +596,7 @@ void Crop::update (int todo) {
int kall=0;
float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi;
parent->ipf.RGB_denoise(kall, trafx, trafy, trafw, trafh, widIm, heiIm, origCrop, origCrop, calclum, ch_M, max_r, max_b, parent->imgsrc->isRAW(), /*Roffset,*/ params.dirpyrDenoise, params.defringe, parent->imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, 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,*/ params.dirpyrDenoise, params.defringe, parent->imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
if(parent->adnListener) parent->adnListener->noiseChanged(nresi, highresi);
if(settings->leveldnautsimpl==1) {
if((params.dirpyrDenoise.Cmethod=="AUT" || params.dirpyrDenoise.Cmethod=="PRE") && (parent->adnListener)) // force display value of sliders
@@ -759,7 +770,7 @@ void Crop::update (int todo) {
if (!cieCrop)
{ cieCrop = new CieImage (cropw, croph); }
if(settings->leveldnautsimpl==1) {
if(settings->ciecamfloat) {
float d; // not used after this block
skip2=skip;
parent->ipf.ciecam_02float (cieCrop, float(adap), begh, endh, 1, 2, labnCrop, &params, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3,

View File

@@ -66,13 +66,13 @@ class Crop : public DetailedCrop, public EditBuffer {
MyMutex cropMutex;
ImProcCoordinator* parent;
bool isDetailWindow;
EditUniqueID getCurrEditID();
bool setCropSizes (int cx, int cy, int cw, int ch, int skip, bool internal);
void freeAll ();
public:
Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider);
Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow);
virtual ~Crop ();
int skip2;

View File

@@ -112,9 +112,9 @@ ImProcCoordinator::~ImProcCoordinator () {
updaterThreadStart.unlock ();
}
DetailedCrop* ImProcCoordinator::createCrop (::EditDataProvider *editDataProvider) {
DetailedCrop* ImProcCoordinator::createCrop (::EditDataProvider *editDataProvider, bool isDetailWindow) {
return new Crop (this, editDataProvider);
return new Crop (this, editDataProvider, isDetailWindow);
}
@@ -270,7 +270,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
imgsrc->getImage (currWB, tr, orig_prev, pp, params.toneCurve, params.icm, params.raw);
//ColorTemp::CAT02 (orig_prev, &params) ;
Imagefloat *calclum ;
Imagefloat *calclum = NULL ;
lldenoiseutili=false;
ccdenoiseutili=false;
params.dirpyrDenoise.getCurves(dnNoisCurve,dnNoisCCcurve,lldenoiseutili, ccdenoiseutili);
@@ -284,6 +284,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
if(params.dirpyrDenoise.Lmethod=="CUR") params.dirpyrDenoise.luma=0.5f;
if(params.dirpyrDenoise.Lmethod=="SLI") lldenoiseutili=false;
if(!lldenoiseutili)
dnNoisCurve.Reset();
if(!ccdenoiseutili)
dnNoisCCcurve.Reset();
if((lldenoiseutili || ccdenoiseutili) && params.dirpyrDenoise.enabled && (scale==1)){//only allocate memory if enabled and scale=1
calclum = new Imagefloat (pW, pH);//for Luminance denoise curve
if(orig_prev != calclum)
@@ -296,8 +301,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
if (params.dirpyrDenoise.enabled && (scale==1)) {
printf("IMPROC\n");
int kall=1;
int trafx, trafy, trafw, trafh, widIm, heiIm;
ipf.RGB_denoise(kall, trafx, trafy, trafw, trafh, widIm, heiIm, orig_prev, orig_prev, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve, lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
ipf.RGB_denoise(kall, orig_prev, orig_prev, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve, lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
}
}
// delete calclum;

View File

@@ -208,7 +208,7 @@ class ImProcCoordinator : public StagedImageProcessor {
int getPreviewWidth () { return pW; }
int getPreviewHeight () { return pH; }
DetailedCrop* createCrop (::EditDataProvider *editDataProvider);
DetailedCrop* createCrop (::EditDataProvider *editDataProvider, bool isDetailWindow);
bool getAutoWB (double& temp, double& green, double equal);
void getCamWB (double& temp, double& green);

View File

@@ -278,7 +278,7 @@ class ImProcFunctions {
//void output_tile_row (float *Lbloxrow, float ** Lhipassdn, float ** tilemask, int height, int width, int top, int blkrad );
void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip);
void RGB_denoise(int kall, int trafx, int trafy, int trafw, int trafh, int widIm, int heiIm, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp,const NoisCurve & ctNoisCurve , bool lldenoiseutili, const NoisCCcurve & ctNoisCCcurve , bool ccdenoiseutili, float &chaut, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &nresi, float &highresi);
void 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 procparams::DefringeParams & defringe, const double expcomp,const NoisCurve & ctNoisCurve , bool lldenoiseutili, const NoisCCcurve & ctNoisCCcurve , bool ccdenoiseutili, float &chaut, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &nresi, float &highresi);
void RGB_denoise_infoGamCurve(const procparams::DirPyrDenoiseParams & dnparams, bool isRAW, LUTf &gamcurve, float &gam, float &gamthresh, float &gamslope);
void RGB_denoise_info(Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp,const NoisCurve & ctNoisCurve , bool lldenoiseutili, const NoisCCcurve & ctNoisCCcurve , bool ccdenoiseutili, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &minredaut, float & minblueaut,float &nresi, float &highresi, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel,float &skinc, float &nsknc);
void RGBtile_denoise (float * fLblox, int hblproc, float noisevar_L, float * nbrwt, float * blurbuffer ); //for DCT

View File

@@ -354,7 +354,7 @@ namespace rtengine {
/** Creates and returns a Crop instance that acts as a window on the image
* @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber
* @return a pointer to the Crop object that handles the image data trough its own pipeline */
virtual DetailedCrop* createCrop (::EditDataProvider *editDataProvider) =0;
virtual DetailedCrop* createCrop (::EditDataProvider *editDataProvider, bool isDetailWindow) =0;
virtual bool getAutoWB (double& temp, double& green, double equal) =0;
virtual void getCamWB (double& temp, double& green) =0;

View File

@@ -129,7 +129,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
bool lldenoiseutili=false;
bool ccdenoiseutili=false;
NoisCCcurve dnNoisCCcurve;
Imagefloat *calclum ;
Imagefloat *calclum = NULL ;
params.dirpyrDenoise.getCurves(dnNoisCurve, dnNoisCCcurve, lldenoiseutili, ccdenoiseutili);
float autoNR = (float) settings->nrauto;//
float autoNRmax = (float) settings->nrautomax;//
@@ -184,8 +184,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
// int crW=tileWskip-10;//crop noise width
// int crH=tileHskip-10;//crop noise height
Imagefloat *origCropPart;//init auto noise
origCropPart = new Imagefloat (crW, crH);//allocate memory
// Imagefloat *origCropPart;//init auto noise
// origCropPart = new Imagefloat (crW, crH);//allocate memory
StopWatch Stop1("denoise info tiled");
if (params.dirpyrDenoise.enabled) {//evaluate Noise
LUTf gamcurve(65536,0);
@@ -345,7 +345,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
LUTf gamcurve(65536,0);
float gam, gamthresh, gamslope;
ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope);
int Nb;
int Nb[9];
#pragma omp parallel
{
Imagefloat *origCropPart;//init auto noise
@@ -377,11 +377,11 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
float maxr=0.f;
float maxb=0.f;
float pondcorrec=1.0f;
int nb = 0;
float chaut=0.f, redaut=0.f, blueaut=0.f, maxredaut=0.f, maxblueaut=0.f, minredaut=0.f, minblueaut=0.f, nresi=0.f, highresi=0.f, chromina=0.f, sigma=0.f, lumema=0.f, sigma_L=0.f, redyel=0.f, skinc=0.f, nsknc=0.f;
ipf.RGB_denoise_info(provi, provi, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise,params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc);
float chaut, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc;
chaut=0.f;redaut=0.f; blueaut=0.f; maxredaut=0.f; maxblueaut=0.f;chromina=0.f; sigma=0.f;sigma_L=0.f;
ipf.RGB_denoise_info(provi, provi, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise,params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve,lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc);
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;
@@ -435,7 +435,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
float redyel, skinc, nsknc;
for(int k=0;k<9;k++) {
maxmax=max(max_r[k],max_b[k]);
ipf.calcautodn_info (ch_M[k], delta[k], Nb, levaut, maxmax, lumL[k], chromC[k], mode, lissage,ry[k], sk[k], pcsk[k] );
ipf.calcautodn_info (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++) {
@@ -543,6 +543,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
// if (params.dirpyrDenoise.enabled && lldenoiseutili) {
if(params.dirpyrDenoise.Lmethod=="CUR") params.dirpyrDenoise.luma=0.5f;
if(params.dirpyrDenoise.Lmethod=="SLI") lldenoiseutili=false;
if(!lldenoiseutili)
dnNoisCurve.Reset();
if(!ccdenoiseutili)
dnNoisCCcurve.Reset();
if (params.dirpyrDenoise.enabled && (lldenoiseutili || ccdenoiseutili )) {
@@ -557,8 +561,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
// ipf.RGB_denoise(baseImg, baseImg, calclum, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve, lldenoiseutili);
float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc;
int kall=2;
int trafx, trafy, trafw, trafh, widIm, heiIm;
ipf.RGB_denoise(kall, trafx, trafy, trafw, trafh, widIm, heiIm, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve, lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
ipf.RGB_denoise(kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), dnNoisCurve, lldenoiseutili, dnNoisCCcurve,ccdenoiseutili, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi);
}
// delete calclum;

View File

@@ -61,7 +61,7 @@ void CropHandler::setEditSubscriber (EditSubscriber* newSubscriber) {
(static_cast<rtengine::Crop *>(crop))->setEditSubscriber(newSubscriber);
}
void CropHandler::newImage (StagedImageProcessor* ipc_) {
void CropHandler::newImage (StagedImageProcessor* ipc_, bool isDetailWindow) {
ipc = ipc_;
cx = 0;
@@ -74,7 +74,7 @@ void CropHandler::newImage (StagedImageProcessor* ipc_) {
CropWindow *cropWin = listener ? static_cast<CropWindow*>(listener) : NULL;
if (cropWin)
editDataProvider = cropWin->getImageArea();
crop = ipc->createCrop (editDataProvider);
crop = ipc->createCrop (editDataProvider, isDetailWindow);
ipc->setSizeListener (this);
crop->setListener (enabled ? this : NULL);
initial = true;

View File

@@ -82,7 +82,7 @@ class CropHandler : public rtengine::DetailedCropListener, public rtengine::Size
void setCropHandlerListener (CropHandlerListener* l) { listener = l; }
void setEditSubscriber (EditSubscriber* newSubscriber);
void newImage (rtengine::StagedImageProcessor* ipc_);
void newImage (rtengine::StagedImageProcessor* ipc_, bool isDetailWindow);
void setZoom (int z, int centerx=-1, int centery=-1);
double getFitZoom ();
void setWSize (int w, int h);

View File

@@ -62,13 +62,12 @@ ZoomStep zoomSteps[] = {
#define MAXZOOMSTEPS 20
#define ZOOM11INDEX 13
CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_)
CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_, bool isDetailWindow)
: onResizeArea(false), deleted(false), fitZoomEnabled(true), fitZoom(false), isLowUpdatePriority(isLowUpdatePriority_),
backColor(options.bgcolor), decorated(true), titleHeight(30),
sideBorderWidth(3), lowerBorderWidth(3), upperBorderWidth(1), sepWidth(2),
xpos(30), ypos(30), imgX(0), imgY(0), imgW(1), imgH(1), iarea(parent),
cropZoom(0), cropgl(NULL), pmlistener(NULL), observedCropWin(NULL), ipc(ipc_), isFlawnOver(false) {
Glib::RefPtr<Pango::Context> context = parent->get_pango_context () ;
Pango::FontDescription fontd = context->get_font_description ();
fontd.set_weight (Pango::WEIGHT_BOLD);
@@ -106,7 +105,7 @@ CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_,
minWidth = bsw + iw + 2*sideBorderWidth;
cropHandler.setCropHandlerListener (this);
cropHandler.newImage (ipc_);
cropHandler.newImage (ipc_, isDetailWindow);
state = SNormal;
}

View File

@@ -98,7 +98,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E
public:
CropHandler cropHandler;
CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_);
CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_, bool isDetailWindow);
void setDecorated (bool decorated) { this->decorated = decorated; }
void setFitZoomEnabled (bool fze) { fitZoomEnabled = fze; }

View File

@@ -1027,10 +1027,8 @@ void DirPyrDenoise::enabledChanged () {
}
if (listener) {
if (enabled->get_active ()) {autochromaChanged ();
if (enabled->get_active ())
listener->panelChanged (EvDPDNEnabled, M("GENERAL_ENABLED"));
}
else
listener->panelChanged (EvDPDNEnabled, M("GENERAL_DISABLED"));
}

View File

@@ -493,7 +493,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
// since there was no resize event
if (iareapanel->imageArea->mainCropWindow)
{
iareapanel->imageArea->mainCropWindow->cropHandler.newImage(ipc);
iareapanel->imageArea->mainCropWindow->cropHandler.newImage(ipc, false);
iareapanel->imageArea->mainCropWindow->initialImageArrived();
// In single tab mode, the image is not always updated between switches

View File

@@ -83,7 +83,7 @@ void ImageArea::on_realize()
void ImageArea::on_resized (Gtk::Allocation& req) {
if (ipc && get_width()>1) { // sometimes on_resize is called in some init state, causing wrong sizes
if (!mainCropWindow) {
mainCropWindow = new CropWindow (this, ipc, false);
mainCropWindow = new CropWindow (this, ipc, false, false);
mainCropWindow->setDecorated (false);
mainCropWindow->setFitZoomEnabled (true);
mainCropWindow->addCropWindowListener (this);
@@ -348,7 +348,7 @@ void ImageArea::addCropWindow () {
if (!mainCropWindow)
return; // if called but no image is loaded, it would crash
CropWindow* cw = new CropWindow (this, ipc, true);
CropWindow* cw = new CropWindow (this, ipc, true, true);
cw->zoom11();
cw->setCropGUIListener (cropgl);
cw->setPointerMotionListener (pmlistener);