diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais
index dfa62c3df..a0c4493ed 100644
--- a/rtdata/languages/Francais
+++ b/rtdata/languages/Francais
@@ -202,6 +202,7 @@ GENERAL_PORTRAIT;Portrait
GENERAL_SAVE;Enregistrer
GENERAL_UNCHANGED;(Inchangé)
GENERAL_YES;Oui
+GENERAL_WARNING;Attention
HISTOGRAM_BUTTON_BAR;RVB
HISTOGRAM_BUTTON_B;B
HISTOGRAM_BUTTON_G;V
@@ -314,7 +315,7 @@ HISTORY_MSG_91;Réd. de bruit Chrominance
HISTORY_MSG_92;Réd. de bruit Gamma
HISTORY_MSG_93;Param. de contraste
HISTORY_MSG_94;Contraste par niveau de détail
-HISTORY_MSG_95;Saturation
+HISTORY_MSG_95;Chromaticité
HISTORY_MSG_96;Courbe 'a'
HISTORY_MSG_97;Courbe 'b'
HISTORY_MSG_98;Algorithme de dématriçage
@@ -330,9 +331,9 @@ HISTORY_MSG_107;A.C. - Seuil
HISTORY_MSG_108;Seuil de compr. des hautes lumières
HISTORY_MSG_109;Redim. - boîte englobante
HISTORY_MSG_110;Redim. s'applique à
-HISTORY_MSG_111;Éviter l'écrêtage couleur
-HISTORY_MSG_112;Limiteur de saturation
-HISTORY_MSG_113;Limite de saturation
+HISTORY_MSG_111;Éviter les dérives de teinte
+HISTORY_MSG_112;--inutilisé--
+HISTORY_MSG_113;Protection des tons rouges et chair
HISTORY_MSG_114;Nbr d'itération DCB
HISTORY_MSG_115;Nbr d'itération des fausses couleurs
HISTORY_MSG_116;DCB amélioré
@@ -386,6 +387,10 @@ HISTORY_MSG_163;Courbes RVB - R
HISTORY_MSG_164;Courbes RVB - V
HISTORY_MSG_165;Courbes RVB - B
HISTORY_MSG_166;Niveaux neutre
+HISTORY_MSG_167;Mode N&B colorisable
+HISTORY_MSG_168;Courbe 'Cc'
+HISTORY_MSG_169;Courbe 'Ct'
+HISTORY_MSG_170;Vibrance - courbe
HISTORY_NEWSNAPSHOTAS;Sous...
HISTORY_NEWSNAPSHOT;Ajouter
HISTORY_NEWSSDIALOGLABEL;Label de la capture:
@@ -803,6 +808,8 @@ SAVEDLG_SAVEIMMEDIATELY;Enregistrer immédiatement
SAVEDLG_SAVESPP;Enregistrer les paramètres de développement avec l'image
SAVEDLG_TIFFFILTER;Fichiers TIFF
SAVEDLG_TIFFUNCOMPRESSED;TIFF non compressé
+SAVEDLG_WARNFILENAME;Le fichier sera nommé
+SHCSELECTOR_TOOLTIP;Cliquez le bouton droit de la souris\npour réinitiliser la position de ces 3 curseurs
THRESHOLDSELECTOR_B;Bas
THRESHOLDSELECTOR_BL;Bas-gauche
THRESHOLDSELECTOR_BR;Bas-droite
@@ -958,14 +965,32 @@ TP_ICM_SAVEREFERENCE;Utiliser l'image comme profil de référence
TP_ICM_WORKINGPROFILE;Profil de Travail
TP_IMPULSEDENOISE_LABEL;Réduction du bruit d'impulsion
TP_IMPULSEDENOISE_THRESH;Seuil
-TP_LABCURVE_AVOIDCOLORCLIP;Éviter l'écrêtage couleur
+TP_LABCURVE_AVOIDCOLORSHIFT;Éviter les dérives de teinte
+TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Ramènes les données dans le gamut de l'espace couleur de travail\npuis applique la correction de Munsell
TP_LABCURVE_BRIGHTNESS;Luminosité
+TP_LABCURVE_BWTONING;Mode N&B colorisable
+TP_LABCURVE_BWTONING_TIP;Avec le mode N&B colorisable activé, la Chromaticité, la courbe Cc et Ct sont sans effet.\nLa colorisation peut être effctué en utilisant les courbes a et b.
TP_LABCURVE_CONTRAST;Contraste
TP_LABCURVE_CURVEEDITOR;Courbe de luminance
-TP_LABCURVE_ENABLESATLIMITER;Activer le limiteur de saturation
+TP_LABCURVE_CURVEEDITOR_A_RANGE1;Vert saturé
+TP_LABCURVE_CURVEEDITOR_A_RANGE2;Vert pastel
+TP_LABCURVE_CURVEEDITOR_A_RANGE3;Rouge pastel
+TP_LABCURVE_CURVEEDITOR_A_RANGE4;Rouge saturé
+TP_LABCURVE_CURVEEDITOR_B_RANGE1;Bleu saturé
+TP_LABCURVE_CURVEEDITOR_B_RANGE2;Bleu pastel
+TP_LABCURVE_CURVEEDITOR_B_RANGE3;Jaune pastel
+TP_LABCURVE_CURVEEDITOR_B_RANGE4;Jaune saturé
+TP_LABCURVE_CURVEEDITOR_CC;CC
+TP_LABCURVE_CURVEEDITOR_CC_RANGE1;Neutre
+TP_LABCURVE_CURVEEDITOR_CC_RANGE2;Terne
+TP_LABCURVE_CURVEEDITOR_CC_RANGE3;Pastel
+TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturé
+TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticité en fonction de la Chromaticité
+TP_LABCURVE_CURVEEDITOR_CH;CT
+TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticité en fonction de la Teinte
TP_LABCURVE_LABEL;Courbes Lab
-TP_LABCURVE_SATLIMIT;Limite de saturation
-TP_LABCURVE_SATURATION;Saturation
+TP_LABCURVE_RSTPROTECTION;Protection des tons rouges et chair
+TP_LABCURVE_CHROMATICITY;Chromaticité
TP_LENSGEOM_AUTOCROP;Recadrage auto
TP_LENSGEOM_FILL;Remplir
TP_LENSGEOM_LABEL;Objectif / Géométrie
@@ -1060,6 +1085,13 @@ TP_SHARPENMICRO_LABEL;Microcontraste
TP_SHARPENMICRO_MATRIX;Matrice 3×3 au lieu de 5×5
TP_SHARPENMICRO_UNIFORMITY;Uniformité
TP_VIBRANCE_AVOIDCOLORSHIFT;Éviter les dérives de teinte
+TP_VIBRANCE_CURVEEDITOR_SKINTONES;TT
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Tons chair
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE1;Rouge/Pourpre
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE2;Rouge
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE3;Rouge/Jaune
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE4;Jaune
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_TOOLTIP;Teinte en fonction de la teinte
TP_VIBRANCE_LABEL;Vibrance
TP_VIBRANCE_PASTELS;Tons pastels
TP_VIBRANCE_PASTSATTOG;Lier Pastels et Saturés
diff --git a/rtdata/languages/default b/rtdata/languages/default
index dd06445c9..909ab7fe4 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -316,7 +316,7 @@ HISTORY_MSG_91;NR - Chrominance
HISTORY_MSG_92;NR - Gamma
HISTORY_MSG_93;Contrast by Detail Levels Value
HISTORY_MSG_94;Contrast by Detail Levels
-HISTORY_MSG_95;Saturation
+HISTORY_MSG_95;Chromaticity
HISTORY_MSG_96;'a' Curve
HISTORY_MSG_97;'b' Curve
HISTORY_MSG_98;Demosaicing Method
@@ -332,9 +332,9 @@ HISTORY_MSG_107;Defringing Threshold
HISTORY_MSG_108;Highlight Compr. Threshold
HISTORY_MSG_109;Resize Bounding Box
HISTORY_MSG_110;Resizing applies o
-HISTORY_MSG_111;Avoid Color Clipping
-HISTORY_MSG_112;Saturation Limiter
-HISTORY_MSG_113;Saturation Limit
+HISTORY_MSG_111;Avoid Color Shift
+HISTORY_MSG_112;--unused--
+HISTORY_MSG_113;Red and Skin Tones Protection
HISTORY_MSG_114;DCB Iterations
HISTORY_MSG_115;False Color Iterations
HISTORY_MSG_116;Enhanced DCB
@@ -388,7 +388,10 @@ HISTORY_MSG_163;RGB Curves - R
HISTORY_MSG_164;RGB Curves - G
HISTORY_MSG_165;RGB Curves - B
HISTORY_MSG_166;Neutral Levels
-HISTORY_MSG_167;BW Toning
+HISTORY_MSG_167;B&W Toning
+HISTORY_MSG_168;'Cc' curve
+HISTORY_MSG_169;'Ch' curve
+HISTORY_MSG_170;Vibrance - Curve
HISTORY_NEWSNAPSHOTAS;As...
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSSDIALOGLABEL;Label of the snapshot:
@@ -807,6 +810,7 @@ SAVEDLG_SAVESPP;Save processing parameters with image
SAVEDLG_TIFFFILTER;TIFF files
SAVEDLG_TIFFUNCOMPRESSED;Uncompressed TIFF
SAVEDLG_WARNFILENAME;File will be named
+SHCSELECTOR_TOOLTIP;Click right mouse button to reset\nthe position of those 3 sliders
THRESHOLDSELECTOR_B;Bottom
THRESHOLDSELECTOR_BL;Bottom-left
THRESHOLDSELECTOR_BR;Bottom-right
@@ -967,16 +971,32 @@ TP_ICM_SAVEREFERENCE;Save reference image for profiling
TP_ICM_WORKINGPROFILE;Working Profile
TP_IMPULSEDENOISE_LABEL;Impulse Noise Reduction
TP_IMPULSEDENOISE_THRESH;Impulse NR Threshold
-TP_LABCURVE_AVOIDCOLORCLIP;Avoid color clipping
+TP_LABCURVE_AVOIDCOLORSHIFT;Avoid Color Shift
+TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space\nand apply Munsell correction
TP_LABCURVE_BRIGHTNESS;Brightness
-TP_LABCURVE_BWTONING;BW Toning
-TP_LABCURVE_BWTONING_TIP;With BW Toning option enabled the Lab Saturation is not in effect.\nToning can be achieved using the a and b curves
+TP_LABCURVE_BWTONING;B&W Toning
+TP_LABCURVE_BWTONING_TIP;With B&W Toning option enabled, the Lab Chromaticity, Cc and Ch curves are not in effect.\nToning can be achieved using the a and b curves
TP_LABCURVE_CONTRAST;Contrast
TP_LABCURVE_CURVEEDITOR;Luminance Curve
-TP_LABCURVE_ENABLESATLIMITER;Enable saturation limiter
+TP_LABCURVE_CURVEEDITOR_A_RANGE1;Green saturated
+TP_LABCURVE_CURVEEDITOR_A_RANGE2;Green pastel
+TP_LABCURVE_CURVEEDITOR_A_RANGE3;Red pastel
+TP_LABCURVE_CURVEEDITOR_A_RANGE4;Red saturated
+TP_LABCURVE_CURVEEDITOR_B_RANGE1;Blue saturated
+TP_LABCURVE_CURVEEDITOR_B_RANGE2;Blue pastel
+TP_LABCURVE_CURVEEDITOR_B_RANGE3;Yellow pastel
+TP_LABCURVE_CURVEEDITOR_B_RANGE4;Yellow saturated
+TP_LABCURVE_CURVEEDITOR_CC;CC
+TP_LABCURVE_CURVEEDITOR_CC_RANGE1;Neutral
+TP_LABCURVE_CURVEEDITOR_CC_RANGE2;Dull
+TP_LABCURVE_CURVEEDITOR_CC_RANGE3;Pastel
+TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturated
+TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity according to the Chromaticity
+TP_LABCURVE_CURVEEDITOR_CH;CH
+TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticity according to the Hue
TP_LABCURVE_LABEL;Lab Adjustments
-TP_LABCURVE_SATLIMIT;Saturation limit
-TP_LABCURVE_SATURATION;Saturation
+TP_LABCURVE_RSTPROTECTION;Red and Skin Tones Protection
+TP_LABCURVE_CHROMATICITY;Chromaticity
TP_LENSGEOM_AUTOCROP; Auto Crop
TP_LENSGEOM_FILL;Auto Fill
TP_LENSGEOM_LABEL;Lens / Geometry
@@ -1074,6 +1094,13 @@ TP_SHARPENMICRO_LABEL;Microcontrast
TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5
TP_SHARPENMICRO_UNIFORMITY;Uniformity
TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift
+TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin tones
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE1;Red/Purple
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE2;Red
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE3;Red/Yellow
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE4;Yellow
+TP_VIBRANCE_CURVEEDITOR_SKINTONES_TOOLTIP;Hue according to the Hue
TP_VIBRANCE_LABEL;Vibrance
TP_VIBRANCE_PASTELS;Pastel tones
TP_VIBRANCE_PASTSATTOG;Link pastel and saturated tones
diff --git a/rtdata/profiles/BW-1.pp3 b/rtdata/profiles/BW-1.pp3
index cc5e02b89..b4830cd18 100644
--- a/rtdata/profiles/BW-1.pp3
+++ b/rtdata/profiles/BW-1.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=-100
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=0
+BWtoning=true
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/BW-2.pp3 b/rtdata/profiles/BW-2.pp3
index 835632359..bc7f34a7f 100644
--- a/rtdata/profiles/BW-2.pp3
+++ b/rtdata/profiles/BW-2.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=-100
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=0
+BWtoning=true
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=3;0;0;0.84892086330935235;0.69064748201438808;1;1;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/BW-3.pp3 b/rtdata/profiles/BW-3.pp3
index 31db39f9f..fbde7b35a 100644
--- a/rtdata/profiles/BW-3.pp3
+++ b/rtdata/profiles/BW-3.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=-25
-Saturation=-100
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=0
+BWtoning=true
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=2;0.25;0.5;0.75;50;12;-12;-50;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/BW-4.pp3 b/rtdata/profiles/BW-4.pp3
index 3674873ca..b1f8785b5 100644
--- a/rtdata/profiles/BW-4.pp3
+++ b/rtdata/profiles/BW-4.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=-35
-Saturation=-100
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=0
+BWtoning=true
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=3;0;0;0.18623481781376497;0.028340080971659902;0.50607287449392713;0.50607287449392713;0.77732793522267185;0.97975708502024295;1;1;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Default-ISO-High.pp3 b/rtdata/profiles/Default-ISO-High.pp3
index 9c3babc28..0aa28f95f 100644
--- a/rtdata/profiles/Default-ISO-High.pp3
+++ b/rtdata/profiles/Default-ISO-High.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=5
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=5
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Default-ISO-Medium.pp3 b/rtdata/profiles/Default-ISO-Medium.pp3
index 9ba98b5c1..07ecc0e93 100644
--- a/rtdata/profiles/Default-ISO-Medium.pp3
+++ b/rtdata/profiles/Default-ISO-Medium.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=5
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=5
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Default.pp3 b/rtdata/profiles/Default.pp3
index 10e34eb9d..03a3d099f 100644
--- a/rtdata/profiles/Default.pp3
+++ b/rtdata/profiles/Default.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=5
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=5
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Highkey-1.pp3 b/rtdata/profiles/Highkey-1.pp3
index e35e54cfc..ffad5dae4 100644
--- a/rtdata/profiles/Highkey-1.pp3
+++ b/rtdata/profiles/Highkey-1.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=5
-Saturation=-10
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=-10
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Natural-1.pp3 b/rtdata/profiles/Natural-1.pp3
index e055627e2..94b353aff 100644
--- a/rtdata/profiles/Natural-1.pp3
+++ b/rtdata/profiles/Natural-1.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=0
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=0
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Natural-2.pp3 b/rtdata/profiles/Natural-2.pp3
index e9a9bed1a..3ef8a8984 100644
--- a/rtdata/profiles/Natural-2.pp3
+++ b/rtdata/profiles/Natural-2.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=5
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=5
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=3;0;0;0.84892086330935235;0.69064748201438808;1;1;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Neutral.pp3 b/rtdata/profiles/Neutral.pp3
index ab0a4e582..9b512ac42 100644
--- a/rtdata/profiles/Neutral.pp3
+++ b/rtdata/profiles/Neutral.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=0
-Saturation=0
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=0
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Punchy-1.pp3 b/rtdata/profiles/Punchy-1.pp3
index e6da63749..d98ef925d 100644
--- a/rtdata/profiles/Punchy-1.pp3
+++ b/rtdata/profiles/Punchy-1.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=-10;-10;120;
[Luminance Curve]
Brightness=0
Contrast=10
-Saturation=5
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=5
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=false
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtdata/profiles/Punchy-2.pp3 b/rtdata/profiles/Punchy-2.pp3
index c8352acaf..bffb76f12 100644
--- a/rtdata/profiles/Punchy-2.pp3
+++ b/rtdata/profiles/Punchy-2.pp3
@@ -1,7 +1,7 @@
[Version]
AppVersion=4.0.9
-Version=302
+Version=303
[General]
Rank=0
@@ -29,13 +29,15 @@ Blue=0;0;100;
[Luminance Curve]
Brightness=0
Contrast=10
-Saturation=5
-AvoidColorClipping=false
-SaturationLimiter=false
-SaturationLimit=50
+Chromaticity=5
+BWtoning=false
+AvoidColorShift=true
+RedAndSkinTonesProtection=0
LCurve=0;
aCurve=0;
bCurve=0;
+ccCurve=0;
+chCurve=0;
[Sharpening]
Enabled=false
@@ -57,10 +59,11 @@ DeconvIterations=30
Enabled=true
Pastels=50
Saturated=50
-PSThreshold=1;75;
+PSThreshold=0;75;
ProtectSkins=false
AvoidColorShift=true
PastSatTog=true
+SkinTonesCurve=0;
[SharpenEdge]
Enabled=false
diff --git a/rtengine/LUT.h b/rtengine/LUT.h
index ad43ab471..9c497a7cc 100644
--- a/rtengine/LUT.h
+++ b/rtengine/LUT.h
@@ -66,6 +66,9 @@
#define LUTu LUT
#include
+#ifndef NDEBUG
+#include
+#endif
template
class LUT {
@@ -165,6 +168,22 @@ public:
T p2 = data[idx + 1]-p1;
return (p1 + p2*diff);
}
+#ifndef NDEBUG
+ // Debug facility ; dump the content of the LUT in a file. No control of the filename is done
+ void dump(Glib::ustring fname) {
+ if (size) {
+ Glib::ustring fname_ = fname + ".xyz"; // TopSolid'Design "plot" file format
+ std::ofstream f (fname_.c_str());
+ f << "$" << std::endl;;
+ for (unsigned int iter=0; iter
+ */
+ // Munsell Lch LUTf : 195 LUT
+ // about 70% data are corrected with significative corrections
+ // almost all data are taken for BG, YR, G excepted a few extreme values with a slight correction
+ // No LUTf for BG and Y : low corrections
+ // Only between 5B and 5PB for L > 40 : under very low corrections for L < 40
+
+ //give hue in function of L and C : Munsell correction
+ LUTf Color::_4P10, Color::_4P20, Color::_4P30, Color::_4P40, Color::_4P50, Color::_4P60;
+ LUTf Color::_1P10, Color::_1P20, Color::_1P30, Color::_1P40, Color::_1P50, Color::_1P60;
+ LUTf Color::_10PB10, Color::_10PB20, Color::_10PB30, Color::_10PB40, Color::_10PB50, Color::_10PB60;
+ LUTf Color::_9PB10, Color::_9PB20, Color::_9PB30, Color::_9PB40, Color::_9PB50, Color::_9PB60, Color::_9PB70, Color::_9PB80;
+ LUTf Color::_75PB10, Color::_75PB20, Color::_75PB30, Color::_75PB40, Color::_75PB50, Color::_75PB60, Color::_75PB70, Color::_75PB80;
+ LUTf Color::_6PB10, Color::_6PB20, Color::_6PB30, Color::_6PB40, Color::_6PB50, Color::_6PB60, Color::_6PB70, Color::_6PB80;
+ LUTf Color::_45PB10, Color::_45PB20, Color::_45PB30, Color::_45PB40, Color::_45PB50, Color::_45PB60, Color::_45PB70, Color::_45PB80;
+ LUTf Color::_3PB10, Color::_3PB20, Color::_3PB30, Color::_3PB40, Color::_3PB50, Color::_3PB60, Color::_3PB70, Color::_3PB80;
+ LUTf Color::_15PB10, Color::_15PB20, Color::_15PB30, Color::_15PB40, Color::_15PB50, Color::_15PB60, Color::_15PB70, Color::_15PB80;
+ LUTf Color::_05PB40, Color::_05PB50, Color::_05PB60, Color::_05PB70, Color::_05PB80;
+ LUTf Color::_10B40, Color::_10B50, Color::_10B60, Color::_10B70, Color::_10B80;
+ LUTf Color::_9B40, Color::_9B50, Color::_9B60, Color::_9B70, Color::_9B80;
+ LUTf Color::_7B40, Color::_7B50, Color::_7B60, Color::_7B70, Color::_7B80;
+ LUTf Color::_5B40, Color::_5B50, Color::_5B60, Color::_5B70, Color::_5B80;
+ LUTf Color::_10YR20, Color::_10YR30, Color::_10YR40, Color::_10YR50, Color::_10YR60, Color::_10YR70, Color::_10YR80, Color::_10YR90;
+ LUTf Color::_85YR20, Color::_85YR30, Color::_85YR40, Color::_85YR50, Color::_85YR60, Color::_85YR70, Color::_85YR80, Color::_85YR90;
+ LUTf Color::_7YR30, Color::_7YR40, Color::_7YR50, Color::_7YR60, Color::_7YR70, Color::_7YR80;
+ LUTf Color::_55YR30, Color::_55YR40, Color::_55YR50, Color::_55YR60, Color::_55YR70, Color::_55YR80, Color::_55YR90;
+ LUTf Color::_4YR30, Color::_4YR40, Color::_4YR50, Color::_4YR60, Color::_4YR70, Color::_4YR80;
+ LUTf Color::_25YR30, Color::_25YR40, Color::_25YR50, Color::_25YR60, Color::_25YR70;
+ LUTf Color::_10R30, Color::_10R40, Color::_10R50, Color::_10R60, Color::_10R70;
+ LUTf Color::_9R30, Color::_9R40, Color::_9R50, Color::_9R60, Color::_9R70;
+ LUTf Color::_7R30, Color::_7R40, Color::_7R50, Color::_7R60, Color::_7R70;
+ LUTf Color::_5R10, Color::_5R20, Color::_5R30;
+ LUTf Color::_25R10, Color::_25R20, Color::_25R30;
+ LUTf Color::_10RP10, Color::_10RP20, Color::_10RP30;
+ LUTf Color::_7G30, Color::_7G40, Color::_7G50, Color::_7G60, Color::_7G70, Color::_7G80;
+ LUTf Color::_5G30, Color::_5G40, Color::_5G50, Color::_5G60, Color::_5G70, Color::_5G80;
+ LUTf Color::_25G30, Color::_25G40, Color::_25G50, Color::_25G60, Color::_25G70, Color::_25G80;
+ LUTf Color::_1G30, Color::_1G40, Color::_1G50, Color::_1G60, Color::_1G70, Color::_1G80;
+ LUTf Color::_10GY30, Color::_10GY40, Color::_10GY50, Color::_10GY60, Color::_10GY70, Color::_10GY80;
+ LUTf Color::_75GY30, Color::_75GY40, Color::_75GY50, Color::_75GY60, Color::_75GY70, Color::_75GY80;
+ LUTf Color::_5GY30, Color::_5GY40, Color::_5GY50, Color::_5GY60, Color::_5GY70, Color::_5GY80;
+
+#ifdef _DEBUG
+ MunsellDebugInfo::MunsellDebugInfo() {
+ reinitValues();
+ }
+ void MunsellDebugInfo::reinitValues() {
+ maxdhue[0]=maxdhue[1]=maxdhue[2]=maxdhue[3]=0.0f;
+ maxdhuelum[0]=maxdhuelum[1]=maxdhuelum[2]=maxdhuelum[3]=0.0f;
+ depass=depassLum=0;
+ }
+#endif
+
+
void Color::init () {
int maxindex = 65536;
@@ -84,6 +144,7 @@ namespace rtengine {
fprintf (f, "%g %g\n", i/255.0, clower (i/255.0, 2.0, 1.0));
fclose (f);*/
+ initMunsell();
}
void Color::cleanup () {
@@ -330,25 +391,26 @@ namespace rtengine {
return (f > epsilonExpInv3) ? f*f*f : (116 * f - 16) * kappaInv;
}
-/* Gamut mapping algorithm
- copyright (c) 2010-2011 Emil Martinec
- solutions to scaling u and v to XYZ paralleliped boundaries
- some equations:
- fu(X,Y,Z) = 4 X/(X + 15 Y + 3 Z);
- fv(X,Y,Z) = 9 Y/(X + 15 Y + 3 Z);
-
- take the plane spanned by X=a*Xr+b*Xg+c*Xb etc with one of a,b,c equal to 0 or 1,
- and itersect with the line u0+lam*u, or in other words solve
-
- u0+lam*u=fu(X,Y,Z)
- v0+lam*v=fv(X,Y,Z)
-
- the value of lam is the scale factor that takes the color to the gamut boundary
-
- columns of the matrix p=xyz_rgb are RGB tristimulus primaries in XYZ
- c is the color fixed on the boundary; and m=0 for c=0, m=1 for c=255
-*/
-
+ /*
+ * Gamut mapping algorithm
+ * Copyright (c) 2010-2011 Emil Martinec
+ *
+ * Solutions to scaling u and v to XYZ paralleliped boundaries
+ * Some equations:
+ *
+ * fu(X,Y,Z) = 4 X/(X + 15 Y + 3 Z);
+ * fv(X,Y,Z) = 9 Y/(X + 15 Y + 3 Z);
+ *
+ * take the plane spanned by X=a*Xr+b*Xg+c*Xb etc with one of a,b,c equal to 0 or 1,
+ * and itersect with the line u0+lam*u, or in other words solve
+ *
+ * u0+lam*u=fu(X,Y,Z)
+ * v0+lam*v=fv(X,Y,Z)
+ *
+ * The value of lam is the scale factor that takes the color to the gamut boundary
+ * columns of the matrix p=xyz_rgb are RGB tristimulus primaries in XYZ
+ * c is the color fixed on the boundary; and m=0 for c=0, m=1 for c=255
+ */
void Color::gamutmap(float &X, float &Y, float &Z, const double p[3][3])
{
float u = 4*X/(X+15*Y+3*Z)-u0;
@@ -383,4 +445,2023 @@ namespace rtengine {
X = (9*u*Y)/(4*v);
Z = (12 - 3*u - 20*v)*Y/(4*v);
}
+
+ /*
+ * AllMunsellLch correction
+ * Copyright (c) 2012 Jacques Desmis
+ *
+ * This function corrects the color (hue) for changes in chromaticity and luminance
+ * to use in a "for" or "do while" statement
+ *
+ * Parameters:
+ * bool lumaMuns : true => luminance correction (for delta L > 10) and chroma correction ; false : only chroma
+ * float Lprov1 , Loldd : luminance after and before
+ * float HH: hue before
+ * float Chprov1, CC : chroma after and before
+ * float coorectionHuechroma : correction Hue for chromaticity (saturation)
+ * float correctlum : correction Hue for luminance (brigtness, contrast,...)
+ * MunsellDebugInfo* munsDbgInfo: (Debug target only) object to collect information.
+ */
+#ifdef _DEBUG
+ void Color::AllMunsellLch(bool lumaMuns, float Lprov1,float Loldd,float HH,float Chprov1,float CC,float &correctionHuechroma,float &correctlum, MunsellDebugInfo* munsDbgInfo)
+#else
+ void Color::AllMunsellLch(bool lumaMuns, float Lprov1, float Loldd, float HH, float Chprov1, float CC, float &correctionHuechroma, float &correctlum)
+#endif
+ {
+
+ bool contin1,contin2;
+ float correctionHue=0.0,correctionHueLum=0.0;
+ float correctlumprov=0.0;
+ float correctlumprov2=0.0;
+ bool correctL=false;
+ float huelimit[8]={-2.48,-0.55,0.44,1.52,1.87,3.09,-0.27,0.44};//limits hue of blue-purple, red-yellow, green-yellow, red-purple
+ if(CC >= 6.0 && CC < 140) { //if C > 140 we say C=140 (only in Prophoto ...with very large saturation)
+ if (Chprov1 > 140) Chprov1=139; //limits of LUTf
+ if (Chprov1 < 6) Chprov1=6;
+ for(int zo=1;zo<=4;zo++) {
+ if(HH>huelimit[2*zo-2] && HHmaxdhue[idx] = MAX(munsDbgInfo->maxdhue[idx], absCorrectionHue);
+}
+ }
+ if(absCorrectionHue > 0.45)
+#pragma omp atomic
+ munsDbgInfo->depass++; //verify if no bug in calculation
+#endif
+ correctionHuechroma=correctionHue; //preserve
+ if(lumaMuns) {
+ if(correctL) {
+ //for Munsell luminance correction
+ correctlumprov=correctionHueLum;
+ contin1=true;
+ correctL=false;
+ }
+ correctionHueLum=0.0;
+ correctionHue=0.0;
+ if(fabs(Lprov1-Loldd) > 6.0) {
+ // correction if delta L significative..Munsell luminance
+ MunsellLch (Loldd, HH,Chprov1, Chprov1, correctionHue, zo, correctionHueLum, correctL);
+
+ if(correctL) {
+ correctlumprov2=correctionHueLum;
+ contin2=true;
+ correctL=false;
+ }
+ correctionHueLum=0.0;
+
+ if(contin1==true && contin2==true)
+ correctlum=correctlumprov2-correctlumprov;
+#ifdef _DEBUG
+ float absCorrectLum = fabs(correctlum);
+ if(correctlum !=0.0) {
+ int idx=zo-1;
+#pragma omp critical (maxdhuelum)
+{
+ munsDbgInfo->maxdhuelum[idx] = MAX(munsDbgInfo->maxdhuelum[idx],absCorrectLum);
+}
+ }
+ if(absCorrectLum > 0.35)
+#pragma omp atomic
+ munsDbgInfo->depassLum++; //verify if no bug in calculation
+#endif
+ }
+ }
+ }
+ }
+
+ }
+
+#ifdef _DEBUG
+ if (correctlum < -0.35f) correctlum =-0.35f;
+ else if(correctlum > 0.35f) correctlum = 0.35f;
+ if (correctionHuechroma<-0.45f) correctionHuechroma=-0.45f;
+ else if(correctionHuechroma> 0.45f) correctionHuechroma= 0.45f;
+#endif
+
+ }
+
+ /*
+ * GamutLchonly correction
+ * Copyright (c)2012 Jacques Desmis and Jean-Christophe Frisch
+ *
+ * This function puts the data (Lab) in the gamut of "working profile":
+ * it returns the corrected values of the chromaticity and luminance
+ *
+ * float HH : hue
+ * float Lprov1 : input luminance value, sent back corrected
+ * float Chprov1: input chroma value, sent back corrected
+ * float R,G,B : red, green and blue value of the corrected color
+ * double wip : working profile
+ * bool isHLEnabled : if "highlight reconstruction " is enabled
+ * float coef : a float number between [0.95 ; 1.0[... the nearest it is from 1.0, the more precise it will be... and the longer too as more iteration will be necessary)
+ * bool neg and moreRGB : only in DEBUG mode to calculate iterations for negatives values and > 65535
+ */
+#ifdef _DEBUG
+ void Color::gamutLchonly (float HH, float &Lprov1, float &Chprov1, float &R, float &G, float &B, double wip[3][3], const bool isHLEnabled, const float lowerCoef, const float higherCoef, bool &neg, bool &more_rgb)
+#else
+ void Color::gamutLchonly (float HH, float &Lprov1, float &Chprov1, float &R, float &G, float &B, double wip[3][3], const bool isHLEnabled, const float lowerCoef, const float higherCoef)
+#endif
+ {
+
+ bool inGamut;
+#ifdef _DEBUG
+ neg=false, more_rgb=false;
+#endif
+ do {
+ inGamut=true;
+
+ //Lprov1=LL;
+ float aprov1=Chprov1*cos(HH);
+ float bprov1=Chprov1*sin(HH);
+
+ //conversion Lab RGB to limit Lab values - this conversion is useful before Munsell correction
+ float fy = (0.00862069f *Lprov1 )+ 0.137932f;
+ float fx = (0.002f * aprov1) + fy;
+ float fz = fy - (0.005f * bprov1);
+
+ float x_ = 65535.0f * f2xyz(fx)*D50x;
+ float y_ = 65535.0f * f2xyz(fy);
+ float z_ = 65535.0f * f2xyz(fz)*D50z;
+ xyz2rgb(x_,y_,z_,R,G,B,wip);
+
+ // gamut control before saturation to put Lab values in future gamut, but not RGB
+ if (R<0.0f || G<0.0f || B<0.0f) {
+#ifdef _DEBUG
+ neg=true;
+#endif
+ if (Lprov1 < 0.01f)
+ Lprov1 = 0.05f;
+ Chprov1 *= higherCoef; // decrease the chromaticity value
+ if (Chprov1 <= 3.0f)
+ Lprov1 += lowerCoef;
+ inGamut = false;
+ }
+ // if "highlight reconstruction" is enabled, don't control Gamut
+ else if ((!isHLEnabled) && (R>65534.5f || G>65534.5f || B>65534.5f)) {
+#ifdef _DEBUG
+ more_rgb=true;
+#endif
+ if (Lprov1 > 99.99f)
+ Lprov1 = 99.8f;
+ Chprov1 *= higherCoef;
+ if (Chprov1 <= 3.0f)
+ Lprov1 -= lowerCoef;
+ inGamut = false;
+ }
+ }
+ while (!inGamut);
+ //end first gamut control
+ }
+
+
+ /*
+ * LabGamutMunsell
+ * Copyright (c) 2012 Jacques Desmis
+ *
+ * This function is the overall Munsell's corrections, but only on global statement: I think it's better to use local statement with AllMunsellLch
+ * not for use in a "for" or "do while" loop
+ * they are named accordingly : gamutLchonly and AllMunsellLch
+ * it can be used before and after treatment (saturation, gamma, luminance, ...)
+ *
+ * Parameters:
+ * Labimage *lab : RT Lab data
+ * float *Lold : luminance before - data: i*width + j
+ * float *Cold : chrominance before - data: i*width + j
+ * bool corMuns : performs Munsell correction
+ * bool lumaMuns : (used only if corMuns=true)
+ * true: apply luma + chroma Munsell correction if delta L > 10;
+ * false: only chroma correction only
+ * bool gamut : performs gamutLch
+ * Glib::ustring &working: working profile's name
+ * bool multiThread : parallelize the loop
+ */
+ void Color::LabGamutMunsell(LabImage *lab, float *Lold, float *Cold, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const Glib::ustring &working, bool multiThread ) {
+#ifdef _DEBUG
+ MyTime t1e,t2e;
+ t1e.set();
+ int negat=0, moreRGB=0;
+ MunsellDebugInfo* MunsDebugInfo=NULL;
+ if (corMunsell)
+ MunsDebugInfo = new MunsellDebugInfo();
+
+ #pragma omp parallel default(shared) firstprivate(MunsDebugInfo) reduction(+: negat, moreRGB) if (multiThread)
+#else
+ #pragma omp parallel default(shared) if (multiThread)
+#endif
+ {
+
+ //unsigned int N = lab->W*lab->H;
+ int width = lab->W, height = lab->H;
+ TMatrix wiprof = iccStore->workingSpaceInverseMatrix (working);
+ double wip[3][3] = {
+ {wiprof[0][0],wiprof[0][1],wiprof[0][2]},
+ {wiprof[1][0],wiprof[1][1],wiprof[1][2]},
+ {wiprof[2][0],wiprof[2][1],wiprof[2][2]}
+ };
+ float correctlum=0.0;
+ float correctionHuechroma=0.0;
+
+ #pragma omp for schedule(dynamic, 10)
+ for (int i=0; iL[i][j]/327.68f;
+ float CC=sqrt(SQR(lab->a[i][j]/327.68f) + SQR(lab->b[i][j]/327.68f));
+ float HH=atan2(lab->b[i][j],lab->a[i][j]);
+ float Chprov1=CC;
+ float Lprov1=LL;
+ float Loldd, Coldd;
+ if(gamut) {
+ bool neg, more_rgb;
+ float R, G, B;
+
+ //gamut control : Lab values are in gamut
+#ifdef _DEBUG
+ gamutLchonly(HH, Lprov1, Chprov1, R, G, B, wip, isHLEnabled, 0.4f, 0.95f, neg, more_rgb);
+#else
+ gamutLchonly(HH, Lprov1, Chprov1, R, G, B, wip, isHLEnabled, 0.4f, 0.95f);
+#endif
+
+#ifdef _DEBUG
+ if(neg) negat++;
+ if(more_rgb) moreRGB++;
+#endif
+ }
+
+ Loldd = Lold[i*width + j];
+ Coldd = Cold[i*width + j];
+ lab->L[i][j] = Lprov1*327.68f;
+ correctionHuechroma = 0.0;
+ correctlum = 0.0;
+
+ if(corMunsell)
+#ifdef _DEBUG
+ AllMunsellLch(lumaMuns, Lprov1, Loldd, HH, Chprov1, Coldd, correctionHuechroma, correctlum, MunsDebugInfo);
+#else
+ AllMunsellLch(lumaMuns, Lprov1, Loldd, HH, Chprov1, Coldd, correctionHuechroma, correctlum);
+#endif
+
+ HH+=correctlum; //hue Munsell luminance correction
+
+ correctlum = 0.0f;
+ lab->a[i][j] = Chprov1*cos(HH+correctionHuechroma)*327.68f;
+ lab->b[i][j] = Chprov1*sin(HH+correctionHuechroma)*327.68f;
+
+ }
+ } // end of parallelization
+
+#ifdef _DEBUG
+ t2e.set();
+ if (settings->verbose) {
+ printf("Color::LabGamutMunsell (correction performed in %d usec):\n", t2e.etime(t1e));
+ printf(" Gamut : G1negat=%iiter G165535=%iiter \n",negat,moreRGB);
+ if (MunsDebugInfo) {
+ printf(" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad depass=%i\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass);
+ printf(" Munsell luminance : MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad depass=%i\n", MunsDebugInfo->maxdhuelum[0] ,MunsDebugInfo->maxdhuelum[1], MunsDebugInfo->maxdhuelum[2], MunsDebugInfo->maxdhuelum[3], MunsDebugInfo->depassLum);
+ }
+ else {
+ printf(" Munsell correction wasn't requested\n");
+ }
+ }
+ if (MunsDebugInfo)
+ delete MunsDebugInfo;
+#endif
+
+ }
+
+ /*
+ * MunsellLch correction
+ * Copyright (c) 2012 Jacques Desmis
+ *
+ * Find the right LUT and calculate the correction
+ */
+ void Color::MunsellLch (float lum, float hue, float chrom, float memChprov, float &correction, int zone, float &lbe, bool &correctL) {
+
+ int x = int(memChprov);
+ int y = int(chrom);
+
+ //begin PB correction + sky
+ if(zone==1) {
+ if(lum > 5.0) {
+ if(lum <15.0) {
+ if( (hue >= (_15PB10[x] - 0.035)) && (hue < (_15PB10[x] + 0.052) && x<=45)) {if(y>49) y=49;correction = _15PB10[y] - _15PB10[x] ;lbe=_15PB10[y];correctL=true;}
+ else if (( hue>=( _3PB10[x] -0.052)) && (hue < (_45PB10[x] + _3PB10[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _3PB10[y] - _3PB10[x]; lbe =_3PB10[y];correctL=true;}
+ else if (( hue>=(_45PB10[x] + _3PB10[x])/2.0) && (hue < (_45PB10[x] +0.052)) && x <= 85) {if(y>89) y=89;correction = _45PB10[y] - _45PB10[x] ;lbe=_45PB10[y];correctL=true;}
+ else if (( hue>=(_6PB10[x] -0.052) && (hue < (_6PB10[x] + _75PB10[x])/2.0))) {correction = _6PB10[y] - _6PB10[x] ;lbe=_6PB10[y];correctL=true;}
+ else if (( hue>=(_6PB10[x] + _75PB10[x])/2.0) && (hue < (_9PB10[x] + _75PB10[x])/2.0)) {correction = _75PB10[y] - _75PB10[x] ;lbe=_75PB10[y];correctL=true;}
+ else if (( hue>=(_9PB10[x] + _75PB10[x])/2.0) && (hue < (_9PB10[x] + _10PB10[x])/2.0)) {correction = _9PB10[y] - _9PB10[x] ; lbe=_9PB10[y];correctL=true;}
+ else if (( hue>=(_10PB10[x] + _9PB10[x])/2.0) && (hue < (_1P10[x] + _10PB10[x])/2.0)) {correction = _10PB10[y] - _10PB10[x] ;lbe=_10PB10[y];correctL=true;}
+ else if (( hue>=(_10PB10[x] + _1P10[x])/2.0) && (hue < (_1P10[x] + _4P10[x])/2.0)) {correction = _1P10[y] - _1P10[x];lbe=_1P10[y];correctL=true;}
+ else if (( hue>=(_1P10[x] + _4P10[x])/2.0) && (hue < (0.035 + _4P10[x])/2.0)) {correction = _4P10[y] - _4P10[x] ;lbe=_4P10[y];correctL=true;}
+ }
+ else if (lum <25.0) {
+ if( (hue >= (_15PB20[x] - 0.035)) && (hue < (_15PB20[x] + _3PB20[x])/2.0) && x<=85) {if(y>89) y=89;correction = _15PB20[y] - _15PB20[x] ;lbe= _15PB20[y];correctL=true;}
+ else if (( hue>=(_15PB20[x] + _3PB20[x])/2.0) && (hue < (_45PB20[x] + _3PB20[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _3PB20[y] - _3PB20[x] ;lbe= _3PB20[y];correctL=true;}
+ else if (( hue>=(_45PB20[x] + _3PB20[x])/2.0) && (hue < ( _45PB20[x] + 0.052)) && x <= 85) {if(y>89) y=89;correction = _45PB20[y] - _45PB20[x] ;lbe=_45PB20[y];correctL=true;}
+ else if (( hue>=(_45PB20[x] + 0.052)) && (hue < (_6PB20[x] + _75PB20[x])/2.0)) {correction = _6PB20[y] - _6PB20[x];lbe=_6PB20[y];correctL=true;}
+ else if (( hue>=(_6PB20[x] + _75PB20[x])/2.0) && (hue < (_9PB20[x] + _75PB20[x])/2.0)) {correction = _75PB20[y] - _75PB20[x] ;lbe=_75PB20[y];correctL=true;}
+ else if (( hue>=(_9PB20[x] + _75PB20[x])/2.0) && (hue < (_9PB20[x] + _10PB20[x])/2.0)) {correction = _9PB20[y] - _9PB20[x] ;lbe= _9PB20[y];correctL=true; }
+ else if (( hue>=(_10PB20[x] + _9PB20[x])/2.0) && (hue < (_1P20[x] + _10PB20[x])/2.0)) {correction = _10PB20[y] - _10PB20[x] ;lbe= _10PB20[y];correctL=true;}
+ else if (( hue>=(_10PB20[x] + _1P20[x])/2.0) && (hue < (_1P20[x] + _4P20[x])/2.0)) {correction = _1P20[y] - _1P20[x] ; lbe=_1P20[y];correctL=true;}
+ else if (( hue>=(_1P20[x] + _4P20[x])/2.0) && (hue < (0.035 + _4P20[x])/2.0)) {correction = _4P20[y] - _4P20[x] ; lbe=_4P20[y];correctL=true;}
+ }
+ else if (lum <35.0) {
+ if( (hue >= (_15PB30[x] - 0.035)) && (hue < (_15PB30[x] + _3PB30[x])/2.0) && x<=85 ) {if(y>89) y=89;correction = _15PB30[y] - _15PB30[x] ;lbe=_15PB30[y];correctL=true;}
+ else if (( hue>=(_15PB30[x] + _3PB30[x])/2.0) && (hue < (_45PB30[x] + _3PB30[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _3PB30[y] - _3PB30[x] ;lbe=_3PB30[y];correctL=true;}
+ else if (( hue>=(_45PB30[x] + _3PB30[x])/2.0) && (hue < (_45PB30[x]+0.052)) && x <= 85) {if(y>89) y=89;correction = _45PB30[y] - _45PB30[x] ;lbe= _45PB30[y];correctL=true;}
+ else if (( hue>=( _45PB30[x]+ 0.052)) && (hue < (_6PB30[x] + _75PB30[x])/2.0)) {correction = _6PB30[y] - _6PB30[x] ; lbe=_6PB30[y];correctL=true;}
+ else if (( hue>=(_6PB30[x] + _75PB30[x])/2.0) && (hue < (_9PB30[x] + _75PB30[x])/2.0)) {correction = _75PB30[y] - _75PB30[x] ;lbe= _75PB30[y] ;correctL=true;}
+ else if (( hue>=(_9PB30[x] + _75PB30[x])/2.0) && (hue < (_9PB30[x] + _10PB30[x])/2.0)) {correction = _9PB30[y] - _9PB30[x] ;lbe=_9PB30[y]; correctL=true;}
+ else if (( hue>=(_10PB30[x] + _9PB30[x])/2.0) && (hue < (_1P30[x] + _10PB30[x])/2.0)) {correction = _10PB30[y] - _10PB30[x] ;lbe=_10PB30[y];correctL=true;}
+ else if (( hue>=(_10PB30[x] + _1P30[x])/2.0) && (hue < (_1P30[x] + _4P30[x])/2.0)) {correction = _1P30[y] - _1P30[x] ;lbe=_1P30[y];correctL=true; }
+ else if (( hue>=(_1P30[x] + _4P30[x])/2.0) && (hue < (0.035 + _4P30[x])/2.0)) {correction = _4P30[y] - _4P30[x] ;lbe=_4P30[y];correctL=true;}
+ }
+ else if (lum <45.0) {
+ if( (hue <= (_05PB40[x] + _15PB40[x])/2.0) && (hue > (_05PB40[x] + _10B40[x])/2.0) && x<75 ) {if(y>75) y=75; correction = _05PB40[y] - _05PB40[x] ;lbe=_05PB40[y];correctL=true;}
+ else if( (hue <= (_05PB40[x] + _10B40[x])/2.0) && (hue >(_10B40[x] + _9B40[x])/2.0) && x<70 ) {if(y>70) y=70;correction = _10B40[y] - _10B40[x] ;lbe=_10B40[y];correctL=true;}
+ else if( (hue <= (_10B40[x] + _9B40[x])/2.0) && (hue >(_9B40[x] + _7B40[x])/2.0) && x<70 ) {if(y>70) y=70;correction = _9B40[y] - _9B40[x] ;lbe=_9B40[y];correctL=true;}
+ else if( (hue <= (_9B40[x] + _7B40[x])/2.0) && (hue >(_5B40[x] + _7B40[x])/2.0) && x<70 ) {if(y>70) y=70;correction = _7B40[y] - _7B40[x] ;lbe= _7B40[y];correctL=true;}
+ else if (( hue<=(_5B40[x] + _7B40[x])/2.0) && (hue > (_5B40[x]-0.035)) && x < 70) {if(y>70) y=70; correction = _5B40[y] - _5B40[x] ;lbe= _5B40[y];correctL=true;} //
+
+ else if( (hue >= (_15PB40[x] - 0.035)) && (hue < (_15PB40[x] + _3PB40[x])/2.0) && x<=85 ) {if(y>89) y=89;correction = _15PB40[y] - _15PB40[x] ; lbe= _15PB40[y];correctL=true;}
+ else if (( hue>=(_15PB40[x] + _3PB40[x])/2.0) && (hue < (_45PB40[x] + _3PB40[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _3PB40[y] - _3PB40[x] ;lbe=_3PB40[y];correctL=true;}
+ else if (( hue>=(_45PB40[x] + _3PB40[x])/2.0) && (hue < (_45PB40[x]+0.052)) && x <= 85) {if(y>89) y=89;correction = _45PB40[y] - _45PB40[x] ;lbe=_45PB40[y] ;correctL=true;}
+ else if (( hue>=(_45PB40[x]+0.052)) && (hue < (_6PB40[x] + _75PB40[x])/2.0)) {correction = _6PB40[y] - _6PB40[x] ;lbe=_6PB40[y];correctL=true; }
+ else if (( hue>=(_6PB40[x] + _75PB40[x])/2.0) && (hue < (_9PB40[x] + _75PB40[x])/2.0)) {correction = _75PB40[y] - _75PB40[x] ; lbe=_75PB40[y];correctL=true;}
+ else if (( hue>=(_9PB40[x] + _75PB40[x])/2.0) && (hue < (_9PB40[x] + _10PB40[x])/2.0)) {correction = _9PB40[y] - _9PB40[x] ;lbe= _9PB40[y]; correctL=true;}
+ else if (( hue>=(_10PB40[x] + _9PB40[x])/2.0) && (hue < (_1P40[x] + _10PB40[x])/2.0)) {correction = _10PB40[y] - _10PB40[x] ;lbe=_10PB40[y];correctL=true;}
+ else if (( hue>=(_10PB40[x] + _1P40[x])/2.0) && (hue < (_1P40[x] + _4P40[x])/2.0)) {correction = _1P40[y] - _1P40[x] ;lbe=_1P40[y];correctL=true;}
+ else if (( hue>=(_1P40[x] + _4P40[x])/2.0) && (hue < (0.035 + _4P40[x])/2.0)) {correction = _4P40[y] - _4P40[x] ;lbe= _4P40[y];correctL=true;}
+ }
+ else if (lum <55.0) {
+ if( (hue <= (_05PB50[x] + _15PB50[x])/2.0) && (hue > (_05PB50[x] + _10B50[x])/2.0) && x<79 ) {if(y>79) y=79; correction = _05PB50[y] - _05PB50[x] ;lbe= _05PB50[y];correctL=true;}
+ else if( (hue <= (_05PB50[x] + _10B50[x])/2.0) && (hue >(_10B50[x] + _9B50[x])/2.0) && x<79 ) {if(y>79) y=79;correction = _10B50[y] - _10B50[x] ;lbe=_10B50[y];correctL=true;}
+ else if( (hue <= (_10B50[x] + _9B50[x])/2.0) && (hue >(_9B50[x] + _7B50[x])/2.0) && x<79 ) {if(y>79) y=79;correction = _9B50[y] - _9B50[x] ;lbe=_9B50[y];correctL=true;}
+ else if( (hue <= (_9B50[x] + _7B50[x])/2.0) && (hue >(_5B50[x] + _7B50[x])/2.0) && x<79 ) {if(y>79) y=79;correction = _7B50[y] - _7B50[x] ;lbe=_7B50[y];correctL=true;}
+ else if (( hue<=(_5B50[x] + _7B50[x])/2.0) && (hue > (_5B50[x]-0.035)) && x < 79) {if(y>79) y=79; correction = _5B50[y] - _5B50[x] ;lbe=_5B50[y];correctL=true; } //
+
+ else if( (hue >= (_15PB50[x] - 0.035)) && (hue < (_15PB50[x] + _3PB50[x])/2.0) && x<=85 ) {if(y>89) y=89;correction = _15PB50[y] - _15PB50[x] ; lbe= _15PB50[y];correctL=true;}
+ else if (( hue>=(_15PB50[x] + _3PB50[x])/2.0) && (hue < (_45PB50[x] + _3PB50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _3PB50[y] - _3PB50[x] ;lbe=_3PB50[y];correctL=true;}
+ else if (( hue>=(_45PB50[x] + _3PB50[x])/2.0) && (hue < (_6PB50[x] + _45PB50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _45PB50[y] - _45PB50[x] ;lbe=_45PB50[y];correctL=true; }
+ else if (( hue>=(_6PB50[x] + _45PB50[x])/2.0) && (hue < (_6PB50[x] + _75PB50[x])/2.0) && x <=85) {if(y>89) y=89;correction = _6PB50[y] - _6PB50[x] ;lbe=_6PB50[y];correctL=true;}
+ else if (( hue>=(_6PB50[x] + _75PB50[x])/2.0) && (hue < (_9PB50[x] + _75PB50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _75PB50[y] - _75PB50[x] ;lbe=_75PB50[y];correctL=true;}
+ else if (( hue>=(_9PB50[x] + _75PB50[x])/2.0) && (hue < (_9PB50[x] + _10PB50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _9PB50[y] - _9PB50[x] ;lbe=_9PB50[y];correctL=true;}
+ else if (( hue>=(_10PB50[x] + _9PB50[x])/2.0) && (hue < (_1P50[x] + _10PB50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _10PB50[y] - _10PB50[x] ;lbe=_10PB50[y];correctL=true;}
+ else if (( hue>=(_10PB50[x] + _1P50[x])/2.0) && (hue < (_1P50[x] + _4P50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _1P50[y] - _1P50[x] ;lbe=_1P50[y];correctL=true; }
+ else if (( hue>=(_1P50[x] + _4P50[x])/2.0) && (hue < (0.035 + _4P50[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _4P50[y] - _4P50[x] ;lbe=_4P50[y];correctL=true;}
+ }
+ else if (lum <65.0) {
+ if( (hue <= (_05PB60[x] + _15PB60[x])/2.0) && (hue > (_05PB60[x] + _10B60[x])/2.0) && x<79 ) {if(y>79) y=79; correction = _05PB60[y] - _05PB60[x] ;lbe=_05PB60[y];correctL=true;}
+ else if( (hue <= (_05PB60[x] + _10B60[x])/2.0) && (hue >(_10B60[x] + _9B60[x])/2.0) && x<79 ) {if(y>79) y=79;correction = _10B60[y] - _10B60[x] ;lbe= _10B60[y];correctL=true;}
+ else if( (hue <= (_10B60[x] + _9B60[x])/2.0) && (hue >(_9B60[x] + _7B60[x])/2.0) && x<79 ) {if(y>79) y=79;correction = _9B60[y] - _9B60[x] ;lbe=_9B60[y];correctL=true;}
+ else if( (hue <= (_9B60[x] + _7B60[x])/2.0) && (hue >(_5B60[x] + _7B60[x])/2.0) && x<79 ) {if(y>79) y=79;correction = _7B60[y] - _7B60[x] ;lbe= _7B60[y];correctL=true;}
+ else if (( hue<=(_5B60[x] + _7B60[x])/2.0) && (hue > (_5B60[x]-0.035)) && x < 79) {if(y>79) y=79; correction = _5B60[y] - _5B60[x] ;lbe= _5B60[y];correctL=true;} //
+
+ else if( (hue >= (_15PB60[x] - 0.035)) && (hue < (_15PB60[x] + _3PB60[x])/2.0) && x<=85 ) {if(y>89) y=89;correction = _15PB60[y] - _15PB60[x] ;lbe=_15PB60[y];correctL=true; }
+ else if (( hue>=(_15PB60[x] + _3PB60[x])/2.0) && (hue < (_45PB60[x] + _3PB60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _3PB60[y] - _3PB60[x] ;lbe=_3PB60[y];correctL=true;}
+ else if (( hue>=(_45PB60[x] + _3PB60[x])/2.0) && (hue < (_6PB60[x] + _45PB60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _45PB60[y] - _45PB60[x] ;lbe=_45PB60[y];correctL=true;}
+ else if (( hue>=(_6PB60[x] + _45PB60[x])/2.0) && (hue < (_6PB60[x] + _75PB60[x])/2.0) && x <=85) {if(y>89) y=89;correction = _6PB60[y] - _6PB60[x] ;lbe= _6PB60[y];correctL=true;}
+ else if (( hue>=(_6PB60[x] + _75PB60[x])/2.0) && (hue < (_9PB60[x] + _75PB60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _75PB60[y] - _75PB60[x] ;lbe= _75PB60[y];correctL=true;}
+ else if (( hue>=(_9PB60[x] + _75PB60[x])/2.0) && (hue < (_9PB60[x] + _10PB60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _9PB60[y] - _9PB60[x] ;lbe= _9PB60[y];correctL=true;}
+ else if (( hue>=(_10PB60[x] + _9PB60[x])/2.0) && (hue < (_1P60[x] + _10PB60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _10PB60[y] - _10PB60[x] ;lbe=_10PB60[y]; correctL=true;}
+ else if (( hue>=(_10PB60[x] + _1P60[x])/2.0) && (hue < (_1P60[x] + _4P60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _1P60[y] - _1P60[x] ; lbe= _1P60[y];correctL=true;}
+ else if (( hue>=(_1P60[x] + _4P60[x])/2.0) && (hue < (0.035 + _4P60[x])/2.0) && x <= 85) {if(y>89) y=89;correction = _4P60[y] - _4P60[x] ;lbe=_4P60[y];correctL=true; }
+ }
+ else if (lum < 75.0) {
+ if( (hue <= (_05PB70[x] + _15PB70[x])/2.0) && (hue > (_05PB70[x] + _10B70[x])/2.0) && x<50 ) {if(y>49) y=49; correction = _05PB70[y] - _05PB70[x] ;lbe=_05PB70[y];correctL=true;}
+ else if( (hue <= (_05PB70[x] + _10B70[x])/2.0) && (hue >(_10B70[x] + _9B70[x])/2.0) && x<50 ) {if(y>49) y=49;correction = _10B70[y] - _10B70[x] ;lbe=_10B70[y];correctL=true;}
+ else if( (hue <= (_10B70[x] + _9B70[x])/2.0) && (hue >(_9B70[x] + _7B70[x])/2.0) && x<50 ) {if(y>49) y=49;correction = _9B70[y] - _9B70[x] ;lbe= _9B70[y];correctL=true;}
+ else if( (hue <= (_9B70[x] + _7B70[x])/2.0) && (hue >(_5B70[x] + _7B70[x])/2.0) && x<50 ) {if(y>49) y=49;correction = _7B70[y] - _7B70[x] ;lbe=_7B70[y];correctL=true;}
+ else if (( hue<=(_5B70[x] + _7B70[x])/2.0) && (hue > (_5B70[x]-0.035)) && x < 50) {if(y>49) y=49; correction = _5B70[y] - _5B70[x] ;lbe= _5B70[y];correctL=true;} //
+
+ else if( (hue >= (_15PB70[x] - 0.035)) && (hue < (_15PB70[x] + _3PB70[x])/2.0) && x<50 ) {if(y>49) y=49;correction = _15PB70[y] - _15PB70[x] ;lbe=_15PB70[y];correctL=true; }
+ else if (( hue>=(_45PB70[x] + _3PB70[x])/2.0) && (hue < (_6PB70[x] + _45PB70[x])/2.0) && x < 50) {if(y>49) y=49;correction = _45PB70[y] - _45PB70[x] ;lbe=_45PB70[y];correctL=true;}
+ else if (( hue>=(_6PB70[x] + _45PB70[x])/2.0) && (hue < (_6PB70[x] + _75PB70[x])/2.0) && x <50) {if(y>49) y=49;correction = _6PB70[y] - _6PB70[x] ;lbe=_6PB70[y];correctL=true;}
+ else if (( hue>=(_6PB70[x] + _75PB70[x])/2.0) && (hue < (_9PB70[x] + _75PB70[x])/2.0) && x <50) {if(y>49) y=49;correction = _75PB70[y] - _75PB70[x] ;lbe=_75PB70[y];correctL=true; }
+ else if (( hue>=(_9PB70[x] + _75PB70[x])/2.0) && (hue < (_9PB70[x] + 0.035)) && x <50) {if(y>49) y=49;correction = _9PB70[y] - _9PB70[x] ;lbe=_9PB70[y];correctL=true;}
+ }
+ else if (lum < 85.0) {
+ if( (hue <= (_05PB80[x] + _15PB80[x])/2.0) && (hue > (_05PB80[x] + _10B80[x])/2.0) && x<40 ) {if(y>39) y=39; correction = _05PB80[y] - _05PB80[x] ;lbe=_05PB80[y] ;correctL=true;}
+ else if( (hue <= (_05PB80[x] + _10B80[x])/2.0) && (hue >(_10B80[x] + _9B80[x])/2.0) && x<40 ) {if(y>39) y=39;correction = _10B80[y] - _10B80[x] ;lbe=_10B80[y];correctL=true;}
+ else if( (hue <= (_10B80[x] + _9B80[x])/2.0) && (hue >(_9B80[x] + _7B80[x])/2.0) && x<40 ) {if(y>39) y=39;correction = _9B80[y] - _9B80[x] ;lbe= _9B80[y];correctL=true;}
+ else if( (hue <= (_9B80[x] + _7B80[x])/2.0) && (hue >(_5B80[x] + _7B80[x])/2.0) && x<50 ) {if(y>49) y=49;correction = _7B80[y] - _7B80[x] ;lbe=_7B80[y];correctL=true;}
+ else if (( hue<=(_5B80[x] + _7B80[x])/2.0) && (hue > (_5B80[x]-0.035)) && x < 50) {if(y>49) y=49; correction = _5B80[y] - _5B80[x] ; lbe=_5B80[y];correctL=true;} //
+
+ else if( (hue >= (_15PB80[x] - 0.035)) && (hue < (_15PB80[x] + _3PB80[x])/2.0) && x<50 ) {if(y>49) y=49;correction = _15PB80[y] - _15PB80[x] ; lbe=_15PB80[y];correctL=true;}
+ else if (( hue>=(_45PB80[x] + _3PB80[x])/2.0) && (hue < (_6PB80[x] + _45PB80[x])/2.0) && x < 50) {if(y>49) y=49;correction = _45PB80[y] - _45PB80[x] ;lbe= _45PB80[y];correctL=true;}
+ else if (( hue>=(_6PB80[x] + _45PB80[x])/2.0) && (hue < (_6PB80[x] + _75PB80[x])/2.0) && x <50) {if(y>49) y=49;correction = _6PB80[y] - _6PB80[x] ;lbe=_6PB80[y];correctL=true;}
+ else if (( hue>=(_6PB80[x] + _75PB80[x])/2.0) && (hue < (_9PB80[x] + _75PB80[x])/2.0) && x <50) {if(y>49) y=49;correction = _75PB80[y] - _75PB80[x] ;lbe=_75PB80[y];correctL=true; }
+ else if (( hue>=(_9PB80[x] + _75PB80[x])/2.0) && (hue < (_9PB80[x] + 0.035)) && x <50) {if(y>49) y=49;correction = _9PB80[y] - _9PB80[x] ;lbe=_9PB80[y]; correctL=true;}
+ }
+ }
+ }
+ // end PB correction
+
+ //red yellow correction
+ else if(zone==2) {
+ if(lum > 15.0) {
+ if(lum < 25.0) {
+ if( (hue <= (_10YR20[x] + 0.035)) && (hue > (_10YR20[x] + _85YR20[x])/2.0) && x<=45) {if(y>49) y=49;correction = _10YR20[y] - _10YR20[x] ;lbe=_10YR20[y];correctL=true;}
+ else if (( hue<=(_85YR20[x] + _10YR20[x])/2.0) && (hue > (_85YR20[x] + 0.035) && x <= 45)) {if(y>49) y=49;correction = _85YR20[y] - _85YR20[x] ;lbe= _85YR20[y];correctL=true;}
+ }
+ else if (lum <35.0) {
+ if( (hue <= (_10YR30[x] + 0.035)) && (hue > (_10YR30[x] + _85YR30[x])/2.0) && x < 85) {if(y>89) y=89;correction = _10YR30[y] - _10YR30[x] ;lbe=_10YR30[y];correctL=true;}
+ else if( (hue <= (_10YR30[x] + _85YR30[x])/2.0) && (hue >(_85YR30[x] + _7YR30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _85YR30[y] - _85YR30[x] ;lbe= _85YR30[y];correctL=true;}
+ else if (( hue<=(_85YR30[x] + _7YR30[x])/2.0) && (hue > (_7YR30[x] + _55YR30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _7YR30[y] - _7YR30[x] ;lbe=_7YR30[y];correctL=true;}
+ else if (( hue<=(_7YR30[x] + _55YR30[x])/2.0) && (hue > (_55YR30[x] + _4YR30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _55YR30[y] - _55YR30[x] ;lbe=_55YR30[y];correctL=true; }
+ else if (( hue<=(_55YR30[x] + _4YR30[x])/2.0) && (hue > (_4YR30[x] + _25YR30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _4YR30[y] - _4YR30[x] ;lbe= _4YR30[y];correctL=true;}
+ else if (( hue<=(_4YR30[x] + _25YR30[x])/2.0) && (hue > (_25YR30[x] + _10R30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _25YR30[y] - _25YR30[x] ;lbe=_25YR30[y];correctL=true;}
+ else if (( hue<=(_25YR30[x] + _10R30[x])/2.0) && (hue > (_10R30[x] + _9R30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10R30[y] - _10R30[x] ; lbe=_10R30[y];correctL=true;}
+ else if (( hue<=(_10R30[x] + _9R30[x])/2.0) && (hue > (_9R30[x] + _7R30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _9R30[y] - _9R30[x] ;lbe=_9R30[y];correctL=true;}
+ else if (( hue<=(_9R30[x] + _7R30[x])/2.0) && (hue > (_7R30[x] -0.035))&& x < 85) {if(y>89) y=89;correction = _7R30[y] - _7R30[x] ; lbe=_7R30[y] ;correctL=true;}
+ }
+ else if (lum <45.0) {
+ if( (hue <= (_10YR40[x] + 0.035)) && (hue > (_10YR40[x] + _85YR40[x])/2.0)&& x<85) {if(y>89) y=89;correction = _10YR40[y] - _10YR40[x] ;lbe=_10YR40[y];correctL=true;}
+ else if( (hue <= (_10YR40[x] + _85YR40[x])/2.0) && (hue >(_85YR40[x] + _7YR40[x])/2.0)&& x < 85 ) {if(y>89) y=89;correction = _85YR40[y] - _85YR40[x] ;lbe= _85YR40[y];correctL=true;}
+ else if (( hue<=(_85YR40[x] + _7YR40[x])/2.0) && (hue > (_7YR40[x] + _55YR40[x])/2.0) && x < 85) {if(y>89) y=89;correction = _7YR40[y] - _7YR40[x] ;lbe= _7YR40[y];correctL=true;}
+ else if (( hue<=(_7YR40[x] + _55YR40[x])/2.0) && (hue > (_55YR40[x] + _4YR40[x])/2.0)&& x < 85 ) {if(y>89) y=89;correction = _55YR40[y] - _55YR40[x] ;lbe=_55YR40[y];correctL=true; }
+ else if (( hue<=(_55YR40[x] + _4YR40[x])/2.0) && (hue > (_4YR40[x] + _25YR40[x])/2.0)&& x < 85 ) {if(y>89) y=89;correction = _4YR40[y] - _4YR40[x] ;lbe=_4YR40[y]; correctL=true;}
+ else if (( hue<=(_4YR40[x] + _25YR40[x])/2.0) && (hue > (_25YR40[x] + _10R40[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _25YR40[y] - _25YR40[x] ;lbe=_25YR40[y] ;correctL=true;}
+ else if (( hue<=(_25YR40[x] + _10R40[x])/2.0) && (hue > (_10R40[x] + _9R40[x])/2.0) && x < 85) {if(y>89) y=89;correction = _10R40[y] - _10R40[x] ; lbe=_10R40[y];correctL=true;}
+ else if (( hue<=(_10R40[x] + _9R40[x])/2.0) && (hue > (_9R40[x] + _7R40[x])/2.0)&& x < 85 ) {if(y>89) y=89;correction = _9R40[y] - _9R40[x] ;lbe=_9R40[y];correctL=true;}
+ else if (( hue<=(_9R40[x] + _7R40[x])/2.0) && (hue > (_7R40[x] -0.035))&& x < 85 ) {if(y>89) y=89;correction = _7R40[y] - _7R40[x] ; lbe=_7R40[y];correctL=true;}
+ }
+ else if (lum <55.0) {
+ if( (hue <= (_10YR50[x] + 0.035)) && (hue > (_10YR50[x] + _85YR50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10YR50[y] - _10YR50[x] ;lbe=_10YR50[y];correctL=true;}
+ else if( (hue <= (_10YR50[x] + _85YR50[x])/2.0) && (hue >(_85YR50[x] + _7YR50[x])/2.0)&& x < 85 ) {if(y>89) y=89;correction = _85YR50[y] - _85YR50[x] ;lbe=_85YR50[y];correctL=true;}
+ else if (( hue<=(_85YR50[x] + _7YR50[x])/2.0) && (hue > (_7YR50[x] + _55YR50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _7YR50[y] - _7YR50[x] ;lbe=_7YR50[y];correctL=true;}
+ else if (( hue<=(_7YR50[x] + _55YR50[x])/2.0) && (hue > (_55YR50[x] + _4YR50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _55YR50[y] - _55YR50[x] ; lbe=_55YR50[y];correctL=true;}
+ else if (( hue<=(_55YR50[x] + _4YR50[x])/2.0) && (hue > (_4YR50[x] + _25YR50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _4YR50[y] - _4YR50[x] ;lbe=_4YR50[y]; correctL=true;}
+ else if (( hue<=(_4YR50[x] + _25YR50[x])/2.0) && (hue > (_25YR50[x] + _10R50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _25YR50[y] - _25YR50[x] ;lbe=_25YR50[y];correctL=true;}
+ else if (( hue<=(_25YR50[x] + _10R50[x])/2.0) && (hue > (_10R50[x] + _9R50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10R50[y] - _10R50[x] ;lbe= _10R50[y]; correctL=true;}
+ else if (( hue<=(_10R50[x] + _9R50[x])/2.0) && (hue > (_9R50[x] + _7R50[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _9R50[y] - _9R50[x] ;lbe=_9R50[y];correctL=true;}
+ else if (( hue<=(_9R50[x] + _7R50[x])/2.0) && (hue > (_7R50[x] -0.035))&& x < 85) {if(y>89) y=89;correction = _7R50[y] - _7R50[x] ; lbe=_7R50[y];correctL=true;}
+ }
+ else if (lum <65.0) {
+ if( (hue <= (_10YR60[x] + 0.035)) && (hue > (_10YR60[x] + _85YR60[x])/2.0)) {;correction = _10YR60[y] - _10YR60[x] ;lbe= _10YR60[y];correctL=true;}
+ else if( (hue <= (_10YR60[x] + _85YR60[x])/2.0) && (hue >(_85YR60[x] + _7YR60[x])/2.0) ) {;correction = _85YR60[y] - _85YR60[x] ;lbe= _85YR60[y];correctL=true;}
+ else if (( hue<=(_85YR60[x] + _7YR60[x])/2.0) && (hue > (_7YR60[x] + _55YR60[x])/2.0)) {correction = _7YR60[y] - _7YR60[x] ;lbe=_7YR60[y];correctL=true;}
+ else if (( hue<=(_7YR60[x] + _55YR60[x])/2.0) && (hue > (_55YR60[x] + _4YR60[x])/2.0)) {correction = _55YR60[y] - _55YR60[x] ;lbe= _55YR60[y];correctL=true;}
+ else if (( hue<=(_55YR60[x] + _4YR60[x])/2.0) && (hue > (_4YR60[x] + _25YR60[x])/2.0)) {correction = _4YR60[y] - _4YR60[x] ;lbe=_4YR60[y]; correctL=true;}
+ else if (( hue<=(_4YR60[x] + _25YR60[x])/2.0) && (hue > (_25YR60[x] + _10R60[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _25YR60[y] - _25YR60[x] ;lbe=_25YR60[y];correctL=true;}
+ else if (( hue<=(_25YR60[x] + _10R60[x])/2.0) && (hue > (_10R60[x] + _9R60[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10R60[y] - _10R60[x] ;lbe= _10R60[y];correctL=true; }
+ else if (( hue<=(_10R60[x] + _9R60[x])/2.0) && (hue > (_9R60[x] + _7R60[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _9R60[y] - _9R60[x] ;lbe=_9R60[y];correctL=true;}
+ else if (( hue<=(_9R60[x] + _7R60[x])/2.0) && (hue > (_7R60[x] -0.035))&& x < 85) {if(y>89) y=89;correction = _7R60[y] - _7R60[x] ;lbe=_7R60[y]; correctL=true;}
+ }
+ else if (lum <75.0) {
+ if( (hue <= (_10YR70[x] + 0.035)) && (hue > (_10YR70[x] + _85YR70[x])/2.0)) {correction = _10YR70[y] - _10YR70[x] ;lbe= _10YR70[y];correctL=true;}
+ else if( (hue <= (_10YR70[x] + _85YR70[x])/2.0) && (hue >(_85YR70[x] + _7YR70[x])/2.0)) {correction = _85YR70[y] - _85YR70[x] ;lbe=_85YR70[y];correctL=true;}
+ if (( hue<=(_85YR70[x] + _7YR70[x])/2.0) && (hue > (_7YR70[x] + _55YR70[x])/2.0)) {correction = _7YR70[y] - _7YR70[x] ;lbe=_7YR70[y];correctL=true;}
+ else if (( hue<=(_7YR70[x] + _55YR70[x])/2.0) && (hue > (_55YR70[x] + _4YR70[x])/2.0)) {correction = _55YR70[y] - _55YR70[x] ;lbe=_55YR70[y];correctL=true; }
+ else if (( hue<=(_55YR70[x] + _4YR70[x])/2.0) && (hue > (_4YR70[x] + _25YR70[x])/2.0)) {correction = _4YR70[y] - _4YR70[x] ;lbe=_4YR70[y];correctL=true; }
+ else if (( hue<=(_4YR70[x] + _25YR70[x])/2.0) && (hue > (_25YR70[x] + _10R70[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _25YR70[y] - _25YR70[x] ;lbe= _25YR70[y];correctL=true;}
+ else if (( hue<=(_25YR70[x] + _10R70[x])/2.0) && (hue > (_10R70[x] + _9R70[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10R70[y] - _10R70[x] ;lbe= _10R70[y];correctL=true;}
+ else if (( hue<=(_10R70[x] + _9R70[x])/2.0) && (hue > (_9R70[x] + _7R70[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _9R70[y] - _9R70[x] ;lbe= _9R70[y] ;correctL=true;}
+ else if (( hue<=(_9R70[x] + _7R70[x])/2.0) && (hue > (_7R70[x] -0.035))&& x < 85) {if(y>89) y=89;correction = _7R70[y] - _7R70[x] ;lbe=_7R70[y];correctL=true; }
+ }
+ else if (lum <85.0) {
+ if( (hue <= (_10YR80[x] + 0.035)) && (hue > (_10YR80[x] + _85YR80[x])/2.0)) {correction = _10YR80[y] - _10YR80[x] ;lbe=_10YR80[y];correctL=true;}
+ else if( (hue <= (_10YR80[x] + _85YR80[x])/2.0) && (hue >(_85YR80[x] + _7YR80[x])/2.0)) {correction = _85YR80[y] - _85YR80[x] ;lbe= _85YR80[y];}
+ else if (( hue<=(_85YR80[x] + _7YR80[x])/2.0) && (hue > (_7YR80[x] + _55YR80[x])/2.0) && x<85) {if(y>89) y=89;correction = _7YR80[y] - _7YR80[x] ;lbe=_7YR80[y];correctL=true;}
+ else if (( hue<=(_7YR80[x] + _55YR80[x])/2.0) && (hue > (_55YR80[x] + _4YR80[x])/2.0) && x <45) {correction = _55YR80[y] - _55YR80[x] ;lbe=_55YR80[y];correctL=true; }
+ else if (( hue<=(_55YR80[x] + _4YR80[x])/2.0) && (hue > (_4YR80[x] - 0.035) && x<45)) {if(y>49) y=49;correction = _4YR80[y] - _4YR80[x] ; lbe=_4YR80[y] ;correctL=true;}
+ }
+ else if (lum <95.0) {
+ if( (hue <= (_10YR90[x] + 0.035)) && (hue > (_10YR90[x] -0.035) && x<85)) {if(y>89) y=89;correction = _10YR90[y] - _10YR90[x] ;lbe= _10YR90[y];correctL=true;}
+ else if ( hue<=(_85YR90[x] + 0.035) && hue > (_85YR90[x] -0.035) && x<85) {if(y>89) y=89;correction = _85YR90[y] - _85YR90[x] ;lbe=_85YR90[y];correctL=true;}
+ else if (( hue<=(_55YR90[x] + 0.035) && (hue > (_55YR90[x] - 0.035) && x<45))) {if(y>49) y=49;correction = _55YR90[y] - _55YR90[x] ;lbe= _55YR90[y];correctL=true; }
+ }
+ }
+ }
+ //end red yellow
+
+ //Green yellow correction
+ else if(zone==3) {
+ if (lum >= 25.0) {
+ if (lum <35.0) {
+ if( (hue <= (_7G30[x] + 0.035)) && (hue > (_7G30[x] + _5G30[x])/2.0) ) {correction = _7G30[y] - _7G30[x] ;lbe=_7G30[y];correctL=true;}
+ else if( (hue <= (_7G30[x] + _5G30[x])/2.0) && (hue >(_5G30[x] + _25G30[x])/2.0)) {correction = _5G30[y] - _5G30[x] ;lbe= _5G30[y];correctL=true;}
+ else if (( hue<=(_25G30[x] + _5G30[x])/2.0) && (hue > (_25G30[x] + _1G30[x])/2.0)) {correction = _25G30[y] - _25G30[x] ;lbe=_25G30[y];correctL=true;}
+ else if (( hue<=(_1G30[x] + _25G30[x])/2.0) && (hue > (_1G30[x] + _10GY30[x])/2.0)) {correction = _1G30[y] - _1G30[x] ;lbe= _1G30[y];correctL=true;}
+ else if (( hue<=(_1G30[x] + _10GY30[x])/2.0) && (hue > (_10GY30[x] + _75GY30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10GY30[y] - _10GY30[x] ;lbe= _10GY30[y];correctL=true;}
+ else if (( hue<=(_10GY30[x] + _75GY30[x])/2.0) && (hue > (_75GY30[x] + _5GY30[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _75GY30[y] - _75GY30[x] ;lbe=_75GY30[y];correctL=true;}
+ else if (( hue<=(_5GY30[x] + _75GY30[x])/2.0) && (hue > (_5GY30[x] -0.035))&& x < 85) {if(y>89) y=89;correction = _5GY30[y] - _5GY30[x] ;lbe= _5GY30[y] ;correctL=true; }
+ }
+ else if (lum <45.0) {
+ if( (hue <= (_7G40[x] + 0.035)) && (hue > (_7G40[x] + _5G40[x])/2.0) ) {correction = _7G40[y] - _7G40[x] ;lbe= _7G40[y];correctL=true;}
+ else if( (hue <= (_7G40[x] + _5G40[x])/2.0) && (hue >(_5G40[x] + _25G40[x])/2.0)) {correction = _5G40[y] - _5G40[x] ;lbe=_5G40[y];correctL=true;}
+ else if (( hue<=(_25G40[x] + _5G40[x])/2.0) && (hue > (_25G40[x] + _1G40[x])/2.0)) {correction = _25G40[y] - _25G40[x] ;lbe=_25G40[y];correctL=true;}
+ else if (( hue<=(_1G40[x] + _25G40[x])/2.0) && (hue > (_1G40[x] + _10GY40[x])/2.0)) {correction = _1G40[y] - _1G40[x] ;lbe=_1G40[y];correctL=true; }
+ else if (( hue<=(_1G40[x] + _10GY40[x])/2.0) && (hue > (_10GY40[x] + _75GY40[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _10GY40[y] - _10GY40[x] ;lbe=_10GY40[y];correctL=true; }
+ else if (( hue<=(_10GY40[x] + _75GY40[x])/2.0) && (hue > (_75GY40[x] + _5GY40[x])/2.0)&& x < 85) {if(y>89) y=89;correction = _75GY40[y] - _75GY40[x] ;lbe=_75GY40[y];correctL=true;}
+ else if (( hue<=(_5GY40[x] + _75GY40[x])/2.0) && (hue > (_5GY40[x]-0.035)) && x < 85) {if(y>89) y=89; correction = _5GY40[y] - _5GY40[x] ;lbe=_5GY40[y];correctL=true; } //
+ }
+ else if (lum <55.0) {
+ if( (hue <= (_7G50[x] + 0.035)) && (hue > (_7G50[x] + _5G50[x])/2.0) ) {correction = _7G50[y] - _7G50[x] ;lbe=_7G50[y];correctL=true;}
+ else if( (hue <= (_7G50[x] + _5G50[x])/2.0) && (hue >(_5G50[x] + _25G50[x])/2.0)) {correction = _5G50[y] - _5G50[x] ;lbe=_5G50[y];correctL=true;}
+ else if (( hue<=(_25G50[x] + _5G50[x])/2.0) && (hue > (_25G50[x] + _1G50[x])/2.0)) {correction = _25G50[y] - _25G50[x] ;lbe= _25G50[y];correctL=true;}
+ else if (( hue<=(_1G50[x] + _25G50[x])/2.0) && (hue > (_1G50[x] + _10GY50[x])/2.0)) {correction = _1G50[y] - _1G50[x] ; lbe=_1G50[y];correctL=true;}
+ else if (( hue<=(_1G50[x] + _10GY50[x])/2.0) && (hue > (_10GY50[x] + _75GY50[x])/2.0)) {correction = _10GY50[y] - _10GY50[x] ;lbe= _10GY50[y];correctL=true;}
+ else if (( hue<=(_10GY50[x] + _75GY50[x])/2.0) && (hue > (_75GY50[x] + _5GY50[x])/2.0)) {correction = _75GY50[y] - _75GY50[x] ;lbe=_75GY50[y];correctL=true;}
+ else if (( hue<=(_5GY50[x] + _75GY50[x])/2.0) && (hue > (_5GY50[x] -0.035))) {correction = _5GY50[y] - _5GY50[x] ; lbe=_5GY50[y];correctL=true;}
+ }
+ else if (lum <65.0) {
+ if( (hue <= (_7G60[x] + 0.035)) && (hue > (_7G60[x] + _5G60[x])/2.0) ) {correction = _7G60[y] - _7G60[x] ;lbe=_7G60[y];correctL=true;}
+ else if( (hue <= (_7G60[x] + _5G60[x])/2.0) && (hue >(_5G60[x] + _25G60[x])/2.0)) {correction = _5G60[y] - _5G60[x] ;lbe=_5G60[y];correctL=true;}
+ else if (( hue<=(_25G60[x] + _5G60[x])/2.0) && (hue > (_25G60[x] + _1G60[x])/2.0)) {correction = _25G60[y] - _25G60[x] ;lbe=_25G60[y];correctL=true;}
+ else if (( hue<=(_1G60[x] + _25G60[x])/2.0) && (hue > (_1G60[x] + _10GY60[x])/2.0)) {correction = _1G60[y] - _1G60[x] ; lbe=_1G60[y];correctL=true;}
+ else if (( hue<=(_1G60[x] + _10GY60[x])/2.0) && (hue > (_10GY60[x] + _75GY60[x])/2.0)) {correction = _10GY60[y] - _10GY60[x] ;lbe= _10GY60[y];correctL=true;}
+ else if (( hue<=(_10GY60[x] + _75GY60[x])/2.0) && (hue > (_75GY60[x] + _5GY60[x])/2.0)) {correction = _75GY60[y] - _75GY60[x] ;lbe=_75GY60[y] ;correctL=true;}
+ else if (( hue<=(_5GY60[x] + _75GY60[x])/2.0) && (hue > (_5GY60[x] -0.035))) {correction = _5GY60[y] - _5GY60[x] ; lbe=_5GY60[y];correctL=true;}
+ }
+ else if (lum <75.0) {
+ if( (hue <= (_7G70[x] + 0.035)) && (hue > (_7G70[x] + _5G70[x])/2.0) ) {correction = _7G70[y] - _7G70[x] ;lbe= _7G70[y];correctL=true;}
+ else if( (hue <= (_7G70[x] + _5G70[x])/2.0) && (hue >(_5G70[x] + _25G70[x])/2.0)) {correction = _5G70[y] - _5G70[x] ;lbe= _5G70[y];correctL=true;}
+ else if (( hue<=(_25G70[x] + _5G70[x])/2.0) && (hue > (_25G70[x] + _1G70[x])/2.0)) {correction = _25G70[y] - _25G70[x] ;lbe=_25G70[y];correctL=true;}
+ else if (( hue<=(_1G70[x] + _25G70[x])/2.0) && (hue > (_1G70[x] + _10GY70[x])/2.0)) {correction = _1G70[y] - _1G70[x] ;lbe= _1G70[y] ;correctL=true;}
+ else if (( hue<=(_1G70[x] + _10GY70[x])/2.0) && (hue > (_10GY70[x] + _75GY70[x])/2.0)) {correction = _10GY70[y] - _10GY70[x] ; lbe=_10GY70[y];correctL=true;}
+ else if (( hue<=(_10GY70[x] + _75GY70[x])/2.0) && (hue > (_75GY70[x] + _5GY70[x])/2.0)) {correction = _75GY70[y] - _75GY70[x] ;lbe=_75GY70[y];correctL=true;}
+ else if (( hue<=(_5GY70[x] + _75GY70[x])/2.0) && (hue > (_5GY70[x] -0.035))) {correction = _5GY70[y] - _5GY70[x] ;lbe= _5GY70[y];correctL=true;}
+ }
+ else if (lum <85.0) {
+ if( (hue <= (_7G80[x] + 0.035)) && (hue > (_7G80[x] + _5G80[x])/2.0) ) {correction = _7G80[y] - _7G80[x] ;lbe=_7G80[y];correctL=true;}
+ else if( (hue <= (_7G80[x] + _5G80[x])/2.0) && (hue >(_5G80[x] + _25G80[x])/2.0)) {correction = _5G80[y] - _5G80[x] ;lbe=_5G80[y];correctL=true;}
+ else if (( hue<=(_25G80[x] + _5G80[x])/2.0) && (hue > (_25G80[x] + _1G80[x])/2.0)) {correction = _25G80[y] - _25G80[x] ;lbe=_25G80[y];correctL=true;}
+ else if (( hue<=(_1G80[x] + _25G80[x])/2.0) && (hue > (_1G80[x] + _10GY80[x])/2.0)) {correction = _1G80[y] - _1G80[x] ; lbe= _1G80[y];correctL=true;}
+ else if (( hue<=(_1G80[x] + _10GY80[x])/2.0) && (hue > (_10GY80[x] + _75GY80[x])/2.0)) {correction = _10GY80[y] - _10GY80[x] ;lbe=_10GY80[y];correctL=true; }
+ else if (( hue<=(_10GY80[x] + _75GY80[x])/2.0) && (hue > (_75GY80[x] + _5GY80[x])/2.0)) {correction = _75GY80[y] - _75GY80[x] ;lbe=_75GY80[y];correctL=true;}
+ else if (( hue<=(_5GY80[x] + _75GY80[x])/2.0) && (hue > (_5GY80[x] -0.035))) {correction = _5GY80[y] - _5GY80[x] ; lbe=_5GY80[y];correctL=true;}
+ }
+ }
+ }
+ //end green yellow
+
+ //Red purple correction : only for L < 30
+ else if(zone==4) {
+ if (lum > 5.0) {
+ if (lum < 15.0) {
+ if( (hue <= (_5R10[x] + 0.035)) && (hue > (_5R10[x] - 0.043)) && x<45) {if(y>44) y=44;correction = _5R10[y] - _5R10[x] ;lbe=_5R10[y];correctL=true;}
+ else if( (hue <= (_25R10[x] + 0.043)) && (hue >(_25R10[x] + _10RP10[x])/2.0) && x<45 ) {if(y>44) y=44;correction = _25R10[y] - _25R10[x] ;lbe= _25R10[y];correctL=true;}
+ else if ( (hue <=(_25R10[x] + _10RP10[x])/2.0) && (hue > (_10RP10[x] -0.035) ) && x<45){if(y>44) y=44; correction = _10RP10[y] - _10RP10[x] ;lbe=_10RP10[y];correctL=true;}
+ }
+ else if (lum <25.0) {
+ if( (hue <= (_5R20[x] + 0.035)) && (hue > (_5R20[x] + _25R20[x])/2.0) && x<70 ) {if(y>70) y=70;correction = _5R20[y] - _5R20[x] ;lbe= _5R20[y];correctL=true;}
+ else if( (hue <= (_5R20[x] + _25R20[x])/2.0) && (hue >(_10RP20[x] + _25R20[x])/2.0) && x<70) {if(y>70) y=70;correction = _25R20[y] - _25R20[x] ;lbe=_25R20[y];correctL=true;}
+ else if (( hue<=(_10RP20[x] + _25R20[x])/2.0) && (hue > (_10RP20[x] -0.035)) && x<70) {if(y>70) y=70; correction = _10RP20[y] - _10RP20[x] ;lbe=_10RP20[y];correctL=true;}
+ }
+ else if (lum <35.0) {
+ if( (hue <= (_5R30[x] + 0.035)) && (hue > (_5R30[x] + _25R30[x])/2.0) && x<85 ) {if(y>85) y=85;correction = _5R30[y] - _5R30[x] ;lbe= _5R30[y];correctL=true;}
+ else if( (hue <= (_5R30[x] + _25R30[x])/2.0) && (hue >(_10RP30[x] + _25R30[x])/2.0) && x< 85) {if(y>85) y=85;correction = _25R30[y] - _25R30[x] ;lbe=_25R30[y];correctL=true;}
+ else if (( hue<=(_10RP30[x] + _25R30[x])/2.0) && (hue > (_10RP30[x] -0.035)) && x<85) {if(y>85) y=85; correction = _10RP30[y] - _10RP30[x] ;lbe= _10RP30[y];correctL=true;}
+ }
+ }
+ }
+ //end red purple
+ }
+
+
+ /*
+ * SkinSat
+ * Copyright (c)2011 Jacques Desmis
+ *
+ * skin color: mixed from NX2 skin color palette, Von Luschan, and photos of people white,
+ * black, yellow....there are some little exceptions...cover 99% case
+ * pay attention to white balance, and do not change hue and saturation, upstream of the modification
+ *
+ */
+ void Color::SkinSat (float lum, float hue, float chrom, float &satreduc, int chromx) {
+
+ float reduction=0.3;// to be adapted...by tests
+ float extendedreduction=0.4;
+ float extendedreduction2=0.6;
+
+ if(chromx==1) {reduction=0.6;extendedreduction=0.7;extendedreduction2=0.8;}
+
+ float C9=0.0, C8=0.0, C7=0.0, C4=0.0, C3=0.0, C2=0.0, C1=0.0;
+ float H9=0.0, H8=0.0, H7=0.0, H4=0.0, H3=0.0, H2=0.0, H1=0.0, H10=0.0,H11=0.0;
+ H9=0.05;H8=0.25;H7=0.1;H4=0.02;H3=0.02;H2=0.1;H1=0.1;H10=-0.2;H11=-0.2;//H10 and H11 are curious...H11=-0.8 ??
+ C9=8.0;C8=15.0;C7=12.0;C4=7.0;C3=5.0;C2=5.0;C1=5.0;
+
+ // wide area for transition
+
+ if (lum >= 92.0 && (hue > -0.1 && hue < 1.65) && (chrom > 7.0 && chrom < (18.0))) satreduc=extendedreduction2;
+ else if (lum >= 85.0 && lum < 92.0 && (hue > 0.0 && hue < 1.65) && (chrom > 7.0 && chrom < (35.0+C9))) satreduc=extendedreduction2;
+ else if ((lum > 20 && lum < 85) && (hue > (0.02 + H11) && hue < 1.65) && (chrom > 7.0 && chrom < (55.0+C9) )) satreduc=extendedreduction2;
+ else if (lum < 20.0 && (hue > (0.02+H11) && hue < 1.60) && (chrom > 7.0 && chrom < (45.0+C1) )) satreduc=extendedreduction2;
+
+ // wide area skin color, useful if not accurate colorimetry or if the user has changed hue and saturation
+
+ if (lum >= 92.0 && (hue > 0.8 && hue < 1.65) && (chrom > 7.0 && chrom < (15.0))) satreduc=extendedreduction;
+ else if (lum >= 85.0 && lum < 92.0 && (hue > 0.70 && hue < 1.4) && (chrom > 7.0 && chrom < (26.0+C9))) satreduc=extendedreduction;
+ else if ((lum > 20 && lum < 85) && (hue > (0.02 + H11) && hue < 1.5) && (chrom > 7.0 && chrom < (48.0+C9) )) satreduc=extendedreduction;
+ else if (lum < 20.0 && (hue > (0.02+H11) && hue < 1.0) && (chrom > 7.0 && chrom < (35.0+C1) )) satreduc=extendedreduction;
+
+ // "real" skin color : take into account a slightly usage of contrast and saturation in RT if option "skin" = 1
+
+ if (lum >= 85.0 && (hue > (0.78-H9) && hue < (1.18+H9)) && (chrom > 8.0 && chrom < (14.0+C9))) satreduc=reduction;
+ else if ((lum >= 70.0 && lum < 85.0) && (hue > 0.4 && hue < (1.04+H8)) && (chrom > 8.0 && chrom < (35.0+C8))) satreduc=reduction;
+ else if ((lum >= 52.0 && lum < 70.0) && (hue > 0.3 && hue < (1.27+H7)) && (chrom > 11.0 && chrom < (35.0+C7))) satreduc=reduction;
+ else if ((lum >= 35.0 && lum < 52.0) && (hue > 0.3 && hue < (1.25+H4)) && (chrom > 13.0 && chrom < (37.0+C4))) satreduc=reduction;
+ else if ((lum >= 20.0 && lum < 35.0) && (hue > 0.3 && hue < (1.20+H3)) && (chrom > 7.0 && chrom <(35.0+C3) )) satreduc=reduction;
+ else if ((lum > 10.0 && lum < 20.0) && (hue > (0.0 + H10) && hue < (0.95 +H2)) && (chrom > 8.0 && chrom < (23.0+C2))) satreduc=reduction;
+ else if ((lum < 10.0) && (hue > (0.02 + H10) && hue < (0.90+H1)) && (chrom > 8.0 && chrom < (23.0+C1))) satreduc=reduction; // no data : extrapolate
+ }
+
+ /*
+ * Munsell Lch correction
+ * Copyright (c) 2011 Jacques Desmis
+ *
+ * data (Munsell ==> Lab) obtained with WallKillcolor and http://www.cis.rit.edu/research/mcsl2/online/munsell.php
+ * each LUT give Hue in function of C, for each color Munsell and Luminance
+ * eg: _6PB20 : color Munsell 6PB for L=20 c=5 c=45 c=85 c=125..139 when possible: interpolation betwwen values
+ * no value for C<5 (gray)
+ * low memory footprint -- maximum: 195 LUTf * 140 values
+ * errors due to small number of samples in LUT and linearization are very low (1 to 2%)
+ * errors due to a different illuminant "Daylight" than "C" are low, about 10%. For example, a theoretical correction of 0.1 radian will be made with a real correction of 0.09 or 0.11 depending on the color illuminant D50
+ * errors due to the use of a very different illuminant "C", for example illuminant "A" (tungsten) are higher, about 20%. Theoretical correction of 0.52 radians will be made with a real correction of 0.42
+ */
+ void Color::initMunsell () {
+ #ifdef _DEBUG
+ MyTime t1e,t2e;
+ t1e.set();
+ #endif
+
+ const int maxInd = 140;
+ const int maxInd2 = 90;
+ const int maxInd3 = 50;
+
+ //blue for sky
+ _5B40(maxInd2);
+ for (int i=0; i5) _5B40[i] = -2.3 + 0.0025*(i-5);
+ else if (i<90 && i>=45) _5B40[i] = -2.2 + 0.00*(i-45);
+ }
+ //printf("5B %1.2f %1.2f\n",_5B40[44],_5B40[89]);
+ _5B50(maxInd2);
+ for (int i=0; i5) _5B50[i] = -2.34 + 0.0025*(i-5);
+ else if (i<90 && i>=45) _5B50[i] = -2.24+0.0003*(i-45);
+ }
+ //printf("5B %1.2f %1.2f\n",_5B50[44],_5B50[89]);
+ _5B60(maxInd2);
+ for (int i=0; i5) _5B60[i] = -2.4 + 0.003*(i-5);
+ else if (i<90 && i>=45) _5B60[i] = -2.28+0.0005*(i-45);
+ }
+ //printf("5B %1.2f %1.2f\n",_5B60[44],_5B60[89]);
+ _5B70(maxInd2);
+ for (int i=0; i5) _5B70[i] = -2.41 + 0.00275*(i-5);
+ else if (i<90 && i>=45) _5B70[i] = -2.30+0.00025*(i-45);
+ }
+ //printf("5B %1.2f %1.2f\n",_5B70[44],_5B70[89]);
+ _5B80(maxInd3);
+ for (int i=0; i5) _5B80[i] = -2.45 +0.003*(i-5);
+ }
+ //printf("5B %1.2f\n",_5B80[49]);
+
+ _7B40(maxInd2);
+ for (int i=0; i5) _7B40[i] = -2.15 + 0.0027*(i-5);
+ else if (i<90 && i>=45) _7B40[i] = -2.04 + 0.00*(i-45);
+ }
+ //printf("7B %1.2f %1.2f\n",_7B40[44],_7B40[89]);
+ _7B50(maxInd2);
+ for (int i=0; i5) _7B50[i] = -2.20 + 0.003*(i-5);
+ else if (i<90 && i>=45) _7B50[i] = -2.08 + 0.001*(i-45);
+ }
+ //printf("7B %1.2f %1.2f\n",_7B50[44],_7B50[79]);
+ _7B60(maxInd2);
+ for (int i=0; i5) _7B60[i] = -2.26 + 0.0035*(i-5);
+ else if (i<90 && i>=45) _7B60[i] = -2.12 + 0.001*(i-45);
+ }
+ //printf("7B %1.2f %1.2f\n",_7B60[44],_7B60[79]);
+ _7B70(maxInd2);
+ for (int i=0; i5) _7B70[i] = -2.28 + 0.003*(i-5);
+ else if (i<90 && i>=45) _7B70[i] = -2.16 + 0.0015*(i-45);
+ }
+ //printf("7B %1.2f %1.2f\n",_7B70[44],_7B70[64]);
+ _7B80(maxInd3);
+ for (int i=0; i5) _7B80[i] = -2.30 +0.0028*(i-5);
+ }
+ //printf("5B %1.2f\n",_7B80[49]);
+
+ _9B40(maxInd2);
+ for (int i=0; i5) _9B40[i] = -1.99 + 0.0022*(i-5);
+ else if (i<90 && i>=45) _9B40[i] = -1.90 + 0.0008*(i-45);
+ }
+ //printf("9B %1.2f %1.2f\n",_9B40[44],_9B40[69]);
+ _9B50(maxInd2);
+ for (int i=0; i5) _9B50[i] = -2.04 + 0.0025*(i-5);
+ else if (i<90 && i>=45) _9B50[i] = -1.94 + 0.0013*(i-45);
+ }
+ //printf("9B %1.2f %1.2f\n",_9B50[44],_9B50[77]);
+ _9B60(maxInd2);
+ for (int i=0; i5) _9B60[i] = -2.10 + 0.0033*(i-5);
+ else if (i<90 && i>=45) _9B60[i] = -1.97 + 0.001*(i-45);
+ }
+ //printf("9B %1.2f %1.2f\n",_9B60[44],_9B60[79]);
+ _9B70(maxInd2);
+ for (int i=0; i5) _9B70[i] = -2.12 + 0.003*(i-5);
+ else if (i<90 && i>=45) _9B70[i] = -2.00 + 0.001*(i-45);
+ }
+ //printf("9B %1.2f %1.2f\n",_9B70[44],_9B70[54]);
+ _9B80(maxInd3);
+ for (int i=0; i5) _9B80[i] = -2.16 +0.0025*(i-5);
+ }
+ //printf("9B %1.2f\n",_9B80[49]);
+
+ _10B40(maxInd2);
+ for (int i=0; i5) _10B40[i] = -1.92 + 0.0022*(i-5);
+ else if (i<90 && i>=45) _10B40[i] = -1.83 + 0.0012*(i-45);
+ }
+ //printf("10B %1.2f %1.2f\n",_10B40[44],_10B40[76]);
+ _10B50(maxInd2);
+ for (int i=0; i5) _10B50[i] = -1.95 + 0.0022*(i-5);
+ else if (i<90 && i>=45) _10B50[i] = -1.86 + 0.0008*(i-45);
+ }
+ //printf("10B %1.2f %1.2f\n",_10B50[44],_10B50[85]);
+ _10B60(maxInd2);
+ for (int i=0; i5) _10B60[i] = -2.01 + 0.0027*(i-5);
+ else if (i<90 && i>=45) _10B60[i] = -1.90 + 0.0012*(i-45);
+ }
+ //printf("10B %1.2f %1.2f\n",_10B60[44],_10B60[70]);
+ _10B70(maxInd3);
+ for (int i=0; i5) _10B70[i] = -2.03 +0.0025*(i-5);
+ }
+ //printf("10B %1.2f\n",_10B70[49]);
+ _10B80(maxInd3);
+ for (int i=0; i5) _10B80[i] = -2.08 +0.0032*(i-5);
+ }
+ //printf("10B %1.2f\n",_10B80[39]);
+
+ _05PB40(maxInd2);
+ for (int i=0; i5) _05PB40[i] = -1.87 + 0.0022*(i-5);
+ else if (i<90 && i>=45) _05PB40[i] = -1.78 + 0.0015*(i-45);
+ }
+ //printf("05PB %1.2f %1.2f\n",_05PB40[44],_05PB40[74]);
+ _05PB50(maxInd2);
+ for (int i=0; i5) _05PB50[i] = -1.91 + 0.0022*(i-5);
+ else if (i<90 && i>=45) _05PB50[i] = -1.82 + 0.001*(i-45);
+ }
+ //printf("05PB %1.2f %1.2f\n",_05PB50[44],_05PB50[85]);
+ _05PB60(maxInd2);
+ for (int i=0; i5) _05PB60[i] = -1.96 + 0.0027*(i-5);
+ else if (i<90 && i>=45) _05PB60[i] = -1.85 + 0.0013*(i-45);
+ }
+ //printf("05PB %1.2f %1.2f\n",_05PB60[44],_05PB60[70]);
+ _05PB70(maxInd2);
+ for (int i=0; i5) _05PB70[i] = -1.99 + 0.0027*(i-5);
+ else if (i<90 && i>=45) _05PB70[i] = -1.88 + 0.001*(i-45);
+ }
+ //printf("05PB %1.2f %1.2f\n",_05PB70[44],_05PB70[54]);
+ _05PB80(maxInd3);
+ for (int i=0; i5) _05PB80[i] = -2.03 +0.003*(i-5);
+ }
+ //printf("05PB %1.2f\n",_05PB80[39]);
+
+
+
+ //blue purple correction
+ //between 15PB to 4P
+ //maximum deviation 75PB
+
+ //15PB
+ _15PB10(maxInd3);
+ for (int i=0; i5) _15PB10[i] = -1.66 +0.0035*(i-5);
+ }
+ //printf("15 %1.2f\n",_15PB10[49]);
+ _15PB20(maxInd2);
+ for (int i=0; i5) _15PB20[i] = -1.71 +0.00275*(i-5);
+ else if (i<90 && i>=45) _15PB20[i] = -1.60+0.0012*(i-45);
+ }
+ //printf("15 %1.2f %1.2f\n",_15PB20[44],_15PB20[89]);
+
+ _15PB30(maxInd2);
+ for (int i=0; i5) _15PB30[i] = -1.75 +0.0025*(i-5);
+ else if (i<90 && i>=45) _15PB30[i] = -1.65+0.002*(i-45);
+ }
+ //printf("15 %1.2f %1.2f\n",_15PB30[44],_15PB30[89]);
+
+ _15PB40(maxInd2);
+ for (int i=0; i5) _15PB40[i] = -1.79 +0.002*(i-5);
+ else if (i<90 && i>=45) _15PB40[i] = -1.71+0.002*(i-45);
+ }
+ //printf("15 %1.2f %1.2f\n",_15PB40[44],_15PB40[89]);
+
+ _15PB50(maxInd2);
+ for (int i=0; i5) _15PB50[i] = -1.82 +0.002*(i-5);
+ else if (i<90 && i>=45) _15PB50[i] = -1.74+0.0011*(i-45);
+ }
+ //printf("15 %1.2f %1.2f\n",_15PB50[44],_15PB50[89]);
+
+ _15PB60(maxInd2);
+ for (int i=0; i5) _15PB60[i] = -1.87 +0.0025*(i-5);
+ else if (i<90 && i>=45) _15PB60[i] = -1.77+0.001*(i-45);
+ }
+ //printf("15 %1.2f %1.2f\n",_15PB60[44],_15PB60[89]);
+ _15PB70(maxInd3);
+ for (int i=0; i5) _15PB70[i] = -1.90 +0.0027*(i-5);
+ }
+ // printf("15 %1.2f\n",_15PB70[49]);
+ _15PB80(maxInd3);
+ for (int i=0; i5) _15PB80[i] = -1.93 +0.0027*(i-5);
+ }
+ //printf("15 %1.2f %1.2f\n",_15PB80[38], _15PB80[49]);
+
+ //3PB
+ _3PB10(maxInd2);
+ for (int i=0; i5) _3PB10[i] = -1.56 +0.005*(i-5);
+ else if (i<90 && i>=45) _3PB10[i] = -1.36+0.001*(i-45);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB10[44],_3PB10[89]);
+
+ _3PB20(maxInd2);
+ for (int i=0; i5) _3PB20[i] = -1.59 +0.00275*(i-5);
+ else if (i<90 && i>=45) _3PB20[i] = -1.48+0.003*(i-45);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB20[44],_3PB20[89]);
+
+ _3PB30(maxInd2);
+ for (int i=0; i5) _3PB30[i] = -1.62 +0.00225*(i-5);
+ else if (i<90 && i>=45) _3PB30[i] = -1.53+0.0032*(i-45);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB30[44],_3PB30[89]);
+
+ _3PB40(maxInd2);
+ for (int i=0; i5) _3PB40[i] = -1.64 +0.0015*(i-5);
+ else if (i<90 && i>=45) _3PB40[i] = -1.58+0.0025*(i-45);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB40[44],_3PB40[89]);
+
+ _3PB50(maxInd2);
+ for (int i=0; i5) _3PB50[i] = -1.69 +0.00175*(i-5);
+ else if (i<90 && i>=45) _3PB50[i] = -1.62+0.002*(i-45);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB50[44],_3PB50[89]);
+
+ _3PB60(maxInd2);
+ for (int i=0; i5) _3PB60[i] = -1.73 +0.002*(i-5);
+ else if (i<90 && i>=45) _3PB60[i] = -1.65+0.0012*(i-45);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB60[44],_3PB60[89]);
+ _3PB70(maxInd3);
+ for (int i=0; i5) _3PB70[i] = -1.76 +0.002*(i-5);
+ }
+ //printf("30 %1.2f\n",_3PB70[49]);
+ _3PB80(maxInd3);
+ for (int i=0; i5) _3PB80[i] = -1.78 +0.0025*(i-5);
+ }
+ //printf("30 %1.2f %1.2f\n",_3PB80[38], _3PB80[49]);
+
+ //45PB
+ _45PB10(maxInd2);
+ for (int i=0; i5) _45PB10[i] = -1.46 +0.0045*(i-5);
+ else if (i<90 && i>=45) _45PB10[i] = -1.28+0.0025*(i-45);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB10[44],_45PB10[89]);
+
+ _45PB20(maxInd2);
+ for (int i=0; i5) _45PB20[i] = -1.48 +0.00275*(i-5);
+ else if (i<90 && i>=45) _45PB20[i] = -1.37+0.0025*(i-45);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB20[44],_45PB20[89]);
+
+ _45PB30(maxInd2);
+ for (int i=0; i5) _45PB30[i] = -1.51 +0.00175*(i-5);
+ else if (i<90 && i>=45) _45PB30[i] = -1.44+0.0035*(i-45);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB30[44],_45PB30[89]);
+
+ _45PB40(maxInd2);
+ for (int i=0; i5) _45PB40[i] = -1.52 +0.001*(i-5);
+ else if (i<90 && i>=45) _45PB40[i] = -1.48+0.003*(i-45);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB40[44],_45PB40[89]);
+
+ _45PB50(maxInd2);
+ for (int i=0; i5) _45PB50[i] = -1.55 +0.001*(i-5);
+ else if (i<90 && i>=45) _45PB50[i] = -1.51+0.0022*(i-45);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB50[44],_45PB50[89]);
+
+ _45PB60(maxInd2);
+ for (int i=0; i5) _45PB60[i] = -1.6 +0.0015*(i-5);
+ else if (i<90 && i>=45) _45PB60[i] = -1.54+0.001*(i-45);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB60[44],_45PB60[89]);
+ _45PB70(maxInd3);
+ for (int i=0; i5) _45PB70[i] = -1.63 +0.0017*(i-5);
+ }
+ //printf("45 %1.2f\n",_45PB70[49]);
+ _45PB80(maxInd3);
+ for (int i=0; i5) _45PB80[i] = -1.67 +0.0025*(i-5);
+ }
+ //printf("45 %1.2f %1.2f\n",_45PB80[38], _45PB80[49]);
+
+ //_6PB
+ _6PB10(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _6PB10[i] = -1.33 +0.005*(i-5);
+ else if (i<85 && i>=45) _6PB10[i] = -1.13+0.0045*(i-45);
+ else if (i<140 && i >=85) _6PB10[i] = -0.95+0.0015*(i-85);
+ }
+ //printf("60 %1.2f %1.2f %1.2f\n",_6PB10[44],_6PB10[84],_6PB10[139]);
+
+ _6PB20(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _6PB20[i] = -1.36 +0.004*(i-5);
+ else if (i<85 && i>=45) _6PB20[i] = -1.20+0.00375*(i-45);
+ else if (i<140 && i >=85) _6PB20[i] = -1.05+0.0017*(i-85);
+ }
+ //printf("60 %1.2f %1.2f %1.2f\n",_6PB20[44],_6PB20[84],_6PB20[139]);
+
+ _6PB30(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _6PB30[i] = -1.38 +0.00225*(i-5);
+ else if (i<85 && i>=45) _6PB30[i] = -1.29+0.00375*(i-45);
+ else if (i<140 && i >=85) _6PB30[i] = -1.14+0.002*(i-85);
+ }
+ //printf("60 %1.2f %1.2f %1.2f\n",_6PB30[44],_6PB30[84],_6PB30[139]);
+
+ _6PB40(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _6PB40[i] = -1.39 +0.00125*(i-5);
+ else if (i<85 && i>=45) _6PB40[i] = -1.34+0.00275*(i-45);
+ else if (i<140 && i >=85) _6PB40[i] = -1.23+0.002*(i-85);
+ }
+ //printf("60 %1.2f %1.2f %1.2f\n",_6PB40[44],_6PB40[84],_6PB40[139]);
+
+ _6PB50(maxInd2);//limits -1.3 -1.11
+ for (int i=0; i5) _6PB50[i] = -1.43 +0.00125*(i-5);
+ else if (i<90 && i>=45) _6PB50[i] = -1.38+0.00225*(i-45);
+ }
+ //printf("60 %1.2f %1.2f \n",_6PB50[44],_6PB50[89]);
+
+ _6PB60(maxInd2);//limits -1.3 -1.11
+ for (int i=0; i5) _6PB60[i] = -1.46 +0.0012*(i-5);
+ else if (i<90 && i>=45) _6PB60[i] = -1.40+0.000875*(i-45);
+ }
+ //printf("60 %1.2f %1.2f\n",_6PB60[44],_6PB60[89]);
+ _6PB70(maxInd3);
+ for (int i=0; i5) _6PB70[i] = -1.49 +0.0018*(i-5);
+ }
+ //printf("6 %1.2f\n",_6PB70[49]);
+ _6PB80(maxInd3);
+ for (int i=0; i5) _6PB80[i] = -1.52 +0.0022*(i-5);
+ }
+ //printf("6 %1.2f %1.2f\n",_6PB80[38], _6PB80[49]);
+
+
+ //_75PB : notation Munsell for maximum deviation blue purple
+ _75PB10(maxInd);//limits hue -1.23 -0.71 _75PBx x=Luminance eg_75PB10 for L >5 and L<=15
+ for (int i=0; i140
+ if (i<45 && i>5) _75PB10[i] = -1.23 +0.0065*(i-5);
+ else if (i<85 && i>=45) _75PB10[i] = -0.97+0.00375*(i-45);
+ else if (i<140 && i >=85) _75PB10[i] = -0.82+0.0015*(i-85);
+ }
+ //printf("75 %1.2f %1.2f %1.2f\n",_75PB10[44],_75PB10[84],_75PB10[139]);
+
+ _75PB20(maxInd);//limits -1.24 -0.79 for L>15 <=25
+ for (int i=0; i5) _75PB20[i] = -1.24 +0.004*(i-5);
+ else if (i<85 && i>=45) _75PB20[i] = -1.08+0.00425*(i-45);
+ else if (i<140 && i >=85) _75PB20[i] = -0.91+0.0017*(i-85);
+ }
+ //printf("75 %1.2f %1.2f %1.2f\n",_75PB20[44],_75PB20[84],_75PB20[139]);
+
+ _75PB30(maxInd);//limits -1.25 -0.85
+ for (int i=0; i5) _75PB30[i] = -1.25 +0.00275*(i-5);
+ else if (i<85 && i>=45) _75PB30[i] = -1.14+0.004*(i-45);
+ else if (i<140 && i >=85) _75PB30[i] = -0.98+0.0015*(i-85);
+ }
+ //printf("75 %1.2f %1.2f %1.2f\n",_75PB30[44],_75PB30[84],_75PB30[139]);
+
+ _75PB40(maxInd);//limits -1.27 -0.92
+ for (int i=0; i5) _75PB40[i] = -1.27 +0.002*(i-5);
+ else if (i<85 && i>=45) _75PB40[i] = -1.19+0.003*(i-45);
+ else if (i<140 && i >=85) _75PB40[i] = -1.07+0.0022*(i-85);
+ }
+ //printf("75 %1.2f %1.2f %1.2f\n",_75PB40[44],_75PB40[84],_75PB40[139]);
+
+ _75PB50(maxInd2);//limits -1.3 -1.11
+ for (int i=0; i5) _75PB50[i] = -1.3 +0.00175*(i-5);
+ else if (i<90 && i>=45) _75PB50[i] = -1.23+0.0025*(i-45);
+ }
+ //printf("75 %1.2f %1.2f\n",_75PB50[44],_75PB50[89]);
+
+ _75PB60(maxInd2);
+ for (int i=0; i5) _75PB60[i] = -1.32 +0.0015*(i-5);
+ else if (i<90 && i>=45) _75PB60[i] = -1.26+0.002*(i-45);
+ }
+ //printf("75 %1.2f %1.2f \n",_75PB60[44],_75PB60[89]);
+
+ _75PB70(maxInd3);
+ for (int i=0; i5) _75PB70[i] = -1.34 +0.002*(i-5);
+ }
+ _75PB80(maxInd3);
+ for (int i=0; i5) _75PB80[i] = -1.35 +0.00125*(i-5);
+ }
+
+
+ _9PB10(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _9PB10[i] = -1.09 +0.00475*(i-5);
+ else if (i<85 && i>=45) _9PB10[i] = -0.9+0.003*(i-45);
+ else if (i<140 && i >=85) _9PB10[i] = -0.78+0.0013*(i-85);
+ }
+ //printf("90 %1.2f %1.2f %1.2f\n",_9PB10[44],_9PB10[84],_9PB10[139]);
+
+ _9PB20(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _9PB20[i] = -1.12 +0.0035*(i-5);
+ else if (i<85 && i>=45) _9PB20[i] = -0.98+0.00325*(i-45);
+ else if (i<140 && i >=85) _9PB20[i] = -0.85+0.0015*(i-85);
+ }
+ //printf("90 %1.2f %1.2f %1.2f\n",_9PB20[44],_9PB20[84],_9PB20[139]);
+
+ _9PB30(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _9PB30[i] = -1.14 +0.0028*(i-5);
+ else if (i<85 && i>=45) _9PB30[i] = -1.03+0.003*(i-45);
+ else if (i<140 && i >=85) _9PB30[i] = -0.91+0.0017*(i-85);
+ }
+ //printf("90 %1.2f %1.2f %1.2f\n",_9PB30[44],_9PB30[84],_9PB30[139]);
+
+ _9PB40(maxInd);
+ for (int i=0; i140
+ if (i<45 && i>5) _9PB40[i] = -1.16 +0.002*(i-5);
+ else if (i<85 && i>=45) _9PB40[i] = -1.08+0.00275*(i-45);
+ else if (i<140 && i >=85) _9PB40[i] = -0.97+0.0016*(i-85);
+ }
+ //printf("90 %1.2f %1.2f %1.2f\n",_9PB40[44],_9PB40[84],_9PB40[139]);
+
+ _9PB50(maxInd2);
+ for (int i=0; i5) _9PB50[i] = -1.19 +0.00175*(i-5);
+ else if (i<90 && i>=45) _9PB50[i] = -1.12+0.00225*(i-45);
+ }
+ //printf("90 %1.2f %1.2f \n",_9PB50[44],_9PB50[84]);
+
+ _9PB60(maxInd2);
+ for (int i=0; i5) _9PB60[i] = -1.21 +0.0015*(i-5);
+ else if (i<90 && i>=45) _9PB60[i] = -1.15+0.002*(i-45);
+ }
+ //printf("90 %1.2f %1.2f \n",_9PB60[44],_9PB60[89]);
+ _9PB70(maxInd3);
+ for (int i=0; i5) _9PB70[i] = -1.23 +0.0018*(i-5);
+ }
+ //printf("9 %1.2f\n",_9PB70[49]);
+ _9PB80(maxInd3);
+ for (int i=0; i5) _9PB80[i] = -1.24 +0.002*(i-5);
+ }
+ //printf("9 %1.2f %1.2f\n",_9PB80[38], _9PB80[49]);
+
+
+ //10PB
+ _10PB10(maxInd);
+ for (int i=0; i5) _10PB10[i] = -1.02 +0.00425*(i-5);
+ else if (i<85 && i>=45) _10PB10[i] = -0.85+0.0025*(i-45);
+ else if (i<140 && i >=85) _10PB10[i] = -0.75+0.0012*(i-85);
+ }
+ //printf("10 %1.2f %1.2f %1.2f\n",_10PB10[44],_10PB10[84],_10PB10[139]);
+
+ _10PB20(maxInd);
+ for (int i=0; i5) _10PB20[i] = -1.05 +0.00325*(i-5);
+ else if (i<85 && i>=45) _10PB20[i] = -0.92+0.00275*(i-45);
+ else if (i<140 && i >=85) _10PB20[i] = -0.81+0.0014*(i-85);
+ }
+ //printf("10 %1.2f %1.2f %1.2f\n",_10PB20[44],_10PB20[84],_10PB20[139]);
+
+ _10PB30(maxInd);
+ for (int i=0; i5) _10PB30[i] = -1.07 +0.00275*(i-5);
+ else if (i<85 && i>=45) _10PB30[i] = -0.96+0.0025*(i-45);
+ else if (i<140 && i >=85) _10PB30[i] = -0.86+0.0015*(i-85);
+ }
+ //printf("10 %1.2f %1.2f %1.2f\n",_10PB30[44],_10PB30[84],_10PB30[139]);
+
+ _10PB40(maxInd);
+ for (int i=0; i5) _10PB40[i] = -1.09 +0.002*(i-5);
+ else if (i<85 && i>=45) _10PB40[i] = -1.01+0.00225*(i-45);
+ else if (i<140 && i >=85) _10PB40[i] = -0.92+0.0016*(i-85);
+ }
+ //printf("10 %1.2f %1.2f %1.2f\n",_10PB40[44],_10PB40[84],_10PB40[139]);
+
+ _10PB50(maxInd2);
+ for (int i=0; i5) _10PB50[i] = -1.12 +0.00175*(i-5);
+ else if (i<90 && i>=45) _10PB50[i] = -1.05+0.00225*(i-45);
+ }
+ //printf("10 %1.2f %1.2f\n",_10PB50[44],_10PB50[84]);
+
+ _10PB60(maxInd2);
+ for (int i=0; i5) _10PB60[i] = -1.14 +0.0015*(i-5);
+ else if (i<90 && i>=45) _10PB60[i] = -1.08+0.00225*(i-45);
+ }
+ //printf("10 %1.2f %1.2f\n",_10PB60[44],_10PB60[89]);
+
+
+ //1P
+ _1P10(maxInd);
+ for (int i=0; i5) _1P10[i] = -0.96 +0.00375*(i-5);
+ else if (i<85 && i>=45) _1P10[i] = -0.81+0.00225*(i-45);
+ else if (i<140 && i >=85) _1P10[i] = -0.72+0.001*(i-85);
+ }
+ //printf("1P %1.2f %1.2f %1.2f\n",_1P10[44],_1P10[84],_1P10[139]);
+
+ _1P20(maxInd);
+ for (int i=0; i5) _1P20[i] = -1.0 +0.00325*(i-5);
+ else if (i<85 && i>=45) _1P20[i] = -0.87+0.0025*(i-45);
+ else if (i<140 && i >=85) _1P20[i] = -0.77+0.0012*(i-85);
+ }
+ //printf("1P %1.2f %1.2f %1.2f\n",_1P20[44],_1P20[84],_1P20[139]);
+
+ _1P30(maxInd);
+ for (int i=0; i5) _1P30[i] = -1.02 +0.00275*(i-5);
+ else if (i<85 && i>=45) _1P30[i] = -0.91+0.00225*(i-45);
+ else if (i<140 && i >=85) _1P30[i] = -0.82+0.0011*(i-85);
+ }
+ //printf("1P %1.2f %1.2f %1.2f\n",_1P30[44],_1P30[84],_1P30[139]);
+
+ _1P40(maxInd);
+ for (int i=0; i5) _1P40[i] = -1.04 +0.00225*(i-5);
+ else if (i<85 && i>=45) _1P40[i] = -0.95+0.00225*(i-45);
+ else if (i<140 && i >=85) _1P40[i] = -0.86+0.0015*(i-85);
+ }
+ //printf("1P %1.2f %1.2f %1.2f\n",_1P40[44],_1P40[84],_1P40[139]);
+
+ _1P50(maxInd2);
+ for (int i=0; i5) _1P50[i] = -1.06 +0.002*(i-5);
+ else if (i<90 && i>=45) _1P50[i] = -0.98+0.00175*(i-45);
+ }
+ //printf("1P %1.2f %1.2f \n",_1P50[44],_1P50[89]);
+
+ _1P60(maxInd2);
+ for (int i=0; i5) _1P60[i] = -1.07 +0.0015*(i-5);
+ else if (i<90 && i>=45) _1P60[i] = -1.01+0.00175*(i-45);
+ }
+ //printf("1P %1.2f %1.2f \n",_1P60[44],_1P60[84],_1P60[139]);
+
+ //4P
+ _4P10(maxInd);
+ for (int i=0; i5) _4P10[i] = -0.78 +0.002*(i-5);
+ else if (i<85 && i>=45) _4P10[i] = -0.7+0.00125*(i-45);
+ else if (i<140 && i >=85) _4P10[i] = -0.65+0.001*(i-85);
+ }
+ //printf("4P %1.2f %1.2f %1.2f\n",_4P10[44],_4P10[84],_4P10[139]);
+
+ _4P20(maxInd);
+ for (int i=0; i5) _4P20[i] = -0.84 +0.0025*(i-5);
+ else if (i<85 && i>=45) _4P20[i] = -0.74+0.00175*(i-45);
+ else if (i<140 && i >=85) _4P20[i] = -0.67+0.00085*(i-85);
+ }
+ //printf("4P %1.2f %1.2f %1.2f\n",_4P20[44],_4P20[84],_4P20[139]);
+
+ _4P30(maxInd);
+ for (int i=0; i5) _4P30[i] = -0.85 +0.00225*(i-5);
+ else if (i<85 && i>=45) _4P30[i] = -0.76+0.00125*(i-45);
+ else if (i<140 && i >=85) _4P30[i] = -0.71+0.001*(i-85);
+ }
+ //printf("4P %1.2f %1.2f %1.2f\n",_4P30[44],_4P30[84],_4P30[139]);
+
+ _4P40(maxInd);
+ for (int i=0; i5) _4P40[i] = -0.87 +0.00175*(i-5);
+ else if (i<85 && i>=45) _4P40[i] = -0.8+0.00175*(i-45);
+ else if (i<140 && i >=85) _4P40[i] = -0.73+0.00075*(i-85);
+ }
+ //printf("4P %1.2f %1.2f %1.2f\n",_4P40[44],_4P40[84],_4P40[139]);
+
+ _4P50(maxInd2);
+ for (int i=0; i5) _4P50[i] = -0.88 +0.0015*(i-5);
+ else if (i<90 && i>=45) _4P50[i] = -0.82+0.0015*(i-45);
+ }
+ //printf("4P %1.2f %1.2f \n",_4P50[44],_4P50[89]);
+
+ _4P60(maxInd2);
+ for (int i=0; i5) _4P60[i] = -0.89 +0.00125*(i-5);
+ else if (i<90 && i>=45) _4P60[i] = -0.84+0.00125*(i-45);
+ }
+ //printf("4P %1.2f %1.2f\n",_4P60[44],_4P60[89]);
+
+
+ //red yellow correction
+ _10YR20(maxInd2);
+ for (int i=0; i5) _10YR20[i] = 1.22 +0.002*(i-5);
+ else if (i<90 && i>=45) _10YR20[i] = 1.30+0.006*(i-45);
+ }
+ //printf("10YR %1.2f %1.2f\n",_10YR20[44],_10YR20[56]);
+ _10YR30(maxInd2);
+ for (int i=0; i5) _10YR30[i] = 1.27 +0.00175*(i-5);
+ else if (i<90 && i>=45) _10YR30[i] = 1.34+0.0017*(i-45);
+ }
+ //printf("10YR %1.2f %1.2f\n",_10YR30[44],_10YR30[75]);
+ _10YR40(maxInd2);
+ for (int i=0; i5) _10YR40[i] = 1.32 +0.00025*(i-5);
+ else if (i<90 && i>=45) _10YR40[i] = 1.33+0.0015*(i-45);
+ }
+ //printf("10YR %1.2f %1.2f\n",_10YR40[44],_10YR40[85]);
+ _10YR50(maxInd2);
+ for (int i=0; i5) _10YR50[i] = 1.35 +0.000*(i-5);
+ else if (i<90 && i>=45) _10YR50[i] = 1.35+0.0012*(i-45);
+ }
+ //printf("10YR %1.2f %1.2f\n",_10YR50[44],_10YR50[80]);
+ _10YR60(maxInd);
+ for (int i=0; i5) _10YR60[i] = 1.38 - 0.00025*(i-5);
+ else if (i<85 && i>=45) _10YR60[i] = 1.37+0.0005*(i-45);
+ else if (i<140 && i >=85) _10YR60[i] = 1.39+0.0013*(i-85);
+ }
+ //printf("10YR %1.2f %1.2f %1.2f\n",_10YR60[44],_10YR60[85],_10YR60[139] );
+ _10YR70(maxInd);
+ for (int i=0; i5) _10YR70[i] = 1.41 - 0.0005*(i-5);
+ else if (i<85 && i>=45) _10YR70[i] = 1.39+0.000*(i-45);
+ else if (i<140 && i >=85) _10YR70[i] = 1.39+0.0013*(i-85);
+ }
+ //printf("10YR %1.2f %1.2f %1.2f\n",_10YR70[44],_10YR70[85],_10YR70[139] );
+ _10YR80(maxInd);
+ for (int i=0; i5) _10YR80[i] = 1.45 - 0.00125*(i-5);
+ else if (i<85 && i>=45) _10YR80[i] = 1.40+0.000*(i-45);
+ else if (i<140 && i >=85) _10YR80[i] = 1.40+0.00072*(i-85);//1.436
+ }
+ //printf("10YR %1.2f %1.2f %1.2f\n",_10YR80[44],_10YR80[84],_10YR80[139] );
+ _10YR90(maxInd2);
+ for (int i=0; i5) _10YR90[i] = 1.48 -0.001*(i-5);
+ else if (i<90 && i>=45) _10YR90[i] = 1.44-0.0009*(i-45);
+ }
+ //printf("10YR %1.2f %1.2f\n",_10YR90[45],_10YR90[80]);
+ _85YR20(maxInd3);
+ for (int i=0; i5) _85YR20[i] = 1.12 +0.004*(i-5);
+ }
+
+ //printf("85YR %1.2f \n",_85YR20[44]);
+ _85YR30(maxInd2);
+ for (int i=0; i5) _85YR30[i] = 1.16 + 0.0025*(i-5);
+ else if (i<90 && i>=45) _85YR30[i] = 1.26+0.0028*(i-45);
+ }
+ //printf("85YR %1.2f %1.2f\n",_85YR30[44],_85YR30[75]);
+ _85YR40(maxInd2);
+ for (int i=0; i5) _85YR40[i] = 1.20 + 0.0015*(i-5);
+ else if (i<90 && i>=45) _85YR40[i] = 1.26+0.0024*(i-45);
+ }
+ //printf("85YR %1.2f %1.2f\n",_85YR40[44],_85YR40[75]);
+ _85YR50(maxInd);
+ for (int i=0; i5) _85YR50[i] = 1.24 + 0.0005*(i-5);
+ else if (i<85 && i>=45) _85YR50[i] = 1.26+0.002*(i-45);
+ else if (i<140 && i >=85) _85YR50[i] = 1.34+0.0015*(i-85);
+ }
+ //printf("85YR %1.2f %1.2f %1.2f\n",_85YR50[44],_85YR50[85],_85YR50[110] );
+ _85YR60(maxInd);
+ for (int i=0; i5) _85YR60[i] = 1.27 + 0.00025*(i-5);
+ else if (i<85 && i>=45) _85YR60[i] = 1.28+0.0015*(i-45);
+ else if (i<140 && i >=85) _85YR60[i] = 1.34+0.0012*(i-85);
+ }
+ //printf("85YR %1.2f %1.2f %1.2f\n",_85YR60[44],_85YR60[85],_85YR60[139] );
+
+ _85YR70(maxInd);
+ for (int i=0; i5) _85YR70[i] = 1.31 - 0.00025*(i-5);
+ else if (i<85 && i>=45) _85YR70[i] = 1.30+0.0005*(i-45);
+ else if (i<140 && i >=85) _85YR70[i] = 1.32+0.0012*(i-85);
+ }
+ //printf("85YR %1.2f %1.2f %1.2f\n",_85YR70[44],_85YR70[85],_85YR70[139] );
+ _85YR80(maxInd);
+ for (int i=0; i5) _85YR80[i] = 1.35 - 0.00075*(i-5);
+ else if (i<85 && i>=45) _85YR80[i] = 1.32+0.00025*(i-45);
+ else if (i<140 && i >=85) _85YR80[i] = 1.33+0.00125*(i-85);
+ }
+ //printf("85YR %1.2f %1.2f %1.2f\n",_85YR80[44],_85YR80[85],_85YR80[139] );
+ _85YR90(maxInd2);
+ for (int i=0; i5) _85YR90[i] = 1.39 - 0.00125*(i-5);
+ else if (i<90 && i>=45) _85YR90[i] = 1.34+0.00*(i-45);
+ }
+ //printf("85YR %1.2f %1.2f\n",_85YR90[44],_85YR90[85]);
+
+ //7YR
+ _7YR30(maxInd2);
+ for (int i=0; i5) _7YR30[i] = 1.06 + 0.0028*(i-5);
+ else if (i<90 && i>=45) _7YR30[i] = 1.17+0.0045*(i-45);
+ }
+ //printf("7YR %1.2f %1.2f\n",_7YR30[44],_7YR30[66]);
+ _7YR40(maxInd2);
+ for (int i=0; i5) _7YR40[i] = 1.10 + 0.0018*(i-5);
+ else if (i<90 && i>=45) _7YR40[i] = 1.17+0.0035*(i-45);
+ }
+ //printf("7YR %1.2f %1.2f\n",_7YR40[44],_7YR40[89]);
+ _7YR50(maxInd2);
+ for (int i=0; i5) _7YR50[i] = 1.14 + 0.00125*(i-5);
+ else if (i<90 && i>=45) _7YR50[i] = 1.19+0.002*(i-45);
+ }
+ //printf("7YR %1.2f %1.2f\n",_7YR50[44],_7YR50[89] );
+ _7YR60(maxInd);
+ for (int i=0; i5) _7YR60[i] = 1.17 + 0.00075*(i-5);
+ else if (i<85 && i>=45) _7YR60[i] = 1.20+0.00175*(i-45);
+ else if (i<140 && i >=85) _7YR60[i] = 1.27+0.002*(i-85);
+ }
+ //printf("7YR %1.2f %1.2f %1.2f\n",_7YR60[44],_7YR60[84],_7YR60[125] );
+
+ _7YR70(maxInd);
+ for (int i=0; i5) _7YR70[i] = 1.20 + 0.0005*(i-5);
+ else if (i<85 && i>=45) _7YR70[i] = 1.22+0.00125*(i-45);
+ else if (i<140 && i >=85) _7YR70[i] = 1.27+0.0015*(i-85);
+ }
+ //printf("7YR %1.2f %1.2f %1.2f\n",_7YR70[44],_7YR70[84],_7YR70[125] );
+ _7YR80(maxInd3);
+ for (int i=0; i5) _7YR80[i] = 1.29 - 0.0008*(i-5);
+ }
+ //printf("7YR %1.2f \n",_7YR80[44] );
+ _55YR30(maxInd3);
+ for (int i=0; i5) _55YR30[i] = 0.96 + 0.0038*(i-5);
+ }
+ //printf("55YR %1.2f \n",_55YR30[44] );
+ _55YR40(maxInd2);
+ for (int i=0; i5) _55YR40[i] = 1.01 + 0.0022*(i-5);
+ else if (i<90 && i>=45) _55YR40[i] = 1.10+0.0037*(i-45);
+ }
+ //printf("55YR %1.2f %1.2f\n",_55YR40[44],_55YR40[89] );
+ _55YR50(maxInd);
+ for (int i=0; i5) _55YR50[i] = 1.06 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _55YR50[i] = 1.12+0.00225*(i-45);
+ else if (i<140 && i >=85) _55YR50[i] = 1.21+0.0015*(i-85);
+ }
+ //printf("55YR %1.2f %1.2f %1.2f\n",_55YR50[44],_55YR50[84],_55YR50[125] );
+ _55YR60(maxInd);
+ for (int i=0; i5) _55YR60[i] = 1.08 + 0.0012*(i-5);
+ else if (i<85 && i>=45) _55YR60[i] = 1.13+0.0018*(i-45);
+ else if (i<140 && i >=85) _55YR60[i] = 1.20+0.0025*(i-85);
+ }
+ //printf("55YR %1.2f %1.2f %1.2f\n",_55YR60[44],_55YR60[84],_55YR60[125] );
+ _55YR70(maxInd);
+ for (int i=0; i5) _55YR70[i] = 1.11 + 0.00075*(i-5);
+ else if (i<85 && i>=45) _55YR70[i] = 1.14+0.0012*(i-45);
+ else if (i<140 && i >=85) _55YR70[i] = 1.19+0.00225*(i-85);
+ }
+ //printf("55YR %1.2f %1.2f %1.2f\n",_55YR70[44],_55YR70[84],_55YR70[125] );
+ _55YR80(maxInd);
+ for (int i=0; i5) _55YR80[i] = 1.16 + 0.00*(i-5);
+ else if (i<85 && i>=45) _55YR80[i] = 1.16+0.00075*(i-45);
+ else if (i<140 && i >=85) _55YR80[i] = 1.19+0.00175*(i-85);
+ }
+ //printf("55YR %1.2f %1.2f %1.2f\n",_55YR80[44],_55YR80[84],_55YR80[125] );
+ _55YR90(maxInd3);
+ for (int i=0; i5) _55YR90[i] = 1.19 - 0.0005*(i-5);
+ }
+ //printf("55YR %1.2f \n",_55YR90[44] );
+
+ _4YR30(maxInd2);
+ for (int i=0; i5) _4YR30[i] = 0.87 + 0.0035*(i-5);
+ else if (i<90 && i>=45) _4YR30[i] = 1.01+0.0043*(i-45);
+ }
+ //printf("4YR %1.2f %1.2f\n",_4YR30[44],_4YR30[78] );
+ _4YR40(maxInd2);
+ for (int i=0; i5) _4YR40[i] = 0.92 + 0.0025*(i-5);
+ else if (i<90 && i>=45) _4YR40[i] = 1.02+0.0033*(i-45);
+ }
+ //printf("4YR %1.2f %1.2f\n",_4YR40[44],_4YR40[74] );
+ _4YR50(maxInd2);
+ for (int i=0; i5) _4YR50[i] = 0.97 + 0.0015*(i-5);
+ else if (i<90 && i>=45) _4YR50[i] = 1.03+0.0025*(i-45);
+ }
+ //printf("4YR %1.2f %1.2f\n",_4YR50[44],_4YR50[85] );
+ _4YR60(maxInd);
+ for (int i=0; i5) _4YR60[i] = 0.99 + 0.00125*(i-5);
+ else if (i<85 && i>=45) _4YR60[i] = 1.04+0.002*(i-45);
+ else if (i<140 && i >=85) _4YR60[i] = 1.12+0.003*(i-85);
+ }
+ //printf("4YR %1.2f %1.2f %1.2f\n",_4YR60[44],_4YR60[84],_4YR60[125] );
+ _4YR70(maxInd);
+ for (int i=0; i5) _4YR70[i] = 1.02 + 0.00075*(i-5);
+ else if (i<85 && i>=45) _4YR70[i] = 1.05+0.00175*(i-45);
+ else if (i<140 && i >=85) _4YR70[i] = 1.12+0.002*(i-85);
+ }
+ //printf("4YR %1.2f %1.2f %1.2f\n",_4YR70[44],_4YR70[84],_4YR70[125] );
+ _4YR80(maxInd3);
+ for (int i=0; i5) _4YR80[i] = 1.09 - 0.0002*(i-5);
+ }
+ //printf("4YR %1.2f \n",_4YR80[41] );
+
+ _25YR30(maxInd2);
+ for (int i=0; i5) _25YR30[i] = 0.77 + 0.004*(i-5);
+ else if (i<90 && i>=45) _25YR30[i] = 0.94+0.004*(i-45);
+ }
+ //printf("25YR %1.2f %1.2f\n",_25YR30[44],_25YR30[74] );
+ _25YR40(maxInd2);
+ for (int i=0; i5) _25YR40[i] = 0.82 + 0.003*(i-5);
+ else if (i<90 && i>=45) _25YR40[i] = 0.94+0.002*(i-45);
+ }
+ //printf("25YR %1.2f %1.2f\n",_25YR40[44],_25YR40[84] );
+ _25YR50(maxInd2);
+ for (int i=0; i5) _25YR50[i] = 0.87+ 0.002*(i-5);
+ else if (i<90 && i>=45) _25YR50[i] = 0.95+0.003*(i-45);
+ }
+ //printf("25YR %1.2f %1.2f\n",_25YR50[44],_25YR50[84] );
+ _25YR60(maxInd2);
+ for (int i=0; i5) _25YR60[i] = 0.89+ 0.0015*(i-5);
+ else if (i<90 && i>=45) _25YR60[i] = 0.95+0.004*(i-45);
+ }
+ //printf("25YR %1.2f %1.2f\n",_25YR60[44],_25YR60[84] );
+ _25YR70(maxInd2);
+ for (int i=0; i5) _25YR70[i] = 0.92+ 0.001*(i-5);
+ else if (i<90 && i>=45) _25YR70[i] = 0.96+0.003*(i-45);
+ }
+ //printf("25YR %1.2f %1.2f\n",_25YR70[44],_25YR70[84] );
+
+ _10R30(maxInd2);
+ for (int i=0; i5) _10R30[i] = 0.62 + 0.00225*(i-5);
+ else if (i<90 && i>=45) _10R30[i] = 0.71+0.003*(i-45);
+ }
+ //printf("10R %1.2f %1.2f\n",_10R30[44],_10R30[84] );
+ _10R40(maxInd2);
+ for (int i=0; i5) _10R40[i] = 0.66 + 0.0025*(i-5);
+ else if (i<90 && i>=45) _10R40[i] = 0.76+0.0035*(i-45);
+ }
+ //printf("10R %1.2f %1.2f\n",_10R40[44],_10R40[84] );
+ _10R50(maxInd2);
+ for (int i=0; i5) _10R50[i] = 0.71 + 0.002*(i-5);
+ else if (i<90 && i>=45) _10R50[i] = 0.79+0.0043*(i-45);
+ }
+ //printf("10R %1.2f %1.2f\n",_10R50[44],_10R50[84] );
+ _10R60(maxInd);
+ for (int i=0; i5) _10R60[i] = 0.73 + 0.00175*(i-5);
+ else if (i<85 && i>=45) _10R60[i] = 0.80 +0.0033*(i-45);
+ else if (i<140 && i >=85) _10R60[i] = 0.93+0.0018*(i-85);
+ }
+ //printf("10R %1.2f %1.2f %1.2f\n",_10R60[44],_10R60[84],_10R60[125] );
+ _10R70(maxInd);
+ for (int i=0; i5) _10R70[i] = 0.75 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _10R70[i] = 0.81 +0.0017*(i-45);
+ else if (i<140 && i >=85) _10R70[i] = 0.88+0.0025*(i-85);
+ }
+ //printf("10R %1.2f %1.2f %1.2f\n",_10R70[44],_10R70[84],_10R70[125] );
+
+ _9R30(maxInd2);
+ for (int i=0; i5) _9R30[i] = 0.57 + 0.002*(i-5);
+ else if (i<90 && i>=45) _9R30[i] = 0.65+0.0018*(i-45);
+ }
+ //printf("9R %1.2f %1.2f\n",_9R30[44],_9R30[84] );
+ _9R40(maxInd2);
+ for (int i=0; i5) _9R40[i] = 0.61 + 0.002*(i-5);
+ else if (i<90 && i>=45) _9R40[i] = 0.69+0.0025*(i-45);
+ }
+ //printf("9R %1.2f %1.2f\n",_9R40[44],_9R40[84] );
+ _9R50(maxInd);
+ for (int i=0; i5) _9R50[i] = 0.66 + 0.00175*(i-5);
+ else if (i<85 && i>=45) _9R50[i] = 0.73 +0.0025*(i-45);
+ else if (i<140 && i >=85) _9R50[i] = 0.83+0.0035*(i-85);
+ }
+ //printf("9R %1.2f %1.2f %1.2f\n",_9R50[44],_9R50[84],_9R50[125] );
+ _9R60(maxInd);
+ for (int i=0; i5) _9R60[i] = 0.68 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _9R60[i] = 0.74 +0.0022*(i-45);
+ else if (i<140 && i >=85) _9R60[i] = 0.93+0.0022*(i-85);
+ }
+ //printf("9R %1.2f %1.2f %1.2f\n",_9R60[44],_9R60[84],_9R60[125] );
+ _9R70(maxInd2);
+ for (int i=0; i5) _9R70[i] = 0.70 + 0.0012*(i-5);
+ else if (i<90 && i>=45) _9R70[i] = 0.75+0.0013*(i-45);
+ }
+ //printf("9R %1.2f %1.2f\n",_9R70[44],_9R70[84] );
+
+ _7R30(maxInd2);
+ for (int i=0; i5) _7R30[i] = 0.48 + 0.0015*(i-5);
+ else if (i<90 && i>=45) _7R30[i] = 0.54-0.0005*(i-45);
+ }
+ //printf("7R %1.2f %1.2f\n",_7R30[44],_7R30[84] );
+ _7R40(maxInd2);
+ for (int i=0; i5) _7R40[i] = 0.51 + 0.0015*(i-5);
+ else if (i<90 && i>=45) _7R40[i] = 0.57+0.0005*(i-45);
+ }
+ //printf("7R %1.2f %1.2f\n",_7R40[44],_7R40[84] );
+ _7R50(maxInd);
+ for (int i=0; i5) _7R50[i] = 0.54 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _7R50[i] = 0.60 +0.0005*(i-45);
+ else if (i<140 && i >=85) _7R50[i] = 0.62+0.0025*(i-85);
+ }
+ //printf("7R %1.2f %1.2f %1.2f\n",_7R50[44],_7R50[84],_7R50[125] );
+ _7R60(maxInd);
+ for (int i=0; i5) _7R60[i] = 0.58 + 0.00075*(i-5);
+ else if (i<85 && i>=45) _7R60[i] = 0.61 +0.00075*(i-45);
+ else if (i<140 && i >=85) _7R60[i] = 0.64+0.001*(i-85);
+ }
+ //printf("7R %1.2f %1.2f %1.2f\n",_7R60[44],_7R60[84],_7R60[107] );
+ _7R70(maxInd2);
+ for (int i=0; i5) _7R70[i] = 0.59 + 0.00075*(i-5);
+ else if (i<90 && i>=45) _7R70[i] = 0.62+0.00075*(i-45);
+ }
+ //printf("7R %1.2f %1.2f\n",_7R70[44],_7R70[84] );
+
+ //5R 1 2 3
+
+ //5R
+ _5R10(maxInd2);
+ for (int i=0; i5) _5R10[i] = 0.10 - 0.0018*(i-5);
+ else if (i<90 && i>=45) _5R10[i] = 0.035-0.003*(i-45);
+ }
+ //printf("5R %1.2f %1.2f\n",_5R10[44],_5R10[51] );
+ _5R20(maxInd2);
+ for (int i=0; i5) _5R20[i] = 0.26 - 0.00075*(i-5);
+ else if (i<90 && i>=45) _5R20[i] = 0.023-0.0002*(i-45);
+ }
+ //printf("5R %1.2f %1.2f\n",_5R20[44],_5R20[70] );
+ _5R30(maxInd2);
+ for (int i=0; i5) _5R30[i] = 0.39 + 0.00075*(i-5);
+ else if (i<90 && i>=45) _5R30[i] = 0.42-0.0007*(i-45);
+ }
+ //printf("5R %1.2f %1.2f\n",_5R30[44],_5R30[85] );
+
+ //25R
+ _25R10(maxInd3);
+ for (int i=0; i5) _25R10[i] = -0.03 - 0.002*(i-5);
+ }
+ //printf("25R %1.2f \n",_25R10[44]);
+ _25R20(maxInd2);
+ for (int i=0; i5) _25R20[i] = 0.13 - 0.0012*(i-5);
+ else if (i<90 && i>=45) _25R20[i] = 0.08-0.002*(i-45);
+ }
+ //printf("25R %1.2f %1.2f\n",_25R20[44],_25R20[69] );
+ //25R30: 0.28, 0.26, 0.22
+ _25R30(maxInd2);
+ for (int i=0; i5) _25R30[i] = 0.28 - 0.0005*(i-5);
+ else if (i<90 && i>=45) _25R30[i] = 0.26-0.0009*(i-45);
+ }
+ //printf("25R %1.2f %1.2f\n",_25R30[44],_25R30[85] );
+
+
+ _10RP10(maxInd3);
+ for (int i=0; i5) _10RP10[i] = -0.16 - 0.0017*(i-5);
+ }
+ //printf("10RP %1.2f \n",_10RP10[44]);
+ _10RP20(maxInd2);
+ for (int i=0; i5) _10RP20[i] = 0.0 - 0.0018*(i-5);
+ else if (i<90 && i>=45) _10RP20[i] = -0.07-0.0012*(i-45);
+ }
+ //printf("10RP %1.2f %1.2f\n",_10RP20[44],_10RP20[69] );
+ _10RP30(maxInd2);
+ for (int i=0; i5) _10RP30[i] = 0.15 - 0.001*(i-5);
+ else if (i<90 && i>=45) _10RP30[i] = 0.11-0.0012*(i-45);
+ }
+ //printf("10RP %1.2f %1.2f\n",_10RP30[44],_10RP30[85] );
+
+ //7G
+ _7G30(maxInd);
+ for (int i=0; i5) _7G30[i] = 2.90 + 0.0027*(i-5);
+ else if (i<85 && i>=45) _7G30[i] = 3.01+0.0005*(i-45);
+ else if (i<140 && i >=85) _7G30[i] = 3.03+0.00075*(i-85);
+ }
+ //printf("7G %1.2f %1.2f %1.2f\n",_7G30[44],_7G30[84],_7G30[125] );
+ _7G40(maxInd);
+ for (int i=0; i5) _7G40[i] = 2.89 + 0.00125*(i-5);
+ else if (i<85 && i>=45) _7G40[i] = 2.94+0.0015*(i-45);
+ else if (i<140 && i >=85) _7G40[i] = 3.0+0.001*(i-85);
+ }
+ //printf("7G %1.2f %1.2f %1.2f\n",_7G40[44],_7G40[84],_7G40[125] );
+ _7G50(maxInd);
+ for (int i=0; i5) _7G50[i] = 2.87 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _7G50[i] = 2.93+0.00125*(i-45);
+ else if (i<140 && i >=85) _7G50[i] = 2.98+0.001*(i-85);
+ }
+ //printf("7G %1.2f %1.2f %1.2f\n",_7G50[44],_7G50[84],_7G50[125] );
+ _7G60(maxInd);
+ for (int i=0; i5) _7G60[i] = 2.86 + 0.00125*(i-5);
+ else if (i<85 && i>=45) _7G60[i] = 2.91+0.00125*(i-45);
+ else if (i<140 && i >=85) _7G60[i] = 2.96+0.00075*(i-85);
+ }
+ //printf("7G %1.2f %1.2f %1.2f\n",_7G60[44],_7G60[84],_7G60[125] );
+ _7G70(maxInd);
+ for (int i=0; i5) _7G70[i] = 2.85 + 0.001*(i-5);
+ else if (i<85 && i>=45) _7G70[i] = 2.89+0.00125*(i-45);
+ else if (i<140 && i >=85) _7G70[i] = 2.94+0.00075*(i-85);
+ }
+ //printf("7G %1.2f %1.2f %1.2f\n",_7G70[44],_7G70[84],_7G70[125] );
+ _7G80(maxInd);
+ for (int i=0; i5) _7G80[i] = 2.84 + 0.001*(i-5);
+ else if (i<85 && i>=45) _7G80[i] = 2.88+0.001*(i-45);
+ else if (i<140 && i >=85) _7G80[i] = 2.92+0.001*(i-85);
+ }
+ //printf("7G %1.2f %1.2f %1.2f\n",_7G80[44],_7G80[84],_7G80[125] );
+
+
+ //5G
+ _5G30(maxInd);
+ for (int i=0; i5) _5G30[i] = 2.82 + 0.00175*(i-5);
+ else if (i<85 && i>=45) _5G30[i] = 2.89+0.0018*(i-45);
+ else if (i<140 && i >=85) _5G30[i] = 2.96+0.0012*(i-85);
+ }
+ //printf("5G %1.2f %1.2f %1.2f\n",_5G30[44],_5G30[84],_5G30[125] );
+ _5G40(maxInd);
+ for (int i=0; i5) _5G40[i] = 2.80 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _5G40[i] = 2.86+0.00175*(i-45);
+ else if (i<140 && i >=85) _5G40[i] = 2.93+0.00125*(i-85);
+ }
+ //printf("5G %1.2f %1.2f %1.2f\n",_5G40[44],_5G40[84],_5G40[125] );
+ _5G50(maxInd);
+ for (int i=0; i5) _5G50[i] = 2.79 + 0.001*(i-5);
+ else if (i<85 && i>=45) _5G50[i] = 2.84+0.0015*(i-45);
+ else if (i<140 && i >=85) _5G50[i] = 2.90+0.0015*(i-85);
+ }
+ //printf("5G %1.2f %1.2f %1.2f\n",_5G50[44],_5G50[84],_5G50[125] );
+ _5G60(maxInd);
+ for (int i=0; i5) _5G60[i] = 2.78 + 0.001*(i-5);
+ else if (i<85 && i>=45) _5G60[i] = 2.82+0.00175*(i-45);
+ else if (i<140 && i >=85) _5G60[i] = 2.89+0.001*(i-85);
+ }
+ //printf("5G %1.2f %1.2f %1.2f\n",_5G60[44],_5G60[84],_5G60[125] );
+ _5G70(maxInd);
+ for (int i=0; i5) _5G70[i] = 2.77 + 0.001*(i-5);
+ else if (i<85 && i>=45) _5G70[i] = 2.81+0.00125*(i-45);
+ else if (i<140 && i >=85) _5G70[i] = 2.86+0.00125*(i-85);
+ }
+ //printf("5G %1.2f %1.2f %1.2f\n",_5G70[44],_5G70[84],_5G70[125] );
+ _5G80(maxInd);
+ for (int i=0; i5) _5G80[i] = 2.76 + 0.001*(i-5);
+ else if (i<85 && i>=45) _5G80[i] = 2.8+0.00125*(i-45);
+ else if (i<140 && i >=85) _5G80[i] = 2.85+0.00125*(i-85);
+ }
+ //printf("5G %1.2f %1.2f %1.2f\n",_5G80[44],_5G80[84],_5G80[125] );
+
+ //25G
+ _25G30(maxInd);
+ for (int i=0; i5) _25G30[i] = 2.68 + 0.0015*(i-5);
+ else if (i<85 && i>=45) _25G30[i] = 2.74+0.0018*(i-45);
+ else if (i<140 && i >=85) _25G30[i] = 2.81+0.002*(i-85);
+ }
+ //printf("25G %1.2f %1.2f %1.2f\n",_25G30[44],_25G30[84],_25G30[125] );
+ _25G40(maxInd);
+ for (int i=0; i5) _25G40[i] = 2.68 + 0.00075*(i-5);
+ else if (i<85 && i>=45) _25G40[i] = 2.71+0.0015*(i-45);
+ else if (i<140 && i >=85) _25G40[i] = 2.77+0.00125*(i-85);
+ }
+ //printf("25G %1.2f %1.2f %1.2f\n",_25G40[44],_25G40[84],_25G40[125] );
+ _25G50(maxInd);
+ for (int i=0; i5) _25G50[i] = 2.65 + 0.00075*(i-5);
+ else if (i<85 && i>=45) _25G50[i] = 2.68+0.00125*(i-45);
+ else if (i<140 && i >=85) _25G50[i] = 2.73+0.00125*(i-85);
+ }
+ //printf("25G %1.2f %1.2f %1.2f\n",_25G50[44],_25G50[84],_25G50[125] );
+ _25G60(maxInd);
+ for (int i=0; i5) _25G60[i] = 2.64 + 0.0005*(i-5);
+ else if (i<85 && i>=45) _25G60[i] = 2.66+0.001*(i-45);
+ else if (i<140 && i >=85) _25G60[i] = 2.70+0.001*(i-85);
+ }
+ //printf("25G %1.2f %1.2f %1.2f\n",_25G60[44],_25G60[84],_25G60[125] );
+ _25G70(maxInd);
+ for (int i=0; i5) _25G70[i] = 2.64 + 0.00*(i-5);
+ else if (i<85 && i>=45) _25G70[i] = 2.64+0.00075*(i-45);
+ else if (i<140 && i >=85) _25G70[i] = 2.67+0.001*(i-85);
+ }
+ //printf("25G %1.2f %1.2f %1.2f\n",_25G70[44],_25G70[84],_25G70[125] );
+ _25G80(maxInd);
+ for (int i=0; i5) _25G80[i] = 2.63 + 0.00*(i-5);
+ else if (i<85 && i>=45) _25G80[i] = 2.63+0.0005*(i-45);
+ else if (i<140 && i >=85) _25G80[i] = 2.65+0.0005*(i-85);
+ }
+ //printf("25G %1.2f %1.2f %1.2f\n",_25G80[44],_25G80[84],_25G80[125] );
+
+
+ //1G
+ _1G30(maxInd);
+ for (int i=0; i5) _1G30[i] = 2.58 + 0.00025*(i-5);
+ else if (i<85 && i>=45) _1G30[i] = 2.59+0.001*(i-45);
+ else if (i<140 && i >=85) _1G30[i] = 2.63+0.00125*(i-85);
+ }
+ //printf("1G %1.2f %1.2f %1.2f\n",_1G30[44],_1G30[84],_1G30[125] );
+ _1G40(maxInd);
+ for (int i=0; i5) _1G40[i] = 2.56 - 0.00025*(i-5);
+ else if (i<85 && i>=45) _1G40[i] = 2.55+0.0005*(i-45);
+ else if (i<140 && i >=85) _1G40[i] = 2.57+0.0005*(i-85);
+ }
+ //printf("1G %1.2f %1.2f %1.2f\n",_1G40[44],_1G40[84],_1G40[125] );
+ _1G50(maxInd);
+ for (int i=0; i5) _1G50[i] = 2.55 - 0.00025*(i-5);
+ else if (i<85 && i>=45) _1G50[i] = 2.54+0.00025*(i-45);
+ else if (i<140 && i >=85) _1G50[i] = 2.55+0.0005*(i-85);
+ }
+ //printf("1G %1.2f %1.2f %1.2f\n",_1G50[44],_1G50[84],_1G50[125] );
+ _1G60(maxInd);
+ for (int i=0; i5) _1G60[i] = 2.54 - 0.0005*(i-5);
+ else if (i<85 && i>=45) _1G60[i] = 2.52+0.00025*(i-45);
+ else if (i<140 && i >=85) _1G60[i] = 2.53+0.00025*(i-85);
+ }
+ //printf("1G %1.2f %1.2f %1.2f\n",_1G60[44],_1G60[84],_1G60[125] );
+ _1G70(maxInd);
+ for (int i=0; i5) _1G70[i] = 2.53 - 0.0005*(i-5);
+ else if (i<85 && i>=45) _1G70[i] = 2.51+0.0*(i-45);
+ else if (i<140 && i >=85) _1G70[i] = 2.51+0.00025*(i-85);
+ }
+ //printf("1G %1.2f %1.2f %1.2f\n",_1G70[44],_1G70[84],_1G70[125] );
+ _1G80(maxInd);
+ for (int i=0; i5) _1G80[i] = 2.52 - 0.0005*(i-5);
+ else if (i<85 && i>=45) _1G80[i] = 2.50+0.00*(i-45);
+ else if (i<140 && i >=85) _1G80[i] = 2.50+0.00*(i-85);
+ }
+ //printf("1G %1.2f %1.2f %1.2f\n",_1G80[44],_1G80[84],_1G80[125] );
+
+
+ //10GY
+ _10GY30(maxInd);
+ for (int i=0; i5) _10GY30[i] = 2.52 - 0.001*(i-5);
+ else if (i<85 && i>=45) _10GY30[i] = 2.48-0.002*(i-45);
+ else if (i<140 && i >=85) _10GY30[i] = 2.40+0.0025*(i-85);
+ }
+ //printf("10GY %1.2f %1.2f %1.2f\n",_10GY30[44],_10GY30[84],_10GY30[125] );
+ _10GY40(maxInd);
+ for (int i=0; i5) _10GY40[i] = 2.48 - 0.0005*(i-5);
+ else if (i<85 && i>=45) _10GY40[i] = 2.46-0.0005*(i-45);
+ else if (i<140 && i >=85) _10GY40[i] = 2.44-0.0015*(i-85);
+ }
+ //printf("10GY %1.2f %1.2f %1.2f\n",_10GY40[44],_10GY40[84],_10GY40[125] );
+ _10GY50(maxInd);
+ for (int i=0; i5) _10GY50[i] = 2.48 - 0.00075*(i-5);
+ else if (i<85 && i>=45) _10GY50[i] = 2.45-0.00075*(i-45);
+ else if (i<140 && i >=85) _10GY50[i] = 2.42-0.00175*(i-85);
+ }
+ //printf("10GY %1.2f %1.2f %1.2f\n",_10GY50[44],_10GY50[84],_10GY50[125] );
+ _10GY60(maxInd);
+ for (int i=0; i5) _10GY60[i] = 2.47 - 0.00125*(i-5);
+ else if (i<85 && i>=45) _10GY60[i] = 2.42-0.00025*(i-45);
+ else if (i<140 && i >=85) _10GY60[i] = 2.41-0.0005*(i-85);
+ }
+ //printf("10GY %1.2f %1.2f %1.2f\n",_10GY60[44],_10GY60[84],_10GY60[125] );
+ _10GY70(maxInd);
+ for (int i=0; i5) _10GY70[i] = 2.46 - 0.001*(i-5);
+ else if (i<85 && i>=45) _10GY70[i] = 2.42+0.0*(i-45);
+ else if (i<140 && i >=85) _10GY70[i] = 2.42-0.001*(i-85);
+ }
+ //printf("10GY %1.2f %1.2f %1.2f\n",_10GY70[44],_10GY70[84],_10GY70[125] );
+ _10GY80(maxInd);
+ for (int i=0; i5) _10GY80[i] = 2.45 - 0.00075*(i-5);
+ else if (i<85 && i>=45) _10GY80[i] = 2.42 - 0.0005*(i-45);
+ else if (i<140 && i >=85) _10GY80[i] = 2.40-0.0005*(i-85);
+ }
+ //printf("10GY %1.2f %1.2f %1.2f\n",_10GY80[44],_10GY80[84],_10GY80[125] );
+
+
+ //75GY
+ _75GY30(maxInd2);
+ for (int i=0; i5) _75GY30[i] = 2.36 - 0.0025*(i-5);
+ else if (i<90 && i>=45) _75GY30[i] = 2.26-0.00175*(i-45);
+ }
+ //printf("75GY %1.2f %1.2f\n",_75GY30[44],_75GY30[84] );
+ _75GY40(maxInd2);
+ for (int i=0; i5) _75GY40[i] = 2.34 - 0.00175*(i-5);
+ else if (i<90 && i>=45) _75GY40[i] = 2.27-0.00225*(i-45);
+ }
+ //printf("75GY %1.2f %1.2f \n",_75GY40[44],_75GY40[84] );
+ _75GY50(maxInd);
+ for (int i=0; i5) _75GY50[i] = 2.32 - 0.0015*(i-5);
+ else if (i<85 && i>=45) _75GY50[i] = 2.26-0.00175*(i-45);
+ else if (i<140 && i >=85) _75GY50[i] = 2.19-0.00325*(i-85);
+ }
+ //printf("75GY %1.2f %1.2f %1.2f %1.2f\n",_75GY50[44],_75GY50[84],_75GY50[125],_75GY50[139] );
+ _75GY60(maxInd);
+ for (int i=0; i5) _75GY60[i] = 2.30 - 0.00125*(i-5);
+ else if (i<85 && i>=45) _75GY60[i] = 2.25-0.001*(i-45);
+ else if (i<140 && i >=85) _75GY60[i] = 2.21-0.0027*(i-85);
+ }
+ //printf("75GY %1.2f %1.2f %1.2f\n",_75GY60[44],_75GY60[84],_75GY60[125] );
+ _75GY70(maxInd);
+ for (int i=0; i5) _75GY70[i] = 2.29 - 0.00125*(i-5);
+ else if (i<85 && i>=45) _75GY70[i] = 2.24-0.0015*(i-45);
+ else if (i<140 && i >=85) _75GY70[i] = 2.18-0.00175*(i-85);
+ }
+ //printf("75GY %1.2f %1.2f %1.2f\n",_75GY70[44],_75GY70[84],_75GY70[125] );
+ _75GY80(maxInd);
+ for (int i=0; i5) _75GY80[i] = 2.27 - 0.001*(i-5);
+ else if (i<85 && i>=45) _75GY80[i] = 2.23 - 0.001*(i-45);
+ else if (i<140 && i >=85) _75GY80[i] = 2.19-0.00175*(i-85);
+ }
+ //printf("75GY %1.2f %1.2f %1.2f\n",_75GY80[44],_75GY80[84],_75GY80[125] );
+
+
+ //55GY
+ _5GY30(maxInd2);
+ for (int i=0; i5) _5GY30[i] = 2.16 - 0.002*(i-5);
+ else if (i<90 && i>=45) _5GY30[i] = 2.07-0.0025*(i-45);
+ }
+ //printf("5GY %1.2f %1.2f\n",_5GY30[44],_5GY30[84] );
+
+ //5GY4: 2.14,2.04, 1.96, 1.91 //95
+
+ _5GY40(maxInd2);
+ for (int i=0; i5) _5GY40[i] = 2.14 - 0.0025*(i-5);
+ else if (i<90 && i>=45) _5GY40[i] = 2.04-0.003*(i-45);
+ }
+ //printf("5GY %1.2f %1.2f \n",_5GY40[44],_5GY40[84] );
+ _5GY50(maxInd);
+ for (int i=0; i5) _5GY50[i] = 2.13 - 0.00175*(i-5);
+ else if (i<85 && i>=45) _5GY50[i] = 2.06-0.002*(i-45);
+ else if (i<140 && i >=85) _5GY50[i] = 1.98-0.00225*(i-85);
+ }
+ //printf("5GY %1.2f %1.2f %1.2f\n",_5GY50[44],_5GY50[84],_5GY50[125] );
+ _5GY60(maxInd);
+ for (int i=0; i5) _5GY60[i] = 2.11 - 0.0015*(i-5);
+ else if (i<85 && i>=45) _5GY60[i] = 2.05-0.002*(i-45);
+ else if (i<140 && i >=85) _5GY60[i] = 1.97-0.00275*(i-85);
+ }
+ //printf("5GY %1.2f %1.2f %1.2f\n",_5GY60[44],_5GY60[84],_5GY60[125] );
+ _5GY70(maxInd);
+ for (int i=0; i5) _5GY70[i] = 2.09 - 0.001*(i-5);
+ else if (i<85 && i>=45) _5GY70[i] = 2.05-0.00175*(i-45);
+ else if (i<140 && i >=85) _5GY70[i] = 1.98-0.002*(i-85);
+ }
+ //printf("5GY %1.2f %1.2f %1.2f\n",_5GY70[44],_5GY70[84],_5GY70[125] );
+ _5GY80(maxInd);
+ for (int i=0; i5) _5GY80[i] = 2.07 - 0.001*(i-5);
+ else if (i<85 && i>=45) _5GY80[i] = 2.03 - 0.00075*(i-45);
+ else if (i<140 && i >=85) _5GY80[i] = 2.0-0.002*(i-85);
+ }
+ //printf("5GY %1.2f %1.2f %1.2f\n",_5GY80[44],_5GY80[84],_5GY80[125] );
+
+ #ifdef _DEBUG
+ t2e.set();
+ if (settings->verbose)
+ printf("Lutf Munsell %d usec\n", t2e.etime(t1e));
+ #endif
+ }
+
}
diff --git a/rtengine/color.h b/rtengine/color.h
index 7b6a3b57a..08e547797 100644
--- a/rtengine/color.h
+++ b/rtengine/color.h
@@ -22,26 +22,82 @@
#include
#include "LUT.h"
+#include "labimage.h"
+#include "iccstore.h"
namespace rtengine {
+#ifdef _DEBUG
+
+class MunsellDebugInfo {
+public:
+ float maxdhuelum[4];
+ float maxdhue[4];
+ unsigned int depass;
+ unsigned int depassLum;
+
+ MunsellDebugInfo();
+ void reinitValues();
+};
+
+#endif
+
class Color {
+private:
+ // Jacques' 195 LUTf for Munsell Lch correction
+ static LUTf _4P10,_4P20,_4P30,_4P40,_4P50,_4P60;
+ static LUTf _1P10,_1P20,_1P30,_1P40,_1P50,_1P60;
+ static LUTf _5B40,_5B50,_5B60, _5B70,_5B80;
+ static LUTf _7B40,_7B50,_7B60, _7B70,_7B80;
+ static LUTf _9B40,_9B50,_9B60, _9B70,_9B80;
+ static LUTf _10B40,_10B50,_10B60, _10B70,_10B80;
+ static LUTf _05PB40,_05PB50,_05PB60, _05PB70,_05PB80;
+ static LUTf _10PB10,_10PB20,_10PB30,_10PB40,_10PB50,_10PB60;
+ static LUTf _9PB10,_9PB20,_9PB30,_9PB40,_9PB50,_9PB60,_9PB70,_9PB80;
+ static LUTf _75PB10,_75PB20,_75PB30,_75PB40,_75PB50,_75PB60,_75PB70,_75PB80;
+ static LUTf _6PB10,_6PB20,_6PB30,_6PB40,_6PB50,_6PB60,_6PB70,_6PB80;
+ static LUTf _45PB10,_45PB20,_45PB30,_45PB40,_45PB50,_45PB60,_45PB70,_45PB80;
+ static LUTf _3PB10,_3PB20,_3PB30,_3PB40,_3PB50,_3PB60,_3PB70,_3PB80;
+ static LUTf _15PB10,_15PB20,_15PB30,_15PB40,_15PB50,_15PB60, _15PB70,_15PB80;
+ static LUTf _10YR20, _10YR30, _10YR40,_10YR50,_10YR60,_10YR70,_10YR80,_10YR90;
+ static LUTf _85YR20, _85YR30, _85YR40,_85YR50,_85YR60,_85YR70,_85YR80,_85YR90;
+ static LUTf _7YR30, _7YR40,_7YR50,_7YR60,_7YR70,_7YR80;
+ static LUTf _55YR30, _55YR40,_55YR50,_55YR60,_55YR70,_55YR80,_55YR90;
+ static LUTf _4YR30, _4YR40,_4YR50,_4YR60,_4YR70,_4YR80;
+ static LUTf _25YR30, _25YR40,_25YR50,_25YR60,_25YR70;
+ static LUTf _10R30, _10R40,_10R50,_10R60,_10R70;
+ static LUTf _9R30, _9R40,_9R50,_9R60,_9R70;
+ static LUTf _7R30, _7R40,_7R50,_7R60,_7R70;
+ static LUTf _5R10, _5R20,_5R30;
+ static LUTf _25R10, _25R20,_25R30;
+ static LUTf _10RP10, _10RP20,_10RP30;
+ static LUTf _7G30, _7G40,_7G50,_7G60,_7G70,_7G80;
+ static LUTf _5G30, _5G40,_5G50,_5G60,_5G70,_5G80;
+ static LUTf _25G30, _25G40,_25G50,_25G60,_25G70,_25G80;
+ static LUTf _1G30, _1G40,_1G50,_1G60,_1G70,_1G80;
+ static LUTf _10GY30, _10GY40,_10GY50,_10GY60,_10GY70,_10GY80;
+ static LUTf _75GY30, _75GY40,_75GY50,_75GY60,_75GY70,_75GY80;
+ static LUTf _5GY30, _5GY40,_5GY50,_5GY60,_5GY70,_5GY80;
+
+ // Separated from init() to keep the code clear
+ static void initMunsell ();
+
public:
const static double sRGBGamma; // standard average gamma
- const static double sRGBGammaCurve; // 2.4 in the curve
- const static double eps_max, kappa;
- const static float D50x, D50z;
- const static double u0, v0;
+ const static double sRGBGammaCurve; // 2.4 in the curve
+ const static double eps_max, kappa;
+ const static float D50x, D50z;
+ const static double u0, v0;
- static LUTf cachef;
+ static LUTf cachef;
static LUTf gamma2curve;
- // look-up tables for the standard srgb gamma and its inverse (filled by init())
- static LUTf igammatab_srgb;
- static LUTf gammatab_srgb;
- // look-up tables for the simple exponential gamma
- static LUTf gammatab;
+ // look-up tables for the standard srgb gamma and its inverse (filled by init())
+ static LUTf igammatab_srgb;
+ static LUTf gammatab_srgb;
+ // look-up tables for the simple exponential gamma
+ static LUTf gammatab;
static void init ();
@@ -50,10 +106,10 @@ public:
static void rgb2hsv (float r, float g, float b, float &h, float &s, float &v);
static void hsv2rgb (float h, float s, float v, float &r, float &g, float &b);
static void hsv2rgb (float h, float s, float v, int &r, int &g, int &b);
- static void hsv2rgb01 (float h, float s, float v, float &r, float &g, float &b);
+ static void hsv2rgb01 (float h, float s, float v, float &r, float &g, float &b);
static void xyz2srgb (float x, float y, float z, float &r, float &g, float &b);
static void xyz2rgb (float x, float y, float z, float &r, float &g, float &b, double rgb_xyz[3][3]);
- static void xyz2rgb (float x, float y, float z, float &r, float &g, float &b, float rgb_xyz[3][3]);
+ static void xyz2rgb (float x, float y, float z, float &r, float &g, float &b, float rgb_xyz[3][3]);
static void Lab2XYZ(float L, float a, float b, float &x, float &y, float &z);
static void XYZ2Lab(float X, float Y, float Z, float &L, float &a, float &b);
static void Lab2Yuv(float L, float a, float b, float &Y, float &u, float &v);
@@ -87,6 +143,20 @@ public:
//static inline float gamma (double x) { return gammatab[x]; }
//static inline float igamma_srgb (double x) { return igammatab_srgb[x]; }
+ //Jacques's Munsell correction
+#ifdef _DEBUG
+ static void AllMunsellLch (bool lumaMuns, float Lprov1, float Loldd, float HH, float Chprov1, float CC, float &correctionHueChroma, float &correctlum, MunsellDebugInfo* munsDbgInfo);
+ static void gamutLchonly (float HH, float &Lprov1, float &Chprov1, float &R, float &G, float &B, double wip[3][3], const bool isHLEnabled, const float lowerCoef, const float higherCoef, bool &neg, bool &more_rgb);
+#else
+ static void AllMunsellLch (bool lumaMuns, float Lprov1, float Loldd, float HH, float Chprov1, float CC, float &correctionHueChroma, float &correctlum);
+ static void gamutLchonly (float HH, float &Lprov1, float &Chprov1, float &R, float &G, float &B, double wip[3][3], const bool isHLEnabled, const float lowerCoef, const float higherCoef);
+#endif
+ static void LabGamutMunsell (LabImage *lab, float *Lold, float *Cold, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const Glib::ustring &working, bool multiThread );
+
+ static void SkinSat (float lum, float hue, float chrom, float &satreduc, int chromx);//jacques Skin color
+ static void MunsellLch (float lum, float hue, float chrom, float memChprov, float &correction, int zone, float &lbe, bool &correctL);//jacques: Munsell correction
+ // end Munsell
+
//void gamutmap(LabImage* );
static void gamutmap(float &X, float &Y, float &Z, const double p[3][3]);
diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc
index 0e6d4bc4e..747aa107d 100644
--- a/rtengine/colortemp.cc
+++ b/rtengine/colortemp.cc
@@ -554,11 +554,13 @@ void ColorTemp::temp2mul (double temp, double green, double& rmul, double& gmul,
xD=x; yD=y;
+ /*
if (settings->verbose) {
double u=4*xD/(-2*xD+12*yD+3);
double v=6*yD/(-2*xD+12*yD+3);
printf("xD=%f yD=%f u=%f v=%f\n",xD,yD,u,v);
}
+ */
double X = xD/yD;
double Y = 1.0;
diff --git a/rtengine/curves.cc b/rtengine/curves.cc
index e6ef98cf6..62ac0e568 100644
--- a/rtengine/curves.cc
+++ b/rtengine/curves.cc
@@ -154,9 +154,9 @@ namespace rtengine {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- void CurveFactory::complexsgnCurve (double saturation, bool satlimit, double satlimthresh,
- const std::vector& acurvePoints, const std::vector& bcurvePoints,
- LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, int skip) {
+ void CurveFactory::complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, double saturation, double rstprotection,
+ const std::vector& acurvePoints, const std::vector& bcurvePoints,const std::vector& cccurvePoints,
+ /*const std::vector& cbgcurvePoints,*/ LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve,/* LUTf & satbgCurve,*/ int skip) {
//colormult = chroma_scale for Lab manipulations
@@ -164,7 +164,7 @@ namespace rtengine {
bool needed;
DiagonalCurve* dCurve = NULL;
-
+/*
// check if contrast curve is needed
needed = (saturation<-0.0001 || saturation>0.0001);
@@ -194,13 +194,15 @@ namespace rtengine {
satcurvePoints.push_back(0.5+0.5*scale); //shoulder point
satcurvePoints.push_back(0.5+0.5*scale); //value at shoulder point
- /*} else {
- satcurvePoints.push_back(0.25+saturation/500.0); //toe point
- satcurvePoints.push_back(0.25-saturation/500.0); //value at toe point
+ / Commented out...
+ } else {
+ satcurvePoints.push_back(0.25+saturation/500.0); //toe point
+ satcurvePoints.push_back(0.25-saturation/500.0); //value at toe point
- satcurvePoints.push_back(0.75-saturation/500.0); //shoulder point
- satcurvePoints.push_back(0.75+saturation/500.0); //value at shoulder point
- }*/
+ satcurvePoints.push_back(0.75-saturation/500.0); //shoulder point
+ satcurvePoints.push_back(0.75+saturation/500.0); //value at shoulder point
+ }
+ /
satcurvePoints.push_back(1); // white point
satcurvePoints.push_back(1); // value at white point
@@ -222,17 +224,21 @@ namespace rtengine {
else {
fillCurveArray(NULL, satCurve, skip, needed);
}
-
+*/
//-----------------------------------------------------
needed = false;
// create a curve if needed
if (!acurvePoints.empty() && acurvePoints[0]!=0) {
dCurve = new DiagonalCurve (acurvePoints, CURVES_MIN_POLY_POINTS/skip);
- if (dCurve && !dCurve->isIdentity())
+ if (dCurve && !dCurve->isIdentity()) {
needed = true;
+ autili=true;
+ }
}
fillCurveArray(dCurve, aoutCurve, skip, needed);
+ //if(autili) aoutCurve.dump("acurve");
+
if (dCurve) {
delete dCurve;
dCurve = NULL;
@@ -243,14 +249,43 @@ namespace rtengine {
needed = false;
if (!bcurvePoints.empty() && bcurvePoints[0]!=0) {
dCurve = new DiagonalCurve (bcurvePoints, CURVES_MIN_POLY_POINTS/skip);
- if (dCurve && !dCurve->isIdentity())
+ if (dCurve && !dCurve->isIdentity()) {
needed = true;
+ butili=true;
+ }
}
fillCurveArray(dCurve, boutCurve, skip, needed);
if (dCurve) {
delete dCurve;
dCurve = NULL;
}
+
+ //-----------------------------------------------
+ needed = false;
+ if (!cccurvePoints.empty() && cccurvePoints[0]!=0) {
+ dCurve = new DiagonalCurve (cccurvePoints, CURVES_MIN_POLY_POINTS/skip);
+ if (dCurve && !dCurve->isIdentity())
+ {needed = true;ccutili=true;}
+ }
+ fillCurveArray(dCurve, satCurve, skip, needed);
+ if (dCurve) {
+ delete dCurve;
+ dCurve = NULL;
+ }
+ //----------------------------
+ /*needed = false;
+ if (!cbgcurvePoints.empty() && cbgcurvePoints[0]!=0) {
+ dCurve = new DiagonalCurve (cbgcurvePoints, CURVES_MIN_POLY_POINTS/skip);
+ if (dCurve && !dCurve->isIdentity())
+ {needed = true;cbgutili=true;}
+ }
+ fillCurveArray(dCurve, satbgCurve, skip, needed);
+ if (dCurve) {
+ delete dCurve;
+ dCurve = NULL;
+ }
+ */
+
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -489,7 +524,7 @@ namespace rtengine {
void CurveFactory::complexLCurve (double br, double contr, const std::vector& curvePoints,
LUTu & histogram, LUTu & histogramCropped, LUTf & outCurve,
- LUTu & outBeforeCCurveHistogram, int skip) {
+ LUTu & outBeforeCCurveHistogram, int skip, bool & utili) {
// curve without contrast
LUTf dcurve(65536,0);
@@ -504,6 +539,7 @@ namespace rtengine {
// check if brightness curve is needed
if (br>0.00001 || br<-0.00001) {
+ utili=true;
std::vector brightcurvePoints;
brightcurvePoints.push_back((double)((CurveType)DCT_NURBS));
@@ -550,13 +586,13 @@ namespace rtengine {
dcurve[i] = (float)i / 32767.0;
}
}
-
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// check if contrast curve is needed
if (contr>0.00001 || contr<-0.00001) {
+ utili=true;
// compute mean luminance of the image with the curve applied
int sum = 0;
@@ -613,6 +649,8 @@ namespace rtengine {
}
if (tcurve) {
+ utili=true;//if active
+
// L values go up to 32767, last stop is for highlight overflow
for (int i=0; i<32768; i++) {
float val;
diff --git a/rtengine/curves.h b/rtengine/curves.h
index 5d27da3f2..c165e7288 100644
--- a/rtengine/curves.h
+++ b/rtengine/curves.h
@@ -178,11 +178,12 @@ class CurveFactory {
static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr,
double gamma_, bool igamma_, const std::vector& curvePoints, LUTu & histogram, LUTu & histogramCropped,
LUTf & hlCurve, LUTf & shCurve,LUTf & outCurve, LUTu & outBeforeCCurveHistogram, int skip=1);
- static void complexsgnCurve (double saturation, bool satlimit, double satlimthresh, const std::vector& acurvePoints,
- const std::vector& bcurvePoints, LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, int skip=1);
+ static void complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, double saturation, double rstprotection, const std::vector& acurvePoints,
+ const std::vector& bcurvePoints,const std::vector& cccurvePoints,/*const std::vector& cbgurvePoints,*/ LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, /*LUTf & satbgCurve,*/ int skip=1);
static void complexLCurve (double br, double contr, const std::vector& curvePoints, LUTu & histogram, LUTu & histogramCropped,
- LUTf & outCurve, LUTu & outBeforeCCurveHistogram, int skip);
+ LUTf & outCurve, LUTu & outBeforeCCurveHistogram, int skip, bool & utili);
static void RGBCurve (const std::vector& curvePoints, LUTf & outCurve, int skip);
+
};
class Curve {
diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc
index 6b52463e3..04b02fcdb 100644
--- a/rtengine/dcrop.cc
+++ b/rtengine/dcrop.cc
@@ -166,8 +166,13 @@ void Crop::update (int todo) {
parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay.
- parent->ipf.luminanceCurve (labnCrop, labnCrop, parent->lumacurve);
- parent->ipf.chrominanceCurve (labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve);
+ // parent->ipf.luminanceCurve (labnCrop, labnCrop, parent->lumacurve);
+ bool utili=false;
+ bool autili=false;
+ bool butili=false;
+ bool ccutili=false;
+
+ parent->ipf.chromiLuminanceCurve (labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve,/*parent->satbgcurve,*/ parent->lumacurve, utili, autili, butili, ccutili);
//parent->ipf.colorCurve (labnCrop, labnCrop);
parent->ipf.vibrance (labnCrop);
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index 0d5c9901e..361c3aecc 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -41,6 +41,7 @@ ImProcCoordinator::ImProcCoordinator ()
chroma_acurve(65536,0);
chroma_bcurve(65536,0);
satcurve(65536,0);
+// satbgcurve(65536,0);
vhist16(65536);
lhist16(65536); lhist16Cropped(65536);
@@ -264,16 +265,19 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
}
readyphase++;
-
+ bool utili=false;
+ bool autili=false;
+ bool butili=false;
+ bool ccutili=false;
+
if ((todo & M_LUMACURVE) || todo==CROP) {
-
CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, lhist16, lhist16Cropped,
- lumacurve, histLCurve, scale==1 ? 1 : 16);
+ lumacurve, histLCurve, scale==1 ? 1 : 16, utili);
}
if (todo & M_LUMACURVE) {
- CurveFactory::complexsgnCurve (params.labCurve.saturation, params.labCurve.enable_saturationlimiter, params.labCurve.saturationlimit,
- params.labCurve.acurve, params.labCurve.bcurve, chroma_acurve, chroma_bcurve, satcurve, scale==1 ? 1 : 16);
+ CurveFactory::complexsgnCurve (autili, butili,ccutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
+ params.labCurve.acurve, params.labCurve.bcurve,params.labCurve.cccurve/*,params.labCurve.cbgcurve*/, chroma_acurve, chroma_bcurve, satcurve,/*satbgcurve,*/ scale==1 ? 1 : 16);
}
if (todo & (M_LUMINANCE+M_COLOR) ) {
@@ -281,13 +285,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
ipf.EPDToneMap(nprevl,0,scale);
- progress ("Applying Luminance Curve...",100*readyphase/numofphases);
+ //progress ("Applying Luminance Curve...",100*readyphase/numofphases);
- ipf.luminanceCurve (nprevl, nprevl, lumacurve);
+ //ipf.luminanceCurve (nprevl, nprevl, lumacurve);
- readyphase++;
+ //readyphase++;
progress ("Applying Color Boost...",100*readyphase/numofphases);
- ipf.chrominanceCurve (nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve/*, params.labCurve.saturation*/);
+ ipf.chromiLuminanceCurve (nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve/*,satbgcurve*/, lumacurve, utili, autili, butili, ccutili);
//ipf.colorCurve (nprevl, nprevl);
ipf.vibrance(nprevl);
readyphase++;
diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h
index 872f27b6d..aca603c24 100644
--- a/rtengine/improccoordinator.h
+++ b/rtengine/improccoordinator.h
@@ -73,6 +73,7 @@ class ImProcCoordinator : public StagedImageProcessor {
LUTf chroma_acurve;
LUTf chroma_bcurve;
LUTf satcurve;
+ // LUTf satbgcurve;
LUTf rCurve;
LUTf gCurve;
diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc
index 9e4dc8d91..283fca526 100644
--- a/rtengine/improcfun.cc
+++ b/rtengine/improcfun.cc
@@ -441,64 +441,307 @@ void ImProcFunctions::luminanceCurve (LabImage* lold, LabImage* lnew, LUTf & cur
lnew->L[i][j] = curve[Lin];
}
}
-
-
-void ImProcFunctions::chrominanceCurve (LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve) {
+
+void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve/*,LUTf & satbgcurve*/, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili) {
int W = lold->W;
int H = lold->H;
+ //init Flatcurve for C=f(H)
+ FlatCurve* chCurve = NULL;
+ bool chutili = false;
+ if (!params->labCurve.bwtoning) {
+ chCurve = new FlatCurve(params->labCurve.chcurve);
+ if (chCurve && !chCurve->isIdentity()) {
+ chutili=true;
+ }//do not use "Munsell" if Chcurve not used
+ }
+#ifdef _DEBUG
+ MyTime t1e,t2e, t3e, t4e;
+ t1e.set();
+ // init variables to display Munsell corrections
+ MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo();
+#endif
+
+ unsigned int N = W*H;
+ float *L = lold->L[0];
+ float *a= lold->a[0];
+ float *b= lold->b[0];
+
+ float* Lold = new float [lold->W*lold->H];//to save L before any used
+ float* Cold = new float [lold->W*lold->H];//to save C before any used
+ float adjustr=1.0f, adjustbg=1.0f;
+
+// if(params->labCurve.avoidclip ){
+ for (unsigned int j=0; j!=N; j++){
+ Lold[j]=L[j]/327.68f;
+ Cold[j]=sqrt(SQR(a[j]/327.68f)+SQR(b[j]/327.68f));
+// Hr=atan2(b[j],a[j]);
+// if(Hr >-0.15f && Hr < 1.5f && Cold[j]>maxCr)
+// maxCr=Cold[j]; // I do not take into account "acurve" and "bcurve" to adjust max
+// else if (Cold[j]>maxCbg)
+// maxCbg=Cold[j];
+ }
+ // parameter to adapt curve C=f(C) to gamut
+ if (params->icm.working=="ProPhoto") {adjustr = adjustbg = 1.2f;}// 1.2 instead 1.0 because it's very rare to have C>170..
+ else if (params->icm.working=="Adobe RGB") {adjustr = 1.8f; adjustbg = 1.4f;}
+ else if (params->icm.working=="sRGB") {adjustr = 2.0f; adjustbg = 1.7f;}
+ else if (params->icm.working=="WideGamut") {adjustr = adjustbg = 1.2f;}
+ else if (params->icm.working=="Beta RGB") {adjustr = adjustbg = 1.4f;}
+ else if (params->icm.working=="BestRGB") {adjustr = adjustbg = 1.4f;}
+ else if (params->icm.working=="BruceRGB") {adjustr = 1.8f; adjustbg = 1.5f;}
+
+
+ // reference to the params structure has to be done outside of the parallelization to avoid CPU cache problem
+ bool highlight = params->hlrecovery.enabled; //Get the value if "highlight reconstruction" is activated
+ int chromaticity = params->labCurve.chromaticity;
+ bool bwToning = params->labCurve.bwtoning;
+ double rstprotection = 100.-params->labCurve.rstprotection; // Red and Skin Tones Protection
+ // avoid color shift is disabled when bwToning is activated
+ bool avoidColorShift = params->labCurve.avoidcolorshift && !bwToning;
+ int protectRed = settings->protectred;
+ double protectRedH = settings->protectredh;
+ bool gamutLch = settings->gamutLch;
+
+ // only if user activate Lab adjustements
+ if (avoidColorShift) {
+ if(autili || butili || ccutili || chutili || utili || chromaticity)
+ Color::LabGamutMunsell(lold, Lold, Cold, /*corMunsell*/true, /*lumaMuns*/false, params->hlrecovery.enabled, /*gamut*/true, params->icm.working, multiThread);
+ }
+
+
+#ifdef _DEBUG
+#pragma omp parallel default(shared) firstprivate(highlight, chromaticity, bwToning, rstprotection, avoidColorShift, protectRed, protectRedH, gamutLch, lold, lnew, MunsDebugInfo) if (multiThread)
+#else
+#pragma omp parallel default(shared) firstprivate(highlight, chromaticity, bwToning, rstprotection, avoidColorShift, protectRed, protectRedH, gamutLch, lold, lnew) if (multiThread)
+#endif
+{
+
+ TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working);
+ double wip[3][3] = {
+ {wiprof[0][0],wiprof[0][1],wiprof[0][2]},
+ {wiprof[1][0],wiprof[1][1],wiprof[1][2]},
+ {wiprof[2][0],wiprof[2][1],wiprof[2][2]}
+ };
+
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
+
TMatrix wprof = iccStore->workingSpaceMatrix (params->icm.working);
-
+ //if(utili) curve.dump("Lcurve");
+
double wp[3][3] = {
{wprof[0][0],wprof[0][1],wprof[0][2]},
{wprof[1][0],wprof[1][1],wprof[1][2]},
{wprof[2][0],wprof[2][1],wprof[2][2]}};
-
-#pragma omp parallel for if (multiThread)
- for (int i=0; ia[i][j]+32768.0f]-32768.0f;
- float btmp = bcurve[lold->b[i][j]+32768.0f]-32768.0f;
-
+
+ //float maxlp=-100.0, minlp=200.0;
+
+#pragma omp for schedule(dynamic, 10)
+ for (int i=0; iL[i][j]/327.68f;
+ float CC=sqrt(SQR(lold->a[i][j]/327.68f) + SQR(lold->b[i][j]/327.68f));
+ float HH=atan2(lold->b[i][j],lold->a[i][j]);
+ float Chprov=CC;
+ float Chprov1=CC;
+ float memChprov=Chprov;
+ float Lprov2=LL;
+ float Lin=lold->L[i][j];
+ lnew->L[i][j] = curve[Lin];
+ float Lprov1=(lnew->L[i][j])/327.68f;
+ float chromaChfactor=1.0f;
+ float atmp = acurve[lold->a[i][j]+32768.0f]-32768.0f;// curves Lab a
+ float btmp = bcurve[lold->b[i][j]+32768.0f]-32768.0f;// curves Lab b
+ //float chromaCredfactor=1.0f;
+ //float chromaCbgfactor=1.0f;
+// chromaCfactor=(satcurve[chroma*adjustr])/(chroma*adjustr);//apply C=f(C)
+// chromaCbgfactor=(satbgcurve[chroma*adjustbg])/(chroma*adjustbg);
+// calculate C=f(H)
+ if (chutili) {
+ double hr;
+ //hr=translate Hue Lab value (-Pi +Pi) in approximative hr (hsv values) (0 1) [red 1/6 yellow 1/6 green 1/6 cyan 1/6 blue 1/6 magenta 1/6 ]
+ // with multi linear correspondances (I expect there is no error !!)
+ if (HH<-2.7f) hr=0.020380804*double(HH)+0.970281708; //Lab green =>hr # 0.33 ==> 0.33 0.42
+ else if (HH<-2.1f) hr=0.266666667*double(HH)+1.14; //Lab cyan =>hr # 0.50 ==> 0.42 0.58
+ else if (HH<-0.9f) hr=0.141666 *double(HH)+0.8775; //Lab blue =>hr # 0.67 ==> 0.58 0.75
+ else if (HH<-0.1f) hr=0.2125 *double(HH)+0.94125; //Lab magenta (purple) =>hr # 0.83 ==> 0.75 0.92
+ else if (HH< 1.3f) hr=0.12142857 *double(HH)+0.932142857; //Lab red and skin =>hr # 0 ==> 0.92 1.09
+ else if (HH< 2.2f) hr=0.1666667 *double(HH)-0.1266667; //Lab yellow and green yellow =>hr # 0.16 ==> 0.09 0.24
+ else hr=0.0955828 *double(HH)+0.02971784; //Lab green =>hr # 0.33 ==> 0.24 0.33
+
+ //allways put h between 0 and 1
+ if (hr<0.0) hr += 1.0;
+ else if(hr>1.0) hr -= 1.0;
+ float chparam = float((chCurve->getVal(hr)-0.5f) * 2.0f);//get C=f(H)
+ chromaChfactor=1.0f+chparam;
+ }
+ atmp *= chromaChfactor;//apply C=f(H)
+ btmp *= chromaChfactor;
+// if (params->labCurve.chromaticity) {// if user use sliders
+ if(chromaticity!=0 && !bwToning){
+ // approximation in Lab mode to protect skin tones and avoid too big gamut clip for red
+ float scale = 100.0f/100.1f;//reduction in normal zone
+ float scaleext=1.0f;//reduction in transition zone
+ float protect_red,protect_redh;
+ float deltaHH;//HH value transition
+ float dred=55.0f;//C red value limit
+ protect_red=float(protectRed);//default=60 chroma: one can put more or less if necessary...in 'option' 40...160
+ if(protect_red < 20.0f) protect_red=20.0; // avoid too low value
+ if(protect_red > 180.0f) protect_red=180.0; // avoid too high value
+ protect_redh=float(protectRedH);//default=0.4 rad : one can put more or less if necessary...in 'option' 0.2 ..1.0
+ if(protect_redh<0.1f) protect_redh=0.1f;//avoid divide by 0 and negatives values
+ if(protect_redh>1.0f) protect_redh=1.0f;//avoid too big values
+
+ deltaHH=protect_redh;//transition hue
+
+ //simulate very approximative gamut f(L) : with pyramid transition
+ if (Lprov1<25.0f) dred = 40.0f;
+ else if(Lprov1<30.0f) dred = 3.0f*Lprov1 -35.0f;
+ else if(Lprov1<70.0f) dred = 55.0f;
+ else if(Lprov1<75.0f) dred = -3.0f*Lprov1 +265.0f;
+ else dred = 40.0f;
+
+ if(rstprotection<99.9999) {
+ if(chromaticity>0)
+ scale = rstprotection/100.1f;
+ if((HH< (1.3f+deltaHH) && HH >=1.3f))
+ scaleext=HH*(1.0f-scale)/deltaHH + 1.0f - (1.3f+deltaHH)*(1.0f-scale)/deltaHH; //transition for Hue (red - yellow)
+ else if((HH< 0.15f && HH >(0.15f-deltaHH)))
+ scaleext=HH*(scale-1.0f)/deltaHH + 1.0f - (0.15f-deltaHH)*(scale-1.0f)/deltaHH; //transition for hue (red purple)
+ }
+
+ //transition for red , near skin tones
+ float factorskin, factorsat, factor, factorskinext;
+ factorskin=1.0f+(chromaticity*scale)/100.0f;
+ factorskinext=1.0f+(chromaticity*scaleext)/100.0f;
+ factorsat=1.0f+(chromaticity)/100.0f;/*if(factorsat==1.0f) factorsat=1.1f;*/
+
+ factor = factorsat;
+ // Test if chroma is in the normal range first
+ if(HH>=0.15f && HH<1.3f) {
+ if (Chprov1(0.15f-deltaHH) || HH<(1.3f+deltaHH) ) {
+ if (Chprov1 < dred)
+ factor = factorskinext;// C=dred=55 => real max of skin tones
+ else if (Chprov1 < (dred+protect_red))// transition
+ factor = (factorsat-factorskinext)/protect_red*Chprov1+factorsat-(dred+protect_red)*(factorsat-factorskinext)/protect_red;
+ }
+
+ atmp *= factor;
+ btmp *= factor;
+ // end approximation
+ }
+
+ // I have placed C=f(C) after all C treatments to assure maximum amplitude of "C"
+ if (!bwToning) {
+ float chroma = sqrt(SQR(atmp)+SQR(btmp)+0.001f);
+ float chromaCfactor = (satcurve[chroma*adjustr])/(chroma*adjustr);//apply C=f(C)
+ atmp *= chromaCfactor;
+ btmp *= chromaCfactor;
+ }
+ // end chroma C=f(C)
+
+ Chprov1 = sqrt(SQR(atmp/327.68f)+SQR(btmp/327.68f));
+
+/*
// modulation of a and b curves with saturation
- if (params->labCurve.saturation!=0 && !params->labCurve.bwtoning) {
+ if (params->labCurve.chromaticity!=0 && !params->labCurve.bwtoning) {
float chroma = sqrt(SQR(atmp)+SQR(btmp)+0.001);
float satfactor = (satcurve[chroma+32768.0f]-32768.0f)/chroma;
atmp *= satfactor;
btmp *= satfactor;
}
+*/
// labCurve.bwtoning option allows to decouple modulation of a & b curves by saturation
// with bwtoning enabled the net effect of a & b curves is visible
- if (params->labCurve.bwtoning) {
+ if (bwToning) {
atmp -= lold->a[i][j];
btmp -= lold->b[i][j];
}
-
- if (params->labCurve.avoidclip) {
- //Luv limiter
- float Y,u,v;
- Color::Lab2Yuv(lnew->L[i][j],atmp,btmp,Y,u,v);
- //Yuv2Lab includes gamut restriction map
- Color::Yuv2Lab(Y,u,v,lnew->L[i][j],lnew->a[i][j],lnew->b[i][j], wp);
-
- } else {
+
+ if (avoidColorShift) {
+ //gamutmap Lch ==> preserve Hue,but a little slower than gamutbdy for high values...and little faster for low values
+ if(gamutLch) {
+ float R,G,B;
+
+#ifdef _DEBUG
+ bool neg=false;
+ bool more_rgb=false;
+ //gamut control : Lab values are in gamut
+ Color::gamutLchonly(HH,Lprov1,Chprov1, R, G, B, wip, highlight, 0.4f, 0.95f, neg, more_rgb);
+#else
+ //gamut control : Lab values are in gamut
+ Color::gamutLchonly(HH,Lprov1,Chprov1, R, G, B, wip, highlight, 0.4f, 0.95f);
+#endif
+ Lprov2 = Lprov1;
+
+ lnew->L[i][j]=Lprov1*327.68f;
+ lnew->a[i][j]=327.68f*Chprov1*cos(HH);
+ lnew->b[i][j]=327.68f*Chprov1*sin(HH);
+ }
+ else {
+ //use gamutbdy
+ //Luv limiter
+ float Y,u,v;
+ Color::Lab2Yuv(lnew->L[i][j],atmp,btmp,Y,u,v);
+ //Yuv2Lab includes gamut restriction map
+ Color::Yuv2Lab(Y,u,v,lnew->L[i][j],lnew->a[i][j],lnew->b[i][j], wp);
+ }
+
+ if (utili || autili || butili || ccutili || chutili || chromaticity) {
+ float correctionHue=0.0f; // Munsell's correction
+ float correctlum=0.0f;
+
+ Lprov1=lnew->L[i][j]/327.68f;
+ Chprov=sqrt(SQR(lnew->a[i][j]/327.68f)+ SQR(lnew->b[i][j]/327.68f));
+
+#ifdef _DEBUG
+ Color::AllMunsellLch(/*lumaMuns*/true, Lprov1,Lprov2,HH,Chprov,memChprov,correctionHue,correctlum, MunsDebugInfo);
+#else
+ Color::AllMunsellLch(/*lumaMuns*/true, Lprov1,Lprov2,HH,Chprov,memChprov,correctionHue,correctlum);
+#endif
+
+ if(fabs(correctionHue) < 0.015f) HH+=correctlum; // correct only if correct Munsell chroma very little.
+
+ lnew->a[i][j]=327.68f*Chprov*cos(HH+correctionHue);// apply Munsell
+ lnew->b[i][j]=327.68f*Chprov*sin(HH+correctionHue);
+ }
+ }
+ else {
+// if(Lprov1 > maxlp) maxlp=Lprov1;
+// if(Lprov1 < minlp) minlp=Lprov1;
+ lnew->L[i][j]=Lprov1*327.68f;
+
//Luv limiter only
lnew->a[i][j] = atmp;
lnew->b[i][j] = btmp;
}
+ }
+} // end of parallelization
- }
-
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
+#ifdef _DEBUG
+ if (settings->verbose) {
+ t3e.set();
+ printf("Color::AllMunsellLch (correction performed in %d usec):\n", t3e.etime(t1e));
+ printf(" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad dep=%i\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass);
+ printf(" Munsell luminance : MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad dep=%i\n", MunsDebugInfo->maxdhuelum[0], MunsDebugInfo->maxdhuelum[1], MunsDebugInfo->maxdhuelum[2], MunsDebugInfo->maxdhuelum[3], MunsDebugInfo->depassLum);
}
-
+ delete MunsDebugInfo;
+#endif
+ delete [] Lold;
+ delete [] Cold;
+
+ if (chutili) delete chCurve;
+}
+
//#include "cubic.cc"
@@ -933,4 +1176,4 @@ fclose(f);*/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-}
\ No newline at end of file
+}
diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h
index f3a039f41..ed902f4f4 100644
--- a/rtengine/improcfun.h
+++ b/rtengine/improcfun.h
@@ -66,46 +66,11 @@ class ImProcFunctions {
public:
static LUTf cachef;
- // 195 LUTf for Munsell Lch correction
- static LUTf _4P10,_4P20,_4P30,_4P40,_4P50,_4P60;
- static LUTf _1P10,_1P20,_1P30,_1P40,_1P50,_1P60;
- static LUTf _5B40,_5B50,_5B60, _5B70,_5B80;
- static LUTf _7B40,_7B50,_7B60, _7B70,_7B80;
- static LUTf _9B40,_9B50,_9B60, _9B70,_9B80;
- static LUTf _10B40,_10B50,_10B60, _10B70,_10B80;
- static LUTf _05PB40,_05PB50,_05PB60, _05PB70,_05PB80;
- static LUTf _10PB10,_10PB20,_10PB30,_10PB40,_10PB50,_10PB60;
- static LUTf _9PB10,_9PB20,_9PB30,_9PB40,_9PB50,_9PB60,_9PB70,_9PB80;
- static LUTf _75PB10,_75PB20,_75PB30,_75PB40,_75PB50,_75PB60,_75PB70,_75PB80;
- static LUTf _6PB10,_6PB20,_6PB30,_6PB40,_6PB50,_6PB60,_6PB70,_6PB80;
- static LUTf _45PB10,_45PB20,_45PB30,_45PB40,_45PB50,_45PB60,_45PB70,_45PB80;
- static LUTf _3PB10,_3PB20,_3PB30,_3PB40,_3PB50,_3PB60,_3PB70,_3PB80;
- static LUTf _15PB10,_15PB20,_15PB30,_15PB40,_15PB50,_15PB60, _15PB70,_15PB80;
- static LUTf _10YR20, _10YR30, _10YR40,_10YR50,_10YR60,_10YR70,_10YR80,_10YR90;
- static LUTf _85YR20, _85YR30, _85YR40,_85YR50,_85YR60,_85YR70,_85YR80,_85YR90;
- static LUTf _7YR30, _7YR40,_7YR50,_7YR60,_7YR70,_7YR80;
- static LUTf _55YR30, _55YR40,_55YR50,_55YR60,_55YR70,_55YR80,_55YR90;
- static LUTf _4YR30, _4YR40,_4YR50,_4YR60,_4YR70,_4YR80;
- static LUTf _25YR30, _25YR40,_25YR50,_25YR60,_25YR70;
- static LUTf _10R30, _10R40,_10R50,_10R60,_10R70;
- static LUTf _9R30, _9R40,_9R50,_9R60,_9R70;
- static LUTf _7R30, _7R40,_7R50,_7R60,_7R70;
- static LUTf _5R10, _5R20,_5R30;
- static LUTf _25R10, _25R20,_25R30;
- static LUTf _10RP10, _10RP20,_10RP30;
- static LUTf _7G30, _7G40,_7G50,_7G60,_7G70,_7G80;
- static LUTf _5G30, _5G40,_5G50,_5G60,_5G70,_5G80;
- static LUTf _25G30, _25G40,_25G50,_25G60,_25G70,_25G80;
- static LUTf _1G30, _1G40,_1G50,_1G60,_1G70,_1G80;
- static LUTf _10GY30, _10GY40,_10GY50,_10GY60,_10GY70,_10GY80;
- static LUTf _75GY30, _75GY40,_75GY50,_75GY60,_75GY70,_75GY80;
- static LUTf _5GY30, _5GY40,_5GY50,_5GY60,_5GY70,_5GY80;
double lumimul[3];
static void initCache ();
static void cleanupCache ();
- static void initMunsell ();
ImProcFunctions (const ProcParams* iparams, bool imultiThread=true)
: monitorTransform(NULL), params(iparams), scale(1), multiThread(imultiThread) {}
@@ -122,10 +87,8 @@ class ImProcFunctions {
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve,
double expcomp, int hlcompr, int hlcomprthresh);
void luminanceCurve (LabImage* lold, LabImage* lnew, LUTf &curve);
- void chrominanceCurve (LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve);
+ void chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve/*,LUTf & satbgcurve*/, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili);
void vibrance (LabImage* lab);//Jacques' vibrance
- void skinsat (float lum, float hue, float chrom, float &satreduc);//jacques Skin color
- void MunsellLch (float lum, float hue, float chrom, float memChprov, float &correction, int zone);//jacques: Munsell correction
void colorCurve (LabImage* lold, LabImage* lnew);
void sharpening (LabImage* lab, float** buffer);
void transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH,
diff --git a/rtengine/init.cc b/rtengine/init.cc
index 81b422257..b5e79092a 100644
--- a/rtengine/init.cc
+++ b/rtengine/init.cc
@@ -43,7 +43,6 @@ int init (const Settings* s, Glib::ustring baseDir) {
profileStore.init ();
ProcParams::init ();
Color::init();
- ImProcFunctions::initMunsell();
ImProcFunctions::initCache ();
Thumbnail::initGamma ();
delete lcmsMutex;
diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc
index af06a172a..e37f6753e 100644
--- a/rtengine/ipvibrance.cc
+++ b/rtengine/ipvibrance.cc
@@ -19,13 +19,15 @@
*/
#include "rt_math.h"
+//#include
#include "rtengine.h"
#include "improcfun.h"
#include "iccstore.h"
#include "mytime.h"
-#include "rt_math.h"
#include "../rtgui/thresholdselector.h"
+#include "curves.h"
+//#include "calc_distort.h"
#ifdef _OPENMP
#include
@@ -41,1969 +43,92 @@ using namespace procparams;
extern const Settings* settings;
-//Munsell Lch LUTf : 195 LUT
-LUTf ImProcFunctions::_4P10 ;//give hue in function of L and C : Munsell correction
-LUTf ImProcFunctions::_4P20 ;
-LUTf ImProcFunctions::_4P30 ;
-LUTf ImProcFunctions::_4P40 ;
-LUTf ImProcFunctions::_4P50 ;
-LUTf ImProcFunctions::_4P60 ;
-
-
-LUTf ImProcFunctions::_1P10 ;
-LUTf ImProcFunctions::_1P20 ;
-LUTf ImProcFunctions::_1P30 ;
-LUTf ImProcFunctions::_1P40 ;
-LUTf ImProcFunctions::_1P50 ;
-LUTf ImProcFunctions::_1P60 ;
-
-
-LUTf ImProcFunctions::_10PB10 ;
-LUTf ImProcFunctions::_10PB20 ;
-LUTf ImProcFunctions::_10PB30 ;
-LUTf ImProcFunctions::_10PB40 ;
-LUTf ImProcFunctions::_10PB50 ;
-LUTf ImProcFunctions::_10PB60 ;
-
-
-LUTf ImProcFunctions::_9PB10 ;
-LUTf ImProcFunctions::_9PB20 ;
-LUTf ImProcFunctions::_9PB30 ;
-LUTf ImProcFunctions::_9PB40 ;
-LUTf ImProcFunctions::_9PB50 ;
-LUTf ImProcFunctions::_9PB60 ;
-LUTf ImProcFunctions::_9PB70 ;
-LUTf ImProcFunctions::_9PB80 ;
-
-LUTf ImProcFunctions::_75PB10 ;
-LUTf ImProcFunctions::_75PB20 ;
-LUTf ImProcFunctions::_75PB30 ;
-LUTf ImProcFunctions::_75PB40 ;
-LUTf ImProcFunctions::_75PB50 ;
-LUTf ImProcFunctions::_75PB60 ;
-LUTf ImProcFunctions::_75PB70 ;
-LUTf ImProcFunctions::_75PB80 ;
-
-LUTf ImProcFunctions::_6PB10 ;
-LUTf ImProcFunctions::_6PB20 ;
-LUTf ImProcFunctions::_6PB30 ;
-LUTf ImProcFunctions::_6PB40 ;
-LUTf ImProcFunctions::_6PB50 ;
-LUTf ImProcFunctions::_6PB60 ;
-LUTf ImProcFunctions::_6PB70 ;
-LUTf ImProcFunctions::_6PB80 ;
-
-LUTf ImProcFunctions::_45PB10 ;
-LUTf ImProcFunctions::_45PB20 ;
-LUTf ImProcFunctions::_45PB30 ;
-LUTf ImProcFunctions::_45PB40 ;
-LUTf ImProcFunctions::_45PB50 ;
-LUTf ImProcFunctions::_45PB60 ;
-LUTf ImProcFunctions::_45PB70 ;
-LUTf ImProcFunctions::_45PB80 ;
-
-LUTf ImProcFunctions::_3PB10 ;
-LUTf ImProcFunctions::_3PB20 ;
-LUTf ImProcFunctions::_3PB30 ;
-LUTf ImProcFunctions::_3PB40 ;
-LUTf ImProcFunctions::_3PB50 ;
-LUTf ImProcFunctions::_3PB60 ;
-LUTf ImProcFunctions::_3PB70 ;
-LUTf ImProcFunctions::_3PB80 ;
-
-LUTf ImProcFunctions::_15PB10 ;
-LUTf ImProcFunctions::_15PB20 ;
-LUTf ImProcFunctions::_15PB30 ;
-LUTf ImProcFunctions::_15PB40 ;
-LUTf ImProcFunctions::_15PB50 ;
-LUTf ImProcFunctions::_15PB60 ;
-LUTf ImProcFunctions::_15PB70 ;
-LUTf ImProcFunctions::_15PB80 ;
-
-LUTf ImProcFunctions::_05PB40 ;
-LUTf ImProcFunctions::_05PB50 ;
-LUTf ImProcFunctions::_05PB60 ;
-LUTf ImProcFunctions::_05PB70 ;
-LUTf ImProcFunctions::_05PB80 ;
-
-LUTf ImProcFunctions::_10B40 ;
-LUTf ImProcFunctions::_10B50 ;
-LUTf ImProcFunctions::_10B60 ;
-LUTf ImProcFunctions::_10B70 ;
-LUTf ImProcFunctions::_10B80 ;
-
-LUTf ImProcFunctions::_9B40 ;
-LUTf ImProcFunctions::_9B50 ;
-LUTf ImProcFunctions::_9B60 ;
-LUTf ImProcFunctions::_9B70 ;
-LUTf ImProcFunctions::_9B80 ;
-
-LUTf ImProcFunctions::_7B40 ;
-LUTf ImProcFunctions::_7B50 ;
-LUTf ImProcFunctions::_7B60 ;
-LUTf ImProcFunctions::_7B70 ;
-LUTf ImProcFunctions::_7B80 ;
-
-LUTf ImProcFunctions::_5B40 ;
-LUTf ImProcFunctions::_5B50 ;
-LUTf ImProcFunctions::_5B60 ;
-LUTf ImProcFunctions::_5B70 ;
-LUTf ImProcFunctions::_5B80 ;
-
-LUTf ImProcFunctions::_10YR20;
-LUTf ImProcFunctions::_10YR30;
-LUTf ImProcFunctions::_10YR40;
-LUTf ImProcFunctions::_10YR50;
-LUTf ImProcFunctions::_10YR60;
-LUTf ImProcFunctions::_10YR70;
-LUTf ImProcFunctions::_10YR80;
-LUTf ImProcFunctions::_10YR90;
-
-LUTf ImProcFunctions::_85YR20;
-LUTf ImProcFunctions::_85YR30;
-LUTf ImProcFunctions::_85YR40;
-LUTf ImProcFunctions::_85YR50;
-LUTf ImProcFunctions::_85YR60;
-LUTf ImProcFunctions::_85YR70;
-LUTf ImProcFunctions::_85YR80;
-LUTf ImProcFunctions::_85YR90;
-
-LUTf ImProcFunctions::_7YR30;
-LUTf ImProcFunctions::_7YR40;
-LUTf ImProcFunctions::_7YR50;
-LUTf ImProcFunctions::_7YR60;
-LUTf ImProcFunctions::_7YR70;
-LUTf ImProcFunctions::_7YR80;
-
-LUTf ImProcFunctions::_55YR30;
-LUTf ImProcFunctions::_55YR40;
-LUTf ImProcFunctions::_55YR50;
-LUTf ImProcFunctions::_55YR60;
-LUTf ImProcFunctions::_55YR70;
-LUTf ImProcFunctions::_55YR80;
-LUTf ImProcFunctions::_55YR90;
-
-LUTf ImProcFunctions::_4YR30;
-LUTf ImProcFunctions::_4YR40;
-LUTf ImProcFunctions::_4YR50;
-LUTf ImProcFunctions::_4YR60;
-LUTf ImProcFunctions::_4YR70;
-LUTf ImProcFunctions::_4YR80;
-
-LUTf ImProcFunctions::_25YR30;
-LUTf ImProcFunctions::_25YR40;
-LUTf ImProcFunctions::_25YR50;
-LUTf ImProcFunctions::_25YR60;
-LUTf ImProcFunctions::_25YR70;
-
-LUTf ImProcFunctions::_10R30;
-LUTf ImProcFunctions::_10R40;
-LUTf ImProcFunctions::_10R50;
-LUTf ImProcFunctions::_10R60;
-LUTf ImProcFunctions::_10R70;
-
-LUTf ImProcFunctions::_9R30;
-LUTf ImProcFunctions::_9R40;
-LUTf ImProcFunctions::_9R50;
-LUTf ImProcFunctions::_9R60;
-LUTf ImProcFunctions::_9R70;
-
-LUTf ImProcFunctions::_7R30;
-LUTf ImProcFunctions::_7R40;
-LUTf ImProcFunctions::_7R50;
-LUTf ImProcFunctions::_7R60;
-LUTf ImProcFunctions::_7R70;
-
-LUTf ImProcFunctions::_5R10;
-LUTf ImProcFunctions::_5R20;
-LUTf ImProcFunctions::_5R30;
-
-LUTf ImProcFunctions::_25R10;
-LUTf ImProcFunctions::_25R20;
-LUTf ImProcFunctions::_25R30;
-
-LUTf ImProcFunctions::_10RP10;
-LUTf ImProcFunctions::_10RP20;
-LUTf ImProcFunctions::_10RP30;
-
-LUTf ImProcFunctions::_7G30;
-LUTf ImProcFunctions::_7G40;
-LUTf ImProcFunctions::_7G50;
-LUTf ImProcFunctions::_7G60;
-LUTf ImProcFunctions::_7G70;
-LUTf ImProcFunctions::_7G80;
-
-LUTf ImProcFunctions::_5G30;
-LUTf ImProcFunctions::_5G40;
-LUTf ImProcFunctions::_5G50;
-LUTf ImProcFunctions::_5G60;
-LUTf ImProcFunctions::_5G70;
-LUTf ImProcFunctions::_5G80;
-
-LUTf ImProcFunctions::_25G30;
-LUTf ImProcFunctions::_25G40;
-LUTf ImProcFunctions::_25G50;
-LUTf ImProcFunctions::_25G60;
-LUTf ImProcFunctions::_25G70;
-LUTf ImProcFunctions::_25G80;
-
-LUTf ImProcFunctions::_1G30;
-LUTf ImProcFunctions::_1G40;
-LUTf ImProcFunctions::_1G50;
-LUTf ImProcFunctions::_1G60;
-LUTf ImProcFunctions::_1G70;
-LUTf ImProcFunctions::_1G80;
-
-LUTf ImProcFunctions::_10GY30;
-LUTf ImProcFunctions::_10GY40;
-LUTf ImProcFunctions::_10GY50;
-LUTf ImProcFunctions::_10GY60;
-LUTf ImProcFunctions::_10GY70;
-LUTf ImProcFunctions::_10GY80;
-
-LUTf ImProcFunctions::_75GY30;
-LUTf ImProcFunctions::_75GY40;
-LUTf ImProcFunctions::_75GY50;
-LUTf ImProcFunctions::_75GY60;
-LUTf ImProcFunctions::_75GY70;
-LUTf ImProcFunctions::_75GY80;
-
-LUTf ImProcFunctions::_5GY30;
-LUTf ImProcFunctions::_5GY40;
-LUTf ImProcFunctions::_5GY50;
-LUTf ImProcFunctions::_5GY60;
-LUTf ImProcFunctions::_5GY70;
-LUTf ImProcFunctions::_5GY80;
-
-/*
- * Munsell Lch correction
- * copyright (c) 2011 Jacques Desmis
- *
- * data (Munsell ==> Lab) obtained with WallKillcolor and http://www.cis.rit.edu/research/mcsl2/online/munsell.php
- * each LUT give Hue in function of C, for each color Munsell and Luminance
- * eg: _6PB20 : color Munsell 6PB for L=20 c=5 c=45 c=85 c=125..139 when possible: interpolation betwwen values
- * no value for C<5 (gray)
- * low memory usage -- maximum: 195 LUT * 140 values
- * errors due to small number of point of LUT and linearization are very low (1 to 2%)
- * errors due to a different illuminant "Daylight" than "C" are low in the order of 10%. For example, a theoretical correction of 0.1 radian will be made with a real correction of 0.09 or 0.11 depending on the color illuminant D50
- * errors due to the use of a very different illuminant "C", for example illuminant "A" (tungsten) are higher in the order of 20%. Theoretical correction of 0.52 radians will be made with a real correction of 0.42
- */
-void ImProcFunctions::initMunsell () {
-#ifdef _DEBUG
- MyTime t1e,t2e;
- t1e.set();
-#endif
-
-int maxInd = 140;
-int maxInd2 = 90;
-int maxInd3 = 50;
-
-//blue for sky
-_5B40(maxInd2);
- for (int i=0; i5) _5B40[i] = -2.3 + 0.0025*(i-5);
- else if (i<90 && i>=45) _5B40[i] = -2.2 + 0.00*(i-45);
- }
- //printf("5B %1.2f %1.2f\n",_5B40[44],_5B40[89]);
-_5B50(maxInd2);
- for (int i=0; i5) _5B50[i] = -2.34 + 0.0025*(i-5);
- else if (i<90 && i>=45) _5B50[i] = -2.24+0.0003*(i-45);
- }
- //printf("5B %1.2f %1.2f\n",_5B50[44],_5B50[89]);
-_5B60(maxInd2);
- for (int i=0; i5) _5B60[i] = -2.4 + 0.003*(i-5);
- else if (i<90 && i>=45) _5B60[i] = -2.28+0.0005*(i-45);
- }
- //printf("5B %1.2f %1.2f\n",_5B60[44],_5B60[89]);
-_5B70(maxInd2);
- for (int i=0; i5) _5B70[i] = -2.41 + 0.00275*(i-5);
- else if (i<90 && i>=45) _5B70[i] = -2.30+0.00025*(i-45);
- }
- //printf("5B %1.2f %1.2f\n",_5B70[44],_5B70[89]);
-_5B80(maxInd3);
- for (int i=0; i5) _5B80[i] = -2.45 +0.003*(i-5);
- }
- //printf("5B %1.2f\n",_5B80[49]);
-
-_7B40(maxInd2);
- for (int i=0; i5) _7B40[i] = -2.15 + 0.0027*(i-5);
- else if (i<90 && i>=45) _7B40[i] = -2.04 + 0.00*(i-45);
- }
- //printf("7B %1.2f %1.2f\n",_7B40[44],_7B40[89]);
-_7B50(maxInd2);
- for (int i=0; i5) _7B50[i] = -2.20 + 0.003*(i-5);
- else if (i<90 && i>=45) _7B50[i] = -2.08 + 0.001*(i-45);
- }
- //printf("7B %1.2f %1.2f\n",_7B50[44],_7B50[79]);
-_7B60(maxInd2);
- for (int i=0; i5) _7B60[i] = -2.26 + 0.0035*(i-5);
- else if (i<90 && i>=45) _7B60[i] = -2.12 + 0.001*(i-45);
- }
- //printf("7B %1.2f %1.2f\n",_7B60[44],_7B60[79]);
-_7B70(maxInd2);
- for (int i=0; i5) _7B70[i] = -2.28 + 0.003*(i-5);
- else if (i<90 && i>=45) _7B70[i] = -2.16 + 0.0015*(i-45);
- }
- //printf("7B %1.2f %1.2f\n",_7B70[44],_7B70[64]);
-_7B80(maxInd3);
- for (int i=0; i5) _7B80[i] = -2.30 +0.0028*(i-5);
- }
- //printf("5B %1.2f\n",_7B80[49]);
-
-_9B40(maxInd2);
- for (int i=0; i5) _9B40[i] = -1.99 + 0.0022*(i-5);
- else if (i<90 && i>=45) _9B40[i] = -1.90 + 0.0008*(i-45);
- }
- //printf("9B %1.2f %1.2f\n",_9B40[44],_9B40[69]);
-_9B50(maxInd2);
- for (int i=0; i5) _9B50[i] = -2.04 + 0.0025*(i-5);
- else if (i<90 && i>=45) _9B50[i] = -1.94 + 0.0013*(i-45);
- }
- //printf("9B %1.2f %1.2f\n",_9B50[44],_9B50[77]);
-_9B60(maxInd2);
- for (int i=0; i5) _9B60[i] = -2.10 + 0.0033*(i-5);
- else if (i<90 && i>=45) _9B60[i] = -1.97 + 0.001*(i-45);
- }
- //printf("9B %1.2f %1.2f\n",_9B60[44],_9B60[79]);
-_9B70(maxInd2);
- for (int i=0; i5) _9B70[i] = -2.12 + 0.003*(i-5);
- else if (i<90 && i>=45) _9B70[i] = -2.00 + 0.001*(i-45);
- }
- //printf("9B %1.2f %1.2f\n",_9B70[44],_9B70[54]);
-_9B80(maxInd3);
- for (int i=0; i5) _9B80[i] = -2.16 +0.0025*(i-5);
- }
- //printf("9B %1.2f\n",_9B80[49]);
-
-_10B40(maxInd2);
- for (int i=0; i5) _10B40[i] = -1.92 + 0.0022*(i-5);
- else if (i<90 && i>=45) _10B40[i] = -1.83 + 0.0012*(i-45);
- }
- //printf("10B %1.2f %1.2f\n",_10B40[44],_10B40[76]);
-_10B50(maxInd2);
- for (int i=0; i5) _10B50[i] = -1.95 + 0.0022*(i-5);
- else if (i<90 && i>=45) _10B50[i] = -1.86 + 0.0008*(i-45);
- }
- //printf("10B %1.2f %1.2f\n",_10B50[44],_10B50[85]);
-_10B60(maxInd2);
- for (int i=0; i