Merge branch 'dev' into improve_pyramids
This commit is contained in:
commit
7687ca9853
@ -1792,7 +1792,7 @@ TP_LOCALLAB_BLURLEVELFRA;Flouter niveaux
|
||||
TP_LOCALLAB_BLURMASK_TOOLTIP;Génère un masque flou, prend en compte la structure avec le curseur de seuil de contraste du Masque flou.
|
||||
TP_LOCALLAB_BLURRESIDFRA;Flouter image Résiduelle
|
||||
TP_LOCALLAB_BLUR_TOOLNAME;Adoucir Flouter Grain & Réduction du Bruit - 1
|
||||
TP_LOCALLAB_BLWH;Tous les chnagements forcés en noir et blanc
|
||||
TP_LOCALLAB_BLWH;Tous les changements forcés en noir et blanc
|
||||
TP_LOCALLAB_BLWH_TOOLTIP;Force le changement de la composante "a" et "b" à zéro.\nUtile quand l'utilisateur choisit un processus noir et blanc, ou un film.
|
||||
TP_LOCALLAB_BUTTON_ADD;Ajouter
|
||||
TP_LOCALLAB_BUTTON_DEL;Effacer
|
||||
@ -1823,7 +1823,7 @@ TP_LOCALLAB_CLARIFRA;Clarté & Masque de netteté - Fusion & adoucir images
|
||||
TP_LOCALLAB_CLARILRES;Fusion Luma
|
||||
TP_LOCALLAB_CLARISOFT;Rayon adoucir
|
||||
TP_LOCALLAB_CLARISOFT_TOOLTIP;Actif pour Clarté et Masque de netteté si différent de zéro.\n\nActif pour toutes les pyramides ondelettes.\nInactif si rayon = 0
|
||||
TP_LOCALLAB_CLARITYML;Claté
|
||||
TP_LOCALLAB_CLARITYML;Clarté
|
||||
TP_LOCALLAB_CLARI_TOOLTIP;En dessous ou égal à 4, 'Masque netteté' est actif.\nAu dessus du niveau ondelettes 5 'Clarté' est actif.\nUtilesu=i vous utilisez 'Compression dynamique des niveaux'
|
||||
TP_LOCALLAB_CLIPTM;Clip Recupère données (gain)
|
||||
TP_LOCALLAB_COFR;Couleur & Lumière - Petits défauts
|
||||
@ -1854,7 +1854,7 @@ TP_LOCALLAB_CURVCURR;Normal
|
||||
TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP;Si la courbe est au sommet, le masque est compétement noir aucune transformation n'est réalisée par le masque sur l'image.\nQuand vous descendez la courbe, progressivement le masque va se colorer et s'éclaicir, l'image change de plus en plus.\n\nIl est recommendé (pas obligatoire) de positionner le sommet des courbes curves sur la ligne de transition grise qui représnte les références (chroma, luma, couleur).
|
||||
TP_LOCALLAB_CURVEEDITORM_CC_TOOLTIP;Si la courbe est au sommet,le masque est compétement noir aucune transformation n'est réalisée par le masque sur l'image.\nQuand vous descendez la courbe, progressivement le masque va se colorer et s'éclaicir, l'image change de plus en plus.\nVous pouvez choisir ou non de positionner le sommet de la courbe sur la transition.
|
||||
TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP;Pour être actif, vous devez activer la combobox 'Curves type'
|
||||
TP_LOCALLAB_CURVEEDITOR_TONES_LABEL;Curve tonale
|
||||
TP_LOCALLAB_CURVEEDITOR_TONES_LABEL;Courbe tonale
|
||||
TP_LOCALLAB_CURVEEDITOR_TONES_TOOLTIP;L=f(L), peut être utilisée avec L(H) dans Couleur et lumière
|
||||
TP_LOCALLAB_CURVEMETHOD_TOOLTIP;'Normal', la courbe L=f(L) a le même algorithme que le curseur luminosité.\n'Super' the curve L=f(L) has an new improved algorithm, which can leeds in some cases to artifacts.
|
||||
TP_LOCALLAB_CURVENCONTRAST;Super+Contrast threshold (experimental)
|
||||
@ -1921,7 +1921,7 @@ TP_LOCALLAB_EXPOSURE_TOOLTIP;Dans certains cases (fortes ombres ..) vous pouvez
|
||||
TP_LOCALLAB_EXPRETITOOLS;Outils Retinex avancés
|
||||
TP_LOCALLAB_EXPSHARP_TOOLTIP;RT-Spot minimum 39*39.\nUtiliser de basses valeurs de transition et de hautes valeurs de transition affaiblissement et Etendue pour simuler un petit RT-spot.
|
||||
TP_LOCALLAB_EXPTOOL;Outils exposition
|
||||
TP_LOCALLAB_EXPTRC;Tone Response Curve - TRC
|
||||
TP_LOCALLAB_EXPTRC;Courbe de réponse Tonale - TRC
|
||||
TP_LOCALLAB_EXP_TOOLNAME;Exposition - Compression Dynamique - 10
|
||||
TP_LOCALLAB_FATAMOUNT;Quantité
|
||||
TP_LOCALLAB_FATANCHOR;Ancre
|
||||
@ -1932,30 +1932,30 @@ TP_LOCALLAB_FATFRAME_TOOLTIP;PDE Fattal - utilise Fattal Tone mapping algorithme
|
||||
TP_LOCALLAB_FATLEVEL;Sigma
|
||||
TP_LOCALLAB_FATRES;Quantité de Residual Image
|
||||
TP_LOCALLAB_FATSHFRA;Compression Dynamique Masque ƒ
|
||||
TP_LOCALLAB_FEATH_TOOLTIP;Largeur du Gradiant en porcentage de la diagonale du Spot\nUtilisé par tous les Filtres Gradués dans tous les outils.\nPas d'action si les filtres gradués ne sont pas utilisés.
|
||||
TP_LOCALLAB_FEATVALUE;Adoucissement gradiant (Filtres Gradués)
|
||||
TP_LOCALLAB_FEATH_TOOLTIP;Largeur du Gradient en porcentage de la diagonale du Spot\nUtilisé par tous les Filtres Gradués dans tous les outils.\nPas d'action si les filtres gradués ne sont pas utilisés.
|
||||
TP_LOCALLAB_FEATVALUE;Adoucissement gradient (Filtres Gradués)
|
||||
TP_LOCALLAB_FFTCOL_MASK;FFTW ƒ
|
||||
TP_LOCALLAB_FFTW;ƒ - Utilise Fast Fourier Transform
|
||||
TP_LOCALLAB_FFTW2;ƒ - Utilise Fast Fourier Transform (TIF, JPG,..)
|
||||
TP_LOCALLAB_FFTWBLUR;ƒ - Utilise toujours Fast Fourier Transform
|
||||
TP_LOCALLAB_FULLIMAGE;Calcule les valeurs DarkEv - WhiteEv - sur l'image entière
|
||||
TP_LOCALLAB_FULLIMAGE;Calcule les valeurs Noir Ev - Blanc Ev - sur l'image entière
|
||||
TP_LOCALLAB_GAM;Gamma
|
||||
TP_LOCALLAB_GAMFRA;Tone response curve (TRC)
|
||||
TP_LOCALLAB_GAMFRA;Courbe Réponse Tonale (TRC)
|
||||
TP_LOCALLAB_GAMM;Gamma
|
||||
TP_LOCALLAB_GAMMASKCOL;Gamma masque
|
||||
TP_LOCALLAB_GAMSH;Gamma
|
||||
TP_LOCALLAB_GRADANG;Angle du Gradiant
|
||||
TP_LOCALLAB_GRADANG;Angle du Gradient
|
||||
TP_LOCALLAB_GRADANG_TOOLTIP;Angle de Rotation en degrés : -180 0 +180
|
||||
TP_LOCALLAB_GRADFRA;Filtre gradué Masque
|
||||
TP_LOCALLAB_GRADGEN_TOOLTIP;Filtre Gradué est fourni avec Couleur et Lumière & Fusion fichier, Exposition & masque, Shadows Highlight, Vibrance, Encoding log.\n\nVibrance, Couleur et Lumière & Fusion fichier, sont fournis avec GF luminance, chrominance, teinte.\nAdoucissement est situé dans "réglages".
|
||||
TP_LOCALLAB_GRADLOGFRA;Filtre Gradué Luminance
|
||||
TP_LOCALLAB_GRADSTR;Force du Gradiant
|
||||
TP_LOCALLAB_GRADSTR;Force du Gradient
|
||||
TP_LOCALLAB_GRADSTRAB_TOOLTIP;Filtre chroma force
|
||||
TP_LOCALLAB_GRADSTRCHRO;Force Gradiant Chrominance
|
||||
TP_LOCALLAB_GRADSTRHUE;Force Gradiant Teinte
|
||||
TP_LOCALLAB_GRADSTRHUE2;Force Gradiant Teinte
|
||||
TP_LOCALLAB_GRADSTRCHRO;Force Gradient Chrominance
|
||||
TP_LOCALLAB_GRADSTRHUE;Force Gradient Teinte
|
||||
TP_LOCALLAB_GRADSTRHUE2;Force Gradient Teinte
|
||||
TP_LOCALLAB_GRADSTRHUE_TOOLTIP;Filttre Teinte force
|
||||
TP_LOCALLAB_GRADSTRLUM;Force Gradiant Luminance
|
||||
TP_LOCALLAB_GRADSTRLUM;Force Gradient Luminance
|
||||
TP_LOCALLAB_GRADSTR_TOOLTIP;Force Filtre en Ev
|
||||
TP_LOCALLAB_GRAINFRA;Film Grain 1:1
|
||||
TP_LOCALLAB_GRALWFRA;Filtre Gradué Local contraste
|
||||
@ -2003,7 +2003,7 @@ TP_LOCALLAB_LOCCONT;Masque Flou
|
||||
TP_LOCALLAB_LOC_CONTRAST;Contraste Local-Ondelettes-déf.
|
||||
TP_LOCALLAB_LOC_CONTRASTPYR;Ψ Pyramide 1:
|
||||
TP_LOCALLAB_LOC_CONTRASTPYR2;Ψ Pyramide 2:
|
||||
TP_LOCALLAB_LOC_CONTRASTPYR2LAB; Contraste par niveaux- Tone Mapping - Contraste Dir.
|
||||
TP_LOCALLAB_LOC_CONTRASTPYR2LAB; Contr. par niveaux- Tone Mapping - Cont.Dir.
|
||||
TP_LOCALLAB_LOC_CONTRASTPYRLAB; Filtre Gradué - Netteté bords - Flouter
|
||||
TP_LOCALLAB_LOC_RESIDPYR;Image Residuelle
|
||||
TP_LOCALLAB_LOG;Codage log
|
||||
@ -2269,7 +2269,7 @@ TP_LOCALLAB_TONEMASCALE_TOOLTIP;Ce contrôle donne le pouvoir de différencier l
|
||||
TP_LOCALLAB_TONE_TOOLNAME;Compression tonale - 4
|
||||
TP_LOCALLAB_TOOLCOL;Masque Structure comme outil
|
||||
TP_LOCALLAB_TOOLMASK;Outils
|
||||
TP_LOCALLAB_TRANSIT;Transition Gradiant
|
||||
TP_LOCALLAB_TRANSIT;Transition - Gradient
|
||||
TP_LOCALLAB_TRANSITGRAD;Transition différentiation XY
|
||||
TP_LOCALLAB_TRANSITGRAD_TOOLTIP;Change la transition des abscisses vers les ordonnées
|
||||
TP_LOCALLAB_TRANSITVALUE;Transition valeur
|
||||
|
@ -2407,7 +2407,7 @@ TP_LOCALLAB_COLORDE;Color preview selection ΔE - Intensity
|
||||
TP_LOCALLAB_COLORDEPREV_TOOLTIP;Button Preview ΔE needs that only one tool is enabled (expander).\nTo be able to have an Preview ΔE with several enable tools use Mask and modifications - Preview ΔE
|
||||
TP_LOCALLAB_COLORDE_TOOLTIP;Show preview selection ΔE in blue if negative and in green if positive.\n\nMask and modifications (show modifications without mask): show real modifications if positive, show enhanced modifications (only luminance) with blue and yellow if negative.
|
||||
TP_LOCALLAB_COLORSCOPE;Scope Color Tools
|
||||
TP_LOCALLAB_COLORSCOPE_TOOLTIP;Use a common Scope for Color and light, Exposure (Standard), Shadows highlight, Vibrance.\nOthers tools have their specific scope.
|
||||
TP_LOCALLAB_COLORSCOPE_TOOLTIP;Use a common Scope for Color and light, Shadows highlight, Vibrance.\nOthers tools have their specific scope.
|
||||
TP_LOCALLAB_COLOR_TOOLNAME;Color&Light (Defects) - 11
|
||||
TP_LOCALLAB_COL_NAME;Name
|
||||
TP_LOCALLAB_COL_VIS;Status
|
||||
@ -2492,13 +2492,13 @@ TP_LOCALLAB_EXPLAP_TOOLTIP;The more you act on this threshold slider, the greate
|
||||
TP_LOCALLAB_EXPMERGEFILE_TOOLTIP;Allows various possibilities to blend image (as layers in Photosshop) : difference, multiply, soft light, overlay...with opacity...\nOriginal Image : merge current RT-spot with Original.\nPrevious spot : merge current Rt-spot with previous - if there is only one spot previous = original.\nBackground : merge current RT-spot with a color and luminance background (less possibilties)
|
||||
TP_LOCALLAB_EXPMETHOD_TOOLTIP;Standard : use an algorithm similar as main Exposure but in L*a*b* and taking account of deltaE.\n\nLaplacian & PDE : use another algorithm also with deltaE and with Poisson equation to solve Laplacian in Fourier space.\nPDE IPOL, PDE Fattal and Standard can be combined.\nFFTW Fourier Transform is optimized in size to reduce processing time.\nPDE reduce artifacts and noise.
|
||||
TP_LOCALLAB_EXPNOISEMETHOD_TOOLTIP;Apply a median before Laplace transform to prevent artifacts (noise).\nYou can also use "Denoise" tool.
|
||||
TP_LOCALLAB_EXPOSE;Exposure - PDE algorithms
|
||||
TP_LOCALLAB_EXPOSE;PDE algorithms & Exposure
|
||||
TP_LOCALLAB_EXPOSURE_TOOLTIP;In some cases (strong shadows ..) you can use others modules "Shadows Highlights", "Tone equalizer", "TRC", "Encoding Log"...
|
||||
TP_LOCALLAB_EXPRETITOOLS;Advanced Retinex Tools
|
||||
TP_LOCALLAB_EXPSHARP_TOOLTIP;RT-Spot minimum 39*39.\nUse low transition values and high decay transition values and scope to simulate small RT-spot.
|
||||
TP_LOCALLAB_EXPTOOL;Tools exposure
|
||||
TP_LOCALLAB_EXPTRC;Tone Response Curve - TRC
|
||||
TP_LOCALLAB_EXP_TOOLNAME;Exposure - Dynamic Range Compression - 10
|
||||
TP_LOCALLAB_EXP_TOOLNAME;Laplacian PDE -Dynamic Range Compression & Exposure- 10
|
||||
TP_LOCALLAB_FATAMOUNT;Amount
|
||||
TP_LOCALLAB_FATANCHOR;Anchor
|
||||
TP_LOCALLAB_FATANCHORA;Offset
|
||||
|
@ -351,7 +351,7 @@ public:
|
||||
|
||||
void transit_shapedetect_retinex(int call, int senstype, LabImage * bufexporig, LabImage * bufmask, LabImage * buforigmas, float **buflight, float **bufchro, const float hueref, const float chromaref, const float lumaref, const struct local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk);
|
||||
void transit_shapedetect(int senstype, const LabImage *bufexporig, LabImage * originalmask, float **bufchro, 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(local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve);
|
||||
void exlabLocal(local_params& lp, int bfh, int bfw, int bfhr, int bfwr, LabImage* bufexporig, LabImage* lab, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve, const float hueref, const float lumaref, const float chromaref);
|
||||
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, LabImage* originalmask, int levred, float hueref, float lumaref, float chromaref, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy, int sk);
|
||||
|
@ -1417,13 +1417,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall
|
||||
lp.residhithr = locallab.spots.at(sp).residhithr;
|
||||
lp.blwh = locallab.spots.at(sp).blwh;
|
||||
lp.senscolor = (int) locallab.spots.at(sp).colorscope;
|
||||
//replace scope color exposure vibrance shadows
|
||||
//replace scope color vibrance shadows
|
||||
lp.sens = lp.senscolor;
|
||||
lp.sensv = lp.senscolor;
|
||||
lp.senshs = lp.senscolor;
|
||||
if(lp.expmet == 0){
|
||||
lp.sensex = lp.senscolor;
|
||||
}
|
||||
}
|
||||
|
||||
static void calcTransitionrect(const float lox, const float loy, const float ach, const local_params& lp, int &zone, float &localFactor)
|
||||
@ -2446,25 +2443,83 @@ void ImProcFunctions::softprocess(const LabImage* bufcolorig, array2D<float> &bu
|
||||
}
|
||||
}
|
||||
|
||||
void ImProcFunctions::exlabLocal(local_params& lp, int bfh, int bfw, LabImage* bufexporig, LabImage* lab, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve)
|
||||
void ImProcFunctions::exlabLocal(local_params& lp, int bfh, int bfw, int bfhr, int bfwr, LabImage* bufexporig, LabImage* lab, const LUTf& hltonecurve, const LUTf& shtonecurve, const LUTf& tonecurve, const float hueref, const float lumaref, const float chromaref)
|
||||
{
|
||||
BENCHFUN
|
||||
//exposure local
|
||||
|
||||
constexpr float maxran = 65536.f;
|
||||
const float linear = lp.linear;
|
||||
if (linear > 0.f && lp.expcomp == 0.f) {
|
||||
lp.expcomp = 0.001f;
|
||||
}
|
||||
const bool exec = (lp.expmet == 1 && linear > 0.f && lp.laplacexp > 0.1f && !lp.invex);
|
||||
|
||||
if(!exec) {
|
||||
//Laplacian PDE before exposure to smooth L, algorithm exposure leads to increase L differences
|
||||
const std::unique_ptr<float[]> datain(new float[bfwr * bfhr]);
|
||||
const std::unique_ptr<float[]> dataout(new float[bfwr * bfhr]);
|
||||
const std::unique_ptr<float[]> dE(new float[bfwr * bfhr]);
|
||||
const float cexp_scale = std::pow(2.f, lp.expcomp);
|
||||
const float ccomp = (rtengine::max(0.f, lp.expcomp) + 1.f) * lp.hlcomp / 100.f;
|
||||
const float cshoulder = ((maxran / rtengine::max(1.0f, cexp_scale)) * (lp.hlcompthr / 200.f)) + 0.1f;
|
||||
const float chlrange = maxran - cshoulder;
|
||||
const float linear = lp.linear;
|
||||
const float diffde = 100.f - lp.sensex;//the more scope, the less take into account dE for Laplace
|
||||
|
||||
deltaEforLaplace(dE.get(), diffde, bfwr, bfhr, bufexporig, hueref, chromaref, lumaref);
|
||||
|
||||
constexpr float alap = 600.f;
|
||||
constexpr float blap = 100.f;
|
||||
constexpr float aa = (alap - blap) / 50.f;
|
||||
constexpr float bb = 100.f - 30.f * aa;
|
||||
|
||||
float lap;
|
||||
if (diffde > 80.f) {
|
||||
lap = alap;
|
||||
} else if (diffde < 30.f) {
|
||||
lap = blap;
|
||||
} else {
|
||||
lap = aa * diffde + bb;
|
||||
}
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16) if (multiThread)
|
||||
#endif
|
||||
for (int y = 0; y < bfhr; y++) {
|
||||
for (int x = 0; x < bfwr; x++) {
|
||||
datain[y * bfwr + x] = bufexporig->L[y][x];
|
||||
}
|
||||
}
|
||||
|
||||
MyMutex::MyLock lock(*fftwMutex);
|
||||
ImProcFunctions::retinex_pde(datain.get(), dataout.get(), bfwr, bfhr, lap, 1.f, dE.get(), 0, 1, 1);//350 arbitrary value about 45% strength Laplacian
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16) if (multiThread)
|
||||
#endif
|
||||
for (int y = 0; y < bfhr; y++) {
|
||||
for (int x = 0; x < bfwr; x++) {
|
||||
bufexporig->L[y][x] = dataout[y * bfwr + x];
|
||||
}
|
||||
}
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for if (multiThread)
|
||||
#endif
|
||||
for (int ir = 0; ir < bfhr; ir++) {
|
||||
for (int jr = 0; jr < bfwr; jr++) {
|
||||
float L = bufexporig->L[ir][jr];
|
||||
//highlight
|
||||
const float hlfactor = (2 * L < MAXVALF ? hltonecurve[2 * L] : CurveFactory::hlcurve(cexp_scale, ccomp, chlrange, 2 * L));
|
||||
L *= hlfactor;//approximation but pretty good with Laplacian and L < mean, hl aren't call
|
||||
//shadow tone curve
|
||||
L *= shtonecurve[2 * L];
|
||||
//tonecurve
|
||||
lab->L[ir][jr] = 0.5f * tonecurve[2 * L];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
constexpr float kl = 1.f;
|
||||
const float hlcompthr = lp.hlcompthr / 200.f;
|
||||
const float hlcomp = lp.hlcomp / 100.f;
|
||||
if (lp.linear > 0.f && lp.expcomp == 0.f) {
|
||||
lp.expcomp = 0.001f;
|
||||
}
|
||||
|
||||
if (lp.expmet == 1 && lp.linear > 0.f && lp.laplacexp > 0.1f && !lp.invex) {
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for if (multiThread)
|
||||
@ -2474,8 +2529,8 @@ void ImProcFunctions::exlabLocal(local_params& lp, int bfh, int bfw, LabImage* b
|
||||
float L = bufexporig->L[ir][jr];
|
||||
const float Llin = LIM01(L / 32768.f);
|
||||
const float addcomp = linear * (-kl * Llin + kl);//maximum about 1 . IL
|
||||
const float exp_scale = pow_F(2.0, (lp.expcomp + addcomp));
|
||||
const float shoulder = ((maxran / rtengine::max(1.0f, exp_scale)) * hlcompthr) + 0.1f;
|
||||
const float exp_scale = pow_F(2.f, lp.expcomp + addcomp);
|
||||
const float shoulder = (maxran / rtengine::max(1.0f, exp_scale)) * hlcompthr + 0.1f;
|
||||
const float comp = (rtengine::max(0.f, (lp.expcomp + addcomp)) + 1.f) * hlcomp;
|
||||
const float hlrange = maxran - shoulder;
|
||||
|
||||
@ -2488,25 +2543,8 @@ void ImProcFunctions::exlabLocal(local_params& lp, int bfh, int bfw, LabImage* b
|
||||
lab->L[ir][jr] = 0.5f * tonecurve[2 * L];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for if (multiThread)
|
||||
#endif
|
||||
for (int ir = 0; ir < bfh; ir++) {
|
||||
for (int jr = 0; jr < bfw; jr++) {
|
||||
float L = bufexporig->L[ir][jr];
|
||||
//highlight
|
||||
const float hlfactor = (2 * L < MAXVALF ? hltonecurve[2 * L] : CurveFactory::hlcurve(cexp_scale, ccomp, chlrange, 2 * L));
|
||||
L *= hlfactor;//approximation but pretty good with Laplacian and L < mean, hl aren't call
|
||||
//shadow tone curve
|
||||
L *= shtonecurve[2 * L];
|
||||
//tonecurve
|
||||
lab->L[ir][jr] = 0.5f * tonecurve[2 * L];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ImProcFunctions::addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk)
|
||||
{
|
||||
@ -3635,30 +3673,27 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw
|
||||
fftwf_plan_with_nthreads(omp_get_max_threads());
|
||||
}
|
||||
#endif
|
||||
float *data_fft, *data_fft04, *data_tmp, *data, *data_tmp04;
|
||||
|
||||
float *datashow = nullptr;
|
||||
|
||||
if (show != 0) {
|
||||
if (NULL == (datashow = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
|
||||
datashow = (float *) fftwf_malloc(sizeof(float) * bfw * bfh);
|
||||
if (!datashow) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == (data_tmp = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
if (NULL == (data_tmp04 = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
|
||||
float *data_tmp = (float *) fftwf_malloc(sizeof(float) * bfw * bfh);
|
||||
if (!data_tmp) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
//first call to laplacian with plein strength
|
||||
ImProcFunctions::discrete_laplacian_threshold(data_tmp, datain, bfw, bfh, thresh);
|
||||
discrete_laplacian_threshold(data_tmp, datain, bfw, bfh, thresh);
|
||||
|
||||
if (NULL == (data_fft = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
|
||||
float *data_fft = (float *) fftwf_malloc(sizeof(float) * bfw * bfh);
|
||||
if (!data_fft) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
@ -3671,55 +3706,55 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw
|
||||
}
|
||||
}
|
||||
|
||||
//second call to laplacian with 40% strength ==> reduce effect if we are far from ref (deltaE)
|
||||
ImProcFunctions::discrete_laplacian_threshold(data_tmp04, datain, bfw, bfh, 0.4f * thresh);
|
||||
|
||||
if (NULL == (data_fft04 = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
if (NULL == (data = (float *) fftwf_malloc(sizeof(float) * bfw * bfh))) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
//execute first
|
||||
const auto dct_fw = fftwf_plan_r2r_2d(bfh, bfw, data_tmp, data_fft, FFTW_REDFT10, FFTW_REDFT10, FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
|
||||
fftwf_execute(dct_fw);
|
||||
fftwf_destroy_plan(dct_fw);
|
||||
|
||||
//execute second
|
||||
if (dEenable == 1) {
|
||||
float* data_fft04 = (float *)fftwf_malloc(sizeof(float) * bfw * bfh);
|
||||
float* data_tmp04 = (float *)fftwf_malloc(sizeof(float) * bfw * bfh);
|
||||
if (!data_fft04 || !data_tmp04) {
|
||||
fprintf(stderr, "allocation error\n");
|
||||
abort();
|
||||
}
|
||||
//second call to laplacian with 40% strength ==> reduce effect if we are far from ref (deltaE)
|
||||
discrete_laplacian_threshold(data_tmp04, datain, bfw, bfh, 0.4f * thresh);
|
||||
const auto dct_fw04 = fftwf_plan_r2r_2d(bfh, bfw, data_tmp04, data_fft04, FFTW_REDFT10, FFTW_REDFT10, FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
|
||||
fftwf_execute(dct_fw04);
|
||||
fftwf_destroy_plan(dct_fw04);
|
||||
constexpr float exponent = 4.5f;
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for if (multiThread)
|
||||
#pragma omp parallel if (multiThread)
|
||||
#endif
|
||||
{
|
||||
#ifdef __SSE2__
|
||||
const vfloat exponentv = F2V(exponent);
|
||||
#endif
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (int y = 0; y < bfh ; y++) {//mix two fftw Laplacian : plein if dE near ref
|
||||
for (int x = 0; x < bfw; x++) {
|
||||
float prov = pow(dE[y * bfw + x], 4.5f);
|
||||
data_fft[y * bfw + x] = prov * data_fft[y * bfw + x] + (1.f - prov) * data_fft04[y * bfw + x];
|
||||
int x = 0;
|
||||
#ifdef __SSE2__
|
||||
for (; x < bfw - 3; x += 4) {
|
||||
STVFU(data_fft[y * bfw + x], intp(pow_F(LVFU(dE[y * bfw + x]), exponentv), LVFU(data_fft[y * bfw + x]), LVFU(data_fft04[y * bfw + x])));
|
||||
}
|
||||
#endif
|
||||
for (; x < bfw; x++) {
|
||||
data_fft[y * bfw + x] = intp(pow_F(dE[y * bfw + x], exponent), data_fft[y * bfw + x], data_fft04[y * bfw + x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (show == 2) {
|
||||
for (int y = 0; y < bfh ; y++) {
|
||||
for (int x = 0; x < bfw; x++) {
|
||||
datashow[y * bfw + x] = data_fft[y * bfw + x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fftwf_free(data_fft04);
|
||||
fftwf_free(data_tmp);
|
||||
fftwf_free(data_tmp04);
|
||||
}
|
||||
|
||||
/* solve the Poisson PDE in Fourier space */
|
||||
/* 1. / (float) (bfw * bfh)) is the DCT normalisation term, see libfftw */
|
||||
ImProcFunctions::rex_poisson_dct(data_fft, bfw, bfh, 1. / (double)(bfw * bfh));
|
||||
rex_poisson_dct(data_fft, bfw, bfh, 1. / (double)(bfw * bfh));
|
||||
|
||||
if (show == 3) {
|
||||
for (int y = 0; y < bfh ; y++) {
|
||||
@ -3729,20 +3764,13 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw
|
||||
}
|
||||
}
|
||||
|
||||
const auto dct_bw = fftwf_plan_r2r_2d(bfh, bfw, data_fft, data, FFTW_REDFT01, FFTW_REDFT01, FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
|
||||
const auto dct_bw = fftwf_plan_r2r_2d(bfh, bfw, data_fft, data_tmp, FFTW_REDFT01, FFTW_REDFT01, FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
|
||||
fftwf_execute(dct_bw);
|
||||
fftwf_destroy_plan(dct_fw);
|
||||
fftwf_destroy_plan(dct_bw);
|
||||
fftwf_free(data_fft);
|
||||
fftwf_cleanup();
|
||||
|
||||
#ifdef RT_FFTW3F_OMP
|
||||
if (multiThread) {
|
||||
fftwf_cleanup_threads();
|
||||
}
|
||||
#endif
|
||||
if (show != 4 && normalize == 1) {
|
||||
normalize_mean_dt(data, datain, bfw * bfh, 1.f, 1.f);
|
||||
normalize_mean_dt(data_tmp, datain, bfw * bfh, 1.f, 1.f);
|
||||
}
|
||||
|
||||
if (show == 0 || show == 4) {
|
||||
@ -3752,7 +3780,7 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw
|
||||
#endif
|
||||
for (int y = 0; y < bfh ; y++) {
|
||||
for (int x = 0; x < bfw; x++) {
|
||||
dataout[y * bfw + x] = clipLoc(multy * data[y * bfw + x]);
|
||||
dataout[y * bfw + x] = clipLoc(multy * data_tmp[y * bfw + x]);
|
||||
}
|
||||
}
|
||||
} else if (show == 1 || show == 2 || show == 3) {
|
||||
@ -3761,12 +3789,19 @@ void ImProcFunctions::retinex_pde(const float * datain, float * dataout, int bfw
|
||||
dataout[y * bfw + x] = clipLoc(multy * datashow[y * bfw + x]);
|
||||
}
|
||||
}
|
||||
|
||||
fftwf_free(datashow);
|
||||
}
|
||||
|
||||
fftwf_free(data);
|
||||
fftwf_free(data_tmp);
|
||||
if (datashow) {
|
||||
fftwf_free(datashow);
|
||||
}
|
||||
fftwf_cleanup();
|
||||
|
||||
#ifdef RT_FFTW3F_OMP
|
||||
if (multiThread) {
|
||||
fftwf_cleanup_threads();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int xstart, int ystart, int sk, int cx, int cy, LabImage* bufcolorig, LabImage* bufmaskblurcol, LabImage* originalmaskcol, LabImage* original, LabImage* reserved, int inv, struct local_params & lp,
|
||||
@ -5294,7 +5329,7 @@ void ImProcFunctions::InverseColorLight_Local(bool tonequ, bool tonecurv, int sp
|
||||
}
|
||||
|
||||
} else if (senstype == 1) { //exposure
|
||||
ImProcFunctions::exlabLocal(lp, GH, GW, original, temp.get(), hltonecurveloc, shtonecurveloc, tonecurveloc);
|
||||
ImProcFunctions::exlabLocal(lp, GH, GW, GW, GH, original, temp.get(), hltonecurveloc, shtonecurveloc, tonecurveloc, hueref, lumaref, chromaref);
|
||||
|
||||
if (exlocalcurve) {
|
||||
#ifdef _OPENMP
|
||||
@ -12877,7 +12912,7 @@ void ImProcFunctions::Lab_Local(
|
||||
|
||||
if (bfw >= mSP && bfh >= mSP) {
|
||||
|
||||
if (lp.expmet == 1) {
|
||||
if (lp.expmet == 1 || lp.expmet == 0) {
|
||||
optfft(N_fftwsize, bfh, bfw, bfhr, bfwr, lp, original->H, original->W, xstart, ystart, xend, yend, cx, cy);
|
||||
}
|
||||
|
||||
@ -13031,12 +13066,12 @@ void ImProcFunctions::Lab_Local(
|
||||
lp.expcomp = 0.001f; // to enabled
|
||||
}
|
||||
|
||||
ImProcFunctions::exlabLocal(lp, bfh, bfw, bufexpfin.get(), bufexpfin.get(), hltonecurveloc, shtonecurveloc, tonecurveloc);
|
||||
ImProcFunctions::exlabLocal(lp, bfh, bfw, bfhr, bfwr, bufexpfin.get(), bufexpfin.get(), hltonecurveloc, shtonecurveloc, tonecurveloc, hueref, lumaref, chromaref);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
ImProcFunctions::exlabLocal(lp, bfh, bfw, bufexporig.get(), bufexpfin.get(), hltonecurveloc, shtonecurveloc, tonecurveloc);
|
||||
ImProcFunctions::exlabLocal(lp, bfh, bfw, bfhr, bfwr, bufexporig.get(), bufexpfin.get(), hltonecurveloc, shtonecurveloc, tonecurveloc, hueref, lumaref, chromaref);
|
||||
}
|
||||
|
||||
//gradient
|
||||
|
@ -2869,7 +2869,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
|
||||
expexpose(false),
|
||||
complexexpose(0),
|
||||
expcomp(0.0),
|
||||
hlcompr(0),
|
||||
hlcompr(20),
|
||||
hlcomprthresh(0),
|
||||
black(0),
|
||||
shadex(0),
|
||||
|
@ -2191,7 +2191,7 @@ LocallabExposure::LocallabExposure():
|
||||
exptoolexp(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_EXPTOOL")))),
|
||||
expcomp(Gtk::manage(new Adjuster(M("TP_EXPOSURE_EXPCOMP"), MINEXP, MAXEXP, 0.01, 0.))),
|
||||
black(Gtk::manage(new Adjuster(M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 10, 0))),
|
||||
hlcompr(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 0))),
|
||||
hlcompr(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 20))),
|
||||
hlcomprthresh(Gtk::manage(new Adjuster(M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 0))),
|
||||
shadex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHADEX"), 0, 100, 1, 0))),
|
||||
shcompr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHADEXCOMP"), 0, 100, 1, 50))),
|
||||
@ -3185,7 +3185,7 @@ void LocallabExposure::updateExposureGUI2()
|
||||
pdeFrame->hide();
|
||||
fatFrame->hide();
|
||||
softradiusexp->set_sensitive(true);
|
||||
sensiex->set_sensitive(false);
|
||||
sensiex->set_sensitive(true);
|
||||
} else if (expMethod->get_active_row_number() == 1) {
|
||||
pdeFrame->show();
|
||||
fatFrame->show();
|
||||
|
Loading…
x
Reference in New Issue
Block a user