Merge pull request #5236 from Beep6581/newlocallab-speedup

Speedups and cleanups for newlocallab
This commit is contained in:
Ingo Weyrich
2019-03-25 12:26:41 +01:00
committed by GitHub
4 changed files with 420 additions and 821 deletions

View File

@@ -242,7 +242,7 @@ public:
void luminanceCurve(LabImage* lold, LabImage* lnew, LUTf &curve);
void ciecamloc_02float(int sp, LabImage* lab, LabImage* dest);
void ciecamloc_02float(int sp, LabImage* lab);
void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params,
const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3,
@@ -250,7 +250,7 @@ public:
bool showSharpMask = false);
void chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve);
void vibrance(LabImage* lab); //Jacques' vibrance
void softprocess(LabImage* bufcolorig, float ** buflight, /* float ** bufchro, float ** buf_a, float ** buf_b, */ float rad, int bfh, int bfw, int sk, bool multiThread);
void softprocess(const LabImage* bufcolorig, array2D<float> &buflight, /* float ** bufchro, float ** buf_a, float ** buf_b, */ float rad, int bfh, int bfw, int sk, bool multiThread);
// void colorCurve (LabImage* lold, LabImage* lnew);
void sharpening(LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask = false);
void sharpeningcam(CieImage* ncie, float** buffer, bool showMask = false);
@@ -311,7 +311,7 @@ public:
void vibrancelocal(int sp, int bfw, int bfh, LabImage* lab, LabImage* dest, bool & localskutili, LUTf & sklocalcurve);
void transit_shapedetect(int senstype, LabImage * bufexporig, LabImage * originalmask, float **buflight, float **bufchro, float **buf_a_cat, float ** buf_b_cat, float ** bufhh, bool HHutili, const float hueref, const float chromaref, const float lumaref, float sobelref, float meansobel, float ** blend2, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk);
void exlabLocal(const local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve);
void Exclude_Local(int sen, float **deltaso, const float hueref, const float chromaref, const float lumaref, float sobelref, float meansobel, const struct local_params & lp, LabImage * original, LabImage * transformed, LabImage * rsv, LabImage * reserv, int cx, int cy, int sk);
void Exclude_Local(float **deltaso, float hueref, float chromaref, float lumaref, float sobelref, float meansobel, const struct local_params & lp, const LabImage * original, LabImage * transformed, const LabImage * rsv, const LabImage * reserv, int cx, int cy, int sk);
void DeNoise_Local(int call, const struct local_params& lp, int levred, float hueref, float lumaref, float chromaref, LabImage* original, LabImage* transformed, LabImage &tmp1, int cx, int cy, int sk);

File diff suppressed because it is too large Load Diff

View File

@@ -25,9 +25,12 @@
namespace rtengine
{
LabImage::LabImage (int w, int h) : W(w), H(h)
LabImage::LabImage (int w, int h, bool initZero, bool multiThread) : W(w), H(h)
{
allocLab(w, h);
if (initZero) {
clear(multiThread);
}
}
LabImage::~LabImage ()
@@ -37,7 +40,19 @@ LabImage::~LabImage ()
void LabImage::CopyFrom(LabImage *Img)
{
#ifdef _OPENMP
#pragma omp parallel sections
{
#pragma omp section
memcpy(L[0], Img->L[0], W * H * sizeof(float));
#pragma omp section
memcpy(a[0], Img->a[0], W * H * sizeof(float));
#pragma omp section
memcpy(b[0], Img->b[0], W * H * sizeof(float));
}
#else
memcpy(data, Img->data, W * H * 3 * sizeof(float));
#endif
}
void LabImage::getPipetteData (float &v1, float &v2, float &v3, int posX, int posY, int squareSize)
@@ -107,12 +122,8 @@ void LabImage::clear(bool multiThread) {
#ifdef _OPENMP
#pragma omp parallel for if(multiThread)
#endif
for(int i = 0; i < H; ++i) {
for(int j = 0; j < W; ++j) {
L[i][j] = a[i][j] = b[i][j] = 0.f;
}
for(size_t i = 0; i < static_cast<size_t>(H) * W * 3; ++i) {
data[i] = 0.f;
}
}
}

View File

@@ -34,7 +34,7 @@ public:
float** a;
float** b;
LabImage (int w, int h);
LabImage (int w, int h, bool initZero = false, bool multiThread = true);
~LabImage ();
//Copies image data in Img into this instance.