Some code cleanups

This commit is contained in:
Ingo Weyrich
2019-11-21 19:36:16 +01:00
parent ff9eeb4744
commit 89d8c341a6
8 changed files with 11 additions and 106 deletions

View File

@@ -195,18 +195,8 @@ void Crop::update(int todo)
params.dirpyrDenoise.getCurves(noiseLCurve, noiseCCurve);
int tilesize;
int overlap;
if (settings->leveldnti == 0) {
tilesize = 1024;
overlap = 128;
}
if (settings->leveldnti == 1) {
tilesize = 768;
overlap = 96;
}
const int tilesize = settings->leveldnti == 0 ? 1024 : 768;
const int overlap = settings->leveldnti == 0 ? 128 : 96;
int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip;

View File

@@ -233,10 +233,10 @@ void Image8::getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* image, P
lineB[dst_x] = CLIP(bm * btot);
} else {
// computing a special factor for this incomplete sub-region
float area = src_sub_width * src_sub_height;
lineR[dst_x] = CLIP(rm2 * rtot / area);
lineG[dst_x] = CLIP(gm2 * gtot / area);
lineB[dst_x] = CLIP(bm2 * btot / area);
float larea = src_sub_width * src_sub_height;
lineR[dst_x] = CLIP(rm2 * rtot / larea);
lineG[dst_x] = CLIP(gm2 * gtot / larea);
lineB[dst_x] = CLIP(bm2 * btot / larea);
}
}
}

View File

@@ -230,9 +230,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
MyMutex::MyLock processingLock(mProcessing);
constexpr int numofphases = 14;
int readyphase = 0;
bool highDetailNeeded = options.prevdemo == PD_Sidecar ? true : (todo & M_HIGHQUAL);
// Check if any detail crops need high detail. If not, take a fast path short cut
@@ -273,8 +270,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
//rp.deadPixelFilter = rp.hotPixelFilter = false;
}
progress("Applying white balance, color correction & sRGB conversion...", 100 * readyphase / numofphases);
if (frameCountListener) {
frameCountListener->FrameCountChanged(imgsrc->getFrameCount(), params->raw.bayersensor.imageNum);
}
@@ -533,8 +528,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
ipf.firstAnalysis(orig_prev, *params, vhist16);
}
readyphase++;
if ((todo & M_HDR) && (params->fattal.enabled || params->dehaze.enabled)) {
if (fattal_11_dcrop_cache) {
delete fattal_11_dcrop_cache;
@@ -551,7 +544,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
oprevi = orig_prev;
progress("Rotate / Distortion...", 100 * readyphase / numofphases);
// Remove transformation if unneeded
bool needstransform = ipf.needsTransform();
@@ -577,11 +569,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
ipf.lab2rgb(labcbdl, *oprevi, params->icm.workingProfile);
}
readyphase++;
progress("Preparing shadow/highlight map...", 100 * readyphase / numofphases);
readyphase++;
if (todo & M_AUTOEXP) {
if (params->toneCurve.autoexp) {
LUTu aehist;
@@ -618,8 +605,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
}
}
progress("Exposure curve & CIELAB conversion...", 100 * readyphase / numofphases);
if (todo & (M_AUTOEXP | M_RGBCURVE)) {
if (params->icm.workingTRC == "Custom") { //exec TRC IN free
if (oprevi == orig_prev) {
@@ -767,8 +752,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
params->crop.mapToResized(pW, pH, scale, x1, x2, y1, y2);
}
readyphase++;
if (todo & (M_LUMACURVE | M_CROP)) {
LUTu lhist16(32768);
lhist16.clear();
@@ -811,8 +794,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
if (todo & (M_LUMINANCE + M_COLOR)) {
nprevl->CopyFrom(oprevl);
progress("Applying Color Boost...", 100 * readyphase / numofphases);
histCCurve.clear();
histLCurve.clear();
ipf.chromiLuminanceCurve(nullptr, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve);
@@ -823,72 +804,22 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
ipf.EPDToneMap(nprevl, 0, scale);
}
// for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled
readyphase++;
/* Issue 2785, disabled some 1:1 tools
if (scale==1) {
if((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)){
progress ("Denoising luminance impulse...",100*readyphase/numofphases);
ipf.impulsedenoise (nprevl);
readyphase++;
}
if((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)){
progress ("Defringing...",100*readyphase/numofphases);
ipf.defringe (nprevl);
readyphase++;
}
if (params->sharpenEdge.enabled) {
progress ("Edge sharpening...",100*readyphase/numofphases);
ipf.MLsharpen (nprevl);
readyphase++;
}
if (params->sharpenMicro.enabled) {
if(( params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)){
progress ("Microcontrast...",100*readyphase/numofphases);
ipf.MLmicrocontrast (nprevl);
readyphase++;
}
}
if(((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled)) && params->sharpening.enabled) {
progress ("Sharpening...",100*readyphase/numofphases);
float **buffer = new float*[pH];
for (int i=0; i<pH; i++)
buffer[i] = new float[pW];
ipf.sharpening (nprevl, (float**)buffer);
for (int i=0; i<pH; i++)
delete [] buffer[i];
delete [] buffer;
readyphase++;
}
}
*/
if (params->dirpyrequalizer.cbdlMethod == "aft") {
if (((params->colorappearance.enabled && !settings->autocielab) || (!params->colorappearance.enabled))) {
progress("Pyramid wavelet...", 100 * readyphase / numofphases);
ipf.dirpyrequalizer(nprevl, scale);
//ipf.Lanczoslab (ip_wavelet(LabImage * lab, LabImage * dst, const procparams::EqualizerParams & eqparams), nprevl, 1.f/scale);
readyphase++;
}
}
wavcontlutili = false;
//CurveFactory::curveWavContL ( wavcontlutili,params->wavelet.lcurve, wavclCurve, LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,int skip);
CurveFactory::curveWavContL(wavcontlutili, params->wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16);
if ((params->wavelet.enabled)) {
WaveletParams WaveParams = params->wavelet;
// WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY);
WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL);
int kall = 0;
progress("Wavelet...", 100 * readyphase / numofphases);
// ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, scale);
ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale);
}
@@ -896,7 +827,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
ipf.softLight(nprevl);
if (params->colorappearance.enabled) {
//L histo and Chroma histo for ciecam
// L histo and Chroma histo for ciecam
// histogram well be for Lab (Lch) values, because very difficult to do with J,Q, M, s, C
int x1, y1, x2, y2;
params->crop.mapToResized(pW, pH, scale, x1, x2, y1, y2);
@@ -977,8 +908,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
if (params->colorappearance.autoybscen && acListener && params->colorappearance.enabled) {
acListener->ybCamChanged((int) yb); //real value Yb scene
}
readyphase++;
} else {
// CIECAM is disabled, we free up its image buffer to save some space
if (ncie) {
@@ -1013,8 +942,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
}
if (panningRelatedChange || (todo & M_MONITOR)) {
progress("Conversion to RGB...", 100 * readyphase / numofphases);
if ((todo != CROP && todo != MINUPDATE) || (todo & M_MONITOR)) {
MyMutex::MyLock prevImgLock(previmg->getMutex());
@@ -1026,7 +953,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
delete workimg;
workimg = ipf.lab2rgb(nprevl, 0, 0, pW, pH, params->icm);
} catch (char * str) {
progress("Error converting file...", 0);
return;
}
}
@@ -1045,8 +971,6 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
imageListener->imageReady(params->crop);
}
readyphase++;
if (hListener) {
updateLRGBHistograms();
hListener->histogramChanged(histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma, histLRETI);
@@ -1209,15 +1133,6 @@ void ImProcCoordinator::updateLRGBHistograms()
}
void ImProcCoordinator::progress(Glib::ustring str, int pr)
{
/* if (plistener) {
plistener->setProgressStr (str);
plistener->setProgress ((double)pr / 100.0);
}*/
}
bool ImProcCoordinator::getAutoWB(double& temp, double& green, double equal, double tempBias)
{

View File

@@ -23,7 +23,6 @@
#include "coord2d.h"
#include "gamutwarning.h"
#include "pipettebuffer.h"
#include "shmap.h"
template<typename T>
class LUT;

View File

@@ -51,6 +51,7 @@
#include "procparams.h"
#include "rawimagesource.h"
#include "rtengine.h"
#include "shmap.h"
#include "StopWatch.h"
namespace

View File

@@ -220,7 +220,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
blue.push_back (Coord2D (src[i].x, src[i].y));
}
return clipped;
return false;
}
double oW = W, oH = H;

View File

@@ -351,7 +351,7 @@ void SHMap::forceStat (float max_, float min_, float avg_)
avg = avg_;
}
void SHMap::dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, LUTf & rangefn, int level, int scale)
void SHMap::dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, const LUTf& rangefn, int level, int scale)
{
//scale is spacing of directional averaging weights

View File

@@ -50,7 +50,7 @@ private:
void fillLuminance( Imagefloat * img, float **luminance, double lumi[3] );
void fillLuminanceL( float ** L, float **luminance );
void dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, LUTf & rangefn, int level, int scale);
void dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, const LUTf& rangefn, int level, int scale);
};