Patch from issue 927: Clarity and sharpening
on behalf of Jacques Desmis
This commit is contained in:
@@ -330,14 +330,14 @@ HISTORY_MSG_97;'b' curve
|
|||||||
HISTORY_MSG_98;Demosaicing method
|
HISTORY_MSG_98;Demosaicing method
|
||||||
HISTORY_MSG_99;Hot/dead pixel filtering
|
HISTORY_MSG_99;Hot/dead pixel filtering
|
||||||
HISTORY_MSG_9;Highlight Compression
|
HISTORY_MSG_9;Highlight Compression
|
||||||
HISTORY_MSG_142;Clarity -passes
|
HISTORY_MSG_142;Edges sharpening - iterations
|
||||||
HISTORY_MSG_143;Clarity -gradient strength
|
HISTORY_MSG_143;Edges sharpening - quantity
|
||||||
HISTORY_MSG_147;Clarity - luminance only
|
HISTORY_MSG_147;Edges sharpening - luminance only
|
||||||
HISTORY_MSG_144;Microcontrast - strength
|
HISTORY_MSG_144;Microcontrast - quantity
|
||||||
HISTORY_MSG_145;Microcontrast - uniformity
|
HISTORY_MSG_145;Microcontrast - uniformity
|
||||||
HISTORY_MSG_146;Clarity Sharpening - enabled
|
HISTORY_MSG_146;Edges Sharpening
|
||||||
HISTORY_MSG_148;Clarity Microcontrast - enabled
|
HISTORY_MSG_148;Microcontrast
|
||||||
HISTORY_MSG_149;Clarity Microcontrast matrix
|
HISTORY_MSG_149;Microcontrast - 3x3 matrix
|
||||||
HISTORY_MSG_150;Post demosaic artifact/noise reduction
|
HISTORY_MSG_150;Post demosaic artifact/noise reduction
|
||||||
HISTORY_NEWSNAPSHOT;Add
|
HISTORY_NEWSNAPSHOT;Add
|
||||||
HISTORY_NEWSNAPSHOTAS;As...
|
HISTORY_NEWSNAPSHOTAS;As...
|
||||||
@@ -512,7 +512,7 @@ PARTIALPASTE_FLATFIELDAUTOSELECT;FF Auto Select
|
|||||||
PARTIALPASTE_FLATFIELDBLURRADIUS;FF Blur Radius
|
PARTIALPASTE_FLATFIELDBLURRADIUS;FF Blur Radius
|
||||||
PARTIALPASTE_FLATFIELDBLURTYPE;FF Blur Type
|
PARTIALPASTE_FLATFIELDBLURTYPE;FF Blur Type
|
||||||
PARTIALPASTE_FLATFIELDFILE;Flat field (FF) File
|
PARTIALPASTE_FLATFIELDFILE;Flat field (FF) File
|
||||||
PARTIALPASTE_GRADIENTSHARPEN;Gradient Sharpening (border)
|
PARTIALPASTE_GRADIENTSHARPEN;Local Sharpening
|
||||||
PARTIALPASTE_HLRECONSTRUCTION;Highlight reconstruction
|
PARTIALPASTE_HLRECONSTRUCTION;Highlight reconstruction
|
||||||
PARTIALPASTE_HLRECOVERY;Highlight recovery
|
PARTIALPASTE_HLRECOVERY;Highlight recovery
|
||||||
PARTIALPASTE_HLRECOVERYAMOUNT;Highlight recovery amount
|
PARTIALPASTE_HLRECOVERYAMOUNT;Highlight recovery amount
|
||||||
@@ -571,7 +571,7 @@ PREFERENCES_CACHETHUMBHEIGHT;Maximal Thumbnail Height
|
|||||||
PREFERENCES_CLIPPINGIND;Clipping indication
|
PREFERENCES_CLIPPINGIND;Clipping indication
|
||||||
PREFERENCES_CMETRICINTENT;Colorimetric Intent
|
PREFERENCES_CMETRICINTENT;Colorimetric Intent
|
||||||
PREFERENCES_CUSTPROFBUILD;Custom image profile builder
|
PREFERENCES_CUSTPROFBUILD;Custom image profile builder
|
||||||
PREFERENCES_CUSTPROFBUILDHINT;Executable (or script) file called when a new initial profile should be generated an image.\nReceives command line params to allow a rules based .pp3 generation:\n[Path RAW/JPG] [Path default profile] [f-no] [exposure in secs] [focal length in mm] [ISO] [Lens] [Camera]
|
PREFERENCES_CUSTPROFBUILDHINT;Executable (or script) file called when a new initial profile should be generated for an image.\nReceives command line params to allow a rules based .pp3 generation:\n[Path RAW/JPG] [Path default profile] [f-no] [exposure in secs] [focal length in mm] [ISO] [Lens] [Camera]
|
||||||
PREFERENCES_CUSTPROFBUILDPATH;Executable path
|
PREFERENCES_CUSTPROFBUILDPATH;Executable path
|
||||||
PREFERENCES_CUTOVERLAYBRUSH;Crop mask color/transparency
|
PREFERENCES_CUTOVERLAYBRUSH;Crop mask color/transparency
|
||||||
PREFERENCES_DARKFRAME;Dark frame
|
PREFERENCES_DARKFRAME;Dark frame
|
||||||
@@ -737,14 +737,14 @@ TP_CHMIXER_GREEN;Green
|
|||||||
TP_CHMIXER_LABEL;Channel Mixer
|
TP_CHMIXER_LABEL;Channel Mixer
|
||||||
TP_CHMIXER_RED;Red
|
TP_CHMIXER_RED;Red
|
||||||
TP_CHROMATABERR_LABEL;Chromatic Aberration
|
TP_CHROMATABERR_LABEL;Chromatic Aberration
|
||||||
TP_CLARITY_LABEL;Clarity and Sharpening
|
TP_CLARITY_LABEL;Local Sharpening
|
||||||
TP_CLARITY_SHARPEN;Border
|
TP_CLARITY_SHARPEN;Edges Sharpening
|
||||||
TP_CLARITY_STRENGTH;Gradient strength
|
TP_CLARITY_STRENGTH;Quantity
|
||||||
TP_CLARITY_PASSES;Gradient passes
|
TP_CLARITY_PASSES;Iterations
|
||||||
TP_CLARITY_MICRO;Texture
|
TP_CLARITY_MICRO;Microcontrast
|
||||||
TP_CLARITY_THREE;Luminance only
|
TP_CLARITY_THREE;Luminance only
|
||||||
TP_CLARITY_MATRIX;3x3 matrix instead of 5x5
|
TP_CLARITY_MATRIX;3x3 matrix instead of 5x5
|
||||||
TP_MLMICRO_STRENGTH;Strength
|
TP_MLMICRO_STRENGTH;Quantity
|
||||||
TP_MLMICRO_UNIFORMITY;Uniformity
|
TP_MLMICRO_UNIFORMITY;Uniformity
|
||||||
TP_COARSETRAF_DEGREE;degree:
|
TP_COARSETRAF_DEGREE;degree:
|
||||||
TP_COARSETRAF_TOOLTIP_HFLIP;Flip horizontally
|
TP_COARSETRAF_TOOLTIP_HFLIP;Flip horizontally
|
||||||
|
@@ -34,12 +34,16 @@ namespace rtengine {
|
|||||||
#define CMAXVAL 0xffff
|
#define CMAXVAL 0xffff
|
||||||
#define CLIP(a) ((a)>0?((a)<CMAXVAL?(a):CMAXVAL):0)
|
#define CLIP(a) ((a)>0?((a)<CMAXVAL?(a):CMAXVAL):0)
|
||||||
#define ABS(a) ((a)<0?-(a):(a))
|
#define ABS(a) ((a)<0?-(a):(a))
|
||||||
|
#define LIM(x,min,max) MAX(min,MIN(x,max))
|
||||||
|
#define CLIREF(x) LIM(x,-200000.0,200000.0) // avoid overflow : do not act directly on image[] or pix[]
|
||||||
|
|
||||||
|
|
||||||
extern Settings* settings;
|
extern Settings* settings;
|
||||||
|
|
||||||
void ImProcFunctions::dcdamping (float** aI, float** aO, float damping, int W, int H) {
|
void ImProcFunctions::dcdamping (float** aI, float** aO, float damping, int W, int H) {
|
||||||
|
|
||||||
const float dampingFac=2.0/(damping*damping);
|
const float dampingFac=2.0/(damping*damping);
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp for
|
#pragma omp for
|
||||||
#endif
|
#endif
|
||||||
@@ -73,10 +77,12 @@ void ImProcFunctions::deconvsharpening (LabImage* lab, float** b2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float** tmp = (float**)b2;
|
float** tmp = (float**)b2;
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H));
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H));
|
||||||
float damping = params->sharpening.deconvdamping / 5.0;
|
float damping = params->sharpening.deconvdamping / 5.0;
|
||||||
bool needdamp = params->sharpening.deconvdamping > 0;
|
bool needdamp = params->sharpening.deconvdamping > 0;
|
||||||
@@ -110,7 +116,7 @@ void ImProcFunctions::deconvsharpening (LabImage* lab, float** b2) {
|
|||||||
} // end for
|
} // end for
|
||||||
delete buffer;
|
delete buffer;
|
||||||
|
|
||||||
float p2 = params->sharpening.deconvamount /100.0;
|
float p2 = params->sharpening.deconvamount / 100.0;
|
||||||
float p1 = 1.0 - p2;
|
float p1 = 1.0 - p2;
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
@@ -120,7 +126,7 @@ void ImProcFunctions::deconvsharpening (LabImage* lab, float** b2) {
|
|||||||
for (int j=0; j<W; j++)
|
for (int j=0; j<W; j++)
|
||||||
lab->L[i][j] = lab->L[i][j]*p1 + MAX(tmpI[i][j],0)*p2;
|
lab->L[i][j] = lab->L[i][j]*p1 + MAX(tmpI[i][j],0)*p2;
|
||||||
|
|
||||||
} // end parallel
|
} // end parallel
|
||||||
|
|
||||||
for (int i=0; i<H; i++)
|
for (int i=0; i<H; i++)
|
||||||
delete [] tmpI[i];
|
delete [] tmpI[i];
|
||||||
@@ -140,8 +146,7 @@ void ImProcFunctions::sharpening (LabImage* lab, float** b2) {
|
|||||||
|
|
||||||
int W = lab->W, H = lab->H;
|
int W = lab->W, H = lab->H;
|
||||||
float** b3;
|
float** b3;
|
||||||
if (params->sharpening.edgesonly)
|
if (params->sharpening.edgesonly) {
|
||||||
{
|
|
||||||
b3 = new float*[H];
|
b3 = new float*[H];
|
||||||
for (int i=0; i<H; i++)
|
for (int i=0; i<H; i++)
|
||||||
b3[i] = new float[W];
|
b3[i] = new float[W];
|
||||||
@@ -181,6 +186,7 @@ void ImProcFunctions::sharpening (LabImage* lab, float** b2) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
sharpenHaloCtrl (lab, b2, base, W, H);
|
sharpenHaloCtrl (lab, b2, base, W, H);
|
||||||
|
|
||||||
} // end parallel
|
} // end parallel
|
||||||
|
|
||||||
if (params->sharpening.edgesonly) {
|
if (params->sharpening.edgesonly) {
|
||||||
@@ -197,7 +203,7 @@ void ImProcFunctions::sharpenHaloCtrl (LabImage* lab, float** blurmap, float** b
|
|||||||
float** nL = base;
|
float** nL = base;
|
||||||
#pragma omp parallel for if (multiThread)
|
#pragma omp parallel for if (multiThread)
|
||||||
for (int i=2; i<H-2; i++) {
|
for (int i=2; i<H-2; i++) {
|
||||||
float max1 = 0, max2 = 0, min1 = 0, min2 = 0, maxn, minn, np1, np2, np3, min, max, labL;
|
float max1=0, max2=0, min1=0, min2=0, maxn, minn, np1, np2, np3, min, max, labL;
|
||||||
for (int j=2; j<W-2; j++) {
|
for (int j=2; j<W-2; j++) {
|
||||||
// compute 3 iterations, only forward
|
// compute 3 iterations, only forward
|
||||||
np1 = 2.f * (nL[i-2][j] + nL[i-2][j+1] + nL[i-2][j+2] + nL[i-1][j] + nL[i-1][j+1] + nL[i-1][j+2] + nL[i] [j] + nL[i] [j+1] + nL[i] [j+2]) / 27.f + nL[i-1][j+1] / 3.f;
|
np1 = 2.f * (nL[i-2][j] + nL[i-2][j+1] + nL[i-2][j+2] + nL[i-1][j] + nL[i-1][j+1] + nL[i-1][j+2] + nL[i] [j] + nL[i] [j+1] + nL[i] [j+2]) / 27.f + nL[i-1][j+1] / 3.f;
|
||||||
@@ -232,14 +238,15 @@ void ImProcFunctions::sharpenHaloCtrl (LabImage* lab, float** blurmap, float** b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To the extent possible under law, Manuel Llorens <manuelllorens@gmail.com>[
|
// To the extent possible under law, Manuel Llorens <manuelllorens@gmail.com>[
|
||||||
// has waived all copyright and related or neighboring rights to this work.
|
// has waived all copyright and related or neighboring rights to this work.
|
||||||
// This work is published from: Spain.
|
// This work is published from: Spain.
|
||||||
|
|
||||||
//thanks to Manuel for this excellent job.. (Jacques Desmis JDC or frej83)
|
// Thanks to Manuel for this excellent job (Jacques Desmis JDC or frej83)
|
||||||
void ImProcFunctions::MLsharpen (LabImage* lab) {
|
void ImProcFunctions::MLsharpen (LabImage* lab) {
|
||||||
// JD: this algorithm maximize clarity of images; it does not play on accutance. It can remove (partialy) the effects of the AA filter)
|
// JD: this algorithm maximize clarity of images; it does not play on accutance. It can remove (partialy) the effects of the AA filter)
|
||||||
// I think we can use this algorithm alone in most cases, or first to clarify image and if you want a very little USM (unsharp mask sharpening) after...
|
// I think we can use this algorithm alone in most cases, or first to clarify image and if you want a very little USM (unsharp mask sharpening) after...
|
||||||
if (params->clarity.enabled==false)
|
if (params->clarity.enabled==false)
|
||||||
return;
|
return;
|
||||||
MyTime t1e,t2e;
|
MyTime t1e,t2e;
|
||||||
@@ -252,145 +259,151 @@ void ImProcFunctions::MLsharpen (LabImage* lab) {
|
|||||||
float f1,f2,f3,f4;
|
float f1,f2,f3,f4;
|
||||||
float templab;
|
float templab;
|
||||||
int iii,kkk;
|
int iii,kkk;
|
||||||
width2=2*width;
|
width2 = 2*width;
|
||||||
float strength;
|
float strength;
|
||||||
strength=params->clarity.clstrength / 100.0f;
|
strength = params->clarity.clstrength / 100.0f;
|
||||||
if(strength < 0.00001f) return;
|
if (strength < 0.00001f)
|
||||||
|
return;
|
||||||
|
|
||||||
if (settings->verbose) printf ("Clarity strength %f\n", strength);
|
if (settings->verbose)
|
||||||
|
printf ("Clarity strength %f\n", strength);
|
||||||
|
|
||||||
L = new float[width*height];
|
L = new float[width*height];
|
||||||
|
|
||||||
chmax[0]=8.0f;
|
chmax[0] = 8.0f;
|
||||||
chmax[1]=3.0f;
|
chmax[1] = 3.0f;
|
||||||
chmax[2]=3.0f;
|
chmax[2] = 3.0f;
|
||||||
|
|
||||||
int channels;
|
int channels;
|
||||||
if(params->clarity.clthreechannels) channels=0; else channels=2;
|
if (params->clarity.clthreechannels) channels=0; else channels=2;
|
||||||
if (settings->verbose) printf ("Clarity channels %d\n", channels);
|
if (settings->verbose)
|
||||||
|
printf ("Clarity channels %d\n", channels);
|
||||||
|
|
||||||
int passes=params->clarity.clpasses;
|
int passes=params->clarity.clpasses;
|
||||||
if (settings->verbose) printf ("Clarity passes %d\n", passes);
|
if (settings->verbose)
|
||||||
|
printf ("Clarity passes %d\n", passes);
|
||||||
|
|
||||||
for(p=0;p<passes;p++)
|
for (p=0; p<passes; p++)
|
||||||
for(c=0;c<=channels;c++) {// c=0 Luminance only
|
for (c=0; c<=channels; c++) {// c=0 Luminance only
|
||||||
|
|
||||||
#pragma omp parallel for private(offset) shared(L)
|
#pragma omp parallel for private(offset) shared(L)
|
||||||
for(offset=0;offset<width*height;offset++)
|
for (offset=0; offset<width*height; offset++) {
|
||||||
{int ii=offset/width;
|
int ii = offset/width;
|
||||||
int kk=offset-ii*width;
|
int kk = offset-ii*width;
|
||||||
if(c==0) L[offset]=lab->L[ii][kk]/327.68f; // adjust to RT and to 0..100
|
if (c==0) L[offset] = lab->L[ii][kk]/327.68f; // adjust to RT and to 0..100
|
||||||
else if (c==1) L[offset]=lab->a[ii][kk]/327.68f;
|
else if (c==1) L[offset] = lab->a[ii][kk]/327.68f;
|
||||||
else if (c==2) L[offset]=lab->b[ii][kk]/327.68f;
|
else if (c==2) L[offset] = lab->b[ii][kk]/327.68f;
|
||||||
}
|
}
|
||||||
#pragma omp parallel for private(j,i,iii,kkk, templab,offset,wH,wV,wD1,wD2,s,lumH,lumV,lumD1,lumD2,v,contrast,f1,f2,f3,f4,difT,difB,difL,difR,difLT,difLB,difRT,difRB) shared(lab,L,strength)
|
#pragma omp parallel for private(j,i,iii,kkk, templab,offset,wH,wV,wD1,wD2,s,lumH,lumV,lumD1,lumD2,v,contrast,f1,f2,f3,f4,difT,difB,difL,difR,difLT,difLB,difRT,difRB) shared(lab,L,strength)
|
||||||
for(j=2;j<height-2;j++)
|
for(j=2; j<height-2; j++)
|
||||||
for(i=2,offset=j*width+i;i<width-2;i++,offset++){
|
for(i=2,offset=j*width+i; i<width-2; i++,offset++) {
|
||||||
// weight functions
|
// weight functions
|
||||||
wH=fabs(L[offset+1]-L[offset-1]);
|
wH = fabs(L[offset+1]-L[offset-1]);
|
||||||
wV=fabs(L[offset+width]-L[offset-width]);
|
wV = fabs(L[offset+width]-L[offset-width]);
|
||||||
|
|
||||||
s=1.0+fabs(wH-wV)/2.0;
|
s = 1.0+fabs(wH-wV)/2.0;
|
||||||
wD1=fabs(L[offset+width+1]-L[offset-width-1])/s;
|
wD1 = fabs(L[offset+width+1]-L[offset-width-1])/s;
|
||||||
wD2=fabs(L[offset+width-1]-L[offset-width+1])/s;
|
wD2 = fabs(L[offset+width-1]-L[offset-width+1])/s;
|
||||||
s=wD1;
|
s = wD1;
|
||||||
wD1/=wD2;
|
wD1 /= wD2;
|
||||||
wD2/=wD1;
|
wD2 /= wD1;
|
||||||
|
|
||||||
// initial values
|
// initial values
|
||||||
int ii=offset/width;
|
int ii = offset/width;
|
||||||
int kk=offset-ii*width;
|
int kk = offset-ii*width;
|
||||||
if(c==0)lumH=lumV=lumD1=lumD2=v=lab->L[ii][kk]/327.68f;
|
if (c==0) lumH=lumV=lumD1=lumD2=v=lab->L[ii][kk]/327.68f;
|
||||||
else if (c==1) lumH=lumV=lumD1=lumD2=v=lab->a[ii][kk]/327.68f;
|
else if (c==1) lumH=lumV=lumD1=lumD2=v=lab->a[ii][kk]/327.68f;
|
||||||
else if (c==2) lumH=lumV=lumD1=lumD2=v=lab->b[ii][kk]/327.68f;
|
else if (c==2) lumH=lumV=lumD1=lumD2=v=lab->b[ii][kk]/327.68f;
|
||||||
|
|
||||||
|
|
||||||
// contrast detection
|
// contrast detection
|
||||||
contrast=sqrt(fabs(L[offset+1]-L[offset-1])*fabs(L[offset+1]-L[offset-1])+fabs(L[offset+width]-L[offset-width])*fabs(L[offset+width]-L[offset-width]))/chmax[c];
|
contrast = sqrt(fabs(L[offset+1]-L[offset-1])*fabs(L[offset+1]-L[offset-1])+fabs(L[offset+width]-L[offset-width])*fabs(L[offset+width]-L[offset-width]))/chmax[c];
|
||||||
if(contrast>1.0) contrast=1.0;
|
if (contrast>1.0)
|
||||||
|
contrast=1.0;
|
||||||
|
|
||||||
// new possible values
|
// new possible values
|
||||||
if((L[offset]<L[offset-1])&&(L[offset]>L[offset+1])||(L[offset]>L[offset-1])&&(L[offset]<L[offset+1])){
|
if ((L[offset]<L[offset-1])&&(L[offset]>L[offset+1])||(L[offset]>L[offset-1])&&(L[offset]<L[offset+1])){
|
||||||
f1=fabs(L[offset-2]-L[offset-1]);
|
f1 = fabs(L[offset-2]-L[offset-1]);
|
||||||
f2=fabs(L[offset-1]-L[offset]);
|
f2 = fabs(L[offset-1]-L[offset]);
|
||||||
f3=fabs(L[offset-1]-L[offset-width])*fabs(L[offset-1]-L[offset+width]);
|
f3 = fabs(L[offset-1]-L[offset-width])*fabs(L[offset-1]-L[offset+width]);
|
||||||
f4=sqrt(fabs(L[offset-1]-L[offset-width2])*fabs(L[offset-1]-L[offset+width2]));
|
f4 = sqrt(fabs(L[offset-1]-L[offset-width2])*fabs(L[offset-1]-L[offset+width2]));
|
||||||
difL=f1*f2*f2*f3*f3*f4;
|
difL = f1*f2*f2*f3*f3*f4;
|
||||||
f1=fabs(L[offset+2]-L[offset+1]);
|
f1 = fabs(L[offset+2]-L[offset+1]);
|
||||||
f2=fabs(L[offset+1]-L[offset]);
|
f2 = fabs(L[offset+1]-L[offset]);
|
||||||
f3=fabs(L[offset+1]-L[offset-width])*fabs(L[offset+1]-L[offset+width]);
|
f3 = fabs(L[offset+1]-L[offset-width])*fabs(L[offset+1]-L[offset+width]);
|
||||||
f4=sqrt(fabs(L[offset+1]-L[offset-width2])*fabs(L[offset+1]-L[offset+width2]));
|
f4 = sqrt(fabs(L[offset+1]-L[offset-width2])*fabs(L[offset+1]-L[offset+width2]));
|
||||||
difR=f1*f2*f2*f3*f3*f4;
|
difR = f1*f2*f2*f3*f3*f4;
|
||||||
if((difR!=0)&&(difL!=0)){
|
if ((difR!=0)&&(difL!=0)){
|
||||||
lumH=(L[offset-1]*difR+L[offset+1]*difL)/(difL+difR);
|
lumH = (L[offset-1]*difR+L[offset+1]*difL)/(difL+difR);
|
||||||
lumH=v*(1-contrast)+lumH*contrast;
|
lumH = v*(1-contrast)+lumH*contrast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((L[offset]<L[offset-width])&&(L[offset]>L[offset+width])||(L[offset]>L[offset-width])&&(L[offset]<L[offset+width])){
|
if ((L[offset]<L[offset-width])&&(L[offset]>L[offset+width])||(L[offset]>L[offset-width])&&(L[offset]<L[offset+width])) {
|
||||||
f1=fabs(L[offset-width2]-L[offset-width]);
|
f1 = fabs(L[offset-width2]-L[offset-width]);
|
||||||
f2=fabs(L[offset-width]-L[offset]);
|
f2 = fabs(L[offset-width]-L[offset]);
|
||||||
f3=fabs(L[offset-width]-L[offset-1])*fabs(L[offset-width]-L[offset+1]);
|
f3 = fabs(L[offset-width]-L[offset-1])*fabs(L[offset-width]-L[offset+1]);
|
||||||
f4=sqrt(fabs(L[offset-width]-L[offset-2])*fabs(L[offset-width]-L[offset+2]));
|
f4 = sqrt(fabs(L[offset-width]-L[offset-2])*fabs(L[offset-width]-L[offset+2]));
|
||||||
difT=f1*f2*f2*f3*f3*f4;
|
difT = f1*f2*f2*f3*f3*f4;
|
||||||
f1=fabs(L[offset+width2]-L[offset+width]);
|
f1 = fabs(L[offset+width2]-L[offset+width]);
|
||||||
f2=fabs(L[offset+width]-L[offset]);
|
f2 = fabs(L[offset+width]-L[offset]);
|
||||||
f3=fabs(L[offset+width]-L[offset-1])*fabs(L[offset+width]-L[offset+1]);
|
f3 = fabs(L[offset+width]-L[offset-1])*fabs(L[offset+width]-L[offset+1]);
|
||||||
f4=sqrt(fabs(L[offset+width]-L[offset-2])*fabs(L[offset+width]-L[offset+2]));
|
f4 = sqrt(fabs(L[offset+width]-L[offset-2])*fabs(L[offset+width]-L[offset+2]));
|
||||||
difB=f1*f2*f2*f3*f3*f4;
|
difB = f1*f2*f2*f3*f3*f4;
|
||||||
if((difB!=0)&&(difT!=0)){
|
if ((difB!=0)&&(difT!=0)){
|
||||||
lumV=(L[offset-width]*difB+L[offset+width]*difT)/(difT+difB);
|
lumV = (L[offset-width]*difB+L[offset+width]*difT)/(difT+difB);
|
||||||
lumV=v*(1-contrast)+lumV*contrast;
|
lumV = v*(1-contrast)+lumV*contrast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((L[offset]<L[offset-1-width])&&(L[offset]>L[offset+1+width])||(L[offset]>L[offset-1-width])&&(L[offset]<L[offset+1+width])){
|
if ((L[offset]<L[offset-1-width])&&(L[offset]>L[offset+1+width])||(L[offset]>L[offset-1-width])&&(L[offset]<L[offset+1+width])) {
|
||||||
f1=fabs(L[offset-2-width2]-L[offset-1-width]);
|
f1 = fabs(L[offset-2-width2]-L[offset-1-width]);
|
||||||
f2=fabs(L[offset-1-width]-L[offset]);
|
f2 = fabs(L[offset-1-width]-L[offset]);
|
||||||
f3=fabs(L[offset-1-width]-L[offset-width+1])*fabs(L[offset-1-width]-L[offset+width-1]);
|
f3 = fabs(L[offset-1-width]-L[offset-width+1])*fabs(L[offset-1-width]-L[offset+width-1]);
|
||||||
f4=sqrt(fabs(L[offset-1-width]-L[offset-width2+2])*fabs(L[offset-1-width]-L[offset+width2-2]));
|
f4 = sqrt(fabs(L[offset-1-width]-L[offset-width2+2])*fabs(L[offset-1-width]-L[offset+width2-2]));
|
||||||
difLT=f1*f2*f2*f3*f3*f4;
|
difLT = f1*f2*f2*f3*f3*f4;
|
||||||
f1=fabs(L[offset+2+width2]-L[offset+1+width]);
|
f1 = fabs(L[offset+2+width2]-L[offset+1+width]);
|
||||||
f2=fabs(L[offset+1+width]-L[offset]);
|
f2 = fabs(L[offset+1+width]-L[offset]);
|
||||||
f3=fabs(L[offset+1+width]-L[offset-width+1])*fabs(L[offset+1+width]-L[offset+width-1]);
|
f3 = fabs(L[offset+1+width]-L[offset-width+1])*fabs(L[offset+1+width]-L[offset+width-1]);
|
||||||
f4=sqrt(fabs(L[offset+1+width]-L[offset-width2+2])*fabs(L[offset+1+width]-L[offset+width2-2]));
|
f4 = sqrt(fabs(L[offset+1+width]-L[offset-width2+2])*fabs(L[offset+1+width]-L[offset+width2-2]));
|
||||||
difRB=f1*f2*f2*f3*f3*f4;
|
difRB = f1*f2*f2*f3*f3*f4;
|
||||||
if((difLT!=0)&&(difRB!=0)){
|
if ((difLT!=0)&&(difRB!=0)) {
|
||||||
lumD1=(L[offset-1-width]*difRB+L[offset+1+width]*difLT)/(difLT+difRB);
|
lumD1 = (L[offset-1-width]*difRB+L[offset+1+width]*difLT)/(difLT+difRB);
|
||||||
lumD1=v*(1-contrast)+lumD1*contrast;
|
lumD1 = v*(1-contrast)+lumD1*contrast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((L[offset]<L[offset+1-width])&&(L[offset]>L[offset-1+width])||(L[offset]>L[offset+1-width])&&(L[offset]<L[offset-1+width])){
|
if ((L[offset]<L[offset+1-width])&&(L[offset]>L[offset-1+width])||(L[offset]>L[offset+1-width])&&(L[offset]<L[offset-1+width])) {
|
||||||
f1=fabs(L[offset-2+width2]-L[offset-1+width]);
|
f1 = fabs(L[offset-2+width2]-L[offset-1+width]);
|
||||||
f2=fabs(L[offset-1+width]-L[offset]);
|
f2 = fabs(L[offset-1+width]-L[offset]);
|
||||||
f3=fabs(L[offset-1+width]-L[offset-width-1])*fabs(L[offset-1+width]-L[offset+width+1]);
|
f3 = fabs(L[offset-1+width]-L[offset-width-1])*fabs(L[offset-1+width]-L[offset+width+1]);
|
||||||
f4=sqrt(fabs(L[offset-1+width]-L[offset-width2-2])*fabs(L[offset-1+width]-L[offset+width2+2]));
|
f4 = sqrt(fabs(L[offset-1+width]-L[offset-width2-2])*fabs(L[offset-1+width]-L[offset+width2+2]));
|
||||||
difLB=f1*f2*f2*f3*f3*f4;
|
difLB = f1*f2*f2*f3*f3*f4;
|
||||||
f1=fabs(L[offset+2-width2]-L[offset+1-width]);
|
f1 = fabs(L[offset+2-width2]-L[offset+1-width]);
|
||||||
f2=fabs(L[offset+1-width]-L[offset])*fabs(L[offset+1-width]-L[offset]);
|
f2 = fabs(L[offset+1-width]-L[offset])*fabs(L[offset+1-width]-L[offset]);
|
||||||
f3=fabs(L[offset+1-width]-L[offset+width+1])*fabs(L[offset+1-width]-L[offset-width-1]);
|
f3 = fabs(L[offset+1-width]-L[offset+width+1])*fabs(L[offset+1-width]-L[offset-width-1]);
|
||||||
f4=sqrt(fabs(L[offset+1-width]-L[offset+width2+2])*fabs(L[offset+1-width]-L[offset-width2-2]));
|
f4 = sqrt(fabs(L[offset+1-width]-L[offset+width2+2])*fabs(L[offset+1-width]-L[offset-width2-2]));
|
||||||
difRT=f1*f2*f2*f3*f3*f4;
|
difRT = f1*f2*f2*f3*f3*f4;
|
||||||
if((difLB!=0)&&(difRT!=0)){
|
if ((difLB!=0)&&(difRT!=0)) {
|
||||||
lumD2=(L[offset+1-width]*difLB+L[offset-1+width]*difRT)/(difLB+difRT);
|
lumD2 = (L[offset+1-width]*difLB+L[offset-1+width]*difRT)/(difLB+difRT);
|
||||||
lumD2=v*(1-contrast)+lumD2*contrast;
|
lumD2 = v*(1-contrast)+lumD2*contrast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s=strength;
|
s = strength;
|
||||||
|
|
||||||
// avoid sharpening diagonals too much
|
// avoid sharpening diagonals too much
|
||||||
if(((fabs(wH/wV)<0.45f)&&(fabs(wH/wV)>0.05f))||((fabs(wV/wH)<0.45f)&&(fabs(wV/wH)>0.05f))) s=strength/3.0f;
|
if (((fabs(wH/wV)<0.45f)&&(fabs(wH/wV)>0.05f))||((fabs(wV/wH)<0.45f)&&(fabs(wV/wH)>0.05f)))
|
||||||
|
s = strength/3.0f;
|
||||||
|
|
||||||
// final mix
|
// final mix
|
||||||
if((wH!=0.0f)&&(wV!=0.0f)&&(wD1!=0.0f)&&(wD2!=0.0f)) {
|
if ((wH!=0.0f)&&(wV!=0.0f)&&(wD1!=0.0f)&&(wD2!=0.0f)) {
|
||||||
iii=offset/width;
|
iii = offset/width;
|
||||||
kkk=offset-iii*width;
|
kkk = offset-iii*width;
|
||||||
templab=v*(1-s)+(lumH*wH+lumV*wV+lumD1*wD1+lumD2*wD2)/(wH+wV+wD1+wD2)*s;
|
templab = v*(1-s)+(lumH*wH+lumV*wV+lumD1*wD1+lumD2*wD2)/(wH+wV+wD1+wD2)*s;
|
||||||
if(c==0) lab->L[iii][kkk]=fabs(327.68f*templab);// fabs because lab->L always >0
|
if (c==0) lab->L[iii][kkk] = fabs(327.68f*templab); // fabs because lab->L always >0
|
||||||
else if (c==1){lab->a[iii][kkk]=327.68f*templab;}
|
else if (c==1) lab->a[iii][kkk] = 327.68f*templab ;
|
||||||
else if (c==2)lab->b[iii][kkk]=327.68f*templab;
|
else if (c==2) lab->b[iii][kkk] = 327.68f*templab ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -399,196 +412,207 @@ void ImProcFunctions::MLsharpen (LabImage* lab) {
|
|||||||
delete [] L;
|
delete [] L;
|
||||||
|
|
||||||
t2e.set();
|
t2e.set();
|
||||||
if( settings->verbose )
|
if (settings->verbose)
|
||||||
printf("Clarity gradient %d usec\n", t2e.etime(t1e));
|
printf("Clarity gradient %d usec\n", t2e.etime(t1e));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
// To the extent possible under law, Manuel Llorens <manuelllorens@gmail.com>
|
||||||
|
// has waived all copyright and related or neighboring rights to this work.
|
||||||
// To the extent possible under law, Manuel Llorens <manuelllorens@gmail.com>
|
// This code is licensed under CC0 v1.0, see license information at
|
||||||
// has waived all copyright and related or neighboring rights to this work.
|
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
// This code is licensed under CC0 v1.0, see license information at
|
// addition from JD : pyramid + ponderated contrast with matrix 5x5
|
||||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
void ImProcFunctions::MLmicrocontrast(LabImage* lab) {
|
||||||
// addition from JD : pyramid + ponderated contrast with matrix 5x5
|
|
||||||
void ImProcFunctions::MLmicrocontrast(LabImage* lab){
|
|
||||||
if (params->clarity.enabledtwo==false)
|
if (params->clarity.enabledtwo==false)
|
||||||
return;
|
return;
|
||||||
MyTime t1e,t2e;
|
MyTime t1e,t2e;
|
||||||
t1e.set();
|
t1e.set();
|
||||||
int k;
|
int k;
|
||||||
if(params->clarity.MLmicromatrix == false) k=2; else k=1;
|
if (params->clarity.MLmicromatrix == false) k=2; else k=1;
|
||||||
// k=2 matrix 5x5 k=1 matrix 3x3
|
// k=2 matrix 5x5 k=1 matrix 3x3
|
||||||
int offset,offset2,c,i,j,col,row,n;
|
int offset,offset2,c,i,j,col,row,n;
|
||||||
float temp,temp2,temp3,temp4,tempL;
|
float temp,temp2,temp3,temp4,tempL;
|
||||||
float *LM,v,s,contrast,w;
|
float *LM,v,s,contrast,w;
|
||||||
int signs[25];
|
int signs[25];
|
||||||
int width = lab->W, height = lab->H;
|
int width = lab->W, height = lab->H;
|
||||||
float uniform=params->clarity.uniformity;//between 0 to 100
|
float uniform = params->clarity.uniformity;//between 0 to 100
|
||||||
int unif;
|
int unif;
|
||||||
unif=(int)(uniform/10.0f); //put unif between 0 to 10
|
unif = (int)(uniform/10.0f); //put unif between 0 to 10
|
||||||
float strength=params->clarity.mlstrength/1500.0f; //strength 2000.0 quasi no artefacts ==> 1500 = maximum, after artefacts
|
float strength = params->clarity.mlstrength/1500.0f; //strength 2000.0 quasi no artefacts ==> 1500 = maximum, after artefacts
|
||||||
if(strength < 0.000001f) return;
|
if (strength < 0.000001f)
|
||||||
if(k==1) strength*=2.7f;//25/9 if 3x3
|
return;
|
||||||
if (settings->verbose) printf ("Microcontrast strength %f\n", strength);
|
if (k==1)
|
||||||
if (settings->verbose) printf ("Microcontrast uniformity %i\n",unif);
|
strength *= 2.7f; //25/9 if 3x3
|
||||||
|
if (settings->verbose)
|
||||||
|
printf ("Microcontrast strength %f\n", strength);
|
||||||
|
if (settings->verbose)
|
||||||
|
printf ("Microcontrast uniformity %i\n",unif);
|
||||||
//modulation uniformity in function of luminance
|
//modulation uniformity in function of luminance
|
||||||
float L98[11]={0.001f,0.0015f,0.002f,0.004f,0.006f,0.008f,0.01f,0.03f,0.05f,0.1f,0.1f};
|
float L98[11] = {0.001f,0.0015f,0.002f,0.004f,0.006f,0.008f,0.01f,0.03f,0.05f,0.1f,0.1f};
|
||||||
float L95[11]={0.0012f,0.002f,0.005f,0.01f,0.02f,0.05f,0.1f,0.12f,0.15f,0.2f,0.25f};
|
float L95[11] = {0.0012f,0.002f,0.005f,0.01f,0.02f,0.05f,0.1f,0.12f,0.15f,0.2f,0.25f};
|
||||||
float L92[11]={0.01f,0.015f,0.02f,0.06f,0.10f,0.13f,0.17f,0.25f,0.3f,0.32f,0.35f};
|
float L92[11] = {0.01f,0.015f,0.02f,0.06f,0.10f,0.13f,0.17f,0.25f,0.3f,0.32f,0.35f};
|
||||||
float L90[11]={0.015f,0.02f,0.04f,0.08f,0.12f,0.15f,0.2f,0.3f,0.4f,0.5f,0.6f};
|
float L90[11] = {0.015f,0.02f,0.04f,0.08f,0.12f,0.15f,0.2f,0.3f,0.4f,0.5f,0.6f};
|
||||||
float L87[11]={0.025f,0.03f,0.05f,0.1f,0.15f,0.25f,0.3f,0.4f,0.5f,0.63f,0.75f};
|
float L87[11] = {0.025f,0.03f,0.05f,0.1f,0.15f,0.25f,0.3f,0.4f,0.5f,0.63f,0.75f};
|
||||||
float L83[11]={0.055f,0.08f,0.1f,0.15f,0.2f,0.3f,0.4f,0.5f,0.6f,0.75f,0.85f};
|
float L83[11] = {0.055f,0.08f,0.1f,0.15f,0.2f,0.3f,0.4f,0.5f,0.6f,0.75f,0.85f};
|
||||||
float L80[11]={0.15f,0.2f,0.25f,0.3f,0.35f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f};
|
float L80[11] = {0.15f,0.2f,0.25f,0.3f,0.35f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f};
|
||||||
float L75[11]={0.22f,0.25f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.85f,0.9f,0.95f};
|
float L75[11] = {0.22f,0.25f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.85f,0.9f,0.95f};
|
||||||
float L70[11]={0.35f,0.4f,0.5f,0.6f,0.7f,0.8f,0.97f,1.0f,1.0f,1.0f,1.0f};
|
float L70[11] = {0.35f,0.4f,0.5f,0.6f,0.7f,0.8f,0.97f,1.0f,1.0f,1.0f,1.0f};
|
||||||
float L63[11]={0.55f,0.6f,0.7f,0.8f,0.85f,0.9f,1.0f,1.0f,1.0f,1.0f,1.0f};
|
float L63[11] = {0.55f,0.6f,0.7f,0.8f,0.85f,0.9f,1.0f,1.0f,1.0f,1.0f,1.0f};
|
||||||
float L58[11]={0.75f,0.77f,0.8f,0.9f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f};
|
float L58[11] = {0.75f,0.77f,0.8f,0.9f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f};
|
||||||
//default 5
|
//default 5
|
||||||
//modulation contrast
|
//modulation contrast
|
||||||
float Cont0[11]={0.05f,0.1f,0.2f,0.25f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f};
|
float Cont0[11] = {0.05f,0.1f,0.2f,0.25f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f};
|
||||||
float Cont1[11]={0.1f,0.2f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f,0.95f,1.0f};
|
float Cont1[11] = {0.1f,0.2f,0.3f,0.4f,0.5f,0.6f,0.7f,0.8f,0.9f,0.95f,1.0f};
|
||||||
float Cont2[11]={0.2f,0.40f,0.6f,0.7f,0.8f,0.85f,0.90f,0.95f,1.0f,1.05f,1.10f};
|
float Cont2[11] = {0.2f,0.40f,0.6f,0.7f,0.8f,0.85f,0.90f,0.95f,1.0f,1.05f,1.10f};
|
||||||
float Cont3[11]={0.5f,0.6f,0.7f,0.8f,0.85f,0.9f,1.0f,1.0f,1.05f,1.10f,1.20f};
|
float Cont3[11] = {0.5f,0.6f,0.7f,0.8f,0.85f,0.9f,1.0f,1.0f,1.05f,1.10f,1.20f};
|
||||||
float Cont4[11]={0.8f,0.85f,0.9f,0.95f,1.0f,1.05f,1.10f,1.150f,1.2f,1.25f,1.40f};
|
float Cont4[11] = {0.8f,0.85f,0.9f,0.95f,1.0f,1.05f,1.10f,1.150f,1.2f,1.25f,1.40f};
|
||||||
float Cont5[11]={1.0f,1.1f,1.2f,1.25f,1.3f,1.4f,1.45f,1.50f,1.6f,1.65f,1.80f};
|
float Cont5[11] = {1.0f,1.1f,1.2f,1.25f,1.3f,1.4f,1.45f,1.50f,1.6f,1.65f,1.80f};
|
||||||
|
|
||||||
float chmax=8.0f;
|
float chmax=8.0f;
|
||||||
LM = new float[width*height];//allocation for Luminance
|
LM = new float[width*height];//allocation for Luminance
|
||||||
c=0;
|
c=0;
|
||||||
#pragma omp parallel for private(offset, i,j) shared(LM)
|
#pragma omp parallel for private(offset, i,j) shared(LM)
|
||||||
for(j=0;j<height;j++)
|
for(j=0; j<height; j++)
|
||||||
for(i=0,offset=j*width+i;i<width;i++,offset++){
|
for(i=0,offset=j*width+i; i<width; i++,offset++) {
|
||||||
LM[offset]=lab->L[j][i]/327.68f;// adjust to 0.100 and to RT variables
|
LM[offset] = lab->L[j][i]/327.68f;// adjust to 0.100 and to RT variables
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp parallel for private(j,i,offset,s,signs,v,n,row,col,offset2,contrast,temp,w,temp2,temp3,tempL,temp4) shared(lab,LM,strength,chmax,unif,k,L98,L95,L92,L90,L87,L83,L80,L75,L70,L63,L58,Cont0,Cont1,Cont2,Cont3,Cont4,Cont5)
|
#pragma omp parallel for private(j,i,offset,s,signs,v,n,row,col,offset2,contrast,temp,w,temp2,temp3,tempL,temp4) shared(lab,LM,strength,chmax,unif,k,L98,L95,L92,L90,L87,L83,L80,L75,L70,L63,L58,Cont0,Cont1,Cont2,Cont3,Cont4,Cont5)
|
||||||
for(j=k;j<height-k;j++)
|
for(j=k; j<height-k; j++)
|
||||||
for(i=k,offset=j*width+i;i<width-k;i++,offset++){
|
for(i=k,offset=j*width+i; i<width-k; i++,offset++) {
|
||||||
s=strength;
|
s=strength;
|
||||||
v=LM[offset];
|
v=LM[offset];
|
||||||
n=0;
|
n=0;
|
||||||
for(row=j-k;row<=j+k;row++)
|
for(row=j-k; row<=j+k; row++)
|
||||||
for(col=i-k,offset2=row*width+col;col<=i+k;col++,offset2++){
|
for(col=i-k,offset2=row*width+col; col<=i+k; col++,offset2++) {
|
||||||
signs[n]=0;
|
signs[n]=0;
|
||||||
if(v<LM[offset2]) signs[n]=-1;
|
if (v<LM[offset2]) signs[n]=-1;
|
||||||
if(v>LM[offset2]) signs[n]=1;
|
if (v>LM[offset2]) signs[n]=1;
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
if(k==1) contrast=sqrt(fabs(LM[offset+1]-LM[offset-1])*fabs(LM[offset+1]-LM[offset-1])+fabs(LM[offset+width]-LM[offset-width])*fabs(LM[offset+width]-LM[offset-width]))/chmax; //for 3x3
|
if (k==1) contrast = sqrt(fabs(LM[offset+1]-LM[offset-1])*fabs(LM[offset+1]-LM[offset-1])+fabs(LM[offset+width]-LM[offset-width])*fabs(LM[offset+width]-LM[offset-width]))/chmax; //for 3x3
|
||||||
else if(k==2) contrast=sqrt(fabs(LM[offset+1]-LM[offset-1])*fabs(LM[offset+1]-LM[offset-1])+fabs(LM[offset+width]-LM[offset-width])*fabs(LM[offset+width]-LM[offset-width])\
|
else if (k==2) contrast = sqrt(fabs(LM[offset+1]-LM[offset-1])*fabs(LM[offset+1]-LM[offset-1])+fabs(LM[offset+width]-LM[offset-width])*fabs(LM[offset+width]-LM[offset-width])\
|
||||||
+fabs(LM[offset+2]-LM[offset-2])*fabs(LM[offset+2]-LM[offset-2])+fabs(LM[offset+2*width]-LM[offset-2*width])*fabs(LM[offset+2*width]-LM[offset-2*width]))/(2*chmax); //for 5x5
|
+fabs(LM[offset+2]-LM[offset-2])*fabs(LM[offset+2]-LM[offset-2])+fabs(LM[offset+2*width]-LM[offset-2*width])*fabs(LM[offset+2*width]-LM[offset-2*width]))/(2*chmax); //for 5x5
|
||||||
|
|
||||||
if(contrast>1.0f) contrast=1.0f;
|
if (contrast>1.0f)
|
||||||
|
contrast=1.0f;
|
||||||
//matrix 5x5
|
//matrix 5x5
|
||||||
temp=lab->L[j][i]/327.68f; //begin 3x3
|
temp=lab->L[j][i]/327.68f; //begin 3x3
|
||||||
temp +=(v-LM[offset-width-1])*sqrtf(2.0f)*s;
|
temp += CLIREF(v-LM[offset-width-1])*sqrtf(2.0f)*s;
|
||||||
temp +=(v-LM[offset-width])*s;
|
temp += CLIREF(v-LM[offset-width])*s;
|
||||||
temp +=(v-LM[offset-width+1])*sqrtf(2.0f)*s;
|
temp += CLIREF(v-LM[offset-width+1])*sqrtf(2.0f)*s;
|
||||||
temp +=(v-LM[offset-1])*s;
|
temp += CLIREF(v-LM[offset-1])*s;
|
||||||
temp +=(v-LM[offset+1])*s;
|
temp += CLIREF(v-LM[offset+1])*s;
|
||||||
temp +=(v-LM[offset+width-1])*sqrtf(2.0f)*s;
|
temp += CLIREF(v-LM[offset+width-1])*sqrtf(2.0f)*s;
|
||||||
temp +=(v-LM[offset+width])*s;
|
temp += CLIREF(v-LM[offset+width])*s;
|
||||||
temp +=(v-LM[offset+width+1])*sqrtf(2.0f)*s;//end 3x3
|
temp += CLIREF(v-LM[offset+width+1])*sqrtf(2.0f)*s;//end 3x3
|
||||||
|
|
||||||
// add JD continue 5x5
|
// add JD continue 5x5
|
||||||
if(k==2) {
|
if (k==2) {
|
||||||
temp +=2.0f*(v-LM[offset+2*width])*s;
|
temp += 2.0f*CLIREF(v-LM[offset+2*width])*s;
|
||||||
temp +=2.0f*(v-LM[offset-2*width])*s;
|
temp += 2.0f*CLIREF(v-LM[offset-2*width])*s;
|
||||||
temp +=2.0f*(v-LM[offset-2])*s;
|
temp += 2.0f*CLIREF(v-LM[offset-2 ])*s;
|
||||||
temp +=2.0f*(v-LM[offset+2])*s;
|
temp += 2.0f*CLIREF(v-LM[offset+2 ])*s;
|
||||||
|
|
||||||
temp +=2.0f*(v-LM[offset+2*width -1])*s*sqrtf(1.25f);// 1.25 = 1*1 + 0.5*0.5
|
temp += 2.0f*CLIREF(v-LM[offset+2*width-1])*s*sqrtf(1.25f);// 1.25 = 1*1 + 0.5*0.5
|
||||||
temp +=2.0f*(v-LM[offset+2*width -2])*s*sqrtf(2.0f);
|
temp += 2.0f*CLIREF(v-LM[offset+2*width-2])*s*sqrtf(2.00f);
|
||||||
temp +=2.0f*(v-LM[offset+2*width+1])*s*sqrtf(1.25f);;
|
temp += 2.0f*CLIREF(v-LM[offset+2*width+1])*s*sqrtf(1.25f);
|
||||||
temp +=2.0f*(v-LM[offset+2*width+2])*s*sqrtf(2.0f);
|
temp += 2.0f*CLIREF(v-LM[offset+2*width+2])*s*sqrtf(2.00f);
|
||||||
temp +=2.0f*(v-LM[offset+ width+2])*s*sqrtf(1.25f);;
|
temp += 2.0f*CLIREF(v-LM[offset+ width+2])*s*sqrtf(1.25f);
|
||||||
temp +=2.0f*(v-LM[offset+width-2])*s*sqrtf(1.25f);;
|
temp += 2.0f*CLIREF(v-LM[offset+ width-2])*s*sqrtf(1.25f);
|
||||||
temp +=2.0f*(v-LM[offset-2*width -1])*s*sqrtf(1.25f);
|
temp += 2.0f*CLIREF(v-LM[offset-2*width-1])*s*sqrtf(1.25f);
|
||||||
temp +=2.0f*(v-LM[offset-2*width -2])*s*sqrtf(2.0f);
|
temp += 2.0f*CLIREF(v-LM[offset-2*width-2])*s*sqrtf(2.00f);
|
||||||
temp +=2.0f*(v-LM[offset-2*width+1])*s*sqrtf(1.25f);;
|
temp += 2.0f*CLIREF(v-LM[offset-2*width+1])*s*sqrtf(1.25f);
|
||||||
temp +=2.0f*(v-LM[offset-2*width+2])*s*sqrtf(2.0f);
|
temp += 2.0f*CLIREF(v-LM[offset-2*width+2])*s*sqrtf(2.00f);
|
||||||
temp +=2.0f*(v-LM[offset- width+2])*s*sqrtf(1.25f);;
|
temp += 2.0f*CLIREF(v-LM[offset- width+2])*s*sqrtf(1.25f);
|
||||||
temp +=2.0f*(v-LM[offset-width-2])*s*sqrtf(1.25f);;
|
temp += 2.0f*CLIREF(v-LM[offset- width-2])*s*sqrtf(1.25f);
|
||||||
}
|
}
|
||||||
if(temp <0.0f) temp=0.0f;
|
if (temp <0.0f) temp = 0.0f;
|
||||||
v=temp;
|
v=temp;
|
||||||
|
|
||||||
n=0;
|
n=0;
|
||||||
|
|
||||||
for(row=j-k;row<=j+k;row++)
|
for(row=j-k; row<=j+k; row++)
|
||||||
for(col=i-k,offset2=row*width+col;col<=i+k;col++,offset2++){
|
for(col=i-k,offset2=row*width+col; col<=i+k; col++,offset2++){
|
||||||
if(((v<LM[offset2])&&(signs[n]>0))||((v>LM[offset2])&&(signs[n]<0)))
|
if (((v<LM[offset2])&&(signs[n]>0))||((v>LM[offset2])&&(signs[n]<0))) {
|
||||||
{
|
temp = v*0.75f+LM[offset2]*0.25f;// 0.75 0.25
|
||||||
temp =v*0.75f+LM[offset2]*0.25f;// 0.75 0.25
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(LM[offset]>95.0f || LM[offset]<5.0f) contrast*=Cont0[unif]; //+ JD : luminance pyramid to adjust contrast by evaluation of LM[offset]
|
if (LM[offset]>95.0f || LM[offset]<5.0f)
|
||||||
else if(LM[offset]>90.0f || LM[offset]<10.0f) contrast*=Cont1[unif];
|
contrast *= Cont0[unif]; //+ JD : luminance pyramid to adjust contrast by evaluation of LM[offset]
|
||||||
else if(LM[offset]>80.0f || LM[offset]<20.0f) contrast*=Cont2[unif];
|
else if (LM[offset]>90.0f || LM[offset]<10.0f)
|
||||||
else if(LM[offset]>70.0f || LM[offset]<30.0f) contrast*=(2.0f/k)*Cont3[unif];
|
contrast *= Cont1[unif];
|
||||||
else if(LM[offset]>60.0f || LM[offset]<40.0f) contrast*=(2.0f/k)*Cont4[unif];
|
else if (LM[offset]>80.0f || LM[offset]<20.0f)
|
||||||
|
contrast *= Cont2[unif];
|
||||||
|
else if (LM[offset]>70.0f || LM[offset]<30.0f)
|
||||||
|
contrast *= Cont3[unif];
|
||||||
|
else if (LM[offset]>60.0f || LM[offset]<40.0f)
|
||||||
|
contrast *= Cont4[unif];
|
||||||
else
|
else
|
||||||
contrast*=(2.0f/k)*Cont5[unif];
|
contrast *= Cont5[unif];//(2.0f/k)*Cont5[unif];
|
||||||
if(contrast>1.0f) {contrast=1.0f;}
|
|
||||||
tempL=327.68f*(temp*(1.0f-contrast)+LM[offset]*contrast);
|
if (contrast>1.0f)
|
||||||
|
contrast=1.0f;
|
||||||
|
tempL = 327.68f*(temp*(1.0f-contrast)+LM[offset]*contrast);
|
||||||
// JD: modulation of microcontrast in function of original Luminance and modulation of luminance
|
// JD: modulation of microcontrast in function of original Luminance and modulation of luminance
|
||||||
temp2=tempL/(327.68f*LM[offset]);//for highlights
|
temp2 = tempL/(327.68f*LM[offset]);//for highlights
|
||||||
if(temp2>1.0f) {
|
if (temp2>1.0f) {
|
||||||
if(temp2>2.0f) temp2=2.0f;//limit action
|
if (temp2>1.70f) temp2=1.70f;//limit action
|
||||||
if(LM[offset]>98.0f) {lab->L[j][i]=LM[offset]*327.68f;}
|
if (LM[offset]>98.0f) { lab->L[j][i]=LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>95.0f) {temp3=temp2-1.0f;temp=(L95[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>95.0f) { temp3=temp2-1.0f; temp=(L95[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>92.0f) {temp3=temp2-1.0f;temp=(L92[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>92.0f) { temp3=temp2-1.0f; temp=(L92[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>90.0f) {temp3=temp2-1.0f;temp=(L90[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>90.0f) { temp3=temp2-1.0f; temp=(L90[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>87.0f) {temp3=temp2-1.0f;temp=(L87[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>87.0f) { temp3=temp2-1.0f; temp=(L87[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>83.0f) {temp3=temp2-1.0f;temp=(L83[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>83.0f) { temp3=temp2-1.0f; temp=(L83[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>80.0f) {temp3=temp2-1.0f;temp=(L80[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>80.0f) { temp3=temp2-1.0f; temp=(L80[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>75.0f) {temp3=temp2-1.0f;temp=(L75[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>75.0f) { temp3=temp2-1.0f; temp=(L75[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>70.0f) {temp3=temp2-1.0f;temp=(L70[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>70.0f) { temp3=temp2-1.0f; temp=(L70[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>63.0f) {temp3=temp2-1.0f;temp=(L63[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>63.0f) { temp3=temp2-1.0f; temp=(L63[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>58.0f) {temp3=temp2-1.0f;temp=(L58[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>58.0f) { temp3=temp2-1.0f; temp=(L58[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>42.0f) {temp3=temp2-1.0f;temp=(L58[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>42.0f) { temp3=temp2-1.0f; temp=(L58[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>37.0f) {temp3=temp2-1.0f;temp=(L63[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>37.0f) { temp3=temp2-1.0f; temp=(L63[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>30.0f) {temp3=temp2-1.0f;temp=(L70[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>30.0f) { temp3=temp2-1.0f; temp=(L70[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>25.0f) {temp3=temp2-1.0f;temp=(L75[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>25.0f) { temp3=temp2-1.0f; temp=(L75[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>20.0f) {temp3=temp2-1.0f;temp=(L80[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>20.0f) { temp3=temp2-1.0f; temp=(L80[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>17.0f) {temp3=temp2-1.0f;temp=(L83[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>17.0f) { temp3=temp2-1.0f; temp=(L83[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>13.0f) {temp3=temp2-1.0f;temp=(L87[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>13.0f) { temp3=temp2-1.0f; temp=(L87[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>10.0f) {temp3=temp2-1.0f;temp=(L90[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]>10.0f) { temp3=temp2-1.0f; temp=(L90[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>5.0f) {temp3=temp2-1.0f;temp=(L95[unif]*temp3)+1.0f;lab->L[j][i]=temp*LM[offset]*327.68f;}
|
else if (LM[offset]> 5.0f) { temp3=temp2-1.0f; temp=(L95[unif]*temp3)+1.0f; lab->L[j][i]=temp*LM[offset]*327.68f; }
|
||||||
else if(LM[offset]>0.0f) {lab->L[j][i]=LM[offset]*327.68f;}
|
else if (LM[offset]> 0.0f) { lab->L[j][i]=LM[offset]*327.68f;}
|
||||||
}
|
}
|
||||||
temp4=(327.68f*LM[offset])/tempL;//
|
temp4 = (327.68f*LM[offset])/tempL;//
|
||||||
if(temp4>1.0f) {
|
if (temp4>1.0f) {
|
||||||
if(temp4>2.f) temp4=2.f;//limit action
|
if (temp4>1.7f)
|
||||||
if(LM[offset]<2.0f) {temp3=temp4-1.0f;temp=(L98[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
temp4 = 1.7f;//limit action
|
||||||
else if(LM[offset]<5.0f) {temp3=temp4-1.0f;temp=(L95[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
if (LM[offset]< 2.0f) { temp3=temp4-1.0f; temp=(L98[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<8.0f) {temp3=temp4-1.0f;temp=(L92[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]< 5.0f) { temp3=temp4-1.0f; temp=(L95[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<10.0f) {temp3=temp4-1.0f;temp=(L90[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]< 8.0f) { temp3=temp4-1.0f; temp=(L92[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<13.0f) {temp3=temp4-1.0f;temp=(L87[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<10.0f) { temp3=temp4-1.0f; temp=(L90[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<17.0f) {temp3=temp4-1.0f;temp=(L83[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<13.0f) { temp3=temp4-1.0f; temp=(L87[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<20.0f) {temp3=temp4-1.0f;temp=(L80[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<17.0f) { temp3=temp4-1.0f; temp=(L83[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<25.0f) {temp3=temp4-1.0f;temp=(L75[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<20.0f) { temp3=temp4-1.0f; temp=(L80[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<30.0f) {temp3=temp4-1.0f;temp=(L70[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<25.0f) { temp3=temp4-1.0f; temp=(L75[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<37.0f) {temp3=temp4-1.0f;temp=(L63[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<30.0f) { temp3=temp4-1.0f; temp=(L70[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<42.0f) {temp3=temp4-1.0f;temp=(L58[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<37.0f) { temp3=temp4-1.0f; temp=(L63[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<58.0f) {temp3=temp4-1.0f;temp=(L58[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<42.0f) { temp3=temp4-1.0f; temp=(L58[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<63.0f) {temp3=temp4-1.0f;temp=(L63[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<58.0f) { temp3=temp4-1.0f; temp=(L58[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<70.0f) {temp3=temp4-1.0f;temp=(L70[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<63.0f) { temp3=temp4-1.0f; temp=(L63[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<75.0f) {temp3=temp4-1.0f;temp=(L75[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<70.0f) { temp3=temp4-1.0f; temp=(L70[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<80.0f) {temp3=temp4-1.0f;temp=(L80[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<75.0f) { temp3=temp4-1.0f; temp=(L75[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<83.0f) {temp3=temp4-1.0f;temp=(L83[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<80.0f) { temp3=temp4-1.0f; temp=(L80[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<87.0f) {temp3=temp4-1.0f;temp=(L87[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<83.0f) { temp3=temp4-1.0f; temp=(L83[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<90.0f) {temp3=temp4-1.0f;temp=(L90[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<87.0f) { temp3=temp4-1.0f; temp=(L87[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<95.0f) {temp3=temp4-1.0f;temp=(L95[unif]*temp3)+1.0f;lab->L[j][i]=(LM[offset]*327.68f)/temp;}
|
else if (LM[offset]<90.0f) { temp3=temp4-1.0f; temp=(L90[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
else if(LM[offset]<100.0f) {lab->L[j][i]=LM[offset]*327.68f;}
|
else if (LM[offset]<95.0f) { temp3=temp4-1.0f; temp=(L95[unif]*temp3)+1.0f; lab->L[j][i]=(LM[offset]*327.68f)/temp; }
|
||||||
|
else if (LM[offset]<100.0f) { lab->L[j][i]=LM[offset]*327.68f; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
delete [] LM;
|
delete [] LM;
|
||||||
t2e.set();
|
t2e.set();
|
||||||
if( settings->verbose )
|
if (settings->verbose)
|
||||||
printf("Microcontrast %d usec\n", t2e.etime(t1e));
|
printf("Microcontrast %d usec\n", t2e.etime(t1e));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user