diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5626512a..d7368f115 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,6 +89,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PROC_FLAGS}")
# Stop compilation on typos such as std:swap (missing colon will be detected as unused label):
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=unused-label")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=delete-incomplete")
# Special treatment for x87 and x86-32 SSE (see GitHub issue #4324)
include(FindX87Math)
diff --git a/rtdata/dcpprofiles/FUJIFILM X-T2.dcp b/rtdata/dcpprofiles/FUJIFILM X-T2.dcp
new file mode 100644
index 000000000..5a4e11688
Binary files /dev/null and b/rtdata/dcpprofiles/FUJIFILM X-T2.dcp differ
diff --git a/rtdata/dcpprofiles/Panasonic DMC-GX7.dcp b/rtdata/dcpprofiles/Panasonic DMC-GX7.dcp
new file mode 100644
index 000000000..25f4e6eab
Binary files /dev/null and b/rtdata/dcpprofiles/Panasonic DMC-GX7.dcp differ
diff --git a/rtdata/languages/Catala b/rtdata/languages/Catala
index e702cbe49..a2d8012cd 100644
--- a/rtdata/languages/Catala
+++ b/rtdata/languages/Catala
@@ -1867,9 +1867,9 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: -
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/Chinese (Simplified) b/rtdata/languages/Chinese (Simplified)
index 387d8fb85..556f609ea 100644
--- a/rtdata/languages/Chinese (Simplified)
+++ b/rtdata/languages/Chinese (Simplified)
@@ -1814,9 +1814,9 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: -
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/Czech b/rtdata/languages/Czech
index 5c807b61d..af9ae0c88 100644
--- a/rtdata/languages/Czech
+++ b/rtdata/languages/Czech
@@ -961,8 +961,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Barva pozadí náhledu: bílá\nZkratka: 9
MAIN_TOOLTIP_BACKCOLOR3;Barva pozadí náhledu: středně šedá\nZkratka: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Zamknout / Odemknout pohled Před\n\nZamknout: ponechá pohled Před nezměněn.\nUžitečné pro posouzení výsledného efektu po použití více nástrojů.\nNavíc může být porovnání provedeno proti kterémukoli stavu v historii.\n\nOdemknout: pohled Před bude následovat pohled Poté, vždy jen o jeden krok zpět, představí vliv právě použitého nástroje.
MAIN_TOOLTIP_HIDEHP;Zobrazit či schovat levý panel (obsahující historii).\nZkratka: l
-MAIN_TOOLTIP_INDCLIPPEDH;Zvýraznit oříznutá světla.\nZkratka: <
-MAIN_TOOLTIP_INDCLIPPEDS;Zvýraznit oříznuté stíny.\nZkratka: >
+MAIN_TOOLTIP_INDCLIPPEDH;Zvýraznit oříznutá světla.\nZkratka: >
+MAIN_TOOLTIP_INDCLIPPEDS;Zvýraznit oříznuté stíny.\nZkratka: <
MAIN_TOOLTIP_PREVIEWB;Náhled modrého kanálu.\nZkratka: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Náhled masky zaostření.\nZkratka: Shift-f\n\nVíce přesné u snímků s nízkou hloubkou ostrosti, nízkým šumem a na vyšších úrovních zvětšení.\n\nPoužijte přiblížení v rozsahu 10 až 30% pro zlepšení přesnosti detekce u zašuměných snímků.
MAIN_TOOLTIP_PREVIEWG;Náhled zeleného kanálu.\nZkratka: g
@@ -2340,9 +2340,9 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: -
!TP_DEHAZE_LUMINANCE;Luminance only
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_PDSHARPENING_LABEL;Capture Sharpening
!TP_SHARPENING_GAMMA;Gamma
diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch
index bd98c63b2..0ee886945 100644
--- a/rtdata/languages/Deutsch
+++ b/rtdata/languages/Deutsch
@@ -82,6 +82,7 @@
#81 15.04.2019 Erweiterung (TooWaBoo) RT 5.6
#82 25.05.2019 Erweiterung (TooWaBoo) RT 5.6
#83 06.07.2019 Erweiterung (TooWaBoo) RT 5.6
+#84 06.10.2019 Erweiterung (TooWaBoo) RT 5.7
#84 18.07.2019 Erweiterung (TooWaBoo) RT 5.6
ABOUT_TAB_BUILD;Version
@@ -808,6 +809,7 @@ HISTORY_MSG_490;(Dynamikkompression)\nIntensität
HISTORY_MSG_491;(Weißabgleich)
HISTORY_MSG_492;(RGB-Kurven)
HISTORY_MSG_493;(L*a*b*)
+HISTORY_MSG_494;(Eingangsschärfung)
HISTORY_MSG_CLAMPOOG;(Belichtung) - Farben\nauf Farbraum beschränken
HISTORY_MSG_COLORTONING_LABGRID_VALUE;(Farbanpassungen)\nL*a*b*-Farbkorrektur
HISTORY_MSG_COLORTONING_LABREGION_AB;(Farbanpassungen)\nL*a*b*-Farbkorrektur\nBereich
@@ -825,6 +827,7 @@ HISTORY_MSG_COLORTONING_LABREGION_SHOWMASK;(Farbanpassungen)\nL*a*b*-Farbkorrekt
HISTORY_MSG_COLORTONING_LABREGION_SLOPE;(Farbanpassungen)\nL*a*b*-Farbkorrektur\nBereich - Steigung
HISTORY_MSG_DEHAZE_DEPTH;(Bildschleier entfernen)\nTiefe
HISTORY_MSG_DEHAZE_ENABLED;(Bildschleier entfernen)
+HISTORY_MSG_DEHAZE_LUMINANCE;(Bildschleier entfernen)\nNur Luminanz
HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;(Bildschleier entfernen)\nMaske anzeigen
HISTORY_MSG_DEHAZE_STRENGTH;(Bildschleier entfernen)\nIntensität
HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;(Sensor—Matrix)\nFarbinterpolation\nAuto-Kontrastschwelle
@@ -845,6 +848,13 @@ HISTORY_MSG_LOCALCONTRAST_LIGHTNESS;(Lokaler Kontrast)\nHelle Bereiche
HISTORY_MSG_LOCALCONTRAST_RADIUS;(Lokaler Kontrast)\nRadius
HISTORY_MSG_METADATA_MODE;(Metadaten)\nKopiermodus
HISTORY_MSG_MICROCONTRAST_CONTRAST;(Mikrokontrast)\nKontrastschwelle
+HISTORY_MSG_PDSHARPEN_AUTO_CONTRAST;(Eingangsschärfung)\nAuto-Schwelle
+HISTORY_MSG_PDSHARPEN_AUTO_RADIUS;(Eingangsschärfung)\nAuto-Radius
+HISTORY_MSG_PDSHARPEN_CONTRAST;(Eingangsschärfung)\nKontrastschwelle
+HISTORY_MSG_PDSHARPEN_GAMMA;(Eingangsschärfung)\nGamma
+HISTORY_MSG_PDSHARPEN_ITERATIONS;(Eingangsschärfung)\nIterationen
+HISTORY_MSG_PDSHARPEN_RADIUS;(Eingangsschärfung)\nRadius
+HISTORY_MSG_PDSHARPEN_RADIUS_BOOST;(Eingangsschärfung)\nRandschärfe erhöhen
HISTORY_MSG_PIXELSHIFT_DEMOSAIC;(Sensor-Matrix)\nFarbinterpolation - PS\nBewegungsmethode
HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;(Sensor-Matrix)\nVorverarbeitung\nRichtung
HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;(Sensor-Matrix)\nVorverarbeitung\nPDAF-Zeilenfilter
@@ -855,6 +865,7 @@ HISTORY_MSG_RAW_BORDER;(Sensor-Matrix)\nFarbinterpolation\nBildrand
HISTORY_MSG_RESIZE_ALLOWUPSCALING;(Skalieren)\nHochskalieren zulassen
HISTORY_MSG_SHARPENING_BLUR;(Schärfung)\nWeichzeichnerradius
HISTORY_MSG_SHARPENING_CONTRAST;(Schärfung)\nKontrastschwelle
+HISTORY_MSG_SHARPENING_GAMMA;(Schärfung) - Gamma
HISTORY_MSG_SH_COLORSPACE;Farbraum
HISTORY_MSG_SOFTLIGHT_ENABLED;(Weiches Licht)
HISTORY_MSG_SOFTLIGHT_STRENGTH;(Weiches Licht)\nIntensität
@@ -1011,8 +1022,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Hintergrundfarbe der Vorschau: Weiß\nTaste: 9
MAIN_TOOLTIP_BACKCOLOR3;Hintergrundfarbe der Vorschau: Mittleres Grau\nTaste: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Vorher-Ansicht: Sperren / Entsperren\n\nGesperrt: Friert die Vorher-Ansicht ein, so\ndass sich die Gesamtwirkung mehrerer\nBearbeitungsschritte beurteilen lässt.\n\nEntsperrt: Die Vorher-Ansicht hinkt dem\naktuellen Bild immer einen Bearbeitungs-\nschritt hinterher.
MAIN_TOOLTIP_HIDEHP;Linkes Bedienfeld ein-/ausblenden.\nTaste: l
-MAIN_TOOLTIP_INDCLIPPEDH;Anzeige zu heller Bereiche ein-/ausschalten.\nTaste: <
-MAIN_TOOLTIP_INDCLIPPEDS;Anzeige zu dunkler Bereiche ein-/ausschalten.\nTaste: >
+MAIN_TOOLTIP_INDCLIPPEDH;Anzeige zu heller Bereiche ein-/ausschalten.\nTaste: >
+MAIN_TOOLTIP_INDCLIPPEDS;Anzeige zu dunkler Bereiche ein-/ausschalten.\nTaste: <
MAIN_TOOLTIP_PREVIEWB;Vorschau Blau-Kanal\nTaste: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Vorschau Fokusmaske\nTaste: Umschalt + f\n\nPräziser bei Bildern mit geringer Tiefenschärfe,\nniedrigem Rauschen und bei hoher Vergrößerung.
MAIN_TOOLTIP_PREVIEWG;Vorschau Grün-Kanal\nTaste: g
@@ -1613,6 +1624,7 @@ TP_DEFRINGE_RADIUS;Radius
TP_DEFRINGE_THRESHOLD;Schwelle
TP_DEHAZE_DEPTH;Tiefe
TP_DEHAZE_LABEL;Bildschleier entfernen
+TP_DEHAZE_LUMINANCE;Nur Luminanz
TP_DEHAZE_SHOW_DEPTH_MAP;Maske anzeigen
TP_DEHAZE_STRENGTH;Intensität
TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto-Multizonen
@@ -1723,9 +1735,9 @@ TP_EXPOS_BLACKPOINT_LABEL;Schwarzpunkt
TP_EXPOS_WHITEPOINT_LABEL;Weißpunkt
TP_FILMNEGATIVE_BLUE;Blauverhältnis
TP_FILMNEGATIVE_GREEN;Bezugsexponent (Kontrast)
-TP_FILMNEGATIVE_GUESS_TOOLTIP;Berechnet die Exponenten durch Auswahl zweier neutraler\nReferenzpunkte im Bild. Weiß (Hellgrau) und Schwarz (Dunkelgrau).\nDie Reihenfolge spielt keine Rolle. Die Exponenten werden aktualisiert,\nnachdem der zweite Punkt ausgewählt wurde.
+TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
TP_FILMNEGATIVE_LABEL;Filmnegativ
-TP_FILMNEGATIVE_PICK;Weißen und schwarzen Bereich auswählen
+TP_FILMNEGATIVE_PICK;Pick neutral spots
TP_FILMNEGATIVE_RED;Rotverhältnis
TP_FILMSIMULATION_LABEL;Filmsimulation
TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee sucht nach Hald-CLUT-Bildern, die für die Filmsimulation benötigt werden, in einem Ordner, der viel Zeit benötigt.\nGehen Sie zu\n< Einstellungen > Bildbearbeitung > Filmsimulation >\nund prüfen Sie welcher Order benutzt wird. Wählen Sie den Ordner aus, der nur die Hald-CLUT-Bilder beinhaltet, oder einen leeren Ordner, wenn Sie die Filsimulation nicht verwenden möchten.\n\nWeitere Informationen über die Filmsimulation finden Sie auf RawPedia.\n\nMöchten Sie die Suche beenden?
@@ -1875,6 +1887,7 @@ TP_PCVIGNETTE_ROUNDNESS;Form
TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Form:\n0 = Rechteck\n50 = Ellipse\n100 = Kreis
TP_PCVIGNETTE_STRENGTH;Intensität
TP_PCVIGNETTE_STRENGTH_TOOLTIP;Filterstärke in Blendenstufen (bezogen auf die Bildecken).
+TP_PDSHARPENING_LABEL;Eingangsschärfung
TP_PERSPECTIVE_HORIZONTAL;Horizontal
TP_PERSPECTIVE_LABEL;Perspektive
TP_PERSPECTIVE_VERTICAL;Vertikal
@@ -2104,12 +2117,14 @@ TP_SHARPENING_BLUR;Weichzeichnerradius
TP_SHARPENING_CONTRAST;Kontrastschwelle
TP_SHARPENING_EDRADIUS;Radius
TP_SHARPENING_EDTOLERANCE;Kantentoleranz
+TP_SHARPENING_GAMMA;Gamma
TP_SHARPENING_HALOCONTROL;Halokontrolle
TP_SHARPENING_HCAMOUNT;Intensität
TP_SHARPENING_LABEL;Schärfung
TP_SHARPENING_METHOD;Methode
TP_SHARPENING_ONLYEDGES;Nur Kanten schärfen
TP_SHARPENING_RADIUS;Radius
+TP_SHARPENING_RADIUS_BOOST;Randschärfe erhöhen
TP_SHARPENING_RLD;RL-Dekonvolution
TP_SHARPENING_RLD_AMOUNT;Intensität
TP_SHARPENING_RLD_DAMPING;Dämpfung
@@ -2371,21 +2386,3 @@ ZOOMPANEL_ZOOMFITSCREEN;An Bildschirm anpassen.\nTaste: Alt + f
ZOOMPANEL_ZOOMIN;Hineinzoomen\nTaste: +
ZOOMPANEL_ZOOMOUT;Herauszoomen\nTaste: -
-!!!!!!!!!!!!!!!!!!!!!!!!!
-! Untranslated keys follow; remove the ! prefix after an entry is translated.
-!!!!!!!!!!!!!!!!!!!!!!!!!
-
-!HISTORY_MSG_494;Capture Sharpening
-!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only
-!HISTORY_MSG_PDSHARPEN_AUTO_CONTRAST;CS - Auto threshold
-!HISTORY_MSG_PDSHARPEN_AUTO_RADIUS;CS - Auto radius
-!HISTORY_MSG_PDSHARPEN_CONTRAST;CS - Contrast threshold
-!HISTORY_MSG_PDSHARPEN_GAMMA;CS - Gamma
-!HISTORY_MSG_PDSHARPEN_ITERATIONS;CS - Iterations
-!HISTORY_MSG_PDSHARPEN_RADIUS;CS - Radius
-!HISTORY_MSG_PDSHARPEN_RADIUS_BOOST;CS - Corner radius boost
-!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma
-!TP_DEHAZE_LUMINANCE;Luminance only
-!TP_PDSHARPENING_LABEL;Capture Sharpening
-!TP_SHARPENING_GAMMA;Gamma
-!TP_SHARPENING_RADIUS_BOOST;Corner radius boost
diff --git a/rtdata/languages/English (UK) b/rtdata/languages/English (UK)
index a36a3d1a9..6c1398a16 100644
--- a/rtdata/languages/English (UK)
+++ b/rtdata/languages/English (UK)
@@ -88,6 +88,7 @@ TP_DIRPYREQUALIZER_ALGO;Skin Colour Range
TP_DIRPYREQUALIZER_ALGO_TOOLTIP;Fine: closer to the colours of the skin, minimizing the action on other colours\nLarge: avoid more artifacts.
TP_DIRPYREQUALIZER_TOOLTIP;Attempts to reduce artifacts in the transitions between skin colours (hue, chroma, luma) and the rest of the image.
TP_EXPOSURE_CLAMPOOG;Clip out-of-gamut colours
+TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no colour) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
TP_FLATFIELD_CLIPCONTROL_TOOLTIP;Clip control avoids clipped highlights caused by applying the flat field. If there are already clipped highlights before applying the flat field, clip control can lead to colour cast.
TP_GRADIENT_CENTER;Centre
TP_GRADIENT_CENTER_X;Centre X
@@ -1022,8 +1023,8 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh
!MAIN_TAB_TRANSFORM_TOOLTIP;Shortcut: Alt-t
!MAIN_TOOLTIP_BEFOREAFTERLOCK;Lock / Unlock the Before view\n\nLock: keep the Before view unchanged.\nUseful to evaluate the cumulative effect of multiple tools.\nAdditionally, comparisons can be made to any state in the History.\n\nUnlock: the Before view will follow the After view one step behind, showing the image before the effect of the currently used tool.
!MAIN_TOOLTIP_HIDEHP;Show/Hide the left panel (including the history).\nShortcut: l
-!MAIN_TOOLTIP_INDCLIPPEDH;Clipped highlight indication.\nShortcut: <
-!MAIN_TOOLTIP_INDCLIPPEDS;Clipped shadow indication.\nShortcut: >
+!MAIN_TOOLTIP_INDCLIPPEDH;Clipped highlight indication.\nShortcut: >
+!MAIN_TOOLTIP_INDCLIPPEDS;Clipped shadow indication.\nShortcut: <
!MAIN_TOOLTIP_PREVIEWB;Preview the blue channel.\nShortcut: b
!MAIN_TOOLTIP_PREVIEWFOCUSMASK;Preview the focus mask.\nShortcut: Shift-f\n\nMore accurate on images with shallow depth of field, low noise and at higher zoom levels.\nZoom out to 10-30% to improve detection accuracy on noisy images.
!MAIN_TOOLTIP_PREVIEWG;Preview the green channel.\nShortcut: g
@@ -1681,9 +1682,8 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/English (US) b/rtdata/languages/English (US)
index aa5239911..6aeae1a45 100644
--- a/rtdata/languages/English (US)
+++ b/rtdata/languages/English (US)
@@ -939,8 +939,8 @@
!MAIN_TOOLTIP_BACKCOLOR3;Background color of the preview: middle grey\nShortcut: 9
!MAIN_TOOLTIP_BEFOREAFTERLOCK;Lock / Unlock the Before view\n\nLock: keep the Before view unchanged.\nUseful to evaluate the cumulative effect of multiple tools.\nAdditionally, comparisons can be made to any state in the History.\n\nUnlock: the Before view will follow the After view one step behind, showing the image before the effect of the currently used tool.
!MAIN_TOOLTIP_HIDEHP;Show/Hide the left panel (including the history).\nShortcut: l
-!MAIN_TOOLTIP_INDCLIPPEDH;Clipped highlight indication.\nShortcut: <
-!MAIN_TOOLTIP_INDCLIPPEDS;Clipped shadow indication.\nShortcut: >
+!MAIN_TOOLTIP_INDCLIPPEDH;Clipped highlight indication.\nShortcut: >
+!MAIN_TOOLTIP_INDCLIPPEDS;Clipped shadow indication.\nShortcut: <
!MAIN_TOOLTIP_PREVIEWB;Preview the blue channel.\nShortcut: b
!MAIN_TOOLTIP_PREVIEWFOCUSMASK;Preview the focus mask.\nShortcut: Shift-f\n\nMore accurate on images with shallow depth of field, low noise and at higher zoom levels.\nZoom out to 10-30% to improve detection accuracy on noisy images.
!MAIN_TOOLTIP_PREVIEWG;Preview the green channel.\nShortcut: g
@@ -1652,9 +1652,9 @@
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/Espanol b/rtdata/languages/Espanol
index 27aa39c12..211f968e2 100644
--- a/rtdata/languages/Espanol
+++ b/rtdata/languages/Espanol
@@ -979,8 +979,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Color de fondo de la previsualización: Blanco\nT
MAIN_TOOLTIP_BACKCOLOR3;Color de fondo de la vista previa: Medio gris \nMétodo rápido: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Bloquear / Desbloquear la vista Antes\n\nBloquear: la vista Antes permanece inalterada - \nútil para evaluar el efecto acumulativo de varias herramientas.\nAdemás, se puede hacer una comparación con cualquier estado en el Historial\n\nDesbloquear: la vista Antes seguirá a la vista Después un paso por detrás, mostrando la imagen antes del efecto de la herramienta que se está usando
MAIN_TOOLTIP_HIDEHP;Mostrar/Ocultar panel izquierdo (incluyendo historial).\nTecla de Atajo: i
-MAIN_TOOLTIP_INDCLIPPEDH;Indicación de luces altas recortadas.\nTecla de Atajo: <
-MAIN_TOOLTIP_INDCLIPPEDS;Indicación de sombras recortadas.\nTecla de Atajo: >
+MAIN_TOOLTIP_INDCLIPPEDH;Indicación de luces altas recortadas.\nTecla de Atajo: >
+MAIN_TOOLTIP_INDCLIPPEDS;Indicación de sombras recortadas.\nTecla de Atajo: <
MAIN_TOOLTIP_PREVIEWB;Previsualización Canal azul.\nTecla de Atajo: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Previsualización Máscara de Foco.\nTecla de Atajo: Shift-F\n\nMás preciso en imágenes con poca profundidad de campo, bajo ruido y a mayores niveles de aumento\n\nPara mejorar la precisión en imágenes con ruido evalúe usando menor aumento (10%-30%)\n\nLa vista previa es realizada más lentamente cuando la Máscara de Foco esta activa.
MAIN_TOOLTIP_PREVIEWG;Previsualización Canal verde.\nTecla de Atajo: g
@@ -2358,9 +2358,9 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nTecla de Atajo: -
!TP_DEHAZE_LUMINANCE;Luminance only
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected
!TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected
diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais
index 9f9485c70..82ef3fcd2 100644
--- a/rtdata/languages/Francais
+++ b/rtdata/languages/Francais
@@ -916,8 +916,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Couleur de fond de l'aperçu: Blanc\nRaccourci: <
MAIN_TOOLTIP_BACKCOLOR3;Couleur de fond de l'aperçu: Gris moyen\nRaccourci : 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Vérouille / déverouille la vue Avant\n\nVérouille: garde la vue Avant inchangée - \nutile pour évaluer l'effet cumulatif de plusieurs outils.\nDe plus, une comparaison peut être faite à partir de n'importe quelle étape de l'historique\n\nDéverouille: la vue Avant représentera l'étape précédant la vue Après, montrant l'effet qui vient d'être modifié
MAIN_TOOLTIP_HIDEHP;Montrer/cacher le panneau gauche (incluant l'historique)\nRaccourci: l
-MAIN_TOOLTIP_INDCLIPPEDH;Indication hautes lumières hors domaine\nRaccourci: <
-MAIN_TOOLTIP_INDCLIPPEDS;Indication ombres hors domaine\nRaccourci: >
+MAIN_TOOLTIP_INDCLIPPEDH;Indication hautes lumières hors domaine\nRaccourci: >
+MAIN_TOOLTIP_INDCLIPPEDS;Indication ombres hors domaine\nRaccourci: <
MAIN_TOOLTIP_PREVIEWB;Affichage du canal Bleu\nRaccourci: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Affichage du Masque du focus\nRaccourci: Shift-f\n\nPlus précis sur les images avec une faible profondeur de champ, à faible bruit et à des niveaux de zoom élevé\n\nPour améliorer la précision de détection des images bruitées, évaluez les à un facteur de zoom de 10-30%\n\nLa prévisualisation met plus de temps à se calculer lorsque cet outil est actif.
MAIN_TOOLTIP_PREVIEWG;Affichage du canal Vert\nRaccourci: g
@@ -2291,9 +2291,9 @@ ZOOMPANEL_ZOOMOUT;Zoom Arrière\nRaccourci: -
!TP_DEHAZE_LUMINANCE;Luminance only
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected
!TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected
diff --git a/rtdata/languages/Italiano b/rtdata/languages/Italiano
index 7ba18b2d8..4649aea62 100644
--- a/rtdata/languages/Italiano
+++ b/rtdata/languages/Italiano
@@ -519,8 +519,8 @@ MAIN_TOOLTIP_BACKCOLOR1;Colore di sfondo dell'anteprima: Nero\nScorciatoi
MAIN_TOOLTIP_BACKCOLOR2;Colore di sfondo dell'anteprima: Bianco\nScorciatoia: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Blocca/Sblocca la vista Prima\n\nBlocca: Conserva la vista Prima.\nUtile per valutare l'effetto cumulativo di diversi strumenti.\nIn più, possono essere confrontati diversi passi della cronologia.\n\nSblocca: la vista Prima segue di un passo la vista Dopo, mostrando l'immagine prima dell'effetto dello strumento corrente.
MAIN_TOOLTIP_HIDEHP;Mostra/Nascondi il pannello sinistro (inclusa la cronologia)\nScorciatoia: l
-MAIN_TOOLTIP_INDCLIPPEDH;Indicazione delle alteluci tosate.\nScorciatoia: <
-MAIN_TOOLTIP_INDCLIPPEDS;Indicazione delle ombre tosate.\nScorciatoia: >
+MAIN_TOOLTIP_INDCLIPPEDH;Indicazione delle alteluci tosate.\nScorciatoia: >
+MAIN_TOOLTIP_INDCLIPPEDS;Indicazione delle ombre tosate.\nScorciatoia: <
MAIN_TOOLTIP_PREVIEWB;Anteprima del Canale Blu.\nScorciatoia: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Anteprima della Focus Mask.\nScorciatoia: Maiuscolo-F\n\nPiù accurato su immagini con bassa profondità di campo, poco rumore e ad elevati livelli di zoom.\n\nPer aumentare l'accuratezza della rilevazione su immagini con molto rumore, riduci le dimensioni del 10-30%.
MAIN_TOOLTIP_PREVIEWG;Anteprima del Canale Verde.\nScorciatoia: g
@@ -1919,9 +1919,9 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: -
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/Japanese b/rtdata/languages/Japanese
index 83b8caa30..511f6daf0 100644
--- a/rtdata/languages/Japanese
+++ b/rtdata/languages/Japanese
@@ -960,8 +960,8 @@ MAIN_TOOLTIP_BACKCOLOR2;プレビューの背景色を指定します: 白中間のグレー\nショートカット: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;固定 / 固定解除 - 補正前 の表示設定\n\n固定: 補正前をそのまま表示し変更されません\n複数のツールの累積効果を評価するのに役立ちます\nさらに、比較は履歴上のどこからでも行うことができます\n\n固定解除: 現在使用のツールの効果が 補正後 に表示され、その1段階前が 補正前 に表示されます
MAIN_TOOLTIP_HIDEHP;左パネル 表示/非表示 (履歴含む)\nショートカット: l
-MAIN_TOOLTIP_INDCLIPPEDH;ハイライト・クリッピング領域の表示\nショートカット: <
-MAIN_TOOLTIP_INDCLIPPEDS;シャドウ・クリッピング領域の表示\nショートカット: >
+MAIN_TOOLTIP_INDCLIPPEDH;ハイライト・クリッピング領域の表示\nショートカット: >
+MAIN_TOOLTIP_INDCLIPPEDS;シャドウ・クリッピング領域の表示\nショートカット: <
MAIN_TOOLTIP_PREVIEWB;ブルー チャンネル表示\nショートカット: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;フォーカス・マスク表示\nショートカット: Shift-f\n\n浅い被写界深度、低ノイズ、高ズームの画像の場合は、より正確に\n\nノイズの多い画像に対しては、検出精度を向上させるため10から30%縮小して評価します\n\nフォーカス・マスクをオンにすると表示に時間が掛かります
MAIN_TOOLTIP_PREVIEWG;グリーン チャンネル表示\nショートカット: g
@@ -1672,9 +1672,9 @@ TP_EXPOS_BLACKPOINT_LABEL;raw ブラック・ポイント
TP_EXPOS_WHITEPOINT_LABEL;raw ホワイト・ポイント
TP_FILMNEGATIVE_BLUE;ブルーの比率
TP_FILMNEGATIVE_GREEN;参考指数(コントラスト)
-TP_FILMNEGATIVE_GUESS_TOOLTIP;画像の中でニュートラルな参考ポイントを2点選んで指数を計算します;白い(明るいグレー)1点と黒い(暗いグレー)1点を選びます。順番は関係ありません。2つ目のポイントが選択されると指数が更新されます。
+TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
TP_FILMNEGATIVE_LABEL;ネガフィルム
-TP_FILMNEGATIVE_PICK;白と黒のポイントをピックアップする
+TP_FILMNEGATIVE_PICK;Pick neutral spots
TP_FILMNEGATIVE_RED;レッドの比率
TP_FILMSIMULATION_LABEL;フィルムシミュレーション
TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapeeはフィルムシミュレーション機能に使う画像をHald CLUTフォルダーの中から探すよう設計されています(プログラムに組み込むにはフォルダーが大き過ぎるため)。\n変更するには、環境設定 > 画像処理 > フィルムシミュレーションと進み\nどのフォルダーが使われているか確認します。機能を利用する場合は、Hald CLUTだけが入っているフォルダーを指定するか、 この機能を使わない場合はそのフォルダーを空にしておきます。\n\n詳しくはRawPediaを参照して下さい。\n\nフィルム画像のスキャンを止めますか?
diff --git a/rtdata/languages/Magyar b/rtdata/languages/Magyar
index 11c48c3d9..8ee6e66e4 100644
--- a/rtdata/languages/Magyar
+++ b/rtdata/languages/Magyar
@@ -1832,9 +1832,9 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés -
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/Nederlands b/rtdata/languages/Nederlands
index 5e2c92742..ebfdbed9d 100644
--- a/rtdata/languages/Nederlands
+++ b/rtdata/languages/Nederlands
@@ -788,8 +788,8 @@ MAIN_TOOLTIP_BACKCOLOR1;Achtergrond kleur van het voorbeeld: Zwart\nSnelt
MAIN_TOOLTIP_BACKCOLOR2;Achtergrond kleur van het voorbeeld: Wit\nSneltoets: 0
MAIN_TOOLTIP_BEFOREAFTERLOCK;Vergrendel / Ontgrendel de Voorafbeelding.\n\nVergrendel: hou de Voorafbeelding ongewijzigd.\nDit is handig om het cumulatieve effect van meerdere gereedschappen te beoordelen.\nBovendien kan er worden vergeleken met elke stap in de geschiedenislijst.\n\nOntgrendel: de Voorafbeelding volgt een stap achter de Naafbeelding en laat de afbeelding zien zonder het effect van het huidige gereedschap.
MAIN_TOOLTIP_HIDEHP;Toon/verberg linkerpaneel (geschiedenis).\nSneltoets: H
-MAIN_TOOLTIP_INDCLIPPEDH;Overbelichtingsindicatie.\nSneltoets: <
-MAIN_TOOLTIP_INDCLIPPEDS;Onderbelichtingsindicatie.\nSneltoets: >
+MAIN_TOOLTIP_INDCLIPPEDH;Overbelichtingsindicatie.\nSneltoets: >
+MAIN_TOOLTIP_INDCLIPPEDS;Onderbelichtingsindicatie.\nSneltoets: <
MAIN_TOOLTIP_PREVIEWB;Bekijk het Blauwe kanaal.\nSneltoets: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Bekijk het Focus Masker.\nSneltoets: Shift-F\n\nAccurater bij afbeeldingen met geringe scherptediepte, weinig ruis en hogere zoomniveaus.\n\nBekijk de afbeelding op lagere zoomniveaus (10-30%) om de accuratesse te vergroten bij afbeeldingen met veel ruis.\n\nHet voorbeeld wordt langzamer aangemaakt als Focus Masker aanstaat.
MAIN_TOOLTIP_PREVIEWG;Bekijk het Groene kanaal.\nSneltoets: g
@@ -2246,9 +2246,9 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: -
!TP_EXPOSURE_HISTMATCHING_TOOLTIP;Automatically adjust sliders and curves (except exposure compensation) to match the look of the embedded JPEG thumbnail.
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_ICM_WORKING_TRC;Tone response curve:
!TP_ICM_WORKING_TRC_CUSTOM;Custom
diff --git a/rtdata/languages/Polish b/rtdata/languages/Polish
index 2e8a4549f..86461bf6d 100644
--- a/rtdata/languages/Polish
+++ b/rtdata/languages/Polish
@@ -563,8 +563,8 @@ MAIN_TOOLTIP_BACKCOLOR1;Kolor tła podglądu: Czarny\nSkrót: 9
MAIN_TOOLTIP_BACKCOLOR2;Kolor tła podglądu: Biały\nSkrót: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Zablokuj / Odblokuj widok Przed\n\nZablokuj: nie zmieniaj widoku Przed - \nPrzydatne w porównywaniu zablokowanego obrazu z obrazem na ktorym wykonano wiele zmian.\n\nOdblokuj: widok Przed będzie śledził widok Po o jeden krok do tyłu, pokazując obraz przed efektem aktualnie użytego narzędzia.
MAIN_TOOLTIP_HIDEHP;Pokaż/ukryj lewy panel (razem z historią).\nSkrót: l
-MAIN_TOOLTIP_INDCLIPPEDH;Pokaż obcięte prześwietlenia.\nSkrót: <
-MAIN_TOOLTIP_INDCLIPPEDS;Pokaż obcięte niedoświetlenia.\nSkrót: >
+MAIN_TOOLTIP_INDCLIPPEDH;Pokaż obcięte prześwietlenia.\nSkrót: >
+MAIN_TOOLTIP_INDCLIPPEDS;Pokaż obcięte niedoświetlenia.\nSkrót: <
MAIN_TOOLTIP_PREVIEWB;Podgląd kanału niebieskiego.\nSkrót: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Podgląd maski ostrości.\nSkrót: Shift-f\n\nDokładniejsze w przypadku zdjęc o płytkiej głębi ostrości, niskim pozimie szumów i o większym przybliżeniu. W przypadku zdjęć o wyższym poziomie szumów maska ostrości będzie dokładniejsza przy mniejszym zoomie (10-30%).
MAIN_TOOLTIP_PREVIEWG;Podgląd kanału zielonego.\nSkrót: g
@@ -1945,9 +1945,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: -
!TP_EXPOSURE_TCMODE_PERCEPTUAL;Perceptual
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
!TP_ICM_APPLYBASELINEEXPOSUREOFFSET;Baseline exposure
diff --git a/rtdata/languages/Portugues b/rtdata/languages/Portugues
index c4adbc7f9..dea314f46 100644
--- a/rtdata/languages/Portugues
+++ b/rtdata/languages/Portugues
@@ -916,8 +916,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Cor de fundo da pré-visualização: branco\nAtal
MAIN_TOOLTIP_BACKCOLOR3;Cor de fundo da pré-visualização: cinza médio\nAtalho: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Bloquear / desbloquear a visualização antes\n\nBloquear: manter a visualização antes inalterada.\nÚtil para avaliar o efeito cumulativo de várias ferramentas.\nAlém disso, podem ser feitas comparações a qualquer momento no histórico.\n\nDesbloquear: a visualização antes seguirá a visualização depois um passo antes, mostrando a imagem antes do efeito da ferramenta atualmente utilizada.
MAIN_TOOLTIP_HIDEHP;Mostrar o painel esquerdo (incluindo o histórico).\nAtalho: l
-MAIN_TOOLTIP_INDCLIPPEDH;Ver altas luzes cortadas.\nAtalho: <
-MAIN_TOOLTIP_INDCLIPPEDS;Ver sombras cortadas.\nAtalho: >
+MAIN_TOOLTIP_INDCLIPPEDH;Ver altas luzes cortadas.\nAtalho: >
+MAIN_TOOLTIP_INDCLIPPEDS;Ver sombras cortadas.\nAtalho: <
MAIN_TOOLTIP_PREVIEWB;Pré-visualizar o canal azul.\nAtalho: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Pré-visualizar a máscara de foco.\nAtalho: Shift-f\n\nMais preciso em imagens com pouca profundidade de campo, baixo ruído e níveis de zoom mais altos.\n\nUtilize um zoom menor entre 10-30% para melhorar a precisão da deteção de imagens com muito ruído.
MAIN_TOOLTIP_PREVIEWG;Pré-visualizar o canal verde.\nAtalho: g
@@ -2290,9 +2290,9 @@ ZOOMPANEL_ZOOMOUT;Afastar\nAtalho: -
!TP_DEHAZE_LUMINANCE;Luminance only
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected
!TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected
diff --git a/rtdata/languages/Portugues (Brasil) b/rtdata/languages/Portugues (Brasil)
index 259cabb7e..c6ff58310 100644
--- a/rtdata/languages/Portugues (Brasil)
+++ b/rtdata/languages/Portugues (Brasil)
@@ -923,8 +923,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Cor de fundo da pré-visualização: Branco\nAtal
MAIN_TOOLTIP_BACKCOLOR3;Cor de fundo da pré-visualização: Cinza médio\nAtalho: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Travar / Destravar a Antes visualização\n\nTravar: mantenha o Antes visualização inalterada.\nÚtil para avaliar o efeito cumulativo de várias ferramentas.\nAlém disso, comparações podem ser feitas a qualquer momento.\n\nDestravar: o Antes visualização seguinte Depois visualização anterior, mostrando a imagem antes do efeito da ferramenta atualmente utilizada.
MAIN_TOOLTIP_HIDEHP;Mostrar/Ocultar o painel esquerdo (incluindo o histórico).\nAtalho: l
-MAIN_TOOLTIP_INDCLIPPEDH;Indicação de realce recortado.\nAtalho: <
-MAIN_TOOLTIP_INDCLIPPEDS;Indicação de sombra recortada.\nAtalho: >
+MAIN_TOOLTIP_INDCLIPPEDH;Indicação de realce recortado.\nAtalho: >
+MAIN_TOOLTIP_INDCLIPPEDS;Indicação de sombra recortada.\nAtalho: <
MAIN_TOOLTIP_PREVIEWB;Pré-visualize o Canal Azul.\nAtalho: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Pré-visualize a Máscara de Foco.\nAtalho: Shift-f\n\nMais preciso em imagens com pouca profundidade de campo, baixo ruído e níveis de zoom mais altos.\n\nPara melhorar a precisão da detecção de imagens ruidosas, avalie com zoom menor, cerca de 10-30%.
MAIN_TOOLTIP_PREVIEWG;Pré-visualize o Canal verde.\nAtalho: g
@@ -1626,7 +1626,7 @@ TP_EXPOSURE_TCMODE_WEIGHTEDSTD;Padrão Ponderado
TP_EXPOS_BLACKPOINT_LABEL;Pontos Pretos Raw
TP_EXPOS_WHITEPOINT_LABEL;Pontos Brancos Raw
TP_FILMNEGATIVE_BLUE;Relação de azul
-TP_FILMNEGATIVE_PICK;Escolher os pontos brancos e pretos
+TP_FILMNEGATIVE_PICK;Pick neutral spots
TP_FILMNEGATIVE_RED;Relação de vermelho
TP_FILMSIMULATION_LABEL;Simulação de Filme
TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee está configurado para procurar por imagens Hald CLUT, que são usadas para a ferramenta Simulação de Filme, numa pasta que está demorando para carregar.\nVá para Preferências > Processamento de Imagem > Simulação de Filme\npara ver qual pasta está sendo usada. Deves apontar RawTherapee para uma pasta que contenha apenas imagens Hald CLUT e nada mais, ou para uma pasta vazia, se não quiseres usar a ferramenta Simulação de Filme.\n\nLeia o artigo sobre Simulação de Filme na RawPedia para mais informações.\n\nDesejas cancelar a verificação agora?
@@ -2293,7 +2293,7 @@ ZOOMPANEL_ZOOMOUT;Menos Zoom\nAtalho: -
!TP_CROP_PPI;PPI
!TP_DEHAZE_LUMINANCE;Luminance only
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
!TP_LENSPROFILE_LENS_WARNING;Warning: the crop factor used for lens profiling is larger than the crop factor of the camera, the results might be wrong.
!TP_LENSPROFILE_USE_HEADER;Correct
diff --git a/rtdata/languages/Russian b/rtdata/languages/Russian
index 2014f9aad..9f8f47da0 100644
--- a/rtdata/languages/Russian
+++ b/rtdata/languages/Russian
@@ -613,8 +613,8 @@ MAIN_TOOLTIP_BACKCOLOR1;Фоновый цвет предпросмотра:
MAIN_TOOLTIP_BACKCOLOR2;Фоновый цвет предпросмотра: Белый\nГорячая клавиша: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Заблокировать / Разблокировать предыдущий вид\n\nЗаблокировать: сохраняет предыдущий вид неизменным.\nПолезно для оценки общего эффекта от применения нескольких инструментов.\nК тому же, сравнения могут быть произведены на любом состоянии истории\n\nРазблокировать: предыдущий вид будет следовать сразу за следующим, показывая состояние изображения до применения текущего инструмента.
MAIN_TOOLTIP_HIDEHP;Показать/скрыть левую панель (включая историю).\nГорячая клавиша l
-MAIN_TOOLTIP_INDCLIPPEDH;Индикатор пересветов.\nГорячая клавиша: <
-MAIN_TOOLTIP_INDCLIPPEDS;Индикатор затемнений.\nГорячая клавиша: >
+MAIN_TOOLTIP_INDCLIPPEDH;Индикатор пересветов.\nГорячая клавиша: >
+MAIN_TOOLTIP_INDCLIPPEDS;Индикатор затемнений.\nГорячая клавиша: <
MAIN_TOOLTIP_PREVIEWB;Просмотреть канал синего.\nГорячая клавиша: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Просмотреть Маску резкости.\nГорячая клавиша: Shift-F\n\nБолее точна на изображениях с небольшой глубиной резкости, малым шумом и при большем приближении изображения\n\nДля улучшения определения на шумных изображениях используйте на маленьком зуме 10-30%
MAIN_TOOLTIP_PREVIEWG;Просмотреть канал зеленого.\nГорячая клавиша: g
@@ -1990,9 +1990,9 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: -
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
!TP_FLATFIELD_CLIPCONTROL;Clip control
diff --git a/rtdata/languages/Serbian (Cyrilic Characters) b/rtdata/languages/Serbian (Cyrilic Characters)
index 0e940be55..63b838201 100644
--- a/rtdata/languages/Serbian (Cyrilic Characters)
+++ b/rtdata/languages/Serbian (Cyrilic Characters)
@@ -1918,9 +1918,9 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике -
!TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FILMSIMULATION_LABEL;Film Simulation
!TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
diff --git a/rtdata/languages/Swedish b/rtdata/languages/Swedish
index fbc55624d..b39d95e02 100644
--- a/rtdata/languages/Swedish
+++ b/rtdata/languages/Swedish
@@ -698,8 +698,8 @@ MAIN_TOOLTIP_BACKCOLOR1;Bakgrundsfärg: Svart\nKortkommando: 9
MAIN_TOOLTIP_BACKCOLOR2;Bakgrundsfärg: Vit\nKortkommando: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Lås / Lås upp före-vyn\n\nLås: behåll före-vyn oförändrad.\nAnvändbart för att utvärdera den sammanlagda effekten av flera stegs redigering. Dessutom kan jämförelser göras gentemot varje annat steg i historiken.\n\nLås upp: Före-vyn kommer hela tiden visa ett tidigare steg jämfört med efter-vyn, och visar därmed effekten av det verktyg som användes senast.
MAIN_TOOLTIP_HIDEHP;Visa/göm den vänstra panelen. Kortkommando: l
-MAIN_TOOLTIP_INDCLIPPEDH;Markera högdagerindikation.\nKortkommando: <
-MAIN_TOOLTIP_INDCLIPPEDS;Markera skuggindikation.\nKortkommando: >
+MAIN_TOOLTIP_INDCLIPPEDH;Markera högdagerindikation.\nKortkommando: >
+MAIN_TOOLTIP_INDCLIPPEDS;Markera skuggindikation.\nKortkommando: <
MAIN_TOOLTIP_PREVIEWB;Förhandsgranska den blå kanalen.\nGenväg: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Förhandsgranska fokusmasken.\nKortkommando: Shift-f\n\nNoggrannare på bilder med kort skärpedjup, lågt brus och där en hög zoom-grad är vald.\n\nFör att förbättra detekteringen för brusiga bilder, utvärdera vid en zoom-grad om 10-30%\n\nFörhandsvisningen görs långsammare med fokusmasken påslagen.
MAIN_TOOLTIP_PREVIEWG;Förhandsgranska den gröna kanalen.\nGenväg: g
@@ -2133,9 +2133,9 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: -
!TP_EXPOSURE_HISTMATCHING_TOOLTIP;Automatically adjust sliders and curves (except exposure compensation) to match the look of the embedded JPEG thumbnail.
!TP_FILMNEGATIVE_BLUE;Blue ratio
!TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-!TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+!TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
!TP_FILMNEGATIVE_LABEL;Film Negative
-!TP_FILMNEGATIVE_PICK;Pick white and black spots
+!TP_FILMNEGATIVE_PICK;Pick neutral spots
!TP_FILMNEGATIVE_RED;Red ratio
!TP_FLATFIELD_CLIPCONTROL;Clip control
!TP_FLATFIELD_CLIPCONTROL_TOOLTIP;Clip control avoids clipped highlights caused by applying the flat field. If there are already clipped highlights before applying the flat field, clip control can lead to color cast.
diff --git a/rtdata/languages/default b/rtdata/languages/default
index 7000539b2..f3c4645df 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -948,8 +948,8 @@ MAIN_TOOLTIP_BACKCOLOR2;Background color of the preview: white\nShortcut:
MAIN_TOOLTIP_BACKCOLOR3;Background color of the preview: middle grey\nShortcut: 9
MAIN_TOOLTIP_BEFOREAFTERLOCK;Lock / Unlock the Before view\n\nLock: keep the Before view unchanged.\nUseful to evaluate the cumulative effect of multiple tools.\nAdditionally, comparisons can be made to any state in the History.\n\nUnlock: the Before view will follow the After view one step behind, showing the image before the effect of the currently used tool.
MAIN_TOOLTIP_HIDEHP;Show/Hide the left panel (including the history).\nShortcut: l
-MAIN_TOOLTIP_INDCLIPPEDH;Clipped highlight indication.\nShortcut: <
-MAIN_TOOLTIP_INDCLIPPEDS;Clipped shadow indication.\nShortcut: >
+MAIN_TOOLTIP_INDCLIPPEDH;Clipped highlight indication.\nShortcut: >
+MAIN_TOOLTIP_INDCLIPPEDS;Clipped shadow indication.\nShortcut: <
MAIN_TOOLTIP_PREVIEWB;Preview the blue channel.\nShortcut: b
MAIN_TOOLTIP_PREVIEWFOCUSMASK;Preview the focus mask.\nShortcut: Shift-f\n\nMore accurate on images with shallow depth of field, low noise and at higher zoom levels.\nZoom out to 10-30% to improve detection accuracy on noisy images.
MAIN_TOOLTIP_PREVIEWG;Preview the green channel.\nShortcut: g
@@ -1661,9 +1661,9 @@ TP_EXPOS_BLACKPOINT_LABEL;Raw Black Points
TP_EXPOS_WHITEPOINT_LABEL;Raw White Points
TP_FILMNEGATIVE_BLUE;Blue ratio
TP_FILMNEGATIVE_GREEN;Reference exponent (contrast)
-TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking two neutral reference spots in the image; one white (light gray) and one black (dark gray). The order does not matter. The exponents will be updated after the second spot is picked.
+TP_FILMNEGATIVE_GUESS_TOOLTIP;Automatically set the red and blue ratios by picking two patches which had a neutral hue (no color) in the original scene. The patches should differ in brightness. Set the white balance afterwards.
TP_FILMNEGATIVE_LABEL;Film Negative
-TP_FILMNEGATIVE_PICK;Pick white and black spots
+TP_FILMNEGATIVE_PICK;Pick neutral spots
TP_FILMNEGATIVE_RED;Red ratio
TP_FILMSIMULATION_LABEL;Film Simulation
TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now?
@@ -1677,7 +1677,7 @@ TP_FLATFIELD_BT_HORIZONTAL;Horizontal
TP_FLATFIELD_BT_VERTHORIZ;Vertical + Horizontal
TP_FLATFIELD_BT_VERTICAL;Vertical
TP_FLATFIELD_CLIPCONTROL;Clip control
-TP_FLATFIELD_CLIPCONTROL_TOOLTIP;Clip control avoids clipped highlights caused by applying the flat field. If there are already clipped highlights before applying the flat field, clip control can lead to color cast.
+TP_FLATFIELD_CLIPCONTROL_TOOLTIP;Clip control avoids clipped highlights caused by applying the flat field. If there are already clipped highlights before applying the flat field, value 0 is used.
TP_FLATFIELD_LABEL;Flat-Field
TP_GENERAL_11SCALE_TOOLTIP;The effects of this tool are only visible or only accurate at a preview scale of 1:1.
TP_GRADIENT_CENTER;Center
diff --git a/rtdata/rawtherapee.desktop.in b/rtdata/rawtherapee.desktop.in
index b059e7d6a..f6bc3afeb 100644
--- a/rtdata/rawtherapee.desktop.in
+++ b/rtdata/rawtherapee.desktop.in
@@ -17,4 +17,5 @@ Terminal=false
MimeType=image/jpeg;image/png;image/tiff;image/x-adobe-dng;image/x-canon-cr2;image/x-canon-crf;image/x-canon-crw;image/x-fuji-raf;image/x-hasselblad-3fr;image/x-hasselblad-fff;image/x-jpg;image/x-kodak-dcr;image/x-kodak-k25;image/x-kodak-kdc;image/x-leaf-mos;image/x-leica-rwl;image/x-mamiya-mef;image/x-minolta-mrw;image/x-nikon-nef;image/x-nikon-nrw;image/x-olympus-orf;image/x-panasonic-raw;image/x-panasonic-rw2;image/x-pentax-pef;image/x-pentax-raw;image/x-phaseone-iiq;image/x-raw;image/x-rwz;image/x-samsung-srw;image/x-sigma-x3f;image/x-sony-arq;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-tif;
Categories=Graphics;Photography;2DGraphics;RasterGraphics;GTK;
Keywords=raw;photo;photography;develop;pp3;graphics;
+StartupNotify=true
StartupWMClass=rawtherapee
diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc
index a2d68402f..4dc2019c1 100644
--- a/rtengine/CA_correct_RT.cc
+++ b/rtengine/CA_correct_RT.cc
@@ -28,6 +28,14 @@
#include "gauss.h"
#include "median.h"
#include "StopWatch.h"
+
+namespace
+{
+unsigned fc(const unsigned int cfa[2][2], int r, int c) {
+ return cfa[r & 1][c & 1];
+}
+}
+
namespace {
bool LinEqSolve(int nDim, double* pfMatr, double* pfVect, double* pfSolution)
@@ -106,10 +114,6 @@ bool LinEqSolve(int nDim, double* pfMatr, double* pfVect, double* pfSolution)
//end of linear equation solver
}
-namespace rtengine {
- extern const Settings* settings;
-}
-
using namespace std;
using namespace rtengine;
@@ -138,6 +142,7 @@ float* RawImageSource::CA_correct_RT(
}
// multithreaded and vectorized by Ingo Weyrich
+ const unsigned int cfa[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}};
constexpr int ts = 128;
constexpr int tsh = ts / 2;
constexpr int cb = 2; // 2 pixels border will be excluded from correction
@@ -148,7 +153,7 @@ float* RawImageSource::CA_correct_RT(
// Test for RGB cfa
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
- if (FC(i, j) == 3) {
+ if (fc(cfa, i, j) == 3) {
std::cout << "CA correction supports only RGB Colour filter arrays" << std::endl;
return buffer;
}
@@ -167,7 +172,7 @@ float* RawImageSource::CA_correct_RT(
#pragma omp parallel for
#endif
for (int i = cb; i < H - cb; ++i) {
- for (int j = cb + (FC(i, 0) & 1); j < W - cb; j += 2) {
+ for (int j = cb + (fc(cfa, i, 0) & 1); j < W - cb; j += 2) {
(*oldraw)[i - cb][(j - cb) / 2] = rawData[i][j];
}
}
@@ -198,7 +203,7 @@ float* RawImageSource::CA_correct_RT(
//block CA shift values and weight assigned to block
float* const blockwt = buffer + (height * width);
- memset(blockwt, 0, vblsz * hblsz * (2 * 2 + 1) * sizeof(float));
+ memset(blockwt, 0, static_cast(vblsz) * hblsz * (2 * 2 + 1) * sizeof(float));
float (*blockshifts)[2][2] = (float (*)[2][2])(blockwt + vblsz * hblsz);
// Because we can't break parallel processing, we need a switch do handle the errors
@@ -320,12 +325,12 @@ float* RawImageSource::CA_correct_RT(
int cc = ccmin;
int col = cc + left;
#ifdef __SSE2__
- int c0 = FC(rr, cc);
+ int c0 = fc(cfa, rr, cc);
if (c0 == 1) {
rgb[c0][rr * ts + cc] = rawData[row][col] / 65535.f;
cc++;
col++;
- c0 = FC(rr, cc);
+ c0 = fc(cfa, rr, cc);
}
int indx1 = rr * ts + cc;
for (; cc < ccmax - 7; cc+=8, col+=8, indx1 += 8) {
@@ -338,7 +343,7 @@ float* RawImageSource::CA_correct_RT(
}
#endif
for (; cc < ccmax; cc++, col++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
int indx1 = rr * ts + cc;
rgb[c][indx1 >> ((c & 1) ^ 1)] = rawData[row][col] / 65535.f;
}
@@ -348,7 +353,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmin > 0) {
for (int rr = 0; rr < border; rr++) {
for (int cc = ccmin; cc < ccmax; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + cc) >> ((c & 1) ^ 1)] = rgb[c][((border2 - rr) * ts + cc) >> ((c & 1) ^ 1)];
}
}
@@ -357,7 +362,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmax < rr1) {
for (int rr = 0; rr < border; rr++) {
for (int cc = ccmin; cc < ccmax; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][((rrmax + rr)*ts + cc) >> ((c & 1) ^ 1)] = rawData[(height - rr - 2)][left + cc] / 65535.f;
}
}
@@ -366,7 +371,7 @@ float* RawImageSource::CA_correct_RT(
if (ccmin > 0) {
for (int rr = rrmin; rr < rrmax; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + cc) >> ((c & 1) ^ 1)] = rgb[c][(rr * ts + border2 - cc) >> ((c & 1) ^ 1)];
}
}
@@ -375,7 +380,7 @@ float* RawImageSource::CA_correct_RT(
if (ccmax < cc1) {
for (int rr = rrmin; rr < rrmax; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + ccmax + cc) >> ((c & 1) ^ 1)] = rawData[(top + rr)][(width - cc - 2)] / 65535.f;
}
}
@@ -385,7 +390,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmin > 0 && ccmin > 0) {
for (int rr = 0; rr < border; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + cc) >> ((c & 1) ^ 1)] = rawData[border2 - rr][border2 - cc] / 65535.f;
}
}
@@ -394,7 +399,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmax < rr1 && ccmax < cc1) {
for (int rr = 0; rr < border; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][((rrmax + rr)*ts + ccmax + cc) >> ((c & 1) ^ 1)] = rawData[(height - rr - 2)][(width - cc - 2)] / 65535.f;
}
}
@@ -403,7 +408,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmin > 0 && ccmax < cc1) {
for (int rr = 0; rr < border; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + ccmax + cc) >> ((c & 1) ^ 1)] = rawData[(border2 - rr)][(width - cc - 2)] / 65535.f;
}
}
@@ -412,7 +417,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmax < rr1 && ccmin > 0) {
for (int rr = 0; rr < border; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][((rrmax + rr)*ts + cc) >> ((c & 1) ^ 1)] = rawData[(height - rr - 2)][(border2 - cc)] / 65535.f;
}
}
@@ -427,9 +432,9 @@ float* RawImageSource::CA_correct_RT(
#endif
for (int rr = 3; rr < rr1 - 3; rr++) {
int row = rr + top;
- int cc = 3 + (FC(rr,3) & 1);
+ int cc = 3 + (fc(cfa, rr,3) & 1);
int indx = rr * ts + cc;
- int c = FC(rr,cc);
+ int c = fc(cfa, rr,cc);
#ifdef __SSE2__
for (; cc < cc1 - 9; cc+=8, indx+=8) {
//compute directional weights using image gradients
@@ -463,7 +468,7 @@ float* RawImageSource::CA_correct_RT(
}
if (row > -1 && row < height) {
- int offset = (FC(row,max(left + 3, 0)) & 1);
+ int offset = (fc(cfa, row,max(left + 3, 0)) & 1);
int col = max(left + 3, 0) + offset;
int indx = rr * ts + 3 - (left < 0 ? (left+3) : 0) + offset;
#ifdef __SSE2__
@@ -481,9 +486,9 @@ float* RawImageSource::CA_correct_RT(
vfloat zd25v = F2V(0.25f);
#endif
for (int rr = 4; rr < rr1 - 4; rr++) {
- int cc = 4 + (FC(rr, 2) & 1);
+ int cc = 4 + (fc(cfa, rr, 2) & 1);
int indx = rr * ts + cc;
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
#ifdef __SSE2__
for (; cc < cc1 - 10; cc += 8, indx += 8) {
vfloat rgb1v = LC2VFU(rgb[1][indx]);
@@ -547,9 +552,9 @@ float* RawImageSource::CA_correct_RT(
// along line segments, find the point along each segment that minimizes the colour variance
// averaged over the tile; evaluate for up/down and left/right away from R/B grid point
for (int rr = 8; rr < rr1 - 8; rr++) {
- int cc = 8 + (FC(rr, 2) & 1);
+ int cc = 8 + (fc(cfa, rr, 2) & 1);
int indx = rr * ts + cc;
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
#ifdef __SSE2__
vfloat coeff00v = ZEROV;
vfloat coeff01v = ZEROV;
@@ -871,14 +876,14 @@ float* RawImageSource::CA_correct_RT(
int indx = row * width + col;
int indx1 = rr * ts + cc;
#ifdef __SSE2__
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
if (c & 1) {
rgb[1][indx1] = rawData[row][col] / 65535.f;
indx++;
indx1++;
cc++;
col++;
- c = FC(rr, cc);
+ c = fc(cfa, rr, cc);
}
for (; cc < ccmax - 7; cc += 8, col += 8, indx += 8, indx1 += 8) {
vfloat val1v = LVFU(rawData[row][col]) / c65535v;
@@ -890,7 +895,7 @@ float* RawImageSource::CA_correct_RT(
}
#endif
for (; cc < ccmax; cc++, col++, indx++, indx1++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][indx1 >> ((c & 1) ^ 1)] = rawData[row][col] / 65535.f;
if ((c & 1) == 0) {
@@ -903,7 +908,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmin > 0) {
for (int rr = 0; rr < border; rr++) {
for (int cc = ccmin; cc < ccmax; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + cc) >> ((c & 1) ^ 1)] = rgb[c][((border2 - rr) * ts + cc) >> ((c & 1) ^ 1)];
rgb[1][rr * ts + cc] = rgb[1][(border2 - rr) * ts + cc];
}
@@ -913,7 +918,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmax < rr1) {
for (int rr = 0; rr < std::min(border, rr1 - rrmax); rr++) {
for (int cc = ccmin; cc < ccmax; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][((rrmax + rr)*ts + cc) >> ((c & 1) ^ 1)] = (rawData[(height - rr - 2)][left + cc]) / 65535.f;
if ((c & 1) == 0) {
rgb[1][(rrmax + rr)*ts + cc] = Gtmp[((height - rr - 2) * width + left + cc) >> 1];
@@ -925,7 +930,7 @@ float* RawImageSource::CA_correct_RT(
if (ccmin > 0) {
for (int rr = rrmin; rr < rrmax; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + cc) >> ((c & 1) ^ 1)] = rgb[c][(rr * ts + border2 - cc) >> ((c & 1) ^ 1)];
rgb[1][rr * ts + cc] = rgb[1][rr * ts + border2 - cc];
}
@@ -935,7 +940,7 @@ float* RawImageSource::CA_correct_RT(
if (ccmax < cc1) {
for (int rr = rrmin; rr < rrmax; rr++) {
for (int cc = 0; cc < std::min(border, cc1 - ccmax); cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + ccmax + cc) >> ((c & 1) ^ 1)] = (rawData[(top + rr)][(width - cc - 2)]) / 65535.f;
if ((c & 1) == 0) {
rgb[1][rr * ts + ccmax + cc] = Gtmp[((top + rr) * width + (width - cc - 2)) >> 1];
@@ -948,7 +953,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmin > 0 && ccmin > 0) {
for (int rr = 0; rr < border; rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + cc) >> ((c & 1) ^ 1)] = (rawData[border2 - rr][border2 - cc]) / 65535.f;
if ((c & 1) == 0) {
rgb[1][rr * ts + cc] = Gtmp[((border2 - rr) * width + border2 - cc) >> 1];
@@ -960,7 +965,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmax < rr1 && ccmax < cc1) {
for (int rr = 0; rr < std::min(border, rr1 - rrmax); rr++) {
for (int cc = 0; cc < std::min(border, cc1 - ccmax); cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][((rrmax + rr)*ts + ccmax + cc) >> ((c & 1) ^ 1)] = (rawData[(height - rr - 2)][(width - cc - 2)]) / 65535.f;
if ((c & 1) == 0) {
rgb[1][(rrmax + rr)*ts + ccmax + cc] = Gtmp[((height - rr - 2) * width + (width - cc - 2)) >> 1];
@@ -972,7 +977,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmin > 0 && ccmax < cc1) {
for (int rr = 0; rr < border; rr++) {
for (int cc = 0; cc < std::min(border, cc1 - ccmax); cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][(rr * ts + ccmax + cc) >> ((c & 1) ^ 1)] = (rawData[(border2 - rr)][(width - cc - 2)]) / 65535.f;
if ((c & 1) == 0) {
rgb[1][rr * ts + ccmax + cc] = Gtmp[((border2 - rr) * width + (width - cc - 2)) >> 1];
@@ -984,7 +989,7 @@ float* RawImageSource::CA_correct_RT(
if (rrmax < rr1 && ccmin > 0) {
for (int rr = 0; rr < std::min(border, rr1 - rrmax); rr++) {
for (int cc = 0; cc < border; cc++) {
- int c = FC(rr, cc);
+ int c = fc(cfa, rr, cc);
rgb[c][((rrmax + rr)*ts + cc) >> ((c & 1) ^ 1)] = (rawData[(height - rr - 2)][(border2 - cc)]) / 65535.f;
if ((c & 1) == 0) {
rgb[1][(rrmax + rr)*ts + cc] = Gtmp[((height - rr - 2) * width + (border2 - cc)) >> 1];
@@ -1001,7 +1006,7 @@ float* RawImageSource::CA_correct_RT(
#endif
//manual CA correction; use red/blue slider values to set CA shift parameters
for (int rr = 3; rr < rr1 - 3; rr++) {
- int cc = 3 + FC(rr, 1), c = FC(rr,cc), indx = rr * ts + cc;
+ int cc = 3 + fc(cfa, rr, 1), c = fc(cfa, rr,cc), indx = rr * ts + cc;
#ifdef __SSE2__
for (; cc < cc1 - 10; cc += 8, indx += 8) {
//compute directional weights using image gradients
@@ -1082,8 +1087,8 @@ float* RawImageSource::CA_correct_RT(
}
for (int rr = 4; rr < rr1 - 4; rr++) {
- int cc = 4 + (FC(rr, 2) & 1);
- int c = FC(rr, cc);
+ int cc = 4 + (fc(cfa, rr, 2) & 1);
+ int c = fc(cfa, rr, cc);
int indx = (rr * ts + cc) >> 1;
int indxfc = (rr + shiftvfloor[c]) * ts + cc + shifthceil[c];
int indxff = (rr + shiftvfloor[c]) * ts + cc + shifthfloor[c];
@@ -1132,8 +1137,8 @@ float* RawImageSource::CA_correct_RT(
vfloat epsv = F2V(eps);
#endif
for (int rr = 8; rr < rr1 - 8; rr++) {
- int cc = 8 + (FC(rr, 2) & 1);
- int c = FC(rr, cc);
+ int cc = 8 + (fc(cfa, rr, 2) & 1);
+ int c = fc(cfa, rr, cc);
int GRBdir0 = GRBdir[0][c];
int GRBdir1 = GRBdir[1][c];
#ifdef __SSE2__
@@ -1170,7 +1175,7 @@ float* RawImageSource::CA_correct_RT(
STVFU(rgb[c][indx >> 1], RBint);
}
#endif
- for (int c = FC(rr, cc), indx = rr * ts + cc; cc < cc1 - 8; cc += 2, indx += 2) {
+ for (int c = fc(cfa, rr, cc), indx = rr * ts + cc; cc < cc1 - 8; cc += 2, indx += 2) {
float grbdiffold = rgb[1][indx] - rgb[c][indx >> 1];
//interpolate colour difference from optical R/B locations to grid locations
@@ -1212,9 +1217,9 @@ float* RawImageSource::CA_correct_RT(
// copy CA corrected results to temporary image matrix
for (int rr = border; rr < rr1 - border; rr++) {
- int c = FC(rr + top, left + border + (FC(rr + top, 2) & 1));
+ int c = fc(cfa, rr + top, left + border + (fc(cfa, rr + top, 2) & 1));
int row = rr + top;
- int cc = border + (FC(rr, 2) & 1);
+ int cc = border + (fc(cfa, rr, 2) & 1);
int indx = (row * width + cc + left) >> 1;
int indx1 = (rr * ts + cc) >> 1;
#ifdef __SSE2__
@@ -1249,7 +1254,7 @@ float* RawImageSource::CA_correct_RT(
#endif
for (int row = cb; row < height - cb; row++) {
- int col = cb + (FC(row, 0) & 1);
+ int col = cb + (fc(cfa, row, 0) & 1);
int indx = (row * width + col) >> 1;
#ifdef __SSE2__
for (; col < width - 7 - cb; col += 8, indx += 4) {
@@ -1284,8 +1289,8 @@ float* RawImageSource::CA_correct_RT(
#pragma omp for
#endif
for (int i = 0; i < H - 2 * cb; ++i) {
- const int firstCol = FC(i, 0) & 1;
- const int colour = FC(i, firstCol);
+ const int firstCol = fc(cfa, i, 0) & 1;
+ const int colour = fc(cfa, i, firstCol);
const array2D* nonGreen = colour == 0 ? redFactor : blueFactor;
int j = firstCol;
#ifdef __SSE2__
@@ -1317,9 +1322,9 @@ float* RawImageSource::CA_correct_RT(
if (W % 2) {
// odd width => factors for one channel are not set in last column => use value of preceding column
- const int ngRow = 1 - (FC(0, 0) & 1);
- const int ngCol = FC(ngRow, 0) & 1;
- const int colour = FC(ngRow, ngCol);
+ const int ngRow = 1 - (fc(cfa, 0, 0) & 1);
+ const int ngCol = fc(cfa, ngRow, 0) & 1;
+ const int colour = fc(cfa, ngRow, ngCol);
const array2D* nonGreen = colour == 0 ? redFactor : blueFactor;
for (int i = 0; i < (H + 1 - 2 * cb) / 2; ++i) {
(*nonGreen)[i][(W - 2 * cb + 1) / 2 - 1] = (*nonGreen)[i][(W - 2* cb + 1) / 2 - 2];
@@ -1336,8 +1341,8 @@ float* RawImageSource::CA_correct_RT(
#pragma omp for
#endif
for (int i = 0; i < H - 2 * cb; ++i) {
- const int firstCol = FC(i, 0) & 1;
- const int colour = FC(i, firstCol);
+ const int firstCol = fc(cfa, i, 0) & 1;
+ const int colour = fc(cfa, i, firstCol);
const array2D* nonGreen = colour == 0 ? redFactor : blueFactor;
for (int j = firstCol; j < W - 2 * cb; j += 2) {
rawData[i + cb][j + cb] *= (*nonGreen)[i / 2][j / 2];
diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt
index 40ddaefbb..07b0d9f84 100644
--- a/rtengine/CMakeLists.txt
+++ b/rtengine/CMakeLists.txt
@@ -33,6 +33,7 @@ set(RTENGINESOURCEFILES
ahd_demosaic_RT.cc
amaze_demosaic_RT.cc
badpixels.cc
+ boxblur.cc
CA_correct_RT.cc
calc_distort.cc
camconst.cc
@@ -111,6 +112,7 @@ set(RTENGINESOURCEFILES
processingjob.cc
procparams.cc
profilestore.cc
+ rawflatfield.cc
rawimage.cc
rawimagesource.cc
rcd_demosaic.cc
@@ -120,7 +122,6 @@ set(RTENGINESOURCEFILES
rtthumbnail.cc
shmap.cc
simpleprocess.cc
- slicer.cc
stdimagesource.cc
tmo_fattal02.cc
utils.cc
diff --git a/rtengine/EdgePreservingDecomposition.cc b/rtengine/EdgePreservingDecomposition.cc
index 85b7ce243..700181e1d 100644
--- a/rtengine/EdgePreservingDecomposition.cc
+++ b/rtengine/EdgePreservingDecomposition.cc
@@ -4,8 +4,7 @@
#ifdef _OPENMP
#include
#endif
-#include "sleef.c"
-#include "opthelper.h"
+#include "sleef.h"
#define DIAGONALS 5
#define DIAGONALSP1 6
diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc
index d1e659114..ea0565b21 100644
--- a/rtengine/FTblockDN.cc
+++ b/rtengine/FTblockDN.cc
@@ -23,25 +23,34 @@
////////////////////////////////////////////////////////////////
#include
+
#include
-#include "../rtgui/threadutils.h"
-#include "rtengine.h"
-#include "improcfun.h"
-#include "LUT.h"
+
#include "array2D.h"
-#include "iccmatrices.h"
#include "boxblur.h"
-#include "rt_math.h"
-#include "mytime.h"
-#include "sleef.c"
-#include "opthelper.h"
#include "cplx_wavelet_dec.h"
-#include "median.h"
+#include "color.h"
+#include "curves.h"
+#include "iccmatrices.h"
#include "iccstore.h"
+#include "imagefloat.h"
+#include "improcfun.h"
+#include "labimage.h"
+#include "LUT.h"
+#include "median.h"
+#include "mytime.h"
+#include "opthelper.h"
#include "procparams.h"
+#include "rt_math.h"
+#include "sleef.h"
+
+#include "../rtgui/threadutils.h"
+#include "../rtgui/options.h"
+
#ifdef _OPENMP
#include
#endif
+
//#define BENCHMARK
#include "StopWatch.h"
@@ -69,11 +78,7 @@ namespace rtengine
*/
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-extern const Settings* settings;
extern MyMutex *fftwMutex;
@@ -479,6 +484,7 @@ enum nrquality {QUALITY_STANDARD, QUALITY_HIGH};
void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &nresi, float &highresi)
{
BENCHFUN
+
//#ifdef _DEBUG
MyTime t1e, t2e;
t1e.set();
@@ -687,8 +693,8 @@ BENCHFUN
}
}
- int tilesize;
- int overlap;
+ int tilesize = 0;
+ int overlap = 0;
if (settings->leveldnti == 0) {
tilesize = 1024;
@@ -1341,8 +1347,6 @@ BENCHFUN
#ifdef _OPENMP
int masterThread = omp_get_thread_num();
-#endif
-#ifdef _OPENMP
#pragma omp parallel num_threads(denoiseNestedLevels) if (denoiseNestedLevels>1)
#endif
{
@@ -1351,11 +1355,9 @@ BENCHFUN
#else
int subThread = 0;
#endif
- float blurbuffer[TS * TS] ALIGNED64;
float *Lblox = LbloxArray[subThread];
float *fLblox = fLbloxArray[subThread];
float pBuf[width + TS + 2 * blkrad * offset] ALIGNED16;
- float nbrwt[TS * TS] ALIGNED64;
#ifdef _OPENMP
#pragma omp for
#endif
@@ -1430,7 +1432,7 @@ BENCHFUN
for (int hblk = 0; hblk < numblox_W; ++hblk) {
- RGBtile_denoise(fLblox, hblk, noisevar_Ldetail, nbrwt, blurbuffer);
+ RGBtile_denoise(fLblox, hblk, noisevar_Ldetail);
}//end of horizontal block loop
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1447,14 +1449,8 @@ BENCHFUN
//add row of blocks to output image tile
RGBoutput_tile_row(Lblox, Ldetail, tilemask_out, height, width, topproc);
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
}//end of vertical block loop
-
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
}
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#ifdef _OPENMP
#pragma omp parallel for num_threads(denoiseNestedLevels) if (denoiseNestedLevels>1)
@@ -2041,26 +2037,20 @@ BENCHFUN
}//end of main RGB_denoise
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-void ImProcFunctions::RGBtile_denoise(float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer) //for DCT
+void ImProcFunctions::RGBtile_denoise(float* fLblox, int hblproc, float noisevar_Ldetail) //for DCT
{
- int blkstart = hblproc * TS * TS;
+ float nbrwt[TS * TS] ALIGNED64;
+ const int blkstart = hblproc * TS * TS;
- boxabsblur(fLblox + blkstart, nbrwt, 3, 3, TS, TS, blurbuffer); //blur neighbor weights for more robust estimation //for DCT
+ boxabsblur(fLblox + blkstart, nbrwt, 3, TS, TS, false); //blur neighbor weights for more robust estimation //for DCT
#ifdef __SSE2__
- __m128 tempv;
- __m128 noisevar_Ldetailv = _mm_set1_ps(noisevar_Ldetail);
- __m128 onev = _mm_set1_ps(1.0f);
+ const vfloat noisevar_Ldetailv = F2V(-1.f / noisevar_Ldetail);
+ const vfloat onev = F2V(1.f);
for (int n = 0; n < TS * TS; n += 4) { //for DCT
- tempv = onev - xexpf(-SQRV(LVF(nbrwt[n])) / noisevar_Ldetailv);
- _mm_storeu_ps(&fLblox[blkstart + n], LVFU(fLblox[blkstart + n]) * tempv);
+ const vfloat tempv = onev - xexpf(SQRV(LVF(nbrwt[n])) * noisevar_Ldetailv);
+ STVF(fLblox[blkstart + n], LVF(fLblox[blkstart + n]) * tempv);
}//output neighbor averaged result
#else
@@ -2071,14 +2061,7 @@ void ImProcFunctions::RGBtile_denoise(float * fLblox, int hblproc, float noiseva
#endif
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- //printf("vblk=%d hlk=%d wsqave=%f || ",vblproc,hblproc,wsqave);
-
-}//end of function tile_denoise
-
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+}
void ImProcFunctions::RGBoutput_tile_row(float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top)
{
@@ -2207,7 +2190,7 @@ void ImProcFunctions::Noise_residualAB(const wavelet_decomposition &WaveletCoeff
chmaxresid = maxresid;
}
-bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3])
+bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(const wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3])
{
int maxlvl = min(WaveletCoeffs_L.maxlevel(), 5);
const float eps = 0.01f;
@@ -2258,23 +2241,22 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(wavelet_decomposition &Wavelet
//simple wavelet shrinkage
float * sfave = buffer[0] + 32;
float * sfaved = buffer[2] + 96;
- float * blurBuffer = buffer[1] + 64;
float mad_Lr = madL[lvl][dir - 1];
float levelFactor = mad_Lr * 5.f / (lvl + 1);
#ifdef __SSE2__
- __m128 mad_Lv;
- __m128 ninev = _mm_set1_ps(9.0f);
- __m128 epsv = _mm_set1_ps(eps);
- __m128 mag_Lv;
- __m128 levelFactorv = _mm_set1_ps(levelFactor);
+ vfloat mad_Lv;
+ vfloat ninev = F2V(9.0f);
+ vfloat epsv = F2V(eps);
+ vfloat mag_Lv;
+ vfloat levelFactorv = F2V(levelFactor);
int coeffloc_L;
for (coeffloc_L = 0; coeffloc_L < Hlvl_L * Wlvl_L - 3; coeffloc_L += 4) {
mad_Lv = LVFU(noisevarlum[coeffloc_L]) * levelFactorv;
mag_Lv = SQRV(LVFU(WavCoeffs_L[dir][coeffloc_L]));
- _mm_storeu_ps(&sfave[coeffloc_L], mag_Lv / (mag_Lv + mad_Lv * xexpf(-mag_Lv / (mad_Lv * ninev)) + epsv));
+ STVFU(sfave[coeffloc_L], mag_Lv / (mag_Lv + mad_Lv * xexpf(-mag_Lv / (mad_Lv * ninev)) + epsv));
}
for (; coeffloc_L < Hlvl_L * Wlvl_L; ++coeffloc_L) {
@@ -2294,15 +2276,15 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(wavelet_decomposition &Wavelet
}
#endif
- boxblur(sfave, sfaved, blurBuffer, lvl + 2, lvl + 2, Wlvl_L, Hlvl_L); //increase smoothness by locally averaging shrinkage
+ boxblur(sfave, sfaved, lvl + 2, Wlvl_L, Hlvl_L, false); //increase smoothness by locally averaging shrinkage
#ifdef __SSE2__
- __m128 sfavev;
- __m128 sf_Lv;
+ vfloat sfavev;
+ vfloat sf_Lv;
for (coeffloc_L = 0; coeffloc_L < Hlvl_L * Wlvl_L - 3; coeffloc_L += 4) {
sfavev = LVFU(sfaved[coeffloc_L]);
sf_Lv = LVFU(sfave[coeffloc_L]);
- _mm_storeu_ps(&WavCoeffs_L[dir][coeffloc_L], LVFU(WavCoeffs_L[dir][coeffloc_L]) * (SQRV(sfavev) + SQRV(sf_Lv)) / (sfavev + sf_Lv + epsv));
+ STVFU(WavCoeffs_L[dir][coeffloc_L], LVFU(WavCoeffs_L[dir][coeffloc_L]) * (SQRV(sfavev) + SQRV(sf_Lv)) / (sfavev + sf_Lv + epsv));
//use smoothed shrinkage unless local shrinkage is much less
}
@@ -2340,7 +2322,7 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkL(wavelet_decomposition &Wavelet
return (!memoryAllocationFailed);
}
-bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab,
+bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(const wavelet_decomposition &WaveletCoeffs_L, const wavelet_decomposition &WaveletCoeffs_ab,
float *noisevarchrom, float madL[8][3], float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb)
{
int maxlvl = WaveletCoeffs_L.maxlevel();
@@ -2422,12 +2404,12 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &Wavele
if (noisevar_ab > 0.001f) {
#ifdef __SSE2__
- __m128 onev = _mm_set1_ps(1.f);
- __m128 mad_abrv = _mm_set1_ps(mad_abr);
- __m128 rmad_Lm9v = onev / _mm_set1_ps(mad_Lr * 9.f);
- __m128 mad_abv;
- __m128 mag_Lv, mag_abv;
- __m128 tempabv;
+ vfloat onev = F2V(1.f);
+ vfloat mad_abrv = F2V(mad_abr);
+ vfloat rmad_Lm9v = onev / F2V(mad_Lr * 9.f);
+ vfloat mad_abv;
+ vfloat mag_Lv, mag_abv;
+ vfloat tempabv;
int coeffloc_ab;
for (coeffloc_ab = 0; coeffloc_ab < Hlvl_ab * Wlvl_ab - 3; coeffloc_ab += 4) {
@@ -2437,7 +2419,7 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &Wavele
mag_Lv = LVFU(WavCoeffs_L[dir][coeffloc_ab]);
mag_abv = SQRV(tempabv);
mag_Lv = SQRV(mag_Lv) * rmad_Lm9v;
- _mm_storeu_ps(&WavCoeffs_ab[dir][coeffloc_ab], tempabv * SQRV((onev - xexpf(-(mag_abv / mad_abv) - (mag_Lv)))));
+ STVFU(WavCoeffs_ab[dir][coeffloc_ab], tempabv * SQRV((onev - xexpf(-(mag_abv / mad_abv) - (mag_Lv)))));
}
// few remaining pixels
@@ -2470,9 +2452,7 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &Wavele
}
for (int i = 2; i >= 0; i--) {
- if (buffer[i] != nullptr) {
- delete[] buffer[i];
- }
+ delete[] buffer[i];
}
}
@@ -2480,7 +2460,7 @@ bool ImProcFunctions::WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &Wavele
}
-bool ImProcFunctions::WaveletDenoiseAllL(wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge)//mod JD
+bool ImProcFunctions::WaveletDenoiseAllL(const wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge)//mod JD
{
@@ -2530,16 +2510,14 @@ bool ImProcFunctions::WaveletDenoiseAllL(wavelet_decomposition &WaveletCoeffs_L,
}
for (int i = 3; i >= 0; i--) {
- if (buffer[i] != nullptr) {
- delete[] buffer[i];
- }
+ delete[] buffer[i];
}
}
return (!memoryAllocationFailed);
}
-bool ImProcFunctions::WaveletDenoiseAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab,
+bool ImProcFunctions::WaveletDenoiseAllAB(const wavelet_decomposition &WaveletCoeffs_L, const wavelet_decomposition &WaveletCoeffs_ab,
float *noisevarchrom, float madL[8][3], float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb)//mod JD
{
@@ -2596,7 +2574,7 @@ bool ImProcFunctions::WaveletDenoiseAllAB(wavelet_decomposition &WaveletCoeffs_L
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void ImProcFunctions::ShrinkAllL(wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir,
+void ImProcFunctions::ShrinkAllL(const wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir,
float *noisevarlum, float * madL, float * vari, int edge)
{
@@ -2607,12 +2585,12 @@ void ImProcFunctions::ShrinkAllL(wavelet_decomposition &WaveletCoeffs_L, float *
float * sfaved = buffer[1] + 64;
float * blurBuffer = buffer[2] + 96;
- int W_L = WaveletCoeffs_L.level_W(level);
- int H_L = WaveletCoeffs_L.level_H(level);
+ const int W_L = WaveletCoeffs_L.level_W(level);
+ const int H_L = WaveletCoeffs_L.level_H(level);
float ** WavCoeffs_L = WaveletCoeffs_L.level_coeffs(level);
-// printf("OK lev=%d\n",level);
- float mad_L = madL[dir - 1] ;
+ const float mad_L = madL[dir - 1] ;
+ const float levelFactor = mad_L * 5.f / static_cast(level + 1);
if (edge == 1 && vari) {
noisevarlum = blurBuffer; // we need one buffer, but fortunately we don't have to allocate a new one because we can use blurBuffer
@@ -2622,71 +2600,45 @@ void ImProcFunctions::ShrinkAllL(wavelet_decomposition &WaveletCoeffs_L, float *
}
}
- float levelFactor = mad_L * 5.f / static_cast(level + 1);
+ int i = 0;
#ifdef __SSE2__
- __m128 magv;
- __m128 levelFactorv = _mm_set1_ps(levelFactor);
- __m128 mad_Lv;
- __m128 ninev = _mm_set1_ps(9.0f);
- __m128 epsv = _mm_set1_ps(eps);
- int i;
+ const vfloat levelFactorv = F2V(levelFactor);
+ const vfloat ninev = F2V(9.f);
+ const vfloat epsv = F2V(eps);
- for (i = 0; i < W_L * H_L - 3; i += 4) {
- mad_Lv = LVFU(noisevarlum[i]) * levelFactorv;
- magv = SQRV(LVFU(WavCoeffs_L[dir][i]));
- _mm_storeu_ps(&sfave[i], magv / (magv + mad_Lv * xexpf(-magv / (ninev * mad_Lv)) + epsv));
+ for (; i < W_L * H_L - 3; i += 4) {
+ const vfloat mad_Lv = LVFU(noisevarlum[i]) * levelFactorv;
+ const vfloat magv = SQRV(LVFU(WavCoeffs_L[dir][i]));
+ STVFU(sfave[i], magv / (magv + mad_Lv * xexpf(-magv / (ninev * mad_Lv)) + epsv));
}
-
+#endif
// few remaining pixels
for (; i < W_L * H_L; ++i) {
- float mag = SQR(WavCoeffs_L[dir][i]);
+ const float mag = SQR(WavCoeffs_L[dir][i]);
sfave[i] = mag / (mag + levelFactor * noisevarlum[i] * xexpf(-mag / (9 * levelFactor * noisevarlum[i])) + eps);
}
-#else
-
- for (int i = 0; i < W_L * H_L; ++i) {
-
- float mag = SQR(WavCoeffs_L[dir][i]);
- float shrinkfactor = mag / (mag + levelFactor * noisevarlum[i] * xexpf(-mag / (9 * levelFactor * noisevarlum[i])) + eps);
- sfave[i] = shrinkfactor;
- }
-
-#endif
- boxblur(sfave, sfaved, blurBuffer, level + 2, level + 2, W_L, H_L); //increase smoothness by locally averaging shrinkage
+ boxblur(sfave, sfaved, level + 2, W_L, H_L, false); //increase smoothness by locally averaging shrinkage
+ i = 0;
#ifdef __SSE2__
- __m128 sfv;
- for (i = 0; i < W_L * H_L - 3; i += 4) {
- sfv = LVFU(sfave[i]);
+ for (; i < W_L * H_L - 3; i += 4) {
+ const vfloat sfv = LVFU(sfave[i]);
//use smoothed shrinkage unless local shrinkage is much less
- _mm_storeu_ps(&WavCoeffs_L[dir][i], _mm_loadu_ps(&WavCoeffs_L[dir][i]) * (SQRV(LVFU(sfaved[i])) + SQRV(sfv)) / (LVFU(sfaved[i]) + sfv + epsv));
+ STVFU(WavCoeffs_L[dir][i], LVFU(WavCoeffs_L[dir][i]) * (SQRV(LVFU(sfaved[i])) + SQRV(sfv)) / (LVFU(sfaved[i]) + sfv + epsv));
}
-
+#endif
// few remaining pixels
for (; i < W_L * H_L; ++i) {
- float sf = sfave[i];
-
+ const float sf = sfave[i];
//use smoothed shrinkage unless local shrinkage is much less
WavCoeffs_L[dir][i] *= (SQR(sfaved[i]) + SQR(sf)) / (sfaved[i] + sf + eps);
}//now luminance coefficients are denoised
-
-#else
-
- for (int i = 0; i < W_L * H_L; ++i) {
- float sf = sfave[i];
-
- //use smoothed shrinkage unless local shrinkage is much less
- WavCoeffs_L[dir][i] *= (SQR(sfaved[i]) + SQR(sf)) / (sfaved[i] + sf + eps);
-
- }//now luminance coefficients are denoised
-
-#endif
}
-void ImProcFunctions::ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir,
+void ImProcFunctions::ShrinkAllAB(const wavelet_decomposition &WaveletCoeffs_L, const wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir,
float *noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch,
bool denoiseMethodRgb, float * madL, float * madaab, bool madCalculated)
@@ -2700,7 +2652,6 @@ void ImProcFunctions::ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavele
float * sfaveab = buffer[0] + 32;
float * sfaveabd = buffer[1] + 64;
- float * blurBuffer = buffer[2] + 96;
int W_ab = WaveletCoeffs_ab.level_W(level);
int H_ab = WaveletCoeffs_ab.level_H(level);
@@ -2724,12 +2675,12 @@ void ImProcFunctions::ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavele
if (noisevar_ab > 0.001f) {
madab = useNoiseCCurve ? madab : madab * noisevar_ab;
#ifdef __SSE2__
- __m128 onev = _mm_set1_ps(1.f);
- __m128 mad_abrv = _mm_set1_ps(madab);
+ vfloat onev = F2V(1.f);
+ vfloat mad_abrv = F2V(madab);
- __m128 rmadLm9v = onev / _mm_set1_ps(mad_L * 9.f);
- __m128 mad_abv ;
- __m128 mag_Lv, mag_abv;
+ vfloat rmadLm9v = onev / F2V(mad_L * 9.f);
+ vfloat mad_abv ;
+ vfloat mag_Lv, mag_abv;
int coeffloc_ab;
for (coeffloc_ab = 0; coeffloc_ab < H_ab * W_ab - 3; coeffloc_ab += 4) {
@@ -2738,7 +2689,7 @@ void ImProcFunctions::ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavele
mag_Lv = LVFU(WavCoeffs_L[dir][coeffloc_ab]);
mag_abv = SQRV(LVFU(WavCoeffs_ab[dir][coeffloc_ab]));
mag_Lv = (SQRV(mag_Lv)) * rmadLm9v;
- _mm_storeu_ps(&sfaveab[coeffloc_ab], (onev - xexpf(-(mag_abv / mad_abv) - (mag_Lv))));
+ STVFU(sfaveab[coeffloc_ab], (onev - xexpf(-(mag_abv / mad_abv) - (mag_Lv))));
}
// few remaining pixels
@@ -2761,18 +2712,18 @@ void ImProcFunctions::ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavele
#endif
- boxblur(sfaveab, sfaveabd, blurBuffer, level + 2, level + 2, W_ab, H_ab); //increase smoothness by locally averaging shrinkage
+ boxblur(sfaveab, sfaveabd, level + 2, W_ab, H_ab, false); //increase smoothness by locally averaging shrinkage
#ifdef __SSE2__
- __m128 epsv = _mm_set1_ps(eps);
- __m128 sfabv;
- __m128 sfaveabv;
+ vfloat epsv = F2V(eps);
+ vfloat sfabv;
+ vfloat sfaveabv;
for (coeffloc_ab = 0; coeffloc_ab < H_ab * W_ab - 3; coeffloc_ab += 4) {
sfabv = LVFU(sfaveab[coeffloc_ab]);
sfaveabv = LVFU(sfaveabd[coeffloc_ab]);
//use smoothed shrinkage unless local shrinkage is much less
- _mm_storeu_ps(&WavCoeffs_ab[dir][coeffloc_ab], LVFU(WavCoeffs_ab[dir][coeffloc_ab]) * (SQRV(sfaveabv) + SQRV(sfabv)) / (sfaveabv + sfabv + epsv));
+ STVFU(WavCoeffs_ab[dir][coeffloc_ab], LVFU(WavCoeffs_ab[dir][coeffloc_ab]) * (SQRV(sfaveabv) + SQRV(sfabv)) / (sfaveabv + sfabv + epsv));
}
// few remaining pixels
@@ -2919,8 +2870,8 @@ void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_a, float ** WavCoeffs_b,
}
-void ImProcFunctions::WaveletDenoiseAll_info(int levwav, wavelet_decomposition &WaveletCoeffs_a,
- wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice,
+void ImProcFunctions::WaveletDenoiseAll_info(int levwav, const wavelet_decomposition &WaveletCoeffs_a,
+ const wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice,
float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb)
{
@@ -3106,7 +3057,7 @@ void ImProcFunctions::calcautodn_info(float &chaut, float &delta, int Nb, int le
}
-void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc, const bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, bool multiThread)
+void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc, const bool isRAW, const LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, bool multiThread)
{
if ((settings->leveldnautsimpl == 1 && dnparams.Cmethod == "MAN") || (settings->leveldnautsimpl == 0 && dnparams.C2method == "MANU")) {
//nothing to do
@@ -3173,8 +3124,8 @@ void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc,
const float gain = pow(2.0f, float(expcomp));
- int tilesize;
- int overlap;
+ int tilesize = 0;
+ int overlap = 0;
if (settings->leveldnti == 0) {
tilesize = 1024;
@@ -3275,16 +3226,16 @@ void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc,
for (int i = tiletop; i < tilebottom; i += 2) {
int i1 = i - tiletop;
#ifdef __SSE2__
- __m128 aNv, bNv;
- __m128 c100v = _mm_set1_ps(100.f);
+ vfloat aNv, bNv;
+ vfloat c100v = F2V(100.f);
int j;
for (j = tileleft; j < tileright - 7; j += 8) {
int j1 = j - tileleft;
aNv = LVFU(acalc[i >> 1][j >> 1]);
bNv = LVFU(bcalc[i >> 1][j >> 1]);
- _mm_storeu_ps(&noisevarhue[i1 >> 1][j1 >> 1], xatan2f(bNv, aNv));
- _mm_storeu_ps(&noisevarchrom[i1 >> 1][j1 >> 1], vmaxf(vsqrtf(SQRV(aNv) + SQRV(bNv)),c100v));
+ STVFU(noisevarhue[i1 >> 1][j1 >> 1], xatan2f(bNv, aNv));
+ STVFU(noisevarchrom[i1 >> 1][j1 >> 1], vmaxf(vsqrtf(SQRV(aNv) + SQRV(bNv)),c100v));
}
for (; j < tileright; j += 2) {
diff --git a/rtengine/LUT.h b/rtengine/LUT.h
index 34f572f58..a80e5996d 100644
--- a/rtengine/LUT.h
+++ b/rtengine/LUT.h
@@ -56,21 +56,18 @@
* LUTuc stands for LUT
*/
-#ifndef LUT_H_
-#define LUT_H_
+#pragma once
#include
#include
#include
#ifndef NDEBUG
-#include
#include
#endif
#include "opthelper.h"
#include "rt_math.h"
-#include "noncopyable.h"
// Bit representations of flags
enum {
@@ -485,26 +482,6 @@ public:
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 < size; iter++) {
- f << iter << ", " << data[iter] << ", 0." << std::endl;
- }
-
- f << "$" << std::endl;
- f.close ();
- }
- }
-#endif
-
-
operator bool (void) const
{
return size > 0;
@@ -649,5 +626,3 @@ public:
};
-
-#endif /* LUT_H_ */
diff --git a/rtengine/PF_correct_RT.cc b/rtengine/PF_correct_RT.cc
index 7df042663..9a95b8e2f 100644
--- a/rtengine/PF_correct_RT.cc
+++ b/rtengine/PF_correct_RT.cc
@@ -29,8 +29,12 @@
#include "gauss.h"
#include "improcfun.h"
-#include "sleef.c"
-#include "../rtgui/myflatcurve.h"
+#include "cieimage.h"
+#include "color.h"
+#include "curves.h"
+#include "labimage.h"
+#include "sleef.h"
+#include "curves.h"
#include "rt_math.h"
#include "opthelper.h"
#include "median.h"
diff --git a/rtengine/ahd_demosaic_RT.cc b/rtengine/ahd_demosaic_RT.cc
index b3a34295c..064dfd6e1 100644
--- a/rtengine/ahd_demosaic_RT.cc
+++ b/rtengine/ahd_demosaic_RT.cc
@@ -27,12 +27,17 @@
#include "rtengine.h"
#include "rawimagesource.h"
#include "rt_math.h"
-#include "procparams.h"
#include "../rtgui/multilangmgr.h"
#include "median.h"
//#define BENCHMARK
#include "StopWatch.h"
+namespace
+{
+unsigned fc(const unsigned int cfa[2][2], int r, int c) {
+ return cfa[r & 1][c & 1];
+}
+}
namespace rtengine
{
#define TS 144
@@ -40,6 +45,7 @@ void RawImageSource::ahd_demosaic()
{
BENCHFUN
+ const unsigned int cfa[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}};
constexpr int dirs[4] = { -1, 1, -TS, TS };
float xyz_cam[3][3];
LUTf cbrt(65536);
@@ -74,7 +80,7 @@ void RawImageSource::ahd_demosaic()
}
}
}
- border_interpolate2(W, H, 5, rawData, red, green, blue);
+ border_interpolate(W, H, 5, rawData, red, green, blue);
#ifdef _OPENMP
@@ -94,7 +100,7 @@ void RawImageSource::ahd_demosaic()
for (int left = 2; left < width - 5; left += TS - 6) {
// Interpolate green horizontally and vertically:
for (int row = top; row < top + TS && row < height - 2; row++) {
- for (int col = left + (FC(row, left) & 1); col < std::min(left + TS, width - 2); col += 2) {
+ for (int col = left + (fc(cfa, row, left) & 1); col < std::min(left + TS, width - 2); col += 2) {
auto pix = &rawData[row][col];
float val0 = 0.25f * ((pix[-1] + pix[0] + pix[1]) * 2
- pix[-2] - pix[2]) ;
@@ -108,12 +114,12 @@ void RawImageSource::ahd_demosaic()
// Interpolate red and blue, and convert to CIELab:
for (int d = 0; d < 2; d++)
for (int row = top + 1; row < top + TS - 1 && row < height - 3; row++) {
- int cng = FC(row + 1, FC(row + 1, 0) & 1);
+ int cng = fc(cfa, row + 1, fc(cfa, row + 1, 0) & 1);
for (int col = left + 1; col < std::min(left + TS - 1, width - 3); col++) {
auto pix = &rawData[row][col];
auto rix = &rgb[d][row - top][col - left];
auto lix = lab[d][row - top][col - left];
- if (FC(row, col) == 1) {
+ if (fc(cfa, row, col) == 1) {
rix[0][2 - cng] = CLIP(pix[0] + (0.5f * (pix[-1] + pix[1]
- rix[-1][1] - rix[1][1] ) ));
rix[0][cng] = CLIP(pix[0] + (0.5f * (pix[-width] + pix[width]
diff --git a/rtengine/alignedbuffer.h b/rtengine/alignedbuffer.h
index b2c720bd8..05a965766 100644
--- a/rtengine/alignedbuffer.h
+++ b/rtengine/alignedbuffer.h
@@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see .
*/
-#ifndef _ALIGNEDBUFFER_
-#define _ALIGNEDBUFFER_
+#pragma once
#include
#include
@@ -142,5 +141,3 @@ public:
return unitSize ? allocatedSize / unitSize : 0;
}
};
-
-#endif
diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc
index 43aef0f71..24c463458 100644
--- a/rtengine/amaze_demosaic_RT.cc
+++ b/rtengine/amaze_demosaic_RT.cc
@@ -30,12 +30,18 @@
#include "rawimagesource.h"
#include "rt_math.h"
#include "../rtgui/multilangmgr.h"
-#include "sleef.c"
+#include "sleef.h"
#include "opthelper.h"
#include "median.h"
-#include "procparams.h"
#include "StopWatch.h"
+namespace
+{
+unsigned fc(const unsigned int cfa[2][2], int r, int c) {
+ return cfa[r & 1][c & 1];
+}
+}
+
namespace rtengine
{
@@ -56,6 +62,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
plistener->setProgress(progress);
}
+ const unsigned int cfarray[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}};
const int width = winw, height = winh;
const float clip_pt = 1.0 / initialGain;
const float clip_pt8 = 0.8 / initialGain;
@@ -74,8 +81,8 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
int ex, ey;
//determine GRBG coset; (ey,ex) is the offset of the R subarray
- if (FC(0, 0) == 1) { //first pixel is G
- if (FC(0, 1) == 0) {
+ if (fc(cfarray, 0, 0) == 1) { //first pixel is G
+ if (fc(cfarray, 0, 1) == 0) {
ey = 0;
ex = 1;
} else {
@@ -83,7 +90,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
ex = 0;
}
} else {//first pixel is R or B
- if (FC(0, 0) == 0) {
+ if (fc(cfarray, 0, 0) == 0) {
ey = 0;
ex = 0;
} else {
@@ -373,7 +380,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#ifdef __SSE2__
vfloat sgnv;
- if( !(FC(4, 4) & 1) ) {
+ if( !(fc(cfarray, 4, 4) & 1) ) {
sgnv = _mm_set_ps( 1.f, -1.f, 1.f, -1.f );
} else {
sgnv = _mm_set_ps( -1.f, 1.f, -1.f, 1.f );
@@ -440,7 +447,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
for (int rr = 4; rr < rr1 - 4; rr++) {
- bool fcswitch = FC(rr, 4) & 1;
+ bool fcswitch = fc(cfarray, rr, 4) & 1;
for (int cc = 4, indx = rr * ts + cc; cc < cc1 - 4; cc++, indx++) {
@@ -532,7 +539,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
vfloat clip_ptv = F2V( clip_pt );
vfloat sgn3v;
- if( !(FC(4, 4) & 1) ) {
+ if( !(fc(cfarray, 4, 4) & 1) ) {
sgnv = _mm_set_ps( 1.f, -1.f, 1.f, -1.f );
} else {
sgnv = _mm_set_ps( -1.f, 1.f, -1.f, 1.f );
@@ -590,7 +597,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
for (int rr = 4; rr < rr1 - 4; rr++) {
- for (int cc = 4, indx = rr * ts + cc, c = FC(rr, cc) & 1; cc < cc1 - 4; cc++, indx++) {
+ for (int cc = 4, indx = rr * ts + cc, c = fc(cfarray, rr, cc) & 1; cc < cc1 - 4; cc++, indx++) {
float hcdvar = 3.f * (SQR(hcd[indx - 2]) + SQR(hcd[indx]) + SQR(hcd[indx + 2])) - SQR(hcd[indx - 2] + hcd[indx] + hcd[indx + 2]);
float hcdaltvar = 3.f * (SQR(hcdalt[indx - 2]) + SQR(hcdalt[indx]) + SQR(hcdalt[indx + 2])) - SQR(hcdalt[indx - 2] + hcdalt[indx] + hcdalt[indx + 2]);
float vcdvar = 3.f * (SQR(vcd[indx - v2]) + SQR(vcd[indx]) + SQR(vcd[indx + v2])) - SQR(vcd[indx - v2] + vcd[indx] + vcd[indx + v2]);
@@ -686,7 +693,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
vfloat epssqv = F2V( epssq );
for (int rr = 6; rr < rr1 - 6; rr++) {
- for (int indx = rr * ts + 6 + (FC(rr, 2) & 1); indx < rr * ts + cc1 - 6; indx += 8) {
+ for (int indx = rr * ts + 6 + (fc(cfarray, rr, 2) & 1); indx < rr * ts + cc1 - 6; indx += 8) {
//compute colour difference variances in cardinal directions
vfloat tempv = LC2VFU(vcd[indx]);
vfloat uavev = tempv + LC2VFU(vcd[indx - v1]) + LC2VFU(vcd[indx - v2]) + LC2VFU(vcd[indx - v3]);
@@ -732,7 +739,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
for (int rr = 6; rr < rr1 - 6; rr++) {
- for (int cc = 6 + (FC(rr, 2) & 1), indx = rr * ts + cc; cc < cc1 - 6; cc += 2, indx += 2) {
+ for (int cc = 6 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc; cc < cc1 - 6; cc += 2, indx += 2) {
//compute colour difference variances in cardinal directions
@@ -794,7 +801,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
// precompute nyquist
for (int rr = 6; rr < rr1 - 6; rr++) {
- int cc = 6 + (FC(rr, 2) & 1);
+ int cc = 6 + (fc(cfarray, rr, 2) & 1);
int indx = rr * ts + cc;
#ifdef __SSE2__
@@ -857,7 +864,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
int nyendcol = 0;
for (int rr = 6; rr < rr1 - 6; rr++) {
- for (int cc = 6 + (FC(rr, 2) & 1), indx = rr * ts + cc; cc < cc1 - 6; cc += 2, indx += 2) {
+ for (int cc = 6 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc; cc < cc1 - 6; cc += 2, indx += 2) {
//nyquist texture test: ask if difference of vcd compared to hcd is larger or smaller than RGGB gradients
if(nyqutest[indx >> 1] > 0.f) {
@@ -908,7 +915,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
- for (int indx = rr * ts + nystartcol + (FC(rr, 2) & 1); indx < rr * ts + nyendcol; indx += 2) {
+ for (int indx = rr * ts + nystartcol + (fc(cfarray, rr, 2) & 1); indx < rr * ts + nyendcol; indx += 2) {
unsigned int nyquisttemp = (nyquist[(indx - v2) >> 1] + nyquist[(indx - m1) >> 1] + nyquist[(indx + p1) >> 1] +
nyquist[(indx - 2) >> 1] + nyquist[(indx + 2) >> 1] +
nyquist[(indx - p1) >> 1] + nyquist[(indx + m1) >> 1] + nyquist[(indx + v2) >> 1]);
@@ -923,7 +930,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
// in areas of Nyquist texture, do area interpolation
for (int rr = nystartrow; rr < nyendrow; rr++)
- for (int indx = rr * ts + nystartcol + (FC(rr, 2) & 1); indx < rr * ts + nyendcol; indx += 2) {
+ for (int indx = rr * ts + nystartcol + (fc(cfarray, rr, 2) & 1); indx < rr * ts + nyendcol; indx += 2) {
if (nyquist2[indx >> 1]) {
// area interpolation
@@ -963,7 +970,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
//populate G at R/B sites
for (int rr = 8; rr < rr1 - 8; rr++)
- for (int indx = rr * ts + 8 + (FC(rr, 2) & 1); indx < rr * ts + cc1 - 8; indx += 2) {
+ for (int indx = rr * ts + 8 + (fc(cfarray, rr, 2) & 1); indx < rr * ts + cc1 - 8; indx += 2) {
//first ask if one gets more directional discrimination from nearby B/R sites
float hvwtalt = xdivf(hvwt[(indx - m1) >> 1] + hvwt[(indx + p1) >> 1] + hvwt[(indx - p1) >> 1] + hvwt[(indx + m1) >> 1], 2);
@@ -986,7 +993,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
// refine Nyquist areas using G curvatures
if(doNyquist) {
for (int rr = nystartrow; rr < nyendrow; rr++)
- for (int indx = rr * ts + nystartcol + (FC(rr, 2) & 1); indx < rr * ts + nyendcol; indx += 2) {
+ for (int indx = rr * ts + nystartcol + (fc(cfarray, rr, 2) & 1); indx < rr * ts + nyendcol; indx += 2) {
if (nyquist2[indx >> 1]) {
//local averages (over Nyquist pixels only) of G curvature squared
@@ -1009,7 +1016,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#ifdef __SSE2__
for (int rr = 6; rr < rr1 - 6; rr++) {
- if((FC(rr, 2) & 1) == 0) {
+ if((fc(cfarray, rr, 2) & 1) == 0) {
for (int cc = 6, indx = rr * ts + cc; cc < cc1 - 6; cc += 8, indx += 8) {
vfloat tempv = LC2VFU(cfa[indx + 1]);
vfloat Dgrbsq1pv = (SQRV(tempv - LC2VFU(cfa[indx + 1 - p1])) + SQRV(tempv - LC2VFU(cfa[indx + 1 + p1])));
@@ -1035,7 +1042,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
for (int rr = 6; rr < rr1 - 6; rr++) {
- if((FC(rr, 2) & 1) == 0) {
+ if((fc(cfarray, rr, 2) & 1) == 0) {
for (int cc = 6, indx = rr * ts + cc; cc < cc1 - 6; cc += 2, indx += 2) {
delp[indx >> 1] = fabsf(cfa[indx + p1] - cfa[indx - p1]);
delm[indx >> 1] = fabsf(cfa[indx + m1] - cfa[indx - m1]);
@@ -1064,7 +1071,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
for (int rr = 8; rr < rr1 - 8; rr++) {
#ifdef __SSE2__
- for (int indx = rr * ts + 8 + (FC(rr, 2) & 1), indx1 = indx >> 1; indx < rr * ts + cc1 - 8; indx += 8, indx1 += 4) {
+ for (int indx = rr * ts + 8 + (fc(cfarray, rr, 2) & 1), indx1 = indx >> 1; indx < rr * ts + cc1 - 8; indx += 8, indx1 += 4) {
//diagonal colour ratios
vfloat cfav = LC2VFU(cfa[indx]);
@@ -1129,7 +1136,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
- for (int cc = 8 + (FC(rr, 2) & 1), indx = rr * ts + cc, indx1 = indx >> 1; cc < cc1 - 8; cc += 2, indx += 2, indx1++) {
+ for (int cc = 8 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc, indx1 = indx >> 1; cc < cc1 - 8; cc += 2, indx += 2, indx1++) {
//diagonal colour ratios
float crse = xmul2f(cfa[indx + m1]) / (eps + cfa[indx] + (cfa[indx + m2]));
@@ -1219,7 +1226,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
for (int rr = 10; rr < rr1 - 10; rr++)
#ifdef __SSE2__
- for (int indx = rr * ts + 10 + (FC(rr, 2) & 1), indx1 = indx >> 1; indx < rr * ts + cc1 - 10; indx += 8, indx1 += 4) {
+ for (int indx = rr * ts + 10 + (fc(cfarray, rr, 2) & 1), indx1 = indx >> 1; indx < rr * ts + cc1 - 10; indx += 8, indx1 += 4) {
//first ask if one gets more directional discrimination from nearby B/R sites
vfloat pmwtaltv = zd25v * (LVFU(pmwt[(indx - m1) >> 1]) + LVFU(pmwt[(indx + p1) >> 1]) + LVFU(pmwt[(indx - p1) >> 1]) + LVFU(pmwt[(indx + m1) >> 1]));
@@ -1231,7 +1238,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
- for (int cc = 10 + (FC(rr, 2) & 1), indx = rr * ts + cc, indx1 = indx >> 1; cc < cc1 - 10; cc += 2, indx += 2, indx1++) {
+ for (int cc = 10 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc, indx1 = indx >> 1; cc < cc1 - 10; cc += 2, indx += 2, indx1++) {
//first ask if one gets more directional discrimination from nearby B/R sites
float pmwtalt = xdivf(pmwt[(indx - m1) >> 1] + pmwt[(indx + p1) >> 1] + pmwt[(indx - p1) >> 1] + pmwt[(indx + m1) >> 1], 2);
@@ -1247,7 +1254,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
for (int rr = 12; rr < rr1 - 12; rr++)
#ifdef __SSE2__
- for (int indx = rr * ts + 12 + (FC(rr, 2) & 1), indx1 = indx >> 1; indx < rr * ts + cc1 - 12; indx += 8, indx1 += 4) {
+ for (int indx = rr * ts + 12 + (fc(cfarray, rr, 2) & 1), indx1 = indx >> 1; indx < rr * ts + cc1 - 12; indx += 8, indx1 += 4) {
vmask copymask = vmaskf_ge(vabsf(zd5v - LVFU(pmwt[indx1])), vabsf(zd5v - LVFU(hvwt[indx1])));
if(_mm_movemask_ps((vfloat)copymask)) { // if for any of the 4 pixels the condition is true, do the maths for all 4 pixels and mask the unused out at the end
@@ -1302,7 +1309,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
- for (int cc = 12 + (FC(rr, 2) & 1), indx = rr * ts + cc, indx1 = indx >> 1; cc < cc1 - 12; cc += 2, indx += 2, indx1++) {
+ for (int cc = 12 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc, indx1 = indx >> 1; cc < cc1 - 12; cc += 2, indx += 2, indx1++) {
if (fabsf(0.5f - pmwt[indx >> 1]) < fabsf(0.5f - hvwt[indx >> 1]) ) {
continue;
@@ -1400,7 +1407,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
for (int rr = 14; rr < rr1 - 14; rr++)
#ifdef __SSE2__
- for (int cc = 14 + (FC(rr, 2) & 1), indx = rr * ts + cc, c = 1 - FC(rr, cc) / 2; cc < cc1 - 14; cc += 8, indx += 8) {
+ for (int cc = 14 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc, c = 1 - fc(cfarray, rr, cc) / 2; cc < cc1 - 14; cc += 8, indx += 8) {
vfloat tempv = epsv + vabsf(LVFU(Dgrb[c][(indx - m1) >> 1]) - LVFU(Dgrb[c][(indx + m1) >> 1]));
vfloat temp2v = epsv + vabsf(LVFU(Dgrb[c][(indx + p1) >> 1]) - LVFU(Dgrb[c][(indx - p1) >> 1]));
vfloat wtnwv = onev / (tempv + vabsf(LVFU(Dgrb[c][(indx - m1) >> 1]) - LVFU(Dgrb[c][(indx - m3) >> 1])) + vabsf(LVFU(Dgrb[c][(indx + m1) >> 1]) - LVFU(Dgrb[c][(indx - m3) >> 1])));
@@ -1416,7 +1423,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
- for (int cc = 14 + (FC(rr, 2) & 1), indx = rr * ts + cc, c = 1 - FC(rr, cc) / 2; cc < cc1 - 14; cc += 2, indx += 2) {
+ for (int cc = 14 + (fc(cfarray, rr, 2) & 1), indx = rr * ts + cc, c = 1 - fc(cfarray, rr, cc) / 2; cc < cc1 - 14; cc += 2, indx += 2) {
float wtnw = 1.f / (eps + fabsf(Dgrb[c][(indx - m1) >> 1] - Dgrb[c][(indx + m1) >> 1]) + fabsf(Dgrb[c][(indx - m1) >> 1] - Dgrb[c][(indx - m3) >> 1]) + fabsf(Dgrb[c][(indx + m1) >> 1] - Dgrb[c][(indx - m3) >> 1]));
float wtne = 1.f / (eps + fabsf(Dgrb[c][(indx + p1) >> 1] - Dgrb[c][(indx - p1) >> 1]) + fabsf(Dgrb[c][(indx + p1) >> 1] - Dgrb[c][(indx + p3) >> 1]) + fabsf(Dgrb[c][(indx - p1) >> 1] - Dgrb[c][(indx + p3) >> 1]));
float wtsw = 1.f / (eps + fabsf(Dgrb[c][(indx - p1) >> 1] - Dgrb[c][(indx + p1) >> 1]) + fabsf(Dgrb[c][(indx - p1) >> 1] - Dgrb[c][(indx + m3) >> 1]) + fabsf(Dgrb[c][(indx + p1) >> 1] - Dgrb[c][(indx - p3) >> 1]));
@@ -1435,7 +1442,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
vfloat twov = F2V(2.f);
vmask selmask;
- if((FC(16, 2) & 1) == 1) {
+ if((fc(cfarray, 16, 2) & 1) == 1) {
selmask = _mm_set_epi32(0xffffffff, 0, 0xffffffff, 0);
offset = 1;
} else {
@@ -1510,7 +1517,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
#else
- if((FC(rr, 2) & 1) == 1) {
+ if((fc(cfarray, rr, 2) & 1) == 1) {
for (; indx < rr * ts + cc1 - 16 - (cc1 & 1); indx++, col++) {
float temp = 1.f / (hvwt[(indx - v1) >> 1] + 2.f - hvwt[(indx + 1) >> 1] - hvwt[(indx - 1) >> 1] + hvwt[(indx + v1) >> 1]);
red[row][col] = 65535.f * (rgbgreen[indx] - ((hvwt[(indx - v1) >> 1]) * Dgrb[0][(indx - v1) >> 1] + (1.f - hvwt[(indx + 1) >> 1]) * Dgrb[0][(indx + 1) >> 1] + (1.f - hvwt[(indx - 1) >> 1]) * Dgrb[0][(indx - 1) >> 1] + (hvwt[(indx + v1) >> 1]) * Dgrb[0][(indx + v1) >> 1]) *
@@ -1592,7 +1599,7 @@ void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, c
free(buffer);
}
if(border < 4) {
- border_interpolate2(W, H, 3, rawData, red, green, blue);
+ border_interpolate(W, H, 3, rawData, red, green, blue);
}
if(plistener) {
diff --git a/rtengine/array2D.h b/rtengine/array2D.h
index 7713cd55c..208dab1aa 100644
--- a/rtengine/array2D.h
+++ b/rtengine/array2D.h
@@ -52,8 +52,8 @@
*
* !! locked arrays cannot be resized and cannot be unlocked again !!
*/
-#ifndef ARRAY2D_H_
-#define ARRAY2D_H_
+#pragma once
+
#include // for raise()
#include
@@ -249,7 +249,7 @@ public:
ar_realloc(w, h, offset);
if (flags & ARRAY2D_CLEAR_DATA) {
- memset(data + offset, 0, w * h * sizeof(T));
+ memset(data + offset, 0, static_cast(w) * h * sizeof(T));
}
}
@@ -313,4 +313,3 @@ public:
return list[index];
}
};
-#endif /* array2D_H_ */
diff --git a/rtengine/badpixels.cc b/rtengine/badpixels.cc
index 79b8187f7..2710cb28d 100644
--- a/rtengine/badpixels.cc
+++ b/rtengine/badpixels.cc
@@ -20,8 +20,16 @@
#include "array2D.h"
#include "median.h"
#include "pixelsmap.h"
+#include "rawimage.h"
#include "rawimagesource.h"
+namespace
+{
+unsigned fc(const unsigned int cfa[2][2], int r, int c) {
+ return cfa[r & 1][c & 1];
+}
+}
+
namespace rtengine
{
@@ -30,6 +38,7 @@ namespace rtengine
*/
int RawImageSource::interpolateBadPixelsBayer(const PixelsMap &bitmapBads, array2D &rawData)
{
+ const unsigned int cfarray[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}};
constexpr float eps = 1.f;
int counter = 0;
@@ -53,7 +62,7 @@ int RawImageSource::interpolateBadPixelsBayer(const PixelsMap &bitmapBads, array
float wtdsum = 0.f, norm = 0.f;
// diagonal interpolation
- if (FC(row, col) == 1) {
+ if (fc(cfarray, row, col) == 1) {
// green channel. We can use closer pixels than for red or blue channel. Distance to center pixel is sqrt(2) => weighting is 0.70710678
// For green channel following pixels will be used for interpolation. Pixel to be interpolated is in center.
// 1 means that pixel is used in this step, if itself and his counterpart are not marked bad
diff --git a/rtengine/bilateral2.h b/rtengine/bilateral2.h
index d0496810d..53e18fb20 100644
--- a/rtengine/bilateral2.h
+++ b/rtengine/bilateral2.h
@@ -16,22 +16,16 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see .
*/
-#ifndef _BILATERAL2_
-#define _BILATERAL2_
+#pragma once
+#include
#include
-#include
#include
-#include
-
-#include "rtengine.h"
-#include "rt_math.h"
-#include "mytime.h"
+#include
#include "array2D.h"
-#ifdef _OPENMP
-#include
-#endif
+#include "LUT.h"
+#include "rt_math.h"
using namespace rtengine;
@@ -573,7 +567,7 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do
// calculate histogram at the beginning of the row
rhist.clear();
- for (int x = MAX(0, row_from - r); x <= MIN(H, row_from + r); x++)
+ for (int x = std::max(0, row_from - r); x <= std::min(H, row_from + r); x++)
for (int y = 0; y < r + 1; y++) {
rhist[((int)src[x][y]) >> TRANSBIT]++;
}
@@ -584,12 +578,12 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do
// calculate histogram at the beginning of the row
if (i > r)
- for (int x = 0; x <= MIN(H, r); x++) {
+ for (int x = 0; x <= std::min(H, r); x++) {
rhist[((int)src[i - r - 1][x]) >> TRANSBIT]--;
}
if (i < H - r)
- for (int x = 0; x <= MIN(H, r); x++) {
+ for (int x = 0; x <= std::min(H, r); x++) {
rhist[((int)src[i + r][x]) >> TRANSBIT]++;
}
@@ -599,12 +593,12 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do
// subtract pixels at the left and add pixels at the right
if (j > r)
- for (int x = MAX(0, i - r); x <= MIN(i + r, H - 1); x++) {
+ for (int x = std::max(0, i - r); x <= std::min(i + r, H - 1); x++) {
hist[(int)(src[x][j - r - 1]) >> TRANSBIT]--;
}
if (j < W - r)
- for (int x = MAX(0, i - r); x <= MIN(i + r, H - 1); x++) {
+ for (int x = std::max(0, i - r); x <= std::min(i + r, H - 1); x++) {
hist[((int)src[x][j + r]) >> TRANSBIT]++;
}
@@ -643,5 +637,3 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do
}
#undef BINBIT
#undef TRANSBIT
-
-#endif
diff --git a/rtengine/boxblur.cc b/rtengine/boxblur.cc
new file mode 100644
index 000000000..491ffae14
--- /dev/null
+++ b/rtengine/boxblur.cc
@@ -0,0 +1,420 @@
+/*
+ * This file is part of RawTherapee.
+ *
+ * Copyright (C) 2010 Emil Martinec
+ * Copyright (C) 2019 Ingo Weyrich
+ *
+ * RawTherapee is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * RawTherapee is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with RawTherapee. If not, see .
+*/
+
+#include
+#include
+
+#include "boxblur.h"
+
+#include "rt_math.h"
+#include "opthelper.h"
+
+namespace rtengine
+{
+
+void boxblur(float** src, float** dst, int radius, int W, int H, bool multiThread)
+{
+ //box blur using rowbuffers and linebuffers instead of a full size buffer
+
+ if (radius == 0) {
+ if (src != dst) {
+#ifdef _OPENMP
+ #pragma omp parallel for if (multiThread)
+#endif
+
+ for (int row = 0; row < H; ++row) {
+ for (int col = 0; col < W; ++col) {
+ dst[row][col] = src[row][col];
+ }
+ }
+ }
+ return;
+ }
+
+ constexpr int numCols = 8; // process numCols columns at once for better usage of L1 cpu cache
+#ifdef _OPENMP
+ #pragma omp parallel if (multiThread)
+#endif
+ {
+ std::unique_ptr buffer(new float[numCols * (radius + 1)]);
+
+ //horizontal blur
+ float* const lineBuffer = buffer.get();
+#ifdef _OPENMP
+ #pragma omp for
+#endif
+ for (int row = 0; row < H; ++row) {
+ float len = radius + 1;
+ float tempval = src[row][0];
+ lineBuffer[0] = tempval;
+ for (int j = 1; j <= radius; j++) {
+ tempval += src[row][j];
+ }
+
+ tempval /= len;
+ dst[row][0] = tempval;
+
+ for (int col = 1; col <= radius; ++col) {
+ lineBuffer[col] = src[row][col];
+ tempval = (tempval * len + src[row][col + radius]) / (len + 1);
+ dst[row][col] = tempval;
+ ++len;
+ }
+ int pos = 0;
+ for (int col = radius + 1; col < W - radius; ++col) {
+ const float oldVal = lineBuffer[pos];
+ lineBuffer[pos] = src[row][col];
+ tempval = tempval + (src[row][col + radius] - oldVal) / len;
+ dst[row][col] = tempval;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+
+ for (int col = W - radius; col < W; ++col) {
+ tempval = (tempval * len - lineBuffer[pos]) / (len - 1);
+ dst[row][col] = tempval;
+ --len;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ }
+
+ //vertical blur
+#ifdef __SSE2__
+ vfloat (* const rowBuffer)[2] = (vfloat(*)[2]) buffer.get();
+ const vfloat leninitv = F2V(radius + 1);
+ const vfloat onev = F2V(1.f);
+ vfloat tempv, temp1v, lenv, lenp1v, lenm1v, rlenv;
+
+#ifdef _OPENMP
+ #pragma omp for nowait
+#endif
+
+ for (int col = 0; col < W - 7; col += 8) {
+ lenv = leninitv;
+ tempv = LVFU(dst[0][col]);
+ temp1v = LVFU(dst[0][col + 4]);
+ rowBuffer[0][0] = tempv;
+ rowBuffer[0][1] = temp1v;
+
+ for (int i = 1; i <= radius; ++i) {
+ tempv = tempv + LVFU(dst[i][col]);
+ temp1v = temp1v + LVFU(dst[i][col + 4]);
+ }
+
+ tempv = tempv / lenv;
+ temp1v = temp1v / lenv;
+ STVFU(dst[0][col], tempv);
+ STVFU(dst[0][col + 4], temp1v);
+
+ for (int row = 1; row <= radius; ++row) {
+ rowBuffer[row][0] = LVFU(dst[row][col]);
+ rowBuffer[row][1] = LVFU(dst[row][col + 4]);
+ lenp1v = lenv + onev;
+ tempv = (tempv * lenv + LVFU(dst[row + radius][col])) / lenp1v;
+ temp1v = (temp1v * lenv + LVFU(dst[row + radius][col + 4])) / lenp1v;
+ STVFU(dst[row][col], tempv);
+ STVFU(dst[row][col + 4], temp1v);
+ lenv = lenp1v;
+ }
+
+ rlenv = onev / lenv;
+ int pos = 0;
+ for (int row = radius + 1; row < H - radius; ++row) {
+ vfloat oldVal0 = rowBuffer[pos][0];
+ vfloat oldVal1 = rowBuffer[pos][1];
+ rowBuffer[pos][0] = LVFU(dst[row][col]);
+ rowBuffer[pos][1] = LVFU(dst[row][col + 4]);
+ tempv = tempv + (LVFU(dst[row + radius][col]) - oldVal0) * rlenv ;
+ temp1v = temp1v + (LVFU(dst[row + radius][col + 4]) - oldVal1) * rlenv ;
+ STVFU(dst[row][col], tempv);
+ STVFU(dst[row][col + 4], temp1v);
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+
+ for (int row = H - radius; row < H; ++row) {
+ lenm1v = lenv - onev;
+ tempv = (tempv * lenv - rowBuffer[pos][0]) / lenm1v;
+ temp1v = (temp1v * lenv - rowBuffer[pos][1]) / lenm1v;
+ STVFU(dst[row][col], tempv);
+ STVFU(dst[row][col + 4], temp1v);
+ lenv = lenm1v;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ }
+
+#else
+ float (* const rowBuffer)[8] = (float(*)[8]) buffer.get();
+#ifdef _OPENMP
+ #pragma omp for nowait
+#endif
+
+ for (int col = 0; col < W - numCols + 1; col += 8) {
+ float len = radius + 1;
+
+ for (int k = 0; k < numCols; ++k) {
+ rowBuffer[0][k] = dst[0][col + k];
+ }
+
+ for (int i = 1; i <= radius; ++i) {
+ for (int k = 0; k < numCols; ++k) {
+ dst[0][col + k] += dst[i][col + k];
+ }
+ }
+
+ for(int k = 0; k < numCols; ++k) {
+ dst[0][col + k] /= len;
+ }
+
+ for (int row = 1; row <= radius; ++row) {
+ for(int k = 0; k < numCols; ++k) {
+ rowBuffer[row][k] = dst[row][col + k];
+ dst[row][col + k] = (dst[row - 1][col + k] * len + dst[row + radius][col + k]) / (len + 1);
+ }
+
+ len ++;
+ }
+
+ int pos = 0;
+ for (int row = radius + 1; row < H - radius; ++row) {
+ for(int k = 0; k < numCols; ++k) {
+ float oldVal = rowBuffer[pos][k];
+ rowBuffer[pos][k] = dst[row][col + k];
+ dst[row][col + k] = dst[row - 1][col + k] + (dst[row + radius][col + k] - oldVal) / len;
+ }
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+
+ for (int row = H - radius; row < H; ++row) {
+ for(int k = 0; k < numCols; ++k) {
+ dst[row][col + k] = (dst[row - 1][col + k] * len - rowBuffer[pos][k]) / (len - 1);
+ }
+ len --;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ }
+
+#endif
+ //vertical blur, remaining columns
+#ifdef _OPENMP
+ #pragma omp single
+#endif
+ {
+ const int remaining = W % numCols;
+
+ if (remaining > 0) {
+ float (* const rowBuffer)[8] = (float(*)[8]) buffer.get();
+ const int col = W - remaining;
+
+ float len = radius + 1;
+ for(int k = 0; k < remaining; ++k) {
+ rowBuffer[0][k] = dst[0][col + k];
+ }
+ for (int row = 1; row <= radius; ++row) {
+ for(int k = 0; k < remaining; ++k) {
+ dst[0][col + k] += dst[row][col + k];
+ }
+ }
+ for(int k = 0; k < remaining; ++k) {
+ dst[0][col + k] /= len;
+ }
+ for (int row = 1; row <= radius; ++row) {
+ for(int k = 0; k < remaining; ++k) {
+ rowBuffer[row][k] = dst[row][col + k];
+ dst[row][col + k] = (dst[row - 1][col + k] * len + dst[row + radius][col + k]) / (len + 1);
+ }
+ len ++;
+ }
+ const float rlen = 1.f / len;
+ int pos = 0;
+ for (int row = radius + 1; row < H - radius; ++row) {
+ for(int k = 0; k < remaining; ++k) {
+ float oldVal = rowBuffer[pos][k];
+ rowBuffer[pos][k] = dst[row][col + k];
+ dst[row][col + k] = dst[row - 1][col + k] + (dst[row + radius][col + k] - oldVal) * rlen;
+ }
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ for (int row = H - radius; row < H; ++row) {
+ for(int k = 0; k < remaining; ++k) {
+ dst[row][col + k] = (dst[(row - 1)][col + k] * len - rowBuffer[pos][k]) / (len - 1);
+ }
+ len --;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ }
+ }
+ }
+}
+
+void boxabsblur(float** src, float** dst, int radius, int W, int H, bool multiThread)
+{
+ //abs box blur using rowbuffers and linebuffers instead of a full size buffer, W should be a multiple of 16
+
+ if (radius == 0) {
+ if (src != dst) {
+#ifdef _OPENMP
+ #pragma omp parallel for if (multiThread)
+#endif
+
+ for (int row = 0; row < H; ++row) {
+ for (int col = 0; col < W; ++col) {
+ dst[row][col] = std::fabs(src[row][col]);
+ }
+ }
+ }
+ return;
+ }
+
+ constexpr int numCols = 16; // process numCols columns at once for better usage of L1 cpu cache
+#ifdef _OPENMP
+ #pragma omp parallel if (multiThread)
+#endif
+ {
+ float buffer[numCols * (radius + 1)] ALIGNED64;
+
+ //horizontal blur
+ float* const lineBuffer = buffer;
+#ifdef _OPENMP
+ #pragma omp for
+#endif
+ for (int row = 0; row < H; ++row) {
+ float len = radius + 1;
+ float tempval = std::fabs(src[row][0]);
+ lineBuffer[0] = tempval;
+ for (int j = 1; j <= radius; j++) {
+ tempval += std::fabs(src[row][j]);
+ }
+
+ tempval /= len;
+ dst[row][0] = tempval;
+
+ for (int col = 1; col <= radius; ++col) {
+ lineBuffer[col] = std::fabs(src[row][col]);
+ tempval = (tempval * len + std::fabs(src[row][col + radius])) / (len + 1);
+ dst[row][col] = tempval;
+ ++len;
+ }
+
+ const float rlen = 1.f / len;
+ int pos = 0;
+ for (int col = radius + 1; col < W - radius; ++col) {
+ const float oldVal = lineBuffer[pos];
+ lineBuffer[pos] = std::fabs(src[row][col]);
+ tempval = tempval + (std::fabs(src[row][col + radius]) - oldVal) * rlen;
+ dst[row][col] = tempval;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+
+ for (int col = W - radius; col < W; ++col) {
+ tempval = (tempval * len - lineBuffer[pos]) / (len - 1);
+ dst[row][col] = tempval;
+ --len;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ }
+
+ //vertical blur
+ float (* const rowBuffer)[numCols] = (float(*)[numCols]) buffer;
+#ifdef _OPENMP
+ #pragma omp for
+#endif
+
+ for (int col = 0; col < W; col += numCols) {
+ float len = radius + 1;
+
+ for (int k = 0; k < numCols; ++k) {
+ rowBuffer[0][k] = dst[0][col + k];
+ }
+
+ for (int i = 1; i <= radius; ++i) {
+ for (int k = 0; k < numCols; ++k) {
+ dst[0][col + k] += dst[i][col + k];
+ }
+ }
+
+ for(int k = 0; k < numCols; ++k) {
+ dst[0][col + k] /= len;
+ }
+
+ for (int row = 1; row <= radius; ++row) {
+ for(int k = 0; k < numCols; ++k) {
+ rowBuffer[row][k] = dst[row][col + k];
+ dst[row][col + k] = (dst[row - 1][col + k] * len + dst[row + radius][col + k]) / (len + 1);
+ }
+
+ ++len;
+ }
+
+ const float rlen = 1.f / len;
+ int pos = 0;
+ for (int row = radius + 1; row < H - radius; ++row) {
+ for(int k = 0; k < numCols; ++k) {
+ float oldVal = rowBuffer[pos][k];
+ rowBuffer[pos][k] = dst[row][col + k];
+ dst[row][col + k] = dst[row - 1][col + k] + (dst[row + radius][col + k] - oldVal) * rlen;
+ }
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+
+ for (int row = H - radius; row < H; ++row) {
+ for(int k = 0; k < numCols; ++k) {
+ dst[row][col + k] = (dst[row - 1][col + k] * len - rowBuffer[pos][k]) / (len - 1);
+ }
+ --len;
+ ++pos;
+ pos = pos <= radius ? pos : 0;
+ }
+ }
+ }
+}
+
+void boxblur(float* src, float* dst, int radius, int W, int H, bool multiThread)
+{
+ float* srcp[H];
+ float* dstp[H];
+ for (int i = 0; i < H; ++i) {
+ srcp[i] = src + i * W;
+ dstp[i] = dst + i * W;
+ }
+ boxblur(srcp, dstp, radius, W, H, multiThread);
+}
+
+void boxabsblur(float* src, float* dst, int radius, int W, int H, bool multiThread)
+{
+ float* srcp[H];
+ float* dstp[H];
+ for (int i = 0; i < H; ++i) {
+ srcp[i] = src + i * W;
+ dstp[i] = dst + i * W;
+ }
+ boxabsblur(srcp, dstp, radius, W, H, multiThread);
+}
+
+}
diff --git a/rtengine/boxblur.h b/rtengine/boxblur.h
index 1689c5ed1..57fba9119 100644
--- a/rtengine/boxblur.h
+++ b/rtengine/boxblur.h
@@ -1,7 +1,7 @@
/*
* This file is part of RawTherapee.
*
- * Copyright (C) 2010 Emil Martinec
+ * Copyright (C) 2019 Ingo Weyrich
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,873 +15,15 @@
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see .
- */
-#ifndef _BOXBLUR_H_
-#define _BOXBLUR_H_
-
-#include
-#include
-#include
-#include
-#include
-#include "alignedbuffer.h"
-#include "rt_math.h"
-#include "opthelper.h"
+*/
+#pragma once
namespace rtengine
{
-// classical filtering if the support window is small:
-
-template void boxblur (T** src, A** dst, int radx, int rady, int W, int H)
-{
- //box blur image; box range = (radx,rady)
- assert(2*radx+1 < W);
- assert(2*rady+1 < H);
-
- AlignedBuffer* buffer = new AlignedBuffer (W * H);
- float* temp = buffer->data;
-
- if (radx == 0) {
-#ifdef _OPENMP
- #pragma omp parallel for
-#endif
-
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- temp[row * W + col] = (float)src[row][col];
- }
- } else {
- //horizontal blur
-#ifdef _OPENMP
- #pragma omp parallel for
-#endif
-
- for (int row = 0; row < H; row++) {
- int len = radx + 1;
- temp[row * W + 0] = (float)src[row][0] / len;
-
- for (int j = 1; j <= radx; j++) {
- temp[row * W + 0] += (float)src[row][j] / len;
- }
-
- for (int col = 1; col <= radx; col++) {
- temp[row * W + col] = (temp[row * W + col - 1] * len + (float)src[row][col + radx]) / (len + 1);
- len ++;
- }
-
- for (int col = radx + 1; col < W - radx; col++) {
- temp[row * W + col] = temp[row * W + col - 1] + ((float)(src[row][col + radx] - src[row][col - radx - 1])) / len;
- }
-
- for (int col = W - radx; col < W; col++) {
- temp[row * W + col] = (temp[row * W + col - 1] * len - src[row][col - radx - 1]) / (len - 1);
- len --;
- }
- }
- }
-
- if (rady == 0) {
-#ifdef _OPENMP
- #pragma omp parallel for
-#endif
-
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- dst[row][col] = temp[row * W + col];
- }
- } else {
- //vertical blur
-#ifdef _OPENMP
- #pragma omp parallel for
-#endif
-
- for (int col = 0; col < W; col++) {
- int len = rady + 1;
- dst[0][col] = temp[0 * W + col] / len;
-
- for (int i = 1; i <= rady; i++) {
- dst[0][col] += temp[i * W + col] / len;
- }
-
- for (int row = 1; row <= rady; row++) {
- dst[row][col] = (dst[(row - 1)][col] * len + temp[(row + rady) * W + col]) / (len + 1);
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- dst[row][col] = dst[(row - 1)][col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len;
- }
-
- for (int row = H - rady; row < H; row++) {
- dst[row][col] = (dst[(row - 1)][col] * len - temp[(row - rady - 1) * W + col]) / (len - 1);
- len --;
- }
- }
- }
-
- delete buffer;
+void boxblur(float** src, float** dst, int radius, int W, int H, bool multiThread);
+void boxblur(float* src, float* dst, int radius, int W, int H, bool multiThread);
+void boxabsblur(float** src, float** dst, int radius, int W, int H, bool multiThread);
+void boxabsblur(float* src, float* dst, int radius, int W, int H, bool multiThread);
}
-
-template void boxblur (T** src, A** dst, T* buffer, int radx, int rady, int W, int H)
-{
- //box blur image; box range = (radx,rady)
-
- float* temp = buffer;
-
- if (radx == 0) {
-#ifdef _OPENMP
- #pragma omp for
-#endif
-
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- temp[row * W + col] = (float)src[row][col];
- }
- } else {
- //horizontal blur
-#ifdef _OPENMP
- #pragma omp for
-#endif
-
- for (int row = 0; row < H; row++) {
- float len = radx + 1;
- float tempval = (float)src[row][0];
-
- for (int j = 1; j <= radx; j++) {
- tempval += (float)src[row][j];
- }
-
- tempval /= len;
- temp[row * W + 0] = tempval;
-
- for (int col = 1; col <= radx; col++) {
- temp[row * W + col] = tempval = (tempval * len + (float)src[row][col + radx]) / (len + 1);
- len ++;
- }
-
- for (int col = radx + 1; col < W - radx; col++) {
- temp[row * W + col] = tempval = tempval + ((float)(src[row][col + radx] - src[row][col - radx - 1])) / len;
- }
-
- for (int col = W - radx; col < W; col++) {
- temp[row * W + col] = tempval = (tempval * len - src[row][col - radx - 1]) / (len - 1);
- len --;
- }
- }
- }
-
- if (rady == 0) {
-#ifdef _OPENMP
- #pragma omp for
-#endif
-
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- dst[row][col] = temp[row * W + col];
- }
- } else {
- const int numCols = 8; // process numCols columns at once for better usage of L1 cpu cache
-#ifdef __SSE2__
- vfloat leninitv = F2V( (float)(rady + 1));
- vfloat onev = F2V( 1.f );
- vfloat tempv, temp1v, lenv, lenp1v, lenm1v, rlenv;
-
-#ifdef _OPENMP
- #pragma omp for
-#endif
-
- for (int col = 0; col < W - 7; col += 8) {
- lenv = leninitv;
- tempv = LVFU(temp[0 * W + col]);
- temp1v = LVFU(temp[0 * W + col + 4]);
-
- for (int i = 1; i <= rady; i++) {
- tempv = tempv + LVFU(temp[i * W + col]);
- temp1v = temp1v + LVFU(temp[i * W + col + 4]);
- }
-
- tempv = tempv / lenv;
- temp1v = temp1v / lenv;
- STVFU(dst[0][col], tempv);
- STVFU(dst[0][col + 4], temp1v);
-
- for (int row = 1; row <= rady; row++) {
- lenp1v = lenv + onev;
- tempv = (tempv * lenv + LVFU(temp[(row + rady) * W + col])) / lenp1v;
- temp1v = (temp1v * lenv + LVFU(temp[(row + rady) * W + col + 4])) / lenp1v;
- STVFU(dst[row][col], tempv);
- STVFU(dst[row][col + 4], temp1v);
- lenv = lenp1v;
- }
-
- rlenv = onev / lenv;
-
- for (int row = rady + 1; row < H - rady; row++) {
- tempv = tempv + (LVFU(temp[(row + rady) * W + col]) - LVFU(temp[(row - rady - 1) * W + col])) * rlenv ;
- temp1v = temp1v + (LVFU(temp[(row + rady) * W + col + 4]) - LVFU(temp[(row - rady - 1) * W + col + 4])) * rlenv ;
- STVFU(dst[row][col], tempv);
- STVFU(dst[row][col + 4], temp1v);
- }
-
- for (int row = H - rady; row < H; row++) {
- lenm1v = lenv - onev;
- tempv = (tempv * lenv - LVFU(temp[(row - rady - 1) * W + col])) / lenm1v;
- temp1v = (temp1v * lenv - LVFU(temp[(row - rady - 1) * W + col + 4])) / lenm1v;
- STVFU(dst[row][col], tempv);
- STVFU(dst[row][col + 4], temp1v);
- lenv = lenm1v;
- }
- }
-
-#else
- //vertical blur
-#ifdef _OPENMP
- #pragma omp for
-#endif
-
- for (int col = 0; col < W - numCols + 1; col += 8) {
- float len = rady + 1;
-
- for(int k = 0; k < numCols; k++) {
- dst[0][col + k] = temp[0 * W + col + k];
- }
-
- for (int i = 1; i <= rady; i++) {
- for(int k = 0; k < numCols; k++) {
- dst[0][col + k] += temp[i * W + col + k];
- }
- }
-
- for(int k = 0; k < numCols; k++) {
- dst[0][col + k] /= len;
- }
-
- for (int row = 1; row <= rady; row++) {
- for(int k = 0; k < numCols; k++) {
- dst[row][col + k] = (dst[(row - 1)][col + k] * len + temp[(row + rady) * W + col + k]) / (len + 1);
- }
-
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- for(int k = 0; k < numCols; k++) {
- dst[row][col + k] = dst[(row - 1)][col + k] + (temp[(row + rady) * W + col + k] - temp[(row - rady - 1) * W + col + k]) / len;
- }
- }
-
- for (int row = H - rady; row < H; row++) {
- for(int k = 0; k < numCols; k++) {
- dst[row][col + k] = (dst[(row - 1)][col + k] * len - temp[(row - rady - 1) * W + col + k]) / (len - 1);
- }
-
- len --;
- }
- }
-
-#endif
-#ifdef _OPENMP
- #pragma omp single
-#endif
-
- for (int col = W - (W % numCols); col < W; col++) {
- float len = rady + 1;
- dst[0][col] = temp[0 * W + col] / len;
-
- for (int i = 1; i <= rady; i++) {
- dst[0][col] += temp[i * W + col] / len;
- }
-
- for (int row = 1; row <= rady; row++) {
- dst[row][col] = (dst[(row - 1)][col] * len + temp[(row + rady) * W + col]) / (len + 1);
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- dst[row][col] = dst[(row - 1)][col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len;
- }
-
- for (int row = H - rady; row < H; row++) {
- dst[row][col] = (dst[(row - 1)][col] * len - temp[(row - rady - 1) * W + col]) / (len - 1);
- len --;
- }
- }
- }
-
-}
-
-inline void boxblur (float** src, float** dst, int radius, int W, int H, bool multiThread)
-{
- //box blur using rowbuffers and linebuffers instead of a full size buffer
-
- if (radius == 0) {
- if (src != dst) {
-#ifdef _OPENMP
- #pragma omp parallel for if (multiThread)
-#endif
-
- for (int row = 0; row < H; row++) {
- for (int col = 0; col < W; col++) {
- dst[row][col] = src[row][col];
- }
- }
- }
- return;
- }
-
- constexpr int numCols = 8; // process numCols columns at once for better usage of L1 cpu cache
-#ifdef _OPENMP
- #pragma omp parallel if (multiThread)
-#endif
- {
- std::unique_ptr buffer(new float[numCols * (radius + 1)]);
-
- //horizontal blur
- float* const lineBuffer = buffer.get();
-#ifdef _OPENMP
- #pragma omp for
-#endif
- for (int row = 0; row < H; row++) {
- float len = radius + 1;
- float tempval = src[row][0];
- lineBuffer[0] = tempval;
- for (int j = 1; j <= radius; j++) {
- tempval += src[row][j];
- }
-
- tempval /= len;
- dst[row][0] = tempval;
-
- for (int col = 1; col <= radius; col++) {
- lineBuffer[col] = src[row][col];
- tempval = (tempval * len + src[row][col + radius]) / (len + 1);
- dst[row][col] = tempval;
- ++len;
- }
- int pos = 0;
- for (int col = radius + 1; col < W - radius; col++) {
- const float oldVal = lineBuffer[pos];
- lineBuffer[pos] = src[row][col];
- tempval = tempval + (src[row][col + radius] - oldVal) / len;
- dst[row][col] = tempval;
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
-
- for (int col = W - radius; col < W; col++) {
- tempval = (tempval * len - lineBuffer[pos]) / (len - 1);
- dst[row][col] = tempval;
- --len;
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
- }
-
- //vertical blur
-#ifdef __SSE2__
- vfloat (* const rowBuffer)[2] = (vfloat(*)[2]) buffer.get();
- const vfloat leninitv = F2V(radius + 1);
- const vfloat onev = F2V(1.f);
- vfloat tempv, temp1v, lenv, lenp1v, lenm1v, rlenv;
-
-#ifdef _OPENMP
- #pragma omp for nowait
-#endif
-
- for (int col = 0; col < W - 7; col += 8) {
- lenv = leninitv;
- tempv = LVFU(dst[0][col]);
- temp1v = LVFU(dst[0][col + 4]);
- rowBuffer[0][0] = tempv;
- rowBuffer[0][1] = temp1v;
-
- for (int i = 1; i <= radius; i++) {
- tempv = tempv + LVFU(dst[i][col]);
- temp1v = temp1v + LVFU(dst[i][col + 4]);
- }
-
- tempv = tempv / lenv;
- temp1v = temp1v / lenv;
- STVFU(dst[0][col], tempv);
- STVFU(dst[0][col + 4], temp1v);
-
- for (int row = 1; row <= radius; row++) {
- rowBuffer[row][0] = LVFU(dst[row][col]);
- rowBuffer[row][1] = LVFU(dst[row][col + 4]);
- lenp1v = lenv + onev;
- tempv = (tempv * lenv + LVFU(dst[row + radius][col])) / lenp1v;
- temp1v = (temp1v * lenv + LVFU(dst[row + radius][col + 4])) / lenp1v;
- STVFU(dst[row][col], tempv);
- STVFU(dst[row][col + 4], temp1v);
- lenv = lenp1v;
- }
-
- rlenv = onev / lenv;
- int pos = 0;
- for (int row = radius + 1; row < H - radius; row++) {
- vfloat oldVal0 = rowBuffer[pos][0];
- vfloat oldVal1 = rowBuffer[pos][1];
- rowBuffer[pos][0] = LVFU(dst[row][col]);
- rowBuffer[pos][1] = LVFU(dst[row][col + 4]);
- tempv = tempv + (LVFU(dst[row + radius][col]) - oldVal0) * rlenv ;
- temp1v = temp1v + (LVFU(dst[row + radius][col + 4]) - oldVal1) * rlenv ;
- STVFU(dst[row][col], tempv);
- STVFU(dst[row][col + 4], temp1v);
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
-
- for (int row = H - radius; row < H; row++) {
- lenm1v = lenv - onev;
- tempv = (tempv * lenv - rowBuffer[pos][0]) / lenm1v;
- temp1v = (temp1v * lenv - rowBuffer[pos][1]) / lenm1v;
- STVFU(dst[row][col], tempv);
- STVFU(dst[row][col + 4], temp1v);
- lenv = lenm1v;
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
- }
-
-#else
- float (* const rowBuffer)[8] = (float(*)[8]) buffer.get();
-#ifdef _OPENMP
- #pragma omp for nowait
-#endif
-
- for (int col = 0; col < W - numCols + 1; col += 8) {
- float len = radius + 1;
-
- for (int k = 0; k < numCols; k++) {
- rowBuffer[0][k] = dst[0][col + k];
- }
-
- for (int i = 1; i <= radius; i++) {
- for (int k = 0; k < numCols; k++) {
- dst[0][col + k] += dst[i][col + k];
- }
- }
-
- for(int k = 0; k < numCols; k++) {
- dst[0][col + k] /= len;
- }
-
- for (int row = 1; row <= radius; row++) {
- for(int k = 0; k < numCols; k++) {
- rowBuffer[row][k] = dst[row][col + k];
- dst[row][col + k] = (dst[row - 1][col + k] * len + dst[row + radius][col + k]) / (len + 1);
- }
-
- len ++;
- }
-
- int pos = 0;
- for (int row = radius + 1; row < H - radius; row++) {
- for(int k = 0; k < numCols; k++) {
- float oldVal = rowBuffer[pos][k];
- rowBuffer[pos][k] = dst[row][col + k];
- dst[row][col + k] = dst[row - 1][col + k] + (dst[row + radius][col + k] - oldVal) / len;
- }
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
-
- for (int row = H - radius; row < H; row++) {
- for(int k = 0; k < numCols; k++) {
- dst[row][col + k] = (dst[row - 1][col + k] * len - rowBuffer[pos][k]) / (len - 1);
- }
- len --;
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
- }
-
-#endif
- //vertical blur, remaining columns
-#ifdef _OPENMP
- #pragma omp single
-#endif
- {
- const int remaining = W % numCols;
-
- if (remaining > 0) {
- float (* const rowBuffer)[8] = (float(*)[8]) buffer.get();
- const int col = W - remaining;
-
- float len = radius + 1;
- for(int k = 0; k < remaining; ++k) {
- rowBuffer[0][k] = dst[0][col + k];
- }
- for (int row = 1; row <= radius; ++row) {
- for(int k = 0; k < remaining; ++k) {
- dst[0][col + k] += dst[row][col + k];
- }
- }
- for(int k = 0; k < remaining; ++k) {
- dst[0][col + k] /= len;
- }
- for (int row = 1; row <= radius; ++row) {
- for(int k = 0; k < remaining; ++k) {
- rowBuffer[row][k] = dst[row][col + k];
- dst[row][col + k] = (dst[row - 1][col + k] * len + dst[row + radius][col + k]) / (len + 1);
- }
- len ++;
- }
- const float rlen = 1.f / len;
- int pos = 0;
- for (int row = radius + 1; row < H - radius; ++row) {
- for(int k = 0; k < remaining; ++k) {
- float oldVal = rowBuffer[pos][k];
- rowBuffer[pos][k] = dst[row][col + k];
- dst[row][col + k] = dst[row - 1][col + k] + (dst[row + radius][col + k] - oldVal) * rlen;
- }
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
- for (int row = H - radius; row < H; ++row) {
- for(int k = 0; k < remaining; ++k) {
- dst[row][col + k] = (dst[(row - 1)][col + k] * len - rowBuffer[pos][k]) / (len - 1);
- }
- len --;
- ++pos;
- pos = pos <= radius ? pos : 0;
- }
- }
- }
- }
-}
-
-template void boxblur (T* src, A* dst, A* buffer, int radx, int rady, int W, int H)
-{
- //box blur image; box range = (radx,rady) i.e. box size is (2*radx+1)x(2*rady+1)
-
- float* temp = buffer;
-
- if (radx == 0) {
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- temp[row * W + col] = src[row * W + col];
- }
- } else {
- //horizontal blur
- for (int row = H - 1; row >= 0; row--) {
- int len = radx + 1;
- float tempval = (float)src[row * W];
-
- for (int j = 1; j <= radx; j++) {
- tempval += (float)src[row * W + j];
- }
-
- tempval = tempval / len;
- temp[row * W] = tempval;
-
- for (int col = 1; col <= radx; col++) {
- tempval = (tempval * len + src[row * W + col + radx]) / (len + 1);
- temp[row * W + col] = tempval;
- len ++;
- }
-
- float reclen = 1.f / len;
-
- for (int col = radx + 1; col < W - radx; col++) {
- tempval = tempval + ((float)(src[row * W + col + radx] - src[row * W + col - radx - 1])) * reclen;
- temp[row * W + col] = tempval;
- }
-
- for (int col = W - radx; col < W; col++) {
- tempval = (tempval * len - src[row * W + col - radx - 1]) / (len - 1);
- temp[row * W + col] = tempval;
- len --;
- }
- }
- }
-
- if (rady == 0) {
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- dst[row * W + col] = temp[row * W + col];
- }
- } else {
- //vertical blur
-#ifdef __SSE2__
- vfloat leninitv = F2V( (float)(rady + 1));
- vfloat onev = F2V( 1.f );
- vfloat tempv, temp1v, lenv, lenp1v, lenm1v, rlenv;
- int col;
-
- for (col = 0; col < W - 7; col += 8) {
- lenv = leninitv;
- tempv = LVFU(temp[0 * W + col]);
- temp1v = LVFU(temp[0 * W + col + 4]);
-
- for (int i = 1; i <= rady; i++) {
- tempv = tempv + LVFU(temp[i * W + col]);
- temp1v = temp1v + LVFU(temp[i * W + col + 4]);
- }
-
- tempv = tempv / lenv;
- temp1v = temp1v / lenv;
- STVFU(dst[0 * W + col], tempv);
- STVFU(dst[0 * W + col + 4], temp1v);
-
- for (int row = 1; row <= rady; row++) {
- lenp1v = lenv + onev;
- tempv = (tempv * lenv + LVFU(temp[(row + rady) * W + col])) / lenp1v;
- temp1v = (temp1v * lenv + LVFU(temp[(row + rady) * W + col + 4])) / lenp1v;
- STVFU(dst[row * W + col], tempv);
- STVFU(dst[row * W + col + 4], temp1v);
- lenv = lenp1v;
- }
-
- rlenv = onev / lenv;
-
- for (int row = rady + 1; row < H - rady; row++) {
- tempv = tempv + (LVFU(temp[(row + rady) * W + col]) - LVFU(temp[(row - rady - 1) * W + col])) * rlenv ;
- temp1v = temp1v + (LVFU(temp[(row + rady) * W + col + 4]) - LVFU(temp[(row - rady - 1) * W + col + 4])) * rlenv ;
- STVFU(dst[row * W + col], tempv);
- STVFU(dst[row * W + col + 4], temp1v);
- }
-
- for (int row = H - rady; row < H; row++) {
- lenm1v = lenv - onev;
- tempv = (tempv * lenv - LVFU(temp[(row - rady - 1) * W + col])) / lenm1v;
- temp1v = (temp1v * lenv - LVFU(temp[(row - rady - 1) * W + col + 4])) / lenm1v;
- STVFU(dst[row * W + col], tempv);
- STVFU(dst[row * W + col + 4], temp1v);
- lenv = lenm1v;
- }
- }
-
- for (; col < W - 3; col += 4) {
- lenv = leninitv;
- tempv = LVFU(temp[0 * W + col]);
-
- for (int i = 1; i <= rady; i++) {
- tempv = tempv + LVFU(temp[i * W + col]);
- }
-
- tempv = tempv / lenv;
- STVFU(dst[0 * W + col], tempv);
-
- for (int row = 1; row <= rady; row++) {
- lenp1v = lenv + onev;
- tempv = (tempv * lenv + LVFU(temp[(row + rady) * W + col])) / lenp1v;
- STVFU(dst[row * W + col], tempv);
- lenv = lenp1v;
- }
-
- rlenv = onev / lenv;
-
- for (int row = rady + 1; row < H - rady; row++) {
- tempv = tempv + (LVFU(temp[(row + rady) * W + col]) - LVFU(temp[(row - rady - 1) * W + col])) * rlenv ;
- STVFU(dst[row * W + col], tempv);
- }
-
- for (int row = H - rady; row < H; row++) {
- lenm1v = lenv - onev;
- tempv = (tempv * lenv - LVFU(temp[(row - rady - 1) * W + col])) / lenm1v;
- STVFU(dst[row * W + col], tempv);
- lenv = lenm1v;
- }
- }
-
- for (; col < W; col++) {
- int len = rady + 1;
- dst[0 * W + col] = temp[0 * W + col] / len;
-
- for (int i = 1; i <= rady; i++) {
- dst[0 * W + col] += temp[i * W + col] / len;
- }
-
- for (int row = 1; row <= rady; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1);
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len;
- }
-
- for (int row = H - rady; row < H; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1);
- len --;
- }
- }
-
-#else
-
- for (int col = 0; col < W; col++) {
- int len = rady + 1;
- dst[0 * W + col] = temp[0 * W + col] / len;
-
- for (int i = 1; i <= rady; i++) {
- dst[0 * W + col] += temp[i * W + col] / len;
- }
-
- for (int row = 1; row <= rady; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1);
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len;
- }
-
- for (int row = H - rady; row < H; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1);
- len --;
- }
- }
-
-#endif
- }
-
-}
-
-template void boxabsblur (T* src, A* dst, int radx, int rady, int W, int H, float * temp)
-{
-
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- //box blur image; box range = (radx,rady) i.e. box size is (2*radx+1)x(2*rady+1)
-
- if (radx == 0) {
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- temp[row * W + col] = fabs(src[row * W + col]);
- }
- } else {
- //horizontal blur
- for (int row = 0; row < H; row++) {
- int len = radx + 1;
- float tempval = fabsf((float)src[row * W + 0]);
-
- for (int j = 1; j <= radx; j++) {
- tempval += fabsf((float)src[row * W + j]);
- }
-
- tempval /= len;
- temp[row * W + 0] = tempval;
-
- for (int col = 1; col <= radx; col++) {
- tempval = (tempval * len + fabsf(src[row * W + col + radx])) / (len + 1);
- temp[row * W + col] = tempval;
- len ++;
- }
-
- float rlen = 1.f / (float)len;
-
- for (int col = radx + 1; col < W - radx; col++) {
- tempval = tempval + ((float)(fabsf(src[row * W + col + radx]) - fabsf(src[row * W + col - radx - 1]))) * rlen;
- temp[row * W + col] = tempval;
- }
-
- for (int col = W - radx; col < W; col++) {
- tempval = (tempval * len - fabsf(src[row * W + col - radx - 1])) / (len - 1);
- temp[row * W + col] = tempval;
- len --;
- }
- }
- }
-
- if (rady == 0) {
- for (int row = 0; row < H; row++)
- for (int col = 0; col < W; col++) {
- dst[row * W + col] = temp[row * W + col];
- }
- } else {
- //vertical blur
-#ifdef __SSE2__
- vfloat leninitv = F2V( (float)(rady + 1));
- vfloat onev = F2V( 1.f );
- vfloat tempv, lenv, lenp1v, lenm1v, rlenv;
-
- for (int col = 0; col < W - 3; col += 4) {
- lenv = leninitv;
- tempv = LVF(temp[0 * W + col]);
-
- for (int i = 1; i <= rady; i++) {
- tempv = tempv + LVF(temp[i * W + col]);
- }
-
- tempv = tempv / lenv;
- STVF(dst[0 * W + col], tempv);
-
- for (int row = 1; row <= rady; row++) {
- lenp1v = lenv + onev;
- tempv = (tempv * lenv + LVF(temp[(row + rady) * W + col])) / lenp1v;
- STVF(dst[row * W + col], tempv);
- lenv = lenp1v;
- }
-
- rlenv = onev / lenv;
-
- for (int row = rady + 1; row < H - rady; row++) {
- tempv = tempv + (LVF(temp[(row + rady) * W + col]) - LVF(temp[(row - rady - 1) * W + col])) * rlenv;
- STVF(dst[row * W + col], tempv);
- }
-
- for (int row = H - rady; row < H; row++) {
- lenm1v = lenv - onev;
- tempv = (tempv * lenv - LVF(temp[(row - rady - 1) * W + col])) / lenm1v;
- STVF(dst[row * W + col], tempv);
- lenv = lenm1v;
- }
- }
-
- for (int col = W - (W % 4); col < W; col++) {
- int len = rady + 1;
- dst[0 * W + col] = temp[0 * W + col] / len;
-
- for (int i = 1; i <= rady; i++) {
- dst[0 * W + col] += temp[i * W + col] / len;
- }
-
- for (int row = 1; row <= rady; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1);
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len;
- }
-
- for (int row = H - rady; row < H; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1);
- len --;
- }
- }
-
-#else
-
- for (int col = 0; col < W; col++) {
- int len = rady + 1;
- dst[0 * W + col] = temp[0 * W + col] / len;
-
- for (int i = 1; i <= rady; i++) {
- dst[0 * W + col] += temp[i * W + col] / len;
- }
-
- for (int row = 1; row <= rady; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1);
- len ++;
- }
-
- for (int row = rady + 1; row < H - rady; row++) {
- dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len;
- }
-
- for (int row = H - rady; row < H; row++) {
- dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1);
- len --;
- }
- }
-
-#endif
- }
-
-}
-
-}
-#endif /* _BOXBLUR_H_ */
diff --git a/rtengine/calc_distort.h b/rtengine/calc_distort.h
index 711bf9515..7d0c5ef54 100644
--- a/rtengine/calc_distort.h
+++ b/rtengine/calc_distort.h
@@ -1,4 +1,3 @@
-#ifndef CALC_DISTORTION__H
-#define CALC_DISTORTION__H
+#pragma once
+
int calcDistortion (unsigned char* img1, unsigned char* img2, int ncols, int nrows, int nfactor, double &distortion);
-#endif
diff --git a/rtengine/camconst.cc b/rtengine/camconst.cc
index 43de5d688..e8f7b1cbf 100644
--- a/rtengine/camconst.cc
+++ b/rtengine/camconst.cc
@@ -2,6 +2,9 @@
* This file is part of RawTherapee.
*/
#include "camconst.h"
+#include
+#include
+#include
#include "settings.h"
#include "rt_math.h"
#include
@@ -17,8 +20,6 @@
namespace rtengine
{
-extern const Settings* settings;
-
CameraConst::CameraConst() : pdafOffset(0)
{
memset(dcraw_matrix, 0, sizeof(dcraw_matrix));
diff --git a/rtengine/camconst.h b/rtengine/camconst.h
index eb43da483..1096e1767 100644
--- a/rtengine/camconst.h
+++ b/rtengine/camconst.h
@@ -1,11 +1,11 @@
/*
* This file is part of RawTherapee.
*/
-#ifndef __CAMCONST__
-#define __CAMCONST__
+#pragma once
-#include
+#include
#include