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 +#include namespace rtengine { @@ -72,5 +72,3 @@ public: }; } - -#endif diff --git a/rtengine/capturesharpening.cc b/rtengine/capturesharpening.cc index 6720d9abc..f574fa45f 100644 --- a/rtengine/capturesharpening.cc +++ b/rtengine/capturesharpening.cc @@ -20,18 +20,14 @@ #include #include "rtengine.h" +#include "rawimage.h" #include "rawimagesource.h" #include "rt_math.h" -#include "improcfun.h" #include "procparams.h" #include "color.h" -#include "gauss.h" #include "rt_algo.h" //#define BENCHMARK #include "StopWatch.h" -#ifdef _OPENMP -#include -#endif #include "opthelper.h" #include "../rtgui/multilangmgr.h" @@ -513,6 +509,7 @@ float calcRadiusXtrans(const float * const *rawData, int W, int H, float lowerLi } return std::sqrt((1.f / (std::log(1.f / maxRatio))) / -2.f); } + void CaptureDeconvSharpening (float** luminance, float** oldLuminance, const float * const * blend, int W, int H, double sigma, double sigmaCornerOffset, int iterations, rtengine::ProgressListener* plistener, double startVal, double endVal) { BENCHFUN @@ -583,10 +580,10 @@ BENCHFUN } else { if (sigmaCornerOffset != 0.0) { const float distance = sqrt(rtengine::SQR(i + tileSize / 2 - H / 2) + rtengine::SQR(j + tileSize / 2 - W / 2)); - const float sigmaTile = sigma + distanceFactor * distance; + const float sigmaTile = static_cast(sigma) + distanceFactor * distance; if (sigmaTile >= 0.4f) { float lkernel7[7][7]; - compute7x7kernel(sigma + distanceFactor * distance, lkernel7); + compute7x7kernel(static_cast(sigma) + distanceFactor * distance, lkernel7); for (int k = 0; k < iterations - 1; ++k) { // apply 7x7 gaussian blur and divide luminance by result of gaussian blur gauss7x7div(tmpIThr, tmpThr, lumThr, fullTileSize, fullTileSize, lkernel7); @@ -605,13 +602,13 @@ BENCHFUN // special handling for small tiles at end of row or column for (int k = border, ii = endOfCol ? H - fullTileSize - border : i - border; k < fullTileSize - border; ++k) { for (int l = border, jj = endOfRow ? W - fullTileSize - border : j - border; l < fullTileSize - border; ++l) { - luminance[ii + k][jj + l] = rtengine::intp(blend[ii + k][jj + l], max(tmpIThr[k][l], 0.0f), luminance[ii + k][jj + l]); + luminance[ii + k][jj + l] = rtengine::intp(blend[ii + k][jj + l], std::max(tmpIThr[k][l], 0.0f), luminance[ii + k][jj + l]); } } } else { for (int ii = border; ii < fullTileSize - border; ++ii) { for (int jj = border; jj < fullTileSize - border; ++jj) { - luminance[i + ii - border][j + jj - border] = rtengine::intp(blend[i + ii - border][j + jj - border], max(tmpIThr[ii][jj], 0.0f), luminance[i + ii - border][j + jj - border]); + luminance[i + ii - border][j + jj - border] = rtengine::intp(blend[i + ii - border][j + jj - border], std::max(tmpIThr[ii][jj], 0.0f), luminance[i + ii - border][j + jj - border]); } } } @@ -654,13 +651,13 @@ BENCHFUN const float clipVal = (ri->get_white(1) - ri->get_cblack(1)) * scale_mul[1]; - array2D& redVals = redCache ? *redCache : red; - array2D& greenVals = greenCache ? *greenCache : green; - array2D& blueVals = blueCache ? *blueCache : blue; + const array2D& redVals = redCache ? *redCache : red; + const array2D& greenVals = greenCache ? *greenCache : green; + const array2D& blueVals = blueCache ? *blueCache : blue; array2D clipMask(W, H); constexpr float clipLimit = 0.95f; - if (ri->getSensorType() == ST_BAYER) { + if (getSensorType() == ST_BAYER) { const float whites[2][2] = { {(ri->get_white(FC(0,0)) - c_black[FC(0,0)]) * scale_mul[FC(0,0)] * clipLimit, (ri->get_white(FC(0,1)) - c_black[FC(0,1)]) * scale_mul[FC(0,1)] * clipLimit}, {(ri->get_white(FC(1,0)) - c_black[FC(1,0)]) * scale_mul[FC(1,0)] * clipLimit, (ri->get_white(FC(1,1)) - c_black[FC(1,1)]) * scale_mul[FC(1,1)] * clipLimit} @@ -668,9 +665,9 @@ BENCHFUN buildClipMaskBayer(rawData, W, H, clipMask, whites); const unsigned int fc[2] = {FC(0,0), FC(1,0)}; if (sharpeningParams.autoRadius) { - radius = calcRadiusBayer(rawData, W, H, 1000.f, clipVal, fc); + radius = std::min(calcRadiusBayer(rawData, W, H, 1000.f, clipVal, fc), 1.15f); } - } else if (ri->getSensorType() == ST_FUJI_XTRANS) { + } else if (getSensorType() == ST_FUJI_XTRANS) { float whites[6][6]; for (int i = 0; i < 6; ++i) { for (int j = 0; j < 6; ++j) { @@ -696,14 +693,14 @@ BENCHFUN } } if (sharpeningParams.autoRadius) { - radius = calcRadiusXtrans(rawData, W, H, 1000.f, clipVal, i, j); + radius = std::min(calcRadiusXtrans(rawData, W, H, 1000.f, clipVal, i, j), 1.15f); } } else if (ri->get_colors() == 1) { buildClipMaskMono(rawData, W, H, clipMask, (ri->get_white(0) - c_black[0]) * scale_mul[0] * clipLimit); if (sharpeningParams.autoRadius) { const unsigned int fc[2] = {0, 0}; - radius = calcRadiusBayer(rawData, W, H, 1000.f, clipVal, fc); + radius = std::min(calcRadiusBayer(rawData, W, H, 1000.f, clipVal, fc), 1.15f); } } @@ -810,6 +807,7 @@ BENCHFUN if (plistener) { plistener->setProgress(1.0); } + rgbSourceModified = false; } } /* namespace */ diff --git a/rtengine/cfa_linedn_RT.cc b/rtengine/cfa_linedn_RT.cc index 5f6e46f8f..ba26740c1 100644 --- a/rtengine/cfa_linedn_RT.cc +++ b/rtengine/cfa_linedn_RT.cc @@ -24,7 +24,6 @@ #include -#include "rtengine.h" #include "rawimagesource.h" #include "rt_math.h" @@ -63,7 +62,7 @@ void RawImageSource::CLASS cfa_linedn(float noise, bool horizontal, bool vertica // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% float noisevar = SQR(3 * noise * 65535); // _noise_ (as a fraction of saturation) is input to the algorithm float noisevarm4 = 4.0f * noisevar; - float* RawDataTmp = (float*)malloc( width * height * sizeof(float)); + float* RawDataTmp = (float*)malloc(static_cast(width) * height * sizeof(float)); #ifdef _OPENMP #pragma omp parallel #endif diff --git a/rtengine/ciecam02.cc b/rtengine/ciecam02.cc index dc71fee85..8314e5e8f 100644 --- a/rtengine/ciecam02.cc +++ b/rtengine/ciecam02.cc @@ -17,10 +17,10 @@ * along with RawTherapee. If not, see . */ #include "ciecam02.h" -#include "rtengine.h" +#include "rt_math.h" #include "curves.h" #include -#include "sleef.c" +#include "sleef.h" #ifdef _DEBUG #include "settings.h" @@ -34,10 +34,6 @@ namespace rtengine { -#ifdef _DEBUG -extern const Settings* settings; -#endif - void Ciecam02::curvecolorfloat (float satind, float satval, float &sres, float parsat) { if (satind > 0.f) { diff --git a/rtengine/ciecam02.h b/rtengine/ciecam02.h index fea35ab12..8b532fba0 100644 --- a/rtengine/ciecam02.h +++ b/rtengine/ciecam02.h @@ -16,12 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CIECAM02_ -#define _CIECAM02_ +#pragma once + #include -#include "LUT.h" +#include + #include "opthelper.h" +template +class LUT; + +using LUTu = LUT; +using LUTf = LUT; + namespace rtengine { @@ -106,4 +113,3 @@ public: }; } -#endif diff --git a/rtengine/cieimage.cc b/rtengine/cieimage.cc index be122febf..f19808df7 100644 --- a/rtengine/cieimage.cc +++ b/rtengine/cieimage.cc @@ -1,5 +1,7 @@ #include "cieimage.h" -#include + +#include +#include namespace rtengine { @@ -10,7 +12,6 @@ CieImage::CieImage (int w, int h) : fromImage(false), W(w), H(h) M_p = new float*[H]; C_p = new float*[H]; sh_p = new float*[H]; - // ch_p = new float*[H]; h_p = new float*[H]; // Initialize the pointers to zero @@ -98,9 +99,6 @@ CieImage::CieImage (int w, int h) : fromImage(false), W(w), H(h) ++c; - // for (int i=0; i. */ -#ifndef _CIEIMAGE_H_ -#define _CIEIMAGE_H_ +#pragma once -#include "image16.h" #include "noncopyable.h" namespace rtengine @@ -39,7 +37,6 @@ public: float** M_p; float** C_p; float** sh_p; -// float** ch_p; float** h_p; CieImage (int w, int h); @@ -50,4 +47,3 @@ public: }; } -#endif diff --git a/rtengine/clutstore.cc b/rtengine/clutstore.cc index 10b7a2c38..e3bd9c988 100644 --- a/rtengine/clutstore.cc +++ b/rtengine/clutstore.cc @@ -1,7 +1,11 @@ #include +#include +#include + #include "clutstore.h" +#include "colortemp.h" #include "iccstore.h" #include "imagefloat.h" #include "opthelper.h" diff --git a/rtengine/clutstore.h b/rtengine/clutstore.h index cd94bc18b..7c570df98 100644 --- a/rtengine/clutstore.h +++ b/rtengine/clutstore.h @@ -3,8 +3,6 @@ #include #include -#include - #include "cache.h" #include "alignedbuffer.h" #include "noncopyable.h" diff --git a/rtengine/color.cc b/rtengine/color.cc index 7a91f0073..8d20fb9ba 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -20,18 +20,19 @@ #include "rtengine.h" #include "color.h" #include "iccmatrices.h" -#include "mytime.h" -#include "sleef.c" +#include "sleef.h" #include "opthelper.h" #include "iccstore.h" +#ifdef _DEBUG +#include "mytime.h" +#endif + using namespace std; namespace rtengine { -extern const Settings* settings; - cmsToneCurve* Color::linearGammaTRC; LUTf Color::cachef; LUTf Color::cachefy; diff --git a/rtengine/color.h b/rtengine/color.h index 2acf675d4..a89778157 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -20,14 +20,13 @@ #pragma once #include -#include +#include #include "rt_math.h" #include "LUT.h" -#include "labimage.h" #include "iccmatrices.h" #include "lcms2.h" -#include "sleef.c" +#include "sleef.h" #define SAT(a,b,c) ((float)max(a,b,c)-(float)min(a,b,c))/(float)max(a,b,c) diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index 3ddbdc28a..02d3e0e6d 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -16,19 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include + #include "colortemp.h" -#include "rtengine.h" +#include "iccmatrices.h" +#include "rt_math.h" #include #include #include -#include "sleef.c" +#include "sleef.h" #include "settings.h" namespace rtengine { -extern const Settings* settings; - static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desmis 2° Standard Observer. {0.0000000, 0.000000, 0.000000}, {0.0000000, 0.000000, 0.000000}, {0.0001299, 0.0003917, 0.0006061}, {0.0002321, 0.000006965, 0.001086}, {0.0004149, 0.00001239, 0.001946}, {0.0007416, 0.00002202, 0.003846}, diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index da83177be..a38e01072 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _COLORTEMP_ -#define _COLORTEMP_ +#pragma once #include #include @@ -207,4 +206,3 @@ public: }; } -#endif diff --git a/rtengine/coord.h b/rtengine/coord.h index 5f16cf606..6a7decdda 100644 --- a/rtengine/coord.h +++ b/rtengine/coord.h @@ -17,8 +17,7 @@ * along with RawTherapee. If not, see . */ -#ifndef __COORD__ -#define __COORD__ +#pragma once namespace rtengine { @@ -253,5 +252,3 @@ inline const PolarCoord operator* (const double lhs, const PolarCoord& rhs) } } - -#endif diff --git a/rtengine/coord2d.h b/rtengine/coord2d.h index 252219e47..9f0784b9a 100644 --- a/rtengine/coord2d.h +++ b/rtengine/coord2d.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __COORD2D__ -#define __COORD2D__ +#pragma once namespace rtengine { @@ -35,5 +34,5 @@ public: y = y_; } }; + } -#endif diff --git a/rtengine/cplx_wavelet_dec.h b/rtengine/cplx_wavelet_dec.h index 91e71fcd5..c127a7adf 100644 --- a/rtengine/cplx_wavelet_dec.h +++ b/rtengine/cplx_wavelet_dec.h @@ -17,9 +17,7 @@ * 2010 Ilya Popov * 2012 Emil Martinec */ - -#ifndef CPLX_WAVELET_DEC_H_INCLUDED -#define CPLX_WAVELET_DEC_H_INCLUDED +#pragma once #include #include @@ -266,5 +264,3 @@ void wavelet_decomposition::reconstruct(E * dst, const float blend) } } - -#endif diff --git a/rtengine/cplx_wavelet_filter_coeffs.h b/rtengine/cplx_wavelet_filter_coeffs.h index bf8a00b03..5d191e50c 100644 --- a/rtengine/cplx_wavelet_filter_coeffs.h +++ b/rtengine/cplx_wavelet_filter_coeffs.h @@ -17,7 +17,7 @@ * 2012 Emil Martinec * 2014 Jacques Desmis */ - +#pragma once namespace rtengine { diff --git a/rtengine/cplx_wavelet_level.h b/rtengine/cplx_wavelet_level.h index 4c98addfe..8664606c6 100644 --- a/rtengine/cplx_wavelet_level.h +++ b/rtengine/cplx_wavelet_level.h @@ -17,10 +17,8 @@ * 2010 Ilya Popov * 2012 Emil Martinec * 2014 Ingo Weyrich - */ - -#ifndef CPLX_WAVELET_LEVEL_H_INCLUDED -#define CPLX_WAVELET_LEVEL_H_INCLUDED +*/ +#pragma once #include #include "rt_math.h" @@ -759,5 +757,3 @@ template template void wavelet_level::reconstruct_lev } #endif } - -#endif diff --git a/rtengine/curves.cc b/rtengine/curves.cc index a7e3337c8..b2105a091 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -23,9 +23,6 @@ #include #include #include -#ifdef _OPENMP -#include -#endif #include "rt_math.h" @@ -514,7 +511,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou double shcompr, double br, double contr, const std::vector& curvePoints, const std::vector& curvePoints2, - LUTu & histogram, + const LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & customToneCurve1, diff --git a/rtengine/curves.h b/rtengine/curves.h index 25272d44c..bc8193b76 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -16,24 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __CURVES_H__ -#define __CURVES_H__ +#pragma once #include #include #include -#include +#include #include "rt_math.h" -#include "../rtgui/mycurve.h" -#include "../rtgui/myflatcurve.h" -#include "../rtgui/mydiagonalcurve.h" -#include "color.h" +#include "flatcurvetypes.h" +#include "diagonalcurvetypes.h" #include "pipettebuffer.h" #include "noncopyable.h" #include "LUT.h" - +#include "sleef.h" #define CURVES_MIN_POLY_POINTS 1000 #include "rt_math.h" @@ -354,7 +351,7 @@ public: public: static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, const std::vector& curvePoints, const std::vector& curvePoints2, - LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, + const LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, int skip = 1); static void curveBW (const std::vector& curvePointsbw, const std::vector& curvePointsbw2, const LUTu & histogrambw, LUTu & outBeforeCCurveHistogrambw, @@ -896,12 +893,6 @@ public: float *r, float *g, float *b) const; }; -class SatAndValueBlendingToneCurve : public ToneCurve -{ -public: - void Apply(float& r, float& g, float& b) const; -}; - class WeightedStdToneCurve : public ToneCurve { private: @@ -1271,45 +1262,6 @@ inline void WeightedStdToneCurve::BatchApply(const size_t start, const size_t en #endif } -// Tone curve modifying the value channel only, preserving hue and saturation -// values in 0xffff space -inline void SatAndValueBlendingToneCurve::Apply (float& ir, float& ig, float& ib) const -{ - - assert (lutToneCurve); - - float r = CLIP(ir); - float g = CLIP(ig); - float b = CLIP(ib); - - const float lum = (r + g + b) / 3.f; - const float newLum = lutToneCurve[lum]; - - if (newLum == lum) { - return; - } - - float h, s, v; - Color::rgb2hsvtc(r, g, b, h, s, v); - - float dV; - if (newLum > lum) { - // Linearly targeting Value = 1 and Saturation = 0 - const float coef = (newLum - lum) / (65535.f - lum); - dV = (1.f - v) * coef; - s *= 1.f - coef; - } else { - // Linearly targeting Value = 0 - const float coef = (newLum - lum) / lum ; - dV = v * coef; - } - Color::hsv2rgbdcp(h, s, v + dV, r, g, b); - - setUnlessOOG(ir, ig, ib, r, g, b); -} - } #undef CLIPI - -#endif diff --git a/rtengine/dcp.cc b/rtengine/dcp.cc index 8127ebfcb..11fe306b8 100644 --- a/rtengine/dcp.cc +++ b/rtengine/dcp.cc @@ -21,22 +21,22 @@ #include #include #include +#include +#include +#include #include "dcp.h" #include "cJSON.h" +#include "color.h" #include "iccmatrices.h" #include "iccstore.h" -#include "improcfun.h" +#include "imagefloat.h" #include "rawimagesource.h" #include "rt_math.h" - -namespace rtengine -{ - -extern const Settings* settings; - -} +#include "utils.h" +#include "../rtexif/rtexif.h" +#include "../rtgui/options.h" using namespace rtengine; using namespace rtexif; @@ -432,7 +432,7 @@ std::map getAliases(const Glib::ustring& profile_dir) } -struct DCPProfile::ApplyState::Data { +struct DCPProfileApplyState::Data { float pro_photo[3][3]; float work[3][3]; bool already_pro_photo; @@ -441,14 +441,12 @@ struct DCPProfile::ApplyState::Data { float bl_scale; }; -DCPProfile::ApplyState::ApplyState() : +DCPProfileApplyState::DCPProfileApplyState() : data(new Data{}) { } -DCPProfile::ApplyState::~ApplyState() -{ -} +DCPProfileApplyState::~DCPProfileApplyState() = default; DCPProfile::DCPProfile(const Glib::ustring& filename) : has_color_matrix_1(false), @@ -1148,7 +1146,7 @@ void DCPProfile::apply( } } -void DCPProfile::setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, ApplyState& as_out) +void DCPProfile::setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, DCPProfileApplyState& as_out) { as_out.data->use_tone_curve = use_tone_curve; as_out.data->apply_look_table = apply_look_table; @@ -1192,7 +1190,7 @@ void DCPProfile::setStep2ApplyState(const Glib::ustring& working_space, bool use } } -void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int height, int tile_width, const ApplyState& as_in) const +void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int height, int tile_width, const DCPProfileApplyState& as_in) const { #define FCLIP(a) ((a)>0.0?((a)<65535.5?(a):65535.5):0.0) @@ -1868,7 +1866,7 @@ DCPProfile* DCPStore::getProfile(const Glib::ustring& filename) const if (res->isValid()) { // Add profile profile_cache[key] = res; - if (options.rtSettings.verbose) { + if (settings->verbose) { printf("DCP profile '%s' loaded from disk\n", filename.c_str()); } return res; diff --git a/rtengine/dcp.h b/rtengine/dcp.h index 826f073a5..573349348 100644 --- a/rtengine/dcp.h +++ b/rtengine/dcp.h @@ -24,35 +24,23 @@ #include #include -#include +#include #include "../rtgui/threadutils.h" -#include "imagefloat.h" #include "curves.h" -#include "colortemp.h" #include "noncopyable.h" namespace rtengine { +class ColorTemp; +class Imagefloat; +class DCPProfileApplyState; + class DCPProfile final { public: - class ApplyState final - { - public: - ApplyState(); - ~ApplyState(); - - private: - struct Data; - - const std::unique_ptr data; - - friend class DCPProfile; - }; - struct Illuminants { short light_source_1; short light_source_2; @@ -86,8 +74,8 @@ public: const Matrix& cam_wb_matrix, bool apply_hue_sat_map = true ) const; - void setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, ApplyState& as_out); - void step2ApplyTile(float* r, float* g, float* b, int width, int height, int tile_width, const ApplyState& as_in) const; + void setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, DCPProfileApplyState& as_out); + void step2ApplyTile(float* r, float* g, float* b, int width, int height, int tile_width, const DCPProfileApplyState& as_in) const; private: struct HsbModify { @@ -148,6 +136,20 @@ private: AdobeToneCurve tone_curve; }; +class DCPProfileApplyState final +{ +public: + DCPProfileApplyState(); + ~DCPProfileApplyState(); + +private: + struct Data; + + const std::unique_ptr data; + + friend class DCPProfile; +}; + class DCPStore final : public NonCopyable { diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ef209118b..ae6f60cd1 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -26,12 +26,13 @@ /*RT*/#include /*RT*/#endif +#include #include #include #include "opthelper.h" //#define BENCHMARK #include "StopWatch.h" - +#include "utils.h" #include #include @@ -2418,7 +2419,7 @@ void CLASS hasselblad_correct() void CLASS hasselblad_load_raw() { struct jhead jh; - int *back[5], diff[12]; + int diff[12]; if (!ljpeg_start (&jh, 0)) { return; @@ -2426,18 +2427,10 @@ void CLASS hasselblad_load_raw() order = 0x4949; ph1_bithuff_t ph1_bithuff(this, ifp, order); hb_bits(-1); - back[4] = (int *) calloc(raw_width, 3 * sizeof **back); - merror(back[4], "hasselblad_load_raw()"); - for (int c = 0; c < 3; ++c) { - back[c] = back[4] + c * raw_width; - } - const int sh = tiff_samples > 1; - cblack[6] >>= sh; const int shot = LIM(shot_select, 1, tiff_samples) - 1; + const int predictor_init = static_cast(0x8000 + load_flags); for (int row = 0; row < raw_height; ++row) { - for (int c = 0; c < 4; ++c) { - back[(c + 3) & 3] = back[c]; - } + int stashed_predictors[2] = {predictor_init, predictor_init}; for (int col = 0; col < raw_width; col += 2) { for (int s = 0; s < tiff_samples * 2; s += 2) { const int len[2]= { @@ -2455,18 +2448,10 @@ void CLASS hasselblad_load_raw() } } for (int s = col; s < col + 2; ++s) { - int pred; - if (col) { - pred = back[2][s - 2]; - if (row > 1 && jh.psv == 11) { - pred += back[0][s] / 2 - back[0][s - 2] / 2; - } - } else { - pred = 0x8000 + load_flags; - } + int pred = stashed_predictors[s & 1]; for (int c = 0; c < tiff_samples; ++c) { pred += diff[(s & 1) * tiff_samples + c]; - const unsigned upix = pred >> sh & 0xffff; + const unsigned upix = pred & 0xffff; if (raw_image && c == shot) { RAW(row, s) = upix; } @@ -2479,12 +2464,13 @@ void CLASS hasselblad_load_raw() *ip = c < 4 ? upix : (*ip + upix) >> 1; } } + if (c == (tiff_samples-1)) { + stashed_predictors[s & 1] = pred; + } } - back[2][s] = pred; } } } - free(back[4]); ljpeg_end(&jh); if (image) { mix_green = 1; diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index fdebda0cc..5e17b47ab 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -17,8 +17,7 @@ * along with RawTherapee. If not, see . */ -#ifndef DCRAW_H -#define DCRAW_H +#pragma once #include "myfile.h" #include @@ -168,8 +167,7 @@ protected: float cam_mul[4], pre_mul[4], cmatrix[3][4], rgb_cam[3][4]; - int histogram[4][0x2000]; - void (DCraw::*write_thumb)(), (DCraw::*write_fun)(); + void (DCraw::*write_thumb)(); void (DCraw::*load_raw)(), (DCraw::*thumb_load_raw)(); jmp_buf failure; @@ -529,6 +527,3 @@ void shiftXtransMatrix( const int offsy, const int offsx) { void nikon_14bit_load_raw(); // ported from LibRaw }; - - -#endif //DCRAW_H diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 4a7bf3312..edaa94d5d 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -17,12 +17,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include "cieimage.h" #include "curves.h" +#include "dcp.h" #include "dcrop.h" +#include "image8.h" +#include "imagefloat.h" +#include "labimage.h" #include "mytime.h" #include "procparams.h" #include "refreshmap.h" #include "rt_math.h" +#include "color.h" #include "../rtgui/editcallbacks.h" #include "guidedfilter.h" @@ -41,8 +48,6 @@ constexpr T skips(T a, T b) namespace rtengine { -extern const Settings* settings; - Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) : PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), cropImg(nullptr), transCrop(nullptr), cieCrop(nullptr), @@ -826,7 +831,7 @@ void Crop::update(int todo) } double rrm, ggm, bbm; - DCPProfile::ApplyState as; + DCPProfileApplyState as; DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as); LUTu histToneCurve; diff --git a/rtengine/dcrop.h b/rtengine/dcrop.h index 6ce034f3f..c65c1e72f 100644 --- a/rtengine/dcrop.h +++ b/rtengine/dcrop.h @@ -21,8 +21,6 @@ #include "improccoordinator.h" #include "rtengine.h" #include "improcfun.h" -#include "image8.h" -#include "image16.h" #include "imagesource.h" #include "procevents.h" #include "pipettebuffer.h" @@ -31,6 +29,8 @@ namespace rtengine { +class Image8; + using namespace procparams; class ImProcCoordinator; diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 51db8bb3f..d547d3431 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -22,12 +22,10 @@ #include "rawimagesource.h" #include "rawimage.h" #include "mytime.h" -#include "image8.h" #include "rt_math.h" #include "color.h" #include "../rtgui/multilangmgr.h" -#include "procparams.h" -#include "sleef.c" +#include "sleef.h" #include "opthelper.h" #include "median.h" //#define BENCHMARK @@ -41,8 +39,6 @@ using namespace std; namespace rtengine { -extern const Settings* settings; - #undef ABS #define ABS(a) ((a)<0?-(a):(a)) @@ -59,158 +55,7 @@ extern const Settings* settings; #define FORCC for (unsigned int c=0; c < colors; c++) -/* - Patterned Pixel Grouping Interpolation by Alain Desbiolles -*/ -void RawImageSource::ppg_demosaic() -{ - int width = W, height = H; - int dir[5] = { 1, width, -1, -width, 1 }; - int row, col, diff[2] = {}, guess[2], c, d, i; - float (*pix)[4]; - - float (*image)[4]; - - if (plistener) { - // looks like ppg isn't supported anymore - //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::ppg))); - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), M("GENERAL_NA"))); - plistener->setProgress (0.0); - } - - image = (float (*)[4]) calloc (H * W, sizeof * image); - - for (int ii = 0; ii < H; ii++) - for (int jj = 0; jj < W; jj++) { - image[ii * W + jj][fc(ii, jj)] = rawData[ii][jj]; - } - - border_interpolate(3, image); - - /* Fill in the green layer with gradients and pattern recognition: */ - for (row = 3; row < height - 3; row++) { - for (col = 3 + (FC(row, 3) & 1), c = FC(row, col); col < width - 3; col += 2) { - pix = image + row * width + col; - - for (i = 0; (d = dir[i]) > 0; i++) { - guess[i] = (pix[-d][1] + pix[0][c] + pix[d][1]) * 2 - - pix[-2 * d][c] - pix[2 * d][c]; - diff[i] = ( ABS(pix[-2 * d][c] - pix[ 0][c]) + - ABS(pix[ 2 * d][c] - pix[ 0][c]) + - ABS(pix[ -d][1] - pix[ d][1]) ) * 3 + - ( ABS(pix[ 3 * d][1] - pix[ d][1]) + - ABS(pix[-3 * d][1] - pix[-d][1]) ) * 2; - } - - d = dir[i = diff[0] > diff[1]]; - pix[0][1] = median(static_cast(guess[i] >> 2), pix[d][1], pix[-d][1]); - } - - if(plistener) { - plistener->setProgress(0.33 * row / (height - 3)); - } - } - - /* Calculate red and blue for each green pixel: */ - for (row = 1; row < height - 1; row++) { - for (col = 1 + (FC(row, 2) & 1), c = FC(row, col + 1); col < width - 1; col += 2) { - pix = image + row * width + col; - - for (i = 0; (d = dir[i]) > 0; c = 2 - c, i++) - pix[0][c] = CLIP(0.5 * (pix[-d][c] + pix[d][c] + 2 * pix[0][1] - - pix[-d][1] - pix[d][1]) ); - } - - if(plistener) { - plistener->setProgress(0.33 + 0.33 * row / (height - 1)); - } - } - - /* Calculate blue for red pixels and vice versa: */ - for (row = 1; row < height - 1; row++) { - for (col = 1 + (FC(row, 1) & 1), c = 2 - FC(row, col); col < width - 1; col += 2) { - pix = image + row * width + col; - - for (i = 0; (d = dir[i] + dir[i + 1]) > 0; i++) { - diff[i] = ABS(pix[-d][c] - pix[d][c]) + - ABS(pix[-d][1] - pix[0][1]) + - ABS(pix[ d][1] - pix[0][1]); - guess[i] = pix[-d][c] + pix[d][c] + 2 * pix[0][1] - - pix[-d][1] - pix[d][1]; - } - - if (diff[0] != diff[1]) { - pix[0][c] = CLIP(guess[diff[0] > diff[1]] / 2); - } else { - pix[0][c] = CLIP((guess[0] + guess[1]) / 4); - } - } - - if(plistener) { - plistener->setProgress(0.67 + 0.33 * row / (height - 1)); - } - } - - red(W, H); - - for (int i = 0; i < H; i++) - for (int j = 0; j < W; j++) { - red[i][j] = image[i * W + j][0]; - } - - green(W, H); - - for (int i = 0; i < H; i++) - for (int j = 0; j < W; j++) { - green[i][j] = image[i * W + j][1]; - } - - blue(W, H); - - for (int i = 0; i < H; i++) - for (int j = 0; j < W; j++) { - blue[i][j] = image[i * W + j][2]; - } - - free (image); -} - -void RawImageSource::border_interpolate(unsigned int border, float (*image)[4], unsigned int start, unsigned int end) -{ - unsigned row, col, y, x, f; - float sum[8]; - unsigned int width = W, height = H; - unsigned int colors = 3; - - if (end == 0 ) { - end = H; - } - - for (row = start; row < end; row++) - for (col = 0; col < width; col++) { - if (col == border && row >= border && row < height - border) { - col = width - border; - } - - memset (sum, 0, sizeof sum); - - for (y = row - 1; y != row + 2; y++) - for (x = col - 1; x != col + 2; x++) - if (y < height && x < width) { - f = fc(y, x); - sum[f] += image[y * width + x][f]; - sum[f + 4]++; - } - - f = fc(row, col); - - FORCC if (c != f && sum[c + 4]) { - image[row * width + col][c] = sum[c] / sum[c + 4]; - } - } -} - -void RawImageSource::border_interpolate2( int winw, int winh, int lborders, const array2D &rawData, array2D &red, array2D &green, array2D &blue) +void RawImageSource::border_interpolate( int winw, int winh, int lborders, const array2D &rawData, array2D &red, array2D &green, array2D &blue) { int bord = lborders; int width = winw; @@ -365,129 +210,6 @@ void RawImageSource::border_interpolate2( int winw, int winh, int lborders, cons } -// Joint Demosaicing and Denoising using High Order Interpolation Techniques -// Revision 0.9.1a - 09/02/2010 - Contact info: luis.sanz.rodriguez@gmail.com -// Copyright Luis Sanz Rodriguez 2010 -// Adapted to RawTherapee by Jacques Desmis 3/2013 - -void RawImageSource::jdl_interpolate_omp() // from "Lassus" -{ - int width = W, height = H; - int row, col, c, d, i, u = width, v = 2 * u, w = 3 * u, x = 4 * u, y = 5 * u, z = 6 * u, indx, (*dif)[2], (*chr)[2]; - float f[4], g[4]; - float (*image)[4]; - image = (float (*)[4]) calloc (width * height, sizeof * image); - dif = (int (*)[2]) calloc(width * height, sizeof * dif); - chr = (int (*)[2]) calloc(width * height, sizeof * chr); - - if (plistener) { - // this function seems to be unused - //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::jdl))); - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), M("GENERAL_NA"))); - plistener->setProgress (0.0); - } - -#ifdef _OPENMP - #pragma omp parallel shared(image,width,height,u,w,v,y,x,z,dif,chr) private(row,col,f,g,indx,c,d,i) -#endif - { -#ifdef _OPENMP - #pragma omp for -#endif - - for (int ii = 0; ii < height; ii++) - for (int jj = 0; jj < width; jj++) { - image[ii * width + jj][fc(ii, jj)] = rawData[ii][jj]; - } - - border_interpolate(6, image); - -#ifdef _OPENMP - #pragma omp for -#endif - - for (row = 5; row < height - 5; row++) - for (col = 5 + (FC(row, 1) & 1), indx = row * width + col, c = FC(row, col); col < u - 5; col += 2, indx += 2) { - f[0] = 1.f + abs(image[indx - u][1] - image[indx - w][1]) + abs(image[indx - u][1] - image[indx + u][1]) + abs(image[indx][c] - image[indx - v][c]) + abs(image[indx - v][c] - image[indx - x][c]); - f[1] = 1.f + abs(image[indx + 1][1] - image[indx + 3][1]) + abs(image[indx + 1][1] - image[indx - 1][1]) + abs(image[indx][c] - image[indx + 2][c]) + abs(image[indx + 2][c] - image[indx + 4][c]); - f[2] = 1.f + abs(image[indx - 1][1] - image[indx - 3][1]) + abs(image[indx - 1][1] - image[indx + 1][1]) + abs(image[indx][c] - image[indx - 2][c]) + abs(image[indx - 2][c] - image[indx - 4][c]); - f[3] = 1.f + abs(image[indx + u][1] - image[indx + w][1]) + abs(image[indx + u][1] - image[indx - u][1]) + abs(image[indx][c] - image[indx + v][c]) + abs(image[indx + v][c] - image[indx + x][c]); - g[0] = CLIP((22.f * image[indx - u][1] + 22.f * image[indx - w][1] + 2.f * image[indx - y][1] + 2.f * image[indx + u][1] + 40.f * image[indx][c] - 32.f * image[indx - v][c] - 8.f * image[indx - x][c]) / 48.f); - g[1] = CLIP((22.f * image[indx + 1][1] + 22.f * image[indx + 3][1] + 2.f * image[indx + 5][1] + 2.f * image[indx - 1][1] + 40.f * image[indx][c] - 32.f * image[indx + 2][c] - 8.f * image[indx + 4][c]) / 48.f); - g[2] = CLIP((22.f * image[indx - 1][1] + 22.f * image[indx - 3][1] + 2.f * image[indx - 5][1] + 2.f * image[indx + 1][1] + 40.f * image[indx][c] - 32.f * image[indx - 2][c] - 8.f * image[indx - 4][c]) / 48.f); - g[3] = CLIP((22.f * image[indx + u][1] + 22.f * image[indx + w][1] + 2.f * image[indx + y][1] + 2.f * image[indx - u][1] + 40.f * image[indx][c] - 32.f * image[indx + v][c] - 8.f * image[indx + x][c]) / 48.f); - dif[indx][0] = CLIP((f[3] * g[0] + f[0] * g[3]) / (f[0] + f[3])) - image[indx][c]; - dif[indx][1] = CLIP((f[2] * g[1] + f[1] * g[2]) / (f[1] + f[2])) - image[indx][c]; - } - -#ifdef _OPENMP - #pragma omp for -#endif - - for (row = 6; row < height - 6; row++) - for (col = 6 + (FC(row, 2) & 1), indx = row * width + col, c = FC(row, col) / 2; col < u - 6; col += 2, indx += 2) { - f[0] = 1.f + 78.f * SQR((float)dif[indx][0]) + 69.f * (SQR((float) dif[indx - v][0]) + SQR((float)dif[indx + v][0])) + 51.f * (SQR((float)dif[indx - x][0]) + SQR((float)dif[indx + x][0])) + 21.f * (SQR((float)dif[indx - z][0]) + SQR((float)dif[indx + z][0])) - 6.f * SQR((float)dif[indx - v][0] + dif[indx][0] + dif[indx + v][0]) - 10.f * (SQR((float)dif[indx - x][0] + dif[indx - v][0] + dif[indx][0]) + SQR((float)dif[indx][0] + dif[indx + v][0] + dif[indx + x][0])) - 7.f * (SQR((float)dif[indx - z][0] + dif[indx - x][0] + dif[indx - v][0]) + SQR((float)dif[indx + v][0] + dif[indx + x][0] + dif[indx + z][0])); - f[1] = 1.f + 78.f * SQR((float)dif[indx][1]) + 69.f * (SQR((float)dif[indx - 2][1]) + SQR((float)dif[indx + 2][1])) + 51.f * (SQR((float)dif[indx - 4][1]) + SQR((float)dif[indx + 4][1])) + 21.f * (SQR((float)dif[indx - 6][1]) + SQR((float)dif[indx + 6][1])) - 6.f * SQR((float)dif[indx - 2][1] + dif[indx][1] + dif[indx + 2][1]) - 10.f * (SQR((float)dif[indx - 4][1] + dif[indx - 2][1] + dif[indx][1]) + SQR((float)dif[indx][1] + dif[indx + 2][1] + dif[indx + 4][1])) - 7.f * (SQR((float)dif[indx - 6][1] + dif[indx - 4][1] + dif[indx - 2][1]) + SQR((float)dif[indx + 2][1] + dif[indx + 4][1] + dif[indx + 6][1])); - g[0] = median(0.725f * dif[indx][0] + 0.1375f * dif[indx - v][0] + 0.1375f * dif[indx + v][0], static_cast(dif[indx - v][0]), static_cast(dif[indx + v][0])); - g[1] = median(0.725f * dif[indx][1] + 0.1375f * dif[indx - 2][1] + 0.1375f * dif[indx + 2][1], static_cast(dif[indx - 2][1]), static_cast(dif[indx + 2][1])); - chr[indx][c] = (f[1] * g[0] + f[0] * g[1]) / (f[0] + f[1]); - } - -#ifdef _OPENMP - #pragma omp for -#endif - - for (row = 6; row < height - 6; row++) - for (col = 6 + (FC(row, 2) & 1), indx = row * width + col, c = 1 - FC(row, col) / 2, d = 2 * c; col < u - 6; col += 2, indx += 2) { - f[0] = 1.f / (float)(1.f + fabs((float)chr[indx - u - 1][c] - chr[indx + u + 1][c]) + fabs((float)chr[indx - u - 1][c] - chr[indx - w - 3][c]) + fabs((float)chr[indx + u + 1][c] - chr[indx - w - 3][c])); - f[1] = 1.f / (float)(1.f + fabs((float)chr[indx - u + 1][c] - chr[indx + u - 1][c]) + fabs((float)chr[indx - u + 1][c] - chr[indx - w + 3][c]) + fabs((float)chr[indx + u - 1][c] - chr[indx - w + 3][c])); - f[2] = 1.f / (float)(1.f + fabs((float)chr[indx + u - 1][c] - chr[indx - u + 1][c]) + fabs((float)chr[indx + u - 1][c] - chr[indx + w + 3][c]) + fabs((float)chr[indx - u + 1][c] - chr[indx + w - 3][c])); - f[3] = 1.f / (float)(1.f + fabs((float)chr[indx + u + 1][c] - chr[indx - u - 1][c]) + fabs((float)chr[indx + u + 1][c] - chr[indx + w - 3][c]) + fabs((float)chr[indx - u - 1][c] - chr[indx + w + 3][c])); - g[0] = median(chr[indx - u - 1][c], chr[indx - w - 1][c], chr[indx - u - 3][c]); - g[1] = median(chr[indx - u + 1][c], chr[indx - w + 1][c], chr[indx - u + 3][c]); - g[2] = median(chr[indx + u - 1][c], chr[indx + w - 1][c], chr[indx + u - 3][c]); - g[3] = median(chr[indx + u + 1][c], chr[indx + w + 1][c], chr[indx + u + 3][c]); - chr[indx][c] = (f[0] * g[0] + f[1] * g[1] + f[2] * g[2] + f[3] * g[3]) / (f[0] + f[1] + f[2] + f[3]); - image[indx][1] = CLIP(image[indx][2 - d] + chr[indx][1 - c]); - image[indx][d] = CLIP(image[indx][1] - chr[indx][c]); - } - -#ifdef _OPENMP - #pragma omp for -#endif - - for (row = 6; row < height - 6; row++) - for (col = 6 + (FC(row, 1) & 1), indx = row * width + col, c = FC(row, col + 1) / 2, d = 2 * c; col < u - 6; col += 2, indx += 2) - for(i = 0; i <= 1; c = 1 - c, d = 2 * c, i++) { - f[0] = 1.f / (float)(1.f + fabs((float)chr[indx - u][c] - chr[indx + u][c]) + fabs((float)chr[indx - u][c] - chr[indx - w][c]) + fabs((float)chr[indx + u][c] - chr[indx - w][c])); - f[1] = 1.f / (float)(1.f + fabs((float)chr[indx + 1][c] - chr[indx - 1][c]) + fabs((float)chr[indx + 1][c] - chr[indx + 3][c]) + fabs((float)chr[indx - 1][c] - chr[indx + 3][c])); - f[2] = 1.f / (float)(1.f + fabs((float)chr[indx - 1][c] - chr[indx + 1][c]) + fabs((float)chr[indx - 1][c] - chr[indx - 3][c]) + fabs((float)chr[indx + 1][c] - chr[indx - 3][c])); - f[3] = 1.f / (float)(1.f + fabs((float)chr[indx + u][c] - chr[indx - u][c]) + fabs((float)chr[indx + u][c] - chr[indx + w][c]) + fabs((float)chr[indx - u][c] - chr[indx + w][c])); - g[0] = 0.875f * chr[indx - u][c] + 0.125f * chr[indx - w][c]; - g[1] = 0.875f * chr[indx + 1][c] + 0.125f * chr[indx + 3][c]; - g[2] = 0.875f * chr[indx - 1][c] + 0.125f * chr[indx - 3][c]; - g[3] = 0.875f * chr[indx + u][c] + 0.125f * chr[indx + w][c]; - image[indx][d] = CLIP(image[indx][1] - (f[0] * g[0] + f[1] * g[1] + f[2] * g[2] + f[3] * g[3]) / (f[0] + f[1] + f[2] + f[3])); - } - -#ifdef _OPENMP - #pragma omp for -#endif - - for (int ii = 0; ii < height; ii++) { - for (int jj = 0; jj < width; jj++) { - red[ii][jj] = CLIP(image[ii * width + jj][0]); - green[ii][jj] = CLIP(image[ii * width + jj][1]); - blue[ii][jj] = CLIP(image[ii * width + jj][2]); - } - } - } // End of parallelization - free (image); - free(dif); - free(chr); - //RawImageSource::refinement_lassus(); -} - // LSMME demosaicing algorithm // L. Zhang and X. Wu, // Color demozaicing via directional Linear Minimum Mean Square-error Estimation, @@ -543,14 +265,14 @@ void RawImageSource::lmmse_interpolate_omp(int winw, int winh, array2D &r float *rix[5]; float *qix[5]; - float *buffer = (float *)calloc(rr1 * cc1 * 5 * sizeof(float), 1); + float *buffer = (float *)calloc(static_cast(rr1) * cc1 * 5 * sizeof(float), 1); if(buffer == nullptr) { // allocation of big block of memory failed, try to get 5 smaller ones printf("lmmse_interpolate_omp: allocation of big memory block failed, try to get 5 smaller ones now...\n"); bool allocationFailed = false; for(int i = 0; i < 5; i++) { - qix[i] = (float *)calloc(rr1 * cc1 * sizeof(float), 1); + qix[i] = (float *)calloc(static_cast(rr1) * cc1 * sizeof(float), 1); if(!qix[i]) { // allocation of at least one small block failed allocationFailed = true; @@ -1145,7 +867,7 @@ void RawImageSource::igv_interpolate(int winw, int winh) vdif = (float (*)) calloc( width * height / 2, sizeof * vdif ); hdif = (float (*)) calloc( width * height / 2, sizeof * hdif ); - chrarray = (float (*)) calloc( width * height, sizeof( float ) ); + chrarray = (float (*)) calloc(static_cast(width) * height, sizeof( float ) ); chr[0] = chrarray; chr[1] = chrarray + (width * height) / 2; @@ -1507,7 +1229,7 @@ void RawImageSource::igv_interpolate(int winw, int winh) } } }// End of parallelization - border_interpolate2(winw, winh, 8, rawData, red, green, blue); + border_interpolate(winw, winh, 8, rawData, red, green, blue); if (plistener) { plistener->setProgress (1.0); @@ -1564,8 +1286,6 @@ void RawImageSource::igv_interpolate(int winw, int winh) rgb[c][indx] = CLIP(rawData[row][col]); //rawData = RT data } -// border_interpolate2(7, rgb); - #ifdef _OPENMP #pragma omp single #endif @@ -1740,9 +1460,6 @@ void RawImageSource::igv_interpolate(int winw, int winh) if (plistener) { plistener->setProgress (0.91); } - - //Interpolate borders -// border_interpolate2(7, rgb); } /* #ifdef _OPENMP @@ -1770,7 +1487,7 @@ void RawImageSource::igv_interpolate(int winw, int winh) blue [row][col] = CLIP(rgb[1][indx] - 65535.f * chr[1][indx]); } }// End of parallelization - border_interpolate2(winw, winh, 8, rawData, red, green, blue); + border_interpolate(winw, winh, 8, rawData, red, green, blue); if (plistener) { @@ -2040,7 +1757,7 @@ void RawImageSource::refinement_lassus(int PassCount) t1e.set(); int u = W, v = 2 * u, w = 3 * u, x = 4 * u, y = 5 * u; float (*image)[3]; - image = (float(*)[3]) calloc(W * H, sizeof * image); + image = (float(*)[3]) calloc(static_cast(W) * H, sizeof * image); #ifdef _OPENMP #pragma omp parallel shared(image) #endif @@ -2813,7 +2530,7 @@ BENCHFUN free(buffer0); } - border_interpolate2(W, H, 1, rawData, red, green, blue); + border_interpolate(W, H, 1, rawData, red, green, blue); if(plistener) { plistener->setProgress (1.0); } diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc index 4877aacd8..1fb1d2e1b 100644 --- a/rtengine/dfmanager.cc +++ b/rtengine/dfmanager.cc @@ -16,23 +16,27 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "dfmanager.h" -#include "../rtgui/options.h" -#include -#include "../rtgui/guiutils.h" -#include "rawimage.h" + #include #include #include -#include "imagedata.h" +#include #include +#include "dfmanager.h" +#include "../rtgui/options.h" +#include "rawimage.h" +#include "imagedata.h" +#include "utils.h" + namespace rtengine { -extern const Settings* settings; - // *********************** class dfInfo ************************************** +dfInfo::~dfInfo() +{ + delete ri; +} inline dfInfo& dfInfo::operator =(const dfInfo &o) { diff --git a/rtengine/dfmanager.h b/rtengine/dfmanager.h index 23ca97d14..216dcfc53 100644 --- a/rtengine/dfmanager.h +++ b/rtengine/dfmanager.h @@ -19,17 +19,18 @@ #pragma once #include +#include #include #include #include #include "pixelsmap.h" -#include "rawimage.h" namespace rtengine { +class RawImage; class dfInfo { public: @@ -48,13 +49,7 @@ public: dfInfo( const dfInfo &o) : pathname(o.pathname), maker(o.maker), model(o.model), iso(o.iso), shutter(o.shutter), timestamp(o.timestamp), ri(nullptr) {} - ~dfInfo() - { - if( ri ) { - delete ri; - } - } - + ~dfInfo(); dfInfo &operator =(const dfInfo &o); bool operator <(const dfInfo &e2) const; diff --git a/rtengine/diagonalcurvetypes.h b/rtengine/diagonalcurvetypes.h new file mode 100644 index 000000000..0d304957a --- /dev/null +++ b/rtengine/diagonalcurvetypes.h @@ -0,0 +1,31 @@ +/* + * This file is part of RawTherapee. + * + * Copyright (c) 2004-2019 Gabor Horvath + * + * 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 . +*/ +#pragma once + +// For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget +enum DiagonalCurveType { + DCT_Empty = -1, // Also used for identity curves + DCT_Linear, // 0 + DCT_Spline, // 1 + DCT_Parametric, // 2 + DCT_NURBS, // 3 + DCT_CatumullRom, // 4 + // Insert new curve type above this line + DCT_Unchanged // Must remain the last of the enum +}; diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index e822d8492..1f62badcb 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -18,12 +18,18 @@ * */ -#include +#include #include -#include "improcfun.h" +#include + #include "array2D.h" -#include "rt_math.h" +#include "cieimage.h" +#include "color.h" +#include "improcfun.h" +#include "LUT.h" #include "opthelper.h" +#include "rt_math.h" +#include "settings.h" namespace { @@ -71,8 +77,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w float val = 0.f; float norm = 0.f; - for (int inbr = max(0, i - scalewin); inbr <= min(height - 1, i + scalewin); inbr += scale) { - for (int jnbr = max(0, j - scalewin); jnbr <= j + scalewin; jnbr += scale) { + for (int inbr = std::max(0, i - scalewin); inbr <= std::min(height - 1, i + scalewin); inbr += scale) { + for (int jnbr = std::max(0, j - scalewin); jnbr <= j + scalewin; jnbr += scale) { const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); val += dirwt * data_fine[inbr][jnbr]; norm += dirwt; @@ -105,7 +111,7 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w float val = 0.f; float norm = 0.f; - for (int inbr = max(0, i - scalewin); inbr <= min(height - 1, i + scalewin); inbr += scale) { + for (int inbr = std::max(0, i - scalewin); inbr <= std::min(height - 1, i + scalewin); inbr += scale) { for (int jnbr = j - scalewin; jnbr <= j + scalewin; jnbr += scale) { const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); val += dirwt * data_fine[inbr][jnbr]; @@ -119,8 +125,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w float val = 0.f; float norm = 0.f; - for (int inbr = max(0, i - scalewin); inbr <= min(height - 1, i + scalewin); inbr += scale) { - for (int jnbr = j - scalewin; jnbr <= min(width - 1, j + scalewin); jnbr += scale) { + for (int inbr = std::max(0, i - scalewin); inbr <= std::min(height - 1, i + scalewin); inbr += scale) { + for (int jnbr = j - scalewin; jnbr <= std::min(width - 1, j + scalewin); jnbr += scale) { const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); val += dirwt * data_fine[inbr][jnbr]; norm += dirwt; @@ -149,8 +155,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w float val = 0.f; float norm = 0.f; - for (int inbr = max(0, i - scale); inbr <= min(height - 1, i + scale); inbr += scale) { - for (int jnbr = max(0, j - scale); jnbr <= j + scale; jnbr += scale) { + for (int inbr = std::max(0, i - scale); inbr <= std::min(height - 1, i + scale); inbr += scale) { + for (int jnbr = std::max(0, j - scale); jnbr <= j + scale; jnbr += scale) { const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); val += dirwt * data_fine[inbr][jnbr]; norm += dirwt; @@ -182,7 +188,7 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w float val = 0.f; float norm = 0.f; - for (int inbr = max(0, i - scale); inbr <= min(height - 1, i + scale); inbr += scale) { + for (int inbr = std::max(0, i - scale); inbr <= std::min(height - 1, i + scale); inbr += scale) { for (int jnbr = j - scale; jnbr <= j + scale; jnbr += scale) { const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); val += dirwt * data_fine[inbr][jnbr]; @@ -196,8 +202,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w float val = 0.f; float norm = 0.f; - for (int inbr = max(0, i - scale); inbr <= min(height - 1, i + scale); inbr += scale) { - for (int jnbr = j - scale; jnbr <= min(width - 1, j + scale); jnbr += scale) { + for (int inbr = std::max(0, i - scale); inbr <= std::min(height - 1, i + scale); inbr += scale) { + for (int jnbr = j - scale; jnbr <= std::min(width - 1, j + scale); jnbr += scale) { const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); val += dirwt * data_fine[inbr][jnbr]; norm += dirwt; @@ -346,8 +352,6 @@ void idirpyr_eq_channelcam(const float * const * data_coarse, const float * cons namespace rtengine { -extern const Settings* settings; - void ImProcFunctions::dirpyr_equalizer(const float * const * src, float ** dst, int srcwidth, int srcheight, const float * const * l_a, const float * const * l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scaleprev) { //sequence of scales diff --git a/rtengine/dual_demosaic_RT.cc b/rtengine/dual_demosaic_RT.cc index 60cce506b..b5839ee8b 100644 --- a/rtengine/dual_demosaic_RT.cc +++ b/rtengine/dual_demosaic_RT.cc @@ -23,36 +23,40 @@ // //////////////////////////////////////////////////////////////// +#include "color.h" #include "jaggedarray.h" -#include "rtengine.h" -#include "rawimagesource.h" -#include "rt_math.h" #include "procparams.h" +#include "rawimagesource.h" +#include "rt_algo.h" +#include "rt_math.h" +#include "rtengine.h" + +#include "../rtgui/options.h" + //#define BENCHMARK #include "StopWatch.h" -#include "rt_algo.h" using namespace std; namespace rtengine { -void RawImageSource::dual_demosaic_RT(bool isBayer, const RAWParams &raw, int winw, int winh, const array2D &rawData, array2D &red, array2D &green, array2D &blue, double &contrast, bool autoContrast) +void RawImageSource::dual_demosaic_RT(bool isBayer, const procparams::RAWParams &raw, int winw, int winh, const array2D &rawData, array2D &red, array2D &green, array2D &blue, double &contrast, bool autoContrast) { BENCHFUN if (contrast == 0.f && !autoContrast) { // contrast == 0.0 means only first demosaicer will be used if(isBayer) { - if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4) ) { + if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4) ) { amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCBVNG4) ) { + } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBVNG4) ) { dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::RCDVNG4) ) { + } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::RCDVNG4) ) { rcd_demosaic(options.chunkSizeRCD, options.measure); } } else { - if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FOUR_PASS) ) { + if (raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::FOUR_PASS) ) { xtrans_interpolate (3, true, options.chunkSizeXT, options.measure); } else { xtrans_interpolate (1, false, options.chunkSizeXT, options.measure); @@ -70,15 +74,15 @@ void RawImageSource::dual_demosaic_RT(bool isBayer, const RAWParams &raw, int wi if (isBayer) { vng4_demosaic(rawData, redTmp, greenTmp, blueTmp); - if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4) || raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { + if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4) || raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) { amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCBVNG4) ) { + } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBVNG4) ) { dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::RCDVNG4) ) { + } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::RCDVNG4) ) { rcd_demosaic(options.chunkSizeRCD, options.measure); } } else { - if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FOUR_PASS) ) { + if (raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::FOUR_PASS) ) { xtrans_interpolate (3, true, options.chunkSizeXT, options.measure); } else { xtrans_interpolate (1, false, options.chunkSizeXT, options.measure); diff --git a/rtengine/dynamicprofile.cc b/rtengine/dynamicprofile.cc index af6ecd2ff..617ec2747 100644 --- a/rtengine/dynamicprofile.cc +++ b/rtengine/dynamicprofile.cc @@ -17,10 +17,15 @@ * along with RawTherapee. If not, see . */ -#include "../rtengine/dynamicprofile.h" +#include "dynamicprofile.h" #include #include +#include +#include + +#include "rtengine.h" +#include "../rtgui/options.h" using namespace rtengine; using namespace rtengine::procparams; @@ -176,7 +181,7 @@ bool DynamicProfileRules::loadRules() return false; } - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("loading dynamic profiles...\n"); } @@ -195,7 +200,7 @@ bool DynamicProfileRules::loadRules() return false; } - if (options.rtSettings.verbose) { + if (settings->verbose) { printf (" loading rule %d\n", serial); } @@ -225,7 +230,7 @@ bool DynamicProfileRules::loadRules() bool DynamicProfileRules::storeRules() { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("saving dynamic profiles...\n"); } diff --git a/rtengine/dynamicprofile.h b/rtengine/dynamicprofile.h index aaffc5c4f..d91b91aee 100644 --- a/rtengine/dynamicprofile.h +++ b/rtengine/dynamicprofile.h @@ -16,12 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DYNAMICPROFILE_H_ -#define _DYNAMICPROFILE_H_ +#pragma once -#include +#include #include -#include "../rtgui/options.h" + +namespace rtengine +{ + class FramesMetaData; +} class DynamicProfileRule { @@ -76,5 +79,3 @@ public: const std::vector &getRules(); void setRules (const std::vector &r); }; - -#endif // _DYNAMICPROFILE_H_ diff --git a/rtengine/eahd_demosaic.cc b/rtengine/eahd_demosaic.cc index aa8fdf485..c470eb297 100644 --- a/rtengine/eahd_demosaic.cc +++ b/rtengine/eahd_demosaic.cc @@ -20,14 +20,13 @@ #include #include "color.h" +#include "rawimage.h" #include "rawimagesource.h" #include "rawimagesource_i.h" #include "jaggedarray.h" -#include "rawimage.h" #include "iccmatrices.h" #include "rt_math.h" #include "../rtgui/multilangmgr.h" -#include "procparams.h" //#define BENCHMARK #include "StopWatch.h" diff --git a/rtengine/fast_demo.cc b/rtengine/fast_demo.cc index a40f107af..aaa5ceb02 100644 --- a/rtengine/fast_demo.cc +++ b/rtengine/fast_demo.cc @@ -25,12 +25,18 @@ #include #include "rawimagesource.h" #include "../rtgui/multilangmgr.h" -#include "procparams.h" #include "opthelper.h" using namespace std; using namespace rtengine; +namespace +{ +unsigned fc(const unsigned int cfa[2][2], int r, int c) { + return cfa[r & 1][c & 1]; +} +} + #define TS 224 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -67,6 +73,7 @@ void RawImageSource::fast_demosaic() } + const unsigned int cfarray[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}}; const int bord = 5; float clip_pt = 4 * 65535 * initialGain; @@ -117,12 +124,12 @@ void RawImageSource::fast_demosaic() for (int i1 = imin; i1 < imax; i1++) for (int j1 = jmin; j1 < j + 2; j1++) { - int c = FC(i1, j1); + int c = fc(cfarray, i1, j1); sum[c] += rawData[i1][j1]; sum[c + 3]++; } - int c = FC(i, j); + int c = fc(cfarray, i, j); if (c == 1) { red[i][j] = sum[0] / sum[3]; @@ -150,12 +157,12 @@ void RawImageSource::fast_demosaic() for (int i1 = imin; i1 < imax; i1++) for (int j1 = j - 1; j1 < jmax; j1++) { - int c = FC(i1, j1); + int c = fc(cfarray, i1, j1); sum[c] += rawData[i1][j1]; sum[c + 3]++; } - int c = FC(i, j); + int c = fc(cfarray, i, j); if (c == 1) { red[i][j] = sum[0] / sum[3]; @@ -193,12 +200,12 @@ void RawImageSource::fast_demosaic() for (int i1 = max(0, i - 1); i1 < i + 2; i1++) for (int j1 = j - 1; j1 < j + 2; j1++) { - int c = FC(i1, j1); + int c = fc(cfarray, i1, j1); sum[c] += rawData[i1][j1]; sum[c + 3]++; } - int c = FC(i, j); + int c = fc(cfarray, i, j); if (c == 1) { red[i][j] = sum[0] / sum[3]; @@ -224,12 +231,12 @@ void RawImageSource::fast_demosaic() for (int i1 = i - 1; i1 < min(i + 2, H); i1++) for (int j1 = j - 1; j1 < j + 2; j1++) { - int c = FC(i1, j1); + int c = fc(cfarray, i1, j1); sum[c] += rawData[i1][j1]; sum[c + 3]++; } - int c = FC(i, j); + int c = fc(cfarray, i, j); if (c == 1) { red[i][j] = sum[0] / sum[3]; @@ -282,7 +289,7 @@ void RawImageSource::fast_demosaic() vmask selmask; vmask andmask = _mm_set_epi32( 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff ); - if(FC(top, left) == 1) { + if(fc(cfarray, top, left) == 1) { selmask = _mm_set_epi32( 0, 0xffffffff, 0, 0xffffffff ); } else { selmask = _mm_set_epi32( 0xffffffff, 0, 0xffffffff, 0 ); @@ -312,7 +319,7 @@ void RawImageSource::fast_demosaic() for (; j < right; j++, cc++) { - if (FC(i, j) == 1) { + if (fc(cfarray, i, j) == 1) { greentile[rr * TS + cc] = rawData[i][j]; } else { @@ -333,7 +340,7 @@ void RawImageSource::fast_demosaic() #else for (int j = left, cc = 0; j < right; j++, cc++) { - if (FC(i, j) == 1) { + if (fc(cfarray, i, j) == 1) { greentile[rr * TS + cc] = rawData[i][j]; } else { //compute directional weights using image gradients @@ -359,7 +366,7 @@ void RawImageSource::fast_demosaic() #endif for (int i = top + 1, rr = 1; i < bottom - 1; i++, rr++) { - if (FC(i, left + (FC(i, 2) & 1) + 1) == 0) + if (fc(cfarray, i, left + (fc(cfarray, i, 2) & 1) + 1) == 0) #ifdef __SSE2__ for (int j = left + 1, cc = 1; j < right - 1; j += 4, cc += 4) { //interpolate B/R colors at R/B sites @@ -369,7 +376,7 @@ void RawImageSource::fast_demosaic() #else - for (int cc = (FC(i, 2) & 1) + 1, j = left + cc; j < right - 1; j += 2, cc += 2) { + for (int cc = (fc(cfarray, i, 2) & 1) + 1, j = left + cc; j < right - 1; j += 2, cc += 2) { //interpolate B/R colors at R/B sites bluetile[rr * TS + cc] = greentile[rr * TS + cc] - 0.25f * ((greentile[(rr - 1) * TS + (cc - 1)] + greentile[(rr - 1) * TS + (cc + 1)] + greentile[(rr + 1) * TS + cc + 1] + greentile[(rr + 1) * TS + cc - 1]) - min(clip_pt, rawData[i - 1][j - 1] + rawData[i - 1][j + 1] + rawData[i + 1][j + 1] + rawData[i + 1][j - 1])); @@ -386,7 +393,7 @@ void RawImageSource::fast_demosaic() #else - for (int cc = (FC(i, 2) & 1) + 1, j = left + cc; j < right - 1; j += 2, cc += 2) { + for (int cc = (fc(cfarray, i, 2) & 1) + 1, j = left + cc; j < right - 1; j += 2, cc += 2) { //interpolate B/R colors at R/B sites redtile[rr * TS + cc] = greentile[rr * TS + cc] - 0.25f * ((greentile[(rr - 1) * TS + cc - 1] + greentile[(rr - 1) * TS + cc + 1] + greentile[(rr + 1) * TS + cc + 1] + greentile[(rr + 1) * TS + cc - 1]) - min(clip_pt, rawData[i - 1][j - 1] + rawData[i - 1][j + 1] + rawData[i + 1][j + 1] + rawData[i + 1][j - 1])); @@ -405,7 +412,7 @@ void RawImageSource::fast_demosaic() for (int i = top + 2, rr = 2; i < bottom - 2; i++, rr++) { #ifdef __SSE2__ - for (int cc = 2 + (FC(i, 2) & 1), j = left + cc; j < right - 2; j += 4, cc += 4) { + for (int cc = 2 + (fc(cfarray, i, 2) & 1), j = left + cc; j < right - 2; j += 4, cc += 4) { // no need to take care about the borders of the tile. There's enough free space. //interpolate R and B colors at G sites greenv = LVFU(greentile[rr * TS + cc]); @@ -429,7 +436,7 @@ void RawImageSource::fast_demosaic() #else - for (int cc = 2 + (FC(i, 2) & 1), j = left + cc; j < right - 2; j += 2, cc += 2) { + for (int cc = 2 + (fc(cfarray, i, 2) & 1), j = left + cc; j < right - 2; j += 2, cc += 2) { //interpolate R and B colors at G sites redtile[rr * TS + cc] = greentile[rr * TS + cc] - 0.25f * ((greentile[(rr - 1) * TS + cc] - redtile[(rr - 1) * TS + cc]) + (greentile[(rr + 1) * TS + cc] - redtile[(rr + 1) * TS + cc]) + (greentile[rr * TS + cc - 1] - redtile[rr * TS + cc - 1]) + (greentile[rr * TS + cc + 1] - redtile[rr * TS + cc + 1])); diff --git a/rtengine/ffmanager.cc b/rtengine/ffmanager.cc index e1a9134a8..ce60277e1 100644 --- a/rtengine/ffmanager.cc +++ b/rtengine/ffmanager.cc @@ -16,6 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include +#include + #include "ffmanager.h" #include "../rtgui/options.h" #include "rawimage.h" @@ -26,8 +30,6 @@ namespace rtengine { -extern const Settings* settings; - // *********************** class ffInfo ************************************** inline ffInfo& ffInfo::operator =(const ffInfo &o) @@ -50,6 +52,11 @@ inline ffInfo& ffInfo::operator =(const ffInfo &o) return *this; } +ffInfo::~ffInfo() +{ + delete ri; +} + bool ffInfo::operator <(const ffInfo &e2) const { if( this->maker.compare( e2.maker) >= 0 ) { diff --git a/rtengine/ffmanager.h b/rtengine/ffmanager.h index 537f8ee46..80ef5fa1c 100644 --- a/rtengine/ffmanager.h +++ b/rtengine/ffmanager.h @@ -19,16 +19,16 @@ #pragma once #include +#include #include #include #include -#include "rawimage.h" - namespace rtengine { +class RawImage; class ffInfo { public: @@ -48,13 +48,8 @@ public: ffInfo( const ffInfo &o) : pathname(o.pathname), maker(o.maker), model(o.model), lens(o.lens), aperture(o.aperture), focallength(o.focallength), timestamp(o.timestamp), ri(nullptr) {} - ~ffInfo() - { - if( ri ) { - delete ri; - } - } + ~ffInfo(); ffInfo &operator =(const ffInfo &o); bool operator <(const ffInfo &e2) const; diff --git a/rtengine/filmnegativeproc.cc b/rtengine/filmnegativeproc.cc index 4293c6b2a..1f27983ed 100644 --- a/rtengine/filmnegativeproc.cc +++ b/rtengine/filmnegativeproc.cc @@ -19,28 +19,20 @@ #include #include -#ifdef _OPENMP -#include -#endif - +#include "rawimage.h" #include "rawimagesource.h" +#include "coord.h" #include "mytime.h" #include "opthelper.h" +#include "pixelsmap.h" #include "procparams.h" #include "rt_algo.h" #include "rtengine.h" - +#include "sleef.h" //#define BENCHMARK #include "StopWatch.h" -namespace rtengine -{ - -extern const Settings* settings; - -} - namespace { @@ -98,7 +90,7 @@ bool channelsAvg( } -bool rtengine::RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, std::array& newExps) +bool rtengine::RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const procparams::FilmNegativeParams ¤tParams, std::array& newExps) { newExps = { static_cast(currentParams.redRatio * currentParams.greenExp), diff --git a/rtengine/filmnegativethumb.cc b/rtengine/filmnegativethumb.cc index 6a4da31b0..b31432a55 100644 --- a/rtengine/filmnegativethumb.cc +++ b/rtengine/filmnegativethumb.cc @@ -18,23 +18,17 @@ */ #include +#include "LUT.h" #include "rtengine.h" #include "rtthumbnail.h" #include "opthelper.h" +#include "sleef.h" #include "rt_algo.h" -#include "rtengine.h" #include "settings.h" #include "procparams.h" #define BENCHMARK #include "StopWatch.h" -namespace rtengine -{ - -extern const Settings* settings; - -} - void rtengine::Thumbnail::processFilmNegative( const procparams::ProcParams ¶ms, const Imagefloat* baseImg, diff --git a/rtgui/ilabel.h b/rtengine/flatcurvetypes.h similarity index 59% rename from rtgui/ilabel.h rename to rtengine/flatcurvetypes.h index 06da470b1..9efe0d259 100644 --- a/rtgui/ilabel.h +++ b/rtengine/flatcurvetypes.h @@ -1,7 +1,7 @@ /* * This file is part of RawTherapee. * - * Copyright (c) 2004-2010 Gabor Horvath + * Copyright (c) 2004-2019 Gabor Horvath * * 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,23 +15,15 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - */ -#ifndef _ILABEL_ -#define _ILABEL_ +*/ +#pragma once -#include - -class ILabel : public Gtk::DrawingArea -{ - - Glib::ustring label; - -public: - explicit ILabel (const Glib::ustring &lab); - bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override; - void on_realize() override; - void on_style_updated () override; +// For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget +enum FlatCurveType { + FCT_Empty = -1, // Also used for identity curves + FCT_Linear, // 0 + FCT_MinMaxCPoints, // 1 + //FCT_Parametric, // 2 + // Insert new curve type above this line + FCT_Unchanged // Must remain the last of the enum }; - -#endif - diff --git a/rtengine/gamutwarning.cc b/rtengine/gamutwarning.cc index 3fc20d43a..569ea3066 100644 --- a/rtengine/gamutwarning.cc +++ b/rtengine/gamutwarning.cc @@ -23,10 +23,14 @@ * also distributed under the GPL V3+ */ -#include "gamutwarning.h" #include -namespace rtengine { +#include "gamutwarning.h" +#include "iccstore.h" +#include "image8.h" + +namespace rtengine +{ GamutWarning::GamutWarning(cmsHPROFILE iprof, cmsHPROFILE gamutprof, RenderingIntent intent, bool gamutbpc): lab2ref(nullptr), @@ -126,5 +130,4 @@ inline void GamutWarning::mark(Image8 *image, int y, int x) image->b(y, x) = 255; } - } // namespace rtengine diff --git a/rtengine/gamutwarning.h b/rtengine/gamutwarning.h index e0aaa98d9..b940b911f 100644 --- a/rtengine/gamutwarning.h +++ b/rtengine/gamutwarning.h @@ -25,11 +25,14 @@ #pragma once -#include "iccstore.h" -#include "noncopyable.h" -#include "image8.h" +#include -namespace rtengine { +#include "noncopyable.h" + +namespace rtengine +{ + +class Image8; enum RenderingIntent : int; diff --git a/rtengine/gauss.cc b/rtengine/gauss.cc index ca330f9b9..8d9e5de38 100644 --- a/rtengine/gauss.cc +++ b/rtengine/gauss.cc @@ -16,12 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "gauss.h" -#include "rt_math.h" #include #include -#include "opthelper.h" +#include + +#include "gauss.h" + #include "boxblur.h" +#include "opthelper.h" +#include "rt_math.h" + namespace { @@ -1349,7 +1353,7 @@ template void gaussVerticalmult (T** src, T** dst, const int W, const i } #endif -template void gaussianBlurImpl(T** src, T** dst, const int W, const int H, const double sigma, T *buffer = nullptr, eGaussType gausstype = GAUSS_STANDARD, T** buffer2 = nullptr) +template void gaussianBlurImpl(T** src, T** dst, const int W, const int H, const double sigma, bool useBoxBlur, eGaussType gausstype = GAUSS_STANDARD, T** buffer2 = nullptr) { static constexpr auto GAUSS_SKIP = 0.25; static constexpr auto GAUSS_3X3_LIMIT = 0.6; @@ -1357,7 +1361,7 @@ template void gaussianBlurImpl(T** src, T** dst, const int W, const int static constexpr auto GAUSS_7X7_LIMIT = 1.15; static constexpr auto GAUSS_DOUBLE = 25.0; - if(buffer) { + if (useBoxBlur) { // special variant for very large sigma, currently only used by retinex algorithm // use iterated boxblur to approximate gaussian blur // Compute ideal averaging filter width and number of iterations @@ -1393,10 +1397,10 @@ template void gaussianBlurImpl(T** src, T** dst, const int W, const int sizes[i] = ((i < m ? wl : wu) - 1) / 2; } - rtengine::boxblur(src, dst, buffer, sizes[0], sizes[0], W, H); + rtengine::boxblur(src, dst, sizes[0], W, H, true); for(int i = 1; i < n; i++) { - rtengine::boxblur(dst, dst, buffer, sizes[i], sizes[i], W, H); + rtengine::boxblur(dst, dst, sizes[i], W, H, true); } } else { if (sigma < GAUSS_SKIP) { @@ -1532,8 +1536,8 @@ template void gaussianBlurImpl(T** src, T** dst, const int W, const int } } -void gaussianBlur(float** src, float** dst, const int W, const int H, const double sigma, float *buffer, eGaussType gausstype, float** buffer2) +void gaussianBlur(float** src, float** dst, const int W, const int H, const double sigma, bool useBoxBlur, eGaussType gausstype, float** buffer2) { - gaussianBlurImpl(src, dst, W, H, sigma, buffer, gausstype, buffer2); + gaussianBlurImpl(src, dst, W, H, sigma, useBoxBlur, gausstype, buffer2); } diff --git a/rtengine/gauss.h b/rtengine/gauss.h index b63301d2b..e226bbc13 100644 --- a/rtengine/gauss.h +++ b/rtengine/gauss.h @@ -16,11 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _GAUSS_H_ -#define _GAUSS_H_ +#pragma once enum eGaussType {GAUSS_STANDARD, GAUSS_MULT, GAUSS_DIV}; -void gaussianBlur(float** src, float** dst, const int W, const int H, const double sigma, float *buffer = nullptr, eGaussType gausstype = GAUSS_STANDARD, float** buffer2 = nullptr); - -#endif \ No newline at end of file +void gaussianBlur(float** src, float** dst, const int W, const int H, const double sigma, bool useBoxBlur = false, eGaussType gausstype = GAUSS_STANDARD, float** buffer2 = nullptr); diff --git a/rtengine/guidedfilter.cc b/rtengine/guidedfilter.cc index 159e89504..6b2adb773 100644 --- a/rtengine/guidedfilter.cc +++ b/rtengine/guidedfilter.cc @@ -29,15 +29,19 @@ * available at https://arxiv.org/abs/1505.00996 */ -#include "guidedfilter.h" #include "boxblur.h" -#include "rescale.h" +#include "guidedfilter.h" #include "imagefloat.h" +#include "rescale.h" + #define BENCHMARK #include "StopWatch.h" -namespace rtengine { -namespace { +namespace rtengine +{ + +namespace +{ int calculate_subsampling(int w, int h, int r) { @@ -60,13 +64,17 @@ int calculate_subsampling(int w, int h, int r) } // namespace - void guidedFilter(const array2D &guide, const array2D &src, array2D &dst, int r, float epsilon, bool multithread, int subsampling) { enum Op {MUL, DIVEPSILON, SUBMUL}; const auto apply = +#ifdef _OPENMP [multithread, epsilon](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void +#else + // removed multithread to fix clang warning on msys2 clang builds, which don't support OpenMp + [epsilon](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void +#endif { const int w = res.width(); const int h = res.height(); @@ -105,7 +113,7 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 [multithread](array2D &d, array2D &s, int rad) -> void { rad = LIM(rad, 0, (min(s.width(), s.height()) - 1) / 2 - 1); - boxblur(s, d, rad, s.width(), s.height(), multithread); + boxblur(static_cast(s), static_cast(d), rad, s.width(), s.height(), multithread); }; const int W = src.width(); diff --git a/rtengine/guidedfilter.h b/rtengine/guidedfilter.h index af8ed0901..d66396c6a 100644 --- a/rtengine/guidedfilter.h +++ b/rtengine/guidedfilter.h @@ -22,7 +22,8 @@ #include "array2D.h" -namespace rtengine { +namespace rtengine +{ void guidedFilter(const array2D &guide, const array2D &src, array2D &dst, int r, float epsilon, bool multithread, int subsampling=0); diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 35dd74463..697a5e3d3 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -288,8 +288,6 @@ void boxblur_resamp(const float* const* src, float** dst, float** temp, int H, i namespace rtengine { -extern const Settings* settings; - void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue) { double progress = 0.0; diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index 212b11d00..f5d16866e 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -18,23 +18,22 @@ * along with RawTherapee. If not, see . */ -#include "rawimagesource.h" -#include "rtthumbnail.h" -#include "curves.h" -#include "color.h" -#include "rt_math.h" -#include "iccstore.h" -#include "procparams.h" -#include "../rtgui/mydiagonalcurve.h" -#include "improcfun.h" -//#define BENCHMARK -#include "StopWatch.h" #include +#include "color.h" +#include "curves.h" +#include "improcfun.h" +#include "procparams.h" +#include "rawimagesource.h" +#include "rt_math.h" +#include "rtthumbnail.h" +#include "settings.h" -namespace rtengine { +//#define BENCHMARK +#include "StopWatch.h" -extern const Settings *settings; +namespace rtengine +{ namespace { diff --git a/rtengine/hphd_demosaic_RT.cc b/rtengine/hphd_demosaic_RT.cc index 0e56eae48..5e05b128e 100644 --- a/rtengine/hphd_demosaic_RT.cc +++ b/rtengine/hphd_demosaic_RT.cc @@ -18,12 +18,11 @@ */ #include +#include "rawimage.h" #include "rawimagesource.h" #include "rawimagesource_i.h" #include "jaggedarray.h" -#include "rawimage.h" #include "rt_math.h" -#include "procparams.h" #include "../rtgui/multilangmgr.h" #include "opthelper.h" //#define BENCHMARK @@ -353,7 +352,7 @@ void RawImageSource::hphd_demosaic () interpolate_row_rb_mul_pp(rawData, red[i], blue[i], green[i - 1], green[i], green[i + 1], i, 1.0, 1.0, 1.0, 0, W, 1); } - border_interpolate2(W, H, 4, rawData, red, green, blue); + border_interpolate(W, H, 4, rawData, red, green, blue); if (plistener) { plistener->setProgress(1.0); diff --git a/rtengine/iccmatrices.h b/rtengine/iccmatrices.h index 3e0d0b5d6..5b9883421 100644 --- a/rtengine/iccmatrices.h +++ b/rtengine/iccmatrices.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _ICCMATRICES_ -#define _ICCMATRICES_ +#pragma once // Bradford transform between illuminants constexpr double d65_d50[3][3] = { @@ -296,4 +295,3 @@ constexpr double d50_best[3][3] = { {-0.253000840399762, 0.0215532098817316,1.22569552576991} }; */ -#endif diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index a8d54b810..aea03664e 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -18,7 +18,9 @@ */ #include -#include +#include +#include +#include #include #ifdef WIN32 @@ -32,6 +34,7 @@ #include "iccstore.h" #include "iccmatrices.h" +#include "utils.h" #include "../rtgui/options.h" #include "../rtgui/threadutils.h" @@ -41,12 +44,6 @@ #include "cJSON.h" #define inkc_constant 0x696E6B43 -namespace rtengine -{ - -extern const Settings* settings; - -} namespace { diff --git a/rtengine/iccstore.h b/rtengine/iccstore.h index 5c76660e5..731a155bb 100644 --- a/rtengine/iccstore.h +++ b/rtengine/iccstore.h @@ -19,15 +19,14 @@ #pragma once #include +#include #include #include -#include +#include #include -#include "color.h" - namespace rtengine { diff --git a/rtengine/iimage.cc b/rtengine/iimage.cc index a1ec979a1..7548fc8bf 100644 --- a/rtengine/iimage.cc +++ b/rtengine/iimage.cc @@ -17,6 +17,7 @@ * along with RawTherapee. If not, see . */ +#include "color.h" #include "procparams.h" #include "rtengine.h" @@ -45,3 +46,7 @@ int rtengine::getCoarseBitMask( const procparams::CoarseTransformParams &coarse) return tr; } + +const LUTf& rtengine::getigammatab() { + return Color::igammatab_srgb; +} diff --git a/rtengine/iimage.h b/rtengine/iimage.h index b04b4bf9a..7309dd91f 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -16,17 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IIMAGE_ -#define _IIMAGE_ +#pragma once -#include #include -#include "rt_math.h" + +#include +#include + #include "alignedbuffer.h" +#include "coord2d.h" #include "imagedimensions.h" #include "LUT.h" -#include "coord2d.h" -#include "color.h" +#include "rt_math.h" + #include "../rtgui/threadutils.h" #define TR_NONE 0 @@ -57,6 +59,7 @@ extern const char sImage16[]; extern const char sImagefloat[]; int getCoarseBitMask(const procparams::CoarseTransformParams& coarse); +const LUTf& getigammatab(); enum TypeInterpolation { TI_Nearest, TI_Bilinear }; @@ -955,17 +958,35 @@ public: histogram(65536 >> histcompr); histogram.clear(); + const LUTf& igammatab = getigammatab(); - for (int i = 0; i < height; i++) - for (int j = 0; j < width; j++) { - float r_, g_, b_; - convertTo(r(i, j), r_); - convertTo(g(i, j), g_); - convertTo(b(i, j), b_); - histogram[(int)Color::igamma_srgb (r_) >> histcompr]++; - histogram[(int)Color::igamma_srgb (g_) >> histcompr]++; - histogram[(int)Color::igamma_srgb (b_) >> histcompr]++; +#ifdef _OPENMP + #pragma omp parallel +#endif + { + LUTu histThr(histogram.getSize()); + histThr.clear(); +#ifdef _OPENMP + #pragma omp for schedule(dynamic,16) nowait +#endif + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + float r_, g_, b_; + convertTo(r(i, j), r_); + convertTo(g(i, j), g_); + convertTo(b(i, j), b_); + histThr[static_cast(igammatab[r_]) >> histcompr]++; + histThr[static_cast(igammatab[g_]) >> histcompr]++; + histThr[static_cast(igammatab[b_]) >> histcompr]++; + } } +#ifdef _OPENMP + #pragma omp critical +#endif + { + histogram += histThr; + } + } } void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) const override @@ -973,16 +994,16 @@ public: histogram.clear(); avg_r = avg_g = avg_b = 0.; n = 0; - + const LUTf& igammatab = getigammatab(); for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int j = 0; j < (unsigned int)(width); j++) { float r_, g_, b_; convertTo(r(i, j), r_); convertTo(g(i, j), g_); convertTo(b(i, j), b_); - int rtemp = Color::igamma_srgb (r_); - int gtemp = Color::igamma_srgb (g_); - int btemp = Color::igamma_srgb (b_); + int rtemp = igammatab[r_]; + int gtemp = igammatab[g_]; + int btemp = igammatab[b_]; histogram[rtemp >> compression]++; histogram[gtemp >> compression] += 2; @@ -1009,6 +1030,9 @@ public: int n = 0; //int p = 6; +#ifdef _OPENMP + #pragma omp parallel for reduction(+:avg_r,avg_g,avg_b,n) schedule(dynamic,16) +#endif for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int j = 0; j < (unsigned int)(width); j++) { float r_, g_, b_; @@ -1564,17 +1588,35 @@ public: histogram(65536 >> histcompr); histogram.clear(); + const LUTf& igammatab = getigammatab(); - for (int i = 0; i < height; i++) - for (int j = 0; j < width; j++) { - float r_, g_, b_; - convertTo(r(i, j), r_); - convertTo(g(i, j), g_); - convertTo(b(i, j), b_); - histogram[(int)Color::igamma_srgb (r_) >> histcompr]++; - histogram[(int)Color::igamma_srgb (g_) >> histcompr]++; - histogram[(int)Color::igamma_srgb (b_) >> histcompr]++; +#ifdef _OPENMP + #pragma omp parallel +#endif + { + LUTu histThr(histogram.getSize()); + histThr.clear(); +#ifdef _OPENMP + #pragma omp for schedule(dynamic,16) nowait +#endif + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + float r_, g_, b_; + convertTo(r(i, j), r_); + convertTo(g(i, j), g_); + convertTo(b(i, j), b_); + histThr[static_cast(igammatab[r_]) >> histcompr]++; + histThr[static_cast(igammatab[g_]) >> histcompr]++; + histThr[static_cast(igammatab[b_]) >> histcompr]++; + } } +#ifdef _OPENMP + #pragma omp critical +#endif + { + histogram += histThr; + } + } } void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) const override @@ -1582,6 +1624,7 @@ public: histogram.clear(); avg_r = avg_g = avg_b = 0.; n = 0; + const LUTf& igammatab = getigammatab(); for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int j = 0; j < (unsigned int)(width); j++) { @@ -1589,9 +1632,9 @@ public: convertTo(r(i, j), r_); convertTo(g(i, j), g_); convertTo(b(i, j), b_); - int rtemp = Color::igamma_srgb (r_); - int gtemp = Color::igamma_srgb (g_); - int btemp = Color::igamma_srgb (b_); + int rtemp = igammatab[r_]; + int gtemp = igammatab[g_]; + int btemp = igammatab[b_]; histogram[rtemp >> compression]++; histogram[gtemp >> compression] += 2; @@ -1618,6 +1661,9 @@ public: int n = 0; //int p = 6; +#ifdef _OPENMP + #pragma omp parallel for reduction(+:avg_r,avg_g,avg_b,n) schedule(dynamic,16) +#endif for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int j = 0; j < (unsigned int)(width); j++) { float r_, g_, b_; @@ -1808,5 +1854,3 @@ public: }; } - -#endif diff --git a/rtengine/image16.cc b/rtengine/image16.cc index 0cdcc578f..a98d64d51 100644 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -16,11 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include + +#include "colortemp.h" #include "image16.h" #include "imagefloat.h" #include "image8.h" -#include -#include "rtengine.h" +#include "rt_math.h" namespace { diff --git a/rtengine/image16.h b/rtengine/image16.h index 07747a172..d0053cbfc 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -19,17 +19,15 @@ // // A class representing a 16 bit rgb image with separate planes and 16 byte aligned data // -#ifndef _IMAGE16_ -#define _IMAGE16_ +#pragma once #include "imageio.h" -#include "rtengine.h" -#include "imagefloat.h" namespace rtengine { class Image8; +class Imagefloat; class Image16 : public IImage16, public ImageIO { @@ -109,4 +107,3 @@ public: }; } -#endif diff --git a/rtengine/image8.cc b/rtengine/image8.cc index abcd4efae..3d0a8df06 100644 --- a/rtengine/image8.cc +++ b/rtengine/image8.cc @@ -18,7 +18,10 @@ */ #include #include + +#include "colortemp.h" #include "image8.h" +#include "imagefloat.h" #include "rtengine.h" using namespace rtengine; diff --git a/rtengine/image8.h b/rtengine/image8.h index 969627f69..f125dccf8 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -19,15 +19,13 @@ // // A class representing a 8 bit rgb image without alpha channel // -#ifndef _IMAGE8_ -#define _IMAGE8_ +#pragma once #include "imageio.h" -#include "rtengine.h" -#include "imagefloat.h" namespace rtengine { +class Imagefloat; class Image8 : public IImage8, public ImageIO { @@ -104,4 +102,3 @@ public: }; } -#endif diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 403f4708c..24cfefde9 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -17,15 +17,22 @@ * along with RawTherapee. If not, see . */ #include + #include -#include + #include +#include + +#include + #include "imagedata.h" -#include "iptcpairs.h" #include "imagesource.h" -#include "rt_math.h" +#include "iptcpairs.h" #include "procparams.h" +#include "rt_math.h" +#include "utils.h" +#include "../rtexif/rtexif.h" #pragma GCC diagnostic warning "-Wextra" #define PRINT_HDR_PS_DETECTION 0 diff --git a/rtengine/imagedata.h b/rtengine/imagedata.h index 99caaf361..ff8ed4b86 100644 --- a/rtengine/imagedata.h +++ b/rtengine/imagedata.h @@ -16,17 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __IMAGEDATA_H__ -#define __IMAGEDATA_H__ +#pragma once #include #include -#include "rawimage.h" #include -#include -#include "../rtexif/rtexif.h" +#include + +#include + #include -#include "rtengine.h" + +#include "imageio.h" + +namespace rtexif +{ + +class TagDirectory; +} namespace rtengine { @@ -133,4 +140,3 @@ public: } -#endif diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index 8a9a511a6..1da91a4b4 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -17,12 +17,14 @@ * along with RawTherapee. If not, see . */ #include + +#include "colortemp.h" #include "imagefloat.h" #include "image16.h" #include "image8.h" +#include "labimage.h" #include #include "rtengine.h" -#include "mytime.h" #include "iccstore.h" #include "alignedbuffer.h" #include "rt_math.h" diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index 261a0677c..4a2b2f7e1 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -19,11 +19,9 @@ // // A class representing a 16 bit rgb image with separate planes and 16 byte aligned data // -#ifndef _IMAGEFLOAT_ -#define _IMAGEFLOAT_ +#pragma once #include "imageio.h" -#include "rtengine.h" namespace rtengine { @@ -31,6 +29,7 @@ using namespace procparams; class Image8; class Image16; +class LabImage; /* * Image type used by most tools; expected range: [0.0 ; 65535.0] @@ -227,4 +226,3 @@ public: }; } -#endif diff --git a/rtengine/imageformat.h b/rtengine/imageformat.h index dc40cf147..f8fee4c59 100644 --- a/rtengine/imageformat.h +++ b/rtengine/imageformat.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMAGEFORMAT_ -#define _IMAGEFORMAT_ +#pragma once namespace rtengine { @@ -51,5 +50,3 @@ typedef enum SensorType { } eSensorType; } - -#endif diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index f335f5be8..fce181c3f 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -27,8 +27,10 @@ #include #include "rt_math.h" #include "procparams.h" +#include "utils.h" #include "../rtgui/options.h" #include "../rtgui/version.h" +#include "../rtexif/rtexif.h" #ifdef WIN32 #include @@ -810,7 +812,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname) * TIFFTAG_SMAXSAMPLEVALUE, but for now, we normalize the image to the * effective minimum and maximum values */ - if (options.rtSettings.verbose) { + if (settings->verbose) { printf("Information of \"%s\":\n", fname.c_str()); uint16 tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit; if (TIFFGetField(in, TIFFTAG_DEFAULTSCALE, &tiffDefaultScale)) { diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 89c482ca3..d9afa926f 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -16,35 +16,51 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMAGEIO_ -#define _IMAGEIO_ - -#define IMIO_SUCCESS 0 -#define IMIO_CANNOTREADFILE 1 -#define IMIO_INVALIDHEADER 2 -#define IMIO_HEADERERROR 3 -#define IMIO_READERROR 4 -#define IMIO_VARIANTNOTSUPPORTED 5 -#define IMIO_FILETYPENOTSUPPORTED 6 -#define IMIO_CANNOTWRITEFILE 7 +#pragma once #include -#include +#include + #include -#include "rtengine.h" -#include "imageformat.h" -#include "../rtexif/rtexif.h" -#include "imagedimensions.h" + #include "iimage.h" -#include "colortemp.h" +#include "imagedimensions.h" +#include "imageformat.h" +#include "rtengine.h" + +enum { + IMIO_SUCCESS, + IMIO_CANNOTREADFILE, + IMIO_INVALIDHEADER, + IMIO_HEADERERROR, + IMIO_READERROR, + IMIO_VARIANTNOTSUPPORTED, + IMIO_FILETYPENOTSUPPORTED, + IMIO_CANNOTWRITEFILE +}; + +namespace rtexif +{ + +class TagDirectory; + +} namespace rtengine { +class ColorTemp; class ProgressListener; class Imagefloat; +namespace procparams +{ + +class ExifPairs; + +} + class ImageIO : virtual public ImageDatas { @@ -111,4 +127,3 @@ public: }; } -#endif diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index edc1102c4..e0c26aa9f 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -21,21 +21,31 @@ #include #include -#include +#include -#include "colortemp.h" #include "coord2d.h" -#include "dcp.h" -#include "image16.h" -#include "image8.h" #include "imagedata.h" -#include "imagefloat.h" #include "LUT.h" #include "rtengine.h" +template +class LUT; + +using LUTf = LUT; + +template +class multi_array2D; + namespace rtengine { +class ColorTemp; +class DCPProfile; +class DCPProfileApplyState; +class Imagefloat; +class RetinexgaintransmissionCurve; +class RetinextransmissionCurve; + namespace procparams { @@ -47,7 +57,7 @@ struct RAWParams; struct RetinexParams; struct ToneCurveParams; struct CaptureSharpeningParams; -} +}; class ImageMatrices { @@ -82,7 +92,7 @@ public: virtual int load (const Glib::ustring &fname) = 0; virtual void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) {}; virtual void filmNegativeProcess (const procparams::FilmNegativeParams ¶ms) {}; - virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams& currentParams, std::array& newExps) { return false; }; + virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const procparams::FilmNegativeParams& currentParams, std::array& newExps) { return false; }; virtual void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold, bool cache = false) {}; virtual void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; virtual void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; @@ -101,13 +111,13 @@ public: // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* - virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hlp, const RAWParams &raw) = 0; + virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hlp, const procparams::RAWParams &raw) = 0; virtual eSensorType getSensorType () const = 0; virtual bool isMono () const = 0; // true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource virtual bool isWBProviderReady () = 0; - virtual void convertColorSpace (Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb) = 0; // DIRTY HACK: this method is derived in rawimagesource and strimagesource, but (...,RAWParams raw) will be used ONLY for raw images + virtual void convertColorSpace (Imagefloat* image, const procparams::ColorManagementParams &cmp, const ColorTemp &wb) = 0; // DIRTY HACK: this method is derived in rawimagesource and strimagesource, but (...,RAWParams raw) will be used ONLY for raw images virtual void getAutoWBMultipliers (double &rm, double &gm, double &bm) = 0; virtual ColorTemp getWB () const = 0; virtual ColorTemp getSpotWB (std::vector &red, std::vector &green, std::vector &blue, int tran, double equal) = 0; @@ -126,7 +136,7 @@ public: virtual ImageMatrices* getImageMatrices () = 0; virtual bool isRAW () const = 0; - virtual DCPProfile* getDCP (const procparams::ColorManagementParams &cmp, DCPProfile::ApplyState &as) + virtual DCPProfile* getDCP (const procparams::ColorManagementParams &cmp, DCPProfileApplyState &as) { return nullptr; }; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 3e7ac5cd8..6cec71006 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -16,28 +16,38 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include "improccoordinator.h" -#include "curves.h" -#include "mytime.h" -#include "refreshmap.h" -#include "../rtgui/ppversion.h" -#include "colortemp.h" -#include "improcfun.h" -#include "iccstore.h" -#include "procparams.h" -#include #include +#include #include -#include "guidedfilter.h" +#include + +#include "improccoordinator.h" + +#include "cieimage.h" #include "color.h" +#include "colortemp.h" +#include "curves.h" +#include "dcp.h" +#include "iccstore.h" +#include "image8.h" +#include "imagefloat.h" +#include "improcfun.h" +#include "labimage.h" +#include "lcp.h" +#include "procparams.h" +#include "refreshmap.h" +#include "guidedfilter.h" + +#include "../rtgui/options.h" + #ifdef _OPENMP #include #endif + + namespace rtengine { -extern const Settings* settings; - ImProcCoordinator::ImProcCoordinator() : orig_prev(nullptr), oprevi(nullptr), @@ -741,7 +751,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) double ggm = 33.; double bbm = 33.; - DCPProfile::ApplyState as; + DCPProfileApplyState as; DCPProfile *dcpProf = imgsrc->getDCP(params->icm, as); ipf.rgbProc(oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params->toneCurve.saturation, diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 379a3fb20..c27cfe76e 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -16,21 +16,27 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMPROCCOORDINATOR_H_ -#define _IMPROCCOORDINATOR_H_ +#pragma once #include -#include "rtengine.h" -#include "improcfun.h" -#include "image8.h" -#include "image16.h" -#include "imagesource.h" -#include "procevents.h" +#include "array2D.h" +#include "colortemp.h" +#include "curves.h" #include "dcrop.h" +#include "imagesource.h" +#include "improcfun.h" #include "LUT.h" +#include "procevents.h" +#include "rtengine.h" + #include "../rtgui/threadutils.h" +namespace Glib +{ +class Thread; +} + namespace rtengine { @@ -408,5 +414,5 @@ public: } denoiseInfoStore; }; + } -#endif diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 3d8583097..58258076d 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -18,16 +18,18 @@ */ #include #include -#include +#include #ifdef _OPENMP #include #endif #include "alignedbuffer.h" +#include "cieimage.h" +#include "labimage.h" #include "rtengine.h" #include "improcfun.h" #include "curves.h" -#include "mytime.h" +#include "dcp.h" #include "iccstore.h" #include "imagesource.h" #include "rtthumbnail.h" @@ -40,12 +42,15 @@ #include "improccoordinator.h" #include "clutstore.h" #include "ciecam02.h" +#include "satandvalueblendingcurve.h" #include "StopWatch.h" #include "procparams.h" -#include "../rtgui/ppversion.h" -#include "../rtgui/guiutils.h" #include "../rtgui/editcallbacks.h" +#ifdef _DEBUG +#include "mytime.h" +#endif + #undef CLIPD #define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) @@ -265,8 +270,6 @@ namespace rtengine using namespace procparams; -extern const Settings* settings; - ImProcFunctions::~ImProcFunctions () { if (monitorTransform) { @@ -2048,7 +2051,7 @@ filmlike_clip (float *r, float *g, float *b) void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve, - const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure) + const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure) { rgbProc (working, lab, pipetteBuffer, hltonecurve, shtonecurve, tonecurve, sat, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, asIn, histToneCurve, chunkSize, measure); } @@ -2056,7 +2059,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer // Process RGB image and convert to LAB space void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve, - const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure) + const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure) { std::unique_ptr stop; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 9a6c48be5..145639f57 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -16,33 +16,54 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMPROCFUN_H_ -#define _IMPROCFUN_H_ +#pragma once + +#include -#include "imagefloat.h" -#include "image16.h" -#include "image8.h" -#include "shmap.h" #include "coord2d.h" -#include "color.h" -#include "labimage.h" -#include "cieimage.h" -#include "LUT.h" -#include "lcp.h" -#include "dcp.h" -#include "curves.h" -#include "cplx_wavelet_dec.h" -#include "pipettebuffer.h" #include "gamutwarning.h" +#include "pipettebuffer.h" +#include "shmap.h" +template +class LUT; + +using LUTu = LUT; +using LUTf = LUT; + +template +class multi_array2D; namespace rtengine { +class ColorAppearance; +class ColorGradientCurve; +class DCPProfile; +class DCPProfileApplyState; +class FlatCurve; +class FramesMetaData; +class LensCorrection; +class NoiseCurve; +class OpacityCurve; +class ToneCurve; +class WavCurve; +class WavOpacityCurveBY; +class WavOpacityCurveRG; +class WavOpacityCurveW; +class WavOpacityCurveWL; + +class CieImage; +class Image8; +class Imagefloat; +class LabImage; +class wavelet_decomposition; + namespace procparams { class ProcParams; +struct ColorManagementParams; struct DirPyrDenoiseParams; struct SharpeningParams; struct VignettingParams; @@ -57,7 +78,7 @@ class ImProcFunctions cmsHTRANSFORM monitorTransform; std::unique_ptr gamutWarning; - const ProcParams* params; + const procparams::ProcParams* params; double scale; bool multiThread; @@ -90,7 +111,7 @@ public: double lumimul[3]; - explicit ImProcFunctions(const ProcParams* iparams, bool imultiThread = true) + explicit ImProcFunctions(const procparams::ProcParams* iparams, bool imultiThread = true) : monitorTransform(nullptr), params(iparams), scale(1), multiThread(imultiThread), lumimul{} {} ~ImProcFunctions(); bool needsLuminanceOnly() @@ -106,11 +127,11 @@ public: void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, - const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false); + const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false); void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, - double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false); + double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false); void labtoning(float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve, LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3]); void toning2col(float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float rl, float gl, float bl, float rh, float gh, float bh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect); void toningsmh(float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect); @@ -122,7 +143,7 @@ public: void moyeqt(Imagefloat* working, float &moyS, float &eqty); void luminanceCurve(LabImage* lold, LabImage* lnew, LUTf &curve); - void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params, + void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const procparams::ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt, bool showSharpMask = false); @@ -132,7 +153,7 @@ public: void sharpening(LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask = false); void sharpeningcam(CieImage* ncie, float** buffer, bool showMask = false); void transform(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage); - float resizeScale(const ProcParams* params, int fw, int fh, int &imw, int &imh); + float resizeScale(const procparams::ProcParams* params, int fw, int fh, int &imw, int &imh); void lab2monitorRgb(LabImage* lab, Image8* image); void resize(Imagefloat* src, Imagefloat* dst, float dScale); void Lanczos(const LabImage* src, LabImage* dst, float scale); @@ -198,20 +219,20 @@ public: void Median_Denoise(float **src, float **dst, float upperBound, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); void 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); void RGB_denoise_infoGamCurve(const procparams::DirPyrDenoiseParams & dnparams, const bool isRAW, LUTf &gamcurve, float &gam, float &gamthresh, float &gamslope); - void RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc, 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 = false); - void RGBtile_denoise(float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer); //for DCT + void RGB_denoise_info(Imagefloat * src, Imagefloat * provicalc, 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 = false); + void RGBtile_denoise(float * fLblox, int hblproc, float noisevar_Ldetail); //for DCT void RGBoutput_tile_row(float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top); - bool WaveletDenoiseAllL(wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge); - bool WaveletDenoiseAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb); - void 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, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, + bool WaveletDenoiseAllL(const wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge); + bool 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); + void 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); - bool WaveletDenoiseAll_BiShrinkL(wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3]); - bool WaveletDenoiseAll_BiShrinkAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float noisevar_ab, + bool WaveletDenoiseAll_BiShrinkL(const wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3]); + bool 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); - void ShrinkAllL(wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir, float *noisevarlum, float * madL, float * vari, int edge); - void ShrinkAllAB(wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir, + void ShrinkAllL(const wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir, float *noisevarlum, float * madL, float * vari, int edge); + void 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 = nullptr, bool madCalculated = false); void ShrinkAll_info(float ** WavCoeffs_a, float ** WavCoeffs_b, int W_ab, int H_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, @@ -256,5 +277,5 @@ public: void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); }; + } -#endif diff --git a/rtengine/impulse_denoise.cc b/rtengine/impulse_denoise.cc index c08f55700..20229e714 100644 --- a/rtengine/impulse_denoise.cc +++ b/rtengine/impulse_denoise.cc @@ -22,7 +22,7 @@ #include "labimage.h" #include "improcfun.h" #include "cieimage.h" -#include "sleef.c" +#include "sleef.h" #include "opthelper.h" #include "gauss.h" diff --git a/rtengine/init.cc b/rtengine/init.cc index 8d3ee96cb..1a00f7ff6 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -18,6 +18,7 @@ */ #include #include "../rtgui/profilestorecombobox.h" +#include "color.h" #include "rtengine.h" #include "iccstore.h" #include "dcp.h" @@ -42,7 +43,7 @@ const Settings* settings; MyMutex* lcmsMutex = nullptr; MyMutex *fftwMutex = nullptr; -int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir, bool loadAll) +int init (const Settings* s, const Glib::ustring& baseDir, const Glib::ustring& userSettingsDir, bool loadAll) { settings = s; ProcParams::init(); diff --git a/rtengine/ipdehaze.cc b/rtengine/ipdehaze.cc index e7bf71ba6..28a0f2d57 100644 --- a/rtengine/ipdehaze.cc +++ b/rtengine/ipdehaze.cc @@ -32,17 +32,22 @@ #include #include +#include "color.h" #include "guidedfilter.h" +#include "iccstore.h" +#include "imagefloat.h" #include "improcfun.h" #include "procparams.h" #include "rescale.h" #include "rt_math.h" -extern Options options; +#include "../rtgui/options.h" -namespace rtengine { +namespace rtengine +{ -namespace { +namespace +{ float normalize(Imagefloat *rgb, bool multithread) { @@ -198,7 +203,7 @@ float estimate_ambient_light(const array2D &R, const array2D &G, c } } - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "dehaze: computing ambient light from " << patches.size() << " patches" << std::endl; } @@ -269,7 +274,6 @@ void extract_channels(Imagefloat *img, array2D &r, array2D &g, arr } // namespace - void ImProcFunctions::dehaze(Imagefloat *img) { if (!params->dehaze.enabled || params->dehaze.strength == 0.0) { @@ -282,7 +286,7 @@ void ImProcFunctions::dehaze(Imagefloat *img) const int H = img->getHeight(); const float strength = LIM01(float(params->dehaze.strength) / 100.f * 0.9f); - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "dehaze: strength = " << strength << std::endl; } @@ -324,7 +328,7 @@ void ImProcFunctions::dehaze(Imagefloat *img) } if (min(ambient[0], ambient[1], ambient[2]) < 0.01f) { - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "dehaze: no haze detected" << std::endl; } restore(img, maxChannel, multiThread); @@ -332,7 +336,7 @@ void ImProcFunctions::dehaze(Imagefloat *img) } patchsize = max(max(W, H) / 600, 2); - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "dehaze: ambient light is " << ambient[0] << ", " << ambient[1] << ", " << ambient[2] << std::endl; @@ -347,7 +351,7 @@ void ImProcFunctions::dehaze(Imagefloat *img) array2D guideB(W, H, img->b.ptrs, ARRAY2D_BYREFERENCE); guidedFilter(guideB, dark, dark, radius, epsilon, multiThread); - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "dehaze: max distance is " << maxDistance << std::endl; } @@ -429,5 +433,4 @@ void ImProcFunctions::dehaze(Imagefloat *img) } } - } // namespace rtengine diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 14aeb4049..1d3f2f494 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -17,13 +17,14 @@ * along with RawTherapee. If not, see . */ #include "rtengine.h" +#include "image8.h" +#include "imagefloat.h" +#include "labimage.h" #include "improcfun.h" -#include +#include #include "iccstore.h" #include "iccmatrices.h" -#include "../rtgui/options.h" #include "settings.h" -#include "curves.h" #include "alignedbuffer.h" #include "color.h" #include "procparams.h" @@ -33,8 +34,6 @@ namespace rtengine extern void filmlike_clip(float *r, float *g, float *b); -extern const Settings* settings; - namespace { inline void copyAndClampLine(const float *src, unsigned char *dst, const int W) diff --git a/rtengine/iplabregions.cc b/rtengine/iplabregions.cc index af6567c3c..1768101c8 100644 --- a/rtengine/iplabregions.cc +++ b/rtengine/iplabregions.cc @@ -18,16 +18,17 @@ * along with RawTherapee. If not, see . */ -#ifdef _OPENMP -#include -#endif - -#include "improcfun.h" +#include "color.h" +#include "curves.h" #include "guidedfilter.h" +#include "iccstore.h" +#include "improcfun.h" +#include "labimage.h" #include "procparams.h" +#include "sleef.h" + //#define BENCHMARK #include "StopWatch.h" -#include "sleef.c" namespace { @@ -51,7 +52,8 @@ void fastlin2log(float *x, float factor, float base, int w) } -namespace rtengine { +namespace rtengine +{ void ImProcFunctions::labColorCorrectionRegions(LabImage *lab) { diff --git a/rtengine/iplocalcontrast.cc b/rtengine/iplocalcontrast.cc index 6143f48a3..daeb142dd 100644 --- a/rtengine/iplocalcontrast.cc +++ b/rtengine/iplocalcontrast.cc @@ -22,16 +22,14 @@ * along with RawTherapee. If not, see . */ -#ifdef _OPENMP -#include -#endif - #include "array2D.h" #include "gauss.h" +#include "labimage.h" #include "improcfun.h" #include "procparams.h" -namespace rtengine { +namespace rtengine +{ void ImProcFunctions::localContrast(LabImage *lab) { diff --git a/rtengine/ipresize.cc b/rtengine/ipresize.cc index 0c1fb1ad8..b9e234b63 100644 --- a/rtengine/ipresize.cc +++ b/rtengine/ipresize.cc @@ -20,10 +20,12 @@ #include "improcfun.h" #include "alignedbuffer.h" +#include "imagefloat.h" +#include "labimage.h" #include "opthelper.h" #include "rt_math.h" #include "procparams.h" -#include "sleef.c" +#include "sleef.h" //#define PROFILE diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 7117c9f2a..b5d504a99 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -41,8 +41,11 @@ #include #include +#include "color.h" +#include "curves.h" #include "gauss.h" #include "improcfun.h" +#include "jaggedarray.h" #include "median.h" #include "opthelper.h" #include "procparams.h" @@ -50,8 +53,6 @@ #include "rtengine.h" #include "StopWatch.h" -#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) - namespace { void retinex_scales( float* scales, int nscales, int mode, int s, float high) @@ -136,362 +137,422 @@ void mean_stddv2( float **dst, float &mean, float &stddv, int W_L, int H_L, floa namespace rtengine { -extern const Settings* settings; - -void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, LUTf & mapcurve, bool &mapcontlutili, int width, int height, const RetinexParams &deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, const LUTf& mapcurve, bool mapcontlutili, int width, int height, const procparams::RetinexParams &deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { +BENCHFUN + if (!deh.enabled) { + return; + } - if (deh.enabled) {//enabled - float maxtr, mintr; - constexpr float eps = 2.f; - bool useHsl = deh.retinexcolorspace == "HSLLOG"; - bool useHslLin = deh.retinexcolorspace == "HSLLIN"; - float offse = (float) deh.offs; //def = 0 not use - int iter = deh.iter; - int gradient = deh.scal; - int scal = 3;//disabled scal - int nei = (int) (2.8f * deh.neigh); //def = 220 - float vart = (float)deh.vart / 100.f;//variance - float gradvart = (float)deh.grad; - float gradstr = (float)deh.grads; - float strength = (float) deh.str / 100.f; // Blend with original L channel data - float limD = (float) deh.limd; - limD = pow(limD, 1.7f);//about 2500 enough - limD *= useHslLin ? 10.f : 1.f; - float ilimD = 1.f / limD; - float hig = ((float) deh.highl) / 100.f; - scal = deh.skal; + constexpr float eps = 2.f; + const bool useHsl = deh.retinexcolorspace == "HSLLOG"; + const bool useHslLin = deh.retinexcolorspace == "HSLLIN"; + const float offse = deh.offs; //def = 0 not use + const int iter = deh.iter; + const int gradient = deh.scal; + int scal = deh.skal; + const int nei = 2.8f * deh.neigh; //def = 220 + const float vart = deh.vart / 100.f;//variance + const float gradvart = deh.grad; + const float gradstr = deh.grads; + const float strength = deh.str / 100.f; // Blend with original L channel data + float limD = deh.limd; + limD = pow(limD, 1.7f);//about 2500 enough + limD *= useHslLin ? 10.f : 1.f; + const float ilimD = 1.f / limD; + const float hig = deh.highl / 100.f; - int H_L = height; - int W_L = width; + const int H_L = height; + const int W_L = width; - float *tran[H_L] ALIGNED16; - float *tranBuffer = nullptr; + constexpr float elogt = 2.71828f; + bool lhutili = false; - constexpr float elogt = 2.71828f; - bool lhutili = false; + FlatCurve* shcurve = new FlatCurve(deh.lhcurve); //curve L=f(H) - FlatCurve* shcurve = new FlatCurve(deh.lhcurve); //curve L=f(H) - - if (!shcurve || shcurve->isIdentity()) { - if (shcurve) { - delete shcurve; - shcurve = nullptr; - } - } else { - lhutili = true; + if (!shcurve || shcurve->isIdentity()) { + if (shcurve) { + delete shcurve; + shcurve = nullptr; } + } else { + lhutili = true; + } - bool higplus = false ; - int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) + bool higplus = false ; + int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) - if(deh.retinexMethod == "highliplus") { - higplus = true; - moderetinex = 3; - } else if (deh.retinexMethod == "uni") { - moderetinex = 0; - } else if (deh.retinexMethod == "low") { - moderetinex = 1; - } else { /*if (deh.retinexMethod == "highli") */ - moderetinex = 3; - } + if(deh.retinexMethod == "highliplus") { + higplus = true; + moderetinex = 3; + } else if (deh.retinexMethod == "uni") { + moderetinex = 0; + } else if (deh.retinexMethod == "low") { + moderetinex = 1; + } else { /*if (deh.retinexMethod == "highli") */ + moderetinex = 3; + } - constexpr float aahi = 49.f / 99.f; ////reduce sensibility 50% - constexpr float bbhi = 1.f - aahi; + constexpr float aahi = 49.f / 99.f; ////reduce sensibility 50% + constexpr float bbhi = 1.f - aahi; + float high = bbhi + aahi * (float) deh.highl; - for(int it = 1; it < iter + 1; it++) { //iter nb max of iterations - float high = bbhi + aahi * (float) deh.highl; + for (int it = 1; it < iter + 1; it++) { //iter nb max of iterations + float grad = 1.f; + float sc = scal; - float grad = 1.f; - float sc = scal; - - if(gradient == 0) { - grad = 1.f; - sc = 3.f; - } else if(gradient == 1) { - grad = 0.25f * it + 0.75f; - sc = -0.5f * it + 4.5f; - } else if(gradient == 2) { - grad = 0.5f * it + 0.5f; - sc = -0.75f * it + 5.75f; - } else if(gradient == 3) { - grad = 0.666f * it + 0.333f; - sc = -0.75f * it + 5.75f; - } else if(gradient == 4) { - grad = 0.8f * it + 0.2f; - sc = -0.75f * it + 5.75f; - } else if(gradient == 5) { - if(moderetinex != 3) { - grad = 2.5f * it - 1.5f; - } else { - float aa = (11.f * high - 1.f) / 4.f; - float bb = 1.f - aa; - grad = aa * it + bb; - } - - sc = -0.75f * it + 5.75f; - } else if(gradient == 6) { - if(moderetinex != 3) { - grad = 5.f * it - 4.f; - } else { - float aa = (21.f * high - 1.f) / 4.f; - float bb = 1.f - aa; - grad = aa * it + bb; - } - - sc = -0.75f * it + 5.75f; - } - - else if(gradient == -1) { - grad = -0.125f * it + 1.125f; - sc = 3.f; - } - - if(iter == 1) { - sc = scal; + if (gradient == 0) { + grad = 1.f; + sc = 3.f; + } else if (gradient == 1) { + grad = 0.25f * it + 0.75f; + sc = -0.5f * it + 4.5f; + } else if (gradient == 2) { + grad = 0.5f * it + 0.5f; + sc = -0.75f * it + 5.75f; + } else if (gradient == 3) { + grad = 0.666f * it + 0.333f; + sc = -0.75f * it + 5.75f; + } else if (gradient == 4) { + grad = 0.8f * it + 0.2f; + sc = -0.75f * it + 5.75f; + } else if (gradient == 5) { + if (moderetinex != 3) { + grad = 2.5f * it - 1.5f; } else { - //adjust sc in function of choice of scale by user if iterations - if(scal < 3) { - sc -= 1; + float aa = (11.f * high - 1.f) / 4.f; + float bb = 1.f - aa; + grad = aa * it + bb; + } - if(sc < 1.f) {//avoid 0 - sc = 1.f; - } + sc = -0.75f * it + 5.75f; + } else if (gradient == 6) { + if (moderetinex != 3) { + grad = 5.f * it - 4.f; + } else { + float aa = (21.f * high - 1.f) / 4.f; + float bb = 1.f - aa; + grad = aa * it + bb; + } + + sc = -0.75f * it + 5.75f; + } else if (gradient == -1) { + grad = -0.125f * it + 1.125f; + sc = 3.f; + } + + if (iter == 1) { + sc = scal; + } else { + //adjust sc in function of choice of scale by user if iterations + if (scal < 3) { + sc -= 1; + if (sc < 1.f) {//avoid 0 + sc = 1.f; } + } else if (scal > 4) { + sc += 1; + } + } - if(scal > 4) { - sc += 1; + float varx = vart; + float limdx = limD; + float ilimdx = ilimD; + + if (gradvart != 0) { + if (gradvart == 1) { + varx = vart * (-0.125f * it + 1.125f); + limdx = limD * (-0.125f * it + 1.125f); + ilimdx = 1.f / limdx; + } else if (gradvart == 2) { + varx = vart * (-0.2f * it + 1.2f); + limdx = limD * (-0.2f * it + 1.2f); + ilimdx = 1.f / limdx; + } else if (gradvart == -1) { + varx = vart * (0.125f * it + 0.875f); + limdx = limD * (0.125f * it + 0.875f); + ilimdx = 1.f / limdx; + } else if (gradvart == -2) { + varx = vart * (0.4f * it + 0.6f); + limdx = limD * (0.4f * it + 0.6f); + ilimdx = 1.f / limdx; + } + } + + scal = round(sc); + float ks = 1.f; + + if (gradstr != 0) { + if (gradstr == 1) { + if (it <= 3) { + ks = -0.3f * it + 1.6f; + } else { + ks = 0.5f; + } + } else if (gradstr == 2) { + if (it <= 3) { + ks = -0.6f * it + 2.2f; + } else { + ks = 0.3f; + } + } else if (gradstr == -1) { + if (it <= 3) { + ks = 0.2f * it + 0.6f; + } else { + ks = 1.2f; + } + } else if (gradstr == -2) { + if (it <= 3) { + ks = 0.4f * it + 0.2f; + } else { + ks = 1.5f; } } + } - float varx = vart; - float limdx = limD; - float ilimdx = ilimD; + const float strengthx = ks * strength; - if(gradvart != 0) { - if(gradvart == 1) { - varx = vart * (-0.125f * it + 1.125f); - limdx = limD * (-0.125f * it + 1.125f); - ilimdx = 1.f / limdx; - } else if(gradvart == 2) { - varx = vart * (-0.2f * it + 1.2f); - limdx = limD * (-0.2f * it + 1.2f); - ilimdx = 1.f / limdx; - } else if(gradvart == -1) { - varx = vart * (0.125f * it + 0.875f); - limdx = limD * (0.125f * it + 0.875f); - ilimdx = 1.f / limdx; - } else if(gradvart == -2) { - varx = vart * (0.4f * it + 0.6f); - limdx = limD * (0.4f * it + 0.6f); - ilimdx = 1.f / limdx; - } - } + constexpr auto maxRetinexScales = 8; + float RetinexScales[maxRetinexScales]; - scal = round(sc); - float ks = 1.f; + retinex_scales(RetinexScales, scal, moderetinex, nei / grad, high); - if(gradstr != 0) { - if(gradstr == 1) { - if(it <= 3) { - ks = -0.3f * it + 1.6f; - } else { - ks = 0.5f; - } - } else if(gradstr == 2) { - if(it <= 3) { - ks = -0.6f * it + 2.2f; - } else { - ks = 0.3f; - } - } else if(gradstr == -1) { - if(it <= 3) { - ks = 0.2f * it + 0.6f; - } else { - ks = 1.2f; - } - } else if(gradstr == -2) { - if(it <= 3) { - ks = 0.4f * it + 0.2f; - } else { - ks = 1.5f; - } - } - } + const int shHighlights = deh.highlights; + const int shShadows = deh.shadows; - float strengthx = ks * strength; + int mapmet = 0; - constexpr auto maxRetinexScales = 8; - float RetinexScales[maxRetinexScales]; + if(deh.mapMethod == "map") { + mapmet = 2; + } else if(deh.mapMethod == "mapT") { + mapmet = 3; + } else if(deh.mapMethod == "gaus") { + mapmet = 4; + } - retinex_scales( RetinexScales, scal, moderetinex, nei / grad, high ); + const double shradius = mapmet == 4 ? (double) deh.radius : 40.; - float *src[H_L] ALIGNED16; - float *srcBuffer = new float[H_L * W_L]; + int viewmet = 0; - for (int i = 0; i < H_L; i++) { - src[i] = &srcBuffer[i * W_L]; - } + if(deh.viewMethod == "mask") { + viewmet = 1; + } else if(deh.viewMethod == "tran") { + viewmet = 2; + } else if(deh.viewMethod == "tran2") { + viewmet = 3; + } else if(deh.viewMethod == "unsharp") { + viewmet = 4; + } - int h_th = 0, s_th = 0; - - int shHighlights = deh.highlights; - int shShadows = deh.shadows; - - int mapmet = 0; - - if(deh.mapMethod == "map") { - mapmet = 2; - } else if(deh.mapMethod == "mapT") { - mapmet = 3; - } else if(deh.mapMethod == "gaus") { - mapmet = 4; - } - - const double shradius = mapmet == 4 ? (double) deh.radius : 40.; - - int viewmet = 0; - - if(deh.viewMethod == "mask") { - viewmet = 1; - } else if(deh.viewMethod == "tran") { - viewmet = 2; - } else if(deh.viewMethod == "tran2") { - viewmet = 3; - } else if(deh.viewMethod == "unsharp") { - viewmet = 4; - } + std::unique_ptr> srcBuffer(new JaggedArray(W_L, H_L)); + float** src = *(srcBuffer.get()); #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int i = 0; i < H_L; i++) - for (int j = 0; j < W_L; j++) { - src[i][j] = luminance[i][j] + eps; - luminance[i][j] = 0.f; - } - - float *out[H_L] ALIGNED16; - float *outBuffer = new float[H_L * W_L]; - - for (int i = 0; i < H_L; i++) { - out[i] = &outBuffer[i * W_L]; + for (int i = 0; i < H_L; i++) + for (int j = 0; j < W_L; j++) { + src[i][j] = luminance[i][j] + eps; + luminance[i][j] = 0.f; } - if(viewmet == 3 || viewmet == 2) { - tranBuffer = new float[H_L * W_L]; + JaggedArray out(W_L, H_L); + JaggedArray& tran = out; // tran and out can safely use the same buffer - for (int i = 0; i < H_L; i++) { - tran[i] = &tranBuffer[i * W_L]; - } - } + const float logBetaGain = xlogf(16384.f); + float pond = logBetaGain / (float) scal; - const float logBetaGain = xlogf(16384.f); - float pond = logBetaGain / (float) scal; + if(!useHslLin) { + pond /= log(elogt); + } - if(!useHslLin) { - pond /= log(elogt); - } + std::unique_ptr shmap; + if (((mapmet == 2 || mapmet == 3 || mapmet == 4) && it == 1)) { + shmap.reset(new SHMap(W_L, H_L)); + } - auto shmap = ((mapmet == 2 || mapmet == 3 || mapmet == 4) && it == 1) ? new SHMap (W_L, H_L) : nullptr; + std::unique_ptr buffer; + if (mapmet > 0) { + buffer.reset(new float[W_L * H_L]); + } - float *buffer = new float[W_L * H_L];; - - for ( int scale = scal - 1; scale >= 0; scale-- ) { -#ifdef _OPENMP - #pragma omp parallel -#endif - { - if(scale == scal - 1) - { - gaussianBlur (src, out, W_L, H_L, RetinexScales[scale], buffer); - } else { // reuse result of last iteration - // out was modified in last iteration => restore it - if((((mapmet == 2 && scale > 1) || mapmet == 3 || mapmet == 4) || (mapmet > 0 && mapcontlutili)) && it == 1) - { -#ifdef _OPENMP - #pragma omp for -#endif - - for (int i = 0; i < H_L; i++) { - for (int j = 0; j < W_L; j++) { - out[i][j] = buffer[i * W_L + j]; - } - } - } - - gaussianBlur (out, out, W_L, H_L, sqrtf(SQR(RetinexScales[scale]) - SQR(RetinexScales[scale + 1])), buffer); - } - if((((mapmet == 2 && scale > 2) || mapmet == 3 || mapmet == 4) || (mapmet > 0 && mapcontlutili)) && it == 1 && scale > 0) - { - // out will be modified => store it for use in next iteration. We even don't need a new buffer because 'buffer' is free after gaussianBlur :) -#ifdef _OPENMP - #pragma omp for -#endif - - for (int i = 0; i < H_L; i++) { - for (int j = 0; j < W_L; j++) { - buffer[i * W_L + j] = out[i][j]; - } - } - } - } - - if(((mapmet == 2 && scale > 2) || mapmet == 3 || mapmet == 4) && it == 1) { - shmap->updateL (out, shradius, true, 1); - h_th = shmap->max_f - deh.htonalwidth * (shmap->max_f - shmap->avg) / 100; - s_th = deh.stonalwidth * (shmap->avg - shmap->min_f) / 100; - } - -#ifdef __SSE2__ - vfloat pondv = F2V(pond); - vfloat limMinv = F2V(ilimdx); - vfloat limMaxv = F2V(limdx); - -#endif - - if(mapmet > 0 && mapcontlutili && it == 1) { - // TODO: When rgbcurvespeedup branch is merged into master we can simplify the code by - // 1) in rawimagesource.retinexPrepareCurves() insert - // mapcurve *= 0.5f; - // after - // CurveFactory::mapcurve (mapcontlutili, retinexParams.mapcurve, mapcurve, 1, lhist16RETI, histLRETI); - // 2) remove the division by 2.f from the code 7 lines below this line + for (int scale = scal - 1; scale >= 0; --scale) { + if (scale == scal - 1) { + gaussianBlur(src, out, W_L, H_L, RetinexScales[scale], true); + } else { // reuse result of last iteration + // out was modified in last iteration => restore it + if((((mapmet == 2 && scale > 1) || mapmet == 3 || mapmet == 4) || (mapmet > 0 && mapcontlutili)) && it == 1) { #ifdef _OPENMP #pragma omp parallel for #endif for (int i = 0; i < H_L; i++) { for (int j = 0; j < W_L; j++) { - out[i][j] = mapcurve[2.f * out[i][j]] / 2.f; + out[i][j] = buffer[i * W_L + j]; } } - } - if(((mapmet == 2 && scale > 2) || mapmet == 3 || mapmet == 4) && it == 1) { - float hWeight = (100.f - shHighlights) / 100.f; - float sWeight = (100.f - shShadows) / 100.f; + gaussianBlur(out, out, W_L, H_L, sqrtf(SQR(RetinexScales[scale]) - SQR(RetinexScales[scale + 1])), true); + } + + if ((((mapmet == 2 && scale > 2) || mapmet == 3 || mapmet == 4) || (mapmet > 0 && mapcontlutili)) && it == 1 && scale > 0) { + // out will be modified => store it for use in next iteration. #ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) + #pragma omp parallel for #endif - for (int i = 0; i < H_L; i++) { - for (int j = 0; j < W_L; j++) { - float mapval = 1.f + shmap->map[i][j]; - float factor = 1.f; + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + buffer[i * W_L + j] = out[i][j]; + } + } + } + int h_th = 0; + int s_th = 0; + if (((mapmet == 2 && scale > 2) || mapmet == 3 || mapmet == 4) && it == 1) { + shmap->updateL(out, shradius, true, 1); + h_th = shmap->max_f - deh.htonalwidth * (shmap->max_f - shmap->avg) / 100; + s_th = deh.stonalwidth * (shmap->avg - shmap->min_f) / 100; + } - if (mapval > h_th) { - factor = (h_th + hWeight * (mapval - h_th)) / mapval; - } else if (mapval < s_th) { - factor = (s_th - sWeight * (s_th - mapval)) / mapval; - } + if (mapmet > 0 && mapcontlutili && it == 1) { +#ifdef _OPENMP + #pragma omp parallel for +#endif - out[i][j] *= factor; + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + out[i][j] = mapcurve[2.f * out[i][j]]; + } + } + } + + if (((mapmet == 2 && scale > 2) || mapmet == 3 || mapmet == 4) && it == 1) { + const float hWeight = (100.f - shHighlights) / 100.f; + const float sWeight = (100.f - shShadows) / 100.f; +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + const float mapval = 1.f + shmap->map[i][j]; + float factor; + + if (mapval > h_th) { + factor = (h_th + hWeight * (mapval - h_th)) / mapval; + } else if (mapval < s_th) { + factor = (s_th - sWeight * (s_th - mapval)) / mapval; + } else { + factor = 1.f; } + + out[i][j] *= factor; + } + } + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = 0; i < H_L; i++) { + int j = 0; + +#ifdef __SSE2__ + const vfloat pondv = F2V(pond); + const vfloat limMinv = F2V(ilimdx); + const vfloat limMaxv = F2V(limdx); + if( useHslLin) { + for (; j < W_L - 3; j += 4) { + STVFU(luminance[i][j], LVFU(luminance[i][j]) + pondv * vclampf(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv)); + } + } else { + for (; j < W_L - 3; j += 4) { + STVFU(luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(vclampf(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv))); + } + } + +#endif + + if(useHslLin) { + for (; j < W_L; j++) { + luminance[i][j] += pond * LIM(src[i][j] / out[i][j], ilimdx, limdx); + } + } else { + for (; j < W_L; j++) { + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimdx, limdx)); // /logt ? + } + } + } + } + + srcBuffer.reset(); + + float mean = 0.f; + float stddv = 0.f; + // I call mean_stddv2 instead of mean_stddv ==> logBetaGain + + float maxtr, mintr; + mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr); + //printf("mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", mean, stddv, delta, maxtr, mintr); + + //mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain, maxtr, mintr); + if (dehatransmissionCurve && mean != 0.f && stddv != 0.f) { //if curve + float asig = 0.166666f / stddv; + float bsig = 0.5f - asig * mean; + float amax = 0.333333f / (maxtr - mean - stddv); + float bmax = 1.f - amax * maxtr; + float amin = 0.333333f / (mean - stddv - mintr); + float bmin = -amin * mintr; + + asig *= 500.f; + bsig *= 500.f; + amax *= 500.f; + bmax *= 500.f; + amin *= 500.f; + bmin *= 500.f; + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int i = 0; i < H_L; i++ ) { + for (int j = 0; j < W_L; j++) { //for mintr to maxtr evalate absciss in function of original transmission + float absciss; + if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) { + absciss = asig * luminance[i][j] + bsig; + } else if (luminance[i][j] >= mean) { + absciss = amax * luminance[i][j] + bmax; + } else { /*if(luminance[i][j] <= mean - stddv)*/ + absciss = amin * luminance[i][j] + bmin; + } + + //TODO : move multiplication by 4.f and subtraction of 1.f inside the curve + luminance[i][j] *= (-1.f + 4.f * dehatransmissionCurve[absciss]); //new transmission + + if(viewmet == 3 || viewmet == 2) { + tran[i][j] = luminance[i][j]; + } + } + } + + // median filter on transmission ==> reduce artifacts + if (deh.medianmap && it == 1) { //only one time + JaggedArray tmL(W_L, H_L); + constexpr int borderL = 1; + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = borderL; i < H_L - borderL; i++) { + for (int j = borderL; j < W_L - borderL; j++) { + tmL[i][j] = median(luminance[i][j], luminance[i - 1][j], luminance[i + 1][j], luminance[i][j + 1], luminance[i][j - 1], luminance[i - 1][j - 1], luminance[i - 1][j + 1], luminance[i + 1][j - 1], luminance[i + 1][j + 1]); //3x3 } } @@ -499,307 +560,164 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e #pragma omp parallel for #endif - for (int i = 0; i < H_L; i++) { - int j = 0; - -#ifdef __SSE2__ - - if(useHslLin) { - for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * (vclampf(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); - } - } else { - for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(vclampf(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); - } - } - -#endif - - if(useHslLin) { - for (; j < W_L; j++) { - luminance[i][j] += pond * (LIM(src[i][j] / out[i][j], ilimdx, limdx)); - } - } else { - for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimdx, limdx)); // /logt ? - } + for (int i = borderL; i < H_L - borderL; i++ ) { + for (int j = borderL; j < W_L - borderL; j++) { + luminance[i][j] = tmL[i][j]; } } } - if(mapmet > 1) { - if(shmap) { - delete shmap; - } - } - - shmap = nullptr; - - delete [] buffer; - delete [] srcBuffer; - - float mean = 0.f; - float stddv = 0.f; // I call mean_stddv2 instead of mean_stddv ==> logBetaGain + //mean_stddv( luminance, mean, stddv, W_L, H_L, 1.f, maxtr, mintr); + mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr); + } - mean_stddv2( luminance, mean, stddv, W_L, H_L, maxtr, mintr); - //printf("mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", mean, stddv, delta, maxtr, mintr); + constexpr float epsil = 0.1f; - //mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain, maxtr, mintr); - if (dehatransmissionCurve && mean != 0.f && stddv != 0.f) { //if curve - float asig = 0.166666f / stddv; - float bsig = 0.5f - asig * mean; - float amax = 0.333333f / (maxtr - mean - stddv); - float bmax = 1.f - amax * maxtr; - float amin = 0.333333f / (mean - stddv - mintr); - float bmin = -amin * mintr; + mini = mean - varx * stddv; - asig *= 500.f; - bsig *= 500.f; - amax *= 500.f; - bmax *= 500.f; - amin *= 500.f; - bmin *= 500.f; + if (mini < mintr) { + mini = mintr + epsil; + } -#ifdef _OPENMP - #pragma omp parallel -#endif - { - float absciss; -#ifdef _OPENMP - #pragma omp for schedule(dynamic,16) -#endif + maxi = mean + varx * stddv; - for (int i = 0; i < H_L; i++ ) - for (int j = 0; j < W_L; j++) { //for mintr to maxtr evalate absciss in function of original transmission - if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) { - absciss = asig * luminance[i][j] + bsig; - } else if (luminance[i][j] >= mean) { - absciss = amax * luminance[i][j] + bmax; - } else { /*if(luminance[i][j] <= mean - stddv)*/ - absciss = amin * luminance[i][j] + bmin; - } + if (maxi > maxtr) { + maxi = maxtr - epsil; + } - //TODO : move multiplication by 4.f and subtraction of 1.f inside the curve - luminance[i][j] *= (-1.f + 4.f * dehatransmissionCurve[absciss]); //new transmission + float delta = maxi - mini; + //printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); - if(viewmet == 3 || viewmet == 2) { - tran[i][j] = luminance[i][j]; - } - } - } + if ( !delta ) { + delta = 1.0f; + } - // median filter on transmission ==> reduce artifacts - if (deh.medianmap && it == 1) { //only one time - int wid = W_L; - int hei = H_L; - float *tmL[hei] ALIGNED16; - float *tmLBuffer = new float[wid * hei]; - int borderL = 1; - - for (int i = 0; i < hei; i++) { - tmL[i] = &tmLBuffer[i * wid]; - } - -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int i = borderL; i < hei - borderL; i++) { - for (int j = borderL; j < wid - borderL; j++) { - tmL[i][j] = median(luminance[i][j], luminance[i - 1][j], luminance[i + 1][j], luminance[i][j + 1], luminance[i][j - 1], luminance[i - 1][j - 1], luminance[i - 1][j + 1], luminance[i + 1][j - 1], luminance[i + 1][j + 1]); //3x3 - } - } - -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int i = borderL; i < hei - borderL; i++ ) { - for (int j = borderL; j < wid - borderL; j++) { - luminance[i][j] = tmL[i][j]; - } - } - - delete [] tmLBuffer; - - } - - // I call mean_stddv2 instead of mean_stddv ==> logBetaGain - //mean_stddv( luminance, mean, stddv, W_L, H_L, 1.f, maxtr, mintr); - mean_stddv2( luminance, mean, stddv, W_L, H_L, maxtr, mintr); - - } - - float epsil = 0.1f; - - mini = mean - varx * stddv; - - if (mini < mintr) { - mini = mintr + epsil; - } - - maxi = mean + varx * stddv; - - if (maxi > maxtr) { - maxi = maxtr - epsil; - } - - float delta = maxi - mini; - //printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); - - if ( !delta ) { - delta = 1.0f; - } - - float cdfactor = 32768.f / delta; - maxCD = -9999999.f; - minCD = 9999999.f; - // coeff for auto "transmission" with 2 sigma #95% data - float aza = 16300.f / (2.f * stddv); - float azb = -aza * (mean - 2.f * stddv); - float bza = 16300.f / (2.f * stddv); - float bzb = 16300.f - bza * (mean); + // coeff for auto "transmission" with 2 sigma #95% data + const float aza = 16300.f / (2.f * stddv); + const float azb = -aza * (mean - 2.f * stddv); + const float bza = 16300.f / (2.f * stddv); + const float bzb = 16300.f - bza * (mean); //prepare work for curve gain #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int i = 0; i < H_L; i++) { - for (int j = 0; j < W_L; j++) { - luminance[i][j] = luminance[i][j] - mini; - } + for (int i = 0; i < H_L; i++) { + for (int j = 0; j < W_L; j++) { + luminance[i][j] = luminance[i][j] - mini; } + } - mean = 0.f; - stddv = 0.f; - // I call mean_stddv2 instead of mean_stddv ==> logBetaGain + mean = 0.f; + stddv = 0.f; + // I call mean_stddv2 instead of mean_stddv ==> logBetaGain - mean_stddv2( luminance, mean, stddv, W_L, H_L, maxtr, mintr); - float asig = 0.f, bsig = 0.f, amax = 0.f, bmax = 0.f, amin = 0.f, bmin = 0.f; + mean_stddv2(luminance, mean, stddv, W_L, H_L, maxtr, mintr); + float asig = 0.f, bsig = 0.f, amax = 0.f, bmax = 0.f, amin = 0.f, bmin = 0.f; - if (dehagaintransmissionCurve && mean != 0.f && stddv != 0.f) { //if curve - asig = 0.166666f / stddv; - bsig = 0.5f - asig * mean; - amax = 0.333333f / (maxtr - mean - stddv); - bmax = 1.f - amax * maxtr; - amin = 0.333333f / (mean - stddv - mintr); - bmin = -amin * mintr; + if (dehagaintransmissionCurve && mean != 0.f && stddv != 0.f) { //if curve + asig = 0.166666f / stddv; + bsig = 0.5f - asig * mean; + amax = 0.333333f / (maxtr - mean - stddv); + bmax = 1.f - amax * maxtr; + amin = 0.333333f / (mean - stddv - mintr); + bmin = -amin * mintr; - asig *= 500.f; - bsig *= 500.f; - amax *= 500.f; - bmax *= 500.f; - amin *= 500.f; - bmin *= 500.f; - } + asig *= 500.f; + bsig *= 500.f; + amax *= 500.f; + bmax *= 500.f; + amin *= 500.f; + bmin *= 500.f; + } + + const float cdfactor = 32768.f / delta; + maxCD = -9999999.f; + minCD = 9999999.f; #ifdef _OPENMP - #pragma omp parallel -#endif - { - float cdmax = -999999.f, cdmin = 999999.f; -#ifdef _OPENMP - #pragma omp for schedule(dynamic,16) nowait + #pragma omp parallel for reduction(max:maxCD) reduction(min:minCD) schedule(dynamic, 16) #endif - for ( int i = 0; i < H_L; i ++ ) - for (int j = 0; j < W_L; j++) { - float gan; + for ( int i = 0; i < H_L; i ++ ) { + for (int j = 0; j < W_L; j++) { + float gan; - if (dehagaintransmissionCurve && mean != 0.f && stddv != 0.f) { - float absciss; - - if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) { - absciss = asig * luminance[i][j] + bsig; - } else if (luminance[i][j] >= mean) { - absciss = amax * luminance[i][j] + bmax; - } else { /*if(luminance[i][j] <= mean - stddv)*/ - absciss = amin * luminance[i][j] + bmin; - } - - - // float cd = cdfactor * ( luminance[i][j] - mini ) + offse; - // TODO : move multiplication by 2.f inside the curve - gan = 2.f * (dehagaintransmissionCurve[absciss]); //new gain function transmission - } else { - gan = 0.5f; - } - - float cd = gan * cdfactor * ( luminance[i][j] ) + offse; - - cdmax = cd > cdmax ? cd : cdmax; - cdmin = cd < cdmin ? cd : cdmin; - - float str = strengthx; - - if(lhutili && it == 1) { // S=f(H) - { - float HH = exLuminance[i][j]; - float valparam; - - if(useHsl || useHslLin) { - valparam = float((shcurve->getVal(HH) - 0.5f)); - } else { - valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); - } - - str *= (1.f + 2.f * valparam); - } - } - - if(higplus && exLuminance[i][j] > 65535.f * hig) { - str *= hig; - } - - if(viewmet == 0) { - luminance[i][j] = intp(str, clipretinex( cd, 0.f, 32768.f ), originalLuminance[i][j]); - } else if(viewmet == 1) { - luminance[i][j] = out[i][j]; - } else if(viewmet == 4) { - luminance[i][j] = originalLuminance[i][j] + str * (originalLuminance[i][j] - out[i][j]);//unsharp - } else if(viewmet == 2) { - if(tran[i][j] <= mean) { - luminance[i][j] = azb + aza * tran[i][j]; //auto values - } else { - luminance[i][j] = bzb + bza * tran[i][j]; - } - } else { /*if(viewmet == 3) */ - luminance[i][j] = 1000.f + tran[i][j] * 700.f; //arbitrary values to help display log values which are between -20 to + 30 - usage values -4 + 5 - } + if (dehagaintransmissionCurve && mean != 0.f && stddv != 0.f) { + float absciss; + if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) { + absciss = asig * luminance[i][j] + bsig; + } else if (luminance[i][j] >= mean) { + absciss = amax * luminance[i][j] + bmax; + } else { /*if(luminance[i][j] <= mean - stddv)*/ + absciss = amin * luminance[i][j] + bmin; } -#ifdef _OPENMP - #pragma omp critical -#endif - { - maxCD = maxCD > cdmax ? maxCD : cdmax; - minCD = minCD < cdmin ? minCD : cdmin; + + // float cd = cdfactor * ( luminance[i][j] - mini ) + offse; + // TODO : move multiplication by 2.f inside the curve + gan = 2.f * dehagaintransmissionCurve[absciss]; //new gain function transmission + } else { + gan = 0.5f; + } + + const float cd = gan * cdfactor * luminance[i][j] + offse; + + maxCD = cd > maxCD ? cd : maxCD; + minCD = cd < minCD ? cd : minCD; + + float str = strengthx; + + if (lhutili && it == 1) { // S=f(H) + { + const float HH = exLuminance[i][j]; + float valparam; + + if(useHsl || useHslLin) { + valparam = shcurve->getVal(HH) - 0.5f; + } else { + valparam = shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f; + } + + str *= (1.f + 2.f * valparam); + } + } + + if (higplus && exLuminance[i][j] > 65535.f * hig) { + str *= hig; + } + + if (viewmet == 0) { + luminance[i][j] = intp(str, LIM(cd, 0.f, 32768.f), originalLuminance[i][j]); + } else if (viewmet == 1) { + luminance[i][j] = out[i][j]; + } else if (viewmet == 4) { + luminance[i][j] = originalLuminance[i][j] + str * (originalLuminance[i][j] - out[i][j]);//unsharp + } else if (viewmet == 2) { + if(tran[i][j] <= mean) { + luminance[i][j] = azb + aza * tran[i][j]; //auto values + } else { + luminance[i][j] = bzb + bza * tran[i][j]; + } + } else { /*if (viewmet == 3) */ + luminance[i][j] = 1000.f + tran[i][j] * 700.f; //arbitrary values to help display log values which are between -20 to + 30 - usage values -4 + 5 } } - - delete [] outBuffer; - outBuffer = nullptr; - //printf("cdmin=%f cdmax=%f\n",minCD, maxCD); - Tmean = mean; - Tsigma = stddv; - Tmin = mintr; - Tmax = maxtr; - - if (shcurve) { - delete shcurve; - shcurve = nullptr; - } } - if(tranBuffer) { - delete [] tranBuffer; - } + Tmean = mean; + Tsigma = stddv; + Tmin = mintr; + Tmax = maxtr; + if (shcurve) { + delete shcurve; + shcurve = nullptr; + } } } diff --git a/rtengine/ipshadowshighlights.cc b/rtengine/ipshadowshighlights.cc index 0052789b8..ae1fbadfa 100644 --- a/rtengine/ipshadowshighlights.cc +++ b/rtengine/ipshadowshighlights.cc @@ -20,11 +20,15 @@ #include "improcfun.h" +#include "color.h" +#include "curves.h" #include "gauss.h" #include "guidedfilter.h" +#include "iccstore.h" +#include "labimage.h" #include "opthelper.h" #include "procparams.h" -#include "sleef.c" +#include "sleef.h" namespace rtengine { //modifications to pass parameters needs by locallab, to avoid 2 functions - no change in process - J.Desmis march 2019 diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index bbd1de155..a35476d3a 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -17,22 +17,27 @@ * along with RawTherapee. If not, see . */ -#include "improcfun.h" -#include "gauss.h" #include "bilateral2.h" +#include "cieimage.h" +#include "gauss.h" +#include "improcfun.h" #include "jaggedarray.h" -#include "rt_math.h" -#include "procparams.h" -#include "sleef.c" +#include "labimage.h" #include "opthelper.h" +#include "procparams.h" +#include "rt_algo.h" +#include "rt_math.h" +#include "settings.h" +#include "sleef.h" + //#define BENCHMARK #include "StopWatch.h" -#include "rt_algo.h" + using namespace std; namespace { -void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, float** blend, int W, int H, const SharpeningParams &sharpenParam) +void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, float** blend, int W, int H, const procparams::SharpeningParams &sharpenParam) { const float scale = (100.f - sharpenParam.halocontrol_amount) * 0.01f; @@ -156,9 +161,7 @@ void dcdamping (float** aI, float** aO, float damping, int W, int H) namespace rtengine { -extern const Settings* settings; - -void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, const float * const * blend, int W, int H, const SharpeningParams &sharpenParam, double Scale) +void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, const float * const * blend, int W, int H, const procparams::SharpeningParams &sharpenParam, double Scale) { if (sharpenParam.deconvamount == 0 && sharpenParam.blurradius < 0.25f) { return; @@ -207,13 +210,13 @@ BENCHFUN for (int k = 0; k < sharpenParam.deconviter; k++) { if (!needdamp) { // apply gaussian blur and divide luminance by result of gaussian blur - gaussianBlur(tmpI, tmp, W, H, sigma, nullptr, GAUSS_DIV, luminance); + gaussianBlur(tmpI, tmp, W, H, sigma, false, GAUSS_DIV, luminance); } else { // apply gaussian blur + damping gaussianBlur(tmpI, tmp, W, H, sigma); dcdamping(tmp, luminance, damping, W, H); } - gaussianBlur(tmp, tmpI, W, H, sigma, nullptr, GAUSS_MULT); + gaussianBlur(tmp, tmpI, W, H, sigma, false, GAUSS_MULT); } // end for #ifdef _OPENMP @@ -241,7 +244,7 @@ BENCHFUN delete blurbuffer; } -void ImProcFunctions::sharpening (LabImage* lab, const SharpeningParams &sharpenParam, bool showMask) +void ImProcFunctions::sharpening (LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask) { if ((!sharpenParam.enabled) || sharpenParam.amount < 1 || lab->W < 8 || lab->H < 8) { diff --git a/rtengine/ipsoftlight.cc b/rtengine/ipsoftlight.cc index cd49e858f..41d0d48bf 100644 --- a/rtengine/ipsoftlight.cc +++ b/rtengine/ipsoftlight.cc @@ -19,7 +19,10 @@ * along with RawTherapee. If not, see . */ +#include "color.h" +#include "iccstore.h" #include "improcfun.h" +#include "labimage.h" #include "procparams.h" diff --git a/rtengine/iptcpairs.h b/rtengine/iptcpairs.h index 21099735a..af45d7d38 100644 --- a/rtengine/iptcpairs.h +++ b/rtengine/iptcpairs.h @@ -16,9 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IPTCPAIRS_ -#define _IPTCPAIRS_ - +#pragma once struct IptcPair { IptcTag tag; @@ -44,6 +42,3 @@ const IptcPair strTags[] = { {IPTC_TAG_ORIG_TRANS_REF, 32, "TransReference"}, {IPTC_TAG_DATE_CREATED, 8, "DateCreated"} }; - -#endif - diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 69b57d0ba..a4f304413 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -18,18 +18,14 @@ */ #include -#ifdef _OPENMP -#include -#endif - +#include "imagefloat.h" #include "improcfun.h" -#include "mytime.h" #include "procparams.h" #include "rt_math.h" #include "rtengine.h" #include "rtlensfun.h" -#include "sleef.c" +#include "sleef.h" using namespace std; diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index a7199064a..14e5f3c44 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -23,16 +23,11 @@ #include "rtengine.h" #include "improcfun.h" #include "iccstore.h" -#include "mytime.h" -#include "../rtgui/thresholdselector.h" +#include "labimage.h" #include "curves.h" #include "color.h" #include "procparams.h" #include "StopWatch.h" -#ifdef _OPENMP -#include -#endif - using namespace std; diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index c479299a6..2c6d62844 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -28,21 +28,23 @@ #include "../rtgui/threadutils.h" -#include "rtengine.h" -#include "improcfun.h" -#include "LUT.h" #include "array2D.h" -#include "boxblur.h" -#include "rt_math.h" -#include "mytime.h" -#include "sleef.c" -#include "opthelper.h" -#include "median.h" +#include "color.h" +#include "curves.h" #include "EdgePreservingDecomposition.h" #include "iccstore.h" +#include "improcfun.h" +#include "labimage.h" +#include "LUT.h" +#include "median.h" +#include "opthelper.h" #include "procparams.h" +#include "rt_math.h" +#include "rtengine.h" +#include "sleef.h" +#include "../rtgui/options.h" #include "guidedfilter.h" - +#include "imagefloat.h" #ifdef _OPENMP #include #endif @@ -56,12 +58,9 @@ #define epsilon 0.001f/(TS*TS) //tolerance - namespace rtengine { -extern const Settings* settings; - struct cont_params { float mul[10]; int chrom; diff --git a/rtengine/jpeg.h b/rtengine/jpeg.h index 99baecc5a..9b1f45f1d 100644 --- a/rtengine/jpeg.h +++ b/rtengine/jpeg.h @@ -1,5 +1,4 @@ -#ifndef _RT_JPEG_H -#define _RT_JPEG_H +#pragma once #include @@ -29,6 +28,3 @@ typedef struct { #ifdef __cplusplus } #endif - - -#endif diff --git a/rtengine/labimage.cc b/rtengine/labimage.cc index b31bc89a1..153af4c75 100644 --- a/rtengine/labimage.cc +++ b/rtengine/labimage.cc @@ -17,7 +17,6 @@ * along with RawTherapee. If not, see . */ -#include #include #include "labimage.h" diff --git a/rtengine/labimage.h b/rtengine/labimage.h index bcc2484ab..79f003b07 100644 --- a/rtengine/labimage.h +++ b/rtengine/labimage.h @@ -16,8 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _LABIMAGE_H_ -#define _LABIMAGE_H_ +#pragma once + +#include namespace rtengine { @@ -45,4 +46,3 @@ public: }; } -#endif diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index b456fc478..57a87c1f1 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -18,8 +18,11 @@ */ #include +#include #include +#include +#include #include #ifdef WIN32 @@ -29,15 +32,11 @@ #include "lcp.h" +#include "opthelper.h" #include "procparams.h" +#include "rt_math.h" #include "settings.h" - -namespace rtengine -{ - -extern const Settings* settings; - -} +#include "utils.h" class rtengine::LCPProfile::LCPPersModel { @@ -984,7 +983,7 @@ rtengine::LCPMapper::LCPMapper( bool useCADistP, int fullWidth, int fullHeight, - const CoarseTransformParams& coarse, + const procparams::CoarseTransformParams& coarse, int rawRotationDeg ) : enableCA(false), diff --git a/rtengine/lcp.h b/rtengine/lcp.h index 30b7e5191..69fd43932 100644 --- a/rtengine/lcp.h +++ b/rtengine/lcp.h @@ -25,16 +25,23 @@ #include #include -#include +#include #include #include "cache.h" -#include "imagefloat.h" -#include "opthelper.h" namespace rtengine { +namespace procparams +{ + +class ProcParams; + +struct CoarseTransformParams; + +} + enum class LCPCorrectionMode { VIGNETTE, DISTORTION, @@ -185,7 +192,7 @@ public: bool useCADistP, int fullWidth, int fullHeight, - const CoarseTransformParams& coarse, + const procparams::CoarseTransformParams& coarse, int rawRotationDeg ); diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc index 259e08565..842766dcf 100644 --- a/rtengine/myfile.cc +++ b/rtengine/myfile.cc @@ -18,8 +18,7 @@ */ #include "myfile.h" #include -#include - +#include "rtengine.h" // get mmap() sorted out #ifdef MYFILE_MMAP diff --git a/rtengine/myfile.h b/rtengine/myfile.h index f2ed4150c..7c498e556 100644 --- a/rtengine/myfile.h +++ b/rtengine/myfile.h @@ -16,13 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _MYFILE_ -#define _MYFILE_ +#pragma once -#include #include #include -#include "rtengine.h" + +#include + +#include "opthelper.h" + +namespace rtengine +{ + +class ProgressListener; + +} + struct IMFILE { int fd; ssize_t pos; @@ -134,6 +143,3 @@ inline unsigned char* fdata(int offset, IMFILE* f) int fscanf (IMFILE* f, const char* s ...); char* fgets (char* s, int n, IMFILE* f); - -#endif - diff --git a/rtengine/pdaflinesfilter.cc b/rtengine/pdaflinesfilter.cc index d0694fd11..8ac0d3091 100644 --- a/rtengine/pdaflinesfilter.cc +++ b/rtengine/pdaflinesfilter.cc @@ -18,17 +18,19 @@ * along with RawTherapee. If not, see . */ -#include "pdaflinesfilter.h" -#include "settings.h" #include + #include "camconst.h" +#include "pdaflinesfilter.h" +#include "pixelsmap.h" +#include "rawimage.h" +#include "settings.h" -namespace rtengine { +namespace rtengine +{ -extern const Settings *settings; - - -namespace { +namespace +{ class PDAFGreenEqulibrateThreshold: public RawImageSource::GreenEqulibrateThreshold { static constexpr float BASE_THRESHOLD = 0.5f; @@ -166,8 +168,6 @@ private: } // namespace - - PDAFLinesFilter::PDAFLinesFilter(RawImage *ri): ri_(ri), W_(ri->get_width()), diff --git a/rtengine/pdaflinesfilter.h b/rtengine/pdaflinesfilter.h index 7f4c7985b..c3d8b47f4 100644 --- a/rtengine/pdaflinesfilter.h +++ b/rtengine/pdaflinesfilter.h @@ -21,10 +21,14 @@ #pragma once #include -#include "rawimagesource.h" -#include "noncopyable.h" -namespace rtengine { +#include "noncopyable.h" +#include "rawimagesource.h" + +namespace rtengine +{ + +class RawImage; class PDAFLinesFilter: public rtengine::NonCopyable { diff --git a/rtengine/pipettebuffer.cc b/rtengine/pipettebuffer.cc index d915381ef..11cf50ae9 100644 --- a/rtengine/pipettebuffer.cc +++ b/rtengine/pipettebuffer.cc @@ -20,6 +20,7 @@ #include "pipettebuffer.h" #include "imagefloat.h" +#include "labimage.h" #include "../rtgui/editcallbacks.h" diff --git a/rtengine/pipettebuffer.h b/rtengine/pipettebuffer.h index 01b24720c..ef8a5f69a 100644 --- a/rtengine/pipettebuffer.h +++ b/rtengine/pipettebuffer.h @@ -31,6 +31,7 @@ namespace rtengine { class Imagefloat; +class LabImage; /// @brief Structure that contains information about and pointers to the Edit buffer class PipetteBuffer diff --git a/rtengine/pixelshift.cc b/rtengine/pixelshift.cc index 4b93f3f61..ff529697b 100644 --- a/rtengine/pixelshift.cc +++ b/rtengine/pixelshift.cc @@ -21,16 +21,27 @@ //////////////////////////////////////////////////////////////// #include -#include "rawimagesource.h" -#include "../rtgui/multilangmgr.h" -#include "procparams.h" +#include + +#include "array2D.h" #include "gauss.h" #include "median.h" +#include "procparams.h" +#include "rawimagesource.h" +#include "sleef.h" +#include "../rtgui/multilangmgr.h" +#include "../rtgui/options.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]; +} + float greenDiff(float a, float b, float stddevFactor, float eperIso, float nreadIso, float prnu) { // calculate the difference between two green samples @@ -107,9 +118,9 @@ void xorMasks(int xStart, int xEnd, int yStart, int yEnd, const array2D } } -void floodFill4Impl(int y, int x, int xStart, int xEnd, int yStart, int yEnd, array2D &mask, std::stack, std::vector>> &coordStack) +void floodFill4Impl(int yin, int xin, int xStart, int xEnd, int yStart, int yEnd, array2D &mask, std::stack, std::vector>> &coordStack) { - coordStack.emplace(x, y); + coordStack.emplace(xin, yin); while(!coordStack.empty()) { auto coord = coordStack.top(); @@ -295,7 +306,7 @@ void calcFrameBrightnessFactor(unsigned int frame, uint32_t datalen, LUTu *histo using namespace std; using namespace rtengine; -void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RAWParams &rawParamsIn, unsigned int frame, const std::string &make, const std::string &model, float rawWpCorrection) +void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const procparams::RAWParams &rawParamsIn, unsigned int frame, const std::string &make, const std::string &model, float rawWpCorrection) { BENCHFUN if(numFrames != 4) { // fallback for non pixelshift files @@ -303,19 +314,20 @@ BENCHFUN return; } - RAWParams::BayerSensor bayerParams = rawParamsIn.bayersensor; + procparams::RAWParams::BayerSensor bayerParams = rawParamsIn.bayersensor; bool motionDetection = true; - if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO) { + if(bayerParams.pixelShiftMotionCorrectionMethod == procparams::RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO) { bool pixelShiftEqualBright = bayerParams.pixelShiftEqualBright; bayerParams.setPixelShiftDefaults(); bayerParams.pixelShiftEqualBright = pixelShiftEqualBright; - } else if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::OFF) { + } else if(bayerParams.pixelShiftMotionCorrectionMethod == procparams::RAWParams::BayerSensor::PSMotionCorrectionMethod::OFF) { motionDetection = false; bayerParams.pixelShiftShowMotion = false; } + const unsigned int cfarray[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}}; const bool showMotion = bayerParams.pixelShiftShowMotion; const bool showOnlyMask = bayerParams.pixelShiftShowMotionMaskOnly && showMotion; const float smoothFactor = 1.0 - bayerParams.pixelShiftSmoothFactor; @@ -323,9 +335,9 @@ BENCHFUN if(motionDetection) { if(!showOnlyMask) { if(bayerParams.pixelShiftMedian) { // We need the demosaiced frames for motion correction - if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::LMMSE)) { + if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE)) { lmmse_interpolate_omp(winw, winh, *(rawDataFrames[0]), red, green, blue, bayerParams.lmmse_iterations); - } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4)) { + } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4)) { dual_demosaic_RT (true, rawParamsIn, winw, winh, *(rawDataFrames[0]), red, green, blue, bayerParams.dualDemosaicContrast, true); } else { amaze_demosaic_RT(winx, winy, winw, winh, *(rawDataFrames[0]), red, green, blue, options.chunkSizeAMAZE, options.measure); @@ -335,9 +347,9 @@ BENCHFUN multi_array2D blueTmp(winw, winh); for(int i = 0; i < 3; i++) { - if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::LMMSE)) { + if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE)) { lmmse_interpolate_omp(winw, winh, *(rawDataFrames[i + 1]), redTmp[i], greenTmp[i], blueTmp[i], bayerParams.lmmse_iterations); - } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4)) { + } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4)) { dual_demosaic_RT (true, rawParamsIn, winw, winh, *(rawDataFrames[i + 1]), redTmp[i], greenTmp[i], blueTmp[i], bayerParams.dualDemosaicContrast, true); } else { amaze_demosaic_RT(winx, winy, winw, winh, *(rawDataFrames[i + 1]), redTmp[i], greenTmp[i], blueTmp[i], options.chunkSizeAMAZE, options.measure); @@ -362,11 +374,11 @@ BENCHFUN } } } else { - if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::LMMSE)) { + if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE)) { lmmse_interpolate_omp(winw, winh, rawData, red, green, blue, bayerParams.lmmse_iterations); - } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4)) { - RAWParams rawParamsTmp = rawParamsIn; - rawParamsTmp.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4); + } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4)) { + procparams::RAWParams rawParamsTmp = rawParamsIn; + rawParamsTmp.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4); dual_demosaic_RT (true, rawParamsTmp, winw, winh, rawData, red, green, blue, bayerParams.dualDemosaicContrast, true); } else { amaze_demosaic_RT(winx, winy, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure); @@ -634,11 +646,11 @@ BENCHFUN for(int i = winy + 1; i < winh - 1; ++i) { int j = winx + 1; - int c = FC(i, j); + int c = fc(cfarray, i, j); - bool bluerow = (c + FC(i, j + 1)) == 3; + bool bluerow = (c + fc(cfarray, i, j + 1)) == 3; - for(int j = winx + 1, offset = FC(i, j) & 1; j < winw - 1; ++j, offset ^= 1) { + for(int j = winx + 1, offset = fc(cfarray, i, j) & 1; j < winw - 1; ++j, offset ^= 1) { (*histogreenThr[1 - offset])[(*rawDataFrames[1 - offset])[i - offset + 1][j]]++; (*histogreenThr[3 - offset])[(*rawDataFrames[3 - offset])[i + offset][j + 1]]++; @@ -719,9 +731,9 @@ BENCHFUN }; int ng = 0; int j = winx + 1; - int c = FC(i, j); + int c = fc(cfarray, i, j); - if((c + FC(i, j + 1)) == 3) { + if((c + fc(cfarray, i, j + 1)) == 3) { // row with blue pixels => swap destination pointers for non green pixels std::swap(nonGreenDest0, nonGreenDest1); ng ^= 1; @@ -776,7 +788,7 @@ BENCHFUN for(int i = winy + border - offsY; i < winh - (border + offsY); ++i) { // offset to keep the code short. It changes its value between 0 and 1 for each iteration of the loop - unsigned int offset = FC(i, winx + border - offsX) & 1; + unsigned int offset = fc(cfarray, i, winx + border - offsX) & 1; for(int j = winx + border - offsX; j < winw - (border + offsX); ++j, offset ^= 1) { psMask[i][j] = noMotion; @@ -912,7 +924,7 @@ BENCHFUN float *blueDest = blue[i + offsY]; // offset to keep the code short. It changes its value between 0 and 1 for each iteration of the loop - unsigned int offset = FC(i, winx + border - offsX) & 1; + unsigned int offset = fc(cfarray, i, winx + border - offsX) & 1; for(int j = winx + border - offsX; j < winw - (border + offsX); ++j, offset ^= 1) { if(showOnlyMask) { @@ -962,9 +974,9 @@ BENCHFUN float *nonGreenDest1 = blue[i]; int ng = 0; int j = winx + 1; - int c = FC(i, j); + int c = fc(cfarray, i, j); - if((c + FC(i, j + 1)) == 3) { + if((c + fc(cfarray, i, j + 1)) == 3) { // row with blue pixels => swap destination pointers for non green pixels std::swap(nonGreenDest0, nonGreenDest1); ng ^= 1; diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index 7216e6a34..de1603f1c 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -19,6 +19,7 @@ #include "previewimage.h" +#include "color.h" #include "iimage.h" #include "iimage.h" #include "procparams.h" diff --git a/rtengine/previewimage.h b/rtengine/previewimage.h index 71ddefe8a..e6c3ea070 100644 --- a/rtengine/previewimage.h +++ b/rtengine/previewimage.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PREVIEWIMAGE_ -#define _PREVIEWIMAGE_ +#pragma once + +#include -#include #include namespace rtengine @@ -52,5 +52,3 @@ public: }; } - -#endif diff --git a/rtengine/processingjob.h b/rtengine/processingjob.h index 004eb006f..6cdc6bd7c 100644 --- a/rtengine/processingjob.h +++ b/rtengine/processingjob.h @@ -16,11 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROCESSINGJOB_ -#define _PROCESSINGJOB_ +#pragma once -#include "rtengine.h" #include "procparams.h" +#include "rtengine.h" namespace rtengine { @@ -55,5 +54,3 @@ public: }; } - -#endif diff --git a/rtengine/procevents.h b/rtengine/procevents.h index ca098f216..1b00d4218 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -16,15 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __PROCEVENT__ -#define __PROCEVENT__ +#pragma once namespace rtengine { - - - // Aligned so the first entry starts on line 30 enum ProcEventCode { EvPhotoLoaded = 0, @@ -540,13 +536,11 @@ private: }; -inline bool operator==(ProcEvent a, ProcEvent b) { return int(a) == int(b); } -inline bool operator==(ProcEvent a, ProcEventCode b) { return int(a) == int(b); } -inline bool operator==(ProcEventCode a, ProcEvent b) { return int(a) == int(b); } -inline bool operator!=(ProcEvent a, ProcEvent b) { return int(a) != int(b); } -inline bool operator!=(ProcEvent a, ProcEventCode b) { return int(a) != int(b); } -inline bool operator!=(ProcEventCode a, ProcEvent b) { return int(a) != int(b); } +inline bool operator ==(ProcEvent a, ProcEvent b) { return int(a) == int(b); } +inline bool operator ==(ProcEvent a, ProcEventCode b) { return int(a) == int(b); } +inline bool operator ==(ProcEventCode a, ProcEvent b) { return int(a) == int(b); } +inline bool operator !=(ProcEvent a, ProcEvent b) { return int(a) != int(b); } +inline bool operator !=(ProcEvent a, ProcEventCode b) { return int(a) != int(b); } +inline bool operator !=(ProcEventCode a, ProcEvent b) { return int(a) != int(b); } } -#endif - diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 68960794e..6ffedf4a7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -22,9 +22,14 @@ #include #include +#include +#include +#include +#include "color.h" #include "curves.h" #include "procparams.h" +#include "utils.h" #include "../rtgui/multilangmgr.h" #include "../rtgui/options.h" diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 4d8f66ebd..75d1f2aab 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -20,10 +20,11 @@ #include #include +#include #include #include -#include +#include #include #include "noncopyable.h" diff --git a/rtengine/profilestore.cc b/rtengine/profilestore.cc index 5c38cf705..7d937e736 100644 --- a/rtengine/profilestore.cc +++ b/rtengine/profilestore.cc @@ -16,6 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include +#include + #include "profilestore.h" #include "dynamicprofile.h" @@ -156,7 +160,7 @@ void ProfileStore::_parseProfiles () if (findEntryFromFullPathU (options.defProfRaw) == nullptr) { options.setDefProfRawMissing (true); - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("WARNING: Default profile \"%s\" for raw images not found!\n", options.defProfRaw.c_str()); } } @@ -164,7 +168,7 @@ void ProfileStore::_parseProfiles () if (findEntryFromFullPathU (options.defProfImg) == nullptr) { options.setDefProfImgMissing (true); - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("WARNING: Default profile \"%s\" for standard images not found!\n", options.defProfImg.c_str()); } } @@ -216,7 +220,7 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath if (lastdot != Glib::ustring::npos && lastdot == currDir.length() - 4 && currDir.substr (lastdot).casefold() == paramFileExtension) { // file found - if ( options.rtSettings.verbose ) { + if (settings->verbose) { printf ("Processing file %s...", fname.c_str()); } @@ -229,7 +233,7 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath if (!res && pProf->pparams->ppVersion >= 220) { fileFound = true; - if ( options.rtSettings.verbose ) { + if (settings->verbose) { printf ("OK\n"); } @@ -240,7 +244,7 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath // map the partial profile partProfiles[filePSE] = pProf; //partProfiles.insert( std::pair (filePSE, pProf) ); - } else if ( options.rtSettings.verbose ) { + } else if (settings->verbose) { printf ("failed!\n"); } } @@ -518,7 +522,7 @@ PartialProfile *ProfileStore::loadDynamicProfile (const FramesMetaData *im) for (auto rule : dynamicRules) { if (rule.matches (im)) { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("found matching profile %s\n", rule.profilepath.c_str()); } diff --git a/rtengine/profilestore.h b/rtengine/profilestore.h index 384aa2a46..460facb72 100644 --- a/rtengine/profilestore.h +++ b/rtengine/profilestore.h @@ -16,16 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROFILESTORE_ -#define _PROFILESTORE_ +#pragma once #include #include -#include -#include "rtengine.h" -#include "noncopyable.h" +#include + #include "dynamicprofile.h" +#include "noncopyable.h" +#include "../rtgui/threadutils.h" // forward decl namespace rtengine @@ -34,6 +34,8 @@ namespace rtengine namespace procparams { +class ProcParams; + class AutoPartialProfile; class PartialProfile; @@ -211,5 +213,3 @@ public: void dumpFolderList(); }; - -#endif diff --git a/rtengine/rawflatfield.cc b/rtengine/rawflatfield.cc new file mode 100644 index 000000000..05b3be408 --- /dev/null +++ b/rtengine/rawflatfield.cc @@ -0,0 +1,537 @@ +/* + * This file is part of RawTherapee. + * + * Copyright (c) 2004-2019 Gabor Horvath + * + * 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 + +#include "rawimagesource.h" +#include "procparams.h" +#include "rawimage.h" +//#define BENCHMARK +//#include "StopWatch.h" +#include "opthelper.h" + +namespace { + +void cfaboxblur(const float* const * riFlatFile, float* cfablur, int boxH, int boxW, int H, int W) +{ + if (boxW < 0 || boxH < 0 || (boxW == 0 && boxH == 0)) { // nothing to blur or negative values + memcpy(cfablur, riFlatFile[0], static_cast(W) * H * sizeof(float)); + return; + } + + std::unique_ptr tmpBuffer; + float *cfatmp = cfablur; + + + if (boxH > 0 && boxW > 0) { + // we need a temporary buffer if we have to blur both directions + tmpBuffer.reset(new float [H * W]); + cfatmp = tmpBuffer.get(); + } + + // if boxW == 0 we can skip the horizontal blur and process the vertical blur from riFlatFile to cfablur without using a temporary buffer + const float* srcVertical = boxW == 0 ? riFlatFile[0] : cfatmp; + +#ifdef _OPENMP + #pragma omp parallel +#endif + { + + if (boxW > 0) { + //box blur cfa image; box size = BS + //horizontal blur +#ifdef _OPENMP + #pragma omp for +#endif + + for (int row = 0; row < H; ++row) { + int len = boxW / 2 + 1; + cfatmp[row * W] = riFlatFile[row][0] / len; + cfatmp[row * W + 1] = riFlatFile[row][1] / len; + + for (int j = 2; j <= boxW; j += 2) { + cfatmp[row * W] += riFlatFile[row][j] / len; + cfatmp[row * W + 1] += riFlatFile[row][j + 1] / len; + } + + for (int col = 2; col <= boxW; col += 2) { + cfatmp[row * W + col] = (cfatmp[row * W + col - 2] * len + riFlatFile[row][boxW + col]) / (len + 1); + cfatmp[row * W + col + 1] = (cfatmp[row * W + col - 1] * len + riFlatFile[row][boxW + col + 1]) / (len + 1); + len ++; + } + + const float rlen = 1.f / len; + for (int col = boxW + 2; col < W - boxW; col++) { + cfatmp[row * W + col] = cfatmp[row * W + col - 2] + (riFlatFile[row][boxW + col] - cfatmp[row * W + col - boxW - 2]) * rlen; + } + + for (int col = W - boxW; col < W; col += 2) { + cfatmp[row * W + col] = (cfatmp[row * W + col - 2] * len - cfatmp[row * W + col - boxW - 2]) / (len - 1); + + if (col + 1 < W) { + cfatmp[row * W + col + 1] = (cfatmp[row * W + col - 1] * len - cfatmp[row * W + col - boxW - 1]) / (len - 1); + } + + len --; + } + } + } + + if (boxH > 0) { + //vertical blur +#ifdef __SSE2__ + const vfloat leninitv = F2V(boxH / 2 + 1); + const vfloat onev = F2V(1.f); +#ifdef _OPENMP + #pragma omp for nowait +#endif + + for (int col = 0; col < W - 7; col += 8) { + vfloat lenv = leninitv; + vfloat temp1v = LVFU(srcVertical[col]) / lenv; + vfloat temp2v = LVFU(srcVertical[W + col]) / lenv; + vfloat temp3v = LVFU(srcVertical[col + 4]) / lenv; + vfloat temp4v = LVFU(srcVertical[W + col + 4]) / lenv; + + for (int i = 2; i < boxH + 2; i += 2) { + temp1v += LVFU(srcVertical[i * W + col]) / lenv; + temp2v += LVFU(srcVertical[(i + 1) * W + col]) / lenv; + temp3v += LVFU(srcVertical[i * W + col + 4]) / lenv; + temp4v += LVFU(srcVertical[(i + 1) * W + col + 4]) / lenv; + } + + STVFU(cfablur[col], temp1v); + STVFU(cfablur[W + col], temp2v); + STVFU(cfablur[col + 4], temp3v); + STVFU(cfablur[W + col + 4], temp4v); + + int row; + for (row = 2; row < boxH + 2; row += 2) { + const vfloat lenp1v = lenv + onev; + temp1v = (temp1v * lenv + LVFU(srcVertical[(row + boxH) * W + col])) / lenp1v; + temp2v = (temp2v * lenv + LVFU(srcVertical[(row + boxH + 1) * W + col])) / lenp1v; + temp3v = (temp3v * lenv + LVFU(srcVertical[(row + boxH) * W + col + 4])) / lenp1v; + temp4v = (temp4v * lenv + LVFU(srcVertical[(row + boxH + 1) * W + col + 4])) / lenp1v; + STVFU(cfablur[row * W + col], temp1v); + STVFU(cfablur[(row + 1) * W + col], temp2v); + STVFU(cfablur[row * W + col + 4], temp3v); + STVFU(cfablur[(row + 1) * W + col + 4], temp4v); + lenv = lenp1v; + } + + for (; row < H - boxH - 1; row += 2) { + temp1v = temp1v + (LVFU(srcVertical[(row + boxH) * W + col]) - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenv; + temp2v = temp2v + (LVFU(srcVertical[(row + 1 + boxH) * W + col]) - LVFU(srcVertical[(row + 1 - boxH - 2) * W + col])) / lenv; + temp3v = temp3v + (LVFU(srcVertical[(row + boxH) * W + col + 4]) - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenv; + temp4v = temp4v + (LVFU(srcVertical[(row + 1 + boxH) * W + col + 4]) - LVFU(srcVertical[(row + 1 - boxH - 2) * W + col + 4])) / lenv; + STVFU(cfablur[row * W + col], temp1v); + STVFU(cfablur[(row + 1) * W + col], temp2v); + STVFU(cfablur[row * W + col + 4], temp3v); + STVFU(cfablur[(row + 1) * W + col + 4], temp4v); + } + + if (row < H - boxH) { + temp1v = temp1v + (LVFU(srcVertical[(row + boxH) * W + col]) - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenv; + temp3v = temp3v + (LVFU(srcVertical[(row + boxH) * W + col + 4]) - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenv; + STVFU(cfablur[row * W + col], temp1v); + STVFU(cfablur[row * W + col + 4], temp3v); + vfloat swapv = temp1v; + temp1v = temp2v; + temp2v = swapv; + swapv = temp3v; + temp3v = temp4v; + temp4v = swapv; + ++row; + } + + for (; row < H - 1; row += 2) { + const vfloat lenm1v = lenv - onev; + temp1v = (temp1v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenm1v; + temp2v = (temp2v * lenv - LVFU(srcVertical[(row - boxH - 1) * W + col])) / lenm1v; + temp3v = (temp3v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenm1v; + temp4v = (temp4v * lenv - LVFU(srcVertical[(row - boxH - 1) * W + col + 4])) / lenm1v; + STVFU(cfablur[row * W + col], temp1v); + STVFU(cfablur[(row + 1) * W + col], temp2v); + STVFU(cfablur[row * W + col + 4], temp3v); + STVFU(cfablur[(row + 1) * W + col + 4], temp4v); + lenv = lenm1v; + } + + if (row < H) { + vfloat lenm1v = lenv - onev; + temp1v = (temp1v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenm1v; + temp3v = (temp3v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenm1v; + STVFU(cfablur[row * W + col], temp1v); + STVFU(cfablur[row * W + col + 4], temp3v); + } + + } + +#ifdef _OPENMP + #pragma omp single +#endif + + for (int col = W - (W % 8); col < W; ++col) { + int len = boxH / 2 + 1; + cfablur[col] = srcVertical[col] / len; + cfablur[W + col] = srcVertical[W + col] / len; + + for (int i = 2; i < boxH + 2; i += 2) { + cfablur[col] += srcVertical[i * W + col] / len; + cfablur[W + col] += srcVertical[(i + 1) * W + col] / len; + } + + for (int row = 2; row < boxH + 2; row += 2) { + cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len + srcVertical[(row + boxH) * W + col]) / (len + 1); + cfablur[(row + 1) * W + col] = (cfablur[(row - 1) * W + col] * len + srcVertical[(row + boxH + 1) * W + col]) / (len + 1); + ++len; + } + + for (int row = boxH + 2; row < H - boxH; ++row) { + cfablur[row * W + col] = cfablur[(row - 2) * W + col] + (srcVertical[(row + boxH) * W + col] - srcVertical[(row - boxH - 2) * W + col]) / len; + } + + for (int row = H - boxH; row < H; row += 2) { + cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len - srcVertical[(row - boxH - 2) * W + col]) / (len - 1); + + if (row + 1 < H) { + cfablur[(row + 1) * W + col] = (cfablur[(row - 1) * W + col] * len - srcVertical[(row - boxH - 1) * W + col]) / (len - 1); + } + --len; + } + } + +#else +#ifdef _OPENMP + #pragma omp for +#endif + + for (int col = 0; col < W; ++col) { + int len = boxH / 2 + 1; + cfablur[col] = srcVertical[col] / len; + cfablur[W + col] = srcVertical[W + col] / len; + + for (int i = 2; i < boxH + 2; i += 2) { + cfablur[col] += srcVertical[i * W + col] / len; + cfablur[W + col] += srcVertical[(i + 1) * W + col] / len; + } + + for (int row = 2; row < boxH + 2; row += 2) { + cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len + srcVertical[(row + boxH) * W + col]) / (len + 1); + cfablur[(row + 1) * W + col] = (cfablur[(row - 1) * W + col] * len + srcVertical[(row + boxH + 1) * W + col]) / (len + 1); + ++len; + } + + for (int row = boxH + 2; row < H - boxH; ++row) { + cfablur[row * W + col] = cfablur[(row - 2) * W + col] + (srcVertical[(row + boxH) * W + col] - srcVertical[(row - boxH - 2) * W + col]) / len; + } + + for (int row = H - boxH; row < H; row += 2) { + cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len - srcVertical[(row - boxH - 2) * W + col]) / (len - 1); + + if (row + 1 < H) { + cfablur[(row + 1) * W + col] = (cfablur[(row - 1) * W + col] * len - srcVertical[(row - boxH - 1) * W + col]) / (len - 1); + } + --len; + } + } +#endif + } + } +} + +} + +namespace rtengine +{ + +void RawImageSource::processFlatField(const procparams::RAWParams &raw, const RawImage *riFlatFile, const unsigned short black[4]) +{ +// BENCHFUN + const float fblack[4] = {static_cast(black[0]), static_cast(black[1]), static_cast(black[2]), static_cast(black[3])}; + std::unique_ptr cfablur(new float[H * W]); + + const int BS = raw.ff_BlurRadius + (raw.ff_BlurRadius & 1); + + if (raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeString(procparams::RAWParams::FlatFieldBlurType::V)) { + cfaboxblur(riFlatFile->data, cfablur.get(), 2 * BS, 0, H, W); + } else if (raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeString(procparams::RAWParams::FlatFieldBlurType::H)) { + cfaboxblur(riFlatFile->data, cfablur.get(), 0, 2 * BS, H, W); + } else if (raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeString(procparams::RAWParams::FlatFieldBlurType::VH)) { + //slightly more complicated blur if trying to correct both vertical and horizontal anomalies + cfaboxblur(riFlatFile->data, cfablur.get(), BS, BS, H, W); //first do area blur to correct vignette + } else { //(raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::area_ff)) + cfaboxblur(riFlatFile->data, cfablur.get(), BS, BS, H, W); + } + + if (ri->getSensorType() == ST_BAYER || ri->get_colors() == 1) { + float refcolor[2][2]; + + // find center values by channel + for (int m = 0; m < 2; ++m) + for (int n = 0; n < 2; ++n) { + const int row = 2 * (H >> 2) + m; + const int col = 2 * (W >> 2) + n; + const int c = ri->get_colors() != 1 ? FC(row, col) : 0; + const int c4 = ri->get_colors() != 1 ? ((c == 1 && !(row & 1)) ? 3 : c) : 0; + refcolor[m][n] = std::max(0.0f, cfablur[row * W + col] - fblack[c4]); + } + + float limitFactor = 1.f; + + if (raw.ff_AutoClipControl) { + bool clippedBefore = false; + for (int m = 0; m < 2 && !clippedBefore; ++m) { + for (int n = 0; n < 2 && !clippedBefore; ++n) { + float maxval = 0.f; + const int c = ri->get_colors() != 1 ? FC(m, n) : 0; + const int c4 = ri->get_colors() != 1 ? ((c == 1 && !(m & 1)) ? 3 : c) : 0; + const float clipVal = ri->get_white(c4); +#ifdef _OPENMP + #pragma omp parallel for reduction(max:maxval) schedule(dynamic, 16) +#endif + for (int row = 0; row < H - m; row += 2) { + for (int col = 0; col < W - n && !clippedBefore; col += 2) { + const float rawVal = rawData[row + m][col + n]; + if (rawVal >= clipVal) { + clippedBefore = true; + break; + } + const float tempval = (rawVal - fblack[c4]) * (refcolor[m][n] / std::max(1e-5f, cfablur[(row + m) * W + col + n] - fblack[c4])); + maxval = std::max(maxval, tempval); + } + } + + // now we have the max value for the channel + // if it clips, calculate factor to avoid clipping + if (maxval + fblack[c4] >= ri->get_white(c4)) { + if (!clippedBefore) { + limitFactor = std::min(limitFactor, ri->get_white(c4) / (maxval + fblack[c4])); + } else { + limitFactor = 1.f; + } + } + } + } + flatFieldAutoClipValue = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui + } else { + limitFactor = std::max((100 - raw.ff_clipControl) / 100.f, 0.01f); + } + + for (int m = 0; m < 2; ++m) + for (int n = 0; n < 2; ++n) { + refcolor[m][n] *= limitFactor; + } + + unsigned int c[2][2] {}; + unsigned int c4[2][2] {}; + if (ri->get_colors() != 1) { + for (int i = 0; i < 2; ++i) { + for (int j = 0; j < 2; ++j) { + c[i][j] = FC(i, j); + } + } + c4[0][0] = (c[0][0] == 1) ? 3 : c[0][0]; + c4[0][1] = (c[0][1] == 1) ? 3 : c[0][1]; + c4[1][0] = c[1][0]; + c4[1][1] = c[1][1]; + } + + constexpr float minValue = 1.f; // if the pixel value in the flat field is less or equal this value, no correction will be applied. + +#ifdef __SSE2__ + const vfloat refcolorv[2] = {_mm_set_ps(refcolor[0][1], refcolor[0][0], refcolor[0][1], refcolor[0][0]), + _mm_set_ps(refcolor[1][1], refcolor[1][0], refcolor[1][1], refcolor[1][0]) + }; + const vfloat blackv[2] = {_mm_set_ps(fblack[c4[0][1]], fblack[c4[0][0]], fblack[c4[0][1]], fblack[c4[0][0]]), + _mm_set_ps(fblack[c4[1][1]], fblack[c4[1][0]], fblack[c4[1][1]], fblack[c4[1][0]]) + }; + + const vfloat onev = F2V(1.f); + const vfloat minValuev = F2V(minValue); +#endif +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int row = 0; row < H; ++row) { + int col = 0; +#ifdef __SSE2__ + const vfloat rowBlackv = blackv[row & 1]; + const vfloat rowRefcolorv = refcolorv[row & 1]; + + for (; col < W - 3; col += 4) { + const vfloat blurv = LVFU(cfablur[row * W + col]) - rowBlackv; + vfloat vignettecorrv = rowRefcolorv / blurv; + vignettecorrv = vself(vmaskf_le(blurv, minValuev), onev, vignettecorrv); + const vfloat valv = LVFU(rawData[row][col]) - rowBlackv; + STVFU(rawData[row][col], valv * vignettecorrv + rowBlackv); + } + +#endif + + for (; col < W; ++col) { + const float blur = cfablur[row * W + col] - fblack[c4[row & 1][col & 1]]; + const float vignettecorr = blur <= minValue ? 1.f : refcolor[row & 1][col & 1] / blur; + rawData[row][col] = (rawData[row][col] - fblack[c4[row & 1][col & 1]]) * vignettecorr + fblack[c4[row & 1][col & 1]]; + } + } + } else if (ri->getSensorType() == ST_FUJI_XTRANS) { + float refcolor[3] = {0.f}; + int cCount[3] = {0}; + + // find center average values by channel + for (int m = -3; m < 3; ++m) + for (int n = -3; n < 3; ++n) { + const int row = 2 * (H >> 2) + m; + const int col = 2 * (W >> 2) + n; + const int c = riFlatFile->XTRANSFC(row, col); + refcolor[c] += std::max(0.0f, cfablur[row * W + col] - fblack[c]); + cCount[c] ++; + } + + for (int c = 0; c < 3; ++c) { + refcolor[c] = refcolor[c] / cCount[c]; + } + + float limitFactor = 1.f; + + if (raw.ff_AutoClipControl) { + // determine maximum calculated value to avoid clipping + bool clippedBefore = false; + const float clipVal = ri->get_white(0); + float maxval = 0.f; + // xtrans files have only one black level actually, so we can simplify the code a bit +#ifdef _OPENMP + #pragma omp parallel for reduction(max:maxval) schedule(dynamic,16) +#endif + for (int row = 0; row < H; ++row) { + for (int col = 0; col < W && !clippedBefore; ++col) { + const float rawVal = rawData[row][col]; + if (rawVal >= clipVal) { + clippedBefore = true; + break; + } + const float tempval = (rawVal - fblack[0]) * (refcolor[ri->XTRANSFC(row, col)] / std::max(1e-5f, cfablur[(row) * W + col] - fblack[0])); + maxval = std::max(maxval, tempval); + } + } + + // there's only one white level for xtrans + if (!clippedBefore && maxval + fblack[0] > ri->get_white(0)) { + limitFactor = ri->get_white(0) / (maxval + fblack[0]); + flatFieldAutoClipValue = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui + } + } else { + limitFactor = std::max((float)(100 - raw.ff_clipControl) / 100.f, 0.01f); + } + + + for (int c = 0; c < 3; ++c) { + refcolor[c] *= limitFactor; + } + + constexpr float minValue = 1.f; // if the pixel value in the flat field is less or equal this value, no correction will be applied. + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int row = 0; row < H; ++row) { + for (int col = 0; col < W; ++col) { + const int c = ri->XTRANSFC(row, col); + const float blur = cfablur[(row) * W + col] - fblack[c]; + const float vignettecorr = blur <= minValue ? 1.f : refcolor[c] / blur; + rawData[row][col] = (rawData[row][col] - fblack[c]) * vignettecorr + fblack[c]; + } + } + } + + if (raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeString(procparams::RAWParams::FlatFieldBlurType::VH)) { + std::unique_ptr cfablur1(new float[H * W]); + std::unique_ptr cfablur2(new float[H * W]); + //slightly more complicated blur if trying to correct both vertical and horizontal anomalies + cfaboxblur(riFlatFile->data, cfablur1.get(), 0, 2 * BS, H, W); //now do horizontal blur + cfaboxblur(riFlatFile->data, cfablur2.get(), 2 * BS, 0, H, W); //now do vertical blur + + if (ri->getSensorType() == ST_BAYER || ri->get_colors() == 1) { + unsigned int c[2][2] {}; + unsigned int c4[2][2] {}; + if (ri->get_colors() != 1) { + for (int i = 0; i < 2; ++i) { + for (int j = 0; j < 2; ++j) { + c[i][j] = FC(i, j); + } + } + c4[0][0] = (c[0][0] == 1) ? 3 : c[0][0]; + c4[0][1] = (c[0][1] == 1) ? 3 : c[0][1]; + c4[1][0] = c[1][0]; + c4[1][1] = c[1][1]; + } + +#ifdef __SSE2__ + const vfloat blackv[2] = {_mm_set_ps(fblack[c4[0][1]], fblack[c4[0][0]], fblack[c4[0][1]], fblack[c4[0][0]]), + _mm_set_ps(fblack[c4[1][1]], fblack[c4[1][0]], fblack[c4[1][1]], fblack[c4[1][0]]) + }; + + const vfloat epsv = F2V(1e-5f); +#endif +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int row = 0; row < H; ++row) { + int col = 0; +#ifdef __SSE2__ + const vfloat rowBlackv = blackv[row & 1]; + + for (; col < W - 3; col += 4) { + const vfloat linecorrv = SQRV(vmaxf(LVFU(cfablur[row * W + col]) - rowBlackv, epsv)) / + (vmaxf(LVFU(cfablur1[row * W + col]) - rowBlackv, epsv) * vmaxf(LVFU(cfablur2[row * W + col]) - rowBlackv, epsv)); + const vfloat valv = LVFU(rawData[row][col]) - rowBlackv; + STVFU(rawData[row][col], valv * linecorrv + rowBlackv); + } + +#endif + + for (; col < W; ++col) { + const float linecorr = SQR(std::max(1e-5f, cfablur[row * W + col] - fblack[c4[row & 1][col & 1]])) / + (std::max(1e-5f, cfablur1[row * W + col] - fblack[c4[row & 1][col & 1]]) * std::max(1e-5f, cfablur2[row * W + col] - fblack[c4[row & 1][col & 1]])); + rawData[row][col] = (rawData[row][col] - fblack[c4[row & 1][col & 1]]) * linecorr + fblack[c4[row & 1][col & 1]]; + } + } + } else if (ri->getSensorType() == ST_FUJI_XTRANS) { +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int row = 0; row < H; ++row) { + for (int col = 0; col < W; ++col) { + const int c = ri->XTRANSFC(row, col); + const float hlinecorr = std::max(1e-5f, cfablur[(row) * W + col] - fblack[c]) / std::max(1e-5f, cfablur1[(row) * W + col] - fblack[c]); + const float vlinecorr = std::max(1e-5f, cfablur[(row) * W + col] - fblack[c]) / std::max(1e-5f, cfablur2[(row) * W + col] - fblack[c]); + rawData[row][col] = (rawData[row][col] - fblack[c]) * hlinecorr * vlinecorr + fblack[c]; + } + } + } + } +} +} /* namespace */ diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc index 0134d4d16..4421e4af4 100644 --- a/rtengine/rawimage.cc +++ b/rtengine/rawimage.cc @@ -15,12 +15,11 @@ #include "settings.h" #include "camconst.h" #include "utils.h" +#include "rtengine.h" namespace rtengine { -extern const Settings* settings; - RawImage::RawImage( const Glib::ustring &name ) : data(nullptr) , prefilters(0) diff --git a/rtengine/rawimage.h b/rtengine/rawimage.h index 9c6d42969..09aaed7ad 100644 --- a/rtengine/rawimage.h +++ b/rtengine/rawimage.h @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __RAWIMAGE_H -#define __RAWIMAGE_H +#pragma once #include #include #include +#include #include "dcraw.h" #include "imageformat.h" @@ -307,5 +307,3 @@ public: }; } - -#endif // __RAWIMAGE_H diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 5f1d13c79..4cfa84434 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -19,32 +19,38 @@ #include #include -#include "rtengine.h" -#include "rawimagesource.h" -#include "rawimagesource_i.h" -#include "jaggedarray.h" -#include "median.h" -#include "rawimage.h" -#include "mytime.h" -#include "iccstore.h" +#include "camconst.h" +#include "color.h" #include "curves.h" +#include "dcp.h" #include "dfmanager.h" #include "ffmanager.h" -#include "dcp.h" -#include "rt_math.h" +#include "iccstore.h" +#include "imagefloat.h" #include "improcfun.h" -#include "rtlensfun.h" +#include "jaggedarray.h" +#include "median.h" +#include "mytime.h" #include "pdaflinesfilter.h" -#include "camconst.h" #include "procparams.h" -#include "color.h" +#include "rawimage.h" +#include "rawimagesource_i.h" +#include "rawimagesource.h" +#include "rt_math.h" +#include "rtengine.h" +#include "rtlensfun.h" +#include "../rtgui/options.h" + //#define BENCHMARK //#include "StopWatch.h" + #ifdef _OPENMP #include #endif + #include "opthelper.h" #define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) + #undef CLIPD #define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) @@ -419,7 +425,6 @@ void transLineD1x (const float* const red, const float* const green, const float namespace rtengine { -extern const Settings* settings; #undef ABS #undef DIST @@ -500,6 +505,26 @@ RawImageSource::~RawImageSource () } } +unsigned RawImageSource::FC(int row, int col) const +{ + return ri->FC(row, col); +} + +eSensorType RawImageSource::getSensorType () const +{ + return ri != nullptr ? ri->getSensorType() : ST_NONE; +} + +bool RawImageSource::isMono() const +{ + return ri->get_colors() == 1; +} + +int RawImageSource::getRotateDegree() const +{ + return ri->get_rotateDegree(); +} + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void RawImageSource::transformRect (const PreviewProps &pp, int tran, int &ssx1, int &ssy1, int &width, int &height, int &fw) @@ -913,7 +938,7 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima } } -DCPProfile *RawImageSource::getDCP(const ColorManagementParams &cmp, DCPProfile::ApplyState &as) +DCPProfile *RawImageSource::getDCP(const ColorManagementParams &cmp, DCPProfileApplyState &as) { if (cmp.inputProfile == "(camera)" || cmp.inputProfile == "(none)") { return nullptr; @@ -1950,8 +1975,8 @@ void RawImageSource::retinexPrepareCurves(const RetinexParams &retinexParams, LU CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdcurve, cdcurve, 1, lhist16RETI, histLRETI); } - CurveFactory::mapcurve (mapcontlutili, retinexParams.mapcurve, mapcurve, 1, lhist16RETI, histLRETI); - + CurveFactory::mapcurve(mapcontlutili, retinexParams.mapcurve, mapcurve, 1, lhist16RETI, histLRETI); + mapcurve *= 0.5f; retinexParams.getCurves(retinextransmissionCurve, retinexgaintransmissionCurve); } @@ -2386,311 +2411,6 @@ void RawImageSource::HLRecovery_Global(const ToneCurveParams &hrp) } - -void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile, unsigned short black[4]) -{ -// BENCHFUN - float *cfablur = (float (*)) malloc (H * W * sizeof * cfablur); - int BS = raw.ff_BlurRadius; - BS += BS & 1; - - //function call to cfabloxblur - if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::V)) { - cfaboxblur(riFlatFile, cfablur, 2 * BS, 0); - } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::H)) { - cfaboxblur(riFlatFile, cfablur, 0, 2 * BS); - } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::VH)) { - //slightly more complicated blur if trying to correct both vertical and horizontal anomalies - cfaboxblur(riFlatFile, cfablur, BS, BS); //first do area blur to correct vignette - } else { //(raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::area_ff)) - cfaboxblur(riFlatFile, cfablur, BS, BS); - } - - if(ri->getSensorType() == ST_BAYER || ri->get_colors() == 1) { - float refcolor[2][2]; - - //find centre average values by channel - for (int m = 0; m < 2; m++) - for (int n = 0; n < 2; n++) { - int row = 2 * (H >> 2) + m; - int col = 2 * (W >> 2) + n; - int c = ri->get_colors() != 1 ? FC(row, col) : 0; - int c4 = ri->get_colors() != 1 ? (( c == 1 && !(row & 1) ) ? 3 : c) : 0; - refcolor[m][n] = max(0.0f, cfablur[row * W + col] - black[c4]); - } - - float limitFactor = 1.f; - - if(raw.ff_AutoClipControl) { - for (int m = 0; m < 2; m++) - for (int n = 0; n < 2; n++) { - float maxval = 0.f; - int c = ri->get_colors() != 1 ? FC(m, n) : 0; - int c4 = ri->get_colors() != 1 ? (( c == 1 && !(m & 1) ) ? 3 : c) : 0; -#ifdef _OPENMP - #pragma omp parallel -#endif - { - float maxvalthr = 0.f; -#ifdef _OPENMP - #pragma omp for -#endif - - for (int row = 0; row < H - m; row += 2) { - for (int col = 0; col < W - n; col += 2) { - float tempval = (rawData[row + m][col + n] - black[c4]) * ( refcolor[m][n] / max(1e-5f, cfablur[(row + m) * W + col + n] - black[c4]) ); - - if(tempval > maxvalthr) { - maxvalthr = tempval; - } - } - } - -#ifdef _OPENMP - #pragma omp critical -#endif - { - - if(maxvalthr > maxval) { - maxval = maxvalthr; - } - - } - } - - // now we have the max value for the channel - // if it clips, calculate factor to avoid clipping - if(maxval + black[c4] >= ri->get_white(c4)) { - limitFactor = min(limitFactor, ri->get_white(c4) / (maxval + black[c4])); - } - } - - flatFieldAutoClipValue = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui - } else { - limitFactor = max((float)(100 - raw.ff_clipControl) / 100.f, 0.01f); - } - - for (int m = 0; m < 2; m++) - for (int n = 0; n < 2; n++) { - refcolor[m][n] *= limitFactor; - } - - unsigned int c[2][2] {}; - unsigned int c4[2][2] {}; - if(ri->get_colors() != 1) { - for (int i = 0; i < 2; ++i) { - for(int j = 0; j < 2; ++j) { - c[i][j] = FC(i, j); - } - } - c4[0][0] = ( c[0][0] == 1) ? 3 : c[0][0]; - c4[0][1] = ( c[0][1] == 1) ? 3 : c[0][1]; - c4[1][0] = c[1][0]; - c4[1][1] = c[1][1]; - } - - constexpr float minValue = 1.f; // if the pixel value in the flat field is less or equal this value, no correction will be applied. - -#ifdef __SSE2__ - vfloat refcolorv[2] = {_mm_set_ps(refcolor[0][1], refcolor[0][0], refcolor[0][1], refcolor[0][0]), - _mm_set_ps(refcolor[1][1], refcolor[1][0], refcolor[1][1], refcolor[1][0]) - }; - vfloat blackv[2] = {_mm_set_ps(black[c4[0][1]], black[c4[0][0]], black[c4[0][1]], black[c4[0][0]]), - _mm_set_ps(black[c4[1][1]], black[c4[1][0]], black[c4[1][1]], black[c4[1][0]]) - }; - - vfloat onev = F2V(1.f); - vfloat minValuev = F2V(minValue); -#endif -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int row = 0; row < H; row ++) { - int col = 0; -#ifdef __SSE2__ - vfloat rowBlackv = blackv[row & 1]; - vfloat rowRefcolorv = refcolorv[row & 1]; - - for (; col < W - 3; col += 4) { - vfloat blurv = LVFU(cfablur[(row) * W + col]) - rowBlackv; - vfloat vignettecorrv = rowRefcolorv / blurv; - vignettecorrv = vself(vmaskf_le(blurv, minValuev), onev, vignettecorrv); - vfloat valv = LVFU(rawData[row][col]); - valv -= rowBlackv; - STVFU(rawData[row][col], valv * vignettecorrv + rowBlackv); - } - -#endif - - for (; col < W; col ++) { - float blur = cfablur[(row) * W + col] - black[c4[row & 1][col & 1]]; - float vignettecorr = blur <= minValue ? 1.f : refcolor[row & 1][col & 1] / blur; - rawData[row][col] = (rawData[row][col] - black[c4[row & 1][col & 1]]) * vignettecorr + black[c4[row & 1][col & 1]]; - } - } - } else if(ri->getSensorType() == ST_FUJI_XTRANS) { - float refcolor[3] = {0.f}; - int cCount[3] = {0}; - - //find center ave values by channel - for (int m = -3; m < 3; m++) - for (int n = -3; n < 3; n++) { - int row = 2 * (H >> 2) + m; - int col = 2 * (W >> 2) + n; - int c = riFlatFile->XTRANSFC(row, col); - refcolor[c] += max(0.0f, cfablur[row * W + col] - black[c]); - cCount[c] ++; - } - - for(int c = 0; c < 3; c++) { - refcolor[c] = refcolor[c] / cCount[c]; - } - - float limitFactor = 1.f; - - if(raw.ff_AutoClipControl) { - // determine maximum calculated value to avoid clipping - float maxval = 0.f; - // xtrans files have only one black level actually, so we can simplify the code a bit -#ifdef _OPENMP - #pragma omp parallel -#endif - { - float maxvalthr = 0.f; -#ifdef _OPENMP - #pragma omp for schedule(dynamic,16) nowait -#endif - - for (int row = 0; row < H; row++) { - for (int col = 0; col < W; col++) { - float tempval = (rawData[row][col] - black[0]) * ( refcolor[ri->XTRANSFC(row, col)] / max(1e-5f, cfablur[(row) * W + col] - black[0]) ); - - if(tempval > maxvalthr) { - maxvalthr = tempval; - } - } - } - -#ifdef _OPENMP - #pragma omp critical -#endif - { - if(maxvalthr > maxval) { - maxval = maxvalthr; - } - } - } - - // there's only one white level for xtrans - if(maxval + black[0] > ri->get_white(0)) { - limitFactor = ri->get_white(0) / (maxval + black[0]); - flatFieldAutoClipValue = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui - } - } else { - limitFactor = max((float)(100 - raw.ff_clipControl) / 100.f, 0.01f); - } - - - for(int c = 0; c < 3; c++) { - refcolor[c] *= limitFactor; - } - - constexpr float minValue = 1.f; // if the pixel value in the flat field is less or equal this value, no correction will be applied. - -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - for (int col = 0; col < W; col++) { - int c = ri->XTRANSFC(row, col); - float blur = cfablur[(row) * W + col] - black[c]; - float vignettecorr = blur <= minValue ? 1.f : refcolor[c] / blur; - rawData[row][col] = (rawData[row][col] - black[c]) * vignettecorr + black[c]; - } - } - } - - if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::VH)) { - float *cfablur1 = (float (*)) malloc (H * W * sizeof * cfablur1); - float *cfablur2 = (float (*)) malloc (H * W * sizeof * cfablur2); - //slightly more complicated blur if trying to correct both vertical and horizontal anomalies - cfaboxblur(riFlatFile, cfablur1, 0, 2 * BS); //now do horizontal blur - cfaboxblur(riFlatFile, cfablur2, 2 * BS, 0); //now do vertical blur - - if(ri->getSensorType() == ST_BAYER || ri->get_colors() == 1) { - unsigned int c[2][2] {}; - unsigned int c4[2][2] {}; - if(ri->get_colors() != 1) { - for (int i = 0; i < 2; ++i) { - for(int j = 0; j < 2; ++j) { - c[i][j] = FC(i, j); - } - } - c4[0][0] = ( c[0][0] == 1) ? 3 : c[0][0]; - c4[0][1] = ( c[0][1] == 1) ? 3 : c[0][1]; - c4[1][0] = c[1][0]; - c4[1][1] = c[1][1]; - } - -#ifdef __SSE2__ - vfloat blackv[2] = {_mm_set_ps(black[c4[0][1]], black[c4[0][0]], black[c4[0][1]], black[c4[0][0]]), - _mm_set_ps(black[c4[1][1]], black[c4[1][0]], black[c4[1][1]], black[c4[1][0]]) - }; - - vfloat epsv = F2V(1e-5f); -#endif -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int row = 0; row < H; row ++) { - int col = 0; -#ifdef __SSE2__ - vfloat rowBlackv = blackv[row & 1]; - - for (; col < W - 3; col += 4) { - vfloat linecorrv = SQRV(vmaxf(LVFU(cfablur[row * W + col]) - rowBlackv, epsv)) / - (vmaxf(LVFU(cfablur1[row * W + col]) - rowBlackv, epsv) * vmaxf(LVFU(cfablur2[row * W + col]) - rowBlackv, epsv)); - vfloat valv = LVFU(rawData[row][col]); - valv -= rowBlackv; - STVFU(rawData[row][col], valv * linecorrv + rowBlackv); - } - -#endif - - for (; col < W; col ++) { - float linecorr = SQR(max(1e-5f, cfablur[row * W + col] - black[c4[row & 1][col & 1]])) / - (max(1e-5f, cfablur1[row * W + col] - black[c4[row & 1][col & 1]]) * max(1e-5f, cfablur2[row * W + col] - black[c4[row & 1][col & 1]])) ; - rawData[row][col] = (rawData[row][col] - black[c4[row & 1][col & 1]]) * linecorr + black[c4[row & 1][col & 1]]; - } - } - } else if(ri->getSensorType() == ST_FUJI_XTRANS) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - for (int col = 0; col < W; col++) { - int c = ri->XTRANSFC(row, col); - float hlinecorr = (max(1e-5f, cfablur[(row) * W + col] - black[c]) / max(1e-5f, cfablur1[(row) * W + col] - black[c]) ); - float vlinecorr = (max(1e-5f, cfablur[(row) * W + col] - black[c]) / max(1e-5f, cfablur2[(row) * W + col] - black[c]) ); - rawData[row][col] = ((rawData[row][col] - black[c]) * hlinecorr * vlinecorr + black[c]); - } - } - - } - - free (cfablur1); - free (cfablur2); - } - - free (cfablur); -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - /* Copy original pixel data and * subtract dark frame (if present) from current image and apply flat field correction (if present) */ @@ -2782,253 +2502,6 @@ void RawImageSource::copyOriginalPixels(const RAWParams &raw, RawImage *src, Raw } } -void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur, int boxH, int boxW) -{ - - if (boxW < 0 || boxH < 0 || (boxW == 0 && boxH == 0)) { // nothing to blur or negative values - memcpy(cfablur, riFlatFile->data[0], W * H * sizeof(float)); - return; - } - - float *tmpBuffer = nullptr; - float *cfatmp = nullptr; - float *srcVertical = nullptr; - - - if(boxH > 0 && boxW > 0) { - // we need a temporary buffer if we have to blur both directions - tmpBuffer = (float (*)) calloc (H * W, sizeof * tmpBuffer); - } - - if(boxH == 0) { - // if boxH == 0 we can skip the vertical blur and process the horizontal blur from riFlatFile to cfablur without using a temporary buffer - cfatmp = cfablur; - } else { - cfatmp = tmpBuffer; - } - - if(boxW == 0) { - // if boxW == 0 we can skip the horizontal blur and process the vertical blur from riFlatFile to cfablur without using a temporary buffer - srcVertical = riFlatFile->data[0]; - } else { - srcVertical = cfatmp; - } - -#ifdef _OPENMP - #pragma omp parallel -#endif - { - - if(boxW > 0) { - //box blur cfa image; box size = BS - //horizontal blur -#ifdef _OPENMP - #pragma omp for -#endif - - for (int row = 0; row < H; row++) { - int len = boxW / 2 + 1; - cfatmp[row * W + 0] = riFlatFile->data[row][0] / len; - cfatmp[row * W + 1] = riFlatFile->data[row][1] / len; - - for (int j = 2; j <= boxW; j += 2) { - cfatmp[row * W + 0] += riFlatFile->data[row][j] / len; - cfatmp[row * W + 1] += riFlatFile->data[row][j + 1] / len; - } - - for (int col = 2; col <= boxW; col += 2) { - cfatmp[row * W + col] = (cfatmp[row * W + col - 2] * len + riFlatFile->data[row][boxW + col]) / (len + 1); - cfatmp[row * W + col + 1] = (cfatmp[row * W + col - 1] * len + riFlatFile->data[row][boxW + col + 1]) / (len + 1); - len ++; - } - - for (int col = boxW + 2; col < W - boxW; col++) { - cfatmp[row * W + col] = cfatmp[row * W + col - 2] + (riFlatFile->data[row][boxW + col] - cfatmp[row * W + col - boxW - 2]) / len; - } - - for (int col = W - boxW; col < W; col += 2) { - cfatmp[row * W + col] = (cfatmp[row * W + col - 2] * len - cfatmp[row * W + col - boxW - 2]) / (len - 1); - - if (col + 1 < W) { - cfatmp[row * W + col + 1] = (cfatmp[row * W + col - 1] * len - cfatmp[row * W + col - boxW - 1]) / (len - 1); - } - - len --; - } - } - } - - if(boxH > 0) { - //vertical blur -#ifdef __SSE2__ - vfloat leninitv = F2V(boxH / 2 + 1); - vfloat onev = F2V( 1.0f ); - vfloat temp1v, temp2v, temp3v, temp4v, lenv, lenp1v, lenm1v; - int row; -#ifdef _OPENMP - #pragma omp for nowait -#endif - - for (int col = 0; col < W - 7; col += 8) { - lenv = leninitv; - temp1v = LVFU(srcVertical[0 * W + col]) / lenv; - temp2v = LVFU(srcVertical[1 * W + col]) / lenv; - temp3v = LVFU(srcVertical[0 * W + col + 4]) / lenv; - temp4v = LVFU(srcVertical[1 * W + col + 4]) / lenv; - - for (int i = 2; i < boxH + 2; i += 2) { - temp1v += LVFU(srcVertical[i * W + col]) / lenv; - temp2v += LVFU(srcVertical[(i + 1) * W + col]) / lenv; - temp3v += LVFU(srcVertical[i * W + col + 4]) / lenv; - temp4v += LVFU(srcVertical[(i + 1) * W + col + 4]) / lenv; - } - - STVFU(cfablur[0 * W + col], temp1v); - STVFU(cfablur[1 * W + col], temp2v); - STVFU(cfablur[0 * W + col + 4], temp3v); - STVFU(cfablur[1 * W + col + 4], temp4v); - - for (row = 2; row < boxH + 2; row += 2) { - lenp1v = lenv + onev; - temp1v = (temp1v * lenv + LVFU(srcVertical[(row + boxH) * W + col])) / lenp1v; - temp2v = (temp2v * lenv + LVFU(srcVertical[(row + boxH + 1) * W + col])) / lenp1v; - temp3v = (temp3v * lenv + LVFU(srcVertical[(row + boxH) * W + col + 4])) / lenp1v; - temp4v = (temp4v * lenv + LVFU(srcVertical[(row + boxH + 1) * W + col + 4])) / lenp1v; - STVFU(cfablur[row * W + col], temp1v); - STVFU(cfablur[(row + 1)*W + col], temp2v); - STVFU(cfablur[row * W + col + 4], temp3v); - STVFU(cfablur[(row + 1)*W + col + 4], temp4v); - lenv = lenp1v; - } - - for (; row < H - boxH - 1; row += 2) { - temp1v = temp1v + (LVFU(srcVertical[(row + boxH) * W + col]) - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenv; - temp2v = temp2v + (LVFU(srcVertical[(row + 1 + boxH) * W + col]) - LVFU(srcVertical[(row + 1 - boxH - 2) * W + col])) / lenv; - temp3v = temp3v + (LVFU(srcVertical[(row + boxH) * W + col + 4]) - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenv; - temp4v = temp4v + (LVFU(srcVertical[(row + 1 + boxH) * W + col + 4]) - LVFU(srcVertical[(row + 1 - boxH - 2) * W + col + 4])) / lenv; - STVFU(cfablur[row * W + col], temp1v); - STVFU(cfablur[(row + 1)*W + col], temp2v); - STVFU(cfablur[row * W + col + 4], temp3v); - STVFU(cfablur[(row + 1)*W + col + 4], temp4v); - } - - for(; row < H - boxH; row++) { - temp1v = temp1v + (LVFU(srcVertical[(row + boxH) * W + col]) - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenv; - temp3v = temp3v + (LVFU(srcVertical[(row + boxH) * W + col + 4]) - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenv; - STVFU(cfablur[row * W + col], temp1v); - STVFU(cfablur[row * W + col + 4], temp3v); - vfloat swapv = temp1v; - temp1v = temp2v; - temp2v = swapv; - swapv = temp3v; - temp3v = temp4v; - temp4v = swapv; - } - - for (; row < H - 1; row += 2) { - lenm1v = lenv - onev; - temp1v = (temp1v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenm1v; - temp2v = (temp2v * lenv - LVFU(srcVertical[(row - boxH - 1) * W + col])) / lenm1v; - temp3v = (temp3v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenm1v; - temp4v = (temp4v * lenv - LVFU(srcVertical[(row - boxH - 1) * W + col + 4])) / lenm1v; - STVFU(cfablur[row * W + col], temp1v); - STVFU(cfablur[(row + 1)*W + col], temp2v); - STVFU(cfablur[row * W + col + 4], temp3v); - STVFU(cfablur[(row + 1)*W + col + 4], temp4v); - lenv = lenm1v; - } - - for(; row < H; row++) { - lenm1v = lenv - onev; - temp1v = (temp1v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col])) / lenm1v; - temp3v = (temp3v * lenv - LVFU(srcVertical[(row - boxH - 2) * W + col + 4])) / lenm1v; - STVFU(cfablur[(row)*W + col], temp1v); - STVFU(cfablur[(row)*W + col + 4], temp3v); - } - - } - -#ifdef _OPENMP - #pragma omp single -#endif - - for (int col = W - (W % 8); col < W; col++) { - int len = boxH / 2 + 1; - cfablur[0 * W + col] = srcVertical[0 * W + col] / len; - cfablur[1 * W + col] = srcVertical[1 * W + col] / len; - - for (int i = 2; i < boxH + 2; i += 2) { - cfablur[0 * W + col] += srcVertical[i * W + col] / len; - cfablur[1 * W + col] += srcVertical[(i + 1) * W + col] / len; - } - - for (int row = 2; row < boxH + 2; row += 2) { - cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len + srcVertical[(row + boxH) * W + col]) / (len + 1); - cfablur[(row + 1)*W + col] = (cfablur[(row - 1) * W + col] * len + srcVertical[(row + boxH + 1) * W + col]) / (len + 1); - len ++; - } - - for (int row = boxH + 2; row < H - boxH; row++) { - cfablur[row * W + col] = cfablur[(row - 2) * W + col] + (srcVertical[(row + boxH) * W + col] - srcVertical[(row - boxH - 2) * W + col]) / len; - } - - for (int row = H - boxH; row < H; row += 2) { - cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len - srcVertical[(row - boxH - 2) * W + col]) / (len - 1); - - if (row + 1 < H) { - cfablur[(row + 1)*W + col] = (cfablur[(row - 1) * W + col] * len - srcVertical[(row - boxH - 1) * W + col]) / (len - 1); - } - - len --; - } - } - -#else -#ifdef _OPENMP - #pragma omp for -#endif - - for (int col = 0; col < W; col++) { - int len = boxH / 2 + 1; - cfablur[0 * W + col] = srcVertical[0 * W + col] / len; - cfablur[1 * W + col] = srcVertical[1 * W + col] / len; - - for (int i = 2; i < boxH + 2; i += 2) { - cfablur[0 * W + col] += srcVertical[i * W + col] / len; - cfablur[1 * W + col] += srcVertical[(i + 1) * W + col] / len; - } - - for (int row = 2; row < boxH + 2; row += 2) { - cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len + srcVertical[(row + boxH) * W + col]) / (len + 1); - cfablur[(row + 1)*W + col] = (cfablur[(row - 1) * W + col] * len + srcVertical[(row + boxH + 1) * W + col]) / (len + 1); - len ++; - } - - for (int row = boxH + 2; row < H - boxH; row++) { - cfablur[row * W + col] = cfablur[(row - 2) * W + col] + (srcVertical[(row + boxH) * W + col] - srcVertical[(row - boxH - 2) * W + col]) / len; - } - - for (int row = H - boxH; row < H; row += 2) { - cfablur[row * W + col] = (cfablur[(row - 2) * W + col] * len - srcVertical[(row - boxH - 2) * W + col]) / (len - 1); - - if (row + 1 < H) { - cfablur[(row + 1)*W + col] = (cfablur[(row - 1) * W + col] * len - srcVertical[(row - boxH - 1) * W + col]) / (len - 1); - } - - len --; - } - } - -#endif - } - } - - if(tmpBuffer) { - free (tmpBuffer); - } -} - - // Scale original pixels into the range 0 65535 using black offsets and multipliers void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const RAWParams &raw, array2D &rawData) { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index e52adea18..f7d905357 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -23,17 +23,19 @@ #include #include "array2D.h" -#include "color.h" -#include "curves.h" -#include "dcp.h" +#include "colortemp.h" #include "iimage.h" #include "imagesource.h" -#include "pixelsmap.h" #define HR_SCALE 2 namespace rtengine { +class PixelsMap; +class RawImage; +class DiagonalCurve; +class RetinextransmissionCurve; +class RetinexgaintransmissionCurve; class RawImageSource : public ImageSource { @@ -107,10 +109,7 @@ protected: void transformRect (const PreviewProps &pp, int tran, int &sx1, int &sy1, int &width, int &height, int &fw); void transformPosition (int x, int y, int tran, int& tx, int& ty); - unsigned FC(int row, int col) const - { - return ri->FC(row, col); - } + unsigned FC(int row, int col) const; inline void getRowStartEnd (int x, int &start, int &end); static void getProfilePreprocParams(cmsHPROFILE in, float& gammafac, float& lineFac, float& lineSum); @@ -122,7 +121,7 @@ public: int load(const Glib::ustring &fname, bool firstFrameOnly); void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) override; void filmNegativeProcess (const procparams::FilmNegativeParams ¶ms) override; - bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams ¤tParams, std::array& newExps) override; + bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const procparams::FilmNegativeParams ¤tParams, std::array& newExps) override; void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold, bool cache = false) override; void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) override; void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) override; @@ -138,21 +137,14 @@ public: return rgbSourceModified; // tracks whether cached rgb output of demosaic has been modified } - void processFlatField(const RAWParams &raw, RawImage *riFlatFile, unsigned short black[4]); - void copyOriginalPixels(const RAWParams &raw, RawImage *ri, RawImage *riDark, RawImage *riFlatFile, array2D &rawData ); - void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW); - void scaleColors (int winx, int winy, int winw, int winh, const RAWParams &raw, array2D &rawData); // raw for cblack + void processFlatField(const procparams::RAWParams &raw, const RawImage *riFlatFile, const unsigned short black[4]); + void copyOriginalPixels(const procparams::RAWParams &raw, RawImage *ri, RawImage *riDark, RawImage *riFlatFile, array2D &rawData ); + void scaleColors (int winx, int winy, int winw, int winh, const procparams::RAWParams &raw, array2D &rawData); // raw for cblack void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hrp, const procparams::RAWParams &raw) override; - eSensorType getSensorType () const override - { - return ri != nullptr ? ri->getSensorType() : ST_NONE; - } - bool isMono () const override - { - return ri->get_colors() == 1; - } - ColorTemp getWB () const override + eSensorType getSensorType () const override; + bool isMono () const override; + ColorTemp getWB () const override { return camera_wb; } @@ -170,10 +162,7 @@ public: void getFullSize (int& w, int& h, int tr = TR_NONE) override; void getSize (const PreviewProps &pp, int& w, int& h) override; - int getRotateDegree() const override - { - return ri->get_rotateDegree(); - } + int getRotateDegree() const override; ImageMatrices* getImageMatrices () override { @@ -191,17 +180,17 @@ public: void getAutoExpHistogram (LUTu & histogram, int& histcompr) override; void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw) override; void getAutoMatchedToneCurve(const procparams::ColorManagementParams &cp, std::vector &outCurve) override; - DCPProfile *getDCP(const procparams::ColorManagementParams &cmp, DCPProfile::ApplyState &as) override; + DCPProfile *getDCP(const procparams::ColorManagementParams &cmp, DCPProfileApplyState &as) override; void convertColorSpace(Imagefloat* image, const procparams::ColorManagementParams &cmp, const ColorTemp &wb) override; static bool findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in); - static void colorSpaceConversion (Imagefloat* im, const ColorManagementParams& cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], const std::string &camName) + static void colorSpaceConversion (Imagefloat* im, const procparams::ColorManagementParams& cmp, const ColorTemp &wb, double pre_mul[3], cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], const std::string &camName) { colorSpaceConversion_ (im, cmp, wb, pre_mul, embedded, camprofile, cam, camName); } static void inverse33 (const double (*coeff)[3], double (*icoeff)[3]); - void MSR(float** luminance, float **originalLuminance, float **exLuminance, LUTf & mapcurve, bool &mapcontlutili, int width, int height, const RetinexParams &deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void MSR(float** luminance, float **originalLuminance, float **exLuminance, const LUTf& mapcurve, bool mapcontlutili, int width, int height, const procparams::RetinexParams &deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); void HLRecovery_inpaint (float** red, float** green, float** blue) override; static void HLRecovery_Luminance (float* rin, float* gin, float* bin, float* rout, float* gout, float* bout, int width, float maxval); static void HLRecovery_CIELab (float* rin, float* gin, float* bin, float* rout, float* gout, float* bout, int width, float maxval, double cam[3][3], double icam[3][3]); @@ -277,18 +266,15 @@ protected: void eahd_demosaic(); void hphd_demosaic(); void vng4_demosaic(const array2D &rawData, array2D &red, array2D &green, array2D &blue); - void ppg_demosaic(); - void jdl_interpolate_omp(); void igv_interpolate(int winw, int winh); void lmmse_interpolate_omp(int winw, int winh, array2D &rawData, array2D &red, array2D &green, array2D &blue, int iterations); void amaze_demosaic_RT(int winx, int winy, int winw, int winh, const array2D &rawData, array2D &red, array2D &green, array2D &blue, size_t chunkSize = 1, bool measure = false);//Emil's code for AMaZE - void dual_demosaic_RT(bool isBayer, const RAWParams &raw, int winw, int winh, const array2D &rawData, array2D &red, array2D &green, array2D &blue, double &contrast, bool autoContrast = false); + void dual_demosaic_RT(bool isBayer, const procparams::RAWParams &raw, int winw, int winh, const array2D &rawData, array2D &red, array2D &green, array2D &blue, double &contrast, bool autoContrast = false); void fast_demosaic();//Emil's code for fast demosaicing void dcb_demosaic(int iterations, bool dcb_enhance); void ahd_demosaic(); void rcd_demosaic(size_t chunkSize = 1, bool measure = false); - void border_interpolate(unsigned int border, float (*image)[4], unsigned int start = 0, unsigned int end = 0); - void border_interpolate2(int winw, int winh, int lborders, const array2D &rawData, array2D &red, array2D &green, array2D &blue); + void border_interpolate(int winw, int winh, int lborders, const array2D &rawData, array2D &red, array2D &green, array2D &blue); void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border); void fill_raw( float (*cache )[3], int x0, int y0, float** rawData); void fill_border( float (*cache )[3], int border, int x0, int y0); @@ -307,7 +293,7 @@ protected: void xtransborder_interpolate (int border, array2D &red, array2D &green, array2D &blue); void xtrans_interpolate (const int passes, const bool useCieLab, size_t chunkSize = 1, bool measure = false); void fast_xtrans_interpolate (const array2D &rawData, array2D &red, array2D &green, array2D &blue); - void pixelshift(int winx, int winy, int winw, int winh, const RAWParams &rawParams, unsigned int frame, const std::string &make, const std::string &model, float rawWpCorrection); + void pixelshift(int winx, int winy, int winw, int winh, const procparams::RAWParams &rawParams, unsigned int frame, const std::string &make, const std::string &model, float rawWpCorrection); void hflip (Imagefloat* im); void vflip (Imagefloat* im); void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) override; diff --git a/rtengine/rawimagesource_i.h b/rtengine/rawimagesource_i.h index 485205d9d..47c6b5bab 100644 --- a/rtengine/rawimagesource_i.h +++ b/rtengine/rawimagesource_i.h @@ -16,9 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ - -#ifndef RAWIMAGESOURCE_I_H_INCLUDED -#define RAWIMAGESOURCE_I_H_INCLUDED +#pragma once #include "rawimagesource.h" @@ -184,5 +182,3 @@ inline void RawImageSource::interpolate_row_rb_mul_pp (const array2D &raw } } - -#endif diff --git a/rtengine/rawmetadatalocation.h b/rtengine/rawmetadatalocation.h index 559815a4f..894bc6bd2 100644 --- a/rtengine/rawmetadatalocation.h +++ b/rtengine/rawmetadatalocation.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RAWMETADATALOCATION_ -#define _RAWMETADATALOCATION_ +#pragma once namespace rtengine { @@ -36,6 +35,3 @@ public: }; } - -#endif - diff --git a/rtengine/rcd_demosaic.cc b/rtengine/rcd_demosaic.cc index 48c3ad334..4ceb92b26 100644 --- a/rtengine/rcd_demosaic.cc +++ b/rtengine/rcd_demosaic.cc @@ -20,13 +20,19 @@ #include "rawimagesource.h" #include "rt_math.h" -#include "procparams.h" #include "../rtgui/multilangmgr.h" #include "opthelper.h" #include "StopWatch.h" using namespace std; +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::rcd_demosaic(size_t chunkSize, bool measure) plistener->setProgress(progress); } + const unsigned int cfarray[2][2] = {{FC(0,0), FC(0,1)}, {FC(1,0), FC(1,1)}}; constexpr int rcdBorder = 9; constexpr int tileSize = 214; constexpr int tileSizeN = tileSize - 2 * rcdBorder; @@ -98,8 +105,8 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) for (int row = rowStart; row < rowEnd; row++) { int indx = (row - rowStart) * tileSize; - int c0 = FC(row, colStart); - int c1 = FC(row, colStart + 1); + int c0 = fc(cfarray, row, colStart); + int c1 = fc(cfarray, row, colStart + 1); int col = colStart; for (; col < colEnd - 1; col+=2, indx+=2) { @@ -132,7 +139,7 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) // Step 2.1: Low pass filter incorporating green, red and blue local samples from the raw data for (int row = 2; row < tileRows - 2; row++) { - for (int col = 2 + (FC(row, 0) & 1), indx = row * tileSize + col; col < tilecols - 2; col += 2, indx += 2) { + for (int col = 2 + (fc(cfarray, row, 0) & 1), indx = row * tileSize + col; col < tilecols - 2; col += 2, indx += 2) { lpf[indx>>1] = 0.25f * cfa[indx] + 0.125f * (cfa[indx - w1] + cfa[indx + w1] + cfa[indx - 1] + cfa[indx + 1]) + 0.0625f * (cfa[indx - w1 - 1] + cfa[indx - w1 + 1] + cfa[indx + w1 - 1] + cfa[indx + w1 + 1]); } } @@ -142,7 +149,7 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) */ // Step 3.1: Populate the green channel at blue and red CFA positions for (int row = 4; row < tileRows - 4; row++) { - for (int col = 4 + (FC(row, 0) & 1), indx = row * tileSize + col; col < tilecols - 4; col += 2, indx += 2) { + for (int col = 4 + (fc(cfarray, row, 0) & 1), indx = row * tileSize + col; col < tilecols - 4; col += 2, indx += 2) { // Refined vertical and horizontal local discrimination float VH_Central_Value = VH_Dir[indx]; @@ -177,7 +184,7 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) // Step 4.1: Calculate P/Q diagonal local discrimination for (int row = rcdBorder - 4; row < tileRows - rcdBorder + 4; row++) { - for (int col = rcdBorder - 4 + (FC(row, rcdBorder) & 1), indx = row * tileSize + col; col < tilecols - rcdBorder + 4; col += 2, indx += 2) { + for (int col = rcdBorder - 4 + (fc(cfarray, row, rcdBorder) & 1), indx = row * tileSize + col; col < tilecols - rcdBorder + 4; col += 2, indx += 2) { const float cfai = cfa[indx]; float P_Stat = max(epssq, - 18.f * cfai * (cfa[indx - w1 - 1] + cfa[indx + w1 + 1] + 2.f * (cfa[indx - w2 - 2] + cfa[indx + w2 + 2]) - cfa[indx - w3 - 3] - cfa[indx + w3 + 3]) - 2.f * cfai * (cfa[indx - w4 - 4] + cfa[indx + w4 + 4] - 19.f * cfai) - cfa[indx - w1 - 1] * (70.f * cfa[indx + w1 + 1] - 12.f * cfa[indx - w2 - 2] + 24.f * cfa[indx + w2 + 2] - 38.f * cfa[indx - w3 - 3] + 16.f * cfa[indx + w3 + 3] + 12.f * cfa[indx - w4 - 4] - 6.f * cfa[indx + w4 + 4] + 46.f * cfa[indx - w1 - 1]) + cfa[indx + w1 + 1] * (24.f * cfa[indx - w2 - 2] - 12.f * cfa[indx + w2 + 2] + 16.f * cfa[indx - w3 - 3] - 38.f * cfa[indx + w3 + 3] - 6.f * cfa[indx - w4 - 4] + 12.f * cfa[indx + w4 + 4] + 46.f * cfa[indx + w1 + 1]) + cfa[indx - w2 - 2] * (14.f * cfa[indx + w2 + 2] - 12.f * cfa[indx + w3 + 3] - 2.f * (cfa[indx - w4 - 4] - cfa[indx + w4 + 4]) + 11.f * cfa[indx - w2 - 2]) - cfa[indx + w2 + 2] * (12.f * cfa[indx - w3 - 3] + 2.f * (cfa[indx - w4 - 4] - cfa[indx + w4 + 4]) + 11.f * cfa[indx + w2 + 2]) + cfa[indx - w3 - 3] * (2.f * cfa[indx + w3 + 3] - 6.f * cfa[indx - w4 - 4] + 10.f * cfa[indx - w3 - 3]) - cfa[indx + w3 + 3] * (6.f * cfa[indx + w4 + 4] + 10.f * cfa[indx + w3 + 3]) + cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + cfa[indx + w4 + 4] * cfa[indx + w4 + 4]); @@ -190,7 +197,7 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) // Step 4.2: Populate the red and blue channels at blue and red CFA positions for (int row = rcdBorder - 3; row < tileRows - rcdBorder + 3; row++) { - for (int col = rcdBorder - 3 + (FC(row, rcdBorder - 1) & 1), indx = row * tileSize + col, c = 2 - FC(row, col); col < tilecols - rcdBorder + 3; col += 2, indx += 2) { + for (int col = rcdBorder - 3 + (fc(cfarray, row, rcdBorder - 1) & 1), indx = row * tileSize + col, c = 2 - fc(cfarray, row, col); col < tilecols - rcdBorder + 3; col += 2, indx += 2) { // Refined P/Q diagonal local discrimination float PQ_Central_Value = PQ_Dir[indx]; @@ -222,7 +229,7 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) // Step 4.3: Populate the red and blue channels at green CFA positions for (int row = rcdBorder; row < tileRows - rcdBorder; row++) { - for (int col = rcdBorder + (FC(row, rcdBorder - 1) & 1), indx = row * tileSize + col; col < tilecols - rcdBorder; col += 2, indx += 2) { + for (int col = rcdBorder + (fc(cfarray, row, rcdBorder - 1) & 1), indx = row * tileSize + col; col < tilecols - rcdBorder; col += 2, indx += 2) { // Refined vertical and horizontal local discrimination float VH_Central_Value = VH_Dir[indx]; @@ -297,7 +304,7 @@ void RawImageSource::rcd_demosaic(size_t chunkSize, bool measure) free(PQ_Dir); } - border_interpolate2(W, H, rcdBorder, rawData, red, green, blue); + border_interpolate(W, H, rcdBorder, rawData, red, green, blue); if (plistener) { plistener->setProgress(1); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 6917d856e..b77eac29c 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -526,7 +526,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { }; -namespace rtengine { +namespace rtengine +{ RefreshMapper::RefreshMapper(): next_event_(rtengine::NUMOFEVENTS) diff --git a/rtengine/refreshmap.h b/rtengine/refreshmap.h index 3f4831329..0f3e5ee90 100644 --- a/rtengine/refreshmap.h +++ b/rtengine/refreshmap.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __REFRESHMAP__ -#define __REFRESHMAP__ +#pragma once #include + #include "procevents.h" // Use M_VOID if you wish to update the proc params without updating the preview at all ! @@ -80,7 +80,8 @@ extern int refreshmap[]; -namespace rtengine { +namespace rtengine +{ class RefreshMapper { public: @@ -97,5 +98,3 @@ private: }; } // namespace rtengine - -#endif diff --git a/rtengine/rescale.h b/rtengine/rescale.h index e9d476fea..70974aa48 100644 --- a/rtengine/rescale.h +++ b/rtengine/rescale.h @@ -21,8 +21,10 @@ #pragma once #include "array2D.h" +#include "rt_math.h" -namespace rtengine { +namespace rtengine +{ inline float getBilinearValue(const array2D &src, float x, float y) { @@ -95,5 +97,4 @@ inline void rescaleNearest(const array2D &src, array2D &dst, bool } } - } // namespace rtengine diff --git a/rtengine/rt_algo.cc b/rtengine/rt_algo.cc index aadbac7f7..b02e75461 100644 --- a/rtengine/rt_algo.cc +++ b/rtengine/rt_algo.cc @@ -31,7 +31,7 @@ #include "opthelper.h" #include "rt_algo.h" #include "rt_math.h" -#include "sleef.c" +#include "sleef.h" namespace { float calcBlendFactor(float val, float threshold) { diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index c188622af..0473622c4 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -21,21 +21,18 @@ #include #include #include +#include -#include +#include #include #include "iimage.h" #include "imageformat.h" -#include "LUT.h" #include "procevents.h" #include "rawmetadatalocation.h" #include "rt_math.h" #include "settings.h" -#include "utils.h" - -#include "../rtexif/rtexif.h" #include "../rtgui/threadutils.h" @@ -45,7 +42,18 @@ * */ +template +class LUT; + +using LUTu = LUT; + class EditDataProvider; +namespace rtexif +{ + +class TagDirectory; + +} namespace rtengine { @@ -562,7 +570,7 @@ public: * @param baseDir base directory of RT's installation dir * @param userSettingsDir RT's base directory in the user's settings dir * @param loadAll if false, don't load the various dependencies (profiles, HALDClut files, ...), they'll be loaded from disk each time they'll be used (launching time improvement) */ -int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir, bool loadAll = true); +int init (const Settings* s, const Glib::ustring& baseDir, const Glib::ustring& userSettingsDir, bool loadAll = true); /** Cleanup the RT engine (static variables) */ void cleanup (); diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index 8c634eaa8..665fbd199 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -18,14 +18,15 @@ * along with RawTherapee. If not, see . */ -#include "rtlensfun.h" -#include "procparams.h" -#include "settings.h" #include -namespace rtengine { +#include "imagedata.h" +#include "procparams.h" +#include "rtlensfun.h" +#include "settings.h" -extern const Settings *settings; +namespace rtengine +{ //----------------------------------------------------------------------------- // LFModifier @@ -500,7 +501,7 @@ std::unique_ptr LFDatabase::getModifier(const LFCamera &camera, cons } -std::unique_ptr LFDatabase::findModifier(const LensProfParams &lensProf, const FramesMetaData *idata, int width, int height, const CoarseTransformParams &coarse, int rawRotationDeg) +std::unique_ptr LFDatabase::findModifier(const procparams::LensProfParams &lensProf, const FramesMetaData *idata, int width, int height, const procparams::CoarseTransformParams &coarse, int rawRotationDeg) { Glib::ustring make, model, lens; float focallen = idata->getFocalLen(); diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index 092e2bf01..7dcd96007 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -23,18 +23,22 @@ #include #include -#include +#include #include #include "lcp.h" #include "noncopyable.h" -namespace rtengine { +namespace rtengine +{ + +class FramesMetaData; namespace procparams { +struct CoarseTransformParams; struct LensProfParams; } @@ -119,7 +123,7 @@ public: LFCamera findCamera(const Glib::ustring &make, const Glib::ustring &model) const; LFLens findLens(const LFCamera &camera, const Glib::ustring &name) const; - static std::unique_ptr findModifier(const procparams::LensProfParams &lensProf, const FramesMetaData *idata, int width, int height, const CoarseTransformParams &coarse, int rawRotationDeg); + static std::unique_ptr findModifier(const procparams::LensProfParams &lensProf, const FramesMetaData *idata, int width, int height, const procparams::CoarseTransformParams &coarse, int rawRotationDeg); private: std::unique_ptr getModifier(const LFCamera &camera, const LFLens &lens, diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 25f50980d..0cdcbf6ed 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -16,31 +16,36 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include + +#include + +#include + +#include +#include +#include + +#include "cieimage.h" +#include "color.h" +#include "colortemp.h" +#include "curves.h" +#include "dcp.h" +#include "iccstore.h" +#include "image8.h" +#include "improcfun.h" +#include "jpeg.h" +#include "labimage.h" +#include "median.h" +#include "procparams.h" +#include "rawimage.h" +#include "rawimagesource.h" #include "rtengine.h" #include "rtthumbnail.h" -#include "../rtgui/options.h" -#include "image8.h" -#include -#include "curves.h" -#include -#include "improcfun.h" -#include "colortemp.h" -#include "mytime.h" -#include "utils.h" -#include "iccstore.h" -#include "iccmatrices.h" -#include "rawimagesource.h" -#include "stdimagesource.h" -#include -#include "rawimage.h" -#include "jpeg.h" -#include "../rtgui/ppversion.h" -#include "improccoordinator.h" #include "settings.h" -#include "procparams.h" -#include +#include "stdimagesource.h" #include "StopWatch.h" -#include "median.h" +#include "utils.h" namespace { @@ -183,13 +188,9 @@ void scale_colors (rtengine::RawImage *ri, float scale_mul[4], float cblack[4], } -extern Options options; - namespace rtengine { -extern const Settings *settings; - using namespace procparams; Thumbnail* Thumbnail::loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh, double wbEq, bool inspectorMode) @@ -329,7 +330,7 @@ Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml neutral.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); neutral.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); neutral.icm.inputProfile = "(camera)"; - neutral.icm.workingProfile = options.rtSettings.srgb; + neutral.icm.workingProfile = settings->srgb; src.preprocess(neutral.raw, neutral.lensProf, neutral.coarse, false); double thresholdDummy = 0.f; @@ -428,7 +429,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL // did we succeed? if ( err ) { - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "Could not extract thumb from " << fname.c_str() << std::endl; } delete tpp; @@ -1236,7 +1237,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT ImProcFunctions ipf (¶ms, forHistogramMatching); // enable multithreading when forHistogramMatching is true ipf.setScale (sqrt (double (fw * fw + fh * fh)) / sqrt (double (thumbImg->getWidth() * thumbImg->getWidth() + thumbImg->getHeight() * thumbImg->getHeight()))*scale); - ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), RenderingIntent(options.rtSettings.monitorIntent), false, false); + ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), RenderingIntent(settings->monitorIntent), false, false); LUTu hist16 (65536); @@ -1363,7 +1364,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT LabImage* labView = new LabImage (fw, fh); DCPProfile *dcpProf = nullptr; - DCPProfile::ApplyState as; + DCPProfileApplyState as; if (isRaw) { cmsHPROFILE dummy; @@ -2126,11 +2127,11 @@ bool Thumbnail::readData (const Glib::ustring& fname) return true; } catch (Glib::Error &err) { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("Thumbnail::readData / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str()); } } catch (...) { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("Thumbnail::readData / Unknown exception while trying to load \"%s\"!\n", fname.c_str()); } } @@ -2177,11 +2178,11 @@ bool Thumbnail::writeData (const Glib::ustring& fname) keyData = keyFile.to_data (); } catch (Glib::Error& err) { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("Thumbnail::writeData / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str()); } } catch (...) { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("Thumbnail::writeData / Unknown exception while trying to save \"%s\"!\n", fname.c_str()); } } @@ -2193,7 +2194,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname) FILE *f = g_fopen (fname.c_str (), "wt"); if (!f) { - if (options.rtSettings.verbose) { + if (settings->verbose) { printf ("Thumbnail::writeData / Error: unable to open file \"%s\" with write access!\n", fname.c_str()); } diff --git a/rtengine/rtthumbnail.h b/rtengine/rtthumbnail.h index 8b3f27a8b..dcc9596f6 100644 --- a/rtengine/rtthumbnail.h +++ b/rtengine/rtthumbnail.h @@ -16,15 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THUMBPROCESSINGPARAMETERS_ -#define _THUMBPROCESSINGPARAMETERS_ +#pragma once + +#include -#include "rawmetadatalocation.h" -#include #include -#include "image8.h" + #include "image16.h" +#include "image8.h" #include "imagefloat.h" +#include "LUT.h" +#include "rawmetadatalocation.h" + #include "../rtgui/threadutils.h" namespace rtengine @@ -160,6 +163,3 @@ public: } }; } - -#endif - diff --git a/rtengine/satandvalueblendingcurve.h b/rtengine/satandvalueblendingcurve.h new file mode 100644 index 000000000..c610652b4 --- /dev/null +++ b/rtengine/satandvalueblendingcurve.h @@ -0,0 +1,70 @@ +/* + * This file is part of RawTherapee. + * + * Copyright (c) 2004-2010 Gabor Horvath + * + * 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 . + */ +#pragma once + +#include "color.h" +#include "curves.h" + +namespace rtengine +{ + +class SatAndValueBlendingToneCurve : public ToneCurve +{ +public: + void Apply(float& r, float& g, float& b) const; +}; + +// Tone curve modifying the value channel only, preserving hue and saturation +// values in 0xffff space +inline void SatAndValueBlendingToneCurve::Apply (float& ir, float& ig, float& ib) const +{ + + assert (lutToneCurve); + + float r = CLIP(ir); + float g = CLIP(ig); + float b = CLIP(ib); + + const float lum = (r + g + b) / 3.f; + const float newLum = lutToneCurve[lum]; + + if (newLum == lum) { + return; + } + + float h, s, v; + Color::rgb2hsvtc(r, g, b, h, s, v); + + float dV; + if (newLum > lum) { + // Linearly targeting Value = 1 and Saturation = 0 + const float coef = (newLum - lum) / (65535.f - lum); + dV = (1.f - v) * coef; + s *= 1.f - coef; + } else { + // Linearly targeting Value = 0 + const float coef = (newLum - lum) / lum ; + dV = v * coef; + } + Color::hsv2rgbdcp(h, s, v + dV, r, g, b); + + setUnlessOOG(ir, ig, ib, r, g, b); +} + +} diff --git a/rtengine/settings.h b/rtengine/settings.h index 8852c05c8..f261444c8 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -16,9 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RTSETTINGS_ -#define _RTSETTINGS_ +#pragma once +#include namespace rtengine { @@ -96,7 +96,5 @@ public: * @param s a pointer to the Settings instance to destroy. */ static void destroy(Settings* s); }; +extern const Settings* settings; } - -#endif - diff --git a/rtengine/shmap.cc b/rtengine/shmap.cc index 6b59c4b40..44096d965 100644 --- a/rtengine/shmap.cc +++ b/rtengine/shmap.cc @@ -18,9 +18,11 @@ */ #include "shmap.h" #include "gauss.h" +#include "imagefloat.h" #include "rtengine.h" #include "rt_math.h" #include "rawimagesource.h" +#include "sleef.h" #include "jaggedarray.h" #undef THREAD_PRIORITY_NORMAL #include "opthelper.h" @@ -28,8 +30,6 @@ namespace rtengine { -extern const Settings* settings; - SHMap::SHMap (int w, int h) : max_f(0.f), min_f(0.f), avg(0.f), W(w), H(h) { @@ -85,21 +85,14 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int if (!hq) { fillLuminance( img, map, lumi); - float *buffer = nullptr; - - if(radius > 40.) { - // When we pass another buffer to gaussianBlur, it will use iterated boxblur which is less prone to artifacts - buffer = new float[W * H]; - } + const bool useBoxBlur = radius > 40.0; // boxblur is less prone to artifacts for large radi #ifdef _OPENMP - #pragma omp parallel + #pragma omp parallel if (!useBoxBlur) #endif { - gaussianBlur (map, map, W, H, radius, buffer); + gaussianBlur (map, map, W, H, radius, useBoxBlur); } - - delete [] buffer; } else { diff --git a/rtengine/shmap.h b/rtengine/shmap.h index 539ef99ff..5373b8302 100644 --- a/rtengine/shmap.h +++ b/rtengine/shmap.h @@ -16,16 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __SHMAP__ -#define __SHMAP__ +#pragma once -#include "imagefloat.h" -#include "image16.h" #include "noncopyable.h" +template +class LUT; + +using LUTf = LUT; + namespace rtengine { +class Imagefloat; + class SHMap : public NonCopyable { @@ -49,5 +53,5 @@ private: void dirpyr_shmap(float ** data_fine, float ** data_coarse, int width, int height, LUTf & rangefn, int level, int scale); }; + } -#endif diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 43a760382..88f24b7fd 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -16,6 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include "cieimage.h" +#include "dcp.h" +#include "imagefloat.h" +#include "labimage.h" #include "rtengine.h" #include "colortemp.h" #include "imagesource.h" @@ -25,18 +29,19 @@ #include "clutstore.h" #include "processingjob.h" #include "procparams.h" -#include +#include +#include #include "../rtgui/options.h" #include "rawimagesource.h" #include "../rtgui/multilangmgr.h" #include "mytime.h" #include "guidedfilter.h" +#include "color.h" #undef THREAD_PRIORITY_NORMAL namespace rtengine { -extern const Settings* settings; namespace { @@ -246,7 +251,6 @@ private: bool dehacontlutili = false; bool mapcontlutili = false; bool useHsl = false; -// multi_array2D conversionBuffer(1, 1); multi_array2D conversionBuffer(1, 1); imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); imgsrc->retinexPrepareCurves(params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy); @@ -1005,7 +1009,7 @@ private: } autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000) - DCPProfile::ApplyState as; + DCPProfileApplyState as; DCPProfile *dcpProf = imgsrc->getDCP(params.icm, as); LUTu histToneCurve; diff --git a/rtengine/simpleprocess.h b/rtengine/simpleprocess.h index d6efe802d..9b41b4643 100644 --- a/rtengine/simpleprocess.h +++ b/rtengine/simpleprocess.h @@ -4,24 +4,11 @@ * * Created on September 18, 2010, 8:31 PM */ +#pragma once -#ifndef SIMPLEPROCESS_H -#define SIMPLEPROCESS_H - -#ifdef __cplusplus -extern "C" { -#endif - - - - -#ifdef __cplusplus -} -#endif namespace rtengine { extern Glib::Thread *batchThread; -} -#endif /* SIMPLEPROCESS_H */ +} diff --git a/rtengine/sleef.c b/rtengine/sleef.h similarity index 99% rename from rtengine/sleef.c rename to rtengine/sleef.h index a01aef5b9..30c059010 100644 --- a/rtengine/sleef.c +++ b/rtengine/sleef.h @@ -6,9 +6,7 @@ // This version contains modifications made by Ingo Weyrich // //////////////////////////////////////////////////////////////// - -#ifndef _SLEEFC_ -#define _SLEEFC_ +#pragma once #include #include @@ -1275,5 +1273,3 @@ __inline float xlog2lin(float x, float base) constexpr float one(1); return (pow_F(base, x) - one) / (base - one); } - -#endif diff --git a/rtengine/slicer.cc b/rtengine/slicer.cc deleted file mode 100644 index 96c0a0ee8..000000000 --- a/rtengine/slicer.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * 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 "rt_math.h" - -#include "slicer.h" - -#ifdef _OPENMP -#include -#endif - -using namespace std; - -// If no parameter set, everything = 0 -> process all the image -Block::Block() -{ - posX = 0; - posY = 0; - width = 0; - height = 0; -} - -Block::Block(unsigned int x, unsigned int y, unsigned int w, unsigned int h) -{ - posX = x; - posY = y; - width = w; - height = h; -} - -/* - * Slice a sub-region to process in blocks who's size is given by the number of processor - * and the number of pixel per block (and hence the memory footprint) - */ -Slicer::Slicer(unsigned int imageWidth, unsigned int imageHeight, Block *subRegion, unsigned int pixels ) -{ - // If the sub-region has a portrait shape, X and Y coordinates are swapped for better result - // It will be swapped back when sending back the block coordinates - region.width = !(subRegion->width) ? imageWidth : subRegion->width; - region.height = !(subRegion->height) ? imageHeight : subRegion->height; // Assuming that the sub-region is under posY - - if (region.width < region.height) { - region.width = !(subRegion->height) ? imageHeight : subRegion->height; - region.height = !(subRegion->width) ? imageWidth : subRegion->width; // Assuming that the sub-region is under posY - portrait = true; - imWidth = imageHeight; - imHeight = imageWidth; - region.posX = subRegion->posY; - region.posY = subRegion->posX; - } else { - portrait = false; - imWidth = imageWidth; - imHeight = imageHeight; - region.posX = subRegion->posX; - region.posY = subRegion->posY; - } - - double subRegionRatio = (double)(region.width) / (double)(region.height); - - //total number of core/processor -#ifdef _OPENMP - unsigned int procNumber = omp_get_num_procs(); -#else - unsigned int procNumber = 1; -#endif - - //calculate the number of block - blockNumber = (double(region.width * region.height) / (double)pixels); - blockNumber = int((rtengine::max(blockNumber, 1U) + (double)procNumber / 2.) / procNumber) * procNumber; - vBlockNumber = (unsigned int)(sqrt((double)blockNumber / subRegionRatio) + 0.5); - vBlockNumber = CLAMP(vBlockNumber, 1, blockNumber); - hBlockNumber = (double)blockNumber / (double)vBlockNumber; - blockWidth = 1.0 / hBlockNumber; - - double maxPixelNumberX = (double)region.height / (double)vBlockNumber; - double maxPixelNumberY = (double)region.width / (double)((unsigned int)hBlockNumber); - - if (maxPixelNumberX - (double)((unsigned int)maxPixelNumberX) != 0.) { - maxPixelNumberX += 1.; - } - - if (maxPixelNumberY - (double)((unsigned int)maxPixelNumberY) != 0.) { - maxPixelNumberY += 1.; - } - - maxPixelNumber = (unsigned int)maxPixelNumberX * (unsigned int)maxPixelNumberY; - -} - -// return the absolute position and size of the requested block -void Slicer::get_block(unsigned int numBlock, Block *block) -{ - double roundingTradeOff = (hBlockNumber - (double)((int)hBlockNumber)) == 0.5 ? 2.1 : 2.0; - unsigned int alreadyCompletedLineNbr = (unsigned int)((double)(numBlock) * blockWidth + (blockWidth / roundingTradeOff)); - - unsigned int prevLineEnd = (unsigned int)((double)alreadyCompletedLineNbr * hBlockNumber + 0.5); - unsigned int myLineEnd = (unsigned int)((double)(alreadyCompletedLineNbr + 1) * hBlockNumber + 0.5); - - unsigned int nbrCellsOnMyLine = myLineEnd - prevLineEnd; - unsigned int cellOnMyLine = numBlock - prevLineEnd; - - unsigned int blockStart = (unsigned int)(((double)region.width / (double)nbrCellsOnMyLine) * (double)(cellOnMyLine)); - unsigned int blockEnd = (unsigned int)(((double)region.width / (double)nbrCellsOnMyLine) * (double)(cellOnMyLine + 1)); - block->width = blockEnd - blockStart; - block->posX = region.posX + blockStart; - - if (cellOnMyLine == (nbrCellsOnMyLine - 1)) { - // We make sure that the last block of the row take the rest of the remaining X space - block->width = region.posX + region.width - block->posX; - } - - blockStart = (unsigned int)(((double)region.height / (double)vBlockNumber) * (double)(alreadyCompletedLineNbr)); - blockEnd = (unsigned int)(((double)region.height / (double)vBlockNumber) * (double)(alreadyCompletedLineNbr + 1)); - block->height = blockEnd - blockStart; - block->posY = region.posY + blockStart; - - if (alreadyCompletedLineNbr == (vBlockNumber - 1)) { - block->height = region.posY + region.height - block->posY; - } - - if (portrait) { - // we swap back the X/Y coordinates - unsigned int temp; - - temp = block->posX; - block->posX = block->posY; - block->posY = temp; - - temp = block->width; - block->width = block->height; - block->height = temp; - - } -} diff --git a/rtengine/slicer.h b/rtengine/slicer.h deleted file mode 100644 index 658133e5f..000000000 --- a/rtengine/slicer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * 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 . - */ -#ifndef _SLICER_ -#define _SLICER_ - -//The image is divided in blocks even on single processor machine, mainly to decrease memory consumption -//maximum number of pixel per block -#define PIXELS_PER_BLOCK 250000 - -/* - * Used to specify a subregion of an image and to specify a cell in this subregion - */ -class Block -{ -public: - unsigned int posX; - unsigned int posY; - unsigned int width; // If 0, use the full width of the image - unsigned int height; // If 0, use the full height of the image - Block(); - Block(unsigned int x, unsigned int y, unsigned int w, unsigned int h); -}; - -/* - * This class handle the best slicing of the image with a given number of pixels per block and the number of - * processor, and tries to create blocks as square as possible. There can be a different number of block on - * each line, and the pixel per block requested may be oversized by very few percents. - */ -class Slicer -{ -protected: - bool portrait; // Orientation of the sub-region - unsigned int imWidth; // Image width - unsigned int imHeight; // Image height - Block region; // Sub-region to process - double hBlockNumber; // Horizontal number of block for the sub-region - unsigned int vBlockNumber; // Vertical number of block for the sub-region - double blockWidth; - -public: - unsigned int blockNumber; // number of block for the sub-region - unsigned int maxPixelNumber; // number of pixel of the biggest block (for memory allocation purpose) - Slicer(unsigned int imageWidth, unsigned int imageHeight, Block *subRegion, unsigned int pixels); - void get_block(unsigned int blockId, Block *block); -}; - -#endif diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index 2ec1529f7..1cb11e94d 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -19,19 +19,20 @@ #include "stdimagesource.h" #include "color.h" -#include "curves.h" #include "iccstore.h" +#include "image8.h" +#include "image16.h" +#include "imagefloat.h" #include "imageio.h" #include "mytime.h" #include "procparams.h" +#include "utils.h" #undef THREAD_PRIORITY_NORMAL namespace rtengine { -extern const Settings* settings; - template void freeArray (T** a, int H) { for (int i = 0; i < H; i++) { diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 0dffe2fd0..b95328c80 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -16,14 +16,27 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _STDIMAGESOURCE_ -#define _STDIMAGESOURCE_ +#pragma once +#include "colortemp.h" #include "imagesource.h" namespace rtengine { +class ImageIO; + +namespace procparams +{ + +class ProcParams; + +struct ToneCurveParams; +struct RAWParams; +struct ColorManagementParams; + +} + class StdImageSource : public ImageSource { @@ -43,7 +56,7 @@ public: ~StdImageSource () override; int load (const Glib::ustring &fname) override; - void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw) override; + void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hrp, const procparams::RAWParams &raw) override; ColorTemp getWB () const override { return wb; @@ -87,8 +100,8 @@ public: plistener = pl; } - void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb) override;// RAWParams raw will not be used for non-raw files (see imagesource.h) - static void colorSpaceConversion (Imagefloat* im, const ColorManagementParams &cmp, cmsHPROFILE embedded, IIOSampleFormat sampleFormat); + void convertColorSpace(Imagefloat* image, const procparams::ColorManagementParams &cmp, const ColorTemp &wb) override;// RAWParams raw will not be used for non-raw files (see imagesource.h) + static void colorSpaceConversion (Imagefloat* im, const procparams::ColorManagementParams &cmp, cmsHPROFILE embedded, IIOSampleFormat sampleFormat); bool isRGBSourceModified() const override { @@ -104,5 +117,5 @@ public: void flushRGB () override; void captureSharpening(const procparams::CaptureSharpeningParams &sharpeningParams, bool showMask, double &conrastThreshold, double &radius) override {}; }; + } -#endif diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 6b5460ffd..feba5c95f 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -50,31 +50,33 @@ * $Id: tmo_fattal02.cpp,v 1.3 2008/11/04 23:43:08 rafm Exp $ */ - #ifdef _OPENMP #include #endif + +#include #include #include #include -#include -#include #include +#include -#include #include #include +#include #include "array2D.h" -#include "improcfun.h" -#include "settings.h" +#include "color.h" #include "iccstore.h" -#include "StopWatch.h" -#include "sleef.c" +#include "imagefloat.h" +#include "improcfun.h" #include "opthelper.h" -#include "rt_algo.h" -#include "rescale.h" #include "procparams.h" +#include "rescale.h" +#include "rt_algo.h" +#include "settings.h" +#include "sleef.h" +#include "StopWatch.h" namespace rtengine { @@ -83,7 +85,6 @@ namespace rtengine * RT code ******************************************************************************/ -extern const Settings *settings; extern MyMutex *fftwMutex; using namespace std; @@ -1093,7 +1094,7 @@ void ImProcFunctions::ToneMapFattal02 (Imagefloat *rgb) float oldMedian; const float percentile = float(LIM(params->fattal.anchor, 1, 100)) / 100.f; - findMinMaxPercentile (Yr.data(), Yr.getRows() * Yr.getCols(), percentile, oldMedian, percentile, oldMedian, multiThread); + findMinMaxPercentile (Yr.data(), static_cast(Yr.getRows()) * Yr.getCols(), percentile, oldMedian, percentile, oldMedian, multiThread); // median filter on the deep shadows, to avoid boosting noise // because w2 >= w and h2 >= h, we can use the L buffer as temporary buffer for Median_Denoise() int w2 = find_fast_dim (w) + 1; @@ -1135,7 +1136,7 @@ void ImProcFunctions::ToneMapFattal02 (Imagefloat *rgb) const float wr = float(w2) / float(w); float newMedian; - findMinMaxPercentile (L.data(), L.getRows() * L.getCols(), percentile, newMedian, percentile, newMedian, multiThread); + findMinMaxPercentile (L.data(), static_cast(L.getRows()) * L.getCols(), percentile, newMedian, percentile, newMedian, multiThread); const float scale = (oldMedian == 0.f || newMedian == 0.f) ? 65535.f : (oldMedian / newMedian); // avoid Nan #ifdef _OPENMP diff --git a/rtengine/vng4_demosaic_RT.cc b/rtengine/vng4_demosaic_RT.cc index 66413e4c7..47982b6da 100644 --- a/rtengine/vng4_demosaic_RT.cc +++ b/rtengine/vng4_demosaic_RT.cc @@ -21,8 +21,8 @@ //////////////////////////////////////////////////////////////// #include "rtengine.h" +#include "rawimage.h" #include "rawimagesource.h" -#include "procparams.h" #include "../rtgui/multilangmgr.h" //#define BENCHMARK #include "StopWatch.h" @@ -102,7 +102,7 @@ void RawImageSource::vng4_demosaic (const array2D &rawData, array2D(height) * width, sizeof * image); int lcode[16][16][32]; float mul[16][16][8]; @@ -384,7 +384,7 @@ void RawImageSource::vng4_demosaic (const array2D &rawData, array2D #include +#include #include "rtexif.h" diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index f4b0e089e..4c5a6cafe 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _MEXIF3_ -#define _MEXIF3_ +#pragma once #include #include @@ -30,11 +29,15 @@ #include #include -#include +#include #include "../rtengine/noncopyable.h" #include "../rtengine/rawmetadatalocation.h" +namespace Glib +{ + class KeyFile; +} namespace rtengine { @@ -686,5 +689,5 @@ extern const TagAttrib kodakIfdAttribs[]; void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif); extern const TagAttrib panasonicAttribs[]; extern const TagAttrib panasonicRawAttribs[]; + } -#endif diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index edc2b8202..4b21ce421 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -79,7 +79,6 @@ set(NONCLISOURCEFILES hsvequalizer.cc iccprofilecreator.cc icmpanel.cc - ilabel.cc imagearea.cc imageareapanel.cc impulsedenoise.cc diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 02dc60aed..4b935af95 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -1,6 +1,4 @@ -#ifndef _ADDSETIDS_ -#define _ADDSETIDS_ - +#pragma once // UPDATE THE DEFAULT VALUE IN OPTIONS.CC int babehav[] TOO !!! @@ -149,5 +147,3 @@ enum { ADDSET_PARAM_NUM // THIS IS USED AS A DELIMITER!! }; - -#endif diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 5182cd825..302a2de00 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -17,14 +17,14 @@ * along with RawTherapee. If not, see . */ #include "adjuster.h" + #include #include -#include "multilangmgr.h" -#include "../rtengine/rtengine.h" -#include "options.h" -#include "guiutils.h" -#include "rtimage.h" +#include "multilangmgr.h" +#include "options.h" +#include "rtimage.h" +#include "../rtengine/rt_math.h" namespace { diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index 52857a3d2..9800dbac8 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -16,10 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _ADJUSTER_H_ -#define _ADJUSTER_H_ +#pragma once -#include #include "editedstate.h" #include "guiutils.h" @@ -130,5 +128,3 @@ public: void trimValue (int &val) const; void setLogScale(double base, double pivot, bool anchorMiddle = false); }; - -#endif diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index abb37b24d..acb45c266 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include #include #include #include @@ -28,12 +28,14 @@ #include #include +#include "cachemanager.h" #include "thumbnail.h" #include "batchqueue.h" #include "multilangmgr.h" #include "filecatalog.h" #include "batchqueuebuttonset.h" #include "guiutils.h" +#include "pathutils.h" #include "rtimage.h" #include diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index f61b7b5c4..9ae615965 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -15,20 +15,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BATCHQUEUE_ -#define _BATCHQUEUE_ +#pragma once #include #include -#include "../rtengine/rtengine.h" - #include "batchqueueentry.h" +#include "lwbutton.h" #include "lwbuttonset.h" -#include "options.h" #include "threadutils.h" #include "thumbbrowserbase.h" + +#include "../rtengine/rtengine.h" #include "../rtengine/noncopyable.h" class BatchQueueListener @@ -124,5 +123,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/batchqueuebuttonset.cc b/rtgui/batchqueuebuttonset.cc index a8be9eedf..969a55079 100644 --- a/rtgui/batchqueuebuttonset.cc +++ b/rtgui/batchqueuebuttonset.cc @@ -18,8 +18,10 @@ */ #include "batchqueuebuttonset.h" +#include "lwbutton.h" #include "multilangmgr.h" #include "rtimage.h" +#include "rtsurface.h" bool BatchQueueButtonSet::iconsLoaded = false; diff --git a/rtgui/batchqueuebuttonset.h b/rtgui/batchqueuebuttonset.h index 19479ccc1..fb45df518 100644 --- a/rtgui/batchqueuebuttonset.h +++ b/rtgui/batchqueuebuttonset.h @@ -16,14 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BATCHQUEUEBUTTONSET_ -#define _BATCHQUEUEBUTTONSET_ +#pragma once -#include "lwbuttonset.h" -#include "rtsurface.h" #include +#include "lwbuttonset.h" + class BatchQueueEntry; +class RTSurface; + class BatchQueueButtonSet : public LWButtonSet { @@ -40,5 +41,3 @@ public: explicit BatchQueueButtonSet (BatchQueueEntry* myEntry); }; - -#endif diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index 424c8e486..90079b2cc 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -25,8 +25,10 @@ #include "rtimage.h" #include "multilangmgr.h" #include "thumbbrowserbase.h" +#include "thumbnail.h" #include "../rtengine/procparams.h" +#include "../rtengine/rtengine.h" bool BatchQueueEntry::iconsLoaded(false); Glib::RefPtr BatchQueueEntry::savedAsIcon; diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index 03097e55e..c4cd48615 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -16,18 +16,33 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BATCHQUEUEENTRY_ -#define _BATCHQUEUEENTRY_ +#pragma once #include #include -#include "../rtengine/rtengine.h" -#include "thumbbrowserentrybase.h" -#include "thumbnail.h" + #include "bqentryupdater.h" +#include "options.h" +#include "thumbbrowserentrybase.h" + #include "../rtengine/noncopyable.h" +class Thumbnail; + +namespace rtengine +{ +class ProcessingJob; + +namespace procparams +{ + +class ProcParams; + +} + +} + class BatchQueueEntry; struct BatchQueueEntryIdleHelper { BatchQueueEntry* bqentry; @@ -77,7 +92,3 @@ public: void updateImage (guint8* img, int w, int h, int origw, int origh, guint8* newOPreview) override; void _updateImage (guint8* img, int w, int h); // inside gtk thread }; - - - -#endif diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index 2f8e27057..590ec2347 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -16,15 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BATCHQUEUEPANEL_ -#define _BATCHQUEUEPANEL_ +#pragma once #include #include + #include "batchqueue.h" -#include "saveformatpanel.h" #include "guiutils.h" +#include "saveformatpanel.h" class RTWindow; class FileCatalog; @@ -83,5 +83,3 @@ private: void formatChanged(const Glib::ustring& format) override; void updateTab (int qsize, int forceOrientation = 0); // forceOrientation=0: base on options / 1: horizontal / 2: vertical }; -#endif - diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 8815deb2e..1ee0680a0 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -16,12 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include "bayerpreprocess.h" +#include "bayerprocess.h" + #include "multilangmgr.h" #include "batchtoolpanelcoord.h" #include "options.h" #include "filepanel.h" #include "procparamchangers.h" #include "addsetids.h" +#include "thumbnail.h" using namespace rtengine::procparams; diff --git a/rtgui/batchtoolpanelcoord.h b/rtgui/batchtoolpanelcoord.h index f03d1d4b2..7a5fe77ed 100644 --- a/rtgui/batchtoolpanelcoord.h +++ b/rtgui/batchtoolpanelcoord.h @@ -16,17 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __BATCHTOOLPANELCCORD__ -#define __BATCHTOOLPANELCCORD__ +#pragma once -#include "thumbnail.h" -#include "toolpanelcoord.h" #include "fileselectionchangelistener.h" -#include "../rtengine/rtengine.h" #include "paramsedited.h" #include "thumbnaillistener.h" +#include "toolpanelcoord.h" + +#include "../rtengine/procevents.h" +#include "../rtengine/procparams.h" class FilePanel; +class Thumbnail; class BatchToolPanelCoordinator : public ToolPanelCoordinator, public FileSelectionChangeListener, @@ -84,5 +85,3 @@ public: void optionsChanged (); }; - -#endif diff --git a/rtgui/bayerpreprocess.h b/rtgui/bayerpreprocess.h index 5d2b101d9..c07bbcba4 100644 --- a/rtgui/bayerpreprocess.h +++ b/rtgui/bayerpreprocess.h @@ -16,13 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BAYERPREPROCESS_H_ -#define _BAYERPREPROCESS_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -#include "../rtengine/rawimage.h" class BayerPreProcess : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel { @@ -54,5 +53,3 @@ public: void lineDenoiseDirectionChanged(); void pdafLinesFilterChanged(); }; - -#endif diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index aa09067e4..4a57177e1 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -23,6 +23,7 @@ #include "options.h" #include "../rtengine/procparams.h" +#include "../rtengine/utils.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/bayerprocess.h b/rtgui/bayerprocess.h index 893010e65..04985dc66 100644 --- a/rtgui/bayerprocess.h +++ b/rtgui/bayerprocess.h @@ -16,16 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BAYERPROCESS_H_ -#define _BAYERPROCESS_H_ +#pragma once #include + #include "adjuster.h" #include "checkbox.h" #include "guiutils.h" #include "toolpanel.h" -class BayerProcess : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel, public rtengine::FrameCountListener, public rtengine::AutoContrastListener +class BayerProcess : + public ToolParamBlock, + public AdjusterListener, + public CheckBoxListener, + public FoldableToolPanel, + public rtengine::FrameCountListener, + public rtengine::AutoContrastListener { protected: @@ -89,5 +95,3 @@ public: void autoContrastChanged (double autoContrast) override; void FrameCountChanged(int n, int frameNum) override; }; - -#endif diff --git a/rtgui/bayerrawexposure.h b/rtgui/bayerrawexposure.h index 5825383be..247bf6ff0 100644 --- a/rtgui/bayerrawexposure.h +++ b/rtgui/bayerrawexposure.h @@ -16,26 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BAYERRAWEXPOSURE_H_ -#define _BAYERRAWEXPOSURE_H_ +#pragma once #include + #include "adjuster.h" #include "checkbox.h" #include "toolpanel.h" -class BayerRAWExposure : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel +class BayerRAWExposure : + public ToolParamBlock, + public AdjusterListener, + public CheckBoxListener, + public FoldableToolPanel { - -protected: - Adjuster* PexBlack0; - Adjuster* PexBlack1; - Adjuster* PexBlack2; - Adjuster* PexBlack3; - CheckBox* PextwoGreen; - public: - BayerRAWExposure (); void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; @@ -46,6 +41,11 @@ public: void checkBoxToggled (CheckBox* c, CheckValue newval) override; void setAdjusterBehavior (bool pexblackadd); void trimValues (rtengine::procparams::ProcParams* pp) override; -}; -#endif +protected: + Adjuster* PexBlack0; + Adjuster* PexBlack1; + Adjuster* PexBlack2; + Adjuster* PexBlack3; + CheckBox* PextwoGreen; +}; diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index b5ecb96bd..b3ebea28a 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -23,9 +23,11 @@ #include "guiutils.h" #include "rtimage.h" +#include "options.h" #include "../rtengine/color.h" #include "../rtengine/procparams.h" +#include "../rtengine/utils.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/blackwhite.h b/rtgui/blackwhite.h index 36234cda5..9f504fd4f 100644 --- a/rtgui/blackwhite.h +++ b/rtgui/blackwhite.h @@ -16,17 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BLACKWHITE_H_ -#define _BLACKWHITE_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" -#include "guiutils.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" +#include "guiutils.h" #include "mycurve.h" -#include "colorprovider.h" +#include "toolpanel.h" class EditDataProvider; @@ -144,5 +144,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/bqentryupdater.cc b/rtgui/bqentryupdater.cc index 21a0f5ad0..61683e158 100644 --- a/rtgui/bqentryupdater.cc +++ b/rtgui/bqentryupdater.cc @@ -17,8 +17,26 @@ * along with RawTherapee. If not, see . */ #include "bqentryupdater.h" -#include + #include "guiutils.h" +#include "options.h" +#include "thumbnail.h" +#include "../rtengine/utils.h" + +namespace +{ + +void thumbInterp(const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh) +{ + + if (options.thumbInterp == 0) { + rtengine::nearestInterp (src, sw, sh, dst, dw, dh); + } else if (options.thumbInterp == 1) { + rtengine::bilinearInterp (src, sw, sh, dst, dw, dh); + } +} + +} BatchQueueEntryUpdater batchQueueEntryUpdater; @@ -27,7 +45,7 @@ BatchQueueEntryUpdater::BatchQueueEntryUpdater () { } -void BatchQueueEntryUpdater::process (guint8* oimg, int ow, int oh, int newh, BQEntryUpdateListener* listener, rtengine::ProcParams* pparams, Thumbnail* thumbnail) +void BatchQueueEntryUpdater::process (guint8* oimg, int ow, int oh, int newh, BQEntryUpdateListener* listener, rtengine::procparams::ProcParams* pparams, Thumbnail* thumbnail) { if (!oimg && (!pparams || !thumbnail)) { //printf("WARNING! !oimg && (!pparams || !thumbnail)\n"); diff --git a/rtgui/bqentryupdater.h b/rtgui/bqentryupdater.h index efd63f9de..dfd42aff1 100644 --- a/rtgui/bqentryupdater.h +++ b/rtgui/bqentryupdater.h @@ -16,14 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BQENTRYUPDATER_ -#define _BQENTRYUPDATER_ +#pragma once + +#include -#include -#include "../rtengine/rtengine.h" #include "threadutils.h" -#include "thumbnail.h" +class Thumbnail; + +namespace rtengine +{ +namespace procparams +{ + +class ProcParams; + +} + +} class BQEntryUpdateListener { @@ -39,7 +49,7 @@ class BatchQueueEntryUpdater guint8* oimg; int ow, oh, newh; BQEntryUpdateListener* listener; - rtengine::ProcParams* pparams; + rtengine::procparams::ProcParams* pparams; Thumbnail* thumbnail; }; @@ -53,7 +63,7 @@ protected: public: BatchQueueEntryUpdater (); - void process (guint8* oimg, int ow, int oh, int newh, BQEntryUpdateListener* listener, rtengine::ProcParams* pparams = nullptr, Thumbnail* thumbnail = nullptr); + void process (guint8* oimg, int ow, int oh, int newh, BQEntryUpdateListener* listener, rtengine::procparams::ProcParams* pparams = nullptr, Thumbnail* thumbnail = nullptr); void removeJobs (BQEntryUpdateListener* listener); void terminate (); @@ -61,5 +71,3 @@ public: }; extern BatchQueueEntryUpdater batchQueueEntryUpdater; - -#endif diff --git a/rtgui/browserfilter.h b/rtgui/browserfilter.h index f5dac180e..df9a94c11 100644 --- a/rtgui/browserfilter.h +++ b/rtgui/browserfilter.h @@ -16,15 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _BROWSERFILTER_ -#define _BROWSERFILTER_ +#pragma once + +#include #include "exiffiltersettings.h" -#include class BrowserFilter { - public: bool showRanked[6]; bool showCLabeled[6]; @@ -41,5 +40,3 @@ public: BrowserFilter (); }; - -#endif diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index d31b6c7a5..d44ca28ec 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -19,10 +19,12 @@ #include "cacheimagedata.h" #include #include +#include #include "version.h" #include #include "../rtengine/procparams.h" +#include "../rtengine/settings.h" CacheImageData::CacheImageData() : supported(false), @@ -223,11 +225,11 @@ int CacheImageData::load (const Glib::ustring& fname) return 0; } } catch (Glib::Error &err) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("CacheImageData::load / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str()); } } catch (...) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("CacheImageData::load / Unknown exception while trying to load \"%s\"!\n", fname.c_str()); } } @@ -305,11 +307,11 @@ int CacheImageData::save (const Glib::ustring& fname) keyData = keyFile.to_data (); } catch (Glib::Error &err) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("CacheImageData::save / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str()); } } catch (...) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("CacheImageData::save / Unknown exception while trying to save \"%s\"!\n", fname.c_str()); } } @@ -321,7 +323,7 @@ int CacheImageData::save (const Glib::ustring& fname) FILE *f = g_fopen (fname.c_str (), "wt"); if (!f) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("CacheImageData::save / Error: unable to open file \"%s\" with write access!\n", fname.c_str()); } diff --git a/rtgui/cacheimagedata.h b/rtgui/cacheimagedata.h index 72bf55749..caab1de5b 100644 --- a/rtgui/cacheimagedata.h +++ b/rtgui/cacheimagedata.h @@ -16,17 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CACHEIMAGEDATA_ -#define _CACHEIMAGEDATA_ +#pragma once + +#include -#include #include "options.h" -#include "../rtengine/rtengine.h" + #include "../rtengine/imageformat.h" +#include "../rtengine/rtengine.h" -class CacheImageData: public rtengine::FramesMetaData +class CacheImageData : + public rtengine::FramesMetaData { - public: // basic information @@ -115,4 +116,3 @@ public: std::string getImageType (unsigned int frame) const override { return isPixelShift ? "PS" : isHDR ? "HDR" : "STD"; } rtengine::IIOSampleFormat getSampleFormat (unsigned int frame = 0) const override { return sampleFormat; } }; -#endif diff --git a/rtgui/cachemanager.cc b/rtgui/cachemanager.cc index 419538656..9f6e111e5 100644 --- a/rtgui/cachemanager.cc +++ b/rtgui/cachemanager.cc @@ -32,8 +32,8 @@ #include "guiutils.h" #include "options.h" -#include "procparamchangers.h" #include "thumbnail.h" +#include "procparamchangers.h" namespace { @@ -64,7 +64,7 @@ void CacheManager::init () } } - if (error != 0 && options.rtSettings.verbose) { + if (error != 0 && rtengine::settings->verbose) { std::cerr << "Failed to create all cache directories: " << g_strerror(errno) << std::endl; } } @@ -191,7 +191,7 @@ void CacheManager::renameEntry (const std::string& oldfilename, const std::strin error |= g_rename (getCacheFileName ("embprofiles", oldfilename, ".icc", oldmd5).c_str (), getCacheFileName ("embprofiles", newfilename, ".icc", newmd5).c_str ()); error |= g_rename (getCacheFileName ("data", oldfilename, ".txt", oldmd5).c_str (), getCacheFileName ("data", newfilename, ".txt", newmd5).c_str ()); - if (error != 0 && options.rtSettings.verbose) { + if (error != 0 && rtengine::settings->verbose) { std::cerr << "Failed to rename all files for cache entry '" << oldfilename << "': " << g_strerror(errno) << std::endl; } @@ -263,7 +263,7 @@ void CacheManager::deleteDir (const Glib::ustring& dirName) const error |= g_remove (Glib::build_filename (baseDir, dirName, *entry).c_str ()); } - if (error != 0 && options.rtSettings.verbose) { + if (error != 0 && rtengine::settings->verbose) { std::cerr << "Failed to delete all entries in cache directory '" << dirName << "': " << g_strerror(errno) << std::endl; } @@ -288,7 +288,7 @@ void CacheManager::deleteFiles (const Glib::ustring& fname, const std::string& m error |= g_remove (getCacheFileName ("profiles", fname, paramFileExtension, md5).c_str ()); } - if (error != 0 && options.rtSettings.verbose) { + if (error != 0 && rtengine::settings->verbose) { std::cerr << "Failed to delete all files for cache entry '" << fname << "': " << g_strerror(errno) << std::endl; } } diff --git a/rtgui/cachemanager.h b/rtgui/cachemanager.h index 3e987866d..56370e966 100644 --- a/rtgui/cachemanager.h +++ b/rtgui/cachemanager.h @@ -16,18 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CACHEMANAGER_ -#define _CACHEMANAGER_ +#pragma once -#include #include +#include #include -#include "../rtengine/noncopyable.h" - #include "threadutils.h" +#include "../rtengine/noncopyable.h" + class Thumbnail; class CacheManager : @@ -70,6 +69,3 @@ public: }; #define cacheMgr CacheManager::getInstance() - -#endif - diff --git a/rtgui/cacorrection.h b/rtgui/cacorrection.h index f6e1f89e3..6e1667a00 100644 --- a/rtgui/cacorrection.h +++ b/rtgui/cacorrection.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CACORRECTION_H_ -#define _CACORRECTION_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class CACorrection : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class CACorrection : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -43,5 +46,3 @@ public: void setAdjusterBehavior (bool badd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/checkbox.h b/rtgui/checkbox.h index 48324d4c8..45433300c 100644 --- a/rtgui/checkbox.h +++ b/rtgui/checkbox.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CHECKBOX_H_ -#define _CHECKBOX_H_ +#pragma once #include + #include "editedstate.h" #include "guiutils.h" @@ -72,5 +72,3 @@ public: void set_tooltip_markup (const Glib::ustring& tooltip); */ }; - -#endif diff --git a/rtgui/chmixer.h b/rtgui/chmixer.h index 94f54ed3d..fb028cf14 100644 --- a/rtgui/chmixer.h +++ b/rtgui/chmixer.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CHMIXER_H_ -#define _CHMIXER_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class ChMixer : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class ChMixer : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -46,5 +49,3 @@ public: void trimValues (rtengine::procparams::ProcParams* pp) override; void enabledChanged() override; }; - -#endif diff --git a/rtgui/clipboard.cc b/rtgui/clipboard.cc index 4cd50f574..f64f2ed07 100644 --- a/rtgui/clipboard.cc +++ b/rtgui/clipboard.cc @@ -18,6 +18,7 @@ */ #include "clipboard.h" +#include "paramsedited.h" #include "../rtengine/procparams.h" Clipboard clipboard; diff --git a/rtgui/clipboard.h b/rtgui/clipboard.h index 4c0ec452f..0a1c8e2fa 100644 --- a/rtgui/clipboard.h +++ b/rtgui/clipboard.h @@ -16,25 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CLIPBOARD_ -#define _CLIPBOARD_ +#pragma once #include #include -#include "mydiagonalcurve.h" -#include "myflatcurve.h" -#include "paramsedited.h" +#include "../rtengine/diagonalcurvetypes.h" +#include "../rtengine/flatcurvetypes.h" -#include "../rtengine/rtengine.h" +struct ParamsEdited; namespace rtengine { namespace procparams { - +class ProcParams; class PartialProfile; +class IPTCPairs; } @@ -80,5 +79,3 @@ private: }; extern Clipboard clipboard; - -#endif diff --git a/rtgui/coarsepanel.h b/rtgui/coarsepanel.h index 2da56b904..c028bbcad 100644 --- a/rtgui/coarsepanel.h +++ b/rtgui/coarsepanel.h @@ -16,13 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __COARSEPANEL__ -#define __COARSEPANEL__ +#pragma once #include + #include "toolpanel.h" -class CoarsePanel : public Gtk::HBox, public ToolPanel +class CoarsePanel : + public Gtk::HBox, + public ToolPanel { protected: @@ -46,5 +48,3 @@ public: void flipHorizontal (); void flipVertical (); }; - -#endif diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index f8eb736d4..094ffec2f 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -21,9 +21,12 @@ #include "colorappearance.h" #include "guiutils.h" +#include "options.h" +#include "rtimage.h" #include "../rtengine/color.h" #include "../rtengine/procparams.h" +#include "../rtengine/utils.h" #define MINTEMP0 2000 //1200 #define MAXTEMP0 12000 //12000 diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index da2e3c8b9..3d82ee831 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -16,25 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _COLORAPPEARANCE_H_ -#define _COLORAPPEARANCE_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "mycurve.h" #include "guiutils.h" -#include "colorprovider.h" +#include "toolpanel.h" class ColorAppearance final : - public ToolParamBlock, - public AdjusterListener, - public FoldableToolPanel, - public rtengine::AutoCamListener, - public CurveListener, - public ColorProvider + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel, + public rtengine::AutoCamListener, + public CurveListener, + public ColorProvider { public: ColorAppearance (); @@ -173,5 +172,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/coloredbar.h b/rtgui/coloredbar.h index 089dfa8cd..6cc121cd5 100644 --- a/rtgui/coloredbar.h +++ b/rtgui/coloredbar.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _COLOREDBAR_ -#define _COLOREDBAR_ +#pragma once #include "colorprovider.h" #include "guiutils.h" @@ -62,5 +61,3 @@ public: BackBuffer::setDirty(isDirty); } }; - -#endif diff --git a/rtgui/colorprovider.h b/rtgui/colorprovider.h index feea792b6..988b080bd 100644 --- a/rtgui/colorprovider.h +++ b/rtgui/colorprovider.h @@ -16,10 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _COLORPROVIDER_ -#define _COLORPROVIDER_ - -#include +#pragma once class ColorProvider; @@ -61,10 +58,7 @@ public: */ class ColorProvider { - public: - virtual ~ColorProvider() {}; + virtual ~ColorProvider() = default; virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller) {}; }; - -#endif diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index e164739e5..1a6a9b918 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -6,6 +6,8 @@ #include "rtimage.h" #include "eventmapper.h" #include "labgrid.h" +#include "options.h" +#include "../rtengine/color.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/colortoning.h b/rtgui/colortoning.h index faba1e383..9c7a54488 100644 --- a/rtgui/colortoning.h +++ b/rtgui/colortoning.h @@ -1,18 +1,19 @@ /* * This file is part of RawTherapee. */ -#ifndef _COLORTONING_H_ -#define _COLORTONING_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" -#include "guiutils.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "thresholdadjuster.h" -#include "colorprovider.h" +#include "guiutils.h" #include "labgrid.h" +#include "thresholdadjuster.h" +#include "toolpanel.h" + #include "../rtengine/procparams.h" class ColorToning final : @@ -166,5 +167,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/coordinateadjuster.h b/rtgui/coordinateadjuster.h index d705915ab..70fe42233 100644 --- a/rtgui/coordinateadjuster.h +++ b/rtgui/coordinateadjuster.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _COORDINATEADJUSTER_ -#define _COORDINATEADJUSTER_ +#pragma once #include @@ -160,6 +159,3 @@ public: void stopNumericalAdjustment(); }; - - -#endif diff --git a/rtgui/crop.cc b/rtgui/crop.cc index b1780538e..3bdcf14cf 100644 --- a/rtgui/crop.cc +++ b/rtgui/crop.cc @@ -26,8 +26,6 @@ using namespace rtengine; using namespace rtengine::procparams; -extern Options options; - namespace { diff --git a/rtgui/crop.h b/rtgui/crop.h index 1bbad548d..b9221a803 100644 --- a/rtgui/crop.h +++ b/rtgui/crop.h @@ -16,14 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CROP_H_ -#define _CROP_H_ +#pragma once + +#include #include + #include "cropguilistener.h" -#include "toolpanel.h" #include "guiutils.h" -#include +#include "toolpanel.h" class CropPanelListener { @@ -129,5 +130,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/cropguilistener.h b/rtgui/cropguilistener.h index c20d6556a..a7e18683a 100644 --- a/rtgui/cropguilistener.h +++ b/rtgui/cropguilistener.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __CROPGUILISTENER__ -#define __CROPGUILISTENER__ +#pragma once class CropGUIListener { @@ -39,5 +38,3 @@ public: virtual bool inImageArea(int x, int y) = 0; virtual double getRatio() const = 0; }; - -#endif diff --git a/rtgui/crophandler.h b/rtgui/crophandler.h index 77355b868..d5da1cf6e 100644 --- a/rtgui/crophandler.h +++ b/rtgui/crophandler.h @@ -16,21 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __CROPHANDLER__ -#define __CROPHANDLER__ +#pragma once #include -#include #include +#include #include -#include "../rtengine/rtengine.h" #include "editbuffer.h" - #include "lockablecolorpicker.h" #include "threadutils.h" +#include "../rtengine/rtengine.h" + class EditSubscriber; class CropDisplayHandler @@ -139,5 +138,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index ef682cf1f..f44e78a56 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -17,6 +17,9 @@ * along with RawTherapee. If not, see . */ #include +#ifdef WIN32 +#include +#endif #include "cropwindow.h" @@ -30,9 +33,9 @@ #include "editcallbacks.h" #include "editbuffer.h" #include "editwidgets.h" +#include "rtsurface.h" #include "../rtengine/dcrop.h" -#include "../rtengine/mytime.h" #include "../rtengine/procparams.h" #include "../rtengine/rt_math.h" diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index 99b0fd897..db44a2508 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -16,23 +16,31 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CROPWINDOW_ -#define _CROPWINDOW_ +#pragma once -#include "../rtengine/rtengine.h" -#include -#include "lwbutton.h" -#include "lwbuttonset.h" -#include "editenums.h" -#include "crophandler.h" #include + +#include + #include "cropguilistener.h" -#include "pointermotionlistener.h" +#include "crophandler.h" #include "cursormanager.h" #include "editbuffer.h" #include "editcoordsys.h" +#include "editenums.h" +#include "lwbutton.h" +#include "lwbuttonset.h" +#include "pointermotionlistener.h" + #include "../rtengine/noncopyable.h" +namespace rtengine +{ + +struct Coord; + +} + class CropWindow; class CropWindowListener @@ -239,5 +247,3 @@ public: ImageArea* getImageArea(); }; - -#endif diff --git a/rtgui/cursormanager.cc b/rtgui/cursormanager.cc index 76b4eabfb..e915150aa 100644 --- a/rtgui/cursormanager.cc +++ b/rtgui/cursormanager.cc @@ -18,7 +18,6 @@ */ #include "cursormanager.h" -#include "options.h" #include "rtimage.h" CursorManager mainWindowCursorManager; diff --git a/rtgui/cursormanager.h b/rtgui/cursormanager.h index aec5110d1..38f198e32 100644 --- a/rtgui/cursormanager.h +++ b/rtgui/cursormanager.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CURSORMANAGER_ -#define _CURSORMANAGER_ +#pragma once #include @@ -89,6 +88,3 @@ public: extern CursorManager mainWindowCursorManager; extern CursorManager editWindowCursorManager; - -#endif - diff --git a/rtgui/curveeditor.h b/rtgui/curveeditor.h index bdd6d6b48..535c1a86d 100644 --- a/rtgui/curveeditor.h +++ b/rtgui/curveeditor.h @@ -16,21 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CURVEEDITOR_ -#define _CURVEEDITOR_ +#pragma once -#include "popuptogglebutton.h" -#include "../rtengine/LUT.h" #include "coloredbar.h" #include "editcallbacks.h" -#include "mydiagonalcurve.h" -#include "myflatcurve.h" +#include "popuptogglebutton.h" + +#include "../rtengine/diagonalcurvetypes.h" +#include "../rtengine/flatcurvetypes.h" +#include "../rtengine/LUT.h" #include "../rtengine/noncopyable.h" class CurveEditorGroup; class CurveEditorSubGroup; - /* *********************** Curve Editor *********************** */ @@ -182,7 +181,6 @@ public: class FlatCurveEditor : public CurveEditor { - friend class FlatCurveEditorSubGroup; protected: @@ -207,5 +205,3 @@ public: // set the reset curve for a given curve type. This is optional; all curve type have a default reset curve void setResetCurve(FlatCurveType cType, const std::vector &resetCurve); }; - -#endif diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index 0e7205518..06def0a8e 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -25,6 +25,8 @@ #include "flatcurveeditorsubgroup.h" #include "multilangmgr.h" #include "rtimage.h" +#include "options.h" +#include "pathutils.h" CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring groupLabel) : curveDir(curveDir), line(0), curve_reset(nullptr), displayedCurve(nullptr), flatSubGroup(nullptr), diagonalSubGroup(nullptr), cl(nullptr), numberOfPackedCurve(0) diff --git a/rtgui/curveeditorgroup.h b/rtgui/curveeditorgroup.h index 6f7b98d9b..e3412546f 100644 --- a/rtgui/curveeditorgroup.h +++ b/rtgui/curveeditorgroup.h @@ -16,18 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CURVEEDITORGROUP_ -#define _CURVEEDITORGROUP_ +#pragma once -#include #include #include + +#include + +#include "adjuster.h" #include "guiutils.h" #include "mycurve.h" -#include "myflatcurve.h" -#include "mydiagonalcurve.h" #include "shcselector.h" -#include "adjuster.h" + +#include "../rtengine/diagonalcurvetypes.h" +#include "../rtengine/flatcurvetypes.h" class CurveEditor; class DiagonalCurveEditorSubGroup; @@ -169,5 +171,3 @@ protected: virtual const std::vector getCurveFromGUI (int type) = 0; }; - -#endif diff --git a/rtgui/curvelistener.h b/rtgui/curvelistener.h index 05a9a4e99..d99167a98 100644 --- a/rtgui/curvelistener.h +++ b/rtgui/curvelistener.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CURVELISTENER_ -#define _CURVELISTENER_ +#pragma once #include @@ -86,5 +85,3 @@ public: return retVal; } }; - -#endif diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index af7ffeace..74ef1384a 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -25,6 +25,7 @@ #include "rtimage.h" #include "../rtengine/procparams.h" +#include "../rtengine/rawimage.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/darkframe.h b/rtgui/darkframe.h index c576712a8..779caf16f 100644 --- a/rtgui/darkframe.h +++ b/rtgui/darkframe.h @@ -16,24 +16,34 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DARKFRAME_H_ -#define _DARKFRAME_H_ +#pragma once #include + #include -#include "toolpanel.h" -#include "../rtengine/rawimage.h" + #include "guiutils.h" +#include "toolpanel.h" + +namespace rtengine +{ + +class RawImage; + +} class DFProvider { public: + virtual ~DFProvider() = default; virtual rtengine::RawImage* getDF() = 0; virtual Glib::ustring GetCurrentImageFilePath() = 0; // add other info here }; -class DarkFrame : public ToolParamBlock, public FoldableToolPanel +class DarkFrame : + public ToolParamBlock, + public FoldableToolPanel { protected: @@ -66,5 +76,3 @@ public: dfp = p; }; }; - -#endif diff --git a/rtgui/defringe.cc b/rtgui/defringe.cc index 659d41960..7114f9a52 100644 --- a/rtgui/defringe.cc +++ b/rtgui/defringe.cc @@ -20,7 +20,9 @@ #include #include "defringe.h" +#include "options.h" +#include "../rtengine/color.h" #include "../rtengine/procparams.h" using namespace rtengine; diff --git a/rtgui/defringe.h b/rtgui/defringe.h index 8a6eb0753..5dd17b547 100644 --- a/rtgui/defringe.h +++ b/rtgui/defringe.h @@ -16,18 +16,23 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DEFRINGE_H_ -#define _DEFRINGE_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" -#include "guiutils.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "colorprovider.h" +#include "guiutils.h" +#include "toolpanel.h" -class Defringe : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider +class Defringe : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel, + public CurveListener, + public ColorProvider { protected: @@ -54,5 +59,3 @@ public: void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller) override; }; - -#endif diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index 21b42a6ce..cece9be66 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -31,6 +31,7 @@ #include "curveeditor.h" #include "diagonalcurveeditorsubgroup.h" #include "rtimage.h" +#include "options.h" #include "../rtengine/curves.h" diff --git a/rtgui/diagonalcurveeditorsubgroup.h b/rtgui/diagonalcurveeditorsubgroup.h index 077ef590e..184fa576f 100644 --- a/rtgui/diagonalcurveeditorsubgroup.h +++ b/rtgui/diagonalcurveeditorsubgroup.h @@ -16,16 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DIAGONALCURVEEDITORSUBGROUP_ -#define _DIAGONALCURVEEDITORSUBGROUP_ +#pragma once #include + #include "curveeditorgroup.h" + #include "../rtengine/noncopyable.h" class DiagonalCurveEditor; +class MyDiagonalCurve; -class DiagonalCurveEditorSubGroup : public CurveEditorSubGroup, public SHCListener, public AdjusterListener, public rtengine::NonCopyable +class DiagonalCurveEditorSubGroup : + public CurveEditorSubGroup, + public SHCListener, + public AdjusterListener, + public rtengine::NonCopyable { friend class DiagonalCurveEditor; @@ -111,5 +117,3 @@ protected: void setSubGroupRangeLabels(Glib::ustring r1, Glib::ustring r2, Glib::ustring r3, Glib::ustring r4); void setSubGroupBottomBarBgGradient(); }; - -#endif diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index 32361d5c5..669528ac1 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -63,7 +63,7 @@ std::vector listSubDirs (const Glib::RefPtr& dir, bool subDirs.push_back (file->get_name ()); } catch (const Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << exception.what().c_str() << std::endl; } @@ -72,7 +72,7 @@ std::vector listSubDirs (const Glib::RefPtr& dir, bool } catch (const Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << "Failed to list subdirectories of \"" << dir->get_parse_name() << "\": " << exception.what () << std::endl; } diff --git a/rtgui/dirbrowser.h b/rtgui/dirbrowser.h index 68422f8be..fa526c3a6 100644 --- a/rtgui/dirbrowser.h +++ b/rtgui/dirbrowser.h @@ -16,13 +16,13 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DIRBROWSER_ -#define _DIRBROWSER_ +#pragma once #include #include #include "guiutils.h" + #ifdef WIN32 #include "windows.h" #endif @@ -110,5 +110,3 @@ inline DirBrowser::DirSelectionSignal DirBrowser::dirSelected () const { return dirSelectionSignal; } - -#endif diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 2a0bba596..b429dfc9f 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -21,14 +21,15 @@ #include "dirpyrdenoise.h" -#include "guiutils.h" - -#include "../rtengine/procparams.h" #include "editbuffer.h" +#include "guiutils.h" +#include "options.h" + +#include "../rtengine/color.h" +#include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; -extern Options options; DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP_DIRPYRDENOISE_LABEL"), true, true), lastmedian(false) { diff --git a/rtgui/dirpyrdenoise.h b/rtgui/dirpyrdenoise.h index a513eb262..424104314 100644 --- a/rtgui/dirpyrdenoise.h +++ b/rtgui/dirpyrdenoise.h @@ -16,17 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DIRPYRDENOISE_H_ -#define _DIRPYRDENOISE_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "colorprovider.h" #include "guiutils.h" -#include "options.h" +#include "toolpanel.h" class EditDataProvider; @@ -138,5 +137,3 @@ private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/dirpyrequalizer.cc b/rtgui/dirpyrequalizer.cc index fc03c83ad..fd0268efa 100644 --- a/rtgui/dirpyrequalizer.cc +++ b/rtgui/dirpyrequalizer.cc @@ -19,6 +19,8 @@ #include "dirpyrequalizer.h" +#include "../rtengine/color.h" + using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/dirpyrequalizer.h b/rtgui/dirpyrequalizer.h index e236dc29b..ff08f36bc 100644 --- a/rtgui/dirpyrequalizer.h +++ b/rtgui/dirpyrequalizer.h @@ -16,17 +16,20 @@ * * (C) 2010 Emil Martinec */ - -#ifndef DIRPYREQUALIZER_H_INCLUDED -#define DIRPYREQUALIZER_H_INCLUDED +#pragma once #include -#include "adjuster.h" -#include "toolpanel.h" -#include "thresholdadjuster.h" -#include "colorprovider.h" -class DirPyrEqualizer : public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, public FoldableToolPanel +#include "adjuster.h" +#include "colorprovider.h" +#include "thresholdadjuster.h" +#include "toolpanel.h" + +class DirPyrEqualizer : + public ToolParamBlock, + public ThresholdAdjusterListener, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -77,5 +80,3 @@ public: void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override; void adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) override; }; - -#endif diff --git a/rtgui/distortion.h b/rtgui/distortion.h index 5e1cf6a6b..dab20bbd9 100644 --- a/rtgui/distortion.h +++ b/rtgui/distortion.h @@ -16,15 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DISTORTION_H_ -#define _DISTORTION_H_ +#pragma once #include -#include "adjuster.h" -#include "toolpanel.h" -#include "lensgeomlistener.h" -class Distortion : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +#include "adjuster.h" +#include "lensgeomlistener.h" +#include "toolpanel.h" + +class Distortion : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -51,5 +54,3 @@ public: rlistener = l; } }; - -#endif diff --git a/rtgui/dynamicprofilepanel.cc b/rtgui/dynamicprofilepanel.cc index 38029af71..d7ed8ee97 100644 --- a/rtgui/dynamicprofilepanel.cc +++ b/rtgui/dynamicprofilepanel.cc @@ -22,6 +22,7 @@ #include "../rtengine/profilestore.h" #include "../rtengine/rtengine.h" #include "../rtengine/dynamicprofile.h" +#include "../rtengine/settings.h" #include #include @@ -615,7 +616,7 @@ void DynamicProfilePanel::save() if (!ProfileStore::getInstance()->storeRules()) { printf ("Error in saving dynamic profile rules\n"); - } else if (options.rtSettings.verbose) { + } else if (rtengine::settings->verbose) { printf ("Saved %d dynamic profile rules\n", int (rules.size())); } } diff --git a/rtgui/dynamicprofilepanel.h b/rtgui/dynamicprofilepanel.h index fd4a6e80e..5796c9c85 100644 --- a/rtgui/dynamicprofilepanel.h +++ b/rtgui/dynamicprofilepanel.h @@ -16,14 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _DYNAMICPROFILEPANEL_H_ -#define _DYNAMICPROFILEPANEL_H_ +#pragma once #include -#include "../rtengine/dynamicprofile.h" + #include "profilestorecombobox.h" -class DynamicProfilePanel: public Gtk::VBox +#include "../rtengine/dynamicprofile.h" + +class DynamicProfilePanel : + public Gtk::VBox { public: DynamicProfilePanel(); @@ -133,5 +135,3 @@ private: Gtk::Button button_edit_; Gtk::Button button_delete_; }; - -#endif // _DYNAMICPROFILEPANEL_H_ diff --git a/rtgui/editbuffer.h b/rtgui/editbuffer.h index 77afb6449..046ab7364 100644 --- a/rtgui/editbuffer.h +++ b/rtgui/editbuffer.h @@ -22,10 +22,6 @@ #include "../rtengine/coord.h" #include -#ifdef GUIVERSION -#include "rtsurface.h" -#endif - class EditDataProvider; class EditSubscriber; diff --git a/rtgui/editedstate.h b/rtgui/editedstate.h index 2cee07eb9..c34aaf539 100644 --- a/rtgui/editedstate.h +++ b/rtgui/editedstate.h @@ -16,10 +16,6 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EDITEDSTATE_ -#define _EDITEDSTATE_ +#pragma once enum EditedState { UnEdited = 0, Edited = 1, Irrelevant = 2 }; - -#endif - diff --git a/rtgui/editenums.h b/rtgui/editenums.h index 8fc28e922..f1ade8bfc 100644 --- a/rtgui/editenums.h +++ b/rtgui/editenums.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EDITENUMS_ -#define _EDITENUMS_ +#pragma once enum ImgEditState {SNormal, SCropMove, SHandMove, SResizeW1, SResizeW2, SResizeH1, SResizeH2, SResizeTL, SResizeTR, SResizeBL, SResizeBR, SCropSelecting, SRotateSelecting, SCropWinMove, SCropFrameMove, SCropImgMove, SCropWinResize, SObservedMove, @@ -26,5 +25,3 @@ enum ImgEditState {SNormal, SCropMove, SHandMove, SResizeW1, SResizeW2, SResizeH enum CursorArea {CropWinButtons, CropToolBar, CropImage, ColorPicker, CropBorder, CropTop, CropTopLeft, CropTopRight, CropBottom, CropBottomLeft, CropBottomRight, CropLeft, CropRight, CropInside, CropResize, CropObserved }; - -#endif diff --git a/rtgui/editid.h b/rtgui/editid.h index 88d77f859..39dc2bf7c 100644 --- a/rtgui/editid.h +++ b/rtgui/editid.h @@ -16,9 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EDITID_H_ -#define _EDITID_H_ - +#pragma once /// @brief List of pipette editing operation enum EditUniqueID : int { @@ -67,5 +65,3 @@ enum ObjectMode { OM_255, /// less or equal than 255 objects OM_65535 /// less or equal than 65535 objects }; - -#endif diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 6aab153a1..108b11ea3 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -23,6 +23,7 @@ #include "../rtengine/imagesource.h" #include "../rtengine/iccstore.h" +#include "batchqueue.h" #include "soundman.h" #include "rtimage.h" #include "rtwindow.h" @@ -32,6 +33,9 @@ #include "progressconnector.h" #include "procparamchangers.h" #include "placesbrowser.h" +#include "pathutils.h" +#include "thumbnail.h" +#include "toolpanelcoord.h" using namespace rtengine::procparams; @@ -889,41 +893,17 @@ EditorPanel::~EditorPanel () delete vboxright; //delete saveAsDialog; - if (catalogPane) { - delete catalogPane; - } - - if (iTopPanel_1_Show) { - delete iTopPanel_1_Show; - } - - if (iTopPanel_1_Hide) { - delete iTopPanel_1_Hide; - } - - if (iHistoryShow) { - delete iHistoryShow; - } - - if (iHistoryHide) { - delete iHistoryHide; - } - - if (iBeforeLockON) { - delete iBeforeLockON; - } - - if (iBeforeLockOFF) { - delete iBeforeLockOFF; - } - - if (iRightPanel_1_Show) { - delete iRightPanel_1_Show; - } - - if (iRightPanel_1_Hide) { - delete iRightPanel_1_Hide; - } + delete catalogPane; + delete iTopPanel_1_Show; + delete iTopPanel_1_Hide; + delete iHistoryShow; + delete iHistoryHide; + delete iBeforeLockON; + delete iBeforeLockOFF; + delete iRightPanel_1_Show; + delete iRightPanel_1_Hide; + delete iShowHideSidePanels_exit; + delete iShowHideSidePanels; } void EditorPanel::leftPaneButtonReleased (GdkEventButton *event) @@ -1130,7 +1110,7 @@ Glib::ustring EditorPanel::getShortName () } } -Glib::ustring EditorPanel::getFileName () +Glib::ustring EditorPanel::getFileName () const { if (openThm) { return openThm->getFileName (); @@ -2034,9 +2014,9 @@ bool EditorPanel::idle_sendToGimp ( ProgressConnector *p if (img) { // get file name base - Glib::ustring shortname = removeExtension (Glib::path_get_basename (fname)); - Glib::ustring dirname = Glib::get_tmp_dir (); - Glib::ustring fname = Glib::build_filename (dirname, shortname); + const Glib::ustring shortname = removeExtension (Glib::path_get_basename (fname)); + const Glib::ustring dirname = Glib::get_tmp_dir (); + const Glib::ustring lfname = Glib::build_filename (dirname, shortname); SaveFormat sf; sf.format = "tif"; @@ -2045,13 +2025,13 @@ bool EditorPanel::idle_sendToGimp ( ProgressConnector *p sf.tiffUncompressed = true; sf.saveParams = true; - Glib::ustring fileName = Glib::ustring::compose ("%1.%2", fname, sf.format); + Glib::ustring fileName = Glib::ustring::compose ("%1.%2", lfname, sf.format); // TODO: Just list all file with a suitable name instead of brute force... int tries = 1; while (Glib::file_test (fileName, Glib::FILE_TEST_EXISTS) && tries < 1000) { - fileName = Glib::ustring::compose ("%1-%2.%3", fname, tries, sf.format); + fileName = Glib::ustring::compose ("%1-%2.%3", lfname, tries, sf.format); tries++; } diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index c4349f693..b577b858f 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -17,27 +17,28 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EDITORPANEL_ -#define _EDITORPANEL_ +#pragma once #include -#include "imageareapanel.h" -#include "toolpanelcoord.h" -#include "profilepanel.h" -#include "../rtengine/rtengine.h" -#include "history.h" -#include "histogrampanel.h" -#include "thumbnail.h" -#include "saveasdlg.h" + #include "batchqueueentry.h" -#include "thumbnaillistener.h" -#include "navigator.h" -#include "progressconnector.h" #include "filepanel.h" +#include "histogrampanel.h" +#include "history.h" +#include "imageareapanel.h" +#include "navigator.h" +#include "profilepanel.h" +#include "progressconnector.h" +#include "saveasdlg.h" +#include "thumbnaillistener.h" + #include "../rtengine/noncopyable.h" +#include "../rtengine/rtengine.h" class EditorPanel; class MyProgressBar; +class Thumbnail; +class ToolPanelCoordinator; struct EditorPanelIdleHelper { EditorPanel* epanel; @@ -149,7 +150,7 @@ public: void saveProfile (); Glib::ustring getShortName (); - Glib::ustring getFileName (); + Glib::ustring getFileName () const; bool handleShortcutKey (GdkEventKey* event); bool getIsProcessing() const @@ -259,6 +260,3 @@ private: IdleRegister idle_register; }; - -#endif - diff --git a/rtgui/editwidgets.cc b/rtgui/editwidgets.cc index a7996ee42..f7c748744 100644 --- a/rtgui/editwidgets.cc +++ b/rtgui/editwidgets.cc @@ -18,8 +18,10 @@ */ #include "editwidgets.h" + #include "editbuffer.h" #include "editcallbacks.h" +#include "rtsurface.h" #include "../rtengine/rt_math.h" RGBColor Geometry::getInnerLineColor () diff --git a/rtgui/editwidgets.h b/rtgui/editwidgets.h index 9154db31f..d31451ecb 100644 --- a/rtgui/editwidgets.h +++ b/rtgui/editwidgets.h @@ -20,12 +20,14 @@ #ifdef GUIVERSION -#include "rtsurface.h" +#include + #include "editbuffer.h" #include "editcoordsys.h" #include "../rtengine/coord.h" class ObjectMOBuffer; +class RTSurface; /** @file * diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index 50a1484cf..11c0be4e2 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -16,6 +16,7 @@ */ #include "editwindow.h" +#include "../rtengine/procparams.h" #include "options.h" #include "preferences.h" #include "cursormanager.h" diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index 8a2ade6ba..08e8c0199 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -14,15 +14,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EDITWINDOW_ -#define _EDITWINDOW_ +#pragma once -#include -#include "filepanel.h" -#include "editorpanel.h" #include -class EditWindow : public Gtk::Window +#include + +#include "editorpanel.h" +#include "filepanel.h" +#include "rtimage.h" + +class EditWindow : + public Gtk::Window { private: @@ -66,5 +69,3 @@ public: void set_title_decorated(Glib::ustring fname); void on_realize () override; }; - -#endif diff --git a/rtgui/epd.h b/rtgui/epd.h index d8781ef27..410004d89 100644 --- a/rtgui/epd.h +++ b/rtgui/epd.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EPD_H_ -#define _EPD_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class EdgePreservingDecompositionUI : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class EdgePreservingDecompositionUI : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: Adjuster *strength; @@ -45,5 +48,3 @@ public: void enabledChanged () override; void setAdjusterBehavior (bool stAdd, bool gAdd, bool esAdd, bool scAdd, bool rAdd); }; - -#endif diff --git a/rtgui/exiffiltersettings.h b/rtgui/exiffiltersettings.h index e820a2cac..5a25af6ad 100644 --- a/rtgui/exiffiltersettings.h +++ b/rtgui/exiffiltersettings.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EXIFFILTERSETTINGS_ -#define _EXIFFILTERSETTINGS_ +#pragma once #include #include @@ -51,6 +50,3 @@ public: ExifFilterSettings (); void clear (); }; - -#endif - diff --git a/rtgui/exifpanel.h b/rtgui/exifpanel.h index f054f37c7..0894c21ad 100644 --- a/rtgui/exifpanel.h +++ b/rtgui/exifpanel.h @@ -16,16 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EXIFPANEL_ -#define _EXIFPANEL_ +#pragma once #include #include #include "toolpanel.h" +#include "../rtexif/rtexif.h" -class ExifPanel : public Gtk::VBox, public ToolPanel +class ExifPanel : + public Gtk::VBox, + public ToolPanel { private: @@ -114,5 +116,3 @@ public: void notifyListener(); }; - -#endif diff --git a/rtgui/exportpanel.h b/rtgui/exportpanel.h index d13ca08ad..f70e47386 100644 --- a/rtgui/exportpanel.h +++ b/rtgui/exportpanel.h @@ -17,12 +17,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _EXPORTPANEL_ -#define _EXPORTPANEL_ +#pragma once #include -#include "guiutils.h" + #include "adjuster.h" +#include "guiutils.h" class ExportPanelListener { @@ -122,5 +122,3 @@ public: listener = l; } }; - -#endif diff --git a/rtgui/extprog.cc b/rtgui/extprog.cc index 00ea07713..a7a757c1b 100644 --- a/rtgui/extprog.cc +++ b/rtgui/extprog.cc @@ -26,6 +26,8 @@ #include #endif +#include + #include "options.h" #include "multilangmgr.h" @@ -211,7 +213,7 @@ bool ExtProgStore::spawnCommandAsync (const Glib::ustring& cmd) } catch (const Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << "Failed to execute \"" << cmd << "\": " << exception.what() << std::endl; } @@ -230,7 +232,7 @@ bool ExtProgStore::spawnCommandSync (const Glib::ustring& cmd) } catch (const Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << "Failed to execute \"" << cmd << "\": " << exception.what() << std::endl; } diff --git a/rtgui/extprog.h b/rtgui/extprog.h index ea2749a61..c5e00bb1b 100644 --- a/rtgui/extprog.h +++ b/rtgui/extprog.h @@ -16,14 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ - -#ifndef _EXTPROG_ -#define _EXTPROG_ - -#include +#pragma once #include +#include + #include "threadutils.h" struct ExtProgAction @@ -74,5 +72,3 @@ inline const std::vector& ExtProgStore::getActions () const { return actions; } - -#endif diff --git a/rtgui/fattaltonemap.cc b/rtgui/fattaltonemap.cc index a0baf3531..89a1e9e30 100644 --- a/rtgui/fattaltonemap.cc +++ b/rtgui/fattaltonemap.cc @@ -23,6 +23,7 @@ #include "fattaltonemap.h" #include "eventmapper.h" +#include "rtimage.h" #include "../rtengine/procparams.h" diff --git a/rtgui/favoritbrowser.h b/rtgui/favoritbrowser.h index 292f17de6..7a73b98af 100644 --- a/rtgui/favoritbrowser.h +++ b/rtgui/favoritbrowser.h @@ -16,17 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FAVORITBROWSER_ -#define _FAVORITBROWSER_ +#pragma once #include + #include "dirbrowserremoteinterface.h" #include "dirselectionlistener.h" -class FavoritBrowser : public Gtk::VBox, public DirSelectionListener +class FavoritBrowser : + public Gtk::VBox, + public DirSelectionListener { - - class FavoritColumns : public Gtk::TreeModel::ColumnRecord + class FavoritColumns : + public Gtk::TreeModel::ColumnRecord { public: Gtk::TreeModelColumn > icon; @@ -61,7 +63,3 @@ public: void delPressed (); void selectionChanged (); }; - -#endif - - diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index f9afcef48..3dcb573ca 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include "filebrowser.h" @@ -29,16 +29,16 @@ #include "clipboard.h" #include "multilangmgr.h" #include "options.h" +#include "profilestorecombobox.h" #include "procparamchangers.h" #include "rtimage.h" #include "threadutils.h" +#include "thumbnail.h" #include "../rtengine/dfmanager.h" #include "../rtengine/ffmanager.h" #include "../rtengine/procparams.h" -extern Options options; - namespace { diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index 6911a944f..b941ea9df 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -16,25 +16,28 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILEBROWSER_ -#define _FILEBROWSER_ +#pragma once + +#include #include -#include -#include "thumbbrowserbase.h" -#include "exiffiltersettings.h" -#include "filebrowserentry.h" + #include "browserfilter.h" -#include "pparamschangelistener.h" -#include "partialpastedlg.h" +#include "exiffiltersettings.h" #include "exportpanel.h" #include "extprog.h" -#include "profilestorecombobox.h" +#include "filebrowserentry.h" +#include "lwbutton.h" +#include "partialpastedlg.h" +#include "pparamschangelistener.h" +#include "../rtengine/profilestore.h" +#include "thumbbrowserbase.h" + #include "../rtengine/noncopyable.h" -class ProfileStoreLabel; class FileBrowser; class FileBrowserEntry; +class ProfileStoreLabel; class FileBrowserListener { @@ -210,5 +213,3 @@ public: type_trash_changed trash_changed(); }; - -#endif diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 44146b990..4d31d625e 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -27,6 +27,7 @@ #include "rtimage.h" #include "threadutils.h" #include "thumbbrowserbase.h" +#include "thumbnail.h" #include "../rtengine/procparams.h" diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index 646e8e67e..1bdbb2ecb 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -16,28 +16,27 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILEBROWSERENTRY_ -#define _FILEBROWSERENTRY_ +#pragma once #include #include #include -#include "../rtengine/rtengine.h" - #include "crophandler.h" #include "editenums.h" #include "filethumbnailbuttonset.h" #include "imageareatoollistener.h" #include "thumbbrowserentrybase.h" #include "thumbimageupdater.h" -#include "thumbnail.h" #include "thumbnaillistener.h" -#include "../rtengine/noncopyable.h" +#include "../rtengine/noncopyable.h" +#include "../rtengine/rtengine.h" class FileBrowserEntry; +class Thumbnail; + struct FileBrowserEntryIdleHelper { FileBrowserEntry* fbentry; bool destroyed; @@ -109,5 +108,3 @@ public: bool pressNotify (int button, int type, int bstate, int x, int y) override; bool releaseNotify (int button, int type, int bstate, int x, int y) override; }; - -#endif diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 674501322..5e93631e5 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -25,6 +25,7 @@ #include #include "../rtengine/rt_math.h" +#include "../rtengine/procparams.h" #include "guiutils.h" #include "options.h" @@ -36,6 +37,8 @@ #include "thumbimageupdater.h" #include "batchqueue.h" #include "placesbrowser.h" +#include "pathutils.h" +#include "thumbnail.h" using namespace std; @@ -602,7 +605,7 @@ std::vector FileCatalog::getFileList() names.push_back(Glib::build_filename(selectedDirectory, fname)); } catch (Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << exception.what() << std::endl; } } @@ -610,7 +613,7 @@ std::vector FileCatalog::getFileList() } catch (Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << "Failed to list directory \"" << selectedDirectory << "\": " << exception.what() << std::endl; } diff --git a/rtgui/filecatalog.h b/rtgui/filecatalog.h index 09e2cc1ed..c71658cca 100644 --- a/rtgui/filecatalog.h +++ b/rtgui/filecatalog.h @@ -16,22 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILECATALOG_ -#define _FILECATALOG_ +#pragma once -#include "filebrowser.h" -#include "exiffiltersettings.h" -#include -#include "fileselectionlistener.h" #include -#include "fileselectionchangelistener.h" + +#include + #include "coarsepanel.h" -#include "toolbar.h" -#include "filterpanel.h" +#include "exiffiltersettings.h" #include "exportpanel.h" -#include "previewloader.h" +#include "filebrowser.h" +#include "fileselectionchangelistener.h" +#include "fileselectionlistener.h" +#include "filterpanel.h" #include "multilangmgr.h" +#include "previewloader.h" #include "threadutils.h" +#include "toolbar.h" + #include "../rtengine/noncopyable.h" class FilePanel; @@ -288,5 +290,3 @@ inline void FileCatalog::setDirSelector (const FileCatalog::DirSelectionSlot& se { this->selectDir = selectDir; } - -#endif diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 3e23cbc5d..8f45343de 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -18,9 +18,12 @@ */ #include "filepanel.h" +#include "batchtoolpanelcoord.h" +#include "editorpanel.h" #include "rtwindow.h" #include "inspector.h" #include "placesbrowser.h" +#include "thumbnail.h" FilePanel::FilePanel () : parent(nullptr), error(0) { diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index bdeb266f4..9db9d99b7 100644 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -16,23 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILEPANEL_ -#define _FILEPANEL_ +#pragma once #include -#include "batchtoolpanelcoord.h" -#include "filecatalog.h" + #include "dirbrowser.h" -#include "fileselectionlistener.h" -#include "placesbrowser.h" -#include "recentbrowser.h" -#include "pparamschangelistener.h" -#include "history.h" -#include "filterpanel.h" #include "exportpanel.h" +#include "filecatalog.h" +#include "fileselectionlistener.h" +#include "filterpanel.h" +#include "history.h" +#include "placesbrowser.h" +#include "pparamschangelistener.h" #include "progressconnector.h" +#include "recentbrowser.h" + #include "../rtengine/noncopyable.h" +class BatchToolPanelCoordinator; class RTWindow; class FilePanel final : @@ -108,6 +109,3 @@ private: IdleRegister idle_register; }; - -#endif - diff --git a/rtgui/fileselectionchangelistener.h b/rtgui/fileselectionchangelistener.h index 1f3b8e612..64251c1bd 100644 --- a/rtgui/fileselectionchangelistener.h +++ b/rtgui/fileselectionchangelistener.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILESELECTIONCHANGELISTENER_ -#define _FILESELECTIONCHANGELISTENER_ +#pragma once class Thumbnail; @@ -27,6 +26,3 @@ public: virtual ~FileSelectionChangeListener() = default; virtual void selectionChanged(const std::vector& selected) = 0; }; - -#endif - diff --git a/rtgui/fileselectionlistener.h b/rtgui/fileselectionlistener.h index a7f7fb284..394a35f51 100644 --- a/rtgui/fileselectionlistener.h +++ b/rtgui/fileselectionlistener.h @@ -16,11 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILESELECTIONLISTENER_ -#define _FILESELECTIONLISTENER_ +#pragma once -class Thumbnail; class BatchQueueEntry; +class Thumbnail; class FileSelectionListener { @@ -29,6 +28,3 @@ public: virtual bool fileSelected(Thumbnail* thm) = 0; virtual bool addBatchQueueJobs(const std::vector& entries) = 0; }; - -#endif - diff --git a/rtgui/filethumbnailbuttonset.cc b/rtgui/filethumbnailbuttonset.cc index ef497a535..bb64675a1 100644 --- a/rtgui/filethumbnailbuttonset.cc +++ b/rtgui/filethumbnailbuttonset.cc @@ -20,6 +20,8 @@ #include "rtimage.h" #include "multilangmgr.h" +#include "lwbutton.h" +#include "rtsurface.h" bool FileThumbnailButtonSet::iconsLoaded = false; diff --git a/rtgui/filethumbnailbuttonset.h b/rtgui/filethumbnailbuttonset.h index 102b573c8..66d5b5f67 100644 --- a/rtgui/filethumbnailbuttonset.h +++ b/rtgui/filethumbnailbuttonset.h @@ -16,18 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILETHUMBNAILBUTTONSET_ -#define _FILETHUMBNAILBUTTONSET_ +#pragma once #include -#include "lwbuttonset.h" #include + #include "filebrowserentry.h" -#include "rtsurface.h" +#include "lwbuttonset.h" class FileBrowserEntry; -class FileThumbnailButtonSet : public LWButtonSet +class RTSurface; + +class FileThumbnailButtonSet : + public LWButtonSet { static bool iconsLoaded; @@ -55,5 +57,3 @@ public: void setInTrash (bool inTrash); }; - -#endif diff --git a/rtgui/filmsimulation.h b/rtgui/filmsimulation.h index b5c9ffa6b..fc9e804e1 100644 --- a/rtgui/filmsimulation.h +++ b/rtgui/filmsimulation.h @@ -1,14 +1,17 @@ -#ifndef FILM_SIMULATION_INCLUDED -#define FILM_SIMULATION_INCLUDED +#pragma once + +#include #include -#include -#include -#include "toolpanel.h" -#include "guiutils.h" -#include "adjuster.h" -class ClutComboBox : public MyComboBox +#include + +#include "adjuster.h" +#include "guiutils.h" +#include "toolpanel.h" + +class ClutComboBox : + public MyComboBox { public: explicit ClutComboBox(const Glib::ustring &path); @@ -74,5 +77,3 @@ private: Adjuster *m_strength; }; - -#endif diff --git a/rtgui/filterpanel.h b/rtgui/filterpanel.h index e6e41a416..25a368b27 100644 --- a/rtgui/filterpanel.h +++ b/rtgui/filterpanel.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FILTERPANEL_ -#define _FILTERPANEL_ +#pragma once #include + #include "exiffiltersettings.h" class FilterPanelListener @@ -79,5 +79,3 @@ public: enabled->set_active(enabledState); } }; - -#endif diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index 6dc3a1f5b..b5dc4f726 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -32,6 +32,7 @@ #include "curveeditor.h" #include "flatcurveeditorsubgroup.h" #include "rtimage.h" +#include "options.h" #include "../rtengine/curves.h" diff --git a/rtgui/flatcurveeditorsubgroup.h b/rtgui/flatcurveeditorsubgroup.h index e9253cd08..c358dde3b 100644 --- a/rtgui/flatcurveeditorsubgroup.h +++ b/rtgui/flatcurveeditorsubgroup.h @@ -16,16 +16,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FLATCURVEEDITORSUBGROUP_ -#define _FLATCURVEEDITORSUBGROUP_ +#pragma once #include + #include "curveeditorgroup.h" + #include "../rtengine/noncopyable.h" class FlatCurveEditor; +class MyFlatCurve; -class FlatCurveEditorSubGroup: public CurveEditorSubGroup, public rtengine::NonCopyable +class FlatCurveEditorSubGroup: + public CurveEditorSubGroup, + public rtengine::NonCopyable { friend class FlatCurveEditor; @@ -76,5 +80,3 @@ protected: void editPointToggled(Gtk::ToggleButton *button); void editToggled (Gtk::ToggleButton *button); }; - -#endif diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 03204c037..ff0c0f9dd 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -25,6 +25,7 @@ #include "rtimage.h" #include "../rtengine/procparams.h" +#include "../rtengine/rawimage.h" using namespace rtengine; using namespace rtengine::procparams; @@ -32,18 +33,17 @@ using namespace rtengine::procparams; FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_LABEL")) { hbff = Gtk::manage(new Gtk::HBox()); - hbff->set_spacing(2); flatFieldFile = Gtk::manage(new MyFileChooserButton(M("TP_FLATFIELD_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN)); bindCurrentFolder (*flatFieldFile, options.lastFlatfieldDir); ffLabel = Gtk::manage(new Gtk::Label(M("GENERAL_FILE"))); flatFieldFileReset = Gtk::manage(new Gtk::Button()); flatFieldFileReset->set_image (*Gtk::manage(new RTImage ("cancel-small.png"))); - hbff->pack_start(*ffLabel, Gtk::PACK_SHRINK, 0); + hbff->pack_start(*ffLabel, Gtk::PACK_SHRINK); hbff->pack_start(*flatFieldFile); - hbff->pack_start(*flatFieldFileReset, Gtk::PACK_SHRINK, 0); + hbff->pack_start(*flatFieldFileReset, Gtk::PACK_SHRINK); flatFieldAutoSelect = Gtk::manage(new Gtk::CheckButton((M("TP_FLATFIELD_AUTOSELECT")))); - ffInfo = Gtk::manage(new Gtk::Label("")); - ffInfo->set_alignment(0, 0); //left align + ffInfo = Gtk::manage(new Gtk::Label("-")); + setExpandAlignProperties(ffInfo, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); flatFieldBlurRadius = Gtk::manage(new Adjuster (M("TP_FLATFIELD_BLURRADIUS"), 0, 200, 2, 32)); flatFieldBlurRadius->setAdjusterListener (this); @@ -54,15 +54,14 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L flatFieldBlurRadius->show(); Gtk::HBox* hbffbt = Gtk::manage (new Gtk::HBox ()); - hbffbt->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_FLATFIELD_BLURTYPE") + ":"))); - hbffbt->set_spacing(4); + hbffbt->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_FLATFIELD_BLURTYPE") + ":")), Gtk::PACK_SHRINK); flatFieldBlurType = Gtk::manage (new MyComboBoxText ()); flatFieldBlurType->append(M("TP_FLATFIELD_BT_AREA")); flatFieldBlurType->append(M("TP_FLATFIELD_BT_VERTICAL")); flatFieldBlurType->append(M("TP_FLATFIELD_BT_HORIZONTAL")); flatFieldBlurType->append(M("TP_FLATFIELD_BT_VERTHORIZ")); flatFieldBlurType->set_active(0); - hbffbt->pack_end (*flatFieldBlurType); + hbffbt->pack_end (*flatFieldBlurType, Gtk::PACK_EXPAND_WIDGET); flatFieldClipControl = Gtk::manage (new Adjuster(M("TP_FLATFIELD_CLIPCONTROL"), 0., 100., 1., 0.)); flatFieldClipControl->setAdjusterListener(this); @@ -75,12 +74,12 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L flatFieldClipControl->show(); flatFieldClipControl->set_tooltip_markup (M("TP_FLATFIELD_CLIPCONTROL_TOOLTIP")); - pack_start( *hbff, Gtk::PACK_SHRINK, 0); - pack_start( *flatFieldAutoSelect, Gtk::PACK_SHRINK, 0); - pack_start( *ffInfo, Gtk::PACK_SHRINK, 0); - pack_start( *hbffbt, Gtk::PACK_SHRINK, 0); - pack_start( *flatFieldBlurRadius, Gtk::PACK_SHRINK, 0); - pack_start( *flatFieldClipControl, Gtk::PACK_SHRINK, 0); + pack_start( *hbff, Gtk::PACK_SHRINK); + pack_start( *flatFieldAutoSelect, Gtk::PACK_SHRINK); + pack_start( *ffInfo, Gtk::PACK_SHRINK); + pack_start( *hbffbt, Gtk::PACK_SHRINK); + pack_start( *flatFieldBlurRadius, Gtk::PACK_SHRINK); + pack_start( *flatFieldClipControl, Gtk::PACK_SHRINK); flatFieldFileconn = flatFieldFile->signal_file_set().connect ( sigc::mem_fun(*this, &FlatField::flatFieldFileChanged)); //, true); flatFieldFileReset->signal_clicked().connect( sigc::mem_fun(*this, &FlatField::flatFieldFile_Reset), true ); @@ -169,7 +168,7 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi ffInfo->set_text(Glib::ustring(M("TP_PREPROCESS_NO_FOUND"))); } } else { - ffInfo->set_text(""); + ffInfo->set_text("-"); } ffChanged = false; @@ -334,7 +333,7 @@ void FlatField::flatFieldFile_Reset() flatFieldFile->set_current_folder(options.lastFlatfieldDir); } - ffInfo->set_text(""); + ffInfo->set_text("-"); if (listener) { listener->panelChanged (EvFlatFieldFile, M("GENERAL_NONE") ); @@ -384,7 +383,7 @@ void FlatField::flatFieldAutoSelectChanged() ffInfo->set_text(Glib::ustring(M("TP_PREPROCESS_NO_FOUND"))); } } else { - ffInfo->set_text(""); + ffInfo->set_text("-"); } if (listener) { diff --git a/rtgui/flatfield.h b/rtgui/flatfield.h index b9997f65e..4308e938a 100644 --- a/rtgui/flatfield.h +++ b/rtgui/flatfield.h @@ -16,15 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _FLATFIELD_H_ -#define _FLATFIELD_H_ +#pragma once #include + #include + #include "adjuster.h" -#include "toolpanel.h" -#include "../rtengine/rawimage.h" #include "guiutils.h" +#include "toolpanel.h" + +namespace rtengine +{ + +class RawImage; + +} class FFProvider { @@ -84,5 +91,3 @@ public: }; void flatFieldAutoClipValueChanged(int n = 0) override; }; - -#endif diff --git a/rtgui/gradient.h b/rtgui/gradient.h index 05a267a0d..834f08670 100644 --- a/rtgui/gradient.h +++ b/rtgui/gradient.h @@ -1,16 +1,20 @@ /* * This file is part of RawTherapee. */ -#ifndef _GRADIENT_H_ -#define _GRADIENT_H_ +#pragma once #include + #include "adjuster.h" #include "editcallbacks.h" -#include "toolpanel.h" #include "guiutils.h" +#include "toolpanel.h" -class Gradient : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber +class Gradient : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel, + public EditSubscriber { private: @@ -58,5 +62,3 @@ public: bool drag1(int modifierKey) override; void switchOffEditMode () override; }; - -#endif diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 189cf6178..d6ede26da 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -217,16 +217,6 @@ bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference) } } -void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh) -{ - - if (options.thumbInterp == 0) { - rtengine::nearestInterp (src, sw, sh, dst, dw, dh); - } else if (options.thumbInterp == 1) { - rtengine::bilinearInterp (src, sw, sh, dst, dw, dh); - } -} - bool confirmOverwrite (Gtk::Window& parent, const std::string& filename) { bool safe = true; diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index b09e20abb..97c72513b 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __GUI_UTILS_ -#define __GUI_UTILS_ +#pragma once #include #include @@ -26,19 +25,29 @@ #include +#include "threadutils.h" + #include "../rtengine/coord.h" #include "../rtengine/noncopyable.h" -#include "../rtengine/rtengine.h" -#include "rtimage.h" +namespace rtengine +{ -// for convenience... -#include "pathutils.h" +namespace procparams +{ +class ProcParams; + +struct CropParams; + +} + +} + +class RTImage; Glib::ustring escapeHtmlChars(const Glib::ustring &src); bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference = true); -void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh); bool confirmOverwrite (Gtk::Window& parent, const std::string& filename); void writeFailed (Gtk::Window& parent, const std::string& filename); void drawCrop (Cairo::RefPtr cr, int imx, int imy, int imw, int imh, int startx, int starty, double scale, const rtengine::procparams::CropParams& cparams, bool drawGuide = true, bool useBgColor = true, bool fullImageVisible = true); @@ -644,5 +653,3 @@ inline Gtk::Window& getToplevelWindow (Gtk::Widget* widget) { return *static_cast (widget->get_toplevel ()); } - -#endif diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 36803ddf2..ddf60ca75 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -24,15 +24,10 @@ #include #include "../rtengine/LUT.h" #include "rtimage.h" -#include "../rtengine/improccoordinator.h" #include "../rtengine/color.h" -#include "../rtengine/opthelper.h" -#include "../rtengine/iccstore.h" using namespace rtengine; -extern Options options; - // // diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 1515db97a..23b065534 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -16,21 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _HISTOGRAMPANEL_ -#define _HISTOGRAMPANEL_ - +#pragma once #include -#include -#include -#include "../rtengine/LUT.h" -#include "../rtengine/improccoordinator.h" -#include "guiutils.h" +#include + +#include + +#include "guiutils.h" #include "pointermotionlistener.h" + +#include "../rtengine/LUT.h" #include "../rtengine/noncopyable.h" class HistogramArea; + struct HistogramAreaIdleHelper { HistogramArea* harea; bool destroyed; @@ -252,5 +253,3 @@ public: // drawModeListener interface void toggleButtonMode () override; }; - -#endif diff --git a/rtgui/history.h b/rtgui/history.h index abf0d1ba5..faebe4765 100644 --- a/rtgui/history.h +++ b/rtgui/history.h @@ -16,14 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _HISTORY_ -#define _HISTORY_ +#pragma once #include -#include "../rtengine/rtengine.h" + +#include "paramsedited.h" #include "pparamschangelistener.h" #include "profilechangelistener.h" -#include "paramsedited.h" + +#include "../rtengine/rtengine.h" class HistoryBeforeLineListener { @@ -135,5 +136,3 @@ public: bmnum = 1; }; }; - -#endif diff --git a/rtgui/hsvequalizer.cc b/rtgui/hsvequalizer.cc index b6b5b04f2..b570a23ac 100644 --- a/rtgui/hsvequalizer.cc +++ b/rtgui/hsvequalizer.cc @@ -18,6 +18,8 @@ */ #include "hsvequalizer.h" +#include "options.h" + #include "../rtengine/color.h" #include "../rtengine/procparams.h" diff --git a/rtgui/hsvequalizer.h b/rtgui/hsvequalizer.h index 2ffa9fa0f..7d313cc76 100644 --- a/rtgui/hsvequalizer.h +++ b/rtgui/hsvequalizer.h @@ -16,20 +16,22 @@ * * 2010 Ilya Popov */ - -#ifndef HSVEQUALIZER_H_INCLUDED -#define HSVEQUALIZER_H_INCLUDED +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" -#include "guiutils.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "colorprovider.h" +#include "guiutils.h" +#include "toolpanel.h" - -class HSVEqualizer : public ToolParamBlock, public FoldableToolPanel, public CurveListener, public ColorProvider +class HSVEqualizer : + public ToolParamBlock, + public FoldableToolPanel, + public CurveListener, + public ColorProvider { protected: @@ -56,5 +58,3 @@ public: //void adjusterChanged (Adjuster* a, double newval); void enabledChanged() override; }; - -#endif diff --git a/rtgui/iccprofilecreator.cc b/rtgui/iccprofilecreator.cc index 9efa4360b..a8f9be007 100644 --- a/rtgui/iccprofilecreator.cc +++ b/rtgui/iccprofilecreator.cc @@ -17,25 +17,20 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include +#include + #include #include "iccprofilecreator.h" +#include "../rtengine/iccstore.h" #include "multilangmgr.h" #include "cachemanager.h" -#include "addsetids.h" #include "../rtengine/color.h" +#include "options.h" +#include "pathutils.h" #include "rtimage.h" -#ifdef _OPENMP -#include -#endif - -extern Options options; - -namespace rtengine -{ - -extern const Settings* settings; - -} +#include "rtwindow.h" const char* sTRCPreset[] = {"BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35", "Low_g2.6_s6.9", "Lab_g3.0s9.03296"}; //gamma free diff --git a/rtgui/iccprofilecreator.h b/rtgui/iccprofilecreator.h index b28ac29f2..2cd19e14f 100644 --- a/rtgui/iccprofilecreator.h +++ b/rtgui/iccprofilecreator.h @@ -19,11 +19,13 @@ */ #pragma once +#include + #include #include "adjuster.h" -#include "options.h" #include -#include "rtwindow.h" + +class RTWindow; class ICCProfileCreator : public Gtk::Dialog, public AdjusterListener { diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 012aeca78..3e3c0508c 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -23,6 +23,7 @@ #include "eventmapper.h" #include "guiutils.h" #include "options.h" +#include "pathutils.h" #include "rtimage.h" #include "../rtengine/dcp.h" @@ -32,8 +33,6 @@ using namespace rtengine; using namespace rtengine::procparams; -extern Options options; - ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunchanged(nullptr), icmplistener(nullptr) { auto m = ProcEventMapper::getInstance(); diff --git a/rtgui/icmpanel.h b/rtgui/icmpanel.h index 9b4706ecd..5573bacb8 100644 --- a/rtgui/icmpanel.h +++ b/rtgui/icmpanel.h @@ -16,16 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _ICMPANEL_ -#define _ICMPANEL_ +#pragma once #include + #include + #include "adjuster.h" #include "guiutils.h" - -#include "toolpanel.h" #include "popupbutton.h" +#include "toolpanel.h" + #include "../rtengine/imagedata.h" class ICMPanelListener @@ -148,5 +149,3 @@ public: icmplistener = ipl; } }; - -#endif diff --git a/rtgui/ilabel.cc b/rtgui/ilabel.cc deleted file mode 100644 index 9dfd50b89..000000000 --- a/rtgui/ilabel.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * 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 "ilabel.h" - -ILabel::ILabel (const Glib::ustring &lab) : label(lab) {} - -void ILabel::on_realize() -{ - - Gtk::DrawingArea::on_realize(); - add_events(Gdk::EXPOSURE_MASK); - - Glib::RefPtr fn = create_pango_layout(label); - fn->set_markup (label); - int labw, labh; - fn->get_pixel_size (labw, labh); - set_size_request (2 + labw, 2 + labh); -} - -bool ILabel::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) -{ - - Glib::RefPtr style = get_style_context (); - - Gtk::StateFlags state = get_state_flags(); - Gdk::RGBA c = style->get_background_color(state); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->rectangle (0, 0, get_width (), get_height()); - cr->fill (); - - Glib::RefPtr fn = create_pango_layout (label); - fn->set_markup (label); - cr->move_to(1., 1.); - fn->add_to_cairo_context(cr); - c = style->get_color (state); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->fill(); - - return true; -} - -void ILabel::on_style_updated () -{ - - Glib::RefPtr fn = create_pango_layout(label); - fn->set_markup (label); - int labw, labh; - fn->get_pixel_size (labw, labh); - set_size_request (2 + labw, 2 + labh); -} diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index b086f8baf..0be6982f9 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -25,6 +25,7 @@ #include "../rtengine/refreshmap.h" #include "../rtengine/procparams.h" #include "options.h" +#include "rtscalable.h" ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), fullImageWidth(0), fullImageHeight(0) { diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index 375e3a536..28b52dcd2 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -16,24 +16,29 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __IMAGEAREA_H__ -#define __IMAGEAREA_H__ +#pragma once #include + #include "cropguilistener.h" -#include "imageareapanel.h" -#include "editenums.h" -#include "toolbar.h" -#include "previewhandler.h" -#include "imageareatoollistener.h" #include "cropwindow.h" #include "editcallbacks.h" -#include "zoompanel.h" +#include "editenums.h" +#include "imageareapanel.h" +#include "imageareatoollistener.h" #include "indclippedpanel.h" +#include "previewhandler.h" #include "previewmodepanel.h" +#include "toolbar.h" +#include "zoompanel.h" class ImageAreaPanel; -class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public EditDataProvider, public LockablePickerToolListener + +class ImageArea : + public Gtk::DrawingArea, + public CropWindowListener, + public EditDataProvider, + public LockablePickerToolListener { friend class ZoomPanel; @@ -158,7 +163,3 @@ public: return mainCropWindow; } }; - - - -#endif diff --git a/rtgui/imageareapanel.h b/rtgui/imageareapanel.h index 4ec3ffcf3..831371dbb 100644 --- a/rtgui/imageareapanel.h +++ b/rtgui/imageareapanel.h @@ -16,13 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMAGEAREAPANEL_ -#define _IMAGEAREAPANEL_ +#pragma once #include "imagearea.h" class ImageArea; -class ImageAreaPanel : public Gtk::VBox + +class ImageAreaPanel : + public Gtk::VBox { protected: @@ -42,5 +43,3 @@ public: void setBeforeAfterViews (ImageAreaPanel* bef, ImageAreaPanel* aft); void syncBeforeAfterViews(); }; - -#endif diff --git a/rtgui/imageareatoollistener.h b/rtgui/imageareatoollistener.h index d387b595c..3c753a5e0 100644 --- a/rtgui/imageareatoollistener.h +++ b/rtgui/imageareatoollistener.h @@ -16,13 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMAGEAREATOOLLISTENER_ -#define _IMAGEAREATOOLLISTENER_ +#pragma once -#include "toolbar.h" -#include "thumbnail.h" #include "cropguilistener.h" +#include "toolbar.h" +class Thumbnail; class ImageAreaToolListener { @@ -36,6 +35,3 @@ public: virtual ToolBar* getToolBar() const = 0; virtual CropGUIListener* startCropEditing(Thumbnail* thm = nullptr) = 0; }; - -#endif - diff --git a/rtgui/impulsedenoise.h b/rtgui/impulsedenoise.h index 1ebdc430b..e3cfc619a 100644 --- a/rtgui/impulsedenoise.h +++ b/rtgui/impulsedenoise.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IMPULSEDENOISE_H_ -#define _IMPULSEDENOISE_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class ImpulseDenoise : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class ImpulseDenoise : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -45,5 +48,3 @@ public: void setAdjusterBehavior (bool threshadd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/indclippedpanel.h b/rtgui/indclippedpanel.h index 54476af10..1017b58f1 100644 --- a/rtgui/indclippedpanel.h +++ b/rtgui/indclippedpanel.h @@ -15,14 +15,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _INDCLIPPEDPANEL_ -#define _INDCLIPPEDPANEL_ +#pragma once -#include #include +#include + class ImageArea; -class IndicateClippedPanel : public Gtk::HBox + +class IndicateClippedPanel : + public Gtk::HBox { protected: @@ -59,5 +61,3 @@ public: return indClippedH->get_active(); } }; - -#endif diff --git a/rtgui/inspector.cc b/rtgui/inspector.cc index 8bd9862a7..d38239cde 100644 --- a/rtgui/inspector.cc +++ b/rtgui/inspector.cc @@ -22,10 +22,10 @@ #include "cursormanager.h" #include "guiutils.h" #include "options.h" +#include "pathutils.h" +#include "rtscalable.h" #include "../rtengine/previewimage.h" -extern Options options; - InspectorBuffer::InspectorBuffer(const Glib::ustring &imagePath) : currTransform(0), fromRaw(false) { if (!imagePath.empty() && Glib::file_test(imagePath, Glib::FILE_TEST_EXISTS) && !Glib::file_test(imagePath, Glib::FILE_TEST_IS_DIR)) { diff --git a/rtgui/inspector.h b/rtgui/inspector.h index 681b90aa3..bb144834a 100644 --- a/rtgui/inspector.h +++ b/rtgui/inspector.h @@ -16,12 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _INSPECTOR_ -#define _INSPECTOR_ +#pragma once #include + #include "guiutils.h" + #include "../rtengine/coord.h" +#include "../rtengine/coord2d.h" +#include "../rtengine/rt_math.h" class InspectorBuffer { @@ -99,5 +102,3 @@ public: void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const override; }; - -#endif diff --git a/rtgui/iptcpanel.h b/rtgui/iptcpanel.h index 0317314a1..15d117f87 100644 --- a/rtgui/iptcpanel.h +++ b/rtgui/iptcpanel.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _IPTCPANEL_ -#define _IPTCPANEL_ +#pragma once #include @@ -26,7 +25,9 @@ #include "guiutils.h" #include "toolpanel.h" -class IPTCPanel : public Gtk::VBox, public ToolPanel +class IPTCPanel : + public Gtk::VBox, + public ToolPanel { private: @@ -92,5 +93,3 @@ public: void copyClicked (); void pasteClicked (); }; - -#endif diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 237f9ea9b..bd4b27f14 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -20,6 +20,9 @@ #include "labcurve.h" +#include "options.h" + +#include "../rtengine/color.h" #include "../rtengine/improcfun.h" #include "../rtengine/procparams.h" #include "editcallbacks.h" diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index 51ba0fdd6..46f506d68 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -16,19 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _LABCURVE_H_ -#define _LABCURVE_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "colorprovider.h" +#include "toolpanel.h" class EditDataProvider; -class LCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider +class LCurve : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel, + public CurveListener, + public ColorProvider { protected: @@ -97,5 +102,3 @@ public: void enabledChanged() override; }; - -#endif diff --git a/rtgui/labgrid.cc b/rtgui/labgrid.cc index b6393f6f5..516dbb825 100644 --- a/rtgui/labgrid.cc +++ b/rtgui/labgrid.cc @@ -38,7 +38,9 @@ #include "labgrid.h" +#include "../rtengine/color.h" #include "options.h" +#include "rtimage.h" using rtengine::Color; diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index 06b8e5689..e3352a506 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -16,14 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _LENSGEOM_H_ -#define _LENSGEOM_H_ +#pragma once #include -#include "toolpanel.h" -#include "lensgeomlistener.h" -class LensGeometry : public ToolParamBlock, public FoldableToolPanel +#include "lensgeomlistener.h" +#include "toolpanel.h" + +class LensGeometry : + public ToolParamBlock, + public FoldableToolPanel { protected: @@ -58,5 +60,3 @@ public: private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/lensgeomlistener.h b/rtgui/lensgeomlistener.h index dbe58f1fa..7bfa0fb45 100644 --- a/rtgui/lensgeomlistener.h +++ b/rtgui/lensgeomlistener.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _LENSGEOMLISTENER_H_ -#define _LENSGEOMLISTENER_H_ +#pragma once class LensGeomListener { @@ -27,5 +26,3 @@ public: virtual void autoCropRequested () = 0; virtual double autoDistorRequested () = 0; }; - -#endif diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index 389f15461..e2cdb5649 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -18,9 +18,10 @@ */ #include #include +#include #include -#include +#include #include "lensprofile.h" @@ -586,7 +587,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged) LensProfilePanel::LFDbHelper::LFDbHelper() { #ifdef _OPENMP -#pragma omp parallel sections if (!options.rtSettings.verbose) +#pragma omp parallel sections if (!settings->verbose) #endif { #ifdef _OPENMP @@ -608,7 +609,7 @@ LensProfilePanel::LFDbHelper::LFDbHelper() void LensProfilePanel::LFDbHelper::fillLensfunCameras() { - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "LENSFUN, scanning cameras:" << std::endl; } @@ -618,7 +619,7 @@ void LensProfilePanel::LFDbHelper::fillLensfunCameras() for (const auto& c : camlist) { camnames[c.getMake()].insert(c.getModel()); - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << " found: " << c.getDisplayString().c_str() << std::endl; } } @@ -638,7 +639,7 @@ void LensProfilePanel::LFDbHelper::fillLensfunCameras() void LensProfilePanel::LFDbHelper::fillLensfunLenses() { - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << "LENSFUN, scanning lenses:" << std::endl; } @@ -650,7 +651,7 @@ void LensProfilePanel::LFDbHelper::fillLensfunLenses() const auto& make = l.getMake(); lenses[make].insert(name); - if (options.rtSettings.verbose) { + if (settings->verbose) { std::cout << " found: " << l.getDisplayString().c_str() << std::endl; } } diff --git a/rtgui/lockablecolorpicker.cc b/rtgui/lockablecolorpicker.cc index ef16df6ec..cb334c7e4 100644 --- a/rtgui/lockablecolorpicker.cc +++ b/rtgui/lockablecolorpicker.cc @@ -21,12 +21,11 @@ #include "options.h" #include "../rtengine/color.h" #include "../rtengine/rt_math.h" +#include "../rtengine/utils.h" #include "imagearea.h" #include "multilangmgr.h" #include "navigator.h" -extern Options options; - LockableColorPicker::LockableColorPicker (CropWindow* cropWindow, Glib::ustring *oProfile, Glib::ustring *wProfile) : cropWindow(cropWindow), displayedValues(ColorPickerType::RGB), position(0, 0), size(Size::S15), outputProfile(oProfile), workingProfile(wProfile), validity(Validity::OUTSIDE), diff --git a/rtgui/lockablecolorpicker.h b/rtgui/lockablecolorpicker.h index f1a63d533..eadf71773 100644 --- a/rtgui/lockablecolorpicker.h +++ b/rtgui/lockablecolorpicker.h @@ -16,13 +16,11 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#pragma once -#ifndef __COLORPICKER__ -#define __COLORPICKER__ - +#include "guiutils.h" #include "../rtengine/coord.h" -#include "guiutils.h" class CropWindow; @@ -93,5 +91,3 @@ public: bool cycleRGB (); bool cycleHSV (); }; - -#endif diff --git a/rtgui/lwbutton.cc b/rtgui/lwbutton.cc index b5c10c532..c6c75584d 100644 --- a/rtgui/lwbutton.cc +++ b/rtgui/lwbutton.cc @@ -18,6 +18,7 @@ */ #include "lwbutton.h" #include "guiutils.h" +#include "rtsurface.h" LWButton::LWButton (Cairo::RefPtr i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring* tooltip) : xpos(0), ypos(0), halign(ha), valign(va), icon(i), bgr(0.0), bgg(0.0), bgb(0.0), fgr(0.0), fgg(0.0), fgb(0.0), state(Normal), listener(nullptr), actionCode(aCode), actionData(aData), toolTip(tooltip) diff --git a/rtgui/lwbutton.h b/rtgui/lwbutton.h index 16e53a875..a98f1fe46 100644 --- a/rtgui/lwbutton.h +++ b/rtgui/lwbutton.h @@ -16,12 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _LWBUTTON_ -#define _LWBUTTON_ +#pragma once #include #include "rtsurface.h" - class LWButton; class LWButtonListener @@ -78,5 +76,3 @@ public: void redraw (Cairo::RefPtr context); }; - -#endif diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index a03b3064b..f475cf0b3 100644 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -17,6 +17,8 @@ * along with RawTherapee. If not, see . */ #include "lwbuttonset.h" +#include "lwbutton.h" +#include "rtscalable.h" LWButtonSet::LWButtonSet () : aw(0), ah(0), ax(-1), ay(-1) { diff --git a/rtgui/lwbuttonset.h b/rtgui/lwbuttonset.h index 07d17a135..63bc5a01b 100644 --- a/rtgui/lwbuttonset.h +++ b/rtgui/lwbuttonset.h @@ -19,9 +19,10 @@ #pragma once #include -#include "lwbutton.h" #include +class LWButton; +class LWButtonListener; class LWButtonSet { diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index 09aab1cff..c60cba070 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -33,6 +33,7 @@ #include #include "../rtengine/procparams.h" #include "../rtengine/profilestore.h" +#include "../rtengine/rtengine.h" #include "options.h" #include "soundman.h" #include "rtimage.h" @@ -55,8 +56,6 @@ // Set this to 1 to make RT work when started with Eclipse and arguments, at least on Windows platform #define ECLIPSE_ARGS 0 -extern Options options; - // stores path to data files Glib::ustring argv0; Glib::ustring creditsPath; diff --git a/rtgui/main.cc b/rtgui/main.cc index 631d3db0a..ae34fc8d0 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -33,12 +33,17 @@ #include #include #include +#include "cachemanager.h" +#include "editorpanel.h" +#include "filecatalog.h" +#include "filepanel.h" #include "options.h" #include "soundman.h" #include "rtimage.h" #include "version.h" #include "extprog.h" #include "../rtengine/dynamicprofile.h" +#include "../rtengine/procparams.h" #ifndef WIN32 #include @@ -53,8 +58,6 @@ // Set this to 1 to make RT work when started with Eclipse and arguments, at least on Windows platform #define ECLIPSE_ARGS 0 -extern Options options; - // stores path to data files Glib::ustring argv0; Glib::ustring creditsPath; @@ -220,7 +223,7 @@ bool init_rt() extProgStore->init(); SoundManager::init(); - if ( !options.rtSettings.verbose ) { + if (!rtengine::settings->verbose) { TIFFSetWarningHandler (nullptr); // avoid annoying message boxes } diff --git a/rtgui/multilangmgr.h b/rtgui/multilangmgr.h index 0c76b4c01..902161eb2 100644 --- a/rtgui/multilangmgr.h +++ b/rtgui/multilangmgr.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _MULTILANGMGR_ -#define _MULTILANGMGR_ +#pragma once #include #include @@ -45,5 +44,3 @@ inline Glib::ustring M (const std::string& key) { return langMgr.getStr (key); } - -#endif diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index 6c00e3f56..7401570c8 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -20,6 +20,7 @@ #include "../rtengine/curves.h" #include #include +#include "rtscalable.h" MyCurve::MyCurve () : pipetteR(-1.f), diff --git a/rtgui/mycurve.h b/rtgui/mycurve.h index 62d8d30f2..6bdfe4b66 100644 --- a/rtgui/mycurve.h +++ b/rtgui/mycurve.h @@ -16,18 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _MYCURVE_ -#define _MYCURVE_ +#pragma once + +#include #include -#include -#include "curvelistener.h" -#include "cursormanager.h" + #include "coloredbar.h" #include "coordinateadjuster.h" +#include "cursormanager.h" +#include "curvelistener.h" + #include "../rtengine/LUT.h" -#include "guiutils.h" -#include "options.h" #include "../rtengine/noncopyable.h" #define RADIUS 3.5 /** radius of the control points ; must be x.5 to target the center of a pixel */ @@ -55,6 +55,7 @@ enum SnapToType { class MyCurveIdleHelper; class CurveEditor; +class EditDataProvider; class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller, public CoordinateProvider, public rtengine::NonCopyable { @@ -152,5 +153,3 @@ public: myCurve->setDirty(true); } }; - -#endif diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index d393c7200..9aa52c67e 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -23,6 +23,7 @@ #include "mydiagonalcurve.h" #include "editcallbacks.h" +#include "rtscalable.h" #include "../rtengine/curves.h" diff --git a/rtgui/mydiagonalcurve.h b/rtgui/mydiagonalcurve.h index 33fac6090..a71c0565c 100644 --- a/rtgui/mydiagonalcurve.h +++ b/rtgui/mydiagonalcurve.h @@ -16,28 +16,22 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _MYDIAGONALCURVE_ -#define _MYDIAGONALCURVE_ +#pragma once + +#include #include -#include -#include "curvelistener.h" + #include "cursormanager.h" +#include "curvelistener.h" #include "mycurve.h" -#include "../rtengine/LUT.h" +#include "../rtengine/diagonalcurvetypes.h" -// For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget -enum DiagonalCurveType { - DCT_Empty = -1, // Also used for identity curves - DCT_Linear, // 0 - DCT_Spline, // 1 - DCT_Parametric, // 2 - DCT_NURBS, // 3 - DCT_CatumullRom, // 4 - // Insert new curve type above this line - DCT_Unchanged // Must remain the last of the enum -}; +template +class LUT; + +using LUTf = LUT; class DiagonalCurveDescr { @@ -101,5 +95,3 @@ public: void setPos(double pos, int chanIdx) override; void stopNumericalAdjustment() override; }; - -#endif diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index ec46908ce..f01fb0066 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -23,6 +23,7 @@ #include "myflatcurve.h" #include "editcallbacks.h" +#include "rtscalable.h" #include "../rtengine/curves.h" diff --git a/rtgui/myflatcurve.h b/rtgui/myflatcurve.h index fa4466b8d..88d651a05 100644 --- a/rtgui/myflatcurve.h +++ b/rtgui/myflatcurve.h @@ -16,24 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _MYFLATCURVE_ -#define _MYFLATCURVE_ +#pragma once + +#include #include -#include -#include "curvelistener.h" -#include "cursormanager.h" -#include "mycurve.h" -// For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget -enum FlatCurveType { - FCT_Empty = -1, // Also used for identity curves - FCT_Linear, // 0 - FCT_MinMaxCPoints, // 1 - //FCT_Parametric, // 2 - // Insert new curve type above this line - FCT_Unchanged // Must remain the last of the enum -}; +#include "cursormanager.h" +#include "curvelistener.h" +#include "mycurve.h" +#include "../rtengine/flatcurvetypes.h" enum MouseOverAreas { FCT_Area_None = 1 << 0, // over a zone that don't have any @@ -138,5 +130,3 @@ public: void setPos(double pos, int chanIdx) override; void stopNumericalAdjustment() override; }; - -#endif diff --git a/rtgui/navigator.cc b/rtgui/navigator.cc index de07ffcd7..6a8137737 100644 --- a/rtgui/navigator.cc +++ b/rtgui/navigator.cc @@ -19,15 +19,10 @@ #include #include "navigator.h" #include "toolpanel.h" -#include "../rtengine/iccmatrices.h" -#include "../rtengine/iccstore.h" -#include "../rtengine/curves.h" #include "../rtengine/color.h" #include "../rtengine/rt_math.h" #include "options.h" -extern Options options; - using namespace rtengine; Navigator::Navigator () : currentRGBUnit(options.navRGBUnit), currentHSVUnit(options.navHSVUnit) diff --git a/rtgui/navigator.h b/rtgui/navigator.h index eb4584f42..953a0a44b 100644 --- a/rtgui/navigator.h +++ b/rtgui/navigator.h @@ -16,16 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _NAVIGATOR_ -#define _NAVIGATOR_ +#pragma once #include -#include "previewwindow.h" -#include "pointermotionlistener.h" -#include "options.h" -#include "../rtengine/iccstore.h" -class Navigator : public Gtk::Frame, public PointerMotionListener +#include "options.h" +#include "pointermotionlistener.h" +#include "previewwindow.h" + +class Navigator : + public Gtk::Frame, + public PointerMotionListener { typedef const double (*TMatrix)[3]; @@ -63,5 +64,3 @@ public: void getLABText (float l, float a, float b, Glib::ustring &sL, Glib::ustring &sA, Glib::ustring &sB) override; }; - -#endif diff --git a/rtgui/options.cc b/rtgui/options.cc index 737607bcf..f5b6b5b60 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -19,13 +19,18 @@ #include "options.h" #include #include +#include +#include #include #include "multilangmgr.h" #include "addsetids.h" #include "guiutils.h" +#include "pathutils.h" #include "version.h" #include "../rtengine/procparams.h" +#include "../rtengine/rtengine.h" +#include "../rtengine/utils.h" #ifdef _OPENMP #include diff --git a/rtgui/options.h b/rtgui/options.h index 3bd83cd5b..c0ed2138b 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _OPTIONS_ -#define _OPTIONS_ +#pragma once #include -#include -#include "../rtengine/rtengine.h" +#include +#include +#include "../rtengine/settings.h" #include #define STARTUPDIR_CURRENT 0 @@ -103,6 +103,13 @@ enum PPLoadLocation {PLL_Cache = 0, PLL_Input = 1}; enum CPBKeyType {CPBKT_TID = 0, CPBKT_NAME = 1, CPBKT_TID_NAME = 2}; enum prevdemo_t {PD_Sidecar = 1, PD_Fast = 0}; +namespace Glib +{ + +class KeyFile; + +} + class Options { public: @@ -447,5 +454,3 @@ extern bool gimpPlugin; extern bool remote; extern Glib::ustring versionString; extern Glib::ustring paramFileExtension; - -#endif diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index fc3cd4b7a..ffbdd8dd5 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -20,7 +20,19 @@ #include -#include "../rtengine/rtengine.h" +namespace rtengine +{ + +namespace procparams +{ + +class ProcParams; + +class PartialProfile; + +} + +} struct GeneralParamsEdited { bool rank; diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index eebb08705..da6c9251a 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -16,11 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PARTIALPASTEDLG_ -#define _PARTIALPASTEDLG_ +#pragma once #include -#include "../rtengine/rtengine.h" + +namespace rtengine +{ +namespace procparams +{ + +class ProcParams; + + +} + +} struct ParamsEdited; @@ -159,6 +169,3 @@ public: void rawToggled (); void advancedToggled (); }; - -#endif - diff --git a/rtgui/pathutils.cc b/rtgui/pathutils.cc index 71ff8b0b2..fc47a0e25 100644 --- a/rtgui/pathutils.cc +++ b/rtgui/pathutils.cc @@ -16,6 +16,8 @@ * along with RawTherapee. If not, see . */ +#include + #include "pathutils.h" diff --git a/rtgui/pathutils.h b/rtgui/pathutils.h index ed7d21984..482dfb82f 100644 --- a/rtgui/pathutils.h +++ b/rtgui/pathutils.h @@ -16,19 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __PATH_UTILS_ -#define __PATH_UTILS_ - -#include -#include -#include "../rtengine/rtengine.h" -#include "../rtengine/coord.h" -#include "rtimage.h" -#include -#include +#pragma once +#include // Removed from guiutils because used by rawtherapee-cli Glib::ustring removeExtension (const Glib::ustring& filename); Glib::ustring getExtension (const Glib::ustring& filename); - -#endif diff --git a/rtgui/pcvignette.h b/rtgui/pcvignette.h index ce41ab75f..da0e02dc6 100644 --- a/rtgui/pcvignette.h +++ b/rtgui/pcvignette.h @@ -1,14 +1,17 @@ /* * This file is part of RawTherapee. */ -#ifndef _PCVIGNETTE_H_ -#define _PCVIGNETTE_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class PCVignette : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class PCVignette : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -30,5 +33,3 @@ public: void setAdjusterBehavior (bool strengthadd, bool featheradd, bool roundnessadd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/perspective.h b/rtgui/perspective.h index 9b36ed24d..618ad32cf 100644 --- a/rtgui/perspective.h +++ b/rtgui/perspective.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PERSPECTIVE_PANEL_H_ -#define _PERSPECTIVE_PANEL_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class PerspCorrection : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class PerspCorrection : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -43,5 +46,3 @@ public: void setAdjusterBehavior (bool badd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/placesbrowser.h b/rtgui/placesbrowser.h index 6325bdb45..78c94969f 100644 --- a/rtgui/placesbrowser.h +++ b/rtgui/placesbrowser.h @@ -16,14 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PLACESBROWSER_ -#define _PLACESBROWSER_ +#pragma once #include + #include + #include "multilangmgr.h" -class PlacesBrowser : public Gtk::VBox +class PlacesBrowser : + public Gtk::VBox { public: typedef sigc::slot DirSelectionSlot; @@ -84,7 +86,3 @@ inline void PlacesBrowser::setDirSelector (const PlacesBrowser::DirSelectionSlot { this->selectDir = selectDir; } - -#endif - - diff --git a/rtgui/pointermotionlistener.h b/rtgui/pointermotionlistener.h index 0a2931262..26ca994b0 100644 --- a/rtgui/pointermotionlistener.h +++ b/rtgui/pointermotionlistener.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _POINTERMOTIONLISTENER_ -#define _POINTERMOTIONLISTENER_ +#pragma once class PointerMotionListener { @@ -26,7 +25,7 @@ protected: sigc::signal sig_cycle_hsv; public: - virtual ~PointerMotionListener() {} + virtual ~PointerMotionListener() = default; virtual void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false) = 0; virtual void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB, bool isRaw = false) { sR = "--"; sG = "--"; sB = "--"; } virtual void getHSVText (float h, float s, float v, Glib::ustring &sH, Glib::ustring &sS, Glib::ustring &sV) { sH = "--"; sS = "--"; sV = "--"; } @@ -41,5 +40,3 @@ public: return sig_cycle_hsv; } }; - -#endif diff --git a/rtgui/popupbutton.h b/rtgui/popupbutton.h index fb0b66e0d..87b1b73a6 100644 --- a/rtgui/popupbutton.h +++ b/rtgui/popupbutton.h @@ -18,13 +18,15 @@ * * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#ifndef _POPUPBUTTON_ -#define _POPUPBUTTON_ +#pragma once #include + #include "popupcommon.h" -class PopUpButton : public Gtk::Button, public PopUpCommon +class PopUpButton : + public Gtk::Button, + public PopUpCommon { public: @@ -40,5 +42,3 @@ private: bool nextOnClicked; }; - -#endif diff --git a/rtgui/popupcommon.h b/rtgui/popupcommon.h index 44ad0886a..b4cf4d7e0 100644 --- a/rtgui/popupcommon.h +++ b/rtgui/popupcommon.h @@ -18,19 +18,22 @@ * * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#ifndef _POPUPCOMMON_ -#define _POPUPCOMMON_ +#pragma once #include + #include + #include namespace Gtk { + class Grid; class Menu; class Button; class ImageMenuItem; + } typedef struct _GdkEventButton GdkEventButton; @@ -101,5 +104,3 @@ inline int PopUpCommon::getSelected () const { return posToIndex(selected); } - -#endif diff --git a/rtgui/popuptogglebutton.h b/rtgui/popuptogglebutton.h index b2949a0b8..a97c75fa2 100644 --- a/rtgui/popuptogglebutton.h +++ b/rtgui/popuptogglebutton.h @@ -18,13 +18,15 @@ * * Class created by Jean-Christophe FRISCH, aka 'Hombre' */ -#ifndef _POPUPTOGGLEBUTTON_ -#define _POPUPTOGGLEBUTTON_ +#pragma once #include + #include "popupcommon.h" -class PopUpToggleButton : public Gtk::ToggleButton, public PopUpCommon +class PopUpToggleButton : + public Gtk::ToggleButton, + public PopUpCommon { public: @@ -32,5 +34,3 @@ public: void show (); void set_tooltip_text (const Glib::ustring &text); }; - -#endif diff --git a/rtgui/pparamschangelistener.h b/rtgui/pparamschangelistener.h index 2c73ea3f6..56ac5f605 100644 --- a/rtgui/pparamschangelistener.h +++ b/rtgui/pparamschangelistener.h @@ -16,12 +16,26 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PPARAMSCHANGELISTENER_ -#define _PPARAMSCHANGELISTENER_ +#pragma once -#include "../rtengine/rtengine.h" -#include -#include "paramsedited.h" +#include + +struct ParamsEdited; + +namespace rtengine +{ + +class ProcEvent; + +namespace procparams +{ + +class ProcParams; + + +} + +} class PParamsChangeListener { @@ -43,6 +57,3 @@ public: virtual void beginBatchPParamsChange(int numberOfEntries) = 0; virtual void endBatchPParamsChange() = 0; }; - -#endif - diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index abf66c1d8..b57956f30 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -24,8 +24,11 @@ #include "addsetids.h" #include "../rtengine/dfmanager.h" #include "../rtengine/ffmanager.h" +#include "../rtengine/iccstore.h" +#include "../rtengine/procparams.h" #include #include "rtimage.h" +#include "rtwindow.h" #ifdef _OPENMP #include #endif @@ -49,7 +52,6 @@ void placeSpinBox(Gtk::Container* where, Gtk::SpinButton* &spin, const std::stri } } -extern Options options; extern Glib::ustring argv0; Glib::RefPtr themecss; Glib::RefPtr fontcss; diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 6ca302fe8..b4b90e669 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -16,20 +16,27 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __PREFERENCES_H__ -#define __PREFERENCES_H__ +#pragma once + +#include #include -#include "adjuster.h" -#include "options.h" -#include -#include "rtwindow.h" -#include "dynamicprofilepanel.h" -class Preferences : public Gtk::Dialog, public ProfileStoreListener +#include "adjuster.h" +#include "dynamicprofilepanel.h" +#include "options.h" +#include "../rtengine/profilestore.h" + +class RTWindow; +class Splash; + +class Preferences : + public Gtk::Dialog, + public ProfileStoreListener { - class ExtensionColumns : public Gtk::TreeModel::ColumnRecord + class ExtensionColumns : + public Gtk::TreeModel::ColumnRecord { public: Gtk::TreeModelColumn enabled; @@ -303,5 +310,3 @@ public: // void selectICCProfileDir (); // void selectMonitorProfile (); }; - -#endif diff --git a/rtgui/preprocess.h b/rtgui/preprocess.h index 015fa3650..3b337a450 100644 --- a/rtgui/preprocess.h +++ b/rtgui/preprocess.h @@ -16,17 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PREPROCESS_H_ -#define _PREPROCESS_H_ +#pragma once #include -//#include "adjuster.h" -#include "toolpanel.h" + #include "adjuster.h" #include "guiutils.h" -#include "../rtengine/rawimage.h" +#include "toolpanel.h" -class PreProcess : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class PreProcess : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -54,5 +55,3 @@ public: //void setAdjusterBehavior (bool linedenoiseadd, bool greenequiladd); //void trimValues (rtengine::procparams::ProcParams* pp); }; - -#endif diff --git a/rtgui/previewhandler.h b/rtgui/previewhandler.h index 7fe7b96f4..d9c91f6ad 100644 --- a/rtgui/previewhandler.h +++ b/rtgui/previewhandler.h @@ -16,19 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PREVIEWHANDLER_ -#define _PREVIEWHANDLER_ +#pragma once #include #include #include -#include "threadutils.h" #include "guiutils.h" +#include "threadutils.h" -#include "../rtengine/rtengine.h" #include "../rtengine/noncopyable.h" +#include "../rtengine/rtengine.h" class PreviewListener { @@ -86,5 +85,3 @@ public: Glib::RefPtr getRoughImage (int desiredW, int desiredH, double& zoom); rtengine::procparams::CropParams getCropParams (); }; - -#endif diff --git a/rtgui/previewloader.cc b/rtgui/previewloader.cc index 67de50113..a808e1f71 100644 --- a/rtgui/previewloader.cc +++ b/rtgui/previewloader.cc @@ -18,6 +18,8 @@ */ #include +#include "cachemanager.h" +#include "filebrowserentry.h" #include "previewloader.h" #include "guiutils.h" #include "threadutils.h" diff --git a/rtgui/previewloader.h b/rtgui/previewloader.h index 52dbee43c..9a74ee2eb 100644 --- a/rtgui/previewloader.h +++ b/rtgui/previewloader.h @@ -16,15 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PREVIEWLOADER_ -#define _PREVIEWLOADER_ +#pragma once #include -#include + +#include #include "../rtengine/noncopyable.h" -#include "filebrowserentry.h" +class FileBrowserEntry; class PreviewLoaderListener { @@ -94,5 +94,3 @@ private: * To use: \c previewLoader->start() , */ #define previewLoader PreviewLoader::getInstance() - -#endif diff --git a/rtgui/previewmodepanel.h b/rtgui/previewmodepanel.h index b43e8484c..98160a5e3 100644 --- a/rtgui/previewmodepanel.h +++ b/rtgui/previewmodepanel.h @@ -15,14 +15,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PREVIEWMODEPANEL_ -#define _PREVIEWMODEPANEL_ +#pragma once #include -#include "adjuster.h"//dev + +#include "adjuster.h" class ImageArea; -class PreviewModePanel : public Gtk::HBox + +class PreviewModePanel : + public Gtk::HBox { protected: @@ -83,5 +85,3 @@ public: int GetbackColor(); }; - -#endif diff --git a/rtgui/previewwindow.cc b/rtgui/previewwindow.cc index 54d785313..6268fe3d2 100644 --- a/rtgui/previewwindow.cc +++ b/rtgui/previewwindow.cc @@ -20,6 +20,8 @@ #include "guiutils.h" #include "imagearea.h" #include "cursormanager.h" +#include "options.h" +#include "rtscalable.h" #include "../rtengine/procparams.h" @@ -88,7 +90,7 @@ void PreviewWindow::updatePreviewImage () cc->fill(); if (previewHandler->getCropParams().enabled) { - rtengine::CropParams cparams = previewHandler->getCropParams(); + rtengine::procparams::CropParams cparams = previewHandler->getCropParams(); switch (options.cropGuides) { case Options::CROP_GUIDE_NONE: cparams.guide = "None"; diff --git a/rtgui/previewwindow.h b/rtgui/previewwindow.h index 64aa84afd..245f4a394 100644 --- a/rtgui/previewwindow.h +++ b/rtgui/previewwindow.h @@ -16,16 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PREVIEWWINDOW_ -#define _PREVIEWWINDOW_ +#pragma once #include -#include "previewhandler.h" -#include "cropwindow.h" -#include "guiutils.h" -#include "cursormanager.h" -class PreviewWindow : public Gtk::DrawingArea, public PreviewListener, public CropWindowListener +#include "cropwindow.h" +#include "cursormanager.h" +#include "guiutils.h" +#include "previewhandler.h" + +class PreviewWindow : + public Gtk::DrawingArea, + public PreviewListener, + public CropWindowListener { private: @@ -71,5 +74,3 @@ public: void cropZoomChanged(CropWindow* w) override; void initialImageArrived() override; }; - -#endif diff --git a/rtgui/profilechangelistener.h b/rtgui/profilechangelistener.h index fa7e1b877..58c565393 100644 --- a/rtgui/profilechangelistener.h +++ b/rtgui/profilechangelistener.h @@ -16,19 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROFILECHANGELISTENER_ -#define _PROFILECHANGELISTENER_ +#pragma once #include -#include "../rtengine/rtengine.h" namespace rtengine { +class ProcEvent; namespace procparams { +class ProcParams; class PartialProfile; } @@ -48,6 +48,3 @@ public: ) = 0; virtual void setDefaults(const rtengine::procparams::ProcParams* defparams) = 0; }; - -#endif - diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index b4b85dfd0..4c8e30e44 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -22,9 +22,12 @@ #include "multilangmgr.h" #include "options.h" #include "profilestorecombobox.h" +#include "paramsedited.h" +#include "pathutils.h" #include "rtimage.h" #include "../rtengine/procparams.h" +#include "../rtengine/procevents.h" using namespace rtengine; using namespace rtengine::procparams; @@ -275,9 +278,27 @@ void ProfilePanel::save_clicked (GdkEventButton* event) return; } - Gtk::FileChooserDialog dialog (getToplevelWindow (this), M("PROFILEPANEL_SAVEDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_SAVE); - bindCurrentFolder (dialog, options.loadSaveProfilePath); - dialog.set_current_name (lastFilename); + // If it's a partial profile, it's more intuitive to first allow the user + // to choose which parameters to save before showing the Save As dialog + // #5491 + const auto isPartial = event->state & Gdk::CONTROL_MASK; + if (isPartial) { + if (!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg(Glib::ustring(), parent); + } + + partialProfileDlg->set_title(M("PROFILEPANEL_SAVEPPASTE")); + const auto response = partialProfileDlg->run(); + partialProfileDlg->hide(); + + if (response != Gtk::RESPONSE_OK) { + return; + } + } + + Gtk::FileChooserDialog dialog(getToplevelWindow(this), M("PROFILEPANEL_SAVEDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_SAVE); + bindCurrentFolder(dialog, options.loadSaveProfilePath); + dialog.set_current_name(lastFilename); //Add the user's default (or global if multiuser=false) profile path to the Shortcut list try { @@ -294,36 +315,32 @@ void ProfilePanel::save_clicked (GdkEventButton* event) dialog.add_button(M("GENERAL_SAVE"), Gtk::RESPONSE_OK); //Add filters, so that only certain file types can be selected: - - Glib::RefPtr filter_pp = Gtk::FileFilter::create(); + auto filter_pp = Gtk::FileFilter::create(); filter_pp->set_name(M("FILECHOOSER_FILTER_PP")); filter_pp->add_pattern("*" + paramFileExtension); dialog.add_filter(filter_pp); - Glib::RefPtr filter_any = Gtk::FileFilter::create(); + auto filter_any = Gtk::FileFilter::create(); filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); filter_any->add_pattern("*"); dialog.add_filter(filter_any); -// dialog.set_do_overwrite_confirmation (true); - - bool done = false; + bool done = true; do { if (dialog.run() == Gtk::RESPONSE_OK) { std::string fname = dialog.get_filename(); - Glib::ustring ext = getExtension (fname); - if (("." + ext) != paramFileExtension) { + if (("." + getExtension(fname)) != paramFileExtension) { fname += paramFileExtension; } - if (!confirmOverwrite (dialog, fname)) { + if (!confirmOverwrite(dialog, fname)) { continue; } - lastFilename = Glib::path_get_basename (fname); + lastFilename = Glib::path_get_basename(fname); const PartialProfile* toSave; @@ -332,60 +349,36 @@ void ProfilePanel::save_clicked (GdkEventButton* event) } else if (isLastSavedSelected()) { toSave = lastsaved; } else { - const ProfileStoreEntry* entry = profiles->getSelectedEntry(); - toSave = entry ? ProfileStore::getInstance()->getProfile (profiles->getSelectedEntry()) : nullptr; + const auto entry = profiles->getSelectedEntry(); + toSave = entry ? ProfileStore::getInstance()->getProfile(entry) : nullptr; } if (toSave) { - if (event->state & Gdk::CONTROL_MASK) { - // opening the partial paste dialog window - if(!partialProfileDlg) { - partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); - } - partialProfileDlg->set_title(M("PROFILEPANEL_SAVEPPASTE")); - int i = partialProfileDlg->run(); - partialProfileDlg->hide(); - - if (i != Gtk::RESPONSE_OK) { - return; - } - - // saving the partial profile + int retCode; + if (isPartial) { + // Build partial profile PartialProfile ppTemp(true); - partialProfileDlg->applyPaste (ppTemp.pparams, ppTemp.pedited, toSave->pparams, toSave->pedited); - int retCode = ppTemp.pparams->save (fname, "", true, ppTemp.pedited); + partialProfileDlg->applyPaste(ppTemp.pparams, ppTemp.pedited, toSave->pparams, toSave->pedited); + // Save partial profile + retCode = ppTemp.pparams->save(fname, "", true, ppTemp.pedited); + // Cleanup ppTemp.deleteInstance(); - - if (retCode) { - writeFailed(dialog, fname); - } else { - done = true; - bool ccPrevState = changeconn.block(true); - ProfileStore::getInstance()->parseProfiles(); - changeconn.block (ccPrevState); - } } else { - // saving a full profile - int retCode = toSave->pparams->save (fname); - - if (retCode) { - writeFailed(dialog, fname); - } else { - done = true; - bool ccPrevState = changeconn.block(true); - ProfileStore::getInstance()->parseProfiles(); - changeconn.block (ccPrevState); - } + // Save full profile + retCode = toSave->pparams->save(fname); + } + + if (!retCode) { + const auto ccPrevState = changeconn.block(true); + ProfileStore::getInstance()->parseProfiles(); + changeconn.block(ccPrevState); + } else { + done = false; + writeFailed(dialog, fname); } - } else { - done = true; } - } else { - done = true; } } while (!done); - - return; } /* @@ -465,7 +458,6 @@ void ProfilePanel::load_clicked (GdkEventButton* event) dialog.add_button(M("GENERAL_OPEN"), Gtk::RESPONSE_OK); //Add filters, so that only certain file types can be selected: - Glib::RefPtr filter_pp = Gtk::FileFilter::create(); filter_pp->set_name(M("FILECHOOSER_FILTER_PP")); filter_pp->add_pattern("*" + paramFileExtension); diff --git a/rtgui/profilepanel.h b/rtgui/profilepanel.h index c5717d523..b3c968682 100644 --- a/rtgui/profilepanel.h +++ b/rtgui/profilepanel.h @@ -16,21 +16,44 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROFILEPANEL_ -#define _PROFILEPANEL_ +#pragma once + +#include #include -#include -#include "../rtengine/rtengine.h" + +#include "guiutils.h" +#include "partialpastedlg.h" #include "pparamschangelistener.h" #include "profilechangelistener.h" -#include "partialpastedlg.h" -#include "guiutils.h" -#include "profilestorecombobox.h" -#include "rtimage.h" + +#include "../rtengine/profilestore.h" #include "../rtengine/noncopyable.h" -class ProfilePanel : public Gtk::Grid, public PParamsChangeListener, public ProfileStoreListener, public rtengine::NonCopyable +class ProfileStoreComboBox; + +namespace rtengine +{ + +class ProcEvent; + +namespace procparams +{ + +class ProcParams; + +class PartialProfile; + +} + +} +class RTImage; + +class ProfilePanel : + public Gtk::Grid, + public PParamsChangeListener, + public ProfileStoreListener, + public rtengine::NonCopyable { private: @@ -106,5 +129,3 @@ public: void selection_changed (); void writeOptions(); }; - -#endif diff --git a/rtgui/profilestorecombobox.h b/rtgui/profilestorecombobox.h index 5d04813d6..bfd713235 100644 --- a/rtgui/profilestorecombobox.h +++ b/rtgui/profilestorecombobox.h @@ -16,21 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROFILESTORECOMBOBOX_ -#define _PROFILESTORECOMBOBOX_ +#pragma once #include #include -#include -#include "../rtengine/rtengine.h" -#include "../rtengine/profilestore.h" +#include -#include "threadutils.h" -#include "paramsedited.h" #include "guiutils.h" +#include "threadutils.h" - +class ProfileStoreEntry; /** * @brief subclass of Gtk::Label with extra fields for Combobox and Menu, to link with a ProfileStoreEntry */ @@ -92,5 +88,3 @@ public: Gtk::TreeIter addRow (const ProfileStoreEntry *profileStoreEntry); void deleteRow (const ProfileStoreEntry *profileStoreEntry); }; - -#endif diff --git a/rtgui/progressconnector.h b/rtgui/progressconnector.h index 012039ba6..eb6eb3a66 100644 --- a/rtgui/progressconnector.h +++ b/rtgui/progressconnector.h @@ -16,13 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PROGRESSCONNECTOR_ -#define _PROGRESSCONNECTOR_ +#pragma once + +#include #include -#include -#include "../rtengine/rtengine.h" + #include "guiutils.h" +#include "multilangmgr.h" +#include "../rtengine/rtengine.h" #undef THREAD_PRIORITY_NORMAL @@ -109,4 +111,3 @@ public: return retval; } }; -#endif diff --git a/rtgui/prsharpening.h b/rtgui/prsharpening.h index 9d37fa8ba..54f2f8063 100644 --- a/rtgui/prsharpening.h +++ b/rtgui/prsharpening.h @@ -16,15 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _PRSHARPENING_H_ -#define _PRSHARPENING_H_ +#pragma once #include + #include "adjuster.h" #include "thresholdadjuster.h" #include "toolpanel.h" -class PrSharpening : public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, public FoldableToolPanel +class PrSharpening : + public ToolParamBlock, + public ThresholdAdjusterListener, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -79,5 +83,3 @@ public: void setAdjusterBehavior (bool contrastadd, bool radiusadd, bool amountadd, bool dampingadd, bool iteradd, bool edgetoladd, bool haloctrladd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/rawcacorrection.h b/rtgui/rawcacorrection.h index d3874d9f9..60c705b19 100644 --- a/rtgui/rawcacorrection.h +++ b/rtgui/rawcacorrection.h @@ -16,15 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RAWCACORRECTION_H_ -#define _RAWCACORRECTION_H_ +#pragma once #include + #include "adjuster.h" #include "checkbox.h" #include "toolpanel.h" -class RAWCACorr : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel +class RAWCACorr : + public ToolParamBlock, + public AdjusterListener, + public CheckBoxListener, + public FoldableToolPanel { protected: @@ -52,5 +56,3 @@ public: void adjusterChanged (Adjuster* a, double newval) override; void checkBoxToggled (CheckBox* c, CheckValue newval) override; }; - -#endif diff --git a/rtgui/rawexposure.h b/rtgui/rawexposure.h index 1dafd4d64..75b3a9330 100644 --- a/rtgui/rawexposure.h +++ b/rtgui/rawexposure.h @@ -16,15 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RAWEXPOSURE_H_ -#define _RAWEXPOSURE_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -#include "../rtengine/rawimage.h" -class RAWExposure : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class RAWExposure : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -44,5 +46,3 @@ public: void setAdjusterBehavior (bool pexposadd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/recentbrowser.h b/rtgui/recentbrowser.h index 1ba2c17f4..68a7962f9 100644 --- a/rtgui/recentbrowser.h +++ b/rtgui/recentbrowser.h @@ -16,14 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RECENTBROWSER_ -#define _RECENTBROWSER_ +#pragma once #include -#include "multilangmgr.h" -#include "guiutils.h" -class RecentBrowser : public Gtk::VBox +#include "guiutils.h" +#include "multilangmgr.h" + +class RecentBrowser : + public Gtk::VBox { public: typedef sigc::slot DirSelectionSlot; @@ -47,7 +48,3 @@ inline void RecentBrowser::setDirSelector (const RecentBrowser::DirSelectionSlot { this->selectDir = selectDir; } - -#endif - - diff --git a/rtgui/renamedlg.cc b/rtgui/renamedlg.cc index 8f55b3653..8908d3419 100644 --- a/rtgui/renamedlg.cc +++ b/rtgui/renamedlg.cc @@ -17,8 +17,8 @@ * along with RawTherapee. If not, see . */ #include "renamedlg.h" +#include "cacheimagedata.h" #include "multilangmgr.h" -#include "options.h" #include "rtimage.h" RenameDialog::RenameDialog (Gtk::Window* parent) diff --git a/rtgui/renamedlg.h b/rtgui/renamedlg.h index a3e16ad0a..f9447fbac 100644 --- a/rtgui/renamedlg.h +++ b/rtgui/renamedlg.h @@ -16,16 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RENAMEDLG_ -#define _RENAMEDLG_ +#pragma once #include -#include "cacheimagedata.h" + #include "guiutils.h" #define RESPONSE_ALL 100 -class RenameDialog : public Gtk::Dialog +class CacheImageData; + +class RenameDialog : + public Gtk::Dialog { protected: @@ -43,6 +45,3 @@ public: Glib::ustring getNewName (); }; - -#endif - diff --git a/rtgui/resize.cc b/rtgui/resize.cc index 456b924ef..a65875426 100644 --- a/rtgui/resize.cc +++ b/rtgui/resize.cc @@ -16,6 +16,9 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ + +#include + #include "resize.h" #include "eventmapper.h" diff --git a/rtgui/resize.h b/rtgui/resize.h index 1d38ae674..41b54509e 100644 --- a/rtgui/resize.h +++ b/rtgui/resize.h @@ -16,14 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RESIZE_H_ -#define _RESIZE_H_ +#pragma once #include + #include "adjuster.h" #include "guiutils.h" -#include "toolpanel.h" #include "guiutils.h" +#include "toolpanel.h" class Resize final : public ToolParamBlock, @@ -86,5 +86,3 @@ private: static constexpr int MAX_SCALE = 16; // 16 to match the main preview max scale of 1600% }; - -#endif diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index e074d7e9c..33f1c2f6a 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -4,6 +4,8 @@ #include "retinex.h" #include "mycurve.h" #include "rtimage.h" +#include "options.h" +#include "../rtengine/color.h" using namespace rtengine; using namespace rtengine::procparams; diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 1be511cb3..c82c01d3e 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -1,21 +1,25 @@ /* * This file is part of RawTherapee. */ -#ifndef _RETINEX_H_ -#define _RETINEX_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" -#include "guiutils.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" +#include "guiutils.h" #include "thresholdadjuster.h" -#include "colorprovider.h" - -class Retinex : public ToolParamBlock, public FoldableToolPanel, public rtengine::RetinexListener, public CurveListener, - public AdjusterListener, public ColorProvider +#include "toolpanel.h" +class Retinex : + public ToolParamBlock, + public FoldableToolPanel, + public rtengine::RetinexListener, + public CurveListener, + public AdjusterListener, + public ColorProvider { private: IdleRegister idle_register; @@ -141,5 +145,3 @@ private: void foldAllButMe (GdkEventButton* event, MyExpander *expander); }; - -#endif diff --git a/rtgui/rgbcurves.cc b/rtgui/rgbcurves.cc index 2350783e0..7af6cab97 100644 --- a/rtgui/rgbcurves.cc +++ b/rtgui/rgbcurves.cc @@ -18,6 +18,8 @@ */ #include "rgbcurves.h" +#include "options.h" + #include "../rtengine/procparams.h" using namespace rtengine; diff --git a/rtgui/rgbcurves.h b/rtgui/rgbcurves.h index e62fdd7c7..b73aa22b7 100644 --- a/rtgui/rgbcurves.h +++ b/rtgui/rgbcurves.h @@ -16,17 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RGBCURVES_H_ -#define _RGBCURVES_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" +#include "colorprovider.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "colorprovider.h" +#include "toolpanel.h" -class RGBCurves : public ToolParamBlock, public FoldableToolPanel, public CurveListener, public ColorProvider +class RGBCurves : + public ToolParamBlock, + public FoldableToolPanel, + public CurveListener, + public ColorProvider { protected: @@ -66,5 +70,3 @@ public: void lumamodeChanged (); void enabledChanged() override; }; - -#endif diff --git a/rtgui/rotate.h b/rtgui/rotate.h index bd0613609..5730fd481 100644 --- a/rtgui/rotate.h +++ b/rtgui/rotate.h @@ -16,15 +16,18 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _ROTATE_H_ -#define _ROTATE_H_ +#pragma once #include -#include "adjuster.h" -#include "toolpanel.h" -#include "lensgeomlistener.h" -class Rotate : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +#include "adjuster.h" +#include "lensgeomlistener.h" +#include "toolpanel.h" + +class Rotate : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -52,5 +55,3 @@ public: rlistener = l; } }; - -#endif diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index e35a6d164..44078ed3b 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -20,9 +20,10 @@ #include "rtimage.h" +#include #include -#include "options.h" +#include "../rtengine/settings.h" namespace { @@ -214,7 +215,7 @@ Cairo::RefPtr RTImage::createImgSurfFromFile (const Glib::u } */ } catch (const Glib::Exception& exception) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { std::cerr << "Failed to load image \"" << fileName << "\": " << exception.what() << std::endl; } } diff --git a/rtgui/rtscalable.cc b/rtgui/rtscalable.cc index b37f2276f..a48a95fd2 100644 --- a/rtgui/rtscalable.cc +++ b/rtgui/rtscalable.cc @@ -20,16 +20,17 @@ #include "rtscalable.h" #include #include -#include +#include #include #include + +#include "../rtengine/rt_math.h" #include "options.h" double RTScalable::dpi = 0.; int RTScalable::scale = 0; extern Glib::ustring argv0; -extern Options options; extern unsigned char initialGdkScale; extern float fontScale; Gtk::TextDirection RTScalable::direction = Gtk::TextDirection::TEXT_DIR_NONE; @@ -101,7 +102,7 @@ void RTScalable::deleteDir(const Glib::ustring& path) error |= g_remove (Glib::build_filename (path, *entry).c_str()); } - if (error != 0 && options.rtSettings.verbose) { + if (error != 0 && rtengine::settings->verbose) { std::cerr << "Failed to delete all entries in '" << path << "': " << g_strerror(errno) << std::endl; } diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index fc9be32f7..c3d735e8f 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -19,12 +19,19 @@ #include #include "rtwindow.h" -#include "options.h" +#include "cachemanager.h" #include "preferences.h" #include "iccprofilecreator.h" #include "cursormanager.h" +#include "editwindow.h" #include "rtimage.h" +#include "thumbnail.h" #include "whitebalance.h" +#include "../rtengine/settings.h" +#include "batchqueuepanel.h" +#include "editorpanel.h" +#include "filepanel.h" +#include "filmsimulation.h" float fontScale = 1.f; Glib::RefPtr cssForced; @@ -170,7 +177,7 @@ RTWindow::RTWindow () if (options.pseudoHiDPISupport) { fontScale = options.fontSize / (float)RTScalable::baseFontSize; } - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale); } } else { @@ -200,14 +207,14 @@ RTWindow::RTWindow () } if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) { css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale); - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, fontScale); } } } } if (!css.empty()) { - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("CSS:\n%s\n\n", css.c_str()); } try { @@ -456,10 +463,9 @@ RTWindow::~RTWindow() g_object_unref (osxApp); #endif - if (fpanel) { - delete fpanel; - } - + delete fpanel; + delete iFullscreen; + delete iFullscreen_exit; RTImage::cleanup(); } @@ -652,8 +658,8 @@ void RTWindow::remEditorPanel (EditorPanel* ep) set_title_decorated (""); } else { - EditorPanel* ep = static_cast (mainNB->get_nth_page (mainNB->get_current_page())); - set_title_decorated (ep->getFileName()); + const EditorPanel* lep = static_cast (mainNB->get_nth_page (mainNB->get_current_page())); + set_title_decorated (lep->getFileName()); } // TODO: ask what to do: close & apply, close & apply selection, close & revert, cancel @@ -1162,3 +1168,8 @@ void RTWindow::createSetmEditor() mainNB->append_page (*epanel, *editorLabelGrid); } + +bool RTWindow::isSingleTabMode() const +{ + return !options.tabbedUI && ! (options.multiDisplayMode > 0); +} diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 93e1c31b9..39e1581e3 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -15,23 +15,29 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _RTWINDOW_ -#define _RTWINDOW_ +#pragma once + +#include #include -#include "filepanel.h" -#include "editorpanel.h" -#include "batchqueuepanel.h" -#include -#include "progressconnector.h" -#include "editwindow.h" -#include "splash.h" + #if defined(__APPLE__) #include #endif + +#include "progressconnector.h" +#include "splash.h" + #include "../rtengine/noncopyable.h" -class RTWindow : public Gtk::Window, public rtengine::ProgressListener, public rtengine::NonCopyable +class BatchQueueEntry; +class BatchQueuePanel; +class EditorPanel; +class FilePanel; +class RTWindow : + public Gtk::Window, + public rtengine::ProgressListener, + public rtengine::NonCopyable { private: @@ -49,10 +55,7 @@ private: Gtk::Image *iFullscreen, *iFullscreen_exit; - bool isSingleTabMode() - { - return !options.tabbedUI && ! (options.multiDisplayMode > 0); - }; + bool isSingleTabMode() const; bool on_expose_event_epanel (GdkEventExpose* event); bool on_expose_event_fpanel (GdkEventExpose* event); @@ -125,5 +128,3 @@ public: void writeToolExpandedStatus (std::vector &tpOpen); }; - -#endif diff --git a/rtgui/saveasdlg.cc b/rtgui/saveasdlg.cc index 1b61d7d3d..ebf2f5b4a 100644 --- a/rtgui/saveasdlg.cc +++ b/rtgui/saveasdlg.cc @@ -22,12 +22,11 @@ #include "guiutils.h" #include "multilangmgr.h" +#include "pathutils.h" #include "rtimage.h" #include "../rtengine/utils.h" -extern Options options; - namespace { diff --git a/rtgui/saveasdlg.h b/rtgui/saveasdlg.h index dd120337d..e4567f69b 100644 --- a/rtgui/saveasdlg.h +++ b/rtgui/saveasdlg.h @@ -16,15 +16,16 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _SAVEASDLG_ -#define _SAVEASDLG_ +#pragma once #include + #include "adjuster.h" #include "saveformatpanel.h" -#include "options.h" -class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener +class SaveAsDialog : + public Gtk::Dialog, + public FormatChangeListener { protected: @@ -65,6 +66,3 @@ public: void formatChanged(const Glib::ustring& format) override; bool keyPressed (GdkEventKey* event); }; - - -#endif diff --git a/rtgui/saveformatpanel.h b/rtgui/saveformatpanel.h index ab5ffef3e..af9baa58a 100644 --- a/rtgui/saveformatpanel.h +++ b/rtgui/saveformatpanel.h @@ -16,13 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __SAVEFORMATPANEL_H__ -#define __SAVEFORMATPANEL_H__ +#pragma once #include + #include "adjuster.h" #include "guiutils.h" #include "options.h" + #include "../rtengine/noncopyable.h" class FormatChangeListener @@ -62,5 +63,3 @@ public: void formatChanged (); void adjusterChanged (Adjuster* a, double newval) override; }; - -#endif diff --git a/rtgui/sensorbayer.h b/rtgui/sensorbayer.h index 2d68411ce..3d6018181 100644 --- a/rtgui/sensorbayer.h +++ b/rtgui/sensorbayer.h @@ -16,13 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _SENSORBAYER_H_ -#define _SENSORBAYER_H_ +#pragma once #include + #include "toolpanel.h" -class SensorBayer : public ToolParamBlock, public FoldableToolPanel +class SensorBayer : + public ToolParamBlock, + public FoldableToolPanel { protected: @@ -37,5 +39,3 @@ public: return packBox; } }; - -#endif diff --git a/rtgui/sensorxtrans.h b/rtgui/sensorxtrans.h index fbf71b401..c1cacb2f4 100644 --- a/rtgui/sensorxtrans.h +++ b/rtgui/sensorxtrans.h @@ -16,13 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _SENSORXTRANS_H_ -#define _SENSORXTRANS_H_ +#pragma once #include + #include "toolpanel.h" -class SensorXTrans : public ToolParamBlock, public FoldableToolPanel +class SensorXTrans : + public ToolParamBlock, + public FoldableToolPanel { protected: @@ -37,5 +39,3 @@ public: return packBox; } }; - -#endif diff --git a/rtgui/shadowshighlights.h b/rtgui/shadowshighlights.h index d675f40d6..4f3ee7577 100644 --- a/rtgui/shadowshighlights.h +++ b/rtgui/shadowshighlights.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _SHADOWSHIGHLIGHTS_H_ -#define _SHADOWSHIGHLIGHTS_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class ShadowsHighlights : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class ShadowsHighlights : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -53,5 +56,3 @@ public: void colorspaceChanged(); }; - -#endif diff --git a/rtgui/sharpenedge.h b/rtgui/sharpenedge.h index b136d8e5e..46a528153 100644 --- a/rtgui/sharpenedge.h +++ b/rtgui/sharpenedge.h @@ -21,14 +21,17 @@ * * */ -#ifndef _SHARPENEDGE_H_ -#define _SHARPENEDGE_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class SharpenEdge : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class SharpenEdge : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -56,5 +59,3 @@ public: void chanthree_toggled (); }; - -#endif diff --git a/rtgui/sharpening.h b/rtgui/sharpening.h index ac846a2b6..e922e82c7 100644 --- a/rtgui/sharpening.h +++ b/rtgui/sharpening.h @@ -16,15 +16,19 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _SHARPENING_H_ -#define _SHARPENING_H_ +#pragma once #include + #include "adjuster.h" #include "thresholdadjuster.h" #include "toolpanel.h" -class Sharpening : public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, public FoldableToolPanel +class Sharpening : + public ToolParamBlock, + public ThresholdAdjusterListener, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -82,5 +86,3 @@ public: void setAdjusterBehavior (bool contrastadd, bool radiusadd, bool amountadd, bool dampingadd, bool iteradd, bool edgetoladd, bool haloctrladd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/sharpenmicro.h b/rtgui/sharpenmicro.h index 7c292413b..3120e6e7b 100644 --- a/rtgui/sharpenmicro.h +++ b/rtgui/sharpenmicro.h @@ -21,14 +21,17 @@ * * */ -#ifndef _SHARPENMICRO_H_ -#define _SHARPENMICRO_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class SharpenMicro : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class SharpenMicro : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -60,5 +63,3 @@ public: }; - -#endif diff --git a/rtgui/shcselector.cc b/rtgui/shcselector.cc index 6137c3ec8..e8aca4071 100644 --- a/rtgui/shcselector.cc +++ b/rtgui/shcselector.cc @@ -17,9 +17,12 @@ * along with RawTherapee. If not, see . */ +#include + #include "shcselector.h" #include "multilangmgr.h" #include "mycurve.h" +#include "rtscalable.h" SHCSelector::SHCSelector() : movingPosition(-1), tmpX(0.0), tmpPos(0.0), wslider(0.0), cl(nullptr), coloredBar(RTO_Left2Right) { diff --git a/rtgui/shcselector.h b/rtgui/shcselector.h index d3ef2adb8..5c4421e0a 100644 --- a/rtgui/shcselector.h +++ b/rtgui/shcselector.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _SHCSELECTOR_ -#define _SHCSELECTOR_ +#pragma once #include + #include "coloredbar.h" class SHCListener @@ -82,6 +82,3 @@ public: bool reset (); void refresh(); }; - -#endif - diff --git a/rtgui/soundman.h b/rtgui/soundman.h index 6d065c87a..5eb6883e0 100644 --- a/rtgui/soundman.h +++ b/rtgui/soundman.h @@ -17,13 +17,13 @@ * along with RawTherapee. If not, see . * */ - -#ifndef _SOUNDMAN_ -#define _SOUNDMAN_ +#pragma once namespace Glib { + class ustring; + } class SoundManager @@ -32,5 +32,3 @@ public: static void init(); static void playSoundAsync(const Glib::ustring &sound); }; - -#endif diff --git a/rtgui/splash.h b/rtgui/splash.h index 29dbb62cf..363c51489 100644 --- a/rtgui/splash.h +++ b/rtgui/splash.h @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __SPLASH__ -#define __SPLASH__ +#pragma once #include -class SplashImage : public Gtk::DrawingArea +class SplashImage : + public Gtk::DrawingArea { private: @@ -59,5 +59,3 @@ public: //virtual bool on_button_release_event (GdkEventButton* event); void closePressed(); }; - -#endif diff --git a/rtgui/threadutils.h b/rtgui/threadutils.h index f8107d74c..eae4a9ad2 100644 --- a/rtgui/threadutils.h +++ b/rtgui/threadutils.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THREADUTILS_ -#define _THREADUTILS_ +#pragma once // Uncomment this if you want to bypass the CMakeList options and force the values, but do not commit! //#undef TRACE_MYRWMUTEX @@ -307,5 +306,3 @@ inline MyWriterLock::~MyWriterLock () #define MYREADERLOCK_RELEASE(ln) ln.release(); #define MYWRITERLOCK_RELEASE(ln) ln.release(); #endif - -#endif /* _THREADUTILS_ */ diff --git a/rtgui/thresholdadjuster.h b/rtgui/thresholdadjuster.h index ea3822875..b28f68dee 100644 --- a/rtgui/thresholdadjuster.h +++ b/rtgui/thresholdadjuster.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THRESHOLDADJUSTER_H_ -#define _THRESHOLDADJUSTER_H_ +#pragma once #include + #include "editedstate.h" #include "guiutils.h" #include "thresholdselector.h" @@ -160,5 +160,3 @@ public: // this set_tooltip_text method is to set_tooltip_markup, and text can contain markups void set_tooltip_text(const Glib::ustring& text); }; - -#endif diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index b44425be4..35d08279c 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -24,6 +24,7 @@ #include "multilangmgr.h" #include "mycurve.h" +#include "rtscalable.h" #include "../rtengine/procparams.h" diff --git a/rtgui/thresholdselector.h b/rtgui/thresholdselector.h index 6b9dda3d0..f948b56ad 100644 --- a/rtgui/thresholdselector.h +++ b/rtgui/thresholdselector.h @@ -16,14 +16,15 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THRESHOLDSELECTOR_ -#define _THRESHOLDSELECTOR_ +#pragma once -#include "guiutils.h" -#include "../rtengine/procparams.h" -#include "coloredbar.h" #include +#include "coloredbar.h" +#include "guiutils.h" + +#include "../rtengine/procparams.h" + class ThresholdSelector; /* @@ -245,6 +246,3 @@ inline void ThresholdSelector::getPositions (Glib::ustring& botto bottomRight = Glib::ustring::format(std::fixed, std::setprecision(precisionBottom), shapePositionValue(TS_BOTTOMRIGHT)); topRight = Glib::ustring::format(std::fixed, std::setprecision(precisionTop), shapePositionValue(TS_TOPRIGHT)); } - -#endif - diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index adf451f05..9832b5730 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -16,13 +16,13 @@ */ #include -#include +#include #include "multilangmgr.h" #include "options.h" +#include "rtscalable.h" #include "thumbbrowserbase.h" -#include "../rtengine/mytime.h" #include "../rtengine/rt_math.h" using namespace std; diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index 890c37c87..a5c51cf5f 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -16,23 +16,26 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THUMBNAILBROWSERBASE_ -#define _THUMBNAILBROWSERBASE_ +#pragma once + +#include #include -#include "thumbbrowserentrybase.h" -#include -#include "options.h" + #include "guiutils.h" #include "inspector.h" +#include "options.h" +#include "thumbbrowserentrybase.h" /* * Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space */ -class ThumbBrowserBase : public Gtk::Grid +class ThumbBrowserBase : + public Gtk::Grid { - class Internal : public Gtk::DrawingArea + class Internal : + public Gtk::DrawingArea { //Cairo::RefPtr cc; int ofsX, ofsY; @@ -253,5 +256,3 @@ public: } }; - -#endif diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 9d74fbd79..12059c72e 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -21,8 +21,6 @@ #include "options.h" #include "thumbbrowserbase.h" -#include "../rtengine/mytime.h" - namespace { diff --git a/rtgui/thumbbrowserentrybase.h b/rtgui/thumbbrowserentrybase.h index 5f018eefd..dbc6cf73e 100644 --- a/rtgui/thumbbrowserentrybase.h +++ b/rtgui/thumbbrowserentrybase.h @@ -26,8 +26,10 @@ #include "guiutils.h" #include "lwbuttonset.h" #include "threadutils.h" -#include "thumbnail.h" +#include "../rtengine/coord2d.h" + +class Thumbnail; class ThumbBrowserBase; class ThumbBrowserEntryBase { diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index 182eba704..bf230fe63 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -26,6 +26,7 @@ #include "guiutils.h" #include "threadutils.h" +#include "thumbnail.h" #include "../rtengine/procparams.h" diff --git a/rtgui/thumbimageupdater.h b/rtgui/thumbimageupdater.h index 0e46b11d7..cdf65bd62 100644 --- a/rtgui/thumbimageupdater.h +++ b/rtgui/thumbimageupdater.h @@ -16,17 +16,26 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THUMBIMAGEUPDATER_ -#define _THUMBIMAGEUPDATER_ +#pragma once -#include #include -#include "../rtengine/rtengine.h" -#include "../rtengine/noncopyable.h" - #include "thumbbrowserentrybase.h" +#include "../rtengine/noncopyable.h" + +namespace rtengine +{ + class IImage8; + +namespace procparams +{ + + struct CropParams; + +} + +} class ThumbImageUpdateListener { public: @@ -101,5 +110,3 @@ private: * To use: \c thumbImageUpdater->start() , */ #define thumbImageUpdater ThumbImageUpdater::getInstance() - -#endif diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 7ec1fef4e..cd7470263 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -15,24 +15,32 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#ifdef WIN32 +#include +#endif + +#include "cachemanager.h" #include "multilangmgr.h" #include "thumbnail.h" #include #include -#include "options.h" -#include "../rtengine/mytime.h" #include #include -#include +#include "../rtengine/colortemp.h" #include "../rtengine/imagedata.h" #include "../rtengine/procparams.h" +#include "../rtengine/rtthumbnail.h" #include #include "../rtengine/dynamicprofile.h" +#include "../rtengine/profilestore.h" +#include "../rtengine/settings.h" +#include "../rtexif/rtexif.h" #include "guiutils.h" #include "batchqueue.h" #include "extprog.h" -#include "profilestorecombobox.h" +#include "pathutils.h" +#include "paramsedited.h" #include "procparamchangers.h" using namespace rtengine::procparams; @@ -299,7 +307,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu // For the filename etc. do NOT use streams, since they are not UTF8 safe Glib::ustring cmdLine = options.CPBPath + Glib::ustring(" \"") + tmpFileName + Glib::ustring("\""); - if (options.rtSettings.verbose) { + if (rtengine::settings->verbose) { printf("Custom profile builder's command line: %s\n", Glib::ustring(cmdLine).c_str()); } @@ -1150,3 +1158,48 @@ bool Thumbnail::imageLoad(bool loading) return false; } + +void Thumbnail::getCamWB(double& temp, double& green) const +{ + if (tpp) { + tpp->getCamWB (temp, green); + } else { + temp = green = -1.0; + } +} + +void Thumbnail::getSpotWB(int x, int y, int rect, double& temp, double& green) +{ + if (tpp) { + tpp->getSpotWB (getProcParams(), x, y, rect, temp, green); + } else { + temp = green = -1.0; + } +} + +void Thumbnail::applyAutoExp (rtengine::procparams::ProcParams& pparams) +{ + if (tpp) { + tpp->applyAutoExp (pparams); + } +} + +const CacheImageData* Thumbnail::getCacheImageData() +{ + return &cfs; +} + +std::string Thumbnail::getMD5() const +{ + return cfs.md5; +} + +bool Thumbnail::isQuick() const +{ + return cfs.thumbImgType == CacheImageData::QUICK_THUMBNAIL; +} + +bool Thumbnail::isPParamsValid() const +{ + return pparamsValid; +} diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index ec5dbd249..aee5ee0a6 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -16,22 +16,31 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THUMBNAIL_ -#define _THUMBNAIL_ +#pragma once #include #include -#include -#include "cachemanager.h" -#include "options.h" -#include "../rtengine/rtengine.h" -#include "../rtengine/rtthumbnail.h" -#include "cacheimagedata.h" -#include "thumbnaillistener.h" -#include "threadutils.h" +#include +#include "cacheimagedata.h" +#include "threadutils.h" +#include "thumbnaillistener.h" + +namespace rtengine +{ +class Thumbnail; + +namespace procparams +{ + +class ProcParams; + +} + +} class CacheManager; + struct ParamsEdited; class Thumbnail @@ -97,14 +106,8 @@ public: void notifylisterners_procParamsChanged(int whoChangedIt); - bool isQuick() const - { - return cfs.thumbImgType == CacheImageData::QUICK_THUMBNAIL; - } - bool isPParamsValid() const - { - return pparamsValid; - } + bool isQuick() const; + bool isPParamsValid() const; bool isRecentlySaved () const; void imageDeveloped (); void imageEnqueued (); @@ -122,29 +125,10 @@ public: const Glib::ustring& getExifString () const; const Glib::ustring& getDateTimeString () const; - void getCamWB (double& temp, double& green) const - { - if (tpp) { - tpp->getCamWB (temp, green); - } else { - temp = green = -1.0; - } - } + void getCamWB (double& temp, double& green) const; void getAutoWB (double& temp, double& green, double equal, double tempBias); - void getSpotWB (int x, int y, int rect, double& temp, double& green) - { - if (tpp) { - tpp->getSpotWB (getProcParams(), x, y, rect, temp, green); - } else { - temp = green = -1.0; - } - } - void applyAutoExp (rtengine::procparams::ProcParams& pparams) - { - if (tpp) { - tpp->applyAutoExp (pparams); - } - } + void getSpotWB (int x, int y, int rect, double& temp, double& green); + void applyAutoExp (rtengine::procparams::ProcParams& pparams); ThFileType getType (); Glib::ustring getFileName () const @@ -155,14 +139,8 @@ public: bool isSupported (); - const CacheImageData* getCacheImageData() - { - return &cfs; - } - std::string getMD5 () const - { - return cfs.md5; - } + const CacheImageData* getCacheImageData(); + std::string getMD5 () const; int getRank () const; void setRank (int rank); @@ -185,7 +163,3 @@ public: bool openDefaultViewer(int destination); bool imageLoad(bool loading); }; - - -#endif - diff --git a/rtgui/thumbnailbrowser.h b/rtgui/thumbnailbrowser.h deleted file mode 100644 index 9d40d1f7d..000000000 --- a/rtgui/thumbnailbrowser.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * 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 . - */ -#ifndef _THUMBNAILBROWSER_ -#define _THUMBNAILBROWSER_ - -#include -#include "thumbnail.h" -#include "filecatalog.h" - -class ThumbBrowserEntry -{ - -public: -// set by arrangeFiles(): - int width; // minimal width - int height; // minimal height - int exp_width; // ararnged width - int startx; // x coord. in the widget - int starty; // y coord. in the widget -// thumbnail preview properties: - int prew; // width of the thumbnail - int preh; // height of the thumbnail - guint8* preview; -// file and directory attributes: - Glib::ustring filename; - Glib::ustring shortname; - Glib::ustring dirname; -// the associated thumbnail instance: - Thumbnail* thumbnail; - - ThumbBrowserEntry (Thumbnail* thm, Glib::ustring fname, Glib::ustring sname, Glib::ustring dname, int h) - : thumbnail(thm), filename(fname), shortname(sname), dirname(dname), preh(h) - { - preview = thumbnail ? (guint8*) thumbnail->getThumbnailImage (prew, preh) : NULL; - } - - bool operator< (FileDescr& other) - { - return shortname > other.shortname; - } -}; - -class ThumbBrowser : public Gtk::DrawingArea -{ - -protected: - int dx, dy, w, h; - - Gdk::RGBA black; - Gdk::RGBA white; - Gdk::RGBA blue; - Gdk::RGBA bluew; - - std::vector fd; - std::vector selected; - - int rowHeight; - int numOfRows; - - ThumbBrowserListener* tbl; - - void arrangeFiles (int rows); - -public: - - ThumbBrowser (); - - void addEntry (ThumbBrowserEntry* entry); - void setThumbBrowserListener (ThumbBrowserListener* l) - { - tbl = l; - } - - virtual void on_realize(); - virtual bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); - virtual bool on_button_press_event (GdkEventButton* event); - virtual bool on_button_release_event (GdkEventButton* event); - virtual void previewReady (FileDescr* fdn); - - void resized (Gtk::Allocation& req); - void redraw (); - void styleChanged (const Glib::RefPtr& style); -}; - -#endif diff --git a/rtgui/thumbnaillistener.h b/rtgui/thumbnaillistener.h index 97503c420..18ac99dce 100644 --- a/rtgui/thumbnaillistener.h +++ b/rtgui/thumbnaillistener.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _THUMBNAILLISTENER_ -#define _THUMBNAILLISTENER_ +#pragma once class Thumbnail; @@ -27,6 +26,3 @@ public: virtual ~ThumbnailListener() = default; virtual void procParamsChanged(Thumbnail* thm, int whoChangedIt) = 0; }; - -#endif - diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index fa1c80ed8..68f3ee4de 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -25,8 +25,10 @@ #include "adjuster.h" #include "eventmapper.h" #include "ppversion.h" +#include "options.h" #include "../rtengine/procparams.h" +#include "../rtengine/utils.h" #include "editcallbacks.h" using namespace rtengine; diff --git a/rtgui/tonecurve.h b/rtgui/tonecurve.h index fb08c02c2..cba810e15 100644 --- a/rtgui/tonecurve.h +++ b/rtgui/tonecurve.h @@ -16,20 +16,24 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _TONECURVE_H_ -#define _TONECURVE_H_ +#pragma once #include + #include "adjuster.h" -#include "toolpanel.h" #include "curveeditor.h" #include "curveeditorgroup.h" -#include "mycurve.h" #include "guiutils.h" +#include "toolpanel.h" class EditDataProvider; -class ToneCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoExpListener, public CurveListener +class ToneCurve : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel, + public rtengine::AutoExpListener, + public CurveListener { private: IdleRegister idle_register; @@ -141,5 +145,3 @@ public: void methodChanged (); void clampOOGChanged(); }; - -#endif diff --git a/rtgui/toolbar.cc b/rtgui/toolbar.cc index b8e0d64dc..38ade6566 100644 --- a/rtgui/toolbar.cc +++ b/rtgui/toolbar.cc @@ -20,6 +20,7 @@ #include "toolbar.h" #include "multilangmgr.h" #include "guiutils.h" +#include "rtimage.h" ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(nullptr) { diff --git a/rtgui/toolbar.h b/rtgui/toolbar.h index 52f4dcbd4..9f0a2818b 100644 --- a/rtgui/toolbar.h +++ b/rtgui/toolbar.h @@ -16,13 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __TOOLBAR_H__ -#define __TOOLBAR_H__ +#pragma once #include -#include "toolenum.h" -#include "rtimage.h" + #include "lockablecolorpicker.h" +#include "toolenum.h" + +class RTImage; class ToolBarListener { @@ -99,5 +100,3 @@ public: bool handleShortcutKey (GdkEventKey* event); void setBatchMode(); }; - -#endif diff --git a/rtgui/toolenum.h b/rtgui/toolenum.h index e90a0f685..c3bc873f1 100644 --- a/rtgui/toolenum.h +++ b/rtgui/toolenum.h @@ -16,9 +16,6 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _TOOLENUM_ -#define _TOOLENUM_ +#pragma once enum ToolMode {TMNone = -1, TMHand = 0, TMSpotWB = 1, TMCropSelect = 2, TMStraighten = 3, TMColorPicker = 4}; - -#endif diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index 27f68767e..b1282f523 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -19,6 +19,7 @@ #include "toolpanel.h" #include "toolpanelcoord.h" #include "guiutils.h" +#include "rtimage.h" #include "../rtengine/procparams.h" diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index 8d4a55eab..627200835 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -16,20 +16,33 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __TOOLPANEL__ -#define __TOOLPANEL__ +#pragma once #include -#include -#include "../rtengine/rtengine.h" + +#include + #include "editbuffer.h" #include "guiutils.h" #include "multilangmgr.h" #include "paramsedited.h" -#include "../rtengine/noncopyable.h" -class ToolPanel; +#include "../rtengine/noncopyable.h" +#include "../rtengine/rtengine.h" + +namespace rtengine +{ + class ProcEvent; + +namespace procparams +{ + +class ProcParams; +} +} + class FoldableToolPanel; +class ToolPanel; class ToolPanelListener { @@ -39,20 +52,23 @@ public: }; /// @brief This class control the space around the group of tools inside a tab, as well as the space separating each tool. */ -class ToolVBox : public Gtk::VBox +class ToolVBox : + public Gtk::VBox { public: ToolVBox(); }; /// @brief This class control the space around a tool's block of parameter. */ -class ToolParamBlock : public Gtk::VBox +class ToolParamBlock : + public Gtk::VBox { public: ToolParamBlock(); }; -class ToolPanel : public rtengine::NonCopyable +class ToolPanel : + public rtengine::NonCopyable { protected: @@ -136,7 +152,8 @@ public: } }; -class FoldableToolPanel : public ToolPanel +class FoldableToolPanel : + public ToolPanel { protected: @@ -218,5 +235,3 @@ public: return exp->signal_enabled_toggled(); } }; - -#endif diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 4fec4a18a..e774e3d39 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -18,7 +18,9 @@ */ #include "multilangmgr.h" #include "toolpanelcoord.h" +#include "metadatapanel.h" #include "options.h" +#include "rtimage.h" #include "../rtengine/imagesource.h" #include "../rtengine/dfmanager.h" #include "../rtengine/ffmanager.h" @@ -178,7 +180,6 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit transformPanelSW = Gtk::manage (new MyScrolledWindow ()); rawPanelSW = Gtk::manage (new MyScrolledWindow ()); advancedPanelSW = Gtk::manage (new MyScrolledWindow ()); - updateVScrollbars (options.hideTPVScrollbar); // load panel endings for (int i = 0; i < 7; i++) { @@ -195,6 +196,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit favoritePanel->pack_start(*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0); favoritePanel->pack_start(*vbPanelEnd[0], Gtk::PACK_SHRINK, 4); } + updateVScrollbars(options.hideTPVScrollbar); exposurePanelSW->add (*exposurePanel); exposurePanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0); diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 3a4ddc05f..4313f6d12 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -16,77 +16,79 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __TOOLPANELCCORD__ -#define __TOOLPANELCCORD__ +#pragma once -#include "../rtengine/rtengine.h" -#include "toolpanel.h" #include -#include "pparamschangelistener.h" -#include "profilechangelistener.h" -#include "imageareatoollistener.h" + #include -#include "whitebalance.h" -#include "coarsepanel.h" -#include "tonecurve.h" -#include "vibrance.h" -#include "colorappearance.h" -#include "shadowshighlights.h" -#include "impulsedenoise.h" -#include "defringe.h" -#include "dirpyrdenoise.h" -#include "epd.h" -#include "sharpening.h" -#include "labcurve.h" -#include "metadatapanel.h" -#include "crop.h" -#include "icmpanel.h" -#include "resize.h" -#include "chmixer.h" -#include "blackwhite.h" -#include "cacorrection.h" -#include "lensprofile.h" -#include "distortion.h" -#include "perspective.h" -#include "rotate.h" -#include "vignetting.h" -#include "retinex.h" -#include "gradient.h" -#include "pcvignette.h" -#include "toolbar.h" -#include "lensgeom.h" -#include "lensgeomlistener.h" -#include "wavelet.h" -#include "dirpyrequalizer.h" -#include "hsvequalizer.h" -#include "preprocess.h" + #include "bayerpreprocess.h" #include "bayerprocess.h" -#include "xtransprocess.h" +#include "bayerrawexposure.h" +#include "blackwhite.h" +#include "cacorrection.h" +#include "chmixer.h" +#include "coarsepanel.h" +#include "colorappearance.h" +#include "colortoning.h" +#include "crop.h" #include "darkframe.h" +#include "defringe.h" +#include "dehaze.h" +#include "dirpyrdenoise.h" +#include "dirpyrequalizer.h" +#include "distortion.h" +#include "epd.h" +#include "fattaltonemap.h" +#include "filmnegative.h" +#include "filmsimulation.h" #include "flatfield.h" -#include "sensorbayer.h" -#include "sensorxtrans.h" +#include "gradient.h" +#include "guiutils.h" +#include "hsvequalizer.h" +#include "icmpanel.h" +#include "imageareatoollistener.h" +#include "impulsedenoise.h" +#include "labcurve.h" +#include "lensgeom.h" +#include "lensgeomlistener.h" +#include "lensprofile.h" +#include "localcontrast.h" +#include "pcvignette.h" +#include "pdsharpening.h" +#include "perspective.h" +#include "pparamschangelistener.h" +#include "preprocess.h" +#include "profilechangelistener.h" +#include "prsharpening.h" #include "rawcacorrection.h" #include "rawexposure.h" -#include "bayerrawexposure.h" -#include "xtransrawexposure.h" -#include "sharpenmicro.h" -#include "sharpenedge.h" +#include "resize.h" +#include "retinex.h" #include "rgbcurves.h" -#include "colortoning.h" -#include "filmsimulation.h" -#include "prsharpening.h" -#include "pdsharpening.h" -#include "fattaltonemap.h" -#include "localcontrast.h" +#include "rotate.h" +#include "sensorbayer.h" +#include "sensorxtrans.h" +#include "shadowshighlights.h" +#include "sharpenedge.h" +#include "sharpening.h" +#include "sharpenmicro.h" #include "softlight.h" -#include "dehaze.h" -#include "guiutils.h" -#include "filmnegative.h" +#include "tonecurve.h" +#include "toolbar.h" +#include "toolpanel.h" +#include "vibrance.h" +#include "vignetting.h" +#include "wavelet.h" +#include "whitebalance.h" +#include "xtransprocess.h" +#include "xtransrawexposure.h" + #include "../rtengine/noncopyable.h" +#include "../rtengine/rtengine.h" class ImageEditorCoordinator; +class MetaDataPanel; class ToolPanelCoordinator : public ToolPanelListener, @@ -331,5 +333,3 @@ public: private: IdleRegister idle_register; }; - -#endif diff --git a/rtgui/vibrance.cc b/rtgui/vibrance.cc index 461c4a79f..67052785a 100644 --- a/rtgui/vibrance.cc +++ b/rtgui/vibrance.cc @@ -18,6 +18,7 @@ */ #include "vibrance.h" +#include "options.h" #include "../rtengine/color.h" using namespace rtengine; diff --git a/rtgui/vibrance.h b/rtgui/vibrance.h index 606bfa80a..211f631f9 100644 --- a/rtgui/vibrance.h +++ b/rtgui/vibrance.h @@ -16,18 +16,23 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _VIBRANCE_ -#define _VIBRANCE_ +#pragma once #include + #include "adjuster.h" -#include "thresholdadjuster.h" #include "curveeditor.h" #include "curveeditorgroup.h" +#include "thresholdadjuster.h" #include "toolpanel.h" -class Vibrance : public ToolParamBlock, public AdjusterListener, public ThresholdCurveProvider, public ThresholdAdjusterListener, - public FoldableToolPanel, public CurveListener +class Vibrance : + public ToolParamBlock, + public AdjusterListener, + public ThresholdCurveProvider, + public ThresholdAdjusterListener, + public FoldableToolPanel, + public CurveListener { protected: @@ -76,6 +81,3 @@ public: void pastsattog_toggled (); std::vector getCurvePoints(ThresholdSelector* tAdjuster) const override; }; - - -#endif diff --git a/rtgui/vignetting.h b/rtgui/vignetting.h index 094869f67..8cc8c498b 100644 --- a/rtgui/vignetting.h +++ b/rtgui/vignetting.h @@ -16,14 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _VIGNETTING_H_ -#define _VIGNETTING_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -class Vignetting : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class Vignetting : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -46,5 +49,3 @@ public: void setAdjusterBehavior (bool amountadd, bool radiusadd, bool strengthadd, bool centeradd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 92b9d7236..6d2961045 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -23,11 +23,12 @@ #include "editcallbacks.h" #include "guiutils.h" #include "rtimage.h" +#include "options.h" #include "eventmapper.h" +#include "../rtengine/color.h" using namespace rtengine; using namespace rtengine::procparams; -extern Options options; namespace { diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index ae04f1d1c..460af13aa 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -27,7 +27,6 @@ #include "thresholdadjuster.h" #include "colorprovider.h" #include "guiutils.h" -#include "options.h" class EditDataProvider; diff --git a/rtgui/wbprovider.h b/rtgui/wbprovider.h index 31ba8331a..a56d93cd3 100644 --- a/rtgui/wbprovider.h +++ b/rtgui/wbprovider.h @@ -16,9 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _WBPROVIDER_ -#define _WBPROVIDER_ - +#pragma once class WBProvider { @@ -29,5 +27,3 @@ public: virtual void getCamWB (double& temp, double& green) {} virtual void spotWBRequested (int size) {} }; - -#endif diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index 109fb7502..2ab09c10a 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -55,7 +55,7 @@ void WhiteBalance::init () void WhiteBalance::cleanup () { - for (unsigned int i = 0; i < toUnderlying(WBEntry::Type::CUSTOM) + 1; i++) { + for (int i = 0; i < toUnderlying(WBEntry::Type::CUSTOM) + 1; i++) { wbPixbufs[i].reset(); } } diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index fd7efe7ce..528c81d17 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -16,15 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _WB_H_ -#define _WB_H_ +#pragma once #include -#include "toolpanel.h" + #include "adjuster.h" #include "guiutils.h" +#include "toolpanel.h" #include "wbprovider.h" + #include "../rtengine/procparams.h" +#include "../rtengine/utils.h" class SpotWBListener { @@ -123,5 +125,3 @@ public: void trimValues (rtengine::procparams::ProcParams* pp) override; void enabledChanged() override; }; - -#endif diff --git a/rtgui/xtransprocess.h b/rtgui/xtransprocess.h index dae93822f..b17b56b07 100644 --- a/rtgui/xtransprocess.h +++ b/rtgui/xtransprocess.h @@ -16,17 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _XTRANSPROCESS_H_ -#define _XTRANSPROCESS_H_ +#pragma once #include + #include "adjuster.h" #include "checkbox.h" #include "guiutils.h" #include "toolpanel.h" - -class XTransProcess : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel, public rtengine::AutoContrastListener +class XTransProcess : + public ToolParamBlock, + public AdjusterListener, + public CheckBoxListener, + public FoldableToolPanel, + public rtengine::AutoContrastListener { protected: @@ -64,5 +68,3 @@ public: void checkBoxToggled(CheckBox* c, CheckValue newval) override; void adjusterAutoToggled(Adjuster* a, bool newval) override; }; - -#endif diff --git a/rtgui/xtransrawexposure.h b/rtgui/xtransrawexposure.h index 08cdcc8bf..46c418f2f 100644 --- a/rtgui/xtransrawexposure.h +++ b/rtgui/xtransrawexposure.h @@ -16,15 +16,17 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _XTRANSRAWEXPOSURE_H_ -#define _XTRANSRAWEXPOSURE_H_ +#pragma once #include + #include "adjuster.h" #include "toolpanel.h" -#include "../rtengine/rawimage.h" -class XTransRAWExposure : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class XTransRAWExposure : + public ToolParamBlock, + public AdjusterListener, + public FoldableToolPanel { protected: @@ -46,5 +48,3 @@ public: void setAdjusterBehavior (bool pexblackadd); void trimValues (rtengine::procparams::ProcParams* pp) override; }; - -#endif diff --git a/rtgui/zoompanel.h b/rtgui/zoompanel.h index e1cb651e3..49e1e848d 100644 --- a/rtgui/zoompanel.h +++ b/rtgui/zoompanel.h @@ -16,13 +16,14 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _ZOOMPANEL_ -#define _ZOOMPANEL_ +#pragma once #include class ImageArea; -class ZoomPanel : public Gtk::Grid + +class ZoomPanel : + public Gtk::Grid { protected: @@ -48,6 +49,3 @@ public: void newCropClicked (); void refreshZoomLabel (); }; - -#endif -