Post demosaic artifact_noise reduction see issue848
This commit is contained in:
@@ -336,6 +336,7 @@ HISTORY_MSG_145;Microcontrast - uniformity
|
||||
HISTORY_MSG_146;Clarity Sharpening - enabled
|
||||
HISTORY_MSG_148;Clarity Microcontrast - enabled
|
||||
HISTORY_MSG_149;Clarity Microcontrast matrix
|
||||
HISTORY_MSG_150;Post demosaic artifact/noise reduction
|
||||
HISTORY_NEWSNAPSHOT;Add
|
||||
HISTORY_NEWSNAPSHOTAS;As...
|
||||
HISTORY_NEWSSDIALOGLABEL;Label of the snapshot:
|
||||
@@ -535,6 +536,7 @@ PARTIALPASTE_RAWEXPOS_BLACK;Black Level
|
||||
PARTIALPASTE_RAWEXPOS_PRESER;Raw white point HL preserving corr. (EV)
|
||||
PARTIALPASTE_RAWGROUP;Raw settings
|
||||
PARTIALPASTE_RAW_DCBENHANCE;Apply DCB enhancement step
|
||||
PARTIALPASTE_RAW_ALLENHANCE;Apply post demosaic artifact/noise reduction
|
||||
PARTIALPASTE_RAW_DCBITERATIONS;Number of DCB iterations
|
||||
PARTIALPASTE_RAW_DMETHOD;Demosaic Method
|
||||
PARTIALPASTE_RAW_FALSECOLOR;Demosaic False color suppression steps
|
||||
@@ -907,6 +909,7 @@ TP_RAW_DCBITERATIONS;Number of DCB iterations
|
||||
TP_RAW_DMETHOD;Method
|
||||
TP_RAW_FALSECOLOR;False color suppression steps
|
||||
TP_RAW_LABEL;Demosaicing
|
||||
TP_RAW_ALLENHANCE;Apply post demosaic artifact/noise reduction
|
||||
TP_RESIZE_APPLIESTO;Applies to:
|
||||
TP_RESIZE_BICUBIC;Bicubic
|
||||
TP_RESIZE_BICUBICSF;Bicubic (Softer)
|
||||
|
||||
@@ -200,3 +200,4 @@ CcSteps=1
|
||||
Method=amaze
|
||||
DCBIterations=2
|
||||
DCBEnhance=false
|
||||
ALLEnhance=false
|
||||
@@ -200,3 +200,4 @@ CcSteps=1
|
||||
Method=amaze
|
||||
DCBIterations=2
|
||||
DCBEnhance=false
|
||||
ALLEnhance=false
|
||||
@@ -200,3 +200,4 @@ CcSteps=1
|
||||
Method=amaze
|
||||
DCBIterations=2
|
||||
DCBEnhance=false
|
||||
ALLEnhance=false
|
||||
@@ -44,7 +44,10 @@ namespace rtengine {
|
||||
#define MAX(a,b) ((a)<(b)?(b):(a))
|
||||
#define MIN(a,b) ((a)>(b)?(b):(a))
|
||||
#define DIST(a,b) (ABS(a-b))
|
||||
#define CLIREF(x) LIM(x,-200000.0,200000.0) // avoid overflow : do not act directly on image[] or pix[]
|
||||
|
||||
#define PIX_SORT(a,b) { if ((a)>(b)) {temp=(a);(a)=(b);(b)=temp;} }
|
||||
extern Settings* settings;
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void RawImageSource::eahd_demosaic () {
|
||||
@@ -1079,6 +1082,148 @@ void RawImageSource::nodemosaic()
|
||||
}
|
||||
}
|
||||
|
||||
// Refinement based on EECI demosaicing algorithm by L. Chang and Y.P. Tan
|
||||
// from "Lassus" : Luis Sanz, adapted by Jacques Desmis - JDC - and Oliver Duis for RawTherapee
|
||||
// increases the signal to noise ratio (PSNR) # +1 to +2 dB : tested with Dcraw : eg: Lighthouse + AMaZE : whitout refinement:39.96dB, with refinement:41.86 dB
|
||||
// reduce color artifacts, improves the interpolation
|
||||
// but it's relatively slow
|
||||
void RawImageSource::refinement_lassus()
|
||||
{
|
||||
const int PassCount=2; // two passes EECI refine, slow but best results...
|
||||
|
||||
if (settings->verbose) printf("Refinement Lassus\n");
|
||||
|
||||
MyTime t1e,t2e;
|
||||
t1e.set();
|
||||
int u=W, v=2*u, w=3*u, x=4*u, y=5*u;
|
||||
float (*image)[4];
|
||||
image = (float(*)[4]) calloc(W*H, sizeof *image);
|
||||
#pragma omp parallel shared(image)
|
||||
{
|
||||
// convert red, blue, green to image
|
||||
#pragma omp for
|
||||
for (int i=0;i<H;i++) {
|
||||
for (int j=0;j<W;j++) {
|
||||
image[i*W+j][0] = red [i][j];
|
||||
image[i*W+j][1] = green[i][j];
|
||||
image[i*W+j][2] = blue [i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int b=0; b<PassCount; b++) {
|
||||
if (plistener) {
|
||||
plistener->setProgressStr ("Refinement...");
|
||||
plistener->setProgress ((float)b/PassCount);
|
||||
}
|
||||
|
||||
// Reinforce interpolated green pixels on RED/BLUE pixel locations
|
||||
#pragma omp for
|
||||
for (int row=6; row<H-6; row++) {
|
||||
int c,d;
|
||||
for (int col=6+(FC(row,2)&1),c=FC(row,col); col<W-6; col+=2) {
|
||||
float (*pix)[4]=image+row*W+col;
|
||||
|
||||
// Cubic Spline Interpolation by Li and Randhawa, modified by Luis Sanz Rodríguez
|
||||
|
||||
float f[4];
|
||||
f[0]=1.0/(1.0+2.0*fabs(1.125*pix[-v][c]-0.875*pix[0][c]-0.250*pix[-x][c])+fabs(0.875*pix[u][1]-1.125*pix[-u][1]+0.250*pix[-w][1])+fabs(0.875*pix[-w][1]-1.125*pix[-u][1]+0.250*pix[-y][1]));
|
||||
f[1]=1.0/(1.0+2.0*fabs(1.125*pix[+2][c]-0.875*pix[0][c]-0.250*pix[+4][c])+fabs(0.875*pix[1][1]-1.125*pix[-1][1]+0.250*pix[+3][1])+fabs(0.875*pix[+3][1]-1.125*pix[+1][1]+0.250*pix[+5][1]));
|
||||
f[2]=1.0/(1.0+2.0*fabs(1.125*pix[-2][c]-0.875*pix[0][c]-0.250*pix[-4][c])+fabs(0.875*pix[1][1]-1.125*pix[-1][1]+0.250*pix[-3][1])+fabs(0.875*pix[-3][1]-1.125*pix[-1][1]+0.250*pix[-5][1]));
|
||||
f[3]=1.0/(1.0+2.0*fabs(1.125*pix[+v][c]-0.875*pix[0][c]-0.250*pix[+x][c])+fabs(0.875*pix[u][1]-1.125*pix[-u][1]+0.250*pix[+w][1])+fabs(0.875*pix[+w][1]-1.125*pix[+u][1]+0.250*pix[+y][1]));
|
||||
|
||||
float g[4];//CLIREF avoid overflow
|
||||
g[0]=pix[0][c]+(0.875*CLIREF(pix[-u][1]-pix[-u][c])+0.125*CLIREF(pix[+u][1]-pix[+u][c]));
|
||||
g[1]=pix[0][c]+(0.875*CLIREF(pix[+1][1]-pix[+1][c])+0.125*CLIREF(pix[-1][1]-pix[-1][c]));
|
||||
g[2]=pix[0][c]+(0.875*CLIREF(pix[-1][1]-pix[-1][c])+0.125*CLIREF(pix[+1][1]-pix[+1][c]));
|
||||
g[3]=pix[0][c]+(0.875*CLIREF(pix[+u][1]-pix[+u][c])+0.125*CLIREF(pix[-u][1]-pix[-u][c]));
|
||||
|
||||
|
||||
pix[0][1]=(f[0]*g[0]+f[1]*g[1]+f[2]*g[2]+f[3]*g[3]) / (f[0]+f[1]+f[2]+f[3]);
|
||||
|
||||
}
|
||||
}
|
||||
// Reinforce interpolated red/blue pixels on GREEN pixel locations
|
||||
#pragma omp for
|
||||
for (int row=6; row<H-6; row++) {
|
||||
int c,d;
|
||||
for (int col=6+(FC(row,3)&1),c=FC(row,col+1); col<W-6; col+=2) {
|
||||
float (*pix)[4]=image+row*W+col;
|
||||
for (int i=0; i<2; c=2-c,i++) {
|
||||
float f[4];
|
||||
f[0]=1.0/(1.0+2.0*fabs(0.875*pix[-v][1]-1.125*pix[0][1]+0.250*pix[-x][1])+fabs(pix[u] [c]-pix[-u][c])+fabs(pix[-w][c]-pix[-u][c]));
|
||||
f[1]=1.0/(1.0+2.0*fabs(0.875*pix[+2][1]-1.125*pix[0][1]+0.250*pix[+4][1])+fabs(pix[+1][c]-pix[-1][c])+fabs(pix[+3][c]-pix[+1][c]));
|
||||
f[2]=1.0/(1.0+2.0*fabs(0.875*pix[-2][1]-1.125*pix[0][1]+0.250*pix[-4][1])+fabs(pix[+1][c]-pix[-1][c])+fabs(pix[-3][c]-pix[-1][c]));
|
||||
f[3]=1.0/(1.0+2.0*fabs(0.875*pix[+v][1]-1.125*pix[0][1]+0.250*pix[+x][1])+fabs(pix[u] [c]-pix[-u][c])+fabs(pix[+w][c]-pix[+u][c]));
|
||||
|
||||
float g[5];//CLIREF avoid overflow
|
||||
g[0]=CLIREF(pix[-u][1]-pix[-u][c]);
|
||||
g[1]=CLIREF(pix[+1][1]-pix[+1][c]);
|
||||
g[2]=CLIREF(pix[-1][1]-pix[-1][c]);
|
||||
g[3]=CLIREF(pix[+u][1]-pix[+u][c]);
|
||||
g[4]=((f[0]*g[0]+f[1]*g[1]+f[2]*g[2]+f[3]*g[3]) / (f[0]+f[1]+f[2]+f[3]));
|
||||
pix[0][c]= pix[0][1]-(0.65*g[4]+0.35*CLIREF(pix[0][1]-pix[0][c]));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reinforce integrated red/blue pixels on BLUE/RED pixel locations
|
||||
#pragma omp for
|
||||
for (int row=6; row<H-6; row++) {
|
||||
int c,d;
|
||||
for (int col=6+(FC(row,2)&1),c=2-FC(row,col),d=2-c; col<W-6; col+=2) {
|
||||
float (*pix)[4]=image+row*W+col;
|
||||
|
||||
float f[4];
|
||||
f[0]=1.0/(1.0+2.0*fabs(1.125*pix[-v][d]-0.875*pix[0][d]-0.250*pix[-x][d])+fabs(0.875*pix[u][1]-1.125*pix[-u][1]+0.250*pix[-w][1])+fabs(0.875*pix[-w][1]-1.125*pix[-u][1]+0.250*pix[-y][1]));
|
||||
f[1]=1.0/(1.0+2.0*fabs(1.125*pix[+2][d]-0.875*pix[0][d]-0.250*pix[+4][d])+fabs(0.875*pix[1][1]-1.125*pix[-1][1]+0.250*pix[+3][1])+fabs(0.875*pix[+3][1]-1.125*pix[+1][1]+0.250*pix[+5][1]));
|
||||
f[2]=1.0/(1.0+2.0*fabs(1.125*pix[-2][d]-0.875*pix[0][d]-0.250*pix[-4][d])+fabs(0.875*pix[1][1]-1.125*pix[-1][1]+0.250*pix[-3][1])+fabs(0.875*pix[-3][1]-1.125*pix[-1][1]+0.250*pix[-5][1]));
|
||||
f[3]=1.0/(1.0+2.0*fabs(1.125*pix[+v][d]-0.875*pix[0][d]-0.250*pix[+x][d])+fabs(0.875*pix[u][1]-1.125*pix[-u][1]+0.250*pix[+w][1])+fabs(0.875*pix[+w][1]-1.125*pix[+u][1]+0.250*pix[+y][1]));
|
||||
|
||||
float g[5];
|
||||
g[0]=(0.875*(pix[-u][1]-pix[-u][c])+0.125*(pix[-v][1]-pix[-v][c]));
|
||||
g[1]=(0.875*(pix[+1][1]-pix[+1][c])+0.125*(pix[+2][1]-pix[+2][c]));
|
||||
g[2]=(0.875*(pix[-1][1]-pix[-1][c])+0.125*(pix[-2][1]-pix[-2][c]));
|
||||
g[3]=(0.875*(pix[+u][1]-pix[+u][c])+0.125*(pix[+v][1]-pix[+v][c]));
|
||||
|
||||
g[4]=(f[0]*g[0]+f[1]*g[1]+f[2]*g[2]+f[3]*g[3]) / (f[0]+f[1]+f[2]+f[3]);
|
||||
|
||||
float p[9];
|
||||
p[0]=(pix[-u-1][1]-pix[-u-1][c]);
|
||||
p[1]=(pix[-u+0][1]-pix[-u+0][c]);
|
||||
p[2]=(pix[-u+1][1]-pix[-u+1][c]);
|
||||
p[3]=(pix[+0-1][1]-pix[+0-1][c]);
|
||||
p[4]=(pix[+0+0][1]-pix[+0+0][c]);
|
||||
p[5]=(pix[+0+1][1]-pix[+0+1][c]);
|
||||
p[6]=(pix[+u-1][1]-pix[+u-1][c]);
|
||||
p[7]=(pix[+u+0][1]-pix[+u+0][c]);
|
||||
p[8]=(pix[+u+1][1]-pix[+u+1][c]);
|
||||
|
||||
// sort p[]
|
||||
float temp; // used in PIX_SORT macro;
|
||||
PIX_SORT(p[1],p[2]); PIX_SORT(p[4],p[5]); PIX_SORT(p[7],p[8]); PIX_SORT(p[0],p[1]); PIX_SORT(p[3],p[4]); PIX_SORT(p[6],p[7]); PIX_SORT(p[1],p[2]); PIX_SORT(p[4],p[5]); PIX_SORT(p[7],p[8]); PIX_SORT(p[0],p[3]); PIX_SORT(p[5],p[8]); PIX_SORT(p[4],p[7]); PIX_SORT(p[3],p[6]); PIX_SORT(p[1],p[4]); PIX_SORT(p[2],p[5]); PIX_SORT(p[4],p[7]); PIX_SORT(p[4],p[2]); PIX_SORT(p[6],p[4]); PIX_SORT(p[4],p[2]);
|
||||
pix[0][c]=LIM(pix[0][1]-(1.30*g[4]-0.30*(pix[0][1]-pix[0][c])), 0.99*(pix[0][1]-p[4]), 1.01*(pix[0][1]-p[4]));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// put modified values to red, green, blue
|
||||
#pragma omp for
|
||||
for (int i=0;i<H;i++) {
|
||||
for (int j=0; j<W; j++) {
|
||||
red [i][j] =image[i*W+j][0];
|
||||
green[i][j] =image[i*W+j][1];
|
||||
blue [i][j] =image[i*W+j][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(image);
|
||||
|
||||
t2e.set();
|
||||
if (settings->verbose) printf("Refinement %d usec\n", t2e.etime(t1e));
|
||||
}
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
|
||||
@@ -112,6 +112,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
|
||||
rp.ca_autocorrect = false;
|
||||
rp.hotdeadpix_filt = false;
|
||||
rp.ccSteps = 0;
|
||||
rp.all_enhance = false;
|
||||
}
|
||||
|
||||
progress ("Applying white balance, color correction & sRBG conversion...",100*readyphase/numofphases);
|
||||
|
||||
@@ -171,7 +171,8 @@ enum ProcEvent {
|
||||
EvClaritythreechannels=146,
|
||||
EvClarityEnabledtwo=147,
|
||||
EvClaritymatrix=148,
|
||||
NUMOFEVENTS=149
|
||||
EvDemosaicALLEnhanced=149,
|
||||
NUMOFEVENTS=150
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -256,6 +256,8 @@ void ProcParams::setDefaults () {
|
||||
raw.dmethod = RAWParams::methodstring[RAWParams::hphd];;
|
||||
raw.dcb_iterations=2;
|
||||
raw.dcb_enhance=false;
|
||||
raw.all_enhance=false;
|
||||
|
||||
// exposure before interpolation
|
||||
raw.expos=1.0;
|
||||
raw.preser=0.0;
|
||||
@@ -515,6 +517,8 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2) const {
|
||||
keyFile.set_string ("RAW", "Method", raw.dmethod );
|
||||
keyFile.set_integer ("RAW", "DCBIterations", raw.dcb_iterations );
|
||||
keyFile.set_boolean ("RAW", "DCBEnhance", raw.dcb_enhance );
|
||||
keyFile.set_boolean ("RAW", "ALLEnhance", raw.all_enhance );
|
||||
|
||||
keyFile.set_double ("RAW", "PreExposure", raw.expos );
|
||||
keyFile.set_double ("RAW", "PrePreserv", raw.preser );
|
||||
keyFile.set_double ("RAW", "PreBlackzero", raw.blackzero );
|
||||
@@ -879,6 +883,8 @@ if (keyFile.has_group ("RAW")) {
|
||||
if (keyFile.has_key ("RAW", "Method")) raw.dmethod = keyFile.get_string ("RAW", "Method");
|
||||
if (keyFile.has_key ("RAW", "DCBIterations")) raw.dcb_iterations = keyFile.get_integer("RAW", "DCBIterations");
|
||||
if (keyFile.has_key ("RAW", "DCBEnhance")) raw.dcb_enhance =keyFile.get_boolean("RAW", "DCBEnhance");
|
||||
if (keyFile.has_key ("RAW", "ALLEnhance")) raw.all_enhance =keyFile.get_boolean("RAW", "ALLEnhance");
|
||||
|
||||
if (keyFile.has_key ("RAW", "PreExposure")) raw.expos =keyFile.get_double("RAW", "PreExposure");
|
||||
if (keyFile.has_key ("RAW", "PrePreserv")) raw.preser =keyFile.get_double("RAW", "PrePreserv");
|
||||
if (keyFile.has_key ("RAW", "PreBlackzero")) raw.blackzero =keyFile.get_double("RAW", "PreBlackzero");
|
||||
|
||||
@@ -442,6 +442,8 @@ class RAWParams {
|
||||
Glib::ustring dmethod;
|
||||
int dcb_iterations;
|
||||
bool dcb_enhance;
|
||||
bool all_enhance;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -453,7 +455,7 @@ class ProcParams {
|
||||
ToneCurveParams toneCurve; ///< Tone curve parameters
|
||||
LCurveParams labCurve; ///< CIELAB luminance curve parameters
|
||||
SharpeningParams sharpening; ///< Sharpening parameters
|
||||
ClarityParams clarity;
|
||||
ClarityParams clarity; ///< clarity parameters
|
||||
ColorBoostParams colorBoost; ///< Color boost parameters
|
||||
WBParams wb; ///< White balance parameters
|
||||
ColorShiftParams colorShift; ///< Color shift parameters
|
||||
|
||||
@@ -420,8 +420,6 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
|
||||
// Color correction (only when running on full resolution)
|
||||
if (ri->isBayer() && pp.skip==1)
|
||||
processFalseColorCorrection (image, raw.ccSteps);
|
||||
|
||||
// Applying postmul
|
||||
colorSpaceConversion (image, cmp, embProfile, camProfile, xyz_cam, defGain);
|
||||
}
|
||||
|
||||
@@ -1120,6 +1118,8 @@ void RawImageSource::demosaic(const RAWParams &raw, HRecParams hrp )
|
||||
t2.set();
|
||||
if( settings->verbose )
|
||||
printf("Demosaicing: %s - %d usec\n",raw.dmethod.c_str(), t2.etime(t1));
|
||||
|
||||
if (raw.all_enhance) refinement_lassus();
|
||||
}
|
||||
if (plistener) {
|
||||
plistener->setProgressStr ("Ready.");
|
||||
|
||||
@@ -130,6 +130,8 @@ class RawImageSource : public ImageSource {
|
||||
int load (Glib::ustring fname, bool batch = false);
|
||||
void preprocess (const RAWParams &raw, HRecParams hrp);
|
||||
void demosaic (const RAWParams &raw, HRecParams hrp);
|
||||
void refinement_lassus ();
|
||||
|
||||
void copyOriginalPixels(const RAWParams &raw, RawImage *ri, RawImage *riDark, RawImage *riFlatFile );
|
||||
void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW );
|
||||
void scaleColors (int winx,int winy,int winw,int winh, const RAWParams &raw);// raw for cblack
|
||||
|
||||
@@ -169,5 +169,7 @@ SHARPENING, //EvClarityEnabled
|
||||
SHARPENING, //EvClaritythreechannels
|
||||
SHARPENING, //EvClarityEnabledtwo
|
||||
SHARPENING, //EvClaritymatrix
|
||||
DEMOSAIC, // EvDemosaicALLEnhanced
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ void ParamsEdited::set (bool v) {
|
||||
raw.dmethod = v;
|
||||
raw.dcbIterations = v;
|
||||
raw.dcbEnhance = v;
|
||||
raw.allEnhance = v;
|
||||
raw.dfAuto = v;
|
||||
raw.caCorrection = v;
|
||||
raw.hotDeadPixel = v;
|
||||
@@ -332,6 +333,8 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
|
||||
icm.slpos = icm.slpos && p.icm.slpos == other.icm.slpos;
|
||||
raw.ccSteps = raw.ccSteps && p.raw.ccSteps == other.raw.ccSteps;
|
||||
raw.dcbEnhance = raw.dcbEnhance && p.raw.dcb_enhance == other.raw.dcb_enhance;
|
||||
raw.allEnhance = raw.allEnhance && p.raw.all_enhance == other.raw.all_enhance;
|
||||
|
||||
raw.dcbIterations = raw.dcbIterations && p.raw.dcb_iterations == other.raw.dcb_iterations;
|
||||
raw.dmethod = raw.dmethod && p.raw.dmethod == other.raw.dmethod;
|
||||
raw.caCorrection = raw.caCorrection && p.raw.ca_autocorrect == other.raw.ca_autocorrect;
|
||||
@@ -503,6 +506,8 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
if (raw.dmethod) toEdit.raw.dmethod = mods.raw.dmethod;
|
||||
if (raw.dcbIterations) toEdit.raw.dcb_iterations = mods.raw.dcb_iterations;
|
||||
if (raw.dcbEnhance) toEdit.raw.dcb_enhance = mods.raw.dcb_enhance;
|
||||
if (raw.allEnhance) toEdit.raw.all_enhance = mods.raw.all_enhance;
|
||||
|
||||
if (raw.caCorrection) toEdit.raw.ca_autocorrect = mods.raw.ca_autocorrect;
|
||||
if (raw.caRed) toEdit.raw.cared = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cared + mods.raw.cared : mods.raw.cared;
|
||||
if (raw.caBlue) toEdit.raw.cablue = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cablue + mods.raw.cablue : mods.raw.cablue;
|
||||
|
||||
@@ -299,6 +299,7 @@ class RAWParamsEdited {
|
||||
bool dmethod;
|
||||
bool dcbIterations;
|
||||
bool dcbEnhance;
|
||||
bool allEnhance;
|
||||
bool caCorrection;
|
||||
bool caRed;
|
||||
bool caBlue;
|
||||
|
||||
@@ -99,6 +99,8 @@ PartialPasteDlg::PartialPasteDlg () {
|
||||
raw_ccSteps = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RAW_FALSECOLOR")));
|
||||
raw_dcb_iterations = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RAW_DCBITERATIONS")));
|
||||
raw_dcb_enhance = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RAW_DCBENHANCE")));
|
||||
raw_all_enhance = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RAW_ALLENHANCE")));
|
||||
|
||||
df_file = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DARKFRAMEFILE")));
|
||||
df_AutoSelect = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DARKFRAMEAUTOSELECT")));
|
||||
ff_file = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_FLATFIELDFILE")));
|
||||
@@ -170,6 +172,7 @@ PartialPasteDlg::PartialPasteDlg () {
|
||||
vboxes[6]->pack_start (*raw_ccSteps, Gtk::PACK_SHRINK, 2);
|
||||
vboxes[6]->pack_start (*raw_dcb_iterations, Gtk::PACK_SHRINK, 2);
|
||||
vboxes[6]->pack_start (*raw_dcb_enhance, Gtk::PACK_SHRINK, 2);
|
||||
vboxes[6]->pack_start (*raw_all_enhance, Gtk::PACK_SHRINK, 2);
|
||||
vboxes[6]->pack_start (*Gtk::manage (new Gtk::HSeparator ()), Gtk::PACK_SHRINK, 0);
|
||||
vboxes[6]->pack_start (*raw_linenoise, Gtk::PACK_SHRINK, 2);
|
||||
vboxes[6]->pack_start (*raw_greenthresh, Gtk::PACK_SHRINK, 2);
|
||||
@@ -274,6 +277,8 @@ PartialPasteDlg::PartialPasteDlg () {
|
||||
raw_ccStepsConn = raw_ccSteps->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
raw_dcb_iterationsConn = raw_dcb_iterations->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
raw_dcb_enhanceConn = raw_dcb_enhance->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
raw_all_enhanceConn = raw_all_enhance->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
|
||||
raw_exposConn = raw_expos->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
raw_preserConn = raw_preser->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
raw_blackConn = raw_black->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true));
|
||||
@@ -342,6 +347,7 @@ void PartialPasteDlg::rawToggled () {
|
||||
raw_ccStepsConn.block (true);
|
||||
raw_dcb_iterationsConn.block (true);
|
||||
raw_dcb_enhanceConn.block (true);
|
||||
raw_all_enhanceConn.block (true);
|
||||
raw_exposConn.block (true);
|
||||
raw_preserConn.block (true);
|
||||
raw_blackConn.block (true);
|
||||
@@ -364,6 +370,7 @@ void PartialPasteDlg::rawToggled () {
|
||||
raw_ccSteps->set_active (raw->get_active ());
|
||||
raw_dcb_iterations->set_active (raw->get_active ());
|
||||
raw_dcb_enhance->set_active (raw->get_active ());
|
||||
raw_all_enhance->set_active (raw->get_active ());
|
||||
raw_expos->set_active (raw->get_active ());
|
||||
raw_preser->set_active (raw->get_active ());
|
||||
raw_black->set_active (raw->get_active ());
|
||||
@@ -384,6 +391,7 @@ void PartialPasteDlg::rawToggled () {
|
||||
raw_ccStepsConn.block (false);
|
||||
raw_dcb_iterationsConn.block (false);
|
||||
raw_dcb_enhanceConn.block (false);
|
||||
raw_all_enhanceConn.block (false);
|
||||
raw_exposConn.block (false);
|
||||
raw_preserConn.block (false);
|
||||
raw_blackConn.block (false);
|
||||
@@ -596,6 +604,8 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dst, const r
|
||||
if (raw_ccSteps->get_active ()) dst->raw.ccSteps =src->raw.ccSteps;
|
||||
if (raw_dcb_iterations->get_active ()) dst->raw.dcb_iterations =src->raw.dcb_iterations;
|
||||
if (raw_dcb_enhance->get_active ()) dst->raw.dcb_enhance =src->raw.dcb_enhance;
|
||||
if (raw_all_enhance->get_active ()) dst->raw.all_enhance =src->raw.all_enhance;
|
||||
|
||||
if (raw_expos->get_active ()) dst->raw.expos =src->raw.expos;
|
||||
if (raw_preser->get_active ()) dst->raw.preser =src->raw.preser;
|
||||
if (raw_black->get_active ()){
|
||||
|
||||
@@ -94,6 +94,8 @@ class PartialPasteDlg : public Gtk::Dialog {
|
||||
Gtk::CheckButton* raw_ccSteps;
|
||||
Gtk::CheckButton* raw_dcb_iterations;
|
||||
Gtk::CheckButton* raw_dcb_enhance;
|
||||
Gtk::CheckButton* raw_all_enhance;
|
||||
|
||||
Gtk::CheckButton* df_file;
|
||||
Gtk::CheckButton* df_AutoSelect;
|
||||
Gtk::CheckButton* ff_file;
|
||||
@@ -110,7 +112,7 @@ class PartialPasteDlg : public Gtk::Dialog {
|
||||
sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, perspectiveConn, commonTransConn;
|
||||
sigc::connection exifchConn, iptcConn, icmConn;
|
||||
sigc::connection df_fileConn, df_AutoSelectConn, ff_fileConn, ff_AutoSelectConn, ff_BlurRadiusConn, ff_BlurTypeConn;
|
||||
sigc::connection raw_caredConn, raw_cablueConn, raw_ca_autocorrectConn, raw_hotdeadpix_filtConn, raw_linenoiseConn, raw_greenthreshConn, raw_ccStepsConn, raw_dmethodConn, raw_dcb_iterationsConn, raw_dcb_enhanceConn, raw_exposConn, raw_preserConn, raw_blackConn;
|
||||
sigc::connection raw_caredConn, raw_cablueConn, raw_ca_autocorrectConn, raw_hotdeadpix_filtConn, raw_linenoiseConn, raw_greenthreshConn, raw_ccStepsConn, raw_dmethodConn, raw_dcb_iterationsConn, raw_all_enhanceConn, raw_dcb_enhanceConn, raw_exposConn, raw_preserConn, raw_blackConn;
|
||||
|
||||
public:
|
||||
PartialPasteDlg ();
|
||||
|
||||
@@ -25,13 +25,13 @@ using namespace rtengine::procparams;
|
||||
RawProcess::RawProcess () : Gtk::VBox(), FoldableToolPanel(this)
|
||||
{
|
||||
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
|
||||
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") +": ")));
|
||||
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") +": ")),Gtk::PACK_SHRINK, 4);
|
||||
dmethod = Gtk::manage (new Gtk::ComboBoxText ());
|
||||
for( size_t i=0; i< procparams::RAWParams::numMethods;i++)
|
||||
dmethod->append_text(procparams::RAWParams::methodstring[i]);
|
||||
|
||||
dmethod->set_active(0);
|
||||
hb1->pack_end (*dmethod);
|
||||
hb1->pack_end (*dmethod, Gtk::PACK_EXPAND_WIDGET, 4);
|
||||
pack_start( *hb1, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
dcbOptions = Gtk::manage (new Gtk::VBox ());
|
||||
@@ -55,8 +55,17 @@ RawProcess::RawProcess () : Gtk::VBox(), FoldableToolPanel(this)
|
||||
ccSteps->show();
|
||||
pack_start( *ccSteps, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
pack_start( *Gtk::manage( new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0 );
|
||||
|
||||
allOptions = Gtk::manage (new Gtk::VBox ());
|
||||
//allOptions->set_border_width(2);
|
||||
allEnhance = Gtk::manage (new Gtk::CheckButton(M("TP_RAW_ALLENHANCE")));
|
||||
allOptions->pack_start(*allEnhance);
|
||||
pack_start( *allOptions, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
methodconn = dmethod->signal_changed().connect( sigc::mem_fun(*this, &RawProcess::methodChanged) );
|
||||
dcbEnhconn = dcbEnhance->signal_toggled().connect ( sigc::mem_fun(*this, &RawProcess::dcbEnhanceChanged), true);
|
||||
allEnhconn = allEnhance->signal_toggled().connect ( sigc::mem_fun(*this, &RawProcess::allEnhanceChanged), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +74,7 @@ void RawProcess::read(const rtengine::procparams::ProcParams* pp, const ParamsEd
|
||||
disableListener ();
|
||||
methodconn.block (true);
|
||||
dcbEnhconn.block (true);
|
||||
allEnhconn.block (true);
|
||||
|
||||
dmethod->set_active(procparams::RAWParams::numMethods);
|
||||
for( size_t i=0; i< procparams::RAWParams::numMethods;i++)
|
||||
@@ -72,6 +82,7 @@ void RawProcess::read(const rtengine::procparams::ProcParams* pp, const ParamsEd
|
||||
dmethod->set_active(i);
|
||||
break;
|
||||
}
|
||||
allEnhance->set_active(pp->raw.all_enhance);
|
||||
|
||||
dcbIterations->setValue (pp->raw.dcb_iterations);
|
||||
dcbEnhance->set_active(pp->raw.dcb_enhance);
|
||||
@@ -89,17 +100,22 @@ void RawProcess::read(const rtengine::procparams::ProcParams* pp, const ParamsEd
|
||||
ccOptions->hide();
|
||||
|
||||
lastDCBen = pp->raw.dcb_enhance;
|
||||
lastALLen = pp->raw.all_enhance;
|
||||
|
||||
if(pedited ){
|
||||
ccSteps->setEditedState (pedited->raw.ccSteps ? Edited : UnEdited);
|
||||
dcbIterations->setEditedState ( pedited->raw.dcbIterations ? Edited : UnEdited);
|
||||
dcbEnhance->set_inconsistent(!pedited->raw.dcbEnhance);
|
||||
allEnhance->set_inconsistent(!pedited->raw.allEnhance);
|
||||
|
||||
if( !pedited->raw.dmethod )
|
||||
dmethod->set_active(procparams::RAWParams::numMethods); // No name
|
||||
}
|
||||
|
||||
methodconn.block (false);
|
||||
dcbEnhconn.block (false);
|
||||
allEnhconn.block (false);
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
|
||||
@@ -108,6 +124,7 @@ void RawProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedi
|
||||
pp->raw.ccSteps = ccSteps->getIntValue();
|
||||
pp->raw.dcb_iterations = dcbIterations->getIntValue();
|
||||
pp->raw.dcb_enhance = dcbEnhance->get_active();
|
||||
pp->raw.all_enhance = allEnhance->get_active();
|
||||
|
||||
int currentRow = dmethod->get_active_row_number();
|
||||
if( currentRow>=0 && currentRow < procparams::RAWParams::numMethods)
|
||||
@@ -118,6 +135,8 @@ void RawProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedi
|
||||
pedited->raw.dmethod = dmethod->get_active_row_number() != procparams::RAWParams::numMethods;
|
||||
pedited->raw.dcbIterations = dcbIterations->getEditedState ();
|
||||
pedited->raw.dcbEnhance = !dcbEnhance->get_inconsistent();
|
||||
pedited->raw.allEnhance = !allEnhance->get_inconsistent();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,3 +205,21 @@ void RawProcess::dcbEnhanceChanged ()
|
||||
if (listener)
|
||||
listener->panelChanged (EvDemosaicDCBEnhanced, dcbEnhance->get_active()?M("GENERAL_ENABLED"):M("GENERAL_DISABLED"));
|
||||
}
|
||||
|
||||
void RawProcess::allEnhanceChanged ()
|
||||
{
|
||||
if (batchMode) {
|
||||
if (allEnhance->get_inconsistent()) {
|
||||
allEnhance->set_inconsistent (false);
|
||||
allEnhconn.block (true);
|
||||
allEnhance->set_active (false);
|
||||
allEnhconn.block (false);
|
||||
}
|
||||
else if (lastALLen)
|
||||
allEnhance->set_inconsistent (true);
|
||||
|
||||
lastALLen = allEnhance->get_active ();
|
||||
}
|
||||
if (listener)
|
||||
listener->panelChanged (EvDemosaicALLEnhanced, allEnhance->get_active()?M("GENERAL_ENABLED"):M("GENERAL_DISABLED"));
|
||||
}
|
||||
|
||||
@@ -35,9 +35,12 @@ class RawProcess : public Gtk::VBox, public AdjusterListener, public FoldableToo
|
||||
Gtk::VBox *ccOptions;
|
||||
Adjuster* dcbIterations;
|
||||
Gtk::CheckButton* dcbEnhance;
|
||||
Gtk::VBox *allOptions;
|
||||
Gtk::CheckButton* allEnhance;
|
||||
|
||||
bool lastDCBen;
|
||||
sigc::connection methodconn,dcbEnhconn;
|
||||
bool lastALLen;
|
||||
sigc::connection methodconn,dcbEnhconn,allEnhconn;
|
||||
public:
|
||||
|
||||
RawProcess ();
|
||||
@@ -50,6 +53,8 @@ class RawProcess : public Gtk::VBox, public AdjusterListener, public FoldableToo
|
||||
void methodChanged ();
|
||||
void adjusterChanged (Adjuster* a, double newval);
|
||||
void dcbEnhanceChanged();
|
||||
void allEnhanceChanged();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user