diff --git a/.travis.yml.fixme b/.travis.yml.fixme deleted file mode 100644 index 0aa85f3b4..000000000 --- a/.travis.yml.fixme +++ /dev/null @@ -1,44 +0,0 @@ -sudo: required -dist: trusty - -language: cpp - -compiler: - - gcc - -os: - - linux - -#branches: -# only: -# - master - -notifications: - irc: - channels: - - "chat.freenode.net#rawtherapee" - skip_join: true - template: - - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}" - email: - on_success: change - on_failure: always - -env: - global: - - OMP_NUM_THREADS=4 - -before_install: - - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ xenial main" - - sudo apt-get -qq update - - sudo apt-get install gcc-6 g++-6 - - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 - - sudo apt-get install build-essential cmake curl git libbz2-dev libcanberra-gtk3-dev libexiv2-dev libexpat-dev libfftw3-dev libglibmm-2.4-dev libgtk-3-dev libgtkmm-3.0-dev libiptcdata0-dev libjpeg8-dev liblcms2-dev libpng12-dev libsigc++-2.0-dev libtiff5-dev zlib1g-dev - -before_script: - - mkdir build - - cd build - - cmake -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" -DWITH_LTO="OFF" -DPROC_TARGET_NUMBER="2" .. - -script: make diff --git a/AUTHORS.txt b/AUTHORS.txt index 160869776..227390faa 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -39,6 +39,7 @@ Development contributors, in last name alphabetical order: Other contributors (profiles, ideas, mockups, testing, forum activity, translations, etc.), in last name alphabetical order: Marcin Bajor + Javier Bartol Thorsten Bartolomäus Patrik Brunner Fernando Carello diff --git a/rtdata/dcpprofiles/RICOH GR III.dcp b/rtdata/dcpprofiles/RICOH GR III.dcp new file mode 100644 index 000000000..f226e62b4 Binary files /dev/null and b/rtdata/dcpprofiles/RICOH GR III.dcp differ diff --git a/rtdata/languages/Catala b/rtdata/languages/Catala index 407348417..e702cbe49 100644 --- a/rtdata/languages/Catala +++ b/rtdata/languages/Catala @@ -1293,6 +1293,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1310,6 +1311,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1330,6 +1332,13 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1340,6 +1349,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1786,6 +1796,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1935,6 +1946,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Roundness:\n0 = rectangle,\n50 = fitted ellipse,\n100 = circle. !TP_PCVIGNETTE_STRENGTH;Strength !TP_PCVIGNETTE_STRENGTH_TOOLTIP;Filter strength in stops (reached in corners). +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PFCURVE_CURVEEDITOR_CH;Hue !TP_PFCURVE_CURVEEDITOR_CH_TOOLTIP;Controls defringe strength by color.\nHigher = more,\nLower = less. !TP_PREPROCESS_DEADPIXFILT;Dead pixel filter @@ -2110,6 +2122,8 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_SAVEDIALOG_OK_TIP;Shortcut: Ctrl-Enter !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/Chinese (Simplified) b/rtdata/languages/Chinese (Simplified) index b93aed7af..387d8fb85 100644 --- a/rtdata/languages/Chinese (Simplified) +++ b/rtdata/languages/Chinese (Simplified) @@ -1340,6 +1340,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1357,6 +1358,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1377,6 +1379,13 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1387,6 +1396,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1732,6 +1742,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_DEFRINGE_THRESHOLD;Threshold !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1896,6 +1907,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_NEUTRAL_TIP;Resets exposure sliders to neutral values.\nApplies to the same controls that Auto Levels applies to, regardless of whether you used Auto Levels or not. !TP_PCVIGNETTE_FEATHER_TOOLTIP;Feathering:\n0 = corners only,\n50 = halfway to center,\n100 = to center. !TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Roundness:\n0 = rectangle,\n50 = fitted ellipse,\n100 = circle. +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PFCURVE_CURVEEDITOR_CH;Hue !TP_PFCURVE_CURVEEDITOR_CH_TOOLTIP;Controls defringe strength by color.\nHigher = more,\nLower = less. !TP_PREPROCESS_DEADPIXFILT;Dead pixel filter @@ -2078,6 +2090,8 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_RETINEX_VIEW_UNSHARP;Unsharp mask !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 diff --git a/rtdata/languages/Czech b/rtdata/languages/Czech index d0b4d89f3..5c807b61d 100644 --- a/rtdata/languages/Czech +++ b/rtdata/languages/Czech @@ -2323,13 +2323,27 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !FILEBROWSER_POPUPREMOVE;Delete permanently !FILEBROWSER_POPUPREMOVEINCLPROC;Delete permanently, including queue-processed version !FILEBROWSER_SHOWNOTTRASHHINT;Show only images not in trash. +!HISTORY_MSG_494;Capture Sharpening +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative !HISTORY_MSG_FILMNEGATIVE_VALUES;Film negative values +!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 !PARTIALPASTE_FILMNEGATIVE;Film Negative !PREFERENCES_APPEARANCE_PSEUDOHIDPI;Pseudo-HiDPI mode +!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_LABEL;Film Negative !TP_FILMNEGATIVE_PICK;Pick white and black spots !TP_FILMNEGATIVE_RED;Red ratio +!TP_PDSHARPENING_LABEL;Capture Sharpening +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch index 57236e1e6..bd98c63b2 100644 --- a/rtdata/languages/Deutsch +++ b/rtdata/languages/Deutsch @@ -2371,3 +2371,21 @@ 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 c6b521c12..a36a3d1a9 100644 --- a/rtdata/languages/English (UK) +++ b/rtdata/languages/English (UK) @@ -820,6 +820,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_COLORTONING_LABREGION_CHANNEL;CT - Channel !HISTORY_MSG_COLORTONING_LABREGION_CHROMATICITYMASK;CT - region C mask !HISTORY_MSG_COLORTONING_LABREGION_HUEMASK;CT - H mask @@ -834,6 +835,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -854,6 +856,13 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -863,6 +872,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength !HISTORY_MSG_TM_FATTAL_ANCHOR;DRC - Anchor @@ -1568,6 +1578,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_DEFRINGE_THRESHOLD;Threshold !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1808,6 +1819,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Roundness:\n0 = rectangle,\n50 = fitted ellipse,\n100 = circle. !TP_PCVIGNETTE_STRENGTH;Strength !TP_PCVIGNETTE_STRENGTH_TOOLTIP;Filter strength in stops (reached in corners). +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PERSPECTIVE_HORIZONTAL;Horizontal !TP_PERSPECTIVE_LABEL;Perspective !TP_PERSPECTIVE_VERTICAL;Vertical @@ -2031,12 +2043,14 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_SHARPENING_CONTRAST;Contrast threshold !TP_SHARPENING_EDRADIUS;Radius !TP_SHARPENING_EDTOLERANCE;Edge tolerance +!TP_SHARPENING_GAMMA;Gamma !TP_SHARPENING_HALOCONTROL;Halo control !TP_SHARPENING_HCAMOUNT;Amount !TP_SHARPENING_LABEL;Sharpening !TP_SHARPENING_METHOD;Method !TP_SHARPENING_ONLYEDGES;Sharpen only edges !TP_SHARPENING_RADIUS;Radius +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENING_RLD;RL Deconvolution !TP_SHARPENING_RLD_AMOUNT;Amount !TP_SHARPENING_RLD_DAMPING;Damping diff --git a/rtdata/languages/English (US) b/rtdata/languages/English (US) index 9b8eda038..aa5239911 100644 --- a/rtdata/languages/English (US) +++ b/rtdata/languages/English (US) @@ -727,6 +727,7 @@ !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -744,6 +745,7 @@ !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -764,6 +766,13 @@ !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -774,6 +783,7 @@ !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1531,6 +1541,7 @@ !TP_DEFRINGE_THRESHOLD;Threshold !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1793,6 +1804,7 @@ !TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Roundness:\n0 = rectangle,\n50 = fitted ellipse,\n100 = circle. !TP_PCVIGNETTE_STRENGTH;Strength !TP_PCVIGNETTE_STRENGTH_TOOLTIP;Filter strength in stops (reached in corners). +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PERSPECTIVE_HORIZONTAL;Horizontal !TP_PERSPECTIVE_LABEL;Perspective !TP_PERSPECTIVE_VERTICAL;Vertical @@ -2021,12 +2033,14 @@ !TP_SHARPENING_CONTRAST;Contrast threshold !TP_SHARPENING_EDRADIUS;Radius !TP_SHARPENING_EDTOLERANCE;Edge tolerance +!TP_SHARPENING_GAMMA;Gamma !TP_SHARPENING_HALOCONTROL;Halo control !TP_SHARPENING_HCAMOUNT;Amount !TP_SHARPENING_LABEL;Sharpening !TP_SHARPENING_METHOD;Method !TP_SHARPENING_ONLYEDGES;Sharpen only edges !TP_SHARPENING_RADIUS;Radius +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENING_RLD;RL Deconvolution !TP_SHARPENING_RLD_AMOUNT;Amount !TP_SHARPENING_RLD_DAMPING;Damping diff --git a/rtdata/languages/Espanol b/rtdata/languages/Espanol index 1e3b84371..27aa39c12 100644 --- a/rtdata/languages/Espanol +++ b/rtdata/languages/Espanol @@ -2321,9 +2321,19 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nTecla de Atajo: - !FILEBROWSER_POPUPREMOVE;Delete permanently !FILEBROWSER_POPUPREMOVEINCLPROC;Delete permanently, including queue-processed version !FILEBROWSER_SHOWNOTTRASHHINT;Show only images not in trash. +!HISTORY_MSG_494;Capture Sharpening +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative !HISTORY_MSG_FILMNEGATIVE_VALUES;Film negative values +!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_BLUR;Sharpening - Blur radius +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !MAIN_FRAME_PLACES_DEL;Remove !MAIN_TAB_FAVORITES;Favorites !MAIN_TAB_FAVORITES_TOOLTIP;Shortcut: Alt-u @@ -2345,6 +2355,7 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nTecla de Atajo: - !PROGRESSBAR_RAWCACORR;Raw CA correction... !QUEUE_LOCATION_TITLE;Output Location !TP_CROP_PPI;PPI +!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. @@ -2356,7 +2367,10 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nTecla de Atajo: - !TP_LENSPROFILE_MODE_HEADER;Lens Profile !TP_LENSPROFILE_USE_GEOMETRIC;Geometric distortion !TP_LENSPROFILE_USE_HEADER;Correct +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_RAW_IMAGENUM_SN;SN mode !TP_RAW_XTRANS;X-Trans !TP_RAW_XTRANSFAST;Fast X-Trans !TP_SHARPENING_BLUR;Blur radius +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 082cff1f1..9f9485c70 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -2266,8 +2266,18 @@ ZOOMPANEL_ZOOMOUT;Zoom Arrière\nRaccourci: - !FILEBROWSER_POPUPREMOVE;Delete permanently !FILEBROWSER_POPUPREMOVEINCLPROC;Delete permanently, including queue-processed version !FILEBROWSER_SHOWNOTTRASHHINT;Show only images not in trash. +!HISTORY_MSG_494;Capture Sharpening +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative !HISTORY_MSG_FILMNEGATIVE_VALUES;Film negative values +!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 !MAIN_FRAME_PLACES_DEL;Remove !PARTIALPASTE_FILMNEGATIVE;Film Negative !PROGRESSBAR_DECODING;Decoding... @@ -2278,6 +2288,7 @@ ZOOMPANEL_ZOOMOUT;Zoom Arrière\nRaccourci: - !PROGRESSBAR_RAWCACORR;Raw CA correction... !QUEUE_LOCATION_TITLE;Output Location !TP_CROP_PPI;PPI +!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. @@ -2289,5 +2300,8 @@ ZOOMPANEL_ZOOMOUT;Zoom Arrière\nRaccourci: - !TP_LENSPROFILE_MODE_HEADER;Lens Profile !TP_LENSPROFILE_USE_GEOMETRIC;Geometric distortion !TP_LENSPROFILE_USE_HEADER;Correct +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_RAW_XTRANS;X-Trans !TP_RAW_XTRANSFAST;Fast X-Trans +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost diff --git a/rtdata/languages/Italiano b/rtdata/languages/Italiano index f11423d7a..7ba18b2d8 100644 --- a/rtdata/languages/Italiano +++ b/rtdata/languages/Italiano @@ -1518,6 +1518,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1535,6 +1536,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1555,6 +1557,13 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1565,6 +1574,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1852,6 +1862,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1954,6 +1965,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_METADATA_STRIP;Strip all metadata !TP_METADATA_TUNNEL;Copy unchanged !TP_NEUTRAL;Reset +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PREPROCESS_DEADPIXFILT;Dead pixel filter !TP_PREPROCESS_DEADPIXFILT_TOOLTIP;Tries to suppress dead pixels. !TP_PREPROCESS_HOTPIXFILT;Hot pixel filter @@ -2119,6 +2131,8 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_RETINEX_VIEW_UNSHARP;Unsharp mask !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/Japanese b/rtdata/languages/Japanese index 16dafb297..83b8caa30 100644 --- a/rtdata/languages/Japanese +++ b/rtdata/languages/Japanese @@ -2319,3 +2319,21 @@ ZOOMPANEL_ZOOMFITSCREEN;画像全体を画面に合わせる\nショートカッ ZOOMPANEL_ZOOMIN;ズームイン\nショートカット: + ZOOMPANEL_ZOOMOUT;ズームアウト\nショートカット: - +!!!!!!!!!!!!!!!!!!!!!!!!! +! 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/Magyar b/rtdata/languages/Magyar index 5879bf130..11c48c3d9 100644 --- a/rtdata/languages/Magyar +++ b/rtdata/languages/Magyar @@ -1227,6 +1227,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1244,6 +1245,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1264,6 +1266,13 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1274,6 +1283,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1741,6 +1751,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1928,6 +1939,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Roundness:\n0 = rectangle,\n50 = fitted ellipse,\n100 = circle. !TP_PCVIGNETTE_STRENGTH;Strength !TP_PCVIGNETTE_STRENGTH_TOOLTIP;Filter strength in stops (reached in corners). +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PFCURVE_CURVEEDITOR_CH;Hue !TP_PFCURVE_CURVEEDITOR_CH_TOOLTIP;Controls defringe strength by color.\nHigher = more,\nLower = less. !TP_PREPROCESS_DEADPIXFILT;Dead pixel filter @@ -2103,6 +2115,8 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_SAVEDIALOG_OK_TIP;Shortcut: Ctrl-Enter !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/Nederlands b/rtdata/languages/Nederlands index d39173a52..5e2c92742 100644 --- a/rtdata/languages/Nederlands +++ b/rtdata/languages/Nederlands @@ -2015,6 +2015,7 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2032,6 +2033,7 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -2052,6 +2054,13 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -2062,6 +2071,7 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -2226,6 +2236,7 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_CURVE_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -2263,6 +2274,7 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_METADATA_MODE;Metadata copy mode !TP_METADATA_STRIP;Strip all metadata !TP_METADATA_TUNNEL;Copy unchanged +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PREPROCESS_LINEDENOISE_DIRECTION;Direction !TP_PREPROCESS_LINEDENOISE_DIRECTION_BOTH;Both !TP_PREPROCESS_LINEDENOISE_DIRECTION_HORIZONTAL;Horizontal @@ -2300,6 +2312,8 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_RETINEX_MAP;Method !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/Polish b/rtdata/languages/Polish index a631353c3..2e8a4549f 100644 --- a/rtdata/languages/Polish +++ b/rtdata/languages/Polish @@ -1600,6 +1600,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1617,6 +1618,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1637,6 +1639,13 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1647,6 +1656,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1892,6 +1902,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1975,6 +1986,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_METADATA_STRIP;Strip all metadata !TP_METADATA_TUNNEL;Copy unchanged !TP_NEUTRAL;Reset +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PREPROCESS_LINEDENOISE_DIRECTION;Direction !TP_PREPROCESS_LINEDENOISE_DIRECTION_BOTH;Both !TP_PREPROCESS_LINEDENOISE_DIRECTION_HORIZONTAL;Horizontal @@ -2125,6 +2137,8 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_RETINEX_VIEW_UNSHARP;Unsharp mask !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/Portugues b/rtdata/languages/Portugues index 766b14e0b..c4adbc7f9 100644 --- a/rtdata/languages/Portugues +++ b/rtdata/languages/Portugues @@ -2264,8 +2264,18 @@ ZOOMPANEL_ZOOMOUT;Afastar\nAtalho: - !FILEBROWSER_POPUPREMOVE;Delete permanently !FILEBROWSER_POPUPREMOVEINCLPROC;Delete permanently, including queue-processed version !FILEBROWSER_SHOWNOTTRASHHINT;Show only images not in trash. +!HISTORY_MSG_494;Capture Sharpening +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative !HISTORY_MSG_FILMNEGATIVE_VALUES;Film negative values +!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 !MAIN_FRAME_PLACES_DEL;Remove !PARTIALPASTE_FILMNEGATIVE;Film Negative !PREFERENCES_APPEARANCE_PSEUDOHIDPI;Pseudo-HiDPI mode @@ -2277,6 +2287,7 @@ ZOOMPANEL_ZOOMOUT;Afastar\nAtalho: - !PROGRESSBAR_RAWCACORR;Raw CA correction... !QUEUE_LOCATION_TITLE;Output Location !TP_CROP_PPI;PPI +!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. @@ -2288,5 +2299,8 @@ ZOOMPANEL_ZOOMOUT;Afastar\nAtalho: - !TP_LENSPROFILE_MODE_HEADER;Lens Profile !TP_LENSPROFILE_USE_GEOMETRIC;Geometric distortion !TP_LENSPROFILE_USE_HEADER;Correct +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_RAW_XTRANS;X-Trans !TP_RAW_XTRANSFAST;Fast X-Trans +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost diff --git a/rtdata/languages/Portugues (Brasil) b/rtdata/languages/Portugues (Brasil) index aef5fcde9..259cabb7e 100644 --- a/rtdata/languages/Portugues (Brasil) +++ b/rtdata/languages/Portugues (Brasil) @@ -119,8 +119,12 @@ FILEBROWSER_COLORLABEL_TOOLTIP;Etiqueta de cor.\n\nUse o menu suspenso ou atalho FILEBROWSER_COPYPROFILE;Copiar perfil FILEBROWSER_CURRENT_NAME;Nome atual: FILEBROWSER_DARKFRAME;Quadro escuro +FILEBROWSER_DELETEDIALOG_ALL;Você tem certeza que quer deletas permanentemente todos os %1 arquivos na lixeira? FILEBROWSER_DELETEDIALOG_HEADER;Confirmação de exclusão de arquivo +FILEBROWSER_DELETEDIALOG_SELECTED;Você tem certeza que quer deletar permanentemente os %1 arquivos selecionados? +FILEBROWSER_DELETEDIALOG_SELECTEDINCLPROC;Você tem certeza que quer deletar permanentemente os %1 arquivos selecionados, incluindo a versão processada em fila? FILEBROWSER_EMPTYTRASH;Esvaziar lixeira +FILEBROWSER_EMPTYTRASHHINT;Deletar permanentemente todos os arquivos na lixeira. FILEBROWSER_EXTPROGMENU;Abrir com FILEBROWSER_FLATFIELD;Flat-Field FILEBROWSER_MOVETODARKFDIR;Mover para o diretório de quadros escuros @@ -154,6 +158,8 @@ FILEBROWSER_POPUPRANK2;Classificação 2 ** FILEBROWSER_POPUPRANK3;Classificação 3 *** FILEBROWSER_POPUPRANK4;Classificação 4 **** FILEBROWSER_POPUPRANK5;Classificação 5 ***** +FILEBROWSER_POPUPREMOVE;Deletar permanentemente +FILEBROWSER_POPUPREMOVEINCLPROC;Excluir permanentemente, incluindo a versão processada em fila FILEBROWSER_POPUPRENAME;Renomear FILEBROWSER_POPUPSELECTALL;Selecionar tudo FILEBROWSER_POPUPTRASH;Mover para a lixeira @@ -180,6 +186,7 @@ FILEBROWSER_SHOWDIRHINT;Limpar todos os filtros.\nAtalho: d FILEBROWSER_SHOWEDITEDHINT;Mostrar imagens editadas.\nAtalho: 7 FILEBROWSER_SHOWEDITEDNOTHINT;Mostrar imagens não editadas.\nAtalho: 6 FILEBROWSER_SHOWEXIFINFO;Mostrar informações Exif.\n\nAtalhos:\ni - Modo de Guias de Editores Múltiplos,\nAlt-i - Modo de Guia de Editor Único. +FILEBROWSER_SHOWNOTTRASHHINT;Mostrar apenas imagens que não estão no lixo. FILEBROWSER_SHOWORIGINALHINT;Mostre somente imagens originais.\n\nQuando existem várias imagens com o mesmo nome de arquivo, mas extensões diferentes, a única considerada original é aquela cuja extensão está mais próxima da parte superior da lista de extensões analisadas em Preferências > Navegador de Arquivos > Extensões Analisadas. FILEBROWSER_SHOWRANK1HINT;Mostrar imagens classificadas com 1 estrela.\nAtalho: 1 FILEBROWSER_SHOWRANK2HINT;Mostrar imagens classificadas com 2 estrelas.\nAtalho: 2 @@ -870,6 +877,7 @@ MAIN_FRAME_FILEBROWSER;Navegador de Arquivos MAIN_FRAME_FILEBROWSER_TOOLTIP;Navegador de arquivos.\nAtalho: Ctrl-F2 MAIN_FRAME_PLACES;Locais MAIN_FRAME_PLACES_ADD;Adicionar +MAIN_FRAME_PLACES_DEL;Remover MAIN_FRAME_QUEUE;Fila MAIN_FRAME_QUEUE_TOOLTIP;Processando fila.\nAtalho: Ctrl-F3 MAIN_FRAME_RECENT;Pastas Recentes @@ -1029,6 +1037,7 @@ PREFERENCES_APPEARANCE_COLORPICKERFONT;Fonte do seletor de cor PREFERENCES_APPEARANCE_CROPMASKCOLOR;Cor da máscara de corte PREFERENCES_APPEARANCE_MAINFONT;Fonte principal PREFERENCES_APPEARANCE_NAVGUIDECOLOR;Cor do guia do navegador +PREFERENCES_APPEARANCE_PSEUDOHIDPI;Modo pseudo-HiDPI PREFERENCES_APPEARANCE_THEME;Tema PREFERENCES_APPLNEXTSTARTUP;é necessário reiniciar PREFERENCES_AUTOMONPROFILE;Usar o perfil de cores do monitor principal do sistema operacional @@ -1215,6 +1224,9 @@ PROFILEPANEL_TOOLTIPCOPY;Copie o perfil de processamento atual para a área de t PROFILEPANEL_TOOLTIPLOAD;Carregue um perfil do arquivo.\nCtrl-click para selecionar os parâmetros a serem carregados. PROFILEPANEL_TOOLTIPPASTE;Cole o perfil da área de transferência.\nCtrl-click para selecionar os parâmetros a serem colados. PROFILEPANEL_TOOLTIPSAVE;Salvar o perfil atual.\nCtrl-click para selecionar os parâmetros a serem salvos. +PROGRESSBAR_GREENEQUIL;Equilíbrio de verde... +PROGRESSBAR_HLREC;Reconstrução de realces... +PROGRESSBAR_LINEDENOISE;Filtro de ruído de linha... PROGRESSBAR_LOADING;Carregando imagem... PROGRESSBAR_LOADINGTHUMBS;Carregando miniaturas... PROGRESSBAR_LOADJPEG;Carregando arquivo JPEG... @@ -1241,6 +1253,7 @@ QUEUE_FORMAT_TITLE;Formato de arquivo QUEUE_LOCATION_FOLDER;Salvar na pasta QUEUE_LOCATION_TEMPLATE;Use modelo QUEUE_LOCATION_TEMPLATE_TOOLTIP;Podes usar as seguintes sequências de formatação:\n%f, %d1, %d2, ..., %p1, %p2, ..., %r, %s1, %s2, ...\n\nEssas cadeias de formatação referem-se às diferentes partes do endereço do nome da foto, alguns atributos da foto ou um índice de sequência arbitrário no processamento em lote.\n\nPor exemplo, se a foto que está sendo processada tiver o seguinte endereço do nome:\n/inicio/rodrigo/fotos/2010-10-31/dsc0042.nef\no significado das cadeias de formatação são:\n%d4 = inicio\n%d3 = rodrigo\n%d2 = fotos\n%d1 = 2010-10-31\n%f = dsc0042\n%p1 = /inicio/rodrigo/fotos/2010-10-31/\n%p2 = /inicio/rodrigo/fotos/\n%p3 = /inicio/rodrigo/\n%p4 = /inicio/\n\n%r será substituído pela classificação da foto. Se a foto não tiver classificação, %r será substituído por '0'. Se a foto estiver na lixeira, %r será substituído por 'x'.\n\n%s1, %s2, etc. será substituído por um índice de sequência que é preenchido entre 1 e 9 dígitos. O índice de sequência iniciará em 1 sempre que o processamento da fila for iniciado e será incrementado em 1 para cada imagem processada.\n\nSe quiseres salvar a imagem de saída no local onde se encontra a original, escreva:\n%p1/%f\n\nSe quiseres salvar a imagem de saída num diretório chamado "convertido" localizado no diretório da imagem aberta, escreva:\n%p1/convertido/%f\n\nSe quiseres salvar a imagem de saída num diretório chamado\n"/inicio/rodrigo/fotos/convertido/2010-10-31", escreva:\n%p2/convertido/%d1/%f +QUEUE_LOCATION_TITLE;Local da Saída QUEUE_STARTSTOP_TOOLTIP;Inicia ou para o processamento das imagens na fila.\n\nAtalho: Ctrl+s SAMPLEFORMAT_0;Formato de dados desconhecido SAMPLEFORMAT_1;8 bits sem assinatura @@ -1612,6 +1625,9 @@ TP_EXPOSURE_TCMODE_STANDARD;Padrão 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_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? TP_FILMSIMULATION_STRENGTH;Intensidade @@ -1732,9 +1748,13 @@ TP_LABCURVE_RSTPRO_TOOLTIP;Funciona no controle deslizante de cromaticidade e na TP_LENSGEOM_AUTOCROP;Corte automático TP_LENSGEOM_FILL;Preenchimento automático TP_LENSGEOM_LABEL;Lente / Geometria +TP_LENSPROFILE_CORRECTION_AUTOMATCH;Selecionado automaticamente TP_LENSPROFILE_CORRECTION_LCPFILE;Ficheiro LCP +TP_LENSPROFILE_CORRECTION_MANUAL;Selecionado manualmente TP_LENSPROFILE_LABEL;Correção de lente perfilada +TP_LENSPROFILE_MODE_HEADER;Perfil da Lente TP_LENSPROFILE_USE_CA;Aberração cromática +TP_LENSPROFILE_USE_GEOMETRIC;Distorção geométrica TP_LENSPROFILE_USE_VIGNETTING;Vinhetagem TP_LOCALCONTRAST_AMOUNT;Montante TP_LOCALCONTRAST_DARKNESS;Nível de escuridão @@ -2249,45 +2269,39 @@ ZOOMPANEL_ZOOMOUT;Menos Zoom\nAtalho: - !!!!!!!!!!!!!!!!!!!!!!!!! !FILEBROWSER_BROWSEPATHBUTTONHINT;Click to open specified path, reload folder and apply "find" keywords. -!FILEBROWSER_DELETEDIALOG_ALL;Are you sure you want to permanently delete all %1 files in trash? -!FILEBROWSER_DELETEDIALOG_SELECTED;Are you sure you want to permanently delete the selected %1 files? -!FILEBROWSER_DELETEDIALOG_SELECTEDINCLPROC;Are you sure you want to permanently delete the selected %1 files, including a queue-processed version? -!FILEBROWSER_EMPTYTRASHHINT;Permanently delete all files in trash. -!FILEBROWSER_POPUPREMOVE;Delete permanently -!FILEBROWSER_POPUPREMOVEINCLPROC;Delete permanently, including queue-processed version -!FILEBROWSER_SHOWNOTTRASHHINT;Show only images not in trash. +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_COLORTONING_LABREGION_OFFSET;CT - region offset !HISTORY_MSG_COLORTONING_LABREGION_POWER;CT - region power +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative !HISTORY_MSG_FILMNEGATIVE_VALUES;Film negative values -!MAIN_FRAME_PLACES_DEL;Remove +!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 !PARTIALPASTE_FILMNEGATIVE;Film Negative -!PREFERENCES_APPEARANCE_PSEUDOHIDPI;Pseudo-HiDPI mode !PREFERENCES_CACHECLEAR_SAFETY;Only files in the cache are cleared. Processing profiles stored alongside the source images are not touched. !PROGRESSBAR_DECODING;Decoding... -!PROGRESSBAR_GREENEQUIL;Green equilibration... -!PROGRESSBAR_HLREC;Highlight reconstruction... !PROGRESSBAR_HOTDEADPIXELFILTER;Hot/dead pixel filter... -!PROGRESSBAR_LINEDENOISE;Line noise filter... !PROGRESSBAR_RAWCACORR;Raw CA correction... -!QUEUE_LOCATION_TITLE;Output Location !TP_COLORTONING_LABREGION_OFFSET;Offset !TP_COLORTONING_LABREGION_POWER;Power !TP_CROP_PPI;PPI -!TP_FILMNEGATIVE_BLUE;Blue ratio +!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_LABEL;Film Negative -!TP_FILMNEGATIVE_PICK;Pick white and black spots -!TP_FILMNEGATIVE_RED;Red ratio -!TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected -!TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected !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_MODE_HEADER;Lens Profile -!TP_LENSPROFILE_USE_GEOMETRIC;Geometric distortion !TP_LENSPROFILE_USE_HEADER;Correct +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_RAWCACORR_AUTOIT_TOOLTIP;This setting is available if "Auto-correction" is checked.\nAuto-correction is conservative, meaning that it often does not correct all chromatic aberration.\nTo correct the remaining chromatic aberration, you can use up to five iterations of automatic chromatic aberration correction.\nEach iteration will reduce the remaining chromatic aberration from the last iteration at the cost of additional processing time. !TP_RAW_DUALDEMOSAICAUTOCONTRAST_TOOLTIP;If the checkbox is checked (recommended), RawTherapee calculates an optimum value based on flat regions in the image.\nIf there is no flat region in the image or the image is too noisy, the value will be set to 0.\nTo set the value manually, uncheck the checkbox first (reasonable values depend on the image). !TP_RAW_XTRANS;X-Trans !TP_RAW_XTRANSFAST;Fast X-Trans !TP_RETINEX_GAINTRANSMISSION_TOOLTIP;Amplify or reduce the transmission map to achieve the desired luminance.\nThe x-axis is the transmission.\nThe y-axis is the gain. +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost diff --git a/rtdata/languages/Russian b/rtdata/languages/Russian index 79c6bebfc..2014f9aad 100644 --- a/rtdata/languages/Russian +++ b/rtdata/languages/Russian @@ -1690,6 +1690,7 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !HISTORY_MSG_483;CAM02 - Yb scene !HISTORY_MSG_484;CAM02 - Auto Yb scene !HISTORY_MSG_489;DRC - Detail +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_CHANNEL;CT - Channel @@ -1704,6 +1705,7 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !HISTORY_MSG_COLORTONING_LABREGION_SATURATION;CT - Saturation !HISTORY_MSG_COLORTONING_LABREGION_SHOWMASK;CT - region show mask !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold !HISTORY_MSG_DUALDEMOSAIC_CONTRAST;Dual demosaic - Contrast threshold !HISTORY_MSG_FILMNEGATIVE_ENABLED;Film Negative @@ -1715,6 +1717,13 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !HISTORY_MSG_ICM_WORKING_SLOPE;Working - Slope !HISTORY_MSG_ICM_WORKING_TRC_METHOD;Working - TRC method !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1725,6 +1734,7 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !ICCPROFCREATOR_COPYRIGHT;Copyright: !ICCPROFCREATOR_COPYRIGHT_RESET_TOOLTIP;Reset to the default copyright, granted to "RawTherapee, CC0" @@ -1947,6 +1957,7 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !TP_COLORTONING_TWOCOLOR_TOOLTIP;Standard chroma:\nLinear response, a* = b*.\n\nSpecial chroma:\nLinear response, a* = b*, but unbound - try under the diagonal.\n\nSpecial a* and b*:\nLinear response unbound with separate curves for a* and b*. Intended for special effects.\n\nSpecial chroma 2 colors:\nMore predictable. !TP_COLORTONING_TWOSTD;Standard chroma !TP_CROP_PPI;PPI +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones !TP_DIRPYRDENOISE_CHROMINANCE_CURVE_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. !TP_DIRPYRDENOISE_CHROMINANCE_METHODADVANCED_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. @@ -2008,6 +2019,7 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !TP_LENSPROFILE_MODE_HEADER;Lens Profile !TP_LENSPROFILE_USE_GEOMETRIC;Geometric distortion !TP_LENSPROFILE_USE_HEADER;Correct +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PREPROCESS_LINEDENOISE_DIRECTION;Direction !TP_PREPROCESS_LINEDENOISE_DIRECTION_BOTH;Both !TP_PREPROCESS_LINEDENOISE_DIRECTION_HORIZONTAL;Horizontal @@ -2135,6 +2147,8 @@ ZOOMPANEL_ZOOMOUT;Отдалить\nГорячая клавиша: - !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask !TP_SHARPENING_BLUR;Blur radius +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Serbian (Cyrilic Characters) b/rtdata/languages/Serbian (Cyrilic Characters) index 2b98cfe2a..0e940be55 100644 --- a/rtdata/languages/Serbian (Cyrilic Characters) +++ b/rtdata/languages/Serbian (Cyrilic Characters) @@ -1493,6 +1493,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1510,6 +1511,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1530,6 +1532,13 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1540,6 +1549,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -1843,6 +1853,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1954,6 +1965,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_METADATA_MODE;Metadata copy mode !TP_METADATA_STRIP;Strip all metadata !TP_METADATA_TUNNEL;Copy unchanged +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PREPROCESS_DEADPIXFILT;Dead pixel filter !TP_PREPROCESS_DEADPIXFILT_TOOLTIP;Tries to suppress dead pixels. !TP_PREPROCESS_HOTPIXFILT;Hot pixel filter @@ -2119,6 +2131,8 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_RETINEX_VIEW_UNSHARP;Unsharp mask !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/Swedish b/rtdata/languages/Swedish index 220339a45..fbc55624d 100644 --- a/rtdata/languages/Swedish +++ b/rtdata/languages/Swedish @@ -1842,6 +1842,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !HISTORY_MSG_491;White Balance !HISTORY_MSG_492;RGB Curves !HISTORY_MSG_493;L*a*b* Adjustments +!HISTORY_MSG_494;Capture Sharpening !HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors !HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction !HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -1859,6 +1860,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope !HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth !HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +!HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only !HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map !HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength !HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -1879,6 +1881,13 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius !HISTORY_MSG_METADATA_MODE;Metadata copy mode !HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold +!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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion !HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction !HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1889,6 +1898,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !HISTORY_MSG_RESIZE_ALLOWUPSCALING;Resize - Allow upscaling !HISTORY_MSG_SHARPENING_BLUR;Sharpening - Blur radius !HISTORY_MSG_SHARPENING_CONTRAST;Sharpening - Contrast threshold +!HISTORY_MSG_SHARPENING_GAMMA;Sharpening - Gamma !HISTORY_MSG_SH_COLORSPACE;S/H - Colorspace !HISTORY_MSG_SOFTLIGHT_ENABLED;Soft light !HISTORY_MSG_SOFTLIGHT_STRENGTH;Soft light - Strength @@ -2100,6 +2110,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_CROP_SELECTCROP;Select !TP_DEHAZE_DEPTH;Depth !TP_DEHAZE_LABEL;Haze Removal +!TP_DEHAZE_LUMINANCE;Luminance only !TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map !TP_DEHAZE_STRENGTH;Strength !TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -2157,6 +2168,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_METADATA_MODE;Metadata copy mode !TP_METADATA_STRIP;Strip all metadata !TP_METADATA_TUNNEL;Copy unchanged +!TP_PDSHARPENING_LABEL;Capture Sharpening !TP_PREPROCESS_LINEDENOISE_DIRECTION;Direction !TP_PREPROCESS_LINEDENOISE_DIRECTION_BOTH;Both !TP_PREPROCESS_LINEDENOISE_DIRECTION_HORIZONTAL;Horizontal @@ -2246,6 +2258,8 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_RETINEX_VIEW_METHOD_TOOLTIP;Standard - Normal display.\nMask - Displays the mask.\nUnsharp mask - Displays the image with a high radius unsharp mask.\nTransmission - Auto/Fixed - Displays the file transmission-map, before any action on contrast and brightness.\n\nAttention: the mask does not correspond to reality, but is amplified to make it more visible. !TP_SHARPENING_BLUR;Blur radius !TP_SHARPENING_CONTRAST;Contrast threshold +!TP_SHARPENING_GAMMA;Gamma +!TP_SHARPENING_RADIUS_BOOST;Corner radius boost !TP_SHARPENMICRO_CONTRAST;Contrast threshold !TP_SOFTLIGHT_LABEL;Soft Light !TP_SOFTLIGHT_STRENGTH;Strength diff --git a/rtdata/languages/default b/rtdata/languages/default index ccae05426..2baebb9df 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -744,6 +744,7 @@ HISTORY_MSG_COLORTONING_LABREGION_SHOWMASK;CT - region show mask HISTORY_MSG_COLORTONING_LABREGION_SLOPE;CT - region slope HISTORY_MSG_DEHAZE_DEPTH;Dehaze - Depth HISTORY_MSG_DEHAZE_ENABLED;Haze Removal +HISTORY_MSG_DEHAZE_LUMINANCE;Dehaze - Luminance only HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP;Dehaze - Show depth map HISTORY_MSG_DEHAZE_STRENGTH;Dehaze - Strength HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST;Dual demosaic - Auto threshold @@ -764,12 +765,13 @@ HISTORY_MSG_LOCALCONTRAST_LIGHTNESS;Local Contrast - Lightness HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius HISTORY_MSG_METADATA_MODE;Metadata copy mode HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold -HISTORY_MSG_PDSHARPEN_CONTRAST;CAS - Contrast threshold -HISTORY_MSG_PDSHARPEN_AUTO_CONTRAST;CAS - Auto threshold -HISTORY_MSG_PDSHARPEN_AUTO_RADIUS;CAS - Auto radius -HISTORY_MSG_PDSHARPEN_GAMMA;CAS - Gamma -HISTORY_MSG_PDSHARPEN_ITERATIONS;CAS - Iterations -HISTORY_MSG_PDSHARPEN_RADIUS;CAS - Radius +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_PIXELSHIFT_DEMOSAIC;PS - Demosaic method for motion HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION;Line noise filter direction HISTORY_MSG_PREPROCESS_PDAFLINESFILTER;PDAF lines filter @@ -1538,6 +1540,7 @@ TP_DEFRINGE_RADIUS;Radius TP_DEFRINGE_THRESHOLD;Threshold TP_DEHAZE_DEPTH;Depth TP_DEHAZE_LABEL;Haze Removal +TP_DEHAZE_LUMINANCE;Luminance only TP_DEHAZE_SHOW_DEPTH_MAP;Show depth map TP_DEHAZE_STRENGTH;Strength TP_DIRPYRDENOISE_CHROMINANCE_AMZ;Auto multi-zones @@ -1801,7 +1804,6 @@ TP_PCVIGNETTE_ROUNDNESS_TOOLTIP;Roundness:\n0 = rectangle,\n50 = fitted ellipse, TP_PCVIGNETTE_STRENGTH;Strength TP_PCVIGNETTE_STRENGTH_TOOLTIP;Filter strength in stops (reached in corners). TP_PDSHARPENING_LABEL;Capture Sharpening -TP_PDSHARPENING_AUTORADIUS_TOOLTIP;If the checkbox is checked, RawTherapee calculates a value based on the raw data of the image. TP_PERSPECTIVE_HORIZONTAL;Horizontal TP_PERSPECTIVE_LABEL;Perspective TP_PERSPECTIVE_VERTICAL;Vertical @@ -2037,7 +2039,7 @@ TP_SHARPENING_LABEL;Sharpening TP_SHARPENING_METHOD;Method TP_SHARPENING_ONLYEDGES;Sharpen only edges TP_SHARPENING_RADIUS;Radius -TP_SHARPENING_RADIUS_OFFSET;Radius corner offset +TP_SHARPENING_RADIUS_BOOST;Corner radius boost TP_SHARPENING_RLD;RL Deconvolution TP_SHARPENING_RLD_AMOUNT;Amount TP_SHARPENING_RLD_DAMPING;Damping diff --git a/rtdata/rawtherapee.desktop.in b/rtdata/rawtherapee.desktop.in index c6c675c4d..b059e7d6a 100644 --- a/rtdata/rawtherapee.desktop.in +++ b/rtdata/rawtherapee.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] Type=Application -Version=1.1 +Version=1.0 Name=RawTherapee GenericName=Raw Photo Editor GenericName[cs]=Editor raw obrázků diff --git a/rtdata/themes/RawTherapee-GTK3-20_.css b/rtdata/themes/RawTherapee-GTK3-20_.css index 3f5072f48..a5f52a769 100644 --- a/rtdata/themes/RawTherapee-GTK3-20_.css +++ b/rtdata/themes/RawTherapee-GTK3-20_.css @@ -640,11 +640,11 @@ spinbutton entry { } spinbutton button { margin: 0; - padding: 0; - border-radius: 0; + padding: 0; + border-radius: 0; } spinbutton button.up { - border-radius: 0 0.16666666666666666666em 0.16666666666666666666em 0; + border-radius: 0 0.16666666666666666666em 0.16666666666666666666em 0; } entry:disabled, spinbutton:disabled { @@ -841,7 +841,7 @@ flowboxchild:selected { color: #CCCCCC; padding: 0; margin: 0 0.25em 0 0.25em; - font-size: 1.1em; + font-size: 1.1em; } #MyExpanderTitle:hover { background-color: #202020; @@ -955,7 +955,7 @@ fontchooser scrolledwindow, } #PlacesPaned { - margin: 0; + margin: 0; padding: 0 0.4166666666666666em 0 0; } #PlacesPaned > box:nth-child(1) scrolledwindow + grid { @@ -1050,7 +1050,7 @@ dialog frame > label:not(.dummy) { #LabelRightNotebook { padding: 0.4166666666666666em; margin: 0.1666666666666666em; - font-size: 1.25em; + font-size: 1.25em; } #ToolPanelNotebook { diff --git a/rtdata/themes/RawTherapee-GTK3-_19.css b/rtdata/themes/RawTherapee-GTK3-_19.css index 58742e8ca..f4bec23b1 100644 --- a/rtdata/themes/RawTherapee-GTK3-_19.css +++ b/rtdata/themes/RawTherapee-GTK3-_19.css @@ -46,7 +46,7 @@ GtkBox { border-style: none; border-radius: 0; margin: 0; - padding: 0; + padding: 0; } GtkGrid { diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index f52cfa256..40ddaefbb 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -11,7 +11,7 @@ include_directories(${EXTRA_INCDIR} ${LCMS_INCLUDE_DIRS} ${LENSFUN_INCLUDE_DIRS} ${RSVG_INCLUDE_DIRS} - ) +) link_directories("${PROJECT_SOURCE_DIR}/rtexif" ${EXPAT_LIBRARY_DIRS} @@ -25,25 +25,22 @@ link_directories("${PROJECT_SOURCE_DIR}/rtexif" ${LCMS_LIBRARY_DIRS} ${LENSFUN_LIBRARY_DIRS} ${RSVG_LIBRARY_DIRS} - ) +) set(CAMCONSTSFILE "camconst.json") set(RTENGINESOURCEFILES - badpixels.cc - CA_correct_RT.cc - capturesharpening.cc - EdgePreservingDecomposition.cc - FTblockDN.cc - PF_correct_RT.cc ahd_demosaic_RT.cc amaze_demosaic_RT.cc - cJSON.c + badpixels.cc + CA_correct_RT.cc calc_distort.cc camconst.cc + capturesharpening.cc cfa_linedn_RT.cc ciecam02.cc cieimage.cc + cJSON.c clutstore.cc color.cc colortemp.cc @@ -60,14 +57,19 @@ set(RTENGINESOURCEFILES dual_demosaic_RT.cc dynamicprofile.cc eahd_demosaic.cc + EdgePreservingDecomposition.cc fast_demo.cc ffmanager.cc filmnegativeproc.cc filmnegativethumb.cc flatcurves.cc + FTblockDN.cc + gamutwarning.cc gauss.cc green_equil_RT.cc + guidedfilter.cc hilite_recon.cc + histmatching.cc hphd_demosaic_RT.cc iccjpeg.cc iccstore.cc @@ -82,29 +84,27 @@ set(RTENGINESOURCEFILES improcfun.cc impulse_denoise.cc init.cc + ipdehaze.cc iplab2rgb.cc + iplabregions.cc + iplocalcontrast.cc ipresize.cc ipretinex.cc + ipshadowshighlights.cc ipsharpen.cc + ipsoftlight.cc iptransform.cc ipvibrance.cc ipwavelet.cc jdatasrc.cc jpeg_ijg/jpeg_memsrc.cc - klt/convolve.cc - klt/error.cc - klt/klt.cc - klt/klt_util.cc - klt/pnmio.cc - klt/pyramid.cc - klt/selectGoodFeatures.cc - klt/storeFeatures.cc - klt/trackFeatures.cc - klt/writeFeatures.cc labimage.cc lcp.cc + lj92.c loadinitial.cc myfile.cc + pdaflinesfilter.cc + PF_correct_RT.cc pipettebuffer.cc pixelshift.cc previewimage.cc @@ -116,27 +116,17 @@ set(RTENGINESOURCEFILES rcd_demosaic.cc refreshmap.cc rt_algo.cc + rtlensfun.cc rtthumbnail.cc shmap.cc simpleprocess.cc slicer.cc stdimagesource.cc - utils.cc - rtlensfun.cc tmo_fattal02.cc - iplocalcontrast.cc - histmatching.cc - pdaflinesfilter.cc - gamutwarning.cc - ipshadowshighlights.cc - xtrans_demosaic.cc + utils.cc vng4_demosaic_RT.cc - ipsoftlight.cc - guidedfilter.cc - ipdehaze.cc - iplabregions.cc - lj92.c - ) + xtrans_demosaic.cc +) if(LENSFUN_HAS_LOAD_DIRECTORY) set_source_files_properties(rtlensfun.cc PROPERTIES COMPILE_DEFINITIONS RT_LENSFUN_HAS_LOAD_DIRECTORY) @@ -150,21 +140,22 @@ if(NOT WITH_SYSTEM_KLT) set(RTENGINESOURCEFILES ${RTENGINESOURCEFILES} klt/convolve.cc klt/error.cc - klt/klt.cc klt/klt_util.cc + klt/klt.cc klt/pnmio.cc klt/pyramid.cc klt/selectGoodFeatures.cc klt/storeFeatures.cc klt/trackFeatures.cc klt/writeFeatures.cc - ) + ) set(KLT_LIBRARIES) endif() include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") -add_library(rtengine ${RTENGINESOURCEFILES}) +add_library(rtengine STATIC ${RTENGINESOURCEFILES}) + add_dependencies(rtengine UpdateInfo) # It may be nice to store library version too @@ -190,6 +181,6 @@ target_link_libraries(rtengine rtexif ${ZLIB_LIBRARIES} ${LENSFUN_LIBRARIES} ${RSVG_LIBRARIES} - ) +) install(FILES ${CAMCONSTSFILE} DESTINATION "${DATADIR}" PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) diff --git a/rtengine/boxblur.h b/rtengine/boxblur.h index da302964b..1689c5ed1 100644 --- a/rtengine/boxblur.h +++ b/rtengine/boxblur.h @@ -20,6 +20,7 @@ #define _BOXBLUR_H_ #include +#include #include #include #include @@ -27,7 +28,6 @@ #include "rt_math.h" #include "opthelper.h" - namespace rtengine { @@ -204,15 +204,15 @@ template void boxblur (T** src, A** dst, T* buffer, int radx, tempv = tempv / lenv; temp1v = temp1v / lenv; - STVFU( dst[0][col], tempv); - STVFU( dst[0][col + 4], temp1v); + 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); + STVFU(dst[row][col], tempv); + STVFU(dst[row][col + 4], temp1v); lenv = lenp1v; } @@ -221,16 +221,16 @@ template void boxblur (T** src, A** dst, T* buffer, int radx, 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); + 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); + STVFU(dst[row][col], tempv); + STVFU(dst[row][col + 4], temp1v); lenv = lenm1v; } } @@ -312,6 +312,247 @@ template void boxblur (T** src, A** dst, T* buffer, int radx, } +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) @@ -382,15 +623,15 @@ template void boxblur (T* src, A* dst, A* buffer, int radx, in tempv = tempv / lenv; temp1v = temp1v / lenv; - STVFU( dst[0 * W + col], tempv); - STVFU( dst[0 * W + col + 4], temp1v); + 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); + STVFU(dst[row * W + col], tempv); + STVFU(dst[row * W + col + 4], temp1v); lenv = lenp1v; } @@ -399,16 +640,16 @@ template void boxblur (T* src, A* dst, A* buffer, int radx, in 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); + 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); + STVFU(dst[row * W + col], tempv); + STVFU(dst[row * W + col + 4], temp1v); lenv = lenm1v; } } @@ -422,12 +663,12 @@ template void boxblur (T* src, A* dst, A* buffer, int radx, in } tempv = tempv / lenv; - STVFU( dst[0 * W + col], tempv); + 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); + STVFU(dst[row * W + col], tempv); lenv = lenp1v; } @@ -435,13 +676,13 @@ template void boxblur (T* src, A* dst, A* buffer, int radx, in 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); + 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); + STVFU(dst[row * W + col], tempv); lenv = lenm1v; } } diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 7f481e104..3393dec9f 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1481,6 +1481,12 @@ Camera constants: } }, + { // Quality B + "make_model": "NIKON COOLPIX P1000", + "dcraw_matrix": [ 14294, -6116, -1333, -1628, 10219, 1637, -14, 1158, 5022 ], // ColorMatrix2 from Adobe DNG Converter 11.4 + "ranges": { "black": 200, "white": 4093 } + }, + { // Quality B, no LENR samples "make_model": "Nikon D5", "dcraw_matrix": [ 9200,-3522,-992,-5755,13803,2117,-753,1486,6338 ], // adobe dng_v9.5 d65 diff --git a/rtengine/capturesharpening.cc b/rtengine/capturesharpening.cc index e08243713..6720d9abc 100644 --- a/rtengine/capturesharpening.cc +++ b/rtengine/capturesharpening.cc @@ -532,9 +532,9 @@ BENCHFUN constexpr int tileSize = 194; constexpr int border = 5; constexpr int fullTileSize = tileSize + 2 * border; - const float maxRadius = std::min(1.15f, sigma + sigmaCornerOffset); - const float maxDistance = sqrt(rtengine::SQR(W * 0.5f) + rtengine::SQR(H * 0.5f)); - const float distanceFactor = (maxRadius - sigma) / maxDistance; + const float cornerRadius = std::min(1.15f, sigma + sigmaCornerOffset); + const float cornerDistance = sqrt(rtengine::SQR(W * 0.5f) + rtengine::SQR(H * 0.5f)); + const float distanceFactor = (cornerRadius - sigma) / cornerDistance; double progress = startVal; const double progressStep = (endVal - startVal) * rtengine::SQR(tileSize) / (W * H); @@ -581,14 +581,17 @@ BENCHFUN gauss5x5mult(tmpThr, tmpIThr, fullTileSize, fullTileSize, kernel5); } } else { - if (sigmaCornerOffset > 0.0) { - float lkernel7[7][7]; + if (sigmaCornerOffset != 0.0) { const float distance = sqrt(rtengine::SQR(i + tileSize / 2 - H / 2) + rtengine::SQR(j + tileSize / 2 - W / 2)); - compute7x7kernel(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); - gauss7x7mult(tmpThr, tmpIThr, fullTileSize, fullTileSize, lkernel7); + const float sigmaTile = sigma + distanceFactor * distance; + if (sigmaTile >= 0.4f) { + float lkernel7[7][7]; + compute7x7kernel(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); + gauss7x7mult(tmpThr, tmpIThr, fullTileSize, fullTileSize, lkernel7); + } } } else { for (int k = 0; k < iterations; ++k) { diff --git a/rtengine/ciecam02.cc b/rtengine/ciecam02.cc index dfef273d6..dc71fee85 100644 --- a/rtengine/ciecam02.cc +++ b/rtengine/ciecam02.cc @@ -145,8 +145,8 @@ void Ciecam02::curveJfloat (float br, float contr, const LUTu & histogram, LUTf } outCurve *= 32767.f; - //printf("out500=%f out15000=%f\n", outCurve[500], outCurve[15000]); - //outCurve.dump("brig"); + //printf("out500=%f out15000=%f\n", outCurve[500], outCurve[15000]); + //outCurve.dump("brig"); } /** diff --git a/rtengine/color.h b/rtengine/color.h index 8318e8649..1927ac06c 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -210,6 +210,13 @@ public: return r * workingspace[1][0] + g * workingspace[1][1] + b * workingspace[1][2]; } +#ifdef __SSE2__ + static vfloat rgbLuminance(vfloat r, vfloat g, vfloat b, const vfloat workingspace[3]) + { + return r * workingspace[0] + g * workingspace[1] + b * workingspace[2]; + } +#endif + /** * @brief Convert red/green/blue to L*a*b * @brief Convert red/green/blue to hue/saturation/luminance @@ -1064,12 +1071,11 @@ public: */ static inline double gamma2 (double x) // g3 1+g4 { - // return x <= 0.003041 ? x * 12.92310 : 1.055 * exp(log(x) / 2.39990) - 0.055;//calculate with calcgamma + // return x <= 0.003041 ? x * 12.92310 : 1.055 * exp(log(x) / 2.39990) - 0.055;//calculate with calcgamma //return x <= 0.0031308 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//standard discontinuous - //very small differences between the 2 + //very small differences between the 2 return x <= 0.003040 ? x * 12.92310 : 1.055 * exp(log(x) / sRGBGammaCurve) - 0.055;//continuous - // return x <= 0.003041 ? x * 12.92310 : 1.055011 * exp(log(x) / sRGBGammaCurve) - 0.055011;//continuous - + // return x <= 0.003041 ? x * 12.92310 : 1.055011 * exp(log(x) / sRGBGammaCurve) - 0.055011;//continuous } @@ -1081,12 +1087,11 @@ public: */ static inline double igamma2 (double x) //g2 { - // return x <= 0.039289 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * 2.39990);//calculate with calcgamma - // return x <= 0.04045 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//standard discontinuous - //very small differences between the 4 + // return x <= 0.039289 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * 2.39990);//calculate with calcgamma + // return x <= 0.04045 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//standard discontinuous + //very small differences between the 4 return x <= 0.039286 ? x / 12.92310 : exp(log((x + 0.055) / 1.055) * sRGBGammaCurve);//continuous - // return x <= 0.039293 ? x / 12.92310 : exp(log((x + 0.055011) / 1.055011) * sRGBGammaCurve);//continuous - + // return x <= 0.039293 ? x / 12.92310 : exp(log((x + 0.055011) / 1.055011) * sRGBGammaCurve);//continuous } diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index d2c68e2e8..ef209118b 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2417,59 +2417,78 @@ void CLASS hasselblad_correct() void CLASS hasselblad_load_raw() { - struct jhead jh; - int shot, row, col, *back[5], len[2], diff[12], pred, sh, f, s, c; - unsigned upix, urow, ucol; - ushort *ip; + struct jhead jh; + int *back[5], diff[12]; - if (!ljpeg_start (&jh, 0)) return; - 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()"); - FORC3 back[c] = back[4] + c*raw_width; - cblack[6] >>= sh = tiff_samples > 1; - shot = LIM(shot_select, 1, tiff_samples) - 1; - for (row=0; row < raw_height; row++) { - FORC4 back[(c+3) & 3] = back[c]; - for (col=0; col < raw_width; col+=2) { - for (s=0; s < tiff_samples*2; s+=2) { - FORC(2) len[c] = ph1_huff(jh.huff[0]); - FORC(2) { - diff[s+c] = hb_bits(len[c]); - if ((diff[s+c] & (1 << (len[c]-1))) == 0) - diff[s+c] -= (1 << len[c]) - 1; - if (diff[s+c] == 65535) diff[s+c] = -32768; - } - } - for (s=col; s < col+2; s++) { - pred = 0x8000 + load_flags; - if (col) pred = back[2][s-2]; - if (col && row > 1) switch (jh.psv) { - case 11: pred += back[0][s]/2 - back[0][s-2]/2; break; - } - f = (row & 1)*3 ^ ((col+s) & 1); - FORC (tiff_samples) { - pred += diff[(s & 1)*tiff_samples+c]; - upix = pred >> sh & 0xffff; - if (raw_image && c == shot) - RAW(row,s) = upix; - if (image) { - urow = row-top_margin + (c & 1); - ucol = col-left_margin - ((c >> 1) & 1); - ip = &image[urow*width+ucol][f]; - if (urow < height && ucol < width) - *ip = c < 4 ? upix : (*ip + upix) >> 1; - } - } - back[2][s] = pred; - } + if (!ljpeg_start (&jh, 0)) { + return; + } + 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; + for (int row = 0; row < raw_height; ++row) { + for (int c = 0; c < 4; ++c) { + back[(c + 3) & 3] = back[c]; + } + for (int col = 0; col < raw_width; col += 2) { + for (int s = 0; s < tiff_samples * 2; s += 2) { + const int len[2]= { + static_cast(ph1_huff(jh.huff[0])), + static_cast(ph1_huff(jh.huff[0])) + }; + for (int c = 0; c < 2; ++c) { + diff[s + c] = hb_bits(len[c]); + if ((diff[s + c] & (1 << (len[c] - 1))) == 0) { + diff[s + c] -= (1 << len[c]) - 1; + } + if (diff[s + c] == 65535) { + diff[s + c] = -32768; + } + } + } + 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; + } + for (int c = 0; c < tiff_samples; ++c) { + pred += diff[(s & 1) * tiff_samples + c]; + const unsigned upix = pred >> sh & 0xffff; + if (raw_image && c == shot) { + RAW(row, s) = upix; + } + if (image) { + const int f = (row & 1) * 3 ^ ((col + s) & 1); + const unsigned urow = row - top_margin + (c & 1); + const unsigned ucol = col - left_margin - ((c >> 1) & 1); + ushort* const ip = &image[urow * width + ucol][f]; + if (urow < height && ucol < width) { + *ip = c < 4 ? upix : (*ip + upix) >> 1; + } + } + } + back[2][s] = pred; + } + } + } + free(back[4]); + ljpeg_end(&jh); + if (image) { + mix_green = 1; } - } - free (back[4]); - ljpeg_end (&jh); - if (image) mix_green = 1; } void CLASS leaf_hdr_load_raw() diff --git a/rtengine/guidedfilter.cc b/rtengine/guidedfilter.cc index 0ebe6c172..159e89504 100644 --- a/rtengine/guidedfilter.cc +++ b/rtengine/guidedfilter.cc @@ -3,6 +3,7 @@ * This file is part of RawTherapee. * * Copyright (c) 2018 Alberto Griggio + * Optimized 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 @@ -16,9 +17,9 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - */ +*/ -/** +/* * This is a Fast Guided Filter implementation, derived directly from the * pseudo-code of the paper: * @@ -26,32 +27,16 @@ * by Kaiming He, Jian Sun * * available at https://arxiv.org/abs/1505.00996 - */ +*/ #include "guidedfilter.h" #include "boxblur.h" #include "rescale.h" #include "imagefloat.h" - +#define BENCHMARK +#include "StopWatch.h" namespace rtengine { -#if 0 -# define DEBUG_DUMP(arr) \ - do { \ - Imagefloat im(arr.width(), arr.height()); \ - const char *out = "/tmp/" #arr ".tif"; \ - for (int y = 0; y < im.getHeight(); ++y) { \ - for (int x = 0; x < im.getWidth(); ++x) { \ - im.r(y, x) = im.g(y, x) = im.b(y, x) = arr[y][x] * 65535.f; \ - } \ - } \ - im.saveTIFF(out, 16); \ - } while (false) -#else -# define DEBUG_DUMP(arr) -#endif - - namespace { int calculate_subsampling(int w, int h, int r) @@ -78,18 +63,10 @@ int calculate_subsampling(int w, int h, int r) void guidedFilter(const array2D &guide, const array2D &src, array2D &dst, int r, float epsilon, bool multithread, int subsampling) { - - const int W = src.width(); - const int H = src.height(); - - if (subsampling <= 0) { - subsampling = calculate_subsampling(W, H, r); - } - - enum Op { MUL, DIVEPSILON, ADD, SUB, ADDMUL, SUBMUL }; + enum Op {MUL, DIVEPSILON, SUBMUL}; const auto apply = - [=](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void + [multithread, epsilon](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void { const int w = res.width(); const int h = res.height(); @@ -99,137 +76,109 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 #endif for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { - float r; - float aa = a[y][x]; - float bb = b[y][x]; switch (op) { - case MUL: - r = aa * bb; - break; - case DIVEPSILON: - r = aa / (bb + epsilon); - break; - case ADD: - r = aa + bb; - break; - case SUB: - r = aa - bb; - break; - case ADDMUL: - r = aa * bb + c[y][x]; - break; - case SUBMUL: - r = c[y][x] - (aa * bb); - break; - default: - assert(false); - r = 0; - break; + case MUL: + res[y][x] = a[y][x] * b[y][x]; + break; + case DIVEPSILON: + res[y][x] = a[y][x] / (b[y][x] + epsilon); // note: the value of epsilon intentionally has an impact on the result. It is not only to avoid divisions by zero + break; + case SUBMUL: + res[y][x] = c[y][x] - (a[y][x] * b[y][x]); + break; + default: + assert(false); + res[y][x] = 0; + break; } - res[y][x] = r; } } }; - // use the terminology of the paper (Algorithm 2) - const array2D &I = guide; - const array2D &p = src; - array2D &q = dst; - const auto f_subsample = - [=](array2D &d, const array2D &s) -> void + [multithread](array2D &d, const array2D &s) -> void { rescaleBilinear(s, d, multithread); }; - const auto f_upsample = f_subsample; - - const size_t w = W / subsampling; - const size_t h = H / subsampling; - - AlignedBuffer blur_buf(w * h); const auto f_mean = - [&](array2D &d, array2D &s, int rad) -> void + [multithread](array2D &d, array2D &s, int rad) -> void { rad = LIM(rad, 0, (min(s.width(), s.height()) - 1) / 2 - 1); - float **src = s; - float **dst = d; -#ifdef _OPENMP - #pragma omp parallel if (multithread) -#endif - boxblur(src, dst, blur_buf.data, rad, rad, s.width(), s.height()); + boxblur(s, d, rad, s.width(), s.height(), multithread); }; + const int W = src.width(); + const int H = src.height(); + + if (subsampling <= 0) { + subsampling = calculate_subsampling(W, H, r); + } + + const size_t w = W / subsampling; + const size_t h = H / subsampling; + const float r1 = float(r) / subsampling; + array2D I1(w, h); array2D p1(w, h); - f_subsample(I1, I); - f_subsample(p1, p); + f_subsample(I1, guide); - DEBUG_DUMP(I); - DEBUG_DUMP(p); - DEBUG_DUMP(I1); - DEBUG_DUMP(p1); + if (&guide == &src) { + f_mean(p1, I1, r1); - float r1 = float(r) / subsampling; + apply(MUL, I1, I1, I1); // I1 = I1 * I1 - array2D meanI(w, h); - f_mean(meanI, I1, r1); - DEBUG_DUMP(meanI); + f_mean(I1, I1, r1); - array2D meanp(w, h); - f_mean(meanp, p1, r1); - DEBUG_DUMP(meanp); + apply(SUBMUL, I1, p1, p1, I1); // I1 = I1 - p1 * p1 + apply(DIVEPSILON, I1, I1, I1); // I1 = I1 / (I1 + epsilon) + apply(SUBMUL, p1, I1, p1, p1); // p1 = p1 - I1 * p1 - array2D &corrIp = p1; - apply(MUL, corrIp, I1, p1); - f_mean(corrIp, corrIp, r1); - DEBUG_DUMP(corrIp); + } else { + f_subsample(p1, src); - array2D &corrI = I1; - apply(MUL, corrI, I1, I1); - f_mean(corrI, corrI, r1); - DEBUG_DUMP(corrI); + array2D meanI(w, h); + f_mean(meanI, I1, r1); - array2D &varI = corrI; - apply(SUBMUL, varI, meanI, meanI, corrI); - DEBUG_DUMP(varI); + array2D meanp(w, h); + f_mean(meanp, p1, r1); - array2D &covIp = corrIp; - apply(SUBMUL, covIp, meanI, meanp, corrIp); - DEBUG_DUMP(covIp); + apply(MUL, p1, I1, p1); - array2D &a = varI; - apply(DIVEPSILON, a, covIp, varI); - DEBUG_DUMP(a); + f_mean(p1, p1, r1); - array2D &b = covIp; - apply(SUBMUL, b, a, meanI, meanp); - DEBUG_DUMP(b); + apply(MUL, I1, I1, I1); - meanI.free(); // frees w * h * 4 byte - meanp.free(); // frees w * h * 4 byte + f_mean(I1, I1, r1); - array2D &meana = a; - f_mean(meana, a, r1); - DEBUG_DUMP(meana); + apply(SUBMUL, I1, meanI, meanI, I1); + apply(SUBMUL, p1, meanI, meanp, p1); + apply(DIVEPSILON, I1, p1, I1); + apply(SUBMUL, p1, I1, meanI, meanp); + } - array2D &meanb = b; - f_mean(meanb, b, r1); - DEBUG_DUMP(meanb); + f_mean(I1, I1, r1); + f_mean(p1, p1, r1); - blur_buf.resize(0); // frees w * h * 4 byte + const int Ws = I1.width(); + const int Hs = I1.height(); + const int Wd = dst.width(); + const int Hd = dst.height(); - array2D meanA(W, H); - f_upsample(meanA, meana); - DEBUG_DUMP(meanA); + const float col_scale = static_cast(Ws) / static_cast(Wd); + const float row_scale = static_cast(Hs) / static_cast(Hd); - array2D &meanB = q; - f_upsample(meanB, meanb); - DEBUG_DUMP(meanB); +#ifdef _OPENMP + #pragma omp parallel for if (multithread) +#endif - apply(ADDMUL, q, meanA, I, meanB); - DEBUG_DUMP(q); + for (int y = 0; y < Hd; ++y) { + const float ymrs = y * row_scale; + for (int x = 0; x < Wd; ++x) { + dst[y][x] = getBilinearValue(I1, x * col_scale, ymrs) * guide[y][x] + getBilinearValue(p1, x * col_scale, ymrs); + } + } } } // namespace rtengine diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 84da1cacc..3a3d461a0 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -67,14 +67,14 @@ class ImProcFunctions void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap); - bool needsCA(); - bool needsDistortion(); - bool needsRotation(); - bool needsPerspective(); - bool needsGradient(); - bool needsVignetting(); - bool needsLCP(); - bool needsLensfun(); + bool needsCA() const; + bool needsDistortion() const; + bool needsRotation() const; + bool needsPerspective() const; + bool needsGradient() const; + bool needsVignetting() const; + bool needsLCP() const; + bool needsLensfun() const; // static cmsUInt8Number* Mempro = NULL; @@ -99,8 +99,8 @@ public: } void setScale(double iscale); - bool needsTransform(); - bool needsPCVignetting(); + bool needsTransform() const; + bool needsPCVignetting() const; void firstAnalysis(const Imagefloat* const working, const procparams::ProcParams ¶ms, LUTu & vhist16); void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); @@ -247,11 +247,11 @@ public: // CieImage *ciec; void workingtrc(const Imagefloat* src, Imagefloat* dst, int cw, int ch, int mul, const Glib::ustring &profile, double gampos, double slpos, cmsHTRANSFORM &transform, bool normalizeIn = true, bool normalizeOut = true, bool keepTransForm = false) const; - bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); - bool transCoord(int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); + bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr) const; + bool transCoord(int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr) const; static void getAutoExp(const LUTu & histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); static double getAutoDistor(const Glib::ustring& fname, int thumb_size); - double getTransformAutoFill(int oW, int oH, const LensCorrection *pLCPMap = nullptr); + double getTransformAutoFill(int oW, int oH, const LensCorrection *pLCPMap = nullptr) const; void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); }; diff --git a/rtengine/ipdehaze.cc b/rtengine/ipdehaze.cc index 60d4cb9ff..e7bf71ba6 100644 --- a/rtengine/ipdehaze.cc +++ b/rtengine/ipdehaze.cc @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - */ +*/ /* * Haze removal using the algorithm described in the paper: @@ -26,15 +26,16 @@ * * using a guided filter for the "soft matting" of the transmission map * - */ +*/ +#include #include -#include +#include #include "guidedfilter.h" #include "improcfun.h" #include "procparams.h" -#include "rt_algo.h" +#include "rescale.h" #include "rt_math.h" extern Options options; @@ -43,24 +44,103 @@ namespace rtengine { namespace { -#if 0 -# define DEBUG_DUMP(arr) \ - do { \ - Imagefloat im(arr.width(), arr.height()); \ - const char *out = "/tmp/" #arr ".tif"; \ - for (int y = 0; y < im.getHeight(); ++y) { \ - for (int x = 0; x < im.getWidth(); ++x) { \ - im.r(y, x) = im.g(y, x) = im.b(y, x) = arr[y][x] * 65535.f; \ - } \ - } \ - im.saveTIFF(out, 16); \ - } while (false) -#else -# define DEBUG_DUMP(arr) +float normalize(Imagefloat *rgb, bool multithread) +{ + float maxval = 0.f; + const int W = rgb->getWidth(); + const int H = rgb->getHeight(); +#ifdef _OPENMP + #pragma omp parallel for reduction(max:maxval) schedule(dynamic, 16) if (multithread) #endif + for (int y = 0; y < H; ++y) { + for (int x = 0; x < W; ++x) { + maxval = max(maxval, rgb->r(y, x), rgb->g(y, x), rgb->b(y, x)); + } + } + maxval = max(maxval * 2.f, 65535.f); +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic, 16) if (multithread) +#endif + for (int y = 0; y < H; ++y) { + for (int x = 0; x < W; ++x) { + rgb->r(y, x) /= maxval; + rgb->g(y, x) /= maxval; + rgb->b(y, x) /= maxval; + } + } + return maxval; +} +void restore(Imagefloat *rgb, float maxval, bool multithread) +{ + const int W = rgb->getWidth(); + const int H = rgb->getHeight(); + if (maxval > 0.f && maxval != 1.f) { +#ifdef _OPENMP +# pragma omp parallel for if (multithread) +#endif + for (int y = 0; y < H; ++y) { + for (int x = 0; x < W; ++x) { + rgb->r(y, x) *= maxval; + rgb->g(y, x) *= maxval; + rgb->b(y, x) *= maxval; + } + } + } +} -int get_dark_channel(const array2D &R, const array2D &G, const array2D &B, array2D &dst, int patchsize, const float ambient[3], bool clip, bool multithread) +int get_dark_channel(const array2D &R, const array2D &G, const array2D &B, const array2D &dst, int patchsize, const float ambient[3], bool clip, bool multithread, float strength) +{ + const int W = R.width(); + const int H = R.height(); + +#ifdef _OPENMP + #pragma omp parallel for if (multithread) +#endif + for (int y = 0; y < H; y += patchsize) { + const int pH = min(y + patchsize, H); + for (int x = 0; x < W; x += patchsize) { + float minR = RT_INFINITY_F; + float minG = RT_INFINITY_F; + float minB = RT_INFINITY_F; +#ifdef __SSE2__ + vfloat minRv = F2V(minR); + vfloat minGv = F2V(minG); + vfloat minBv = F2V(minB); +#endif + const int pW = min(x + patchsize, W); + for (int yy = y; yy < pH; ++yy) { + int xx = x; +#ifdef __SSE2__ + for (; xx < pW - 3; xx += 4) { + minRv = vminf(minRv, LVFU(R[yy][xx])); + minGv = vminf(minGv, LVFU(G[yy][xx])); + minBv = vminf(minBv, LVFU(B[yy][xx])); + } +#endif + for (; xx < pW; ++xx) { + minR = min(minR, R[yy][xx]); + minG = min(minG, G[yy][xx]); + minB = min(minB, B[yy][xx]); + } + } +#ifdef __SSE2__ + minR = min(minR, vhmin(minRv)); + minG = min(minG, vhmin(minGv)); + minB = min(minB, vhmin(minBv)); +#endif + float val = min(minR / ambient[0], minG / ambient[1], minB / ambient[2]); + val = 1.f - strength * LIM01(val); + for (int yy = y; yy < pH; ++yy) { + std::fill(dst[yy] + x, dst[yy] + pW, val); + } + } + } + + return (W / patchsize + ((W % patchsize) > 0)) * (H / patchsize + ((H % patchsize) > 0)); +} + +int get_dark_channel_downsized(const array2D &R, const array2D &G, const array2D &B, const array2D &dst, int patchsize, bool multithread) { const int W = R.width(); const int H = R.height(); @@ -73,22 +153,11 @@ int get_dark_channel(const array2D &R, const array2D &G, const arr for (int x = 0; x < W; x += patchsize) { float val = RT_INFINITY_F; const int pW = min(x + patchsize, W); - for (int yy = y; yy < pH; ++yy) { - for (int xx = x; xx < pW; ++xx) { - float r = R[yy][xx]; - float g = G[yy][xx]; - float b = B[yy][xx]; - if (ambient) { - r /= ambient[0]; - g /= ambient[1]; - b /= ambient[2]; - } - val = min(val, r, g, b); + for (int xx = x; xx < pW; ++xx) { + for (int yy = y; yy < pH; ++yy) { + val = min(val, R[yy][xx], G[yy][xx], B[yy][xx]); } } - if (clip) { - val = LIM01(val); - } for (int yy = y; yy < pH; ++yy) { std::fill(dst[yy] + x, dst[yy] + pW, val); } @@ -98,33 +167,24 @@ int get_dark_channel(const array2D &R, const array2D &G, const arr return (W / patchsize + ((W % patchsize) > 0)) * (H / patchsize + ((H % patchsize) > 0)); } - float estimate_ambient_light(const array2D &R, const array2D &G, const array2D &B, const array2D &dark, int patchsize, int npatches, float ambient[3]) { const int W = R.width(); const int H = R.height(); - const auto get_percentile = - [](std::priority_queue &q, float prcnt) -> float - { - size_t n = LIM(q.size() * prcnt, 1, q.size()); - while (q.size() > n) { - q.pop(); - } - return q.top(); - }; - float darklim = RT_INFINITY_F; { - std::priority_queue p; + std::vector p; for (int y = 0; y < H; y += patchsize) { for (int x = 0; x < W; x += patchsize) { if (!OOG(dark[y][x], 1.f - 1e-5f)) { - p.push(dark[y][x]); + p.push_back(dark[y][x]); } } } - darklim = get_percentile(p, 0.95); + const int pos = p.size() * 0.95; + std::nth_element(p.begin(), p.begin() + pos, p.end()); + darklim = p[pos]; } std::vector> patches; @@ -145,7 +205,8 @@ float estimate_ambient_light(const array2D &R, const array2D &G, c float bright_lim = RT_INFINITY_F; { - std::priority_queue l; + std::vector l; + l.reserve(patches.size() * patchsize * patchsize); for (auto &p : patches) { const int pW = min(p.first+patchsize, W); @@ -153,12 +214,13 @@ float estimate_ambient_light(const array2D &R, const array2D &G, c for (int y = p.second; y < pH; ++y) { for (int x = p.first; x < pW; ++x) { - l.push(R[y][x] + G[y][x] + B[y][x]); + l.push_back(R[y][x] + G[y][x] + B[y][x]); } } } - - bright_lim = get_percentile(l, 0.95); + const int pos = l.size() * 0.95; + std::nth_element(l.begin(), l.begin() + pos, l.end()); + bright_lim = l[pos]; } double rr = 0, gg = 0, bb = 0; @@ -190,7 +252,6 @@ float estimate_ambient_light(const array2D &R, const array2D &G, c return darklim > 0 ? -1.125f * std::log(darklim) : std::log(std::numeric_limits::max()) / 2; } - void extract_channels(Imagefloat *img, array2D &r, array2D &g, array2D &b, int radius, float epsilon, bool multithread) { const int W = img->getWidth(); @@ -211,12 +272,12 @@ void extract_channels(Imagefloat *img, array2D &r, array2D &g, arr void ImProcFunctions::dehaze(Imagefloat *img) { - if (!params->dehaze.enabled) { + if (!params->dehaze.enabled || params->dehaze.strength == 0.0) { return; } - img->normalizeFloatTo1(); - + const float maxChannel = normalize(img, multiThread); + const int W = img->getWidth(); const int H = img->getHeight(); const float strength = LIM01(float(params->dehaze.strength) / 100.f * 0.9f); @@ -229,21 +290,47 @@ void ImProcFunctions::dehaze(Imagefloat *img) int patchsize = max(int(5 / scale), 2); float ambient[3]; - array2D &t_tilde = dark; - float max_t = 0.f; + float maxDistance = 0.f; { - int npatches = 0; - array2D R(W, H); + array2D& R = dark; // R and dark can safely use the same buffer, which is faster and reduces memory allocations/deallocations array2D G(W, H); array2D B(W, H); extract_channels(img, R, G, B, patchsize, 1e-1, multiThread); - - patchsize = max(max(W, H) / 600, 2); - npatches = get_dark_channel(R, G, B, dark, patchsize, nullptr, false, multiThread); - DEBUG_DUMP(dark); - max_t = estimate_ambient_light(R, G, B, dark, patchsize, npatches, ambient); + { + constexpr int sizecap = 200; + const float r = static_cast(W) / static_cast(H); + const int hh = r >= 1.f ? sizecap : sizecap / r; + const int ww = r >= 1.f ? sizecap * r : sizecap; + + if (W <= ww && H <= hh) { + // don't rescale small thumbs + array2D D(W, H); + const int npatches = get_dark_channel_downsized(R, G, B, D, 2, multiThread); + maxDistance = estimate_ambient_light(R, G, B, D, patchsize, npatches, ambient); + } else { + array2D RR(ww, hh); + array2D GG(ww, hh); + array2D BB(ww, hh); + rescaleNearest(R, RR, multiThread); + rescaleNearest(G, GG, multiThread); + rescaleNearest(B, BB, multiThread); + array2D D(ww, hh); + + const int npatches = get_dark_channel_downsized(RR, GG, BB, D, 2, multiThread); + maxDistance = estimate_ambient_light(RR, GG, BB, D, patchsize, npatches, ambient); + } + } + + if (min(ambient[0], ambient[1], ambient[2]) < 0.01f) { + if (options.rtSettings.verbose) { + std::cout << "dehaze: no haze detected" << std::endl; + } + restore(img, maxChannel, multiThread); + return; // probably no haze at all + } + patchsize = max(max(W, H) / 600, 2); if (options.rtSettings.verbose) { std::cout << "dehaze: ambient light is " @@ -251,78 +338,95 @@ void ImProcFunctions::dehaze(Imagefloat *img) << std::endl; } - get_dark_channel(R, G, B, dark, patchsize, ambient, true, multiThread); - } - - if (min(ambient[0], ambient[1], ambient[2]) < 0.01f) { - if (options.rtSettings.verbose) { - std::cout << "dehaze: no haze detected" << std::endl; - } - img->normalizeFloatTo65535(); - return; // probably no haze at all - } - - DEBUG_DUMP(t_tilde); - -#ifdef _OPENMP - #pragma omp parallel for if (multiThread) -#endif - for (int y = 0; y < H; ++y) { - for (int x = 0; x < W; ++x) { - dark[y][x] = 1.f - strength * dark[y][x]; - } + get_dark_channel(R, G, B, dark, patchsize, ambient, true, multiThread, strength); } const int radius = patchsize * 4; - const float epsilon = 1e-5; - array2D &t = t_tilde; + constexpr float epsilon = 1e-5f; - { - array2D guideB(W, H, img->b.ptrs, ARRAY2D_BYREFERENCE); - guidedFilter(guideB, t_tilde, t, radius, epsilon, multiThread); - } + array2D guideB(W, H, img->b.ptrs, ARRAY2D_BYREFERENCE); + guidedFilter(guideB, dark, dark, radius, epsilon, multiThread); - DEBUG_DUMP(t); - if (options.rtSettings.verbose) { - std::cout << "dehaze: max distance is " << max_t << std::endl; + std::cout << "dehaze: max distance is " << maxDistance << std::endl; } - float depth = -float(params->dehaze.depth) / 100.f; - const float t0 = max(1e-3f, std::exp(depth * max_t)); + const float depth = -float(params->dehaze.depth) / 100.f; + const float t0 = max(1e-3f, std::exp(depth * maxDistance)); const float teps = 1e-3f; + + const bool luminance = params->dehaze.luminance; + const TMatrix ws = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); +#ifdef __SSE2__ + const vfloat wsv[3] = {F2V(ws[1][0]), F2V(ws[1][1]),F2V(ws[1][2])}; +#endif + const float ambientY = Color::rgbLuminance(ambient[0], ambient[1], ambient[2], ws); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif for (int y = 0; y < H; ++y) { - for (int x = 0; x < W; ++x) { + int x = 0; +#ifdef __SSE2__ + const vfloat onev = F2V(1.f); + const vfloat ambient0v = F2V(ambient[0]); + const vfloat ambient1v = F2V(ambient[1]); + const vfloat ambient2v = F2V(ambient[2]); + const vfloat ambientYv = F2V(ambientY); + const vfloat epsYv = F2V(1e-5f); + const vfloat t0v = F2V(t0); + const vfloat tepsv = F2V(teps); + const vfloat cmaxChannelv = F2V(maxChannel); + for (; x < W - 3; x += 4) { // ensure that the transmission is such that to avoid clipping... - float rgb[3] = { img->r(y, x), img->g(y, x), img->b(y, x) }; + const vfloat r = LVFU(img->r(y, x)); + const vfloat g = LVFU(img->g(y, x)); + const vfloat b = LVFU(img->b(y, x)); // ... t >= tl to avoid negative values - float tl = 1.f - min(rgb[0]/ambient[0], rgb[1]/ambient[1], rgb[2]/ambient[2]); - // ... t >= tu to avoid values > 1 - float tu = t0 - teps; - for (int c = 0; c < 3; ++c) { - if (ambient[c] < 1) { - tu = max(tu, (rgb[c] - ambient[c])/(1.f - ambient[c])); - } - } - float mt = max(t[y][x], t0, tl + teps, tu + teps); + const vfloat tlv = onev - vminf(r / ambient0v, vminf(g / ambient1v, b / ambient2v)); + const vfloat mtv = vmaxf(LVFU(dark[y][x]), vmaxf(tlv + tepsv, t0v)); if (params->dehaze.showDepthMap) { - img->r(y, x) = img->g(y, x) = img->b(y, x) = LIM01(1.f - mt); + const vfloat valv = vclampf(onev - mtv, ZEROV, onev) * cmaxChannelv; + STVFU(img->r(y, x), valv); + STVFU(img->g(y, x), valv); + STVFU(img->b(y, x), valv); + } else if (luminance) { + const vfloat Yv = Color::rgbLuminance(r, g, b, wsv); + const vfloat YYv = (Yv - ambientYv) / mtv + ambientYv; + const vfloat fv = vself(vmaskf_gt(Yv, epsYv), cmaxChannelv * YYv / Yv, cmaxChannelv); + STVFU(img->r(y, x), r * fv); + STVFU(img->g(y, x), g * fv); + STVFU(img->b(y, x), b * fv); } else { - float r = (rgb[0] - ambient[0]) / mt + ambient[0]; - float g = (rgb[1] - ambient[1]) / mt + ambient[1]; - float b = (rgb[2] - ambient[2]) / mt + ambient[2]; - - img->r(y, x) = r; - img->g(y, x) = g; - img->b(y, x) = b; + STVFU(img->r(y, x), ((r - ambient0v) / mtv + ambient0v) * cmaxChannelv); + STVFU(img->g(y, x), ((g - ambient1v) / mtv + ambient1v) * cmaxChannelv); + STVFU(img->b(y, x), ((b - ambient2v) / mtv + ambient2v) * cmaxChannelv); + } + } +#endif + for (; x < W; ++x) { + // ensure that the transmission is such that to avoid clipping... + const float r = img->r(y, x); + const float g = img->g(y, x); + const float b = img->b(y, x); + // ... t >= tl to avoid negative values + const float tl = 1.f - min(r / ambient[0], g / ambient[1], b / ambient[2]); + const float mt = max(dark[y][x], t0, tl + teps); + if (params->dehaze.showDepthMap) { + img->r(y, x) = img->g(y, x) = img->b(y, x) = LIM01(1.f - mt) * maxChannel; + } else if (luminance) { + const float Y = Color::rgbLuminance(img->r(y, x), img->g(y, x), img->b(y, x), ws); + const float YY = (Y - ambientY) / mt + ambientY; + const float f = Y > 1e-5f ? maxChannel * YY / Y : maxChannel; + img->r(y, x) *= f; + img->g(y, x) *= f; + img->b(y, x) *= f; + } else { + img->r(y, x) = ((r - ambient[0]) / mt + ambient[0]) * maxChannel; + img->g(y, x) = ((g - ambient[1]) / mt + ambient[1]) * maxChannel; + img->b(y, x) = ((b - ambient[2]) / mt + ambient[2]) * maxChannel; } } } - - img->normalizeFloatTo65535(); } diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 99fd39f7e..69b57d0ba 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -208,7 +208,7 @@ namespace rtengine #define CLIPTOC(a,b,c,d) ((a)>=(b)?((a)<=(c)?(a):(d=true,(c))):(d=true,(b))) bool ImProcFunctions::transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef, - const LensCorrection *pLCPMap) + const LensCorrection *pLCPMap) const { bool clipped = false; @@ -310,7 +310,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector &src, } // Transform all corners and critical sidelines of an image -bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef, const LensCorrection *pLCPMap) +bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef, const LensCorrection *pLCPMap) const { const int DivisionsPerBorder = 32; @@ -1113,7 +1113,7 @@ void ImProcFunctions::transformLCPCAOnly(Imagefloat *original, Imagefloat *trans } -double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap) +double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap) const { if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective() && (!params->lensProf.useDist || pLCPMap == nullptr)) { return 1; @@ -1137,52 +1137,52 @@ double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrecti return scaleL; } -bool ImProcFunctions::needsCA () +bool ImProcFunctions::needsCA () const { return fabs (params->cacorrection.red) > 1e-15 || fabs (params->cacorrection.blue) > 1e-15; } -bool ImProcFunctions::needsDistortion () +bool ImProcFunctions::needsDistortion () const { return fabs (params->distortion.amount) > 1e-15; } -bool ImProcFunctions::needsRotation () +bool ImProcFunctions::needsRotation () const { return fabs (params->rotate.degree) > 1e-15; } -bool ImProcFunctions::needsPerspective () +bool ImProcFunctions::needsPerspective () const { return params->perspective.horizontal || params->perspective.vertical; } -bool ImProcFunctions::needsGradient () +bool ImProcFunctions::needsGradient () const { return params->gradient.enabled && fabs (params->gradient.strength) > 1e-15; } -bool ImProcFunctions::needsPCVignetting () +bool ImProcFunctions::needsPCVignetting () const { return params->pcvignette.enabled && fabs (params->pcvignette.strength) > 1e-15; } -bool ImProcFunctions::needsVignetting () +bool ImProcFunctions::needsVignetting () const { return params->vignetting.amount; } -bool ImProcFunctions::needsLCP () +bool ImProcFunctions::needsLCP () const { return params->lensProf.useLcp(); } -bool ImProcFunctions::needsLensfun() +bool ImProcFunctions::needsLensfun() const { return params->lensProf.useLensfun(); } -bool ImProcFunctions::needsTransform () +bool ImProcFunctions::needsTransform () const { return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsLensfun(); } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 33615b84b..74e9526e1 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2527,7 +2527,8 @@ DehazeParams::DehazeParams() : enabled(false), strength(50), showDepthMap(false), - depth(25) + depth(25), + luminance(false) { } @@ -2537,7 +2538,8 @@ bool DehazeParams::operator ==(const DehazeParams& other) const enabled == other.enabled && strength == other.strength && showDepthMap == other.showDepthMap - && depth == other.depth; + && depth == other.depth + && luminance == other.luminance; } bool DehazeParams::operator !=(const DehazeParams& other) const @@ -3248,6 +3250,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->dehaze.strength, "Dehaze", "Strength", dehaze.strength, keyFile); saveToKeyfile(!pedited || pedited->dehaze.showDepthMap, "Dehaze", "ShowDepthMap", dehaze.showDepthMap, keyFile); saveToKeyfile(!pedited || pedited->dehaze.depth, "Dehaze", "Depth", dehaze.depth, keyFile); + saveToKeyfile(!pedited || pedited->dehaze.depth, "Dehaze", "Luminance", dehaze.luminance, keyFile); // Directional pyramid denoising saveToKeyfile(!pedited || pedited->dirpyrDenoise.enabled, "Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled, keyFile); @@ -4890,6 +4893,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Dehaze", "Strength", pedited, dehaze.strength, pedited->dehaze.strength); assignFromKeyfile(keyFile, "Dehaze", "ShowDepthMap", pedited, dehaze.showDepthMap, pedited->dehaze.showDepthMap); assignFromKeyfile(keyFile, "Dehaze", "Depth", pedited, dehaze.depth, pedited->dehaze.depth); + assignFromKeyfile(keyFile, "Dehaze", "Luminance", pedited, dehaze.luminance, pedited->dehaze.luminance); } if (keyFile.has_group("Film Simulation")) { diff --git a/rtengine/procparams.h b/rtengine/procparams.h index ec529ee06..734ca7556 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1343,6 +1343,7 @@ struct DehazeParams { int strength; bool showDepthMap; int depth; + bool luminance; DehazeParams(); diff --git a/rtengine/rt_algo.cc b/rtengine/rt_algo.cc index dd7783c1d..aadbac7f7 100644 --- a/rtengine/rt_algo.cc +++ b/rtengine/rt_algo.cc @@ -352,7 +352,7 @@ void buildBlendMask(const float* const * luminance, float **blend, int W, int H, contrastThreshold = calcContrastThreshold(luminance, minY, minX, tilesize); break; } else { - // in second pass we allow a variance of 4 + // in second pass we allow a variance of 8 // we additionally scan the tiles +-skip pixels around the best tile from pass 2 // Means we scan (2 * skip + 1)^2 tiles in this step to get a better hit rate // fortunately the scan is quite fast, so we use only one core and don't parallelize diff --git a/rtengine/sleef.c b/rtengine/sleef.c index cc92be108..a01aef5b9 100644 --- a/rtengine/sleef.c +++ b/rtengine/sleef.c @@ -26,29 +26,29 @@ #define pow_F(a,b) (xexpf(b*xlogf(a))) __inline int64_t doubleToRawLongBits(double d) { - union { - double f; - int64_t i; - } tmp; - tmp.f = d; - return tmp.i; + union { + double f; + int64_t i; + } tmp; + tmp.f = d; + return tmp.i; } __inline double longBitsToDouble(int64_t i) { - union { - double f; - int64_t i; - } tmp; - tmp.i = i; - return tmp.f; + union { + double f; + int64_t i; + } tmp; + tmp.i = i; + return tmp.f; } __inline double xfabs(double x) { - return longBitsToDouble(0x7fffffffffffffffLL & doubleToRawLongBits(x)); + return longBitsToDouble(0x7fffffffffffffffLL & doubleToRawLongBits(x)); } __inline double mulsign(double x, double y) { - return longBitsToDouble(doubleToRawLongBits(x) ^ (doubleToRawLongBits(y) & (1LL << 63))); + return longBitsToDouble(doubleToRawLongBits(x) ^ (doubleToRawLongBits(y) & (1LL << 63))); } __inline double sign(double d) { return mulsign(1, d); } @@ -61,827 +61,827 @@ __inline int xisminf(double x) { return x == -rtengine::RT_INFINITY; } __inline int xispinf(double x) { return x == rtengine::RT_INFINITY; } __inline double ldexpk(double x, int q) { - double u; - int m; - m = q >> 31; - m = (((m + q) >> 9) - m) << 7; - q = q - (m << 2); - u = longBitsToDouble(((int64_t)(m + 0x3ff)) << 52); - double u2 = u*u; - u2 = u2 * u2; - x = x * u2; - u = longBitsToDouble(((int64_t)(q + 0x3ff)) << 52); - return x * u; + double u; + int m; + m = q >> 31; + m = (((m + q) >> 9) - m) << 7; + q = q - (m << 2); + u = longBitsToDouble(((int64_t)(m + 0x3ff)) << 52); + double u2 = u*u; + u2 = u2 * u2; + x = x * u2; + u = longBitsToDouble(((int64_t)(q + 0x3ff)) << 52); + return x * u; } __inline double xldexp(double x, int q) { return ldexpk(x, q); } __inline int ilogbp1(double d) { - int m = d < 4.9090934652977266E-91; - d = m ? 2.037035976334486E90 * d : d; - int q = (doubleToRawLongBits(d) >> 52) & 0x7ff; - q = m ? q - (300 + 0x03fe) : q - 0x03fe; - return q; + int m = d < 4.9090934652977266E-91; + d = m ? 2.037035976334486E90 * d : d; + int q = (doubleToRawLongBits(d) >> 52) & 0x7ff; + q = m ? q - (300 + 0x03fe) : q - 0x03fe; + return q; } __inline int xilogb(double d) { - int e = ilogbp1(xfabs(d)) - 1; - e = d == 0 ? (-2147483647 - 1) : e; - e = d == rtengine::RT_INFINITY || d == -rtengine::RT_INFINITY ? 2147483647 : e; - return e; + int e = ilogbp1(xfabs(d)) - 1; + e = d == 0 ? (-2147483647 - 1) : e; + e = d == rtengine::RT_INFINITY || d == -rtengine::RT_INFINITY ? 2147483647 : e; + return e; } __inline double upper(double d) { - return longBitsToDouble(doubleToRawLongBits(d) & 0xfffffffff8000000LL); + return longBitsToDouble(doubleToRawLongBits(d) & 0xfffffffff8000000LL); } typedef struct { - double x, y; + double x, y; } double2; typedef struct { - float x, y; + float x, y; } float2; __inline double2 dd(double h, double l) { - double2 ret; - ret.x = h; ret.y = l; - return ret; + double2 ret; + ret.x = h; ret.y = l; + return ret; } __inline double2 normalize_d(double2 t) { - double2 s; + double2 s; - s.x = t.x + t.y; - s.y = t.x - s.x + t.y; + s.x = t.x + t.y; + s.y = t.x - s.x + t.y; - return s; + return s; } __inline double2 scale_d(double2 d, double s) { - double2 r; + double2 r; - r.x = d.x * s; - r.y = d.y * s; + r.x = d.x * s; + r.y = d.y * s; - return r; + return r; } __inline double2 add2_ss(double x, double y) { - double2 r; + double2 r; - r.x = x + y; - double v = r.x - x; - r.y = (x - (r.x - v)) + (y - v); + r.x = x + y; + double v = r.x - x; + r.y = (x - (r.x - v)) + (y - v); - return r; + return r; } __inline double2 add_ds(double2 x, double y) { - // |x| >= |y| + // |x| >= |y| - double2 r; + double2 r; - assert(xisnan(x.x) || xisnan(y) || xfabs(x.x) >= xfabs(y)); + assert(xisnan(x.x) || xisnan(y) || xfabs(x.x) >= xfabs(y)); - r.x = x.x + y; - r.y = x.x - r.x + y + x.y; + r.x = x.x + y; + r.y = x.x - r.x + y + x.y; - return r; + return r; } __inline double2 add2_ds(double2 x, double y) { - // |x| >= |y| + // |x| >= |y| - double2 r; + double2 r; - r.x = x.x + y; - double v = r.x - x.x; - r.y = (x.x - (r.x - v)) + (y - v); - r.y += x.y; + r.x = x.x + y; + double v = r.x - x.x; + r.y = (x.x - (r.x - v)) + (y - v); + r.y += x.y; - return r; + return r; } __inline double2 add_sd(double x, double2 y) { - // |x| >= |y| + // |x| >= |y| - double2 r; + double2 r; - assert(xisnan(x) || xisnan(y.x) || xfabs(x) >= xfabs(y.x)); + assert(xisnan(x) || xisnan(y.x) || xfabs(x) >= xfabs(y.x)); - r.x = x + y.x; - r.y = x - r.x + y.x + y.y; + r.x = x + y.x; + r.y = x - r.x + y.x + y.y; - return r; + return r; } __inline double2 add_dd(double2 x, double2 y) { - // |x| >= |y| + // |x| >= |y| - double2 r; + double2 r; - assert(xisnan(x.x) || xisnan(y.x) || xfabs(x.x) >= xfabs(y.x)); + assert(xisnan(x.x) || xisnan(y.x) || xfabs(x.x) >= xfabs(y.x)); - r.x = x.x + y.x; - r.y = x.x - r.x + y.x + x.y + y.y; + r.x = x.x + y.x; + r.y = x.x - r.x + y.x + x.y + y.y; - return r; + return r; } __inline double2 add2_dd(double2 x, double2 y) { - double2 r; + double2 r; - r.x = x.x + y.x; - double v = r.x - x.x; - r.y = (x.x - (r.x - v)) + (y.x - v); - r.y += x.y + y.y; + r.x = x.x + y.x; + double v = r.x - x.x; + r.y = (x.x - (r.x - v)) + (y.x - v); + r.y += x.y + y.y; - return r; + return r; } __inline double2 div_dd(double2 n, double2 d) { - double t = 1.0 / d.x; - double dh = upper(d.x), dl = d.x - dh; - double th = upper(t ), tl = t - th; - double nhh = upper(n.x), nhl = n.x - nhh; + double t = 1.0 / d.x; + double dh = upper(d.x), dl = d.x - dh; + double th = upper(t ), tl = t - th; + double nhh = upper(n.x), nhl = n.x - nhh; - double2 q; + double2 q; - q.x = n.x * t; + q.x = n.x * t; - double u = -q.x + nhh * th + nhh * tl + nhl * th + nhl * tl + - q.x * (1 - dh * th - dh * tl - dl * th - dl * tl); + double u = -q.x + nhh * th + nhh * tl + nhl * th + nhl * tl + + q.x * (1 - dh * th - dh * tl - dl * th - dl * tl); - q.y = t * (n.y - q.x * d.y) + u; + q.y = t * (n.y - q.x * d.y) + u; - return q; + return q; } __inline double2 mul_ss(double x, double y) { - double xh = upper(x), xl = x - xh; - double yh = upper(y), yl = y - yh; - double2 r; + double xh = upper(x), xl = x - xh; + double yh = upper(y), yl = y - yh; + double2 r; - r.x = x * y; - r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl; + r.x = x * y; + r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl; - return r; + return r; } __inline double2 mul_ds(double2 x, double y) { - double xh = upper(x.x), xl = x.x - xh; - double yh = upper(y ), yl = y - yh; - double2 r; + double xh = upper(x.x), xl = x.x - xh; + double yh = upper(y ), yl = y - yh; + double2 r; - r.x = x.x * y; - r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl + x.y * y; + r.x = x.x * y; + r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl + x.y * y; - return r; + return r; } __inline double2 mul_dd(double2 x, double2 y) { - double xh = upper(x.x), xl = x.x - xh; - double yh = upper(y.x), yl = y.x - yh; - double2 r; + double xh = upper(x.x), xl = x.x - xh; + double yh = upper(y.x), yl = y.x - yh; + double2 r; - r.x = x.x * y.x; - r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl + x.x * y.y + x.y * y.x; + r.x = x.x * y.x; + r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl + x.x * y.y + x.y * y.x; - return r; + return r; } __inline double2 squ_d(double2 x) { - double xh = upper(x.x), xl = x.x - xh; - double2 r; + double xh = upper(x.x), xl = x.x - xh; + double2 r; - r.x = x.x * x.x; - r.y = xh * xh - r.x + (xh + xh) * xl + xl * xl + x.x * (x.y + x.y); + r.x = x.x * x.x; + r.y = xh * xh - r.x + (xh + xh) * xl + xl * xl + x.x * (x.y + x.y); - return r; + return r; } __inline double2 rec_s(double d) { - double t = 1.0 / d; - double dh = upper(d), dl = d - dh; - double th = upper(t), tl = t - th; - double2 q; + double t = 1.0 / d; + double dh = upper(d), dl = d - dh; + double th = upper(t), tl = t - th; + double2 q; - q.x = t; - q.y = t * (1 - dh * th - dh * tl - dl * th - dl * tl); + q.x = t; + q.y = t * (1 - dh * th - dh * tl - dl * th - dl * tl); - return q; + return q; } __inline double2 sqrt_d(double2 d) { - double t = sqrt(d.x + d.y); - return scale_d(mul_dd(add2_dd(d, mul_ss(t, t)), rec_s(t)), 0.5); + double t = sqrt(d.x + d.y); + return scale_d(mul_dd(add2_dd(d, mul_ss(t, t)), rec_s(t)), 0.5); } __inline double atan2k(double y, double x) { - double s, t, u; - int q = 0; + double s, t, u; + int q = 0; - if (x < 0) { x = -x; q = -2; } - if (y > x) { t = x; x = y; y = -t; q += 1; } + if (x < 0) { x = -x; q = -2; } + if (y > x) { t = x; x = y; y = -t; q += 1; } - s = y / x; - t = s * s; + s = y / x; + t = s * s; - u = -1.88796008463073496563746e-05; - u = u * t + (0.000209850076645816976906797); - u = u * t + (-0.00110611831486672482563471); - u = u * t + (0.00370026744188713119232403); - u = u * t + (-0.00889896195887655491740809); - u = u * t + (0.016599329773529201970117); - u = u * t + (-0.0254517624932312641616861); - u = u * t + (0.0337852580001353069993897); - u = u * t + (-0.0407629191276836500001934); - u = u * t + (0.0466667150077840625632675); - u = u * t + (-0.0523674852303482457616113); - u = u * t + (0.0587666392926673580854313); - u = u * t + (-0.0666573579361080525984562); - u = u * t + (0.0769219538311769618355029); - u = u * t + (-0.090908995008245008229153); - u = u * t + (0.111111105648261418443745); - u = u * t + (-0.14285714266771329383765); - u = u * t + (0.199999999996591265594148); - u = u * t + (-0.333333333333311110369124); + u = -1.88796008463073496563746e-05; + u = u * t + (0.000209850076645816976906797); + u = u * t + (-0.00110611831486672482563471); + u = u * t + (0.00370026744188713119232403); + u = u * t + (-0.00889896195887655491740809); + u = u * t + (0.016599329773529201970117); + u = u * t + (-0.0254517624932312641616861); + u = u * t + (0.0337852580001353069993897); + u = u * t + (-0.0407629191276836500001934); + u = u * t + (0.0466667150077840625632675); + u = u * t + (-0.0523674852303482457616113); + u = u * t + (0.0587666392926673580854313); + u = u * t + (-0.0666573579361080525984562); + u = u * t + (0.0769219538311769618355029); + u = u * t + (-0.090908995008245008229153); + u = u * t + (0.111111105648261418443745); + u = u * t + (-0.14285714266771329383765); + u = u * t + (0.199999999996591265594148); + u = u * t + (-0.333333333333311110369124); - t = u * t * s + s; - t = q * (rtengine::RT_PI_2) + t; + t = u * t * s + s; + t = q * (rtengine::RT_PI_2) + t; - return t; + return t; } __inline double xatan2(double y, double x) { - double r = atan2k(xfabs(y), x); + double r = atan2k(xfabs(y), x); - r = mulsign(r, x); - if (xisinf(x) || x == 0) r = rtengine::RT_PI_2 - (xisinf(x) ? (sign(x) * (rtengine::RT_PI_2)) : 0); - if (xisinf(y) ) r = rtengine::RT_PI_2 - (xisinf(x) ? (sign(x) * (rtengine::RT_PI*1/4)) : 0); - if ( y == 0) r = (sign(x) == -1 ? rtengine::RT_PI : 0); + r = mulsign(r, x); + if (xisinf(x) || x == 0) r = rtengine::RT_PI_2 - (xisinf(x) ? (sign(x) * (rtengine::RT_PI_2)) : 0); + if (xisinf(y) ) r = rtengine::RT_PI_2 - (xisinf(x) ? (sign(x) * (rtengine::RT_PI*1/4)) : 0); + if ( y == 0) r = (sign(x) == -1 ? rtengine::RT_PI : 0); - return xisnan(x) || xisnan(y) ? rtengine::RT_NAN : mulsign(r, y); + return xisnan(x) || xisnan(y) ? rtengine::RT_NAN : mulsign(r, y); } __inline double xasin(double d) { - return mulsign(atan2k(xfabs(d), sqrt((1+d)*(1-d))), d); + return mulsign(atan2k(xfabs(d), sqrt((1+d)*(1-d))), d); } __inline double xacos(double d) { - return mulsign(atan2k(sqrt((1+d)*(1-d)), xfabs(d)), d) + (d < 0 ? rtengine::RT_PI : 0); + return mulsign(atan2k(sqrt((1+d)*(1-d)), xfabs(d)), d) + (d < 0 ? rtengine::RT_PI : 0); } __inline double xatan(double s) { - double t, u; - int q = 0; + double t, u; + int q = 0; - if (s < 0) { s = -s; q = 2; } - if (s > 1) { s = 1.0 / s; q |= 1; } + if (s < 0) { s = -s; q = 2; } + if (s > 1) { s = 1.0 / s; q |= 1; } - t = s * s; + t = s * s; - u = -1.88796008463073496563746e-05; - u = u * t + (0.000209850076645816976906797); - u = u * t + (-0.00110611831486672482563471); - u = u * t + (0.00370026744188713119232403); - u = u * t + (-0.00889896195887655491740809); - u = u * t + (0.016599329773529201970117); - u = u * t + (-0.0254517624932312641616861); - u = u * t + (0.0337852580001353069993897); - u = u * t + (-0.0407629191276836500001934); - u = u * t + (0.0466667150077840625632675); - u = u * t + (-0.0523674852303482457616113); - u = u * t + (0.0587666392926673580854313); - u = u * t + (-0.0666573579361080525984562); - u = u * t + (0.0769219538311769618355029); - u = u * t + (-0.090908995008245008229153); - u = u * t + (0.111111105648261418443745); - u = u * t + (-0.14285714266771329383765); - u = u * t + (0.199999999996591265594148); - u = u * t + (-0.333333333333311110369124); + u = -1.88796008463073496563746e-05; + u = u * t + (0.000209850076645816976906797); + u = u * t + (-0.00110611831486672482563471); + u = u * t + (0.00370026744188713119232403); + u = u * t + (-0.00889896195887655491740809); + u = u * t + (0.016599329773529201970117); + u = u * t + (-0.0254517624932312641616861); + u = u * t + (0.0337852580001353069993897); + u = u * t + (-0.0407629191276836500001934); + u = u * t + (0.0466667150077840625632675); + u = u * t + (-0.0523674852303482457616113); + u = u * t + (0.0587666392926673580854313); + u = u * t + (-0.0666573579361080525984562); + u = u * t + (0.0769219538311769618355029); + u = u * t + (-0.090908995008245008229153); + u = u * t + (0.111111105648261418443745); + u = u * t + (-0.14285714266771329383765); + u = u * t + (0.199999999996591265594148); + u = u * t + (-0.333333333333311110369124); - t = s + s * (t * u); + t = s + s * (t * u); - if ((q & 1) != 0) t = 1.570796326794896557998982 - t; - if ((q & 2) != 0) t = -t; + if ((q & 1) != 0) t = 1.570796326794896557998982 - t; + if ((q & 2) != 0) t = -t; - return t; + return t; } __inline double xsin(double d) { - int q; - double u, s; + int q; + double u, s; - q = (int)xrint(d * rtengine::RT_1_PI); + q = (int)xrint(d * rtengine::RT_1_PI); - d = mla(q, -PI4_A*4, d); - d = mla(q, -PI4_B*4, d); - d = mla(q, -PI4_C*4, d); + d = mla(q, -PI4_A*4, d); + d = mla(q, -PI4_B*4, d); + d = mla(q, -PI4_C*4, d); - s = d * d; + s = d * d; - if ((q & 1) != 0) d = -d; + if ((q & 1) != 0) d = -d; - u = -7.97255955009037868891952e-18; - u = mla(u, s, 2.81009972710863200091251e-15); - u = mla(u, s, -7.64712219118158833288484e-13); - u = mla(u, s, 1.60590430605664501629054e-10); - u = mla(u, s, -2.50521083763502045810755e-08); - u = mla(u, s, 2.75573192239198747630416e-06); - u = mla(u, s, -0.000198412698412696162806809); - u = mla(u, s, 0.00833333333333332974823815); - u = mla(u, s, -0.166666666666666657414808); + u = -7.97255955009037868891952e-18; + u = mla(u, s, 2.81009972710863200091251e-15); + u = mla(u, s, -7.64712219118158833288484e-13); + u = mla(u, s, 1.60590430605664501629054e-10); + u = mla(u, s, -2.50521083763502045810755e-08); + u = mla(u, s, 2.75573192239198747630416e-06); + u = mla(u, s, -0.000198412698412696162806809); + u = mla(u, s, 0.00833333333333332974823815); + u = mla(u, s, -0.166666666666666657414808); - u = mla(s, u * d, d); + u = mla(s, u * d, d); - return u; + return u; } __inline double xcos(double d) { - int q; - double u, s; + int q; + double u, s; - q = 1 + 2*(int)xrint(d * rtengine::RT_1_PI - 0.5); + q = 1 + 2*(int)xrint(d * rtengine::RT_1_PI - 0.5); - d = mla(q, -PI4_A*2, d); - d = mla(q, -PI4_B*2, d); - d = mla(q, -PI4_C*2, d); + d = mla(q, -PI4_A*2, d); + d = mla(q, -PI4_B*2, d); + d = mla(q, -PI4_C*2, d); - s = d * d; + s = d * d; - if ((q & 2) == 0) d = -d; + if ((q & 2) == 0) d = -d; - u = -7.97255955009037868891952e-18; - u = mla(u, s, 2.81009972710863200091251e-15); - u = mla(u, s, -7.64712219118158833288484e-13); - u = mla(u, s, 1.60590430605664501629054e-10); - u = mla(u, s, -2.50521083763502045810755e-08); - u = mla(u, s, 2.75573192239198747630416e-06); - u = mla(u, s, -0.000198412698412696162806809); - u = mla(u, s, 0.00833333333333332974823815); - u = mla(u, s, -0.166666666666666657414808); + u = -7.97255955009037868891952e-18; + u = mla(u, s, 2.81009972710863200091251e-15); + u = mla(u, s, -7.64712219118158833288484e-13); + u = mla(u, s, 1.60590430605664501629054e-10); + u = mla(u, s, -2.50521083763502045810755e-08); + u = mla(u, s, 2.75573192239198747630416e-06); + u = mla(u, s, -0.000198412698412696162806809); + u = mla(u, s, 0.00833333333333332974823815); + u = mla(u, s, -0.166666666666666657414808); - u = mla(s, u * d, d); + u = mla(s, u * d, d); - return u; + return u; } __inline double2 xsincos(double d) { - int q; - double u, s, t; - double2 r; + int q; + double u, s, t; + double2 r; - q = (int)xrint(d * (2 * rtengine::RT_1_PI)); + q = (int)xrint(d * (2 * rtengine::RT_1_PI)); - s = d; + s = d; - s = mla(-q, PI4_A*2, s); - s = mla(-q, PI4_B*2, s); - s = mla(-q, PI4_C*2, s); + s = mla(-q, PI4_A*2, s); + s = mla(-q, PI4_B*2, s); + s = mla(-q, PI4_C*2, s); - t = s; + t = s; - s = s * s; + s = s * s; - u = 1.58938307283228937328511e-10; - u = mla(u, s, -2.50506943502539773349318e-08); - u = mla(u, s, 2.75573131776846360512547e-06); - u = mla(u, s, -0.000198412698278911770864914); - u = mla(u, s, 0.0083333333333191845961746); - u = mla(u, s, -0.166666666666666130709393); - u = u * s * t; + u = 1.58938307283228937328511e-10; + u = mla(u, s, -2.50506943502539773349318e-08); + u = mla(u, s, 2.75573131776846360512547e-06); + u = mla(u, s, -0.000198412698278911770864914); + u = mla(u, s, 0.0083333333333191845961746); + u = mla(u, s, -0.166666666666666130709393); + u = u * s * t; - r.x = t + u; + r.x = t + u; - u = -1.13615350239097429531523e-11; - u = mla(u, s, 2.08757471207040055479366e-09); - u = mla(u, s, -2.75573144028847567498567e-07); - u = mla(u, s, 2.48015872890001867311915e-05); - u = mla(u, s, -0.00138888888888714019282329); - u = mla(u, s, 0.0416666666666665519592062); - u = mla(u, s, -0.5); + u = -1.13615350239097429531523e-11; + u = mla(u, s, 2.08757471207040055479366e-09); + u = mla(u, s, -2.75573144028847567498567e-07); + u = mla(u, s, 2.48015872890001867311915e-05); + u = mla(u, s, -0.00138888888888714019282329); + u = mla(u, s, 0.0416666666666665519592062); + u = mla(u, s, -0.5); - r.y = u * s + 1; + r.y = u * s + 1; - if ((q & 1) != 0) { s = r.y; r.y = r.x; r.x = s; } - if ((q & 2) != 0) { r.x = -r.x; } - if (((q+1) & 2) != 0) { r.y = -r.y; } + if ((q & 1) != 0) { s = r.y; r.y = r.x; r.x = s; } + if ((q & 2) != 0) { r.x = -r.x; } + if (((q+1) & 2) != 0) { r.y = -r.y; } - if (xisinf(d)) { r.x = r.y = rtengine::RT_NAN; } + if (xisinf(d)) { r.x = r.y = rtengine::RT_NAN; } - return r; + return r; } __inline double xtan(double d) { - int q; - double u, s, x; + int q; + double u, s, x; - q = (int)xrint(d * (2 * rtengine::RT_1_PI)); + q = (int)xrint(d * (2 * rtengine::RT_1_PI)); - x = mla(q, -PI4_A*2, d); - x = mla(q, -PI4_B*2, x); - x = mla(q, -PI4_C*2, x); + x = mla(q, -PI4_A*2, d); + x = mla(q, -PI4_B*2, x); + x = mla(q, -PI4_C*2, x); - s = x * x; + s = x * x; - if ((q & 1) != 0) x = -x; + if ((q & 1) != 0) x = -x; - u = 1.01419718511083373224408e-05; - u = mla(u, s, -2.59519791585924697698614e-05); - u = mla(u, s, 5.23388081915899855325186e-05); - u = mla(u, s, -3.05033014433946488225616e-05); - u = mla(u, s, 7.14707504084242744267497e-05); - u = mla(u, s, 8.09674518280159187045078e-05); - u = mla(u, s, 0.000244884931879331847054404); - u = mla(u, s, 0.000588505168743587154904506); - u = mla(u, s, 0.00145612788922812427978848); - u = mla(u, s, 0.00359208743836906619142924); - u = mla(u, s, 0.00886323944362401618113356); - u = mla(u, s, 0.0218694882853846389592078); - u = mla(u, s, 0.0539682539781298417636002); - u = mla(u, s, 0.133333333333125941821962); - u = mla(u, s, 0.333333333333334980164153); + u = 1.01419718511083373224408e-05; + u = mla(u, s, -2.59519791585924697698614e-05); + u = mla(u, s, 5.23388081915899855325186e-05); + u = mla(u, s, -3.05033014433946488225616e-05); + u = mla(u, s, 7.14707504084242744267497e-05); + u = mla(u, s, 8.09674518280159187045078e-05); + u = mla(u, s, 0.000244884931879331847054404); + u = mla(u, s, 0.000588505168743587154904506); + u = mla(u, s, 0.00145612788922812427978848); + u = mla(u, s, 0.00359208743836906619142924); + u = mla(u, s, 0.00886323944362401618113356); + u = mla(u, s, 0.0218694882853846389592078); + u = mla(u, s, 0.0539682539781298417636002); + u = mla(u, s, 0.133333333333125941821962); + u = mla(u, s, 0.333333333333334980164153); - u = mla(s, u * x, x); + u = mla(s, u * x, x); - if ((q & 1) != 0) u = 1.0 / u; + if ((q & 1) != 0) u = 1.0 / u; - if (xisinf(d)) u = rtengine::RT_NAN; + if (xisinf(d)) u = rtengine::RT_NAN; - return u; + return u; } __inline double xlog(double d) { - double x, x2, t, m; - int e; + double x, x2, t, m; + int e; - e = ilogbp1(d * 0.7071); - m = ldexpk(d, -e); + e = ilogbp1(d * 0.7071); + m = ldexpk(d, -e); - x = (m-1) / (m+1); - x2 = x * x; + x = (m-1) / (m+1); + x2 = x * x; - t = 0.148197055177935105296783; - t = mla(t, x2, 0.153108178020442575739679); - t = mla(t, x2, 0.181837339521549679055568); - t = mla(t, x2, 0.22222194152736701733275); - t = mla(t, x2, 0.285714288030134544449368); - t = mla(t, x2, 0.399999999989941956712869); - t = mla(t, x2, 0.666666666666685503450651); - t = mla(t, x2, 2); + t = 0.148197055177935105296783; + t = mla(t, x2, 0.153108178020442575739679); + t = mla(t, x2, 0.181837339521549679055568); + t = mla(t, x2, 0.22222194152736701733275); + t = mla(t, x2, 0.285714288030134544449368); + t = mla(t, x2, 0.399999999989941956712869); + t = mla(t, x2, 0.666666666666685503450651); + t = mla(t, x2, 2); - x = x * t + 0.693147180559945286226764 * e; + x = x * t + 0.693147180559945286226764 * e; - if (xisinf(d)) x = rtengine::RT_INFINITY; - if (d < 0) x = rtengine::RT_NAN; - if (d == 0) x = -rtengine::RT_INFINITY; + if (xisinf(d)) x = rtengine::RT_INFINITY; + if (d < 0) x = rtengine::RT_NAN; + if (d == 0) x = -rtengine::RT_INFINITY; - return x; + return x; } __inline double xexp(double d) { - int q = (int)xrint(d * R_LN2); - double s, u; + int q = (int)xrint(d * R_LN2); + double s, u; - s = mla(q, -L2U, d); - s = mla(q, -L2L, s); + s = mla(q, -L2U, d); + s = mla(q, -L2L, s); - u = 2.08860621107283687536341e-09; - u = mla(u, s, 2.51112930892876518610661e-08); - u = mla(u, s, 2.75573911234900471893338e-07); - u = mla(u, s, 2.75572362911928827629423e-06); - u = mla(u, s, 2.4801587159235472998791e-05); - u = mla(u, s, 0.000198412698960509205564975); - u = mla(u, s, 0.00138888888889774492207962); - u = mla(u, s, 0.00833333333331652721664984); - u = mla(u, s, 0.0416666666666665047591422); - u = mla(u, s, 0.166666666666666851703837); - u = mla(u, s, 0.5); + u = 2.08860621107283687536341e-09; + u = mla(u, s, 2.51112930892876518610661e-08); + u = mla(u, s, 2.75573911234900471893338e-07); + u = mla(u, s, 2.75572362911928827629423e-06); + u = mla(u, s, 2.4801587159235472998791e-05); + u = mla(u, s, 0.000198412698960509205564975); + u = mla(u, s, 0.00138888888889774492207962); + u = mla(u, s, 0.00833333333331652721664984); + u = mla(u, s, 0.0416666666666665047591422); + u = mla(u, s, 0.166666666666666851703837); + u = mla(u, s, 0.5); - u = s * s * u + s + 1; - u = ldexpk(u, q); + u = s * s * u + s + 1; + u = ldexpk(u, q); - if (xisminf(d)) u = 0; + if (xisminf(d)) u = 0; - return u; + return u; } __inline double2 logk(double d) { - double2 x, x2; - double m, t; - int e; + double2 x, x2; + double m, t; + int e; - e = ilogbp1(d * 0.7071); - m = ldexpk(d, -e); + e = ilogbp1(d * 0.7071); + m = ldexpk(d, -e); - x = div_dd(add2_ss(-1, m), add2_ss(1, m)); - x2 = squ_d(x); + x = div_dd(add2_ss(-1, m), add2_ss(1, m)); + x2 = squ_d(x); - t = 0.134601987501262130076155; - t = mla(t, x2.x, 0.132248509032032670243288); - t = mla(t, x2.x, 0.153883458318096079652524); - t = mla(t, x2.x, 0.181817427573705403298686); - t = mla(t, x2.x, 0.222222231326187414840781); - t = mla(t, x2.x, 0.285714285651261412873718); - t = mla(t, x2.x, 0.400000000000222439910458); - t = mla(t, x2.x, 0.666666666666666371239645); + t = 0.134601987501262130076155; + t = mla(t, x2.x, 0.132248509032032670243288); + t = mla(t, x2.x, 0.153883458318096079652524); + t = mla(t, x2.x, 0.181817427573705403298686); + t = mla(t, x2.x, 0.222222231326187414840781); + t = mla(t, x2.x, 0.285714285651261412873718); + t = mla(t, x2.x, 0.400000000000222439910458); + t = mla(t, x2.x, 0.666666666666666371239645); - return add2_dd(mul_ds(dd(0.693147180559945286226764, 2.319046813846299558417771e-17), e), - add2_dd(scale_d(x, 2), mul_ds(mul_dd(x2, x), t))); + return add2_dd(mul_ds(dd(0.693147180559945286226764, 2.319046813846299558417771e-17), e), + add2_dd(scale_d(x, 2), mul_ds(mul_dd(x2, x), t))); } __inline double expk(double2 d) { - int q = (int)rint((d.x + d.y) * R_LN2); - double2 s, t; - double u; + int q = (int)rint((d.x + d.y) * R_LN2); + double2 s, t; + double u; - s = add2_ds(d, q * -L2U); - s = add2_ds(s, q * -L2L); + s = add2_ds(d, q * -L2U); + s = add2_ds(s, q * -L2L); - s = normalize_d(s); + s = normalize_d(s); - u = 2.51069683420950419527139e-08; - u = mla(u, s.x, 2.76286166770270649116855e-07); - u = mla(u, s.x, 2.75572496725023574143864e-06); - u = mla(u, s.x, 2.48014973989819794114153e-05); - u = mla(u, s.x, 0.000198412698809069797676111); - u = mla(u, s.x, 0.0013888888939977128960529); - u = mla(u, s.x, 0.00833333333332371417601081); - u = mla(u, s.x, 0.0416666666665409524128449); - u = mla(u, s.x, 0.166666666666666740681535); - u = mla(u, s.x, 0.500000000000000999200722); + u = 2.51069683420950419527139e-08; + u = mla(u, s.x, 2.76286166770270649116855e-07); + u = mla(u, s.x, 2.75572496725023574143864e-06); + u = mla(u, s.x, 2.48014973989819794114153e-05); + u = mla(u, s.x, 0.000198412698809069797676111); + u = mla(u, s.x, 0.0013888888939977128960529); + u = mla(u, s.x, 0.00833333333332371417601081); + u = mla(u, s.x, 0.0416666666665409524128449); + u = mla(u, s.x, 0.166666666666666740681535); + u = mla(u, s.x, 0.500000000000000999200722); - t = add_dd(s, mul_ds(squ_d(s), u)); + t = add_dd(s, mul_ds(squ_d(s), u)); - t = add_sd(1, t); - return ldexpk(t.x + t.y, q); + t = add_sd(1, t); + return ldexpk(t.x + t.y, q); } __inline double xpow(double x, double y) { - int yisint = (int)y == y; - int yisodd = (1 & (int)y) != 0 && yisint; + int yisint = (int)y == y; + int yisodd = (1 & (int)y) != 0 && yisint; - double result = expk(mul_ds(logk(xfabs(x)), y)); + double result = expk(mul_ds(logk(xfabs(x)), y)); - result = xisnan(result) ? rtengine::RT_INFINITY : result; - result *= (x >= 0 ? 1 : (!yisint ? rtengine::RT_NAN : (yisodd ? -1 : 1))); + result = xisnan(result) ? rtengine::RT_INFINITY : result; + result *= (x >= 0 ? 1 : (!yisint ? rtengine::RT_NAN : (yisodd ? -1 : 1))); - double efx = mulsign(xfabs(x) - 1, y); - if (xisinf(y)) result = efx < 0 ? 0.0 : (efx == 0 ? 1.0 : rtengine::RT_INFINITY); - if (xisinf(x) || x == 0) result = (yisodd ? sign(x) : 1) * ((x == 0 ? -y : y) < 0 ? 0 : rtengine::RT_INFINITY); - if (xisnan(x) || xisnan(y)) result = rtengine::RT_NAN; - if (y == 0 || x == 1) result = 1; + double efx = mulsign(xfabs(x) - 1, y); + if (xisinf(y)) result = efx < 0 ? 0.0 : (efx == 0 ? 1.0 : rtengine::RT_INFINITY); + if (xisinf(x) || x == 0) result = (yisodd ? sign(x) : 1) * ((x == 0 ? -y : y) < 0 ? 0 : rtengine::RT_INFINITY); + if (xisnan(x) || xisnan(y)) result = rtengine::RT_NAN; + if (y == 0 || x == 1) result = 1; - return result; + return result; } __inline double2 expk2(double2 d) { - int q = (int)rint((d.x + d.y) * R_LN2); - double2 s, t; - double u; + int q = (int)rint((d.x + d.y) * R_LN2); + double2 s, t; + double u; - s = add2_ds(d, q * -L2U); - s = add2_ds(s, q * -L2L); + s = add2_ds(d, q * -L2U); + s = add2_ds(s, q * -L2L); - s = normalize_d(s); + s = normalize_d(s); - u = 2.51069683420950419527139e-08; - u = mla(u, s.x, 2.76286166770270649116855e-07); - u = mla(u, s.x, 2.75572496725023574143864e-06); - u = mla(u, s.x, 2.48014973989819794114153e-05); - u = mla(u, s.x, 0.000198412698809069797676111); - u = mla(u, s.x, 0.0013888888939977128960529); - u = mla(u, s.x, 0.00833333333332371417601081); - u = mla(u, s.x, 0.0416666666665409524128449); - u = mla(u, s.x, 0.166666666666666740681535); - u = mla(u, s.x, 0.500000000000000999200722); + u = 2.51069683420950419527139e-08; + u = mla(u, s.x, 2.76286166770270649116855e-07); + u = mla(u, s.x, 2.75572496725023574143864e-06); + u = mla(u, s.x, 2.48014973989819794114153e-05); + u = mla(u, s.x, 0.000198412698809069797676111); + u = mla(u, s.x, 0.0013888888939977128960529); + u = mla(u, s.x, 0.00833333333332371417601081); + u = mla(u, s.x, 0.0416666666665409524128449); + u = mla(u, s.x, 0.166666666666666740681535); + u = mla(u, s.x, 0.500000000000000999200722); - t = add_dd(s, mul_ds(squ_d(s), u)); + t = add_dd(s, mul_ds(squ_d(s), u)); - t = add_sd(1, t); - return dd(ldexpk(t.x, q), ldexpk(t.y, q)); + t = add_sd(1, t); + return dd(ldexpk(t.x, q), ldexpk(t.y, q)); } __inline double xsinh(double x) { - double y = xfabs(x); - double2 d = expk2(dd(y, 0)); - d = add2_dd(d, div_dd(dd(-1, 0), d)); - y = (d.x + d.y) * 0.5; + double y = xfabs(x); + double2 d = expk2(dd(y, 0)); + d = add2_dd(d, div_dd(dd(-1, 0), d)); + y = (d.x + d.y) * 0.5; - y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; - y = mulsign(y, x); - y = xisnan(x) ? rtengine::RT_NAN : y; + y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; + y = mulsign(y, x); + y = xisnan(x) ? rtengine::RT_NAN : y; - return y; + return y; } __inline double xcosh(double x) { - double2 d = expk2(dd(x, 0)); - d = add2_dd(d, div_dd(dd(1, 0), d)); - double y = (d.x + d.y) * 0.5; + double2 d = expk2(dd(x, 0)); + d = add2_dd(d, div_dd(dd(1, 0), d)); + double y = (d.x + d.y) * 0.5; - y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; - y = xisnan(x) ? rtengine::RT_NAN : y; + y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; + y = xisnan(x) ? rtengine::RT_NAN : y; - return y; + return y; } __inline double xtanh(double x) { - double y = xfabs(x); - double2 d = expk2(dd(y, 0)); - double2 e = div_dd(dd(1, 0), d); - d = div_dd(add2_dd(d, scale_d(e, -1)), add2_dd(d, e)); - y = d.x + d.y; + double y = xfabs(x); + double2 d = expk2(dd(y, 0)); + double2 e = div_dd(dd(1, 0), d); + d = div_dd(add2_dd(d, scale_d(e, -1)), add2_dd(d, e)); + y = d.x + d.y; - y = xisinf(x) || xisnan(y) ? 1.0 : y; - y = mulsign(y, x); - y = xisnan(x) ? rtengine::RT_NAN : y; + y = xisinf(x) || xisnan(y) ? 1.0 : y; + y = mulsign(y, x); + y = xisnan(x) ? rtengine::RT_NAN : y; - return y; + return y; } __inline double2 logk2(double2 d) { - double2 x, x2, m; - double t; - int e; + double2 x, x2, m; + double t; + int e; - d = normalize_d(d); - e = ilogbp1(d.x * 0.7071); - m = scale_d(d, ldexpk(1, -e)); + d = normalize_d(d); + e = ilogbp1(d.x * 0.7071); + m = scale_d(d, ldexpk(1, -e)); - x = div_dd(add2_ds(m, -1), add2_ds(m, 1)); - x2 = squ_d(x); + x = div_dd(add2_ds(m, -1), add2_ds(m, 1)); + x2 = squ_d(x); - t = 0.134601987501262130076155; - t = mla(t, x2.x, 0.132248509032032670243288); - t = mla(t, x2.x, 0.153883458318096079652524); - t = mla(t, x2.x, 0.181817427573705403298686); - t = mla(t, x2.x, 0.222222231326187414840781); - t = mla(t, x2.x, 0.285714285651261412873718); - t = mla(t, x2.x, 0.400000000000222439910458); - t = mla(t, x2.x, 0.666666666666666371239645); + t = 0.134601987501262130076155; + t = mla(t, x2.x, 0.132248509032032670243288); + t = mla(t, x2.x, 0.153883458318096079652524); + t = mla(t, x2.x, 0.181817427573705403298686); + t = mla(t, x2.x, 0.222222231326187414840781); + t = mla(t, x2.x, 0.285714285651261412873718); + t = mla(t, x2.x, 0.400000000000222439910458); + t = mla(t, x2.x, 0.666666666666666371239645); - return add2_dd(mul_ds(dd(0.693147180559945286226764, 2.319046813846299558417771e-17), e), - add2_dd(scale_d(x, 2), mul_ds(mul_dd(x2, x), t))); + return add2_dd(mul_ds(dd(0.693147180559945286226764, 2.319046813846299558417771e-17), e), + add2_dd(scale_d(x, 2), mul_ds(mul_dd(x2, x), t))); } __inline double xasinh(double x) { - double y = xfabs(x); - double2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(y, y), 1)), y)); - y = d.x + d.y; + double y = xfabs(x); + double2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(y, y), 1)), y)); + y = d.x + d.y; - y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; - y = mulsign(y, x); - y = xisnan(x) ? rtengine::RT_NAN : y; + y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; + y = mulsign(y, x); + y = xisnan(x) ? rtengine::RT_NAN : y; - return y; + return y; } __inline double xacosh(double x) { - double2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(x, x), -1)), x)); - double y = d.x + d.y; + double2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(x, x), -1)), x)); + double y = d.x + d.y; - y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; - y = x == 1.0 ? 0.0 : y; - y = x < 1.0 ? rtengine::RT_NAN : y; - y = xisnan(x) ? rtengine::RT_NAN : y; + y = xisinf(x) || xisnan(y) ? rtengine::RT_INFINITY : y; + y = x == 1.0 ? 0.0 : y; + y = x < 1.0 ? rtengine::RT_NAN : y; + y = xisnan(x) ? rtengine::RT_NAN : y; - return y; + return y; } __inline double xatanh(double x) { - double y = xfabs(x); - double2 d = logk2(div_dd(add2_ss(1, y), add2_ss(1, -y))); - y = y > 1.0 ? rtengine::RT_NAN : (y == 1.0 ? rtengine::RT_INFINITY : (d.x + d.y) * 0.5); + double y = xfabs(x); + double2 d = logk2(div_dd(add2_ss(1, y), add2_ss(1, -y))); + y = y > 1.0 ? rtengine::RT_NAN : (y == 1.0 ? rtengine::RT_INFINITY : (d.x + d.y) * 0.5); - y = xisinf(x) || xisnan(y) ? rtengine::RT_NAN : y; - y = mulsign(y, x); - y = xisnan(x) ? rtengine::RT_NAN : y; + y = xisinf(x) || xisnan(y) ? rtengine::RT_NAN : y; + y = mulsign(y, x); + y = xisnan(x) ? rtengine::RT_NAN : y; - return y; + return y; } // __inline double xfma(double x, double y, double z) { - union { - double f; - long long int i; - } tmp; + union { + double f; + long long int i; + } tmp; - tmp.f = x; - tmp.i = (tmp.i + 0x4000000) & 0xfffffffff8000000LL; - double xh = tmp.f, xl = x - xh; + tmp.f = x; + tmp.i = (tmp.i + 0x4000000) & 0xfffffffff8000000LL; + double xh = tmp.f, xl = x - xh; - tmp.f = y; - tmp.i = (tmp.i + 0x4000000) & 0xfffffffff8000000LL; - double yh = tmp.f, yl = y - yh; + tmp.f = y; + tmp.i = (tmp.i + 0x4000000) & 0xfffffffff8000000LL; + double yh = tmp.f, yl = y - yh; - double h = x * y; - double l = xh * yh - h + xl * yh + xh * yl + xl * yl; + double h = x * y; + double l = xh * yh - h + xl * yh + xh * yl + xl * yl; - double h2, l2, v; + double h2, l2, v; - h2 = h + z; - v = h2 - h; - l2 = (h - (h2 - v)) + (z - v) + l; + h2 = h + z; + v = h2 - h; + l2 = (h - (h2 - v)) + (z - v) + l; - return h2 + l2; + return h2 + l2; } __inline double xsqrt(double d) { // max error : 0.5 ulp - double q = 1; + double q = 1; - if (d < 8.636168555094445E-78) { - d *= 1.157920892373162E77; - q = 2.9387358770557188E-39; - } + if (d < 8.636168555094445E-78) { + d *= 1.157920892373162E77; + q = 2.9387358770557188E-39; + } - // http://en.wikipedia.org/wiki/Fast_inverse_square_root - double x = longBitsToDouble(0x5fe6ec85e7de30da - (doubleToRawLongBits(d + 1e-320) >> 1)); + // http://en.wikipedia.org/wiki/Fast_inverse_square_root + double x = longBitsToDouble(0x5fe6ec85e7de30da - (doubleToRawLongBits(d + 1e-320) >> 1)); - x = x * (1.5 - 0.5 * d * x * x); - x = x * (1.5 - 0.5 * d * x * x); - x = x * (1.5 - 0.5 * d * x * x); + x = x * (1.5 - 0.5 * d * x * x); + x = x * (1.5 - 0.5 * d * x * x); + x = x * (1.5 - 0.5 * d * x * x); - // You can change xfma to fma if fma is correctly implemented - x = xfma(d * x, d * x, -d) * (x * -0.5) + d * x; + // You can change xfma to fma if fma is correctly implemented + x = xfma(d * x, d * x, -d) * (x * -0.5) + d * x; - return d == rtengine::RT_INFINITY ? rtengine::RT_INFINITY : x * q; + return d == rtengine::RT_INFINITY ? rtengine::RT_INFINITY : x * q; } __inline double xcbrt(double d) { // max error : 2 ulps - double x, y, q = 1.0; - int e, r; + double x, y, q = 1.0; + int e, r; - e = ilogbp1(d); - d = ldexpk(d, -e); - r = (e + 6144) % 3; - q = (r == 1) ? 1.2599210498948731647672106 : q; - q = (r == 2) ? 1.5874010519681994747517056 : q; - q = ldexpk(q, (e + 6144) / 3 - 2048); + e = ilogbp1(d); + d = ldexpk(d, -e); + r = (e + 6144) % 3; + q = (r == 1) ? 1.2599210498948731647672106 : q; + q = (r == 2) ? 1.5874010519681994747517056 : q; + q = ldexpk(q, (e + 6144) / 3 - 2048); - q = mulsign(q, d); - d = xfabs(d); + q = mulsign(q, d); + d = xfabs(d); - x = -0.640245898480692909870982; - x = x * d + 2.96155103020039511818595; - x = x * d + -5.73353060922947843636166; - x = x * d + 6.03990368989458747961407; - x = x * d + -3.85841935510444988821632; - x = x * d + 2.2307275302496609725722; + x = -0.640245898480692909870982; + x = x * d + 2.96155103020039511818595; + x = x * d + -5.73353060922947843636166; + x = x * d + 6.03990368989458747961407; + x = x * d + -3.85841935510444988821632; + x = x * d + 2.2307275302496609725722; - y = x * x; y = y * y; x -= (d * y - x) * (1.0 / 3.0); - y = d * x * x; - y = (y - (2.0 / 3.0) * y * (y * x - 1)) * q; + y = x * x; y = y * y; x -= (d * y - x) * (1.0 / 3.0); + y = d * x * x; + y = (y - (2.0 / 3.0) * y * (y * x - 1)) * q; - return y; + return y; } __inline double xexp2(double a) { - double u = expk(mul_ds(dd(0.69314718055994528623, 2.3190468138462995584e-17), a)); - if (xispinf(a)) u = rtengine::RT_INFINITY; - if (xisminf(a)) u = 0; - return u; + double u = expk(mul_ds(dd(0.69314718055994528623, 2.3190468138462995584e-17), a)); + if (xispinf(a)) u = rtengine::RT_INFINITY; + if (xisminf(a)) u = 0; + return u; } __inline double xexp10(double a) { - double u = expk(mul_ds(dd(2.3025850929940459011, -2.1707562233822493508e-16), a)); - if (xispinf(a)) u = rtengine::RT_INFINITY; - if (xisminf(a)) u = 0; - return u; + double u = expk(mul_ds(dd(2.3025850929940459011, -2.1707562233822493508e-16), a)); + if (xispinf(a)) u = rtengine::RT_INFINITY; + if (xisminf(a)) u = 0; + return u; } __inline double xexpm1(double a) { - double2 d = add2_ds(expk2(dd(a, 0)), -1.0); - double x = d.x + d.y; - if (xispinf(a)) x = rtengine::RT_INFINITY; - if (xisminf(a)) x = -1; - return x; + double2 d = add2_ds(expk2(dd(a, 0)), -1.0); + double x = d.x + d.y; + if (xispinf(a)) x = rtengine::RT_INFINITY; + if (xisminf(a)) x = -1; + return x; } __inline double xlog10(double a) { - double2 d = mul_dd(logk(a), dd(0.43429448190325176116, 6.6494347733425473126e-17)); - double x = d.x + d.y; + double2 d = mul_dd(logk(a), dd(0.43429448190325176116, 6.6494347733425473126e-17)); + double x = d.x + d.y; - if (xisinf(a)) x = rtengine::RT_INFINITY; - if (a < 0) x = rtengine::RT_NAN; - if (a == 0) x = -rtengine::RT_INFINITY; + if (xisinf(a)) x = rtengine::RT_INFINITY; + if (a < 0) x = rtengine::RT_NAN; + if (a == 0) x = -rtengine::RT_INFINITY; - return x; + return x; } __inline double xlog1p(double a) { - double2 d = logk2(add2_ss(a, 1)); - double x = d.x + d.y; + double2 d = logk2(add2_ss(a, 1)); + double x = d.x + d.y; - if (xisinf(a)) x = rtengine::RT_INFINITY; - if (a < -1) x = rtengine::RT_NAN; - if (a == -1) x = -rtengine::RT_INFINITY; + if (xisinf(a)) x = rtengine::RT_INFINITY; + if (a < -1) x = rtengine::RT_NAN; + if (a == -1) x = -rtengine::RT_INFINITY; - return x; + return x; } /////////////////////////////////////////// @@ -897,29 +897,29 @@ __inline double xlog1p(double a) { #define R_LN2f 1.442695040888963407359924681001892137426645954152985934135449406931f __inline int32_t floatToRawIntBits(float d) { - union { - float f; - int32_t i; - } tmp; - tmp.f = d; - return tmp.i; + union { + float f; + int32_t i; + } tmp; + tmp.f = d; + return tmp.i; } __inline float intBitsToFloat(int32_t i) { - union { - float f; - int32_t i; - } tmp; - tmp.i = i; - return tmp.f; + union { + float f; + int32_t i; + } tmp; + tmp.i = i; + return tmp.f; } __inline float xfabsf(float x) { - return intBitsToFloat(0x7fffffffL & floatToRawIntBits(x)); + return intBitsToFloat(0x7fffffffL & floatToRawIntBits(x)); } __inline float mulsignf(float x, float y) { - return intBitsToFloat(floatToRawIntBits(x) ^ (floatToRawIntBits(y) & (1 << 31))); + return intBitsToFloat(floatToRawIntBits(x) ^ (floatToRawIntBits(y) & (1 << 31))); } __inline float signf(float d) { return copysign(1, d); } @@ -931,337 +931,337 @@ __inline int xisminff(float x) { return x == -rtengine::RT_INFINITY_F; } __inline int xispinff(float x) { return x == rtengine::RT_INFINITY_F; } __inline int ilogbp1f(float d) { - int m = d < 5.421010862427522E-20f; - d = m ? 1.8446744073709552E19f * d : d; - int q = (floatToRawIntBits(d) >> 23) & 0xff; - q = m ? q - (64 + 0x7e) : q - 0x7e; - return q; + int m = d < 5.421010862427522E-20f; + d = m ? 1.8446744073709552E19f * d : d; + int q = (floatToRawIntBits(d) >> 23) & 0xff; + q = m ? q - (64 + 0x7e) : q - 0x7e; + return q; } __inline float ldexpkf(float x, int q) { - float u; - int m; - m = q >> 31; - m = (((m + q) >> 6) - m) << 4; - q = q - (m << 2); - u = intBitsToFloat(((int32_t)(m + 0x7f)) << 23); - u = u * u; - x = x * u * u; - u = intBitsToFloat(((int32_t)(q + 0x7f)) << 23); - return x * u; + float u; + int m; + m = q >> 31; + m = (((m + q) >> 6) - m) << 4; + q = q - (m << 2); + u = intBitsToFloat(((int32_t)(m + 0x7f)) << 23); + u = u * u; + x = x * u * u; + u = intBitsToFloat(((int32_t)(q + 0x7f)) << 23); + return x * u; } __inline float xcbrtf(float d) { // max error : 2 ulps - float x, y, q = 1.0f; - int e, r; + float x, y, q = 1.0f; + int e, r; - e = ilogbp1f(d); - d = ldexpkf(d, -e); - r = (e + 6144) % 3; - q = (r == 1) ? 1.2599210498948731647672106f : q; - q = (r == 2) ? 1.5874010519681994747517056f : q; - q = ldexpkf(q, (e + 6144) / 3 - 2048); + e = ilogbp1f(d); + d = ldexpkf(d, -e); + r = (e + 6144) % 3; + q = (r == 1) ? 1.2599210498948731647672106f : q; + q = (r == 2) ? 1.5874010519681994747517056f : q; + q = ldexpkf(q, (e + 6144) / 3 - 2048); - q = mulsignf(q, d); - d = xfabsf(d); + q = mulsignf(q, d); + d = xfabsf(d); - x = -0.601564466953277587890625f; - x = mlaf(x, d, 2.8208892345428466796875f); - x = mlaf(x, d, -5.532182216644287109375f); - x = mlaf(x, d, 5.898262500762939453125f); - x = mlaf(x, d, -3.8095417022705078125f); - x = mlaf(x, d, 2.2241256237030029296875f); + x = -0.601564466953277587890625f; + x = mlaf(x, d, 2.8208892345428466796875f); + x = mlaf(x, d, -5.532182216644287109375f); + x = mlaf(x, d, 5.898262500762939453125f); + x = mlaf(x, d, -3.8095417022705078125f); + x = mlaf(x, d, 2.2241256237030029296875f); - y = d * x * x; - y = (y - (2.0f / 3.0f) * y * (y * x - 1.0f)) * q; + y = d * x * x; + y = (y - (2.0f / 3.0f) * y * (y * x - 1.0f)) * q; - return y; + return y; } __inline float xsinf(float d) { - int q; - float u, s; + int q; + float u, s; - q = rint(d * rtengine::RT_1_PI_F); + q = rint(d * rtengine::RT_1_PI_F); - d = mlaf(q, -PI4_Af*4, d); - d = mlaf(q, -PI4_Bf*4, d); - d = mlaf(q, -PI4_Cf*4, d); - d = mlaf(q, -PI4_Df*4, d); + d = mlaf(q, -PI4_Af*4, d); + d = mlaf(q, -PI4_Bf*4, d); + d = mlaf(q, -PI4_Cf*4, d); + d = mlaf(q, -PI4_Df*4, d); - s = d * d; + s = d * d; - if ((q & 1) != 0) d = -d; + if ((q & 1) != 0) d = -d; - u = 2.6083159809786593541503e-06f; - u = mlaf(u, s, -0.0001981069071916863322258f); - u = mlaf(u, s, 0.00833307858556509017944336f); - u = mlaf(u, s, -0.166666597127914428710938f); + u = 2.6083159809786593541503e-06f; + u = mlaf(u, s, -0.0001981069071916863322258f); + u = mlaf(u, s, 0.00833307858556509017944336f); + u = mlaf(u, s, -0.166666597127914428710938f); - u = mlaf(s, u * d, d); + u = mlaf(s, u * d, d); - return u; + return u; } __inline float xcosf(float d) { #ifdef __SSE2__ - // faster than scalar version - return xcosf(_mm_set_ss(d))[0]; + // faster than scalar version + return xcosf(_mm_set_ss(d))[0]; #else - int q; - float u, s; + int q; + float u, s; - q = 1 + 2*rint(d * rtengine::RT_1_PI_F - 0.5f); + q = 1 + 2*rint(d * rtengine::RT_1_PI_F - 0.5f); - d = mlaf(q, -PI4_Af*2, d); - d = mlaf(q, -PI4_Bf*2, d); - d = mlaf(q, -PI4_Cf*2, d); - d = mlaf(q, -PI4_Df*2, d); + d = mlaf(q, -PI4_Af*2, d); + d = mlaf(q, -PI4_Bf*2, d); + d = mlaf(q, -PI4_Cf*2, d); + d = mlaf(q, -PI4_Df*2, d); - s = d * d; + s = d * d; - if ((q & 2) == 0) d = -d; + if ((q & 2) == 0) d = -d; - u = 2.6083159809786593541503e-06f; - u = mlaf(u, s, -0.0001981069071916863322258f); - u = mlaf(u, s, 0.00833307858556509017944336f); - u = mlaf(u, s, -0.166666597127914428710938f); + u = 2.6083159809786593541503e-06f; + u = mlaf(u, s, -0.0001981069071916863322258f); + u = mlaf(u, s, 0.00833307858556509017944336f); + u = mlaf(u, s, -0.166666597127914428710938f); - u = mlaf(s, u * d, d); + u = mlaf(s, u * d, d); - return u; + return u; #endif } __inline float2 xsincosf(float d) { #ifdef __SSE2__ - // faster than scalar version + // faster than scalar version vfloat2 res = xsincosf(_mm_set_ss(d)); return {res.x[0], res.y[0]}; #else - int q; - float u, s, t; - float2 r; + int q; + float u, s, t; + float2 r; - q = rint(d * rtengine::RT_2_PI_F); + q = rint(d * rtengine::RT_2_PI_F); - s = d; + s = d; - s = mlaf(q, -PI4_Af*2, s); - s = mlaf(q, -PI4_Bf*2, s); - s = mlaf(q, -PI4_Cf*2, s); - s = mlaf(q, -PI4_Df*2, s); + s = mlaf(q, -PI4_Af*2, s); + s = mlaf(q, -PI4_Bf*2, s); + s = mlaf(q, -PI4_Cf*2, s); + s = mlaf(q, -PI4_Df*2, s); - t = s; + t = s; - s = s * s; + s = s * s; - u = -0.000195169282960705459117889f; - u = mlaf(u, s, 0.00833215750753879547119141f); - u = mlaf(u, s, -0.166666537523269653320312f); - u = u * s * t; + u = -0.000195169282960705459117889f; + u = mlaf(u, s, 0.00833215750753879547119141f); + u = mlaf(u, s, -0.166666537523269653320312f); + u = u * s * t; - r.x = t + u; + r.x = t + u; - u = -2.71811842367242206819355e-07f; - u = mlaf(u, s, 2.47990446951007470488548e-05f); - u = mlaf(u, s, -0.00138888787478208541870117f); - u = mlaf(u, s, 0.0416666641831398010253906f); - u = mlaf(u, s, -0.5f); + u = -2.71811842367242206819355e-07f; + u = mlaf(u, s, 2.47990446951007470488548e-05f); + u = mlaf(u, s, -0.00138888787478208541870117f); + u = mlaf(u, s, 0.0416666641831398010253906f); + u = mlaf(u, s, -0.5f); - r.y = u * s + 1; + r.y = u * s + 1; - if ((q & 1) != 0) { s = r.y; r.y = r.x; r.x = s; } - if ((q & 2) != 0) { r.x = -r.x; } - if (((q+1) & 2) != 0) { r.y = -r.y; } + if ((q & 1) != 0) { s = r.y; r.y = r.x; r.x = s; } + if ((q & 2) != 0) { r.x = -r.x; } + if (((q+1) & 2) != 0) { r.y = -r.y; } - if (xisinff(d)) { r.x = r.y = rtengine::RT_NAN_F; } + if (xisinff(d)) { r.x = r.y = rtengine::RT_NAN_F; } - return r; + return r; #endif } __inline float xtanf(float d) { - int q; - float u, s, x; + int q; + float u, s, x; - q = rint(d * (float)(2 * rtengine::RT_1_PI)); + q = rint(d * (float)(2 * rtengine::RT_1_PI)); - x = d; + x = d; - x = mlaf(q, -PI4_Af*2, x); - x = mlaf(q, -PI4_Bf*2, x); - x = mlaf(q, -PI4_Cf*2, x); - x = mlaf(q, -PI4_Df*2, x); + x = mlaf(q, -PI4_Af*2, x); + x = mlaf(q, -PI4_Bf*2, x); + x = mlaf(q, -PI4_Cf*2, x); + x = mlaf(q, -PI4_Df*2, x); - s = x * x; + s = x * x; - if ((q & 1) != 0) x = -x; + if ((q & 1) != 0) x = -x; - u = 0.00927245803177356719970703f; - u = mlaf(u, s, 0.00331984995864331722259521f); - u = mlaf(u, s, 0.0242998078465461730957031f); - u = mlaf(u, s, 0.0534495301544666290283203f); - u = mlaf(u, s, 0.133383005857467651367188f); - u = mlaf(u, s, 0.333331853151321411132812f); + u = 0.00927245803177356719970703f; + u = mlaf(u, s, 0.00331984995864331722259521f); + u = mlaf(u, s, 0.0242998078465461730957031f); + u = mlaf(u, s, 0.0534495301544666290283203f); + u = mlaf(u, s, 0.133383005857467651367188f); + u = mlaf(u, s, 0.333331853151321411132812f); - u = mlaf(s, u * x, x); + u = mlaf(s, u * x, x); - if ((q & 1) != 0) u = 1.0f / u; + if ((q & 1) != 0) u = 1.0f / u; - if (xisinff(d)) u = rtengine::RT_NAN_F; + if (xisinff(d)) u = rtengine::RT_NAN_F; - return u; + return u; } __inline float xatanf(float s) { - float t, u; - int q = 0; + float t, u; + int q = 0; - if (s < 0) { s = -s; q = 2; } - if (s > 1) { s = 1.0f / s; q |= 1; } + if (s < 0) { s = -s; q = 2; } + if (s > 1) { s = 1.0f / s; q |= 1; } - t = s * s; + t = s * s; - u = 0.00282363896258175373077393f; - u = mlaf(u, t, -0.0159569028764963150024414f); - u = mlaf(u, t, 0.0425049886107444763183594f); - u = mlaf(u, t, -0.0748900920152664184570312f); - u = mlaf(u, t, 0.106347933411598205566406f); - u = mlaf(u, t, -0.142027363181114196777344f); - u = mlaf(u, t, 0.199926957488059997558594f); - u = mlaf(u, t, -0.333331018686294555664062f); + u = 0.00282363896258175373077393f; + u = mlaf(u, t, -0.0159569028764963150024414f); + u = mlaf(u, t, 0.0425049886107444763183594f); + u = mlaf(u, t, -0.0748900920152664184570312f); + u = mlaf(u, t, 0.106347933411598205566406f); + u = mlaf(u, t, -0.142027363181114196777344f); + u = mlaf(u, t, 0.199926957488059997558594f); + u = mlaf(u, t, -0.333331018686294555664062f); - t = s + s * (t * u); + t = s + s * (t * u); - if ((q & 1) != 0) t = 1.570796326794896557998982f - t; - if ((q & 2) != 0) t = -t; + if ((q & 1) != 0) t = 1.570796326794896557998982f - t; + if ((q & 2) != 0) t = -t; - return t; + return t; } __inline float atan2kf(float y, float x) { - float s, t, u; - float q = 0.f; + float s, t, u; + float q = 0.f; - if (x < 0) { x = -x; q = -2.f; } - if (y > x) { t = x; x = y; y = -t; q += 1.f; } + if (x < 0) { x = -x; q = -2.f; } + if (y > x) { t = x; x = y; y = -t; q += 1.f; } - s = y / x; - t = s * s; + s = y / x; + t = s * s; - u = 0.00282363896258175373077393f; - u = mlaf(u, t, -0.0159569028764963150024414f); - u = mlaf(u, t, 0.0425049886107444763183594f); - u = mlaf(u, t, -0.0748900920152664184570312f); - u = mlaf(u, t, 0.106347933411598205566406f); - u = mlaf(u, t, -0.142027363181114196777344f); - u = mlaf(u, t, 0.199926957488059997558594f); - u = mlaf(u, t, -0.333331018686294555664062f); + u = 0.00282363896258175373077393f; + u = mlaf(u, t, -0.0159569028764963150024414f); + u = mlaf(u, t, 0.0425049886107444763183594f); + u = mlaf(u, t, -0.0748900920152664184570312f); + u = mlaf(u, t, 0.106347933411598205566406f); + u = mlaf(u, t, -0.142027363181114196777344f); + u = mlaf(u, t, 0.199926957488059997558594f); + u = mlaf(u, t, -0.333331018686294555664062f); - t = u * t; - t = mlaf(t,s,s); - return mlaf(q,(float)(rtengine::RT_PI_F_2),t); + t = u * t; + t = mlaf(t,s,s); + return mlaf(q,(float)(rtengine::RT_PI_F_2),t); } __inline float xatan2f(float y, float x) { - float r = atan2kf(xfabsf(y), x); + float r = atan2kf(xfabsf(y), x); - r = mulsignf(r, x); - if (xisinff(x) || x == 0) r = rtengine::RT_PI_F/2 - (xisinff(x) ? (signf(x) * (float)(rtengine::RT_PI_F*.5f)) : 0); - if (xisinff(y) ) r = rtengine::RT_PI_F/2 - (xisinff(x) ? (signf(x) * (float)(rtengine::RT_PI_F*.25f)) : 0); - if ( y == 0) r = (signf(x) == -1 ? rtengine::RT_PI_F : 0); + r = mulsignf(r, x); + if (xisinff(x) || x == 0) r = rtengine::RT_PI_F/2 - (xisinff(x) ? (signf(x) * (float)(rtengine::RT_PI_F*.5f)) : 0); + if (xisinff(y) ) r = rtengine::RT_PI_F/2 - (xisinff(x) ? (signf(x) * (float)(rtengine::RT_PI_F*.25f)) : 0); + if ( y == 0) r = (signf(x) == -1 ? rtengine::RT_PI_F : 0); - return xisnanf(x) || xisnanf(y) ? rtengine::RT_NAN_F : mulsignf(r, y); + return xisnanf(x) || xisnanf(y) ? rtengine::RT_NAN_F : mulsignf(r, y); } __inline float xasinf(float d) { - return mulsignf(atan2kf(fabsf(d), sqrtf((1.0f+d)*(1.0f-d))), d); + return mulsignf(atan2kf(fabsf(d), sqrtf((1.0f+d)*(1.0f-d))), d); } __inline float xacosf(float d) { - return mulsignf(atan2kf(sqrtf((1.0f+d)*(1.0f-d)), fabsf(d)), d) + (d < 0 ? (float)rtengine::RT_PI : 0.0f); + return mulsignf(atan2kf(sqrtf((1.0f+d)*(1.0f-d)), fabsf(d)), d) + (d < 0 ? (float)rtengine::RT_PI : 0.0f); } __inline float xlogf(float d) { - float x, x2, t, m; - int e; + float x, x2, t, m; + int e; - e = ilogbp1f(d * 0.7071f); - m = ldexpkf(d, -e); + e = ilogbp1f(d * 0.7071f); + m = ldexpkf(d, -e); - x = (m-1.0f) / (m+1.0f); - x2 = x * x; + x = (m-1.0f) / (m+1.0f); + x2 = x * x; - t = 0.2371599674224853515625f; - t = mlaf(t, x2, 0.285279005765914916992188f); - t = mlaf(t, x2, 0.400005519390106201171875f); - t = mlaf(t, x2, 0.666666567325592041015625f); - t = mlaf(t, x2, 2.0f); + t = 0.2371599674224853515625f; + t = mlaf(t, x2, 0.285279005765914916992188f); + t = mlaf(t, x2, 0.400005519390106201171875f); + t = mlaf(t, x2, 0.666666567325592041015625f); + t = mlaf(t, x2, 2.0f); - x = x * t + 0.693147180559945286226764f * e; + x = x * t + 0.693147180559945286226764f * e; - if (xisinff(d)) x = rtengine::RT_INFINITY_F; - if (d < 0) x = rtengine::RT_NAN_F; - if (d == 0) x = -rtengine::RT_INFINITY_F; + if (xisinff(d)) x = rtengine::RT_INFINITY_F; + if (d < 0) x = rtengine::RT_NAN_F; + if (d == 0) x = -rtengine::RT_INFINITY_F; - return x; + return x; } __inline float xexpf(float d) { - if(d<=-104.0f) return 0.0f; + if(d<=-104.0f) return 0.0f; - int q = rint(d * R_LN2f); - float s, u; + int q = rint(d * R_LN2f); + float s, u; - s = mlaf(q, -L2Uf, d); - s = mlaf(q, -L2Lf, s); + s = mlaf(q, -L2Uf, d); + s = mlaf(q, -L2Lf, s); - u = 0.00136324646882712841033936f; - u = mlaf(u, s, 0.00836596917361021041870117f); - u = mlaf(u, s, 0.0416710823774337768554688f); - u = mlaf(u, s, 0.166665524244308471679688f); - u = mlaf(u, s, 0.499999850988388061523438f); + u = 0.00136324646882712841033936f; + u = mlaf(u, s, 0.00836596917361021041870117f); + u = mlaf(u, s, 0.0416710823774337768554688f); + u = mlaf(u, s, 0.166665524244308471679688f); + u = mlaf(u, s, 0.499999850988388061523438f); - u = mlaf( s, mlaf(s,u,1.f),1.f); - return ldexpkf(u, q); + u = mlaf( s, mlaf(s,u,1.f),1.f); + return ldexpkf(u, q); } __inline float xmul2f(float d) { - union { - float floatval; - int intval; - } uflint; - uflint.floatval = d; - if (uflint.intval & 0x7FFFFFFF) { // if f==0 do nothing - uflint.intval += 1 << 23; // add 1 to the exponent - } - return uflint.floatval; + union { + float floatval; + int intval; + } uflint; + uflint.floatval = d; + if (uflint.intval & 0x7FFFFFFF) { // if f==0 do nothing + uflint.intval += 1 << 23; // add 1 to the exponent + } + return uflint.floatval; } __inline float xdiv2f(float d) { - union { - float floatval; - int intval; - } uflint; - uflint.floatval = d; - if (uflint.intval & 0x7FFFFFFF) { // if f==0 do nothing - uflint.intval -= 1 << 23; // sub 1 from the exponent - } - return uflint.floatval; + union { + float floatval; + int intval; + } uflint; + uflint.floatval = d; + if (uflint.intval & 0x7FFFFFFF) { // if f==0 do nothing + uflint.intval -= 1 << 23; // sub 1 from the exponent + } + return uflint.floatval; } __inline float xdivf( float d, int n){ - union { - float floatval; - int intval; - } uflint; - uflint.floatval = d; - if (uflint.intval & 0x7FFFFFFF) { // if f==0 do nothing - uflint.intval -= n << 23; // add n to the exponent - } - return uflint.floatval; + union { + float floatval; + int intval; + } uflint; + uflint.floatval = d; + if (uflint.intval & 0x7FFFFFFF) { // if f==0 do nothing + uflint.intval -= n << 23; // add n to the exponent + } + return uflint.floatval; } __inline float xlin2log(float x, float base) diff --git a/rtengine/sleefsseavx.c b/rtengine/sleefsseavx.c index 3000c1c10..1982c7c4c 100644 --- a/rtengine/sleefsseavx.c +++ b/rtengine/sleefsseavx.c @@ -48,199 +48,199 @@ #define NANf ((float)rtengine::RT_NAN) static INLINE vdouble vadd3(vdouble v0, vdouble v1, vdouble v2) { - return vadd(vadd(v0, v1), v2); + return vadd(vadd(v0, v1), v2); } static INLINE vdouble vadd4(vdouble v0, vdouble v1, vdouble v2, vdouble v3) { - return vadd3(vadd(v0, v1), v2, v3); + return vadd3(vadd(v0, v1), v2, v3); } static INLINE vdouble vadd5(vdouble v0, vdouble v1, vdouble v2, vdouble v3, vdouble v4) { - return vadd4(vadd(v0, v1), v2, v3, v4); + return vadd4(vadd(v0, v1), v2, v3, v4); } static INLINE vdouble vadd6(vdouble v0, vdouble v1, vdouble v2, vdouble v3, vdouble v4, vdouble v5) { - return vadd5(vadd(v0, v1), v2, v3, v4, v5); + return vadd5(vadd(v0, v1), v2, v3, v4, v5); } static INLINE vdouble vadd7(vdouble v0, vdouble v1, vdouble v2, vdouble v3, vdouble v4, vdouble v5, vdouble v6) { - return vadd6(vadd(v0, v1), v2, v3, v4, v5, v6); + return vadd6(vadd(v0, v1), v2, v3, v4, v5, v6); } static INLINE vdouble vsub3(vdouble v0, vdouble v1, vdouble v2) { - return vsub(vsub(v0, v1), v2); + return vsub(vsub(v0, v1), v2); } static INLINE vdouble vsub4(vdouble v0, vdouble v1, vdouble v2, vdouble v3) { - return vsub3(vsub(v0, v1), v2, v3); + return vsub3(vsub(v0, v1), v2, v3); } static INLINE vdouble vsub5(vdouble v0, vdouble v1, vdouble v2, vdouble v3, vdouble v4) { - return vsub4(vsub(v0, v1), v2, v3, v4); + return vsub4(vsub(v0, v1), v2, v3, v4); } // static INLINE vdouble2 normalize_d(vdouble2 t) { - vdouble2 s; + vdouble2 s; - s.x = vadd(t.x, t.y); - s.y = vadd(vsub(t.x, s.x), t.y); + s.x = vadd(t.x, t.y); + s.y = vadd(vsub(t.x, s.x), t.y); - return s; + return s; } static INLINE vdouble2 scale_d(vdouble2 d, vdouble s) { - vdouble2 r = {vmul(d.x, s), vmul(d.y, s)}; - return r; + vdouble2 r = {vmul(d.x, s), vmul(d.y, s)}; + return r; } static INLINE vdouble2 add_ss(vdouble x, vdouble y) { - vdouble2 r; + vdouble2 r; - r.x = vadd(x, y); - r.y = vadd(vsub(x, r.x), y); + r.x = vadd(x, y); + r.y = vadd(vsub(x, r.x), y); - return r; + return r; } static INLINE vdouble2 add2_ss(vdouble x, vdouble y) { - vdouble2 r; + vdouble2 r; - r.x = vadd(x, y); - vdouble v = vsub(r.x, x); - r.y = vadd(vsub(x, vsub(r.x, v)), vsub(y, v)); + r.x = vadd(x, y); + vdouble v = vsub(r.x, x); + r.y = vadd(vsub(x, vsub(r.x, v)), vsub(y, v)); - return r; + return r; } static INLINE vdouble2 add_ds(vdouble2 x, vdouble y) { - vdouble2 r; + vdouble2 r; - r.x = vadd(x.x, y); - r.y = vadd3(vsub(x.x, r.x), y, x.y); + r.x = vadd(x.x, y); + r.y = vadd3(vsub(x.x, r.x), y, x.y); - return r; + return r; } static INLINE vdouble2 add2_ds(vdouble2 x, vdouble y) { - vdouble2 r; + vdouble2 r; - r.x = vadd(x.x, y); - vdouble v = vsub(r.x, x.x); - r.y = vadd(vsub(x.x, vsub(r.x, v)), vsub(y, v)); - r.y = vadd(r.y, x.y); + r.x = vadd(x.x, y); + vdouble v = vsub(r.x, x.x); + r.y = vadd(vsub(x.x, vsub(r.x, v)), vsub(y, v)); + r.y = vadd(r.y, x.y); - return r; + return r; } static INLINE vdouble2 add_sd(vdouble x, vdouble2 y) { - vdouble2 r; + vdouble2 r; - r.x = vadd(x, y.x); - r.y = vadd3(vsub(x, r.x), y.x, y.y); + r.x = vadd(x, y.x); + r.y = vadd3(vsub(x, r.x), y.x, y.y); - return r; + return r; } static INLINE vdouble2 add_dd(vdouble2 x, vdouble2 y) { - // |x| >= |y| + // |x| >= |y| - vdouble2 r; + vdouble2 r; - r.x = vadd(x.x, y.x); - r.y = vadd4(vsub(x.x, r.x), y.x, x.y, y.y); + r.x = vadd(x.x, y.x); + r.y = vadd4(vsub(x.x, r.x), y.x, x.y, y.y); - return r; + return r; } static INLINE vdouble2 add2_dd(vdouble2 x, vdouble2 y) { - vdouble2 r; + vdouble2 r; - r.x = vadd(x.x, y.x); - vdouble v = vsub(r.x, x.x); - r.y = vadd(vsub(x.x, vsub(r.x, v)), vsub(y.x, v)); - r.y = vadd(r.y, vadd(x.y, y.y)); + r.x = vadd(x.x, y.x); + vdouble v = vsub(r.x, x.x); + r.y = vadd(vsub(x.x, vsub(r.x, v)), vsub(y.x, v)); + r.y = vadd(r.y, vadd(x.y, y.y)); - return r; + return r; } static INLINE vdouble2 div_dd(vdouble2 n, vdouble2 d) { - vdouble t = vrec(d.x); - vdouble dh = vupper(d.x), dl = vsub(d.x, dh); - vdouble th = vupper(t ), tl = vsub(t , th); - vdouble nhh = vupper(n.x), nhl = vsub(n.x, nhh); + vdouble t = vrec(d.x); + vdouble dh = vupper(d.x), dl = vsub(d.x, dh); + vdouble th = vupper(t ), tl = vsub(t , th); + vdouble nhh = vupper(n.x), nhl = vsub(n.x, nhh); - vdouble2 q; + vdouble2 q; - q.x = vmul(n.x, t); + q.x = vmul(n.x, t); - vdouble u = vadd5(vsub(vmul(nhh, th), q.x), vmul(nhh, tl), vmul(nhl, th), vmul(nhl, tl), - vmul(q.x, vsub5(vcast_vd_d(1), vmul(dh, th), vmul(dh, tl), vmul(dl, th), vmul(dl, tl)))); + vdouble u = vadd5(vsub(vmul(nhh, th), q.x), vmul(nhh, tl), vmul(nhl, th), vmul(nhl, tl), + vmul(q.x, vsub5(vcast_vd_d(1), vmul(dh, th), vmul(dh, tl), vmul(dl, th), vmul(dl, tl)))); - q.y = vadd(vmul(t, vsub(n.y, vmul(q.x, d.y))), u); + q.y = vadd(vmul(t, vsub(n.y, vmul(q.x, d.y))), u); - return q; + return q; } static INLINE vdouble2 mul_ss(vdouble x, vdouble y) { - vdouble xh = vupper(x), xl = vsub(x, xh); - vdouble yh = vupper(y), yl = vsub(y, yh); - vdouble2 r; + vdouble xh = vupper(x), xl = vsub(x, xh); + vdouble yh = vupper(y), yl = vsub(y, yh); + vdouble2 r; - r.x = vmul(x, y); - r.y = vadd5(vmul(xh, yh), vneg(r.x), vmul(xl, yh), vmul(xh, yl), vmul(xl, yl)); + r.x = vmul(x, y); + r.y = vadd5(vmul(xh, yh), vneg(r.x), vmul(xl, yh), vmul(xh, yl), vmul(xl, yl)); - return r; + return r; } static INLINE vdouble2 mul_ds(vdouble2 x, vdouble y) { - vdouble xh = vupper(x.x), xl = vsub(x.x, xh); - vdouble yh = vupper(y ), yl = vsub(y , yh); - vdouble2 r; + vdouble xh = vupper(x.x), xl = vsub(x.x, xh); + vdouble yh = vupper(y ), yl = vsub(y , yh); + vdouble2 r; - r.x = vmul(x.x, y); - r.y = vadd6(vmul(xh, yh), vneg(r.x), vmul(xl, yh), vmul(xh, yl), vmul(xl, yl), vmul(x.y, y)); + r.x = vmul(x.x, y); + r.y = vadd6(vmul(xh, yh), vneg(r.x), vmul(xl, yh), vmul(xh, yl), vmul(xl, yl), vmul(x.y, y)); - return r; + return r; } static INLINE vdouble2 mul_dd(vdouble2 x, vdouble2 y) { - vdouble xh = vupper(x.x), xl = vsub(x.x, xh); - vdouble yh = vupper(y.x), yl = vsub(y.x, yh); - vdouble2 r; + vdouble xh = vupper(x.x), xl = vsub(x.x, xh); + vdouble yh = vupper(y.x), yl = vsub(y.x, yh); + vdouble2 r; - r.x = vmul(x.x, y.x); - r.y = vadd7(vmul(xh, yh), vneg(r.x), vmul(xl, yh), vmul(xh, yl), vmul(xl, yl), vmul(x.x, y.y), vmul(x.y, y.x)); + r.x = vmul(x.x, y.x); + r.y = vadd7(vmul(xh, yh), vneg(r.x), vmul(xl, yh), vmul(xh, yl), vmul(xl, yl), vmul(x.x, y.y), vmul(x.y, y.x)); - return r; + return r; } static INLINE vdouble2 squ_d(vdouble2 x) { - vdouble xh = vupper(x.x), xl = vsub(x.x, xh); - vdouble2 r; + vdouble xh = vupper(x.x), xl = vsub(x.x, xh); + vdouble2 r; - r.x = vmul(x.x, x.x); - r.y = vadd5(vmul(xh, xh), vneg(r.x), vmul(vadd(xh, xh), xl), vmul(xl, xl), vmul(x.x, vadd(x.y, x.y))); + r.x = vmul(x.x, x.x); + r.y = vadd5(vmul(xh, xh), vneg(r.x), vmul(vadd(xh, xh), xl), vmul(xl, xl), vmul(x.x, vadd(x.y, x.y))); - return r; + return r; } static INLINE vdouble2 rec_s(vdouble d) { - vdouble t = vrec(d); - vdouble dh = vupper(d), dl = vsub(d, dh); - vdouble th = vupper(t), tl = vsub(t, th); - vdouble2 q; + vdouble t = vrec(d); + vdouble dh = vupper(d), dl = vsub(d, dh); + vdouble th = vupper(t), tl = vsub(t, th); + vdouble2 q; - q.x = t; - q.y = vmul(t, vsub5(vcast_vd_d(1), vmul(dh, th), vmul(dh, tl), vmul(dl, th), vmul(dl, tl))); + q.x = t; + q.y = vmul(t, vsub5(vcast_vd_d(1), vmul(dh, th), vmul(dh, tl), vmul(dl, th), vmul(dl, tl))); - return q; + return q; } static INLINE vdouble2 sqrt_d(vdouble2 d) { - vdouble t = vsqrt(vadd(d.x, d.y)); - return scale_d(mul_dd(add2_dd(d, mul_ss(t, t)), rec_s(t)), vcast_vd_d(0.5)); + vdouble t = vsqrt(vadd(d.x, d.y)); + return scale_d(mul_dd(add2_dd(d, mul_ss(t, t)), rec_s(t)), vcast_vd_d(0.5)); } // @@ -248,688 +248,688 @@ static INLINE vdouble2 sqrt_d(vdouble2 d) { static INLINE vdouble xldexp(vdouble x, vint q) { return vldexp(x, q); } static INLINE vint xilogb(vdouble d) { - vdouble e = vcast_vd_vi(vsubi(vilogbp1(vabs(d)), vcast_vi_i(1))); - e = vsel(vmask_eq(d, vcast_vd_d(0)), vcast_vd_d(-2147483648.0), e); - e = vsel(vmask_eq(vabs(d), vcast_vd_d(rtengine::RT_INFINITY)), vcast_vd_d(2147483647), e); - return vrint_vi_vd(e); + vdouble e = vcast_vd_vi(vsubi(vilogbp1(vabs(d)), vcast_vi_i(1))); + e = vsel(vmask_eq(d, vcast_vd_d(0)), vcast_vd_d(-2147483648.0), e); + e = vsel(vmask_eq(vabs(d), vcast_vd_d(rtengine::RT_INFINITY)), vcast_vd_d(2147483647), e); + return vrint_vi_vd(e); } static INLINE vdouble xsin(vdouble d) { - vint q; - vdouble u, s; + vint q; + vdouble u, s; - q = vrint_vi_vd(vmul(d, vcast_vd_d(rtengine::RT_1_PI))); + q = vrint_vi_vd(vmul(d, vcast_vd_d(rtengine::RT_1_PI))); - u = vcast_vd_vi(q); - d = vadd(d, vmul(u, vcast_vd_d(-PI4_A*4))); - d = vadd(d, vmul(u, vcast_vd_d(-PI4_B*4))); - d = vadd(d, vmul(u, vcast_vd_d(-PI4_C*4))); + u = vcast_vd_vi(q); + d = vadd(d, vmul(u, vcast_vd_d(-PI4_A*4))); + d = vadd(d, vmul(u, vcast_vd_d(-PI4_B*4))); + d = vadd(d, vmul(u, vcast_vd_d(-PI4_C*4))); - s = vmul(d, d); + s = vmul(d, d); - d = vsel(vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)), vneg(d), d); + d = vsel(vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)), vneg(d), d); - u = vcast_vd_d(-7.97255955009037868891952e-18); - u = vmla(u, s, vcast_vd_d(2.81009972710863200091251e-15)); - u = vmla(u, s, vcast_vd_d(-7.64712219118158833288484e-13)); - u = vmla(u, s, vcast_vd_d(1.60590430605664501629054e-10)); - u = vmla(u, s, vcast_vd_d(-2.50521083763502045810755e-08)); - u = vmla(u, s, vcast_vd_d(2.75573192239198747630416e-06)); - u = vmla(u, s, vcast_vd_d(-0.000198412698412696162806809)); - u = vmla(u, s, vcast_vd_d(0.00833333333333332974823815)); - u = vmla(u, s, vcast_vd_d(-0.166666666666666657414808)); + u = vcast_vd_d(-7.97255955009037868891952e-18); + u = vmla(u, s, vcast_vd_d(2.81009972710863200091251e-15)); + u = vmla(u, s, vcast_vd_d(-7.64712219118158833288484e-13)); + u = vmla(u, s, vcast_vd_d(1.60590430605664501629054e-10)); + u = vmla(u, s, vcast_vd_d(-2.50521083763502045810755e-08)); + u = vmla(u, s, vcast_vd_d(2.75573192239198747630416e-06)); + u = vmla(u, s, vcast_vd_d(-0.000198412698412696162806809)); + u = vmla(u, s, vcast_vd_d(0.00833333333333332974823815)); + u = vmla(u, s, vcast_vd_d(-0.166666666666666657414808)); - u = vmla(s, vmul(u, d), d); + u = vmla(s, vmul(u, d), d); - return u; + return u; } static INLINE vdouble xcos(vdouble d) { - vint q; - vdouble u, s; + vint q; + vdouble u, s; - q = vrint_vi_vd(vsub(vmul(d, vcast_vd_d(rtengine::RT_1_PI)), vcast_vd_d(0.5))); - q = vaddi(vaddi(q, q), vcast_vi_i(1)); + q = vrint_vi_vd(vsub(vmul(d, vcast_vd_d(rtengine::RT_1_PI)), vcast_vd_d(0.5))); + q = vaddi(vaddi(q, q), vcast_vi_i(1)); - u = vcast_vd_vi(q); - d = vadd(d, vmul(u, vcast_vd_d(-PI4_A*2))); - d = vadd(d, vmul(u, vcast_vd_d(-PI4_B*2))); - d = vadd(d, vmul(u, vcast_vd_d(-PI4_C*2))); + u = vcast_vd_vi(q); + d = vadd(d, vmul(u, vcast_vd_d(-PI4_A*2))); + d = vadd(d, vmul(u, vcast_vd_d(-PI4_B*2))); + d = vadd(d, vmul(u, vcast_vd_d(-PI4_C*2))); - s = vmul(d, d); + s = vmul(d, d); - d = vsel(vmaski_eq(vandi(q, vcast_vi_i(2)), vcast_vi_i(0)), vneg(d), d); + d = vsel(vmaski_eq(vandi(q, vcast_vi_i(2)), vcast_vi_i(0)), vneg(d), d); - u = vcast_vd_d(-7.97255955009037868891952e-18); - u = vmla(u, s, vcast_vd_d(2.81009972710863200091251e-15)); - u = vmla(u, s, vcast_vd_d(-7.64712219118158833288484e-13)); - u = vmla(u, s, vcast_vd_d(1.60590430605664501629054e-10)); - u = vmla(u, s, vcast_vd_d(-2.50521083763502045810755e-08)); - u = vmla(u, s, vcast_vd_d(2.75573192239198747630416e-06)); - u = vmla(u, s, vcast_vd_d(-0.000198412698412696162806809)); - u = vmla(u, s, vcast_vd_d(0.00833333333333332974823815)); - u = vmla(u, s, vcast_vd_d(-0.166666666666666657414808)); + u = vcast_vd_d(-7.97255955009037868891952e-18); + u = vmla(u, s, vcast_vd_d(2.81009972710863200091251e-15)); + u = vmla(u, s, vcast_vd_d(-7.64712219118158833288484e-13)); + u = vmla(u, s, vcast_vd_d(1.60590430605664501629054e-10)); + u = vmla(u, s, vcast_vd_d(-2.50521083763502045810755e-08)); + u = vmla(u, s, vcast_vd_d(2.75573192239198747630416e-06)); + u = vmla(u, s, vcast_vd_d(-0.000198412698412696162806809)); + u = vmla(u, s, vcast_vd_d(0.00833333333333332974823815)); + u = vmla(u, s, vcast_vd_d(-0.166666666666666657414808)); - u = vmla(s, vmul(u, d), d); + u = vmla(s, vmul(u, d), d); - return u; + return u; } static INLINE vdouble2 xsincos(vdouble d) { - vint q; - vmask m; - vdouble u, s, t, rx, ry; - vdouble2 r; + vint q; + vmask m; + vdouble u, s, t, rx, ry; + vdouble2 r; - q = vrint_vi_vd(vmul(d, vcast_vd_d(rtengine::RT_2_PI))); + q = vrint_vi_vd(vmul(d, vcast_vd_d(rtengine::RT_2_PI))); - s = d; + s = d; - u = vcast_vd_vi(q); - s = vmla(u, vcast_vd_d(-PI4_A*2), s); - s = vmla(u, vcast_vd_d(-PI4_B*2), s); - s = vmla(u, vcast_vd_d(-PI4_C*2), s); + u = vcast_vd_vi(q); + s = vmla(u, vcast_vd_d(-PI4_A*2), s); + s = vmla(u, vcast_vd_d(-PI4_B*2), s); + s = vmla(u, vcast_vd_d(-PI4_C*2), s); - t = s; + t = s; - s = vmul(s, s); + s = vmul(s, s); - u = vcast_vd_d(1.58938307283228937328511e-10); - u = vmla(u, s, vcast_vd_d(-2.50506943502539773349318e-08)); - u = vmla(u, s, vcast_vd_d(2.75573131776846360512547e-06)); - u = vmla(u, s, vcast_vd_d(-0.000198412698278911770864914)); - u = vmla(u, s, vcast_vd_d(0.0083333333333191845961746)); - u = vmla(u, s, vcast_vd_d(-0.166666666666666130709393)); - u = vmul(vmul(u, s), t); + u = vcast_vd_d(1.58938307283228937328511e-10); + u = vmla(u, s, vcast_vd_d(-2.50506943502539773349318e-08)); + u = vmla(u, s, vcast_vd_d(2.75573131776846360512547e-06)); + u = vmla(u, s, vcast_vd_d(-0.000198412698278911770864914)); + u = vmla(u, s, vcast_vd_d(0.0083333333333191845961746)); + u = vmla(u, s, vcast_vd_d(-0.166666666666666130709393)); + u = vmul(vmul(u, s), t); - rx = vadd(t, u); + rx = vadd(t, u); - u = vcast_vd_d(-1.13615350239097429531523e-11); - u = vmla(u, s, vcast_vd_d(2.08757471207040055479366e-09)); - u = vmla(u, s, vcast_vd_d(-2.75573144028847567498567e-07)); - u = vmla(u, s, vcast_vd_d(2.48015872890001867311915e-05)); - u = vmla(u, s, vcast_vd_d(-0.00138888888888714019282329)); - u = vmla(u, s, vcast_vd_d(0.0416666666666665519592062)); - u = vmla(u, s, vcast_vd_d(-0.5)); + u = vcast_vd_d(-1.13615350239097429531523e-11); + u = vmla(u, s, vcast_vd_d(2.08757471207040055479366e-09)); + u = vmla(u, s, vcast_vd_d(-2.75573144028847567498567e-07)); + u = vmla(u, s, vcast_vd_d(2.48015872890001867311915e-05)); + u = vmla(u, s, vcast_vd_d(-0.00138888888888714019282329)); + u = vmla(u, s, vcast_vd_d(0.0416666666666665519592062)); + u = vmla(u, s, vcast_vd_d(-0.5)); - ry = vadd(vcast_vd_d(1), vmul(s, u)); + ry = vadd(vcast_vd_d(1), vmul(s, u)); - m = vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(0)); - r.x = vsel(m, rx, ry); - r.y = vsel(m, ry, rx); + m = vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(0)); + r.x = vsel(m, rx, ry); + r.y = vsel(m, ry, rx); - m = vmaski_eq(vandi(q, vcast_vi_i(2)), vcast_vi_i(2)); - r.x = vreinterpret_vd_vm(vxorm(vandm(m, vreinterpret_vm_vd(vcast_vd_d(-0.0))), vreinterpret_vm_vd(r.x))); + m = vmaski_eq(vandi(q, vcast_vi_i(2)), vcast_vi_i(2)); + r.x = vreinterpret_vd_vm(vxorm(vandm(m, vreinterpret_vm_vd(vcast_vd_d(-0.0))), vreinterpret_vm_vd(r.x))); - m = vmaski_eq(vandi(vaddi(q, vcast_vi_i(1)), vcast_vi_i(2)), vcast_vi_i(2)); - r.y = vreinterpret_vd_vm(vxorm(vandm(m, vreinterpret_vm_vd(vcast_vd_d(-0.0))), vreinterpret_vm_vd(r.y))); + m = vmaski_eq(vandi(vaddi(q, vcast_vi_i(1)), vcast_vi_i(2)), vcast_vi_i(2)); + r.y = vreinterpret_vd_vm(vxorm(vandm(m, vreinterpret_vm_vd(vcast_vd_d(-0.0))), vreinterpret_vm_vd(r.y))); - m = vmask_isinf(d); - r.x = vsel(m, vcast_vd_d(rtengine::RT_NAN), r.x); - r.y = vsel(m, vcast_vd_d(rtengine::RT_NAN), r.y); + m = vmask_isinf(d); + r.x = vsel(m, vcast_vd_d(rtengine::RT_NAN), r.x); + r.y = vsel(m, vcast_vd_d(rtengine::RT_NAN), r.y); - return r; + return r; } static INLINE vdouble xtan(vdouble d) { - vint q; - vdouble u, s, x; - vmask m; + vint q; + vdouble u, s, x; + vmask m; - q = vrint_vi_vd(vmul(d, vcast_vd_d(rtengine::RT_2_PI))); + q = vrint_vi_vd(vmul(d, vcast_vd_d(rtengine::RT_2_PI))); - u = vcast_vd_vi(q); - x = vadd(d, vmul(u, vcast_vd_d(-PI4_A*2))); - x = vadd(x, vmul(u, vcast_vd_d(-PI4_B*2))); - x = vadd(x, vmul(u, vcast_vd_d(-PI4_C*2))); + u = vcast_vd_vi(q); + x = vadd(d, vmul(u, vcast_vd_d(-PI4_A*2))); + x = vadd(x, vmul(u, vcast_vd_d(-PI4_B*2))); + x = vadd(x, vmul(u, vcast_vd_d(-PI4_C*2))); - s = vmul(x, x); + s = vmul(x, x); - m = vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)); - x = vsel(m, vneg(x), x); + m = vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)); + x = vsel(m, vneg(x), x); - u = vcast_vd_d(1.01419718511083373224408e-05); - u = vmla(u, s, vcast_vd_d(-2.59519791585924697698614e-05)); - u = vmla(u, s, vcast_vd_d(5.23388081915899855325186e-05)); - u = vmla(u, s, vcast_vd_d(-3.05033014433946488225616e-05)); - u = vmla(u, s, vcast_vd_d(7.14707504084242744267497e-05)); - u = vmla(u, s, vcast_vd_d(8.09674518280159187045078e-05)); - u = vmla(u, s, vcast_vd_d(0.000244884931879331847054404)); - u = vmla(u, s, vcast_vd_d(0.000588505168743587154904506)); - u = vmla(u, s, vcast_vd_d(0.00145612788922812427978848)); - u = vmla(u, s, vcast_vd_d(0.00359208743836906619142924)); - u = vmla(u, s, vcast_vd_d(0.00886323944362401618113356)); - u = vmla(u, s, vcast_vd_d(0.0218694882853846389592078)); - u = vmla(u, s, vcast_vd_d(0.0539682539781298417636002)); - u = vmla(u, s, vcast_vd_d(0.133333333333125941821962)); - u = vmla(u, s, vcast_vd_d(0.333333333333334980164153)); + u = vcast_vd_d(1.01419718511083373224408e-05); + u = vmla(u, s, vcast_vd_d(-2.59519791585924697698614e-05)); + u = vmla(u, s, vcast_vd_d(5.23388081915899855325186e-05)); + u = vmla(u, s, vcast_vd_d(-3.05033014433946488225616e-05)); + u = vmla(u, s, vcast_vd_d(7.14707504084242744267497e-05)); + u = vmla(u, s, vcast_vd_d(8.09674518280159187045078e-05)); + u = vmla(u, s, vcast_vd_d(0.000244884931879331847054404)); + u = vmla(u, s, vcast_vd_d(0.000588505168743587154904506)); + u = vmla(u, s, vcast_vd_d(0.00145612788922812427978848)); + u = vmla(u, s, vcast_vd_d(0.00359208743836906619142924)); + u = vmla(u, s, vcast_vd_d(0.00886323944362401618113356)); + u = vmla(u, s, vcast_vd_d(0.0218694882853846389592078)); + u = vmla(u, s, vcast_vd_d(0.0539682539781298417636002)); + u = vmla(u, s, vcast_vd_d(0.133333333333125941821962)); + u = vmla(u, s, vcast_vd_d(0.333333333333334980164153)); - u = vmla(s, vmul(u, x), x); + u = vmla(s, vmul(u, x), x); - u = vsel(m, vrec(u), u); + u = vsel(m, vrec(u), u); - u = vsel(vmask_isinf(d), vcast_vd_d(rtengine::RT_NAN), u); + u = vsel(vmask_isinf(d), vcast_vd_d(rtengine::RT_NAN), u); - return u; + return u; } static INLINE vdouble atan2k(vdouble y, vdouble x) { - vdouble s, t, u; - vint q; - vmask p; + vdouble s, t, u; + vint q; + vmask p; - q = vseli_lt(x, vcast_vd_d(0), vcast_vi_i(-2), vcast_vi_i(0)); - x = vabs(x); + q = vseli_lt(x, vcast_vd_d(0), vcast_vi_i(-2), vcast_vi_i(0)); + x = vabs(x); - q = vseli_lt(x, y, vaddi(q, vcast_vi_i(1)), q); - p = vmask_lt(x, y); - s = vsel (p, vneg(x), y); - t = vmax (x, y); + q = vseli_lt(x, y, vaddi(q, vcast_vi_i(1)), q); + p = vmask_lt(x, y); + s = vsel (p, vneg(x), y); + t = vmax (x, y); - s = vdiv(s, t); - t = vmul(s, s); + s = vdiv(s, t); + t = vmul(s, s); - u = vcast_vd_d(-1.88796008463073496563746e-05); - u = vmla(u, t, vcast_vd_d(0.000209850076645816976906797)); - u = vmla(u, t, vcast_vd_d(-0.00110611831486672482563471)); - u = vmla(u, t, vcast_vd_d(0.00370026744188713119232403)); - u = vmla(u, t, vcast_vd_d(-0.00889896195887655491740809)); - u = vmla(u, t, vcast_vd_d(0.016599329773529201970117)); - u = vmla(u, t, vcast_vd_d(-0.0254517624932312641616861)); - u = vmla(u, t, vcast_vd_d(0.0337852580001353069993897)); - u = vmla(u, t, vcast_vd_d(-0.0407629191276836500001934)); - u = vmla(u, t, vcast_vd_d(0.0466667150077840625632675)); - u = vmla(u, t, vcast_vd_d(-0.0523674852303482457616113)); - u = vmla(u, t, vcast_vd_d(0.0587666392926673580854313)); - u = vmla(u, t, vcast_vd_d(-0.0666573579361080525984562)); - u = vmla(u, t, vcast_vd_d(0.0769219538311769618355029)); - u = vmla(u, t, vcast_vd_d(-0.090908995008245008229153)); - u = vmla(u, t, vcast_vd_d(0.111111105648261418443745)); - u = vmla(u, t, vcast_vd_d(-0.14285714266771329383765)); - u = vmla(u, t, vcast_vd_d(0.199999999996591265594148)); - u = vmla(u, t, vcast_vd_d(-0.333333333333311110369124)); + u = vcast_vd_d(-1.88796008463073496563746e-05); + u = vmla(u, t, vcast_vd_d(0.000209850076645816976906797)); + u = vmla(u, t, vcast_vd_d(-0.00110611831486672482563471)); + u = vmla(u, t, vcast_vd_d(0.00370026744188713119232403)); + u = vmla(u, t, vcast_vd_d(-0.00889896195887655491740809)); + u = vmla(u, t, vcast_vd_d(0.016599329773529201970117)); + u = vmla(u, t, vcast_vd_d(-0.0254517624932312641616861)); + u = vmla(u, t, vcast_vd_d(0.0337852580001353069993897)); + u = vmla(u, t, vcast_vd_d(-0.0407629191276836500001934)); + u = vmla(u, t, vcast_vd_d(0.0466667150077840625632675)); + u = vmla(u, t, vcast_vd_d(-0.0523674852303482457616113)); + u = vmla(u, t, vcast_vd_d(0.0587666392926673580854313)); + u = vmla(u, t, vcast_vd_d(-0.0666573579361080525984562)); + u = vmla(u, t, vcast_vd_d(0.0769219538311769618355029)); + u = vmla(u, t, vcast_vd_d(-0.090908995008245008229153)); + u = vmla(u, t, vcast_vd_d(0.111111105648261418443745)); + u = vmla(u, t, vcast_vd_d(-0.14285714266771329383765)); + u = vmla(u, t, vcast_vd_d(0.199999999996591265594148)); + u = vmla(u, t, vcast_vd_d(-0.333333333333311110369124)); - t = vadd(s, vmul(s, vmul(t, u))); - t = vadd(t, vmul(vcast_vd_vi(q), vcast_vd_d(rtengine::RT_PI/2))); + t = vadd(s, vmul(s, vmul(t, u))); + t = vadd(t, vmul(vcast_vd_vi(q), vcast_vd_d(rtengine::RT_PI/2))); - return t; + return t; } static INLINE vdouble xatan2(vdouble y, vdouble x) { - vdouble r = atan2k(vabs(y), x); + vdouble r = atan2k(vabs(y), x); - r = vmulsign(r, x); - r = vsel(vorm(vmask_isinf(x), vmask_eq(x, vcast_vd_d(0))), vsub(vcast_vd_d(rtengine::RT_PI/2), visinf2(x, vmulsign(vcast_vd_d(rtengine::RT_PI/2), x))), r); - r = vsel(vmask_isinf(y), vsub(vcast_vd_d(rtengine::RT_PI/2), visinf2(x, vmulsign(vcast_vd_d(rtengine::RT_PI/4), x))), r); - r = vsel(vmask_eq(y, vcast_vd_d(0)), vsel(vmask_eq(vsign(x), vcast_vd_d(-1.0)), vcast_vd_d(rtengine::RT_PI), vcast_vd_d(0)), r); + r = vmulsign(r, x); + r = vsel(vorm(vmask_isinf(x), vmask_eq(x, vcast_vd_d(0))), vsub(vcast_vd_d(rtengine::RT_PI/2), visinf2(x, vmulsign(vcast_vd_d(rtengine::RT_PI/2), x))), r); + r = vsel(vmask_isinf(y), vsub(vcast_vd_d(rtengine::RT_PI/2), visinf2(x, vmulsign(vcast_vd_d(rtengine::RT_PI/4), x))), r); + r = vsel(vmask_eq(y, vcast_vd_d(0)), vsel(vmask_eq(vsign(x), vcast_vd_d(-1.0)), vcast_vd_d(rtengine::RT_PI), vcast_vd_d(0)), r); - return vsel(vorm(vmask_isnan(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_NAN), vmulsign(r, y)); + return vsel(vorm(vmask_isnan(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_NAN), vmulsign(r, y)); } static INLINE vdouble xasin(vdouble d) { - vdouble x, y; - x = vadd(vcast_vd_d(1), d); - y = vsub(vcast_vd_d(1), d); - x = vmul(x, y); - x = vsqrt(x); - x = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), atan2k(vabs(d), x)); - return vmulsign(x, d); + vdouble x, y; + x = vadd(vcast_vd_d(1), d); + y = vsub(vcast_vd_d(1), d); + x = vmul(x, y); + x = vsqrt(x); + x = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), atan2k(vabs(d), x)); + return vmulsign(x, d); } static INLINE vdouble xacos(vdouble d) { - vdouble x, y; - x = vadd(vcast_vd_d(1), d); - y = vsub(vcast_vd_d(1), d); - x = vmul(x, y); - x = vsqrt(x); - x = vmulsign(atan2k(x, vabs(d)), d); - y = (vdouble)vandm(vmask_lt(d, vcast_vd_d(0)), (vmask)vcast_vd_d(rtengine::RT_PI)); - x = vadd(x, y); - return x; + vdouble x, y; + x = vadd(vcast_vd_d(1), d); + y = vsub(vcast_vd_d(1), d); + x = vmul(x, y); + x = vsqrt(x); + x = vmulsign(atan2k(x, vabs(d)), d); + y = (vdouble)vandm(vmask_lt(d, vcast_vd_d(0)), (vmask)vcast_vd_d(rtengine::RT_PI)); + x = vadd(x, y); + return x; } static INLINE vdouble xatan(vdouble s) { - vdouble t, u; - vint q; + vdouble t, u; + vint q; - q = vseli_lt(s, vcast_vd_d(0), vcast_vi_i(2), vcast_vi_i(0)); - s = vabs(s); + q = vseli_lt(s, vcast_vd_d(0), vcast_vi_i(2), vcast_vi_i(0)); + s = vabs(s); - q = vseli_lt(vcast_vd_d(1), s, vaddi(q, vcast_vi_i(1)), q); - s = vsel(vmask_lt(vcast_vd_d(1), s), vdiv(vcast_vd_d(1), s), s); + q = vseli_lt(vcast_vd_d(1), s, vaddi(q, vcast_vi_i(1)), q); + s = vsel(vmask_lt(vcast_vd_d(1), s), vdiv(vcast_vd_d(1), s), s); - t = vmul(s, s); + t = vmul(s, s); - u = vcast_vd_d(-1.88796008463073496563746e-05); - u = vmla(u, t, vcast_vd_d(0.000209850076645816976906797)); - u = vmla(u, t, vcast_vd_d(-0.00110611831486672482563471)); - u = vmla(u, t, vcast_vd_d(0.00370026744188713119232403)); - u = vmla(u, t, vcast_vd_d(-0.00889896195887655491740809)); - u = vmla(u, t, vcast_vd_d(0.016599329773529201970117)); - u = vmla(u, t, vcast_vd_d(-0.0254517624932312641616861)); - u = vmla(u, t, vcast_vd_d(0.0337852580001353069993897)); - u = vmla(u, t, vcast_vd_d(-0.0407629191276836500001934)); - u = vmla(u, t, vcast_vd_d(0.0466667150077840625632675)); - u = vmla(u, t, vcast_vd_d(-0.0523674852303482457616113)); - u = vmla(u, t, vcast_vd_d(0.0587666392926673580854313)); - u = vmla(u, t, vcast_vd_d(-0.0666573579361080525984562)); - u = vmla(u, t, vcast_vd_d(0.0769219538311769618355029)); - u = vmla(u, t, vcast_vd_d(-0.090908995008245008229153)); - u = vmla(u, t, vcast_vd_d(0.111111105648261418443745)); - u = vmla(u, t, vcast_vd_d(-0.14285714266771329383765)); - u = vmla(u, t, vcast_vd_d(0.199999999996591265594148)); - u = vmla(u, t, vcast_vd_d(-0.333333333333311110369124)); + u = vcast_vd_d(-1.88796008463073496563746e-05); + u = vmla(u, t, vcast_vd_d(0.000209850076645816976906797)); + u = vmla(u, t, vcast_vd_d(-0.00110611831486672482563471)); + u = vmla(u, t, vcast_vd_d(0.00370026744188713119232403)); + u = vmla(u, t, vcast_vd_d(-0.00889896195887655491740809)); + u = vmla(u, t, vcast_vd_d(0.016599329773529201970117)); + u = vmla(u, t, vcast_vd_d(-0.0254517624932312641616861)); + u = vmla(u, t, vcast_vd_d(0.0337852580001353069993897)); + u = vmla(u, t, vcast_vd_d(-0.0407629191276836500001934)); + u = vmla(u, t, vcast_vd_d(0.0466667150077840625632675)); + u = vmla(u, t, vcast_vd_d(-0.0523674852303482457616113)); + u = vmla(u, t, vcast_vd_d(0.0587666392926673580854313)); + u = vmla(u, t, vcast_vd_d(-0.0666573579361080525984562)); + u = vmla(u, t, vcast_vd_d(0.0769219538311769618355029)); + u = vmla(u, t, vcast_vd_d(-0.090908995008245008229153)); + u = vmla(u, t, vcast_vd_d(0.111111105648261418443745)); + u = vmla(u, t, vcast_vd_d(-0.14285714266771329383765)); + u = vmla(u, t, vcast_vd_d(0.199999999996591265594148)); + u = vmla(u, t, vcast_vd_d(-0.333333333333311110369124)); - t = vadd(s, vmul(s, vmul(t, u))); + t = vadd(s, vmul(s, vmul(t, u))); - t = vsel(vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)), vsub(vcast_vd_d(rtengine::RT_PI/2), t), t); - t = vsel(vmaski_eq(vandi(q, vcast_vi_i(2)), vcast_vi_i(2)), vneg(t), t); + t = vsel(vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)), vsub(vcast_vd_d(rtengine::RT_PI/2), t), t); + t = vsel(vmaski_eq(vandi(q, vcast_vi_i(2)), vcast_vi_i(2)), vneg(t), t); - return t; + return t; } static INLINE vdouble xlog(vdouble d) { - vdouble x, x2; - vdouble t, m; - vint e; + vdouble x, x2; + vdouble t, m; + vint e; - e = vilogbp1(vmul(d, vcast_vd_d(0.7071))); - m = vldexp(d, vsubi(vcast_vi_i(0), e)); + e = vilogbp1(vmul(d, vcast_vd_d(0.7071))); + m = vldexp(d, vsubi(vcast_vi_i(0), e)); - x = vdiv(vadd(vcast_vd_d(-1), m), vadd(vcast_vd_d(1), m)); - x2 = vmul(x, x); + x = vdiv(vadd(vcast_vd_d(-1), m), vadd(vcast_vd_d(1), m)); + x2 = vmul(x, x); - t = vcast_vd_d(0.148197055177935105296783); - t = vmla(t, x2, vcast_vd_d(0.153108178020442575739679)); - t = vmla(t, x2, vcast_vd_d(0.181837339521549679055568)); - t = vmla(t, x2, vcast_vd_d(0.22222194152736701733275)); - t = vmla(t, x2, vcast_vd_d(0.285714288030134544449368)); - t = vmla(t, x2, vcast_vd_d(0.399999999989941956712869)); - t = vmla(t, x2, vcast_vd_d(0.666666666666685503450651)); - t = vmla(t, x2, vcast_vd_d(2)); + t = vcast_vd_d(0.148197055177935105296783); + t = vmla(t, x2, vcast_vd_d(0.153108178020442575739679)); + t = vmla(t, x2, vcast_vd_d(0.181837339521549679055568)); + t = vmla(t, x2, vcast_vd_d(0.22222194152736701733275)); + t = vmla(t, x2, vcast_vd_d(0.285714288030134544449368)); + t = vmla(t, x2, vcast_vd_d(0.399999999989941956712869)); + t = vmla(t, x2, vcast_vd_d(0.666666666666685503450651)); + t = vmla(t, x2, vcast_vd_d(2)); - x = vadd(vmul(x, t), vmul(vcast_vd_d(0.693147180559945286226764), vcast_vd_vi(e))); + x = vadd(vmul(x, t), vmul(vcast_vd_d(0.693147180559945286226764), vcast_vd_vi(e))); - x = vsel(vmask_ispinf(d), vcast_vd_d(rtengine::RT_INFINITY), x); - x = vsel(vmask_gt(vcast_vd_d(0), d), vcast_vd_d(rtengine::RT_NAN), x); - x = vsel(vmask_eq(d, vcast_vd_d(0)), vcast_vd_d(-rtengine::RT_INFINITY), x); + x = vsel(vmask_ispinf(d), vcast_vd_d(rtengine::RT_INFINITY), x); + x = vsel(vmask_gt(vcast_vd_d(0), d), vcast_vd_d(rtengine::RT_NAN), x); + x = vsel(vmask_eq(d, vcast_vd_d(0)), vcast_vd_d(-rtengine::RT_INFINITY), x); - return x; + return x; } static INLINE vdouble xexp(vdouble d) { - vint q = vrint_vi_vd(vmul(d, vcast_vd_d(R_LN2))); - vdouble s, u; + vint q = vrint_vi_vd(vmul(d, vcast_vd_d(R_LN2))); + vdouble s, u; - s = vadd(d, vmul(vcast_vd_vi(q), vcast_vd_d(-L2U))); - s = vadd(s, vmul(vcast_vd_vi(q), vcast_vd_d(-L2L))); + s = vadd(d, vmul(vcast_vd_vi(q), vcast_vd_d(-L2U))); + s = vadd(s, vmul(vcast_vd_vi(q), vcast_vd_d(-L2L))); - u = vcast_vd_d(2.08860621107283687536341e-09); - u = vmla(u, s, vcast_vd_d(2.51112930892876518610661e-08)); - u = vmla(u, s, vcast_vd_d(2.75573911234900471893338e-07)); - u = vmla(u, s, vcast_vd_d(2.75572362911928827629423e-06)); - u = vmla(u, s, vcast_vd_d(2.4801587159235472998791e-05)); - u = vmla(u, s, vcast_vd_d(0.000198412698960509205564975)); - u = vmla(u, s, vcast_vd_d(0.00138888888889774492207962)); - u = vmla(u, s, vcast_vd_d(0.00833333333331652721664984)); - u = vmla(u, s, vcast_vd_d(0.0416666666666665047591422)); - u = vmla(u, s, vcast_vd_d(0.166666666666666851703837)); - u = vmla(u, s, vcast_vd_d(0.5)); + u = vcast_vd_d(2.08860621107283687536341e-09); + u = vmla(u, s, vcast_vd_d(2.51112930892876518610661e-08)); + u = vmla(u, s, vcast_vd_d(2.75573911234900471893338e-07)); + u = vmla(u, s, vcast_vd_d(2.75572362911928827629423e-06)); + u = vmla(u, s, vcast_vd_d(2.4801587159235472998791e-05)); + u = vmla(u, s, vcast_vd_d(0.000198412698960509205564975)); + u = vmla(u, s, vcast_vd_d(0.00138888888889774492207962)); + u = vmla(u, s, vcast_vd_d(0.00833333333331652721664984)); + u = vmla(u, s, vcast_vd_d(0.0416666666666665047591422)); + u = vmla(u, s, vcast_vd_d(0.166666666666666851703837)); + u = vmla(u, s, vcast_vd_d(0.5)); - u = vadd(vcast_vd_d(1), vadd(s, vmul(vmul(s, s), u))); + u = vadd(vcast_vd_d(1), vadd(s, vmul(vmul(s, s), u))); - u = vldexp(u, q); + u = vldexp(u, q); - u = vsel(vmask_isminf(d), vcast_vd_d(0), u); + u = vsel(vmask_isminf(d), vcast_vd_d(0), u); - return u; + return u; } static INLINE vdouble2 logk(vdouble d) { - vdouble2 x, x2; - vdouble t, m; - vint e; + vdouble2 x, x2; + vdouble t, m; + vint e; - e = vilogbp1(vmul(d, vcast_vd_d(0.7071))); - m = vldexp(d, vsubi(vcast_vi_i(0), e)); + e = vilogbp1(vmul(d, vcast_vd_d(0.7071))); + m = vldexp(d, vsubi(vcast_vi_i(0), e)); - x = div_dd(add2_ss(vcast_vd_d(-1), m), add2_ss(vcast_vd_d(1), m)); - x2 = squ_d(x); - x2 = normalize_d(x2); + x = div_dd(add2_ss(vcast_vd_d(-1), m), add2_ss(vcast_vd_d(1), m)); + x2 = squ_d(x); + x2 = normalize_d(x2); - t = vcast_vd_d(0.134601987501262130076155); - t = vmla(t, x2.x, vcast_vd_d(0.132248509032032670243288)); - t = vmla(t, x2.x, vcast_vd_d(0.153883458318096079652524)); - t = vmla(t, x2.x, vcast_vd_d(0.181817427573705403298686)); - t = vmla(t, x2.x, vcast_vd_d(0.222222231326187414840781)); - t = vmla(t, x2.x, vcast_vd_d(0.285714285651261412873718)); - t = vmla(t, x2.x, vcast_vd_d(0.400000000000222439910458)); - t = vmla(t, x2.x, vcast_vd_d(0.666666666666666371239645)); + t = vcast_vd_d(0.134601987501262130076155); + t = vmla(t, x2.x, vcast_vd_d(0.132248509032032670243288)); + t = vmla(t, x2.x, vcast_vd_d(0.153883458318096079652524)); + t = vmla(t, x2.x, vcast_vd_d(0.181817427573705403298686)); + t = vmla(t, x2.x, vcast_vd_d(0.222222231326187414840781)); + t = vmla(t, x2.x, vcast_vd_d(0.285714285651261412873718)); + t = vmla(t, x2.x, vcast_vd_d(0.400000000000222439910458)); + t = vmla(t, x2.x, vcast_vd_d(0.666666666666666371239645)); - return add2_dd(mul_ds(dd(vcast_vd_d(0.693147180559945286226764), vcast_vd_d(2.319046813846299558417771e-17)), - vcast_vd_vi(e)), - add2_dd(scale_d(x, vcast_vd_d(2)), mul_ds(mul_dd(x2, x), t))); + return add2_dd(mul_ds(dd(vcast_vd_d(0.693147180559945286226764), vcast_vd_d(2.319046813846299558417771e-17)), + vcast_vd_vi(e)), + add2_dd(scale_d(x, vcast_vd_d(2)), mul_ds(mul_dd(x2, x), t))); } static INLINE vdouble expk(vdouble2 d) { - vdouble u = vmul(vadd(d.x, d.y), vcast_vd_d(R_LN2)); - vint q = vrint_vi_vd(u); - vdouble2 s, t; + vdouble u = vmul(vadd(d.x, d.y), vcast_vd_d(R_LN2)); + vint q = vrint_vi_vd(u); + vdouble2 s, t; - s = add2_ds(d, vmul(vcast_vd_vi(q), vcast_vd_d(-L2U))); - s = add2_ds(s, vmul(vcast_vd_vi(q), vcast_vd_d(-L2L))); + s = add2_ds(d, vmul(vcast_vd_vi(q), vcast_vd_d(-L2U))); + s = add2_ds(s, vmul(vcast_vd_vi(q), vcast_vd_d(-L2L))); - q = vrint_vi_vd(vmin(vmax(vcast_vd_d(-2047.49), u), vcast_vd_d(2047.49))); + q = vrint_vi_vd(vmin(vmax(vcast_vd_d(-2047.49), u), vcast_vd_d(2047.49))); - s = normalize_d(s); + s = normalize_d(s); - u = vcast_vd_d(2.51069683420950419527139e-08); - u = vmla(u, s.x, vcast_vd_d(2.76286166770270649116855e-07)); - u = vmla(u, s.x, vcast_vd_d(2.75572496725023574143864e-06)); - u = vmla(u, s.x, vcast_vd_d(2.48014973989819794114153e-05)); - u = vmla(u, s.x, vcast_vd_d(0.000198412698809069797676111)); - u = vmla(u, s.x, vcast_vd_d(0.0013888888939977128960529)); - u = vmla(u, s.x, vcast_vd_d(0.00833333333332371417601081)); - u = vmla(u, s.x, vcast_vd_d(0.0416666666665409524128449)); - u = vmla(u, s.x, vcast_vd_d(0.166666666666666740681535)); - u = vmla(u, s.x, vcast_vd_d(0.500000000000000999200722)); + u = vcast_vd_d(2.51069683420950419527139e-08); + u = vmla(u, s.x, vcast_vd_d(2.76286166770270649116855e-07)); + u = vmla(u, s.x, vcast_vd_d(2.75572496725023574143864e-06)); + u = vmla(u, s.x, vcast_vd_d(2.48014973989819794114153e-05)); + u = vmla(u, s.x, vcast_vd_d(0.000198412698809069797676111)); + u = vmla(u, s.x, vcast_vd_d(0.0013888888939977128960529)); + u = vmla(u, s.x, vcast_vd_d(0.00833333333332371417601081)); + u = vmla(u, s.x, vcast_vd_d(0.0416666666665409524128449)); + u = vmla(u, s.x, vcast_vd_d(0.166666666666666740681535)); + u = vmla(u, s.x, vcast_vd_d(0.500000000000000999200722)); - t = add_dd(s, mul_ds(squ_d(s), u)); + t = add_dd(s, mul_ds(squ_d(s), u)); - t = add_sd(vcast_vd_d(1), t); - u = vadd(t.x, t.y); - u = vldexp(u, q); + t = add_sd(vcast_vd_d(1), t); + u = vadd(t.x, t.y); + u = vldexp(u, q); - return u; + return u; } static INLINE vdouble xpow(vdouble x, vdouble y) { #if 1 - vmask yisint = vmask_eq(vcast_vd_vi(vrint_vi_vd(y)), y); - vmask yisodd = vandm(vmaski_eq(vandi(vrint_vi_vd(y), vcast_vi_i(1)), vcast_vi_i(1)), yisint); + vmask yisint = vmask_eq(vcast_vd_vi(vrint_vi_vd(y)), y); + vmask yisodd = vandm(vmaski_eq(vandi(vrint_vi_vd(y), vcast_vi_i(1)), vcast_vi_i(1)), yisint); - vdouble result = expk(mul_ds(logk(vabs(x)), y)); + vdouble result = expk(mul_ds(logk(vabs(x)), y)); - //result = vsel(vmask_isnan(result), vcast_vd_d(rtengine::RT_INFINITY), result); + //result = vsel(vmask_isnan(result), vcast_vd_d(rtengine::RT_INFINITY), result); - result = vmul(result, - vsel(vmask_gt(x, vcast_vd_d(0)), - vcast_vd_d(1), - vsel(yisint, - vsel(yisodd, - vcast_vd_d(-1), - vcast_vd_d(1)), - vcast_vd_d(rtengine::RT_NAN)))); + result = vmul(result, + vsel(vmask_gt(x, vcast_vd_d(0)), + vcast_vd_d(1), + vsel(yisint, + vsel(yisodd, + vcast_vd_d(-1), + vcast_vd_d(1)), + vcast_vd_d(rtengine::RT_NAN)))); - vdouble efx = vreinterpret_vd_vm(vxorm(vreinterpret_vm_vd(vsub(vabs(x), vcast_vd_d(1))), vsignbit(y))); + vdouble efx = vreinterpret_vd_vm(vxorm(vreinterpret_vm_vd(vsub(vabs(x), vcast_vd_d(1))), vsignbit(y))); - result = vsel(vmask_isinf(y), - vsel(vmask_lt(efx, vcast_vd_d(0)), - vcast_vd_d(0), - vsel(vmask_eq(efx, vcast_vd_d(0)), - vcast_vd_d(1.0), - vcast_vd_d(rtengine::RT_INFINITY))), - result); + result = vsel(vmask_isinf(y), + vsel(vmask_lt(efx, vcast_vd_d(0)), + vcast_vd_d(0), + vsel(vmask_eq(efx, vcast_vd_d(0)), + vcast_vd_d(1.0), + vcast_vd_d(rtengine::RT_INFINITY))), + result); - result = vsel(vorm(vmask_isinf(x), vmask_eq(x, vcast_vd_d(0))), - vmul(vsel(yisodd, vsign(x), vcast_vd_d(1)), - vsel(vmask_lt(vsel(vmask_eq(x, vcast_vd_d(0)), vneg(y), y), vcast_vd_d(0)), - vcast_vd_d(0), - vcast_vd_d(rtengine::RT_INFINITY))), - result); + result = vsel(vorm(vmask_isinf(x), vmask_eq(x, vcast_vd_d(0))), + vmul(vsel(yisodd, vsign(x), vcast_vd_d(1)), + vsel(vmask_lt(vsel(vmask_eq(x, vcast_vd_d(0)), vneg(y), y), vcast_vd_d(0)), + vcast_vd_d(0), + vcast_vd_d(rtengine::RT_INFINITY))), + result); - result = vsel(vorm(vmask_isnan(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_NAN), result); + result = vsel(vorm(vmask_isnan(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_NAN), result); - result = vsel(vorm(vmask_eq(y, vcast_vd_d(0)), vmask_eq(x, vcast_vd_d(1))), vcast_vd_d(1), result); + result = vsel(vorm(vmask_eq(y, vcast_vd_d(0)), vmask_eq(x, vcast_vd_d(1))), vcast_vd_d(1), result); - return result; + return result; #else - return expk(mul_ds(logk(x), y)); + return expk(mul_ds(logk(x), y)); #endif } static INLINE vdouble2 expk2(vdouble2 d) { - vdouble u = vmul(vadd(d.x, d.y), vcast_vd_d(R_LN2)); - vint q = vrint_vi_vd(u); - vdouble2 s, t; + vdouble u = vmul(vadd(d.x, d.y), vcast_vd_d(R_LN2)); + vint q = vrint_vi_vd(u); + vdouble2 s, t; - s = add2_ds(d, vmul(vcast_vd_vi(q), vcast_vd_d(-L2U))); - s = add2_ds(s, vmul(vcast_vd_vi(q), vcast_vd_d(-L2L))); + s = add2_ds(d, vmul(vcast_vd_vi(q), vcast_vd_d(-L2U))); + s = add2_ds(s, vmul(vcast_vd_vi(q), vcast_vd_d(-L2L))); - q = vrint_vi_vd(vmin(vmax(vcast_vd_d(-2047.49), u), vcast_vd_d(2047.49))); + q = vrint_vi_vd(vmin(vmax(vcast_vd_d(-2047.49), u), vcast_vd_d(2047.49))); - s = normalize_d(s); + s = normalize_d(s); - u = vcast_vd_d(2.51069683420950419527139e-08); - u = vmla(u, s.x, vcast_vd_d(2.76286166770270649116855e-07)); - u = vmla(u, s.x, vcast_vd_d(2.75572496725023574143864e-06)); - u = vmla(u, s.x, vcast_vd_d(2.48014973989819794114153e-05)); - u = vmla(u, s.x, vcast_vd_d(0.000198412698809069797676111)); - u = vmla(u, s.x, vcast_vd_d(0.0013888888939977128960529)); - u = vmla(u, s.x, vcast_vd_d(0.00833333333332371417601081)); - u = vmla(u, s.x, vcast_vd_d(0.0416666666665409524128449)); - u = vmla(u, s.x, vcast_vd_d(0.166666666666666740681535)); - u = vmla(u, s.x, vcast_vd_d(0.500000000000000999200722)); + u = vcast_vd_d(2.51069683420950419527139e-08); + u = vmla(u, s.x, vcast_vd_d(2.76286166770270649116855e-07)); + u = vmla(u, s.x, vcast_vd_d(2.75572496725023574143864e-06)); + u = vmla(u, s.x, vcast_vd_d(2.48014973989819794114153e-05)); + u = vmla(u, s.x, vcast_vd_d(0.000198412698809069797676111)); + u = vmla(u, s.x, vcast_vd_d(0.0013888888939977128960529)); + u = vmla(u, s.x, vcast_vd_d(0.00833333333332371417601081)); + u = vmla(u, s.x, vcast_vd_d(0.0416666666665409524128449)); + u = vmla(u, s.x, vcast_vd_d(0.166666666666666740681535)); + u = vmla(u, s.x, vcast_vd_d(0.500000000000000999200722)); - t = add_dd(s, mul_ds(squ_d(s), u)); + t = add_dd(s, mul_ds(squ_d(s), u)); - t = add_sd(vcast_vd_d(1), t); + t = add_sd(vcast_vd_d(1), t); - return dd(vldexp(t.x, q), vldexp(t.y, q)); + return dd(vldexp(t.x, q), vldexp(t.y, q)); } static INLINE vdouble xsinh(vdouble x) { - vdouble y = vabs(x); - vdouble2 d = expk2(dd(y, vcast_vd_d(0))); - d = add2_dd(d, div_dd(dd(vcast_vd_d(-1), vcast_vd_d(0)), d)); - y = vmul(vadd(d.x, d.y), vcast_vd_d(0.5)); + vdouble y = vabs(x); + vdouble2 d = expk2(dd(y, vcast_vd_d(0))); + d = add2_dd(d, div_dd(dd(vcast_vd_d(-1), vcast_vd_d(0)), d)); + y = vmul(vadd(d.x, d.y), vcast_vd_d(0.5)); - y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); - y = vmulsign(y, x); - y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); + y = vmulsign(y, x); + y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); - return y; + return y; } static INLINE vdouble xcosh(vdouble x) { - vdouble2 d = expk2(dd(x, vcast_vd_d(0))); - d = add2_dd(d, div_dd(dd(vcast_vd_d(1), vcast_vd_d(0)), d)); - vdouble y = vmul(vadd(d.x, d.y), vcast_vd_d(0.5)); + vdouble2 d = expk2(dd(x, vcast_vd_d(0))); + d = add2_dd(d, div_dd(dd(vcast_vd_d(1), vcast_vd_d(0)), d)); + vdouble y = vmul(vadd(d.x, d.y), vcast_vd_d(0.5)); - y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); - y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); + y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); - return y; + return y; } static INLINE vdouble xtanh(vdouble x) { - vdouble y = vabs(x); - vdouble2 d = expk2(dd(y, vcast_vd_d(0))); - vdouble2 e = div_dd(dd(vcast_vd_d(1), vcast_vd_d(0)), d); - d = div_dd(add2_dd(d, scale_d(e, vcast_vd_d(-1))), add2_dd(d, e)); - y = d.x + d.y; + vdouble y = vabs(x); + vdouble2 d = expk2(dd(y, vcast_vd_d(0))); + vdouble2 e = div_dd(dd(vcast_vd_d(1), vcast_vd_d(0)), d); + d = div_dd(add2_dd(d, scale_d(e, vcast_vd_d(-1))), add2_dd(d, e)); + y = d.x + d.y; - y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(1.0), y); - y = vmulsign(y, x); - y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(1.0), y); + y = vmulsign(y, x); + y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); - return y; + return y; } static INLINE vdouble2 logk2(vdouble2 d) { - vdouble2 x, x2, m; - vdouble t; - vint e; + vdouble2 x, x2, m; + vdouble t; + vint e; - d = normalize_d(d); - e = vilogbp1(vmul(d.x, vcast_vd_d(0.7071))); - m = scale_d(d, vldexp(vcast_vd_d(1), vsubi(vcast_vi_i(0), e))); + d = normalize_d(d); + e = vilogbp1(vmul(d.x, vcast_vd_d(0.7071))); + m = scale_d(d, vldexp(vcast_vd_d(1), vsubi(vcast_vi_i(0), e))); - x = div_dd(add2_ds(m, vcast_vd_d(-1)), add2_ds(m, vcast_vd_d(1))); - x2 = squ_d(x); - x2 = normalize_d(x2); + x = div_dd(add2_ds(m, vcast_vd_d(-1)), add2_ds(m, vcast_vd_d(1))); + x2 = squ_d(x); + x2 = normalize_d(x2); - t = vcast_vd_d(0.134601987501262130076155); - t = vmla(t, x2.x, vcast_vd_d(0.132248509032032670243288)); - t = vmla(t, x2.x, vcast_vd_d(0.153883458318096079652524)); - t = vmla(t, x2.x, vcast_vd_d(0.181817427573705403298686)); - t = vmla(t, x2.x, vcast_vd_d(0.222222231326187414840781)); - t = vmla(t, x2.x, vcast_vd_d(0.285714285651261412873718)); - t = vmla(t, x2.x, vcast_vd_d(0.400000000000222439910458)); - t = vmla(t, x2.x, vcast_vd_d(0.666666666666666371239645)); + t = vcast_vd_d(0.134601987501262130076155); + t = vmla(t, x2.x, vcast_vd_d(0.132248509032032670243288)); + t = vmla(t, x2.x, vcast_vd_d(0.153883458318096079652524)); + t = vmla(t, x2.x, vcast_vd_d(0.181817427573705403298686)); + t = vmla(t, x2.x, vcast_vd_d(0.222222231326187414840781)); + t = vmla(t, x2.x, vcast_vd_d(0.285714285651261412873718)); + t = vmla(t, x2.x, vcast_vd_d(0.400000000000222439910458)); + t = vmla(t, x2.x, vcast_vd_d(0.666666666666666371239645)); - return add2_dd(mul_ds(dd(vcast_vd_d(0.693147180559945286226764), vcast_vd_d(2.319046813846299558417771e-17)), - vcast_vd_vi(e)), - add2_dd(scale_d(x, vcast_vd_d(2)), mul_ds(mul_dd(x2, x), t))); + return add2_dd(mul_ds(dd(vcast_vd_d(0.693147180559945286226764), vcast_vd_d(2.319046813846299558417771e-17)), + vcast_vd_vi(e)), + add2_dd(scale_d(x, vcast_vd_d(2)), mul_ds(mul_dd(x2, x), t))); } static INLINE vdouble xasinh(vdouble x) { - vdouble y = vabs(x); - vdouble2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(y, y), vcast_vd_d(1))), y)); - y = vadd(d.x, d.y); + vdouble y = vabs(x); + vdouble2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(y, y), vcast_vd_d(1))), y)); + y = vadd(d.x, d.y); - y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); - y = vmulsign(y, x); - y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); + y = vmulsign(y, x); + y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); - return y; + return y; } static INLINE vdouble xacosh(vdouble x) { - vdouble2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(x, x), vcast_vd_d(-1))), x)); - vdouble y = vadd(d.x, d.y); + vdouble2 d = logk2(add2_ds(sqrt_d(add2_ds(mul_ss(x, x), vcast_vd_d(-1))), x)); + vdouble y = vadd(d.x, d.y); - y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); - y = vsel(vmask_eq(x, vcast_vd_d(1.0)), vcast_vd_d(0.0), y); - y = vsel(vmask_lt(x, vcast_vd_d(1.0)), vcast_vd_d(rtengine::RT_NAN), y); - y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_INFINITY), y); + y = vsel(vmask_eq(x, vcast_vd_d(1.0)), vcast_vd_d(0.0), y); + y = vsel(vmask_lt(x, vcast_vd_d(1.0)), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); - return y; + return y; } static INLINE vdouble xatanh(vdouble x) { - vdouble y = vabs(x); - vdouble2 d = logk2(div_dd(add2_ss(vcast_vd_d(1), y), add2_ss(vcast_vd_d(1), -y))); - y = vsel(vmask_gt(y, vcast_vd_d(1.0)), vcast_vd_d(rtengine::RT_NAN), vsel(vmask_eq(y, vcast_vd_d(1.0)), vcast_vd_d(rtengine::RT_INFINITY), vmul(vadd(d.x, d.y), vcast_vd_d(0.5)))); + vdouble y = vabs(x); + vdouble2 d = logk2(div_dd(add2_ss(vcast_vd_d(1), y), add2_ss(vcast_vd_d(1), -y))); + y = vsel(vmask_gt(y, vcast_vd_d(1.0)), vcast_vd_d(rtengine::RT_NAN), vsel(vmask_eq(y, vcast_vd_d(1.0)), vcast_vd_d(rtengine::RT_INFINITY), vmul(vadd(d.x, d.y), vcast_vd_d(0.5)))); - y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_NAN), y); - y = vmulsign(y, x); - y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); + y = vsel(vorm(vmask_isinf(x), vmask_isnan(y)), vcast_vd_d(rtengine::RT_NAN), y); + y = vmulsign(y, x); + y = vsel(vmask_isnan(x), vcast_vd_d(rtengine::RT_NAN), y); - return y; + return y; } static INLINE vdouble xcbrt(vdouble d) { - vdouble x, y, q = vcast_vd_d(1.0); - vint e, qu, re; - vdouble t; + vdouble x, y, q = vcast_vd_d(1.0); + vint e, qu, re; + vdouble t; - e = vilogbp1(vabs(d)); - d = vldexp(d, vsubi(vcast_vi_i(0), e)); + e = vilogbp1(vabs(d)); + d = vldexp(d, vsubi(vcast_vi_i(0), e)); - t = vadd(vcast_vd_vi(e), vcast_vd_d(6144)); - qu = vtruncate_vi_vd(vdiv(t, vcast_vd_d(3))); - re = vtruncate_vi_vd(vsub(t, vmul(vcast_vd_vi(qu), vcast_vd_d(3)))); + t = vadd(vcast_vd_vi(e), vcast_vd_d(6144)); + qu = vtruncate_vi_vd(vdiv(t, vcast_vd_d(3))); + re = vtruncate_vi_vd(vsub(t, vmul(vcast_vd_vi(qu), vcast_vd_d(3)))); - q = vsel(vmaski_eq(re, vcast_vi_i(1)), vcast_vd_d(1.2599210498948731647672106), q); - q = vsel(vmaski_eq(re, vcast_vi_i(2)), vcast_vd_d(1.5874010519681994747517056), q); - q = vldexp(q, vsubi(qu, vcast_vi_i(2048))); + q = vsel(vmaski_eq(re, vcast_vi_i(1)), vcast_vd_d(1.2599210498948731647672106), q); + q = vsel(vmaski_eq(re, vcast_vi_i(2)), vcast_vd_d(1.5874010519681994747517056), q); + q = vldexp(q, vsubi(qu, vcast_vi_i(2048))); - q = vmulsign(q, d); + q = vmulsign(q, d); - d = vabs(d); + d = vabs(d); - x = vcast_vd_d(-0.640245898480692909870982); - x = vmla(x, d, vcast_vd_d(2.96155103020039511818595)); - x = vmla(x, d, vcast_vd_d(-5.73353060922947843636166)); - x = vmla(x, d, vcast_vd_d(6.03990368989458747961407)); - x = vmla(x, d, vcast_vd_d(-3.85841935510444988821632)); - x = vmla(x, d, vcast_vd_d(2.2307275302496609725722)); + x = vcast_vd_d(-0.640245898480692909870982); + x = vmla(x, d, vcast_vd_d(2.96155103020039511818595)); + x = vmla(x, d, vcast_vd_d(-5.73353060922947843636166)); + x = vmla(x, d, vcast_vd_d(6.03990368989458747961407)); + x = vmla(x, d, vcast_vd_d(-3.85841935510444988821632)); + x = vmla(x, d, vcast_vd_d(2.2307275302496609725722)); - y = vmul(x, x); y = vmul(y, y); x = vsub(x, vmul(vmla(d, y, vneg(x)), vcast_vd_d(1.0 / 3.0))); - y = vmul(vmul(d, x), x); - y = vmul(vsub(y, vmul(vmul(vcast_vd_d(2.0 / 3.0), y), vmla(y, x, vcast_vd_d(-1.0)))), q); + y = vmul(x, x); y = vmul(y, y); x = vsub(x, vmul(vmla(d, y, vneg(x)), vcast_vd_d(1.0 / 3.0))); + y = vmul(vmul(d, x), x); + y = vmul(vsub(y, vmul(vmul(vcast_vd_d(2.0 / 3.0), y), vmla(y, x, vcast_vd_d(-1.0)))), q); - return y; + return y; } static INLINE vdouble xexp2(vdouble a) { - vdouble u = expk(mul_ds(dd(vcast_vd_d(0.69314718055994528623), vcast_vd_d(2.3190468138462995584e-17)), a)); - u = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), u); - u = vsel(vmask_isminf(a), vcast_vd_d(0), u); - return u; + vdouble u = expk(mul_ds(dd(vcast_vd_d(0.69314718055994528623), vcast_vd_d(2.3190468138462995584e-17)), a)); + u = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), u); + u = vsel(vmask_isminf(a), vcast_vd_d(0), u); + return u; } static INLINE vdouble xexp10(vdouble a) { - vdouble u = expk(mul_ds(dd(vcast_vd_d(2.3025850929940459011), vcast_vd_d(-2.1707562233822493508e-16)), a)); - u = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), u); - u = vsel(vmask_isminf(a), vcast_vd_d(0), u); - return u; + vdouble u = expk(mul_ds(dd(vcast_vd_d(2.3025850929940459011), vcast_vd_d(-2.1707562233822493508e-16)), a)); + u = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), u); + u = vsel(vmask_isminf(a), vcast_vd_d(0), u); + return u; } static INLINE vdouble xexpm1(vdouble a) { - vdouble2 d = add2_ds(expk2(dd(a, vcast_vd_d(0))), vcast_vd_d(-1.0)); - vdouble x = d.x + d.y; - x = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), x); - x = vsel(vmask_isminf(a), vcast_vd_d(-1), x); - return x; + vdouble2 d = add2_ds(expk2(dd(a, vcast_vd_d(0))), vcast_vd_d(-1.0)); + vdouble x = d.x + d.y; + x = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), x); + x = vsel(vmask_isminf(a), vcast_vd_d(-1), x); + return x; } static INLINE vdouble xlog10(vdouble a) { - vdouble2 d = mul_dd(logk(a), dd(vcast_vd_d(0.43429448190325176116), vcast_vd_d(6.6494347733425473126e-17))); - vdouble x = d.x + d.y; + vdouble2 d = mul_dd(logk(a), dd(vcast_vd_d(0.43429448190325176116), vcast_vd_d(6.6494347733425473126e-17))); + vdouble x = d.x + d.y; - x = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), x); - x = vsel(vmask_gt(vcast_vd_d(0), a), vcast_vd_d(rtengine::RT_NAN), x); - x = vsel(vmask_eq(a, vcast_vd_d(0)), vcast_vd_d(-rtengine::RT_INFINITY), x); + x = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), x); + x = vsel(vmask_gt(vcast_vd_d(0), a), vcast_vd_d(rtengine::RT_NAN), x); + x = vsel(vmask_eq(a, vcast_vd_d(0)), vcast_vd_d(-rtengine::RT_INFINITY), x); - return x; + return x; } static INLINE vdouble xlog1p(vdouble a) { - vdouble2 d = logk2(add2_ss(a, vcast_vd_d(1))); - vdouble x = d.x + d.y; + vdouble2 d = logk2(add2_ss(a, vcast_vd_d(1))); + vdouble x = d.x + d.y; - x = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), x); - x = vsel(vmask_gt(vcast_vd_d(-1), a), vcast_vd_d(rtengine::RT_NAN), x); - x = vsel(vmask_eq(a, vcast_vd_d(-1)), vcast_vd_d(-rtengine::RT_INFINITY), x); + x = vsel(vmask_ispinf(a), vcast_vd_d(rtengine::RT_INFINITY), x); + x = vsel(vmask_gt(vcast_vd_d(-1), a), vcast_vd_d(rtengine::RT_NAN), x); + x = vsel(vmask_eq(a, vcast_vd_d(-1)), vcast_vd_d(-rtengine::RT_INFINITY), x); - return x; + return x; } // typedef struct { - vfloat x, y; + vfloat x, y; } vfloat2; static INLINE vfloat vabsf(vfloat f) { return (vfloat)vandnotm((vmask)vcast_vf_f(-0.0f), (vmask)f); } static INLINE vfloat vnegf(vfloat f) { return (vfloat)vxorm((vmask)f, (vmask)vcast_vf_f(-0.0f)); } #ifdef __SSE4_1__ - // only one instruction when using SSE4.1 - static INLINE vfloat vself(vmask mask, vfloat x, vfloat y) { - return _mm_blendv_ps(y,x,(vfloat)mask); - } +// only one instruction when using SSE4.1 +static INLINE vfloat vself(vmask mask, vfloat x, vfloat y) { + return _mm_blendv_ps(y,x,(vfloat)mask); +} - static INLINE vint vselc(vmask mask, vint x, vint y) { - return _mm_blendv_epi8(y,x,mask); - } +static INLINE vint vselc(vmask mask, vint x, vint y) { + return _mm_blendv_epi8(y,x,mask); +} #else - // three instructions when using SSE2 - static INLINE vfloat vself(vmask mask, vfloat x, vfloat y) { - return (vfloat)vorm(vandm(mask, (vmask)x), vandnotm(mask, (vmask)y)); - } +// three instructions when using SSE2 +static INLINE vfloat vself(vmask mask, vfloat x, vfloat y) { + return (vfloat)vorm(vandm(mask, (vmask)x), vandnotm(mask, (vmask)y)); +} - static INLINE vint vselc(vmask mask, vint x, vint y) { - return vorm(vandm(mask, (vmask)x), vandnotm(mask, (vmask)y)); - } +static INLINE vint vselc(vmask mask, vint x, vint y) { + return vorm(vandm(mask, (vmask)x), vandnotm(mask, (vmask)y)); +} #endif static INLINE vfloat vselfzero(vmask mask, vfloat x) { - // returns value of x if corresponding mask bits are 1, else returns 0 - // faster than vself(mask, x, ZEROV) + // returns value of x if corresponding mask bits are 1, else returns 0 + // faster than vself(mask, x, ZEROV) return _mm_and_ps((vfloat)mask, x); } static INLINE vfloat vselfnotzero(vmask mask, vfloat x) { @@ -939,8 +939,8 @@ static INLINE vfloat vselfnotzero(vmask mask, vfloat x) { } static INLINE vint vselizero(vmask mask, vint x) { - // returns value of x if corresponding mask bits are 1, else returns 0 - // faster than vselc(mask, x, ZEROV) + // returns value of x if corresponding mask bits are 1, else returns 0 + // faster than vselc(mask, x, ZEROV) return _mm_and_si128(mask, x); } static INLINE vint vselinotzero(vmask mask, vint x) { @@ -950,20 +950,20 @@ static INLINE vint vselinotzero(vmask mask, vint x) { } static INLINE vint2 vseli2_lt(vfloat f0, vfloat f1, vint2 x, vint2 y) { - vint2 m2 = vcast_vi2_vm(vmaskf_lt(f0, f1)); - return vori2(vandi2(m2, x), vandnoti2(m2, y)); + vint2 m2 = vcast_vi2_vm(vmaskf_lt(f0, f1)); + return vori2(vandi2(m2, x), vandnoti2(m2, y)); } static INLINE vmask vsignbitf(vfloat f) { - return vandm((vmask)f, (vmask)vcast_vf_f(-0.0f)); + return vandm((vmask)f, (vmask)vcast_vf_f(-0.0f)); } static INLINE vfloat vmulsignf(vfloat x, vfloat y) { - return (vfloat)vxorm((vmask)x, vsignbitf(y)); + return (vfloat)vxorm((vmask)x, vsignbitf(y)); } static INLINE vfloat vsignf(vfloat f) { - return (vfloat)vorm((vmask)vcast_vf_f(1.0f), vandm((vmask)vcast_vf_f(-0.0f), (vmask)f)); + return (vfloat)vorm((vmask)vcast_vf_f(1.0f), vandm((vmask)vcast_vf_f(-0.0f), (vmask)f)); } static INLINE vmask vmaskf_isinf(vfloat d) { return vmaskf_eq(vabsf(d), vcast_vf_f(INFINITYf)); } @@ -976,396 +976,396 @@ static INLINE vfloat visinf2f(vfloat d, vfloat m) { return (vfloat)vandm(vmaskf_ static INLINE vfloat visinff(vfloat d) { return visinf2f(d, vcast_vf_f(1.0f)); } static INLINE vint2 vilogbp1f(vfloat d) { - vmask m = vmaskf_lt(d, vcast_vf_f(5.421010862427522E-20f)); - d = vself(m, vmulf(vcast_vf_f(1.8446744073709552E19f), d), d); - vint2 q = vandi2(vsrli2(vcast_vi2_vm(vreinterpret_vm_vf(d)), 23), vcast_vi2_i(0xff)); - q = vsubi2(q, vseli2(m, vcast_vi2_i(64 + 0x7e), vcast_vi2_i(0x7e))); - return q; + vmask m = vmaskf_lt(d, vcast_vf_f(5.421010862427522E-20f)); + d = vself(m, vmulf(vcast_vf_f(1.8446744073709552E19f), d), d); + vint2 q = vandi2(vsrli2(vcast_vi2_vm(vreinterpret_vm_vf(d)), 23), vcast_vi2_i(0xff)); + q = vsubi2(q, vseli2(m, vcast_vi2_i(64 + 0x7e), vcast_vi2_i(0x7e))); + return q; } static INLINE vfloat vldexpf(vfloat x, vint2 q) { - vfloat u; - vint2 m = vsrai2(q, 31); - m = vslli2(vsubi2(vsrai2(vaddi2(m, q), 6), m), 4); - q = vsubi2(q, vslli2(m, 2)); - u = vreinterpret_vf_vm(vcast_vm_vi2(vslli2(vaddi2(m, vcast_vi2_i(0x7f)), 23))); - x = vmulf(vmulf(vmulf(vmulf(x, u), u), u), u); - u = vreinterpret_vf_vm(vcast_vm_vi2(vslli2(vaddi2(q, vcast_vi2_i(0x7f)), 23))); - return vmulf(x, u); + vfloat u; + vint2 m = vsrai2(q, 31); + m = vslli2(vsubi2(vsrai2(vaddi2(m, q), 6), m), 4); + q = vsubi2(q, vslli2(m, 2)); + u = vreinterpret_vf_vm(vcast_vm_vi2(vslli2(vaddi2(m, vcast_vi2_i(0x7f)), 23))); + x = vmulf(vmulf(vmulf(vmulf(x, u), u), u), u); + u = vreinterpret_vf_vm(vcast_vm_vi2(vslli2(vaddi2(q, vcast_vi2_i(0x7f)), 23))); + return vmulf(x, u); } static INLINE vfloat xsinf(vfloat d) { - vint2 q; - vfloat u, s; + vint2 q; + vfloat u, s; - q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)rtengine::RT_1_PI))); + q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)rtengine::RT_1_PI))); - u = vcast_vf_vi2(q); - d = vmlaf(u, vcast_vf_f(-PI4_Af*4), d); - d = vmlaf(u, vcast_vf_f(-PI4_Bf*4), d); - d = vmlaf(u, vcast_vf_f(-PI4_Cf*4), d); - d = vmlaf(u, vcast_vf_f(-PI4_Df*4), d); + u = vcast_vf_vi2(q); + d = vmlaf(u, vcast_vf_f(-PI4_Af*4), d); + d = vmlaf(u, vcast_vf_f(-PI4_Bf*4), d); + d = vmlaf(u, vcast_vf_f(-PI4_Cf*4), d); + d = vmlaf(u, vcast_vf_f(-PI4_Df*4), d); - s = vmulf(d, d); + s = vmulf(d, d); - d = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)), vnegf(d), d); + d = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)), vnegf(d), d); - u = vcast_vf_f(2.6083159809786593541503e-06f); - u = vmlaf(u, s, vcast_vf_f(-0.0001981069071916863322258f)); - u = vmlaf(u, s, vcast_vf_f(0.00833307858556509017944336f)); - u = vmlaf(u, s, vcast_vf_f(-0.166666597127914428710938f)); + u = vcast_vf_f(2.6083159809786593541503e-06f); + u = vmlaf(u, s, vcast_vf_f(-0.0001981069071916863322258f)); + u = vmlaf(u, s, vcast_vf_f(0.00833307858556509017944336f)); + u = vmlaf(u, s, vcast_vf_f(-0.166666597127914428710938f)); - u = vmlaf(s, vmulf(u, d), d); + u = vmlaf(s, vmulf(u, d), d); - return u; + return u; } static INLINE vfloat xcosf(vfloat d) { - vint2 q; - vfloat u, s; + vint2 q; + vfloat u, s; - q = vrint_vi2_vf(vsubf(vmulf(d, vcast_vf_f((float)rtengine::RT_1_PI)), vcast_vf_f(0.5f))); - q = vaddi2(vaddi2(q, q), vcast_vi2_i(1)); + q = vrint_vi2_vf(vsubf(vmulf(d, vcast_vf_f((float)rtengine::RT_1_PI)), vcast_vf_f(0.5f))); + q = vaddi2(vaddi2(q, q), vcast_vi2_i(1)); - u = vcast_vf_vi2(q); - d = vmlaf(u, vcast_vf_f(-PI4_Af*2), d); - d = vmlaf(u, vcast_vf_f(-PI4_Bf*2), d); - d = vmlaf(u, vcast_vf_f(-PI4_Cf*2), d); - d = vmlaf(u, vcast_vf_f(-PI4_Df*2), d); + u = vcast_vf_vi2(q); + d = vmlaf(u, vcast_vf_f(-PI4_Af*2), d); + d = vmlaf(u, vcast_vf_f(-PI4_Bf*2), d); + d = vmlaf(u, vcast_vf_f(-PI4_Cf*2), d); + d = vmlaf(u, vcast_vf_f(-PI4_Df*2), d); - s = vmulf(d, d); + s = vmulf(d, d); - d = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(2)), vcast_vi2_i(2)), d, vnegf(d)); + d = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(2)), vcast_vi2_i(2)), d, vnegf(d)); - u = vcast_vf_f(2.6083159809786593541503e-06f); - u = vmlaf(u, s, vcast_vf_f(-0.0001981069071916863322258f)); - u = vmlaf(u, s, vcast_vf_f(0.00833307858556509017944336f)); - u = vmlaf(u, s, vcast_vf_f(-0.166666597127914428710938f)); + u = vcast_vf_f(2.6083159809786593541503e-06f); + u = vmlaf(u, s, vcast_vf_f(-0.0001981069071916863322258f)); + u = vmlaf(u, s, vcast_vf_f(0.00833307858556509017944336f)); + u = vmlaf(u, s, vcast_vf_f(-0.166666597127914428710938f)); - u = vmlaf(s, vmulf(u, d), d); + u = vmlaf(s, vmulf(u, d), d); - return u; + return u; } static INLINE vfloat2 xsincosf(vfloat d) { - vint2 q; - vmask m; - vfloat u, s, t, rx, ry; - vfloat2 r; + vint2 q; + vmask m; + vfloat u, s, t, rx, ry; + vfloat2 r; - q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)rtengine::RT_2_PI))); + q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)rtengine::RT_2_PI))); - s = d; + s = d; - u = vcast_vf_vi2(q); - s = vmlaf(u, vcast_vf_f(-PI4_Af*2), s); - s = vmlaf(u, vcast_vf_f(-PI4_Bf*2), s); - s = vmlaf(u, vcast_vf_f(-PI4_Cf*2), s); - s = vmlaf(u, vcast_vf_f(-PI4_Df*2), s); + u = vcast_vf_vi2(q); + s = vmlaf(u, vcast_vf_f(-PI4_Af*2), s); + s = vmlaf(u, vcast_vf_f(-PI4_Bf*2), s); + s = vmlaf(u, vcast_vf_f(-PI4_Cf*2), s); + s = vmlaf(u, vcast_vf_f(-PI4_Df*2), s); - t = s; + t = s; - s = vmulf(s, s); + s = vmulf(s, s); - u = vcast_vf_f(-0.000195169282960705459117889f); - u = vmlaf(u, s, vcast_vf_f(0.00833215750753879547119141f)); - u = vmlaf(u, s, vcast_vf_f(-0.166666537523269653320312f)); - u = vmulf(vmulf(u, s), t); + u = vcast_vf_f(-0.000195169282960705459117889f); + u = vmlaf(u, s, vcast_vf_f(0.00833215750753879547119141f)); + u = vmlaf(u, s, vcast_vf_f(-0.166666537523269653320312f)); + u = vmulf(vmulf(u, s), t); - rx = vaddf(t, u); + rx = vaddf(t, u); - u = vcast_vf_f(-2.71811842367242206819355e-07f); - u = vmlaf(u, s, vcast_vf_f(2.47990446951007470488548e-05f)); - u = vmlaf(u, s, vcast_vf_f(-0.00138888787478208541870117f)); - u = vmlaf(u, s, vcast_vf_f(0.0416666641831398010253906f)); - u = vmlaf(u, s, vcast_vf_f(-0.5)); + u = vcast_vf_f(-2.71811842367242206819355e-07f); + u = vmlaf(u, s, vcast_vf_f(2.47990446951007470488548e-05f)); + u = vmlaf(u, s, vcast_vf_f(-0.00138888787478208541870117f)); + u = vmlaf(u, s, vcast_vf_f(0.0416666641831398010253906f)); + u = vmlaf(u, s, vcast_vf_f(-0.5)); - ry = vaddf(vcast_vf_f(1), vmulf(s, u)); + ry = vaddf(vcast_vf_f(1), vmulf(s, u)); - m = vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(0)); - r.x = vself(m, rx, ry); - r.y = vself(m, ry, rx); + m = vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(0)); + r.x = vself(m, rx, ry); + r.y = vself(m, ry, rx); - m = vmaski2_eq(vandi2(q, vcast_vi2_i(2)), vcast_vi2_i(2)); - r.x = vreinterpret_vf_vm(vxorm(vandm(m, vreinterpret_vm_vf(vcast_vf_f(-0.0))), vreinterpret_vm_vf(r.x))); + m = vmaski2_eq(vandi2(q, vcast_vi2_i(2)), vcast_vi2_i(2)); + r.x = vreinterpret_vf_vm(vxorm(vandm(m, vreinterpret_vm_vf(vcast_vf_f(-0.0))), vreinterpret_vm_vf(r.x))); - m = vmaski2_eq(vandi2(vaddi2(q, vcast_vi2_i(1)), vcast_vi2_i(2)), vcast_vi2_i(2)); - r.y = vreinterpret_vf_vm(vxorm(vandm(m, vreinterpret_vm_vf(vcast_vf_f(-0.0))), vreinterpret_vm_vf(r.y))); + m = vmaski2_eq(vandi2(vaddi2(q, vcast_vi2_i(1)), vcast_vi2_i(2)), vcast_vi2_i(2)); + r.y = vreinterpret_vf_vm(vxorm(vandm(m, vreinterpret_vm_vf(vcast_vf_f(-0.0))), vreinterpret_vm_vf(r.y))); - m = vmaskf_isinf(d); - r.x = vself(m, vcast_vf_f(rtengine::RT_NAN), r.x); - r.y = vself(m, vcast_vf_f(rtengine::RT_NAN), r.y); + m = vmaskf_isinf(d); + r.x = vself(m, vcast_vf_f(rtengine::RT_NAN), r.x); + r.y = vself(m, vcast_vf_f(rtengine::RT_NAN), r.y); - return r; + return r; } static INLINE vfloat xtanf(vfloat d) { - vint2 q; - vmask m; - vfloat u, s, x; + vint2 q; + vmask m; + vfloat u, s, x; - q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)(2 * rtengine::RT_1_PI)))); + q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)(2 * rtengine::RT_1_PI)))); - x = d; + x = d; - u = vcast_vf_vi2(q); - x = vmlaf(u, vcast_vf_f(-PI4_Af*2), x); - x = vmlaf(u, vcast_vf_f(-PI4_Bf*2), x); - x = vmlaf(u, vcast_vf_f(-PI4_Cf*2), x); - x = vmlaf(u, vcast_vf_f(-PI4_Df*2), x); + u = vcast_vf_vi2(q); + x = vmlaf(u, vcast_vf_f(-PI4_Af*2), x); + x = vmlaf(u, vcast_vf_f(-PI4_Bf*2), x); + x = vmlaf(u, vcast_vf_f(-PI4_Cf*2), x); + x = vmlaf(u, vcast_vf_f(-PI4_Df*2), x); - s = vmulf(x, x); + s = vmulf(x, x); - m = vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)); - x = vself(m, vnegf(x), x); + m = vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)); + x = vself(m, vnegf(x), x); - u = vcast_vf_f(0.00927245803177356719970703f); - u = vmlaf(u, s, vcast_vf_f(0.00331984995864331722259521f)); - u = vmlaf(u, s, vcast_vf_f(0.0242998078465461730957031f)); - u = vmlaf(u, s, vcast_vf_f(0.0534495301544666290283203f)); - u = vmlaf(u, s, vcast_vf_f(0.133383005857467651367188f)); - u = vmlaf(u, s, vcast_vf_f(0.333331853151321411132812f)); + u = vcast_vf_f(0.00927245803177356719970703f); + u = vmlaf(u, s, vcast_vf_f(0.00331984995864331722259521f)); + u = vmlaf(u, s, vcast_vf_f(0.0242998078465461730957031f)); + u = vmlaf(u, s, vcast_vf_f(0.0534495301544666290283203f)); + u = vmlaf(u, s, vcast_vf_f(0.133383005857467651367188f)); + u = vmlaf(u, s, vcast_vf_f(0.333331853151321411132812f)); - u = vmlaf(s, vmulf(u, x), x); + u = vmlaf(s, vmulf(u, x), x); - u = vself(m, vrecf(u), u); + u = vself(m, vrecf(u), u); - u = vself(vmaskf_isinf(d), vcast_vf_f(NANf), u); + u = vself(vmaskf_isinf(d), vcast_vf_f(NANf), u); - return u; + return u; } static INLINE vfloat xatanf(vfloat s) { - vfloat t, u; - vint2 q; + vfloat t, u; + vint2 q; - q = vseli2_lt(s, vcast_vf_f(0.0f), vcast_vi2_i(2), vcast_vi2_i(0)); - s = vabsf(s); + q = vseli2_lt(s, vcast_vf_f(0.0f), vcast_vi2_i(2), vcast_vi2_i(0)); + s = vabsf(s); - q = vseli2_lt(vcast_vf_f(1.0f), s, vaddi2(q, vcast_vi2_i(1)), q); - s = vself(vmaskf_lt(vcast_vf_f(1.0f), s), vdivf(vcast_vf_f(1.0f), s), s); + q = vseli2_lt(vcast_vf_f(1.0f), s, vaddi2(q, vcast_vi2_i(1)), q); + s = vself(vmaskf_lt(vcast_vf_f(1.0f), s), vdivf(vcast_vf_f(1.0f), s), s); - t = vmulf(s, s); + t = vmulf(s, s); - u = vcast_vf_f(0.00282363896258175373077393f); - u = vmlaf(u, t, vcast_vf_f(-0.0159569028764963150024414f)); - u = vmlaf(u, t, vcast_vf_f(0.0425049886107444763183594f)); - u = vmlaf(u, t, vcast_vf_f(-0.0748900920152664184570312f)); - u = vmlaf(u, t, vcast_vf_f(0.106347933411598205566406f)); - u = vmlaf(u, t, vcast_vf_f(-0.142027363181114196777344f)); - u = vmlaf(u, t, vcast_vf_f(0.199926957488059997558594f)); - u = vmlaf(u, t, vcast_vf_f(-0.333331018686294555664062f)); + u = vcast_vf_f(0.00282363896258175373077393f); + u = vmlaf(u, t, vcast_vf_f(-0.0159569028764963150024414f)); + u = vmlaf(u, t, vcast_vf_f(0.0425049886107444763183594f)); + u = vmlaf(u, t, vcast_vf_f(-0.0748900920152664184570312f)); + u = vmlaf(u, t, vcast_vf_f(0.106347933411598205566406f)); + u = vmlaf(u, t, vcast_vf_f(-0.142027363181114196777344f)); + u = vmlaf(u, t, vcast_vf_f(0.199926957488059997558594f)); + u = vmlaf(u, t, vcast_vf_f(-0.333331018686294555664062f)); - t = vaddf(s, vmulf(s, vmulf(t, u))); + t = vaddf(s, vmulf(s, vmulf(t, u))); - t = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)), vsubf(vcast_vf_f((float)(rtengine::RT_PI/2)), t), t); - t = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(2)), vcast_vi2_i(2)), vnegf(t), t); + t = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)), vsubf(vcast_vf_f((float)(rtengine::RT_PI/2)), t), t); + t = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(2)), vcast_vi2_i(2)), vnegf(t), t); - return t; + return t; } static INLINE vfloat atan2kf(vfloat y, vfloat x) { - vfloat s, t, u; - vint2 q; - vmask p; + vfloat s, t, u; + vint2 q; + vmask p; - q = vseli2_lt(x, vcast_vf_f(0.0f), vcast_vi2_i(-2), vcast_vi2_i(0)); - x = vabsf(x); + q = vseli2_lt(x, vcast_vf_f(0.0f), vcast_vi2_i(-2), vcast_vi2_i(0)); + x = vabsf(x); - q = vseli2_lt(x, y, vaddi2(q, vcast_vi2_i(1)), q); - p = vmaskf_lt(x, y); - s = vself(p, vnegf(x), y); - t = vmaxf(x, y); + q = vseli2_lt(x, y, vaddi2(q, vcast_vi2_i(1)), q); + p = vmaskf_lt(x, y); + s = vself(p, vnegf(x), y); + t = vmaxf(x, y); - s = vdivf(s, t); - t = vmulf(s, s); + s = vdivf(s, t); + t = vmulf(s, s); - u = vcast_vf_f(0.00282363896258175373077393f); - u = vmlaf(u, t, vcast_vf_f(-0.0159569028764963150024414f)); - u = vmlaf(u, t, vcast_vf_f(0.0425049886107444763183594f)); - u = vmlaf(u, t, vcast_vf_f(-0.0748900920152664184570312f)); - u = vmlaf(u, t, vcast_vf_f(0.106347933411598205566406f)); - u = vmlaf(u, t, vcast_vf_f(-0.142027363181114196777344f)); - u = vmlaf(u, t, vcast_vf_f(0.199926957488059997558594f)); - u = vmlaf(u, t, vcast_vf_f(-0.333331018686294555664062f)); + u = vcast_vf_f(0.00282363896258175373077393f); + u = vmlaf(u, t, vcast_vf_f(-0.0159569028764963150024414f)); + u = vmlaf(u, t, vcast_vf_f(0.0425049886107444763183594f)); + u = vmlaf(u, t, vcast_vf_f(-0.0748900920152664184570312f)); + u = vmlaf(u, t, vcast_vf_f(0.106347933411598205566406f)); + u = vmlaf(u, t, vcast_vf_f(-0.142027363181114196777344f)); + u = vmlaf(u, t, vcast_vf_f(0.199926957488059997558594f)); + u = vmlaf(u, t, vcast_vf_f(-0.333331018686294555664062f)); - t = vaddf(s, vmulf(s, vmulf(t, u))); - t = vaddf(t, vmulf(vcast_vf_vi2(q), vcast_vf_f((float)(rtengine::RT_PI/2)))); + t = vaddf(s, vmulf(s, vmulf(t, u))); + t = vaddf(t, vmulf(vcast_vf_vi2(q), vcast_vf_f((float)(rtengine::RT_PI/2)))); - return t; + return t; } static INLINE vfloat xatan2f(vfloat y, vfloat x) { - vfloat r = atan2kf(vabsf(y), x); + vfloat r = atan2kf(vabsf(y), x); - r = vmulsignf(r, x); - r = vself(vorm(vmaskf_isinf(x), vmaskf_eq(x, vcast_vf_f(0.0f))), vsubf(vcast_vf_f((float)(rtengine::RT_PI/2)), visinf2f(x, vmulsignf(vcast_vf_f((float)(rtengine::RT_PI/2)), x))), r); - r = vself(vmaskf_isinf(y), vsubf(vcast_vf_f((float)(rtengine::RT_PI/2)), visinf2f(x, vmulsignf(vcast_vf_f((float)(rtengine::RT_PI/4)), x))), r); - r = vself(vmaskf_eq(y, vcast_vf_f(0.0f)), vselfzero(vmaskf_eq(vsignf(x), vcast_vf_f(-1.0f)), vcast_vf_f((float)rtengine::RT_PI)), r); + r = vmulsignf(r, x); + r = vself(vorm(vmaskf_isinf(x), vmaskf_eq(x, vcast_vf_f(0.0f))), vsubf(vcast_vf_f((float)(rtengine::RT_PI/2)), visinf2f(x, vmulsignf(vcast_vf_f((float)(rtengine::RT_PI/2)), x))), r); + r = vself(vmaskf_isinf(y), vsubf(vcast_vf_f((float)(rtengine::RT_PI/2)), visinf2f(x, vmulsignf(vcast_vf_f((float)(rtengine::RT_PI/4)), x))), r); + r = vself(vmaskf_eq(y, vcast_vf_f(0.0f)), vselfzero(vmaskf_eq(vsignf(x), vcast_vf_f(-1.0f)), vcast_vf_f((float)rtengine::RT_PI)), r); - return vself(vmaskf_isnan(x, y), vcast_vf_f(NANf), vmulsignf(r, y)); + return vself(vmaskf_isnan(x, y), vcast_vf_f(NANf), vmulsignf(r, y)); } static INLINE vfloat xasinf(vfloat d) { - vfloat x, y; - x = vaddf(vcast_vf_f(1.0f), d); - y = vsubf(vcast_vf_f(1.0f), d); - x = vmulf(x, y); - x = vsqrtf(x); - x = vself(vmaskf_isnan(x), vcast_vf_f(NANf), atan2kf(vabsf(d), x)); - return vmulsignf(x, d); + vfloat x, y; + x = vaddf(vcast_vf_f(1.0f), d); + y = vsubf(vcast_vf_f(1.0f), d); + x = vmulf(x, y); + x = vsqrtf(x); + x = vself(vmaskf_isnan(x), vcast_vf_f(NANf), atan2kf(vabsf(d), x)); + return vmulsignf(x, d); } static INLINE vfloat xacosf(vfloat d) { - vfloat x, y; - x = vaddf(vcast_vf_f(1.0f), d); - y = vsubf(vcast_vf_f(1.0f), d); - x = vmulf(x, y); - x = vsqrtf(x); - x = vmulsignf(atan2kf(x, vabsf(d)), d); - y = (vfloat)vandm(vmaskf_lt(d, vcast_vf_f(0.0f)), (vmask)vcast_vf_f((float)rtengine::RT_PI)); - x = vaddf(x, y); - return x; + vfloat x, y; + x = vaddf(vcast_vf_f(1.0f), d); + y = vsubf(vcast_vf_f(1.0f), d); + x = vmulf(x, y); + x = vsqrtf(x); + x = vmulsignf(atan2kf(x, vabsf(d)), d); + y = (vfloat)vandm(vmaskf_lt(d, vcast_vf_f(0.0f)), (vmask)vcast_vf_f((float)rtengine::RT_PI)); + x = vaddf(x, y); + return x; } static INLINE vfloat xlogf(vfloat d) { - vfloat x, x2, t, m; - vint2 e; + vfloat x, x2, t, m; + vint2 e; - e = vilogbp1f(vmulf(d, vcast_vf_f(0.7071f))); - m = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); + e = vilogbp1f(vmulf(d, vcast_vf_f(0.7071f))); + m = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); - x = vdivf(vaddf(vcast_vf_f(-1.0f), m), vaddf(vcast_vf_f(1.0f), m)); - x2 = vmulf(x, x); + x = vdivf(vaddf(vcast_vf_f(-1.0f), m), vaddf(vcast_vf_f(1.0f), m)); + x2 = vmulf(x, x); - t = vcast_vf_f(0.2371599674224853515625f); - t = vmlaf(t, x2, vcast_vf_f(0.285279005765914916992188f)); - t = vmlaf(t, x2, vcast_vf_f(0.400005519390106201171875f)); - t = vmlaf(t, x2, vcast_vf_f(0.666666567325592041015625f)); - t = vmlaf(t, x2, vcast_vf_f(2.0f)); + t = vcast_vf_f(0.2371599674224853515625f); + t = vmlaf(t, x2, vcast_vf_f(0.285279005765914916992188f)); + t = vmlaf(t, x2, vcast_vf_f(0.400005519390106201171875f)); + t = vmlaf(t, x2, vcast_vf_f(0.666666567325592041015625f)); + t = vmlaf(t, x2, vcast_vf_f(2.0f)); - x = vaddf(vmulf(x, t), vmulf(vcast_vf_f(0.693147180559945286226764f), vcast_vf_vi2(e))); + x = vaddf(vmulf(x, t), vmulf(vcast_vf_f(0.693147180559945286226764f), vcast_vf_vi2(e))); - x = vself(vmaskf_ispinf(d), vcast_vf_f(INFINITYf), x); - x = vself(vmaskf_gt(vcast_vf_f(0), d), vcast_vf_f(NANf), x); - x = vself(vmaskf_eq(d, vcast_vf_f(0)), vcast_vf_f(-INFINITYf), x); + x = vself(vmaskf_ispinf(d), vcast_vf_f(INFINITYf), x); + x = vself(vmaskf_gt(vcast_vf_f(0), d), vcast_vf_f(NANf), x); + x = vself(vmaskf_eq(d, vcast_vf_f(0)), vcast_vf_f(-INFINITYf), x); - return x; + return x; } static INLINE vfloat xlogf0(vfloat d) { - vfloat x, x2, t, m; - vint2 e; + vfloat x, x2, t, m; + vint2 e; - e = vilogbp1f(vmulf(d, vcast_vf_f(0.7071f))); - m = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); + e = vilogbp1f(vmulf(d, vcast_vf_f(0.7071f))); + m = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); - x = vdivf(vaddf(vcast_vf_f(-1.0f), m), vaddf(vcast_vf_f(1.0f), m)); - x2 = vmulf(x, x); + x = vdivf(vaddf(vcast_vf_f(-1.0f), m), vaddf(vcast_vf_f(1.0f), m)); + x2 = vmulf(x, x); - t = vcast_vf_f(0.2371599674224853515625f); - t = vmlaf(t, x2, vcast_vf_f(0.285279005765914916992188f)); - t = vmlaf(t, x2, vcast_vf_f(0.400005519390106201171875f)); - t = vmlaf(t, x2, vcast_vf_f(0.666666567325592041015625f)); - t = vmlaf(t, x2, vcast_vf_f(2.0f)); + t = vcast_vf_f(0.2371599674224853515625f); + t = vmlaf(t, x2, vcast_vf_f(0.285279005765914916992188f)); + t = vmlaf(t, x2, vcast_vf_f(0.400005519390106201171875f)); + t = vmlaf(t, x2, vcast_vf_f(0.666666567325592041015625f)); + t = vmlaf(t, x2, vcast_vf_f(2.0f)); - x = vaddf(vmulf(x, t), vmulf(vcast_vf_f(0.693147180559945286226764f), vcast_vf_vi2(e))); + x = vaddf(vmulf(x, t), vmulf(vcast_vf_f(0.693147180559945286226764f), vcast_vf_vi2(e))); - x = vself(vmaskf_ispinf(d), vcast_vf_f(0), x); - x = vself(vmaskf_gt(vcast_vf_f(0), d), vcast_vf_f(0), x); - x = vself(vmaskf_eq(d, vcast_vf_f(0)), vcast_vf_f(0), x); + x = vself(vmaskf_ispinf(d), vcast_vf_f(0), x); + x = vself(vmaskf_gt(vcast_vf_f(0), d), vcast_vf_f(0), x); + x = vself(vmaskf_eq(d, vcast_vf_f(0)), vcast_vf_f(0), x); - return x; + return x; } static INLINE vfloat xlogfNoCheck(vfloat d) { // this version does not check input values. Use it only when you know the input values are > 0 e.g. when filling a lookup table - vfloat x, x2, t, m; - vint2 e; + vfloat x, x2, t, m; + vint2 e; - e = vilogbp1f(vmulf(d, vcast_vf_f(0.7071f))); - m = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); + e = vilogbp1f(vmulf(d, vcast_vf_f(0.7071f))); + m = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); - x = vdivf(vaddf(vcast_vf_f(-1.0f), m), vaddf(vcast_vf_f(1.0f), m)); - x2 = vmulf(x, x); + x = vdivf(vaddf(vcast_vf_f(-1.0f), m), vaddf(vcast_vf_f(1.0f), m)); + x2 = vmulf(x, x); - t = vcast_vf_f(0.2371599674224853515625f); - t = vmlaf(t, x2, vcast_vf_f(0.285279005765914916992188f)); - t = vmlaf(t, x2, vcast_vf_f(0.400005519390106201171875f)); - t = vmlaf(t, x2, vcast_vf_f(0.666666567325592041015625f)); - t = vmlaf(t, x2, vcast_vf_f(2.0f)); + t = vcast_vf_f(0.2371599674224853515625f); + t = vmlaf(t, x2, vcast_vf_f(0.285279005765914916992188f)); + t = vmlaf(t, x2, vcast_vf_f(0.400005519390106201171875f)); + t = vmlaf(t, x2, vcast_vf_f(0.666666567325592041015625f)); + t = vmlaf(t, x2, vcast_vf_f(2.0f)); - return vaddf(vmulf(x, t), vmulf(vcast_vf_f(0.693147180559945286226764f), vcast_vf_vi2(e))); + return vaddf(vmulf(x, t), vmulf(vcast_vf_f(0.693147180559945286226764f), vcast_vf_vi2(e))); } static INLINE vfloat xexpf(vfloat d) { - vint2 q = vrint_vi2_vf(vmulf(d, vcast_vf_f(R_LN2f))); - vfloat s, u; + vint2 q = vrint_vi2_vf(vmulf(d, vcast_vf_f(R_LN2f))); + vfloat s, u; - s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Uf),d); - s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Lf),s); + s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Uf),d); + s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Lf),s); - u = vcast_vf_f(0.00136324646882712841033936f); - u = vmlaf(u, s, vcast_vf_f(0.00836596917361021041870117f)); - u = vmlaf(u, s, vcast_vf_f(0.0416710823774337768554688f)); - u = vmlaf(u, s, vcast_vf_f(0.166665524244308471679688f)); - u = vmlaf(u, s, vcast_vf_f(0.499999850988388061523438f)); + u = vcast_vf_f(0.00136324646882712841033936f); + u = vmlaf(u, s, vcast_vf_f(0.00836596917361021041870117f)); + u = vmlaf(u, s, vcast_vf_f(0.0416710823774337768554688f)); + u = vmlaf(u, s, vcast_vf_f(0.166665524244308471679688f)); + u = vmlaf(u, s, vcast_vf_f(0.499999850988388061523438f)); - u = vaddf(vcast_vf_f(1.0f), vmlaf(vmulf(s, s), u, s)); + u = vaddf(vcast_vf_f(1.0f), vmlaf(vmulf(s, s), u, s)); - u = vldexpf(u, q); + u = vldexpf(u, q); - // -104.0 - return vselfnotzero(vmaskf_gt(vcast_vf_f(-104.f), d), u); + // -104.0 + return vselfnotzero(vmaskf_gt(vcast_vf_f(-104.f), d), u); } static INLINE vfloat xexpfNoCheck(vfloat d) { // this version does not check input values. Use it only when you know the input values are > -104.f e.g. when filling a lookup table - vint2 q = vrint_vi2_vf(vmulf(d, vcast_vf_f(R_LN2f))); - vfloat s, u; + vint2 q = vrint_vi2_vf(vmulf(d, vcast_vf_f(R_LN2f))); + vfloat s, u; - s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Uf),d); - s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Lf),s); + s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Uf),d); + s = vmlaf(vcast_vf_vi2(q), vcast_vf_f(-L2Lf),s); - u = vcast_vf_f(0.00136324646882712841033936f); - u = vmlaf(u, s, vcast_vf_f(0.00836596917361021041870117f)); - u = vmlaf(u, s, vcast_vf_f(0.0416710823774337768554688f)); - u = vmlaf(u, s, vcast_vf_f(0.166665524244308471679688f)); - u = vmlaf(u, s, vcast_vf_f(0.499999850988388061523438f)); + u = vcast_vf_f(0.00136324646882712841033936f); + u = vmlaf(u, s, vcast_vf_f(0.00836596917361021041870117f)); + u = vmlaf(u, s, vcast_vf_f(0.0416710823774337768554688f)); + u = vmlaf(u, s, vcast_vf_f(0.166665524244308471679688f)); + u = vmlaf(u, s, vcast_vf_f(0.499999850988388061523438f)); - u = vaddf(vcast_vf_f(1.0f), vmlaf(vmulf(s, s), u, s)); + u = vaddf(vcast_vf_f(1.0f), vmlaf(vmulf(s, s), u, s)); - return vldexpf(u, q); + return vldexpf(u, q); } static INLINE vfloat xcbrtf(vfloat d) { - vfloat x, y, q = vcast_vf_f(1.0), t; - vint2 e, qu, re; + vfloat x, y, q = vcast_vf_f(1.0), t; + vint2 e, qu, re; - e = vilogbp1f(vabsf(d)); - d = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); + e = vilogbp1f(vabsf(d)); + d = vldexpf(d, vsubi2(vcast_vi2_i(0), e)); - t = vaddf(vcast_vf_vi2(e), vcast_vf_f(6144)); - qu = vtruncate_vi2_vf(vdivf(t, vcast_vf_f(3))); - re = vtruncate_vi2_vf(vsubf(t, vmulf(vcast_vf_vi2(qu), vcast_vf_f(3)))); + t = vaddf(vcast_vf_vi2(e), vcast_vf_f(6144)); + qu = vtruncate_vi2_vf(vdivf(t, vcast_vf_f(3))); + re = vtruncate_vi2_vf(vsubf(t, vmulf(vcast_vf_vi2(qu), vcast_vf_f(3)))); - q = vself(vmaski2_eq(re, vcast_vi2_i(1)), vcast_vf_f(1.2599210498948731647672106f), q); - q = vself(vmaski2_eq(re, vcast_vi2_i(2)), vcast_vf_f(1.5874010519681994747517056f), q); - q = vldexpf(q, vsubi2(qu, vcast_vi2_i(2048))); + q = vself(vmaski2_eq(re, vcast_vi2_i(1)), vcast_vf_f(1.2599210498948731647672106f), q); + q = vself(vmaski2_eq(re, vcast_vi2_i(2)), vcast_vf_f(1.5874010519681994747517056f), q); + q = vldexpf(q, vsubi2(qu, vcast_vi2_i(2048))); - q = vmulsignf(q, d); - d = vabsf(d); + q = vmulsignf(q, d); + d = vabsf(d); - x = vcast_vf_f(-0.601564466953277587890625f); - x = vmlaf(x, d, vcast_vf_f(2.8208892345428466796875f)); - x = vmlaf(x, d, vcast_vf_f(-5.532182216644287109375f)); - x = vmlaf(x, d, vcast_vf_f(5.898262500762939453125f)); - x = vmlaf(x, d, vcast_vf_f(-3.8095417022705078125f)); - x = vmlaf(x, d, vcast_vf_f(2.2241256237030029296875f)); + x = vcast_vf_f(-0.601564466953277587890625f); + x = vmlaf(x, d, vcast_vf_f(2.8208892345428466796875f)); + x = vmlaf(x, d, vcast_vf_f(-5.532182216644287109375f)); + x = vmlaf(x, d, vcast_vf_f(5.898262500762939453125f)); + x = vmlaf(x, d, vcast_vf_f(-3.8095417022705078125f)); + x = vmlaf(x, d, vcast_vf_f(2.2241256237030029296875f)); - y = vmulf(vmulf(d, x), x); - y = vmulf(vsubf(y, vmulf(vmulf(vcast_vf_f(2.0f / 3.0f), y), vmlaf(y, x, vcast_vf_f(-1.0f)))), q); + y = vmulf(vmulf(d, x), x); + y = vmulf(vsubf(y, vmulf(vmulf(vcast_vf_f(2.0f / 3.0f), y), vmlaf(y, x, vcast_vf_f(-1.0f)))), q); - return y; + return y; } static INLINE vfloat vclampf(vfloat value, vfloat low, vfloat high) { @@ -1374,7 +1374,7 @@ static INLINE vfloat vclampf(vfloat value, vfloat low, vfloat high) { } static INLINE vfloat SQRV(vfloat a){ - return a * a; + return a * a; } static inline void vswap( vmask condition, vfloat &a, vfloat &b) { @@ -1390,9 +1390,21 @@ static inline float vhadd( vfloat a ) { return _mm_cvtss_f32(_mm_add_ss(a, _mm_shuffle_ps(a, a, 1))); } +static inline float vhmin(vfloat a) { + // returns min(a[0], a[1], a[2], a[3]) + a = vminf(a, _mm_movehl_ps(a, a)); + return _mm_cvtss_f32(vminf(a, _mm_shuffle_ps(a, a, 1))); +} + +static inline float vhmax(vfloat a) { + // returns max(a[0], a[1], a[2], a[3]) + a = vmaxf(a, _mm_movehl_ps(a, a)); + return _mm_cvtss_f32(vmaxf(a, _mm_shuffle_ps(a, a, 1))); +} + static INLINE vfloat vmul2f(vfloat a){ // fastest way to multiply by 2 - return a + a; + return a + a; } static INLINE vfloat vintpf(vfloat a, vfloat b, vfloat c) { diff --git a/rtexif/CMakeLists.txt b/rtexif/CMakeLists.txt index 9747b03fb..5a3831455 100644 --- a/rtexif/CMakeLists.txt +++ b/rtexif/CMakeLists.txt @@ -1,4 +1,16 @@ -add_library(rtexif rtexif.cc stdattribs.cc nikonattribs.cc canonattribs.cc pentaxattribs.cc fujiattribs.cc sonyminoltaattribs.cc olympusattribs.cc kodakattribs.cc panasonicattribs.cc) +add_library(rtexif STATIC + canonattribs.cc + fujiattribs.cc + kodakattribs.cc + nikonattribs.cc + olympusattribs.cc + panasonicattribs.cc + pentaxattribs.cc + rtexif.cc + sonyminoltaattribs.cc + stdattribs.cc +) + add_dependencies(rtexif UpdateInfo) if(WIN32) diff --git a/rtgui/coloredbar.cc b/rtgui/coloredbar.cc index ca9a381cf..adafcbdde 100644 --- a/rtgui/coloredbar.cc +++ b/rtgui/coloredbar.cc @@ -142,7 +142,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea) case (RTO_Left2Right): for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { - unsigned char *pixel = surfaceData + (py * w + px) * 4; + unsigned char *pixel = surfaceData + (py * w + px) * 4; double x_ = double( px); //double y_ = double((h-1)-py); unused double x01 = x_ / double(w - 1); @@ -158,7 +158,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea) case (RTO_Right2Left): for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { - unsigned char *pixel = surfaceData + (py * w + px) * 4; + unsigned char *pixel = surfaceData + (py * w + px) * 4; //double x_ = double((w-1)-px); unused //double y_ = double((h-1)-py); unused double x01 = double(px) / double(w - 1); @@ -174,7 +174,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea) case (RTO_Bottom2Top): for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { - unsigned char *pixel = surfaceData + (py * w + px) * 4; + unsigned char *pixel = surfaceData + (py * w + px) * 4; //double x_ = double((w-1)-px); unused //double y_ = double((h-1)-py); unused double x01 = double(px) / double(w - 1); @@ -191,7 +191,7 @@ void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea) default: for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { - unsigned char *pixel = surfaceData + (py * w + px) * 4; + unsigned char *pixel = surfaceData + (py * w + px) * 4; double x_ = double( px); double y_ = double( py); double x01 = x_ / double(w - 1); diff --git a/rtgui/dehaze.cc b/rtgui/dehaze.cc index 6f60d08d6..6b7fcd64f 100644 --- a/rtgui/dehaze.cc +++ b/rtgui/dehaze.cc @@ -36,6 +36,7 @@ Dehaze::Dehaze(): FoldableToolPanel(this, "dehaze", M("TP_DEHAZE_LABEL"), false, EvDehazeStrength = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_STRENGTH"); EvDehazeShowDepthMap = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP"); EvDehazeDepth = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_DEPTH"); + EvDehazeLuminance = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_LUMINANCE"); strength = Gtk::manage(new Adjuster(M("TP_DEHAZE_STRENGTH"), 0., 100., 1., 50.)); strength->setAdjusterListener(this); @@ -45,12 +46,17 @@ Dehaze::Dehaze(): FoldableToolPanel(this, "dehaze", M("TP_DEHAZE_LABEL"), false, depth->setAdjusterListener(this); depth->show(); + luminance = Gtk::manage(new Gtk::CheckButton(M("TP_DEHAZE_LUMINANCE"))); + luminance->signal_toggled().connect(sigc::mem_fun(*this, &Dehaze::luminanceChanged)); + luminance->show(); + showDepthMap = Gtk::manage(new Gtk::CheckButton(M("TP_DEHAZE_SHOW_DEPTH_MAP"))); showDepthMap->signal_toggled().connect(sigc::mem_fun(*this, &Dehaze::showDepthMapChanged)); showDepthMap->show(); pack_start(*strength); pack_start(*depth); + pack_start(*luminance); pack_start(*showDepthMap); } @@ -64,12 +70,14 @@ void Dehaze::read(const ProcParams *pp, const ParamsEdited *pedited) depth->setEditedState(pedited->dehaze.depth ? Edited : UnEdited); set_inconsistent(multiImage && !pedited->dehaze.enabled); showDepthMap->set_inconsistent(!pedited->dehaze.showDepthMap); + luminance->set_inconsistent(!pedited->dehaze.luminance); } setEnabled(pp->dehaze.enabled); strength->setValue(pp->dehaze.strength); depth->setValue(pp->dehaze.depth); showDepthMap->set_active(pp->dehaze.showDepthMap); + luminance->set_active(pp->dehaze.luminance); enableListener(); } @@ -81,12 +89,14 @@ void Dehaze::write(ProcParams *pp, ParamsEdited *pedited) pp->dehaze.depth = depth->getValue(); pp->dehaze.enabled = getEnabled(); pp->dehaze.showDepthMap = showDepthMap->get_active(); + pp->dehaze.luminance = luminance->get_active(); if (pedited) { pedited->dehaze.strength = strength->getEditedState(); pedited->dehaze.depth = depth->getEditedState(); pedited->dehaze.enabled = !get_inconsistent(); pedited->dehaze.showDepthMap = !showDepthMap->get_inconsistent(); + pedited->dehaze.luminance = !luminance->get_inconsistent(); } } @@ -138,6 +148,12 @@ void Dehaze::showDepthMapChanged() } } +void Dehaze::luminanceChanged() +{ + if (listener) { + listener->panelChanged(EvDehazeLuminance, luminance->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED")); + } +} void Dehaze::setBatchMode(bool batchMode) { diff --git a/rtgui/dehaze.h b/rtgui/dehaze.h index 3120dfc91..6a9d31cd1 100644 --- a/rtgui/dehaze.h +++ b/rtgui/dehaze.h @@ -28,12 +28,14 @@ class Dehaze: public ToolParamBlock, public AdjusterListener, public FoldableToo private: Adjuster *strength; Adjuster *depth; - Gtk::CheckButton *showDepthMap; + Gtk::CheckButton *showDepthMap; + Gtk::CheckButton *luminance; rtengine::ProcEvent EvDehazeEnabled; rtengine::ProcEvent EvDehazeStrength; rtengine::ProcEvent EvDehazeDepth; rtengine::ProcEvent EvDehazeShowDepthMap; + rtengine::ProcEvent EvDehazeLuminance; public: @@ -47,6 +49,7 @@ public: void adjusterChanged(Adjuster *a, double newval) override; void enabledChanged() override; void showDepthMapChanged(); + void luminanceChanged(); void setAdjusterBehavior(bool strengthAdd); }; diff --git a/rtgui/extprog.cc b/rtgui/extprog.cc index a6a9050c0..00ea07713 100644 --- a/rtgui/extprog.cc +++ b/rtgui/extprog.cc @@ -58,7 +58,7 @@ bool ExtProgAction::execute (const std::vector& fileNames) const } for (const auto& fileName : fileNames) { - cmdLine += " \"" + fileName + "\""; + cmdLine += " " + Glib::shell_quote(fileName); } return ExtProgStore::spawnCommandAsync (cmdLine); @@ -256,7 +256,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName) #else - auto cmdLine = Glib::ustring("gimp \"") + fileName + Glib::ustring("\""); + auto cmdLine = Glib::ustring("gimp ") + Glib::shell_quote(fileName); auto success = spawnCommandAsync (cmdLine); #endif @@ -291,7 +291,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName) #else - cmdLine = Glib::ustring("gimp-remote \"") + fileName + Glib::ustring("\""); + cmdLine = Glib::ustring("gimp-remote ") + Glib::shell_quote(fileName); success = ExtProgStore::spawnCommandAsync (cmdLine); #endif @@ -312,7 +312,7 @@ bool ExtProgStore::openInPhotoshop (const Glib::ustring& fileName) #else - const auto cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir, "Photoshop.exe") + Glib::ustring("\" \"") + fileName + Glib::ustring("\""); + const auto cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir, "Photoshop.exe") + "\" " + Glib::shell_quote(fileName); #endif @@ -334,7 +334,7 @@ bool ExtProgStore::openInCustomEditor (const Glib::ustring& fileName) #else - const auto cmdLine = Glib::ustring("\"") + options.customEditorProg + Glib::ustring("\" \"") + fileName + Glib::ustring("\""); + const auto cmdLine = options.customEditorProg + Glib::ustring(" ") + Glib::shell_quote(fileName); return spawnCommandAsync (cmdLine); #endif diff --git a/rtgui/main.cc b/rtgui/main.cc index 098963e0e..631d3db0a 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -529,13 +529,13 @@ int main (int argc, char **argv) int ret = 0; if (options.pseudoHiDPISupport) { - // Reading/updating GDK_SCALE early if it exists - const gchar *gscale = g_getenv("GDK_SCALE"); - if (gscale && gscale[0] == '2') { - initialGdkScale = 2; - } - // HOMBRE: On Windows, if resolution is set to 200%, Gtk internal variables are SCALE=2 and DPI=96 - g_setenv("GDK_SCALE", "1", true); + // Reading/updating GDK_SCALE early if it exists + const gchar *gscale = g_getenv("GDK_SCALE"); + if (gscale && gscale[0] == '2') { + initialGdkScale = 2; + } + // HOMBRE: On Windows, if resolution is set to 200%, Gtk internal variables are SCALE=2 and DPI=96 + g_setenv("GDK_SCALE", "1", true); } gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave))); diff --git a/rtgui/options.cc b/rtgui/options.cc index a0d089071..dc84a15aa 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -1265,7 +1265,7 @@ void Options::readFromFile(Glib::ustring fname) } if (keyFile.has_key("GUI", "PseudoHiDPISupport")) { - pseudoHiDPISupport = keyFile.get_boolean("GUI", "PseudoHiDPISupport"); + pseudoHiDPISupport = keyFile.get_boolean("GUI", "PseudoHiDPISupport"); } if (keyFile.has_key("GUI", "LastPreviewScale")) { diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index b2b51f38a..74bf975de 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -588,6 +588,7 @@ void ParamsEdited::set(bool v) dehaze.strength = v; dehaze.showDepthMap = v; dehaze.depth = v; + dehaze.luminance = v; metadata.mode = v; filmNegative.enabled = v; filmNegative.redRatio = v; @@ -1160,6 +1161,7 @@ void ParamsEdited::initFrom(const std::vector& dehaze.strength = dehaze.strength && p.dehaze.strength == other.dehaze.strength; dehaze.showDepthMap = dehaze.showDepthMap && p.dehaze.showDepthMap == other.dehaze.showDepthMap; dehaze.depth = dehaze.depth && p.dehaze.depth == other.dehaze.depth; + dehaze.luminance = dehaze.luminance && p.dehaze.luminance == other.dehaze.luminance; metadata.mode = metadata.mode && p.metadata.mode == other.metadata.mode; filmNegative.enabled = filmNegative.enabled && p.filmNegative.enabled == other.filmNegative.enabled; filmNegative.redRatio = filmNegative.redRatio && p.filmNegative.redRatio == other.filmNegative.redRatio; @@ -3230,6 +3232,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.dehaze.showDepthMap = mods.dehaze.showDepthMap; } + if (dehaze.luminance) { + toEdit.dehaze.luminance = mods.dehaze.luminance; + } + if (metadata.mode) { toEdit.metadata.mode = mods.metadata.mode; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index b83fbf568..e435e2291 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -597,6 +597,7 @@ struct DehazeParamsEdited { bool strength; bool showDepthMap; bool depth; + bool luminance; }; struct RAWParamsEdited { diff --git a/rtgui/pdsharpening.cc b/rtgui/pdsharpening.cc index f25e44e69..d0ccc43a8 100644 --- a/rtgui/pdsharpening.cc +++ b/rtgui/pdsharpening.cc @@ -18,22 +18,28 @@ */ #include -#include "eventmapper.h" +#include + #include "pdsharpening.h" + +#include "eventmapper.h" #include "options.h" + #include "../rtengine/procparams.h" using namespace rtengine; using namespace rtengine::procparams; -PdSharpening::PdSharpening() : FoldableToolPanel(this, "pdsharpening", M("TP_PDSHARPENING_LABEL"), false, true) +PdSharpening::PdSharpening() : + FoldableToolPanel(this, "capturesharpening", M("TP_PDSHARPENING_LABEL"), false, true), + lastAutoContrast(true), + lastAutoRadius(true) { - auto m = ProcEventMapper::getInstance(); EvPdShrContrast = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_CONTRAST"); EvPdSharpenGamma = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_GAMMA"); EvPdShrDRadius = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS"); - EvPdShrDRadiusOffset = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS_OFFSET"); + EvPdShrDRadiusOffset = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS_BOOST"); EvPdShrDIterations = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_ITERATIONS"); EvPdShrAutoContrast = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_AUTO_CONTRAST"); EvPdShrAutoRadius = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_AUTO_RADIUS"); @@ -42,7 +48,7 @@ PdSharpening::PdSharpening() : FoldableToolPanel(this, "pdsharpening", M("TP_PDS hb->show(); contrast = Gtk::manage(new Adjuster(M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 10)); contrast->setAdjusterListener(this); - contrast->addAutoButton(M("TP_RAW_DUALDEMOSAICAUTOCONTRAST_TOOLTIP")); + contrast->addAutoButton(); contrast->setAutoValue(true); pack_start(*contrast); @@ -53,9 +59,9 @@ PdSharpening::PdSharpening() : FoldableToolPanel(this, "pdsharpening", M("TP_PDS Gtk::VBox* rld = Gtk::manage(new Gtk::VBox()); gamma = Gtk::manage(new Adjuster(M("TP_SHARPENING_GAMMA"), 0.5, 6.0, 0.05, 1.00)); dradius = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS"), 0.4, 1.15, 0.01, 0.75)); - dradius->addAutoButton(M("TP_PDSHARPENING_AUTORADIUS_TOOLTIP")); + dradius->addAutoButton(); dradius->setAutoValue(true); - dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_OFFSET"), 0.0, 0.5, 0.01, 0.0)); + dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_BOOST"), -0.5, 0.5, 0.01, 0.0)); diter = Gtk::manage(new Adjuster(M("TP_SHARPENING_RLD_ITERATIONS"), 1, 100, 1, 20)); rld->pack_start(*gamma); rld->pack_start(*dradius); diff --git a/rtgui/rtscalable.cc b/rtgui/rtscalable.cc index 15211a7ee..b37f2276f 100644 --- a/rtgui/rtscalable.cc +++ b/rtgui/rtscalable.cc @@ -37,9 +37,9 @@ Gtk::TextDirection RTScalable::direction = Gtk::TextDirection::TEXT_DIR_NONE; void RTScalable::setDPInScale (const double newDPI, const int newScale) { if (!options.pseudoHiDPISupport) { - scale = 1; - dpi = baseDPI; - return; + scale = 1; + dpi = baseDPI; + return; } if (scale != newScale || (scale == 1 && dpi != newDPI)) { diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 3983f93b1..fc9be32f7 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -168,7 +168,7 @@ RTWindow::RTWindow () #endif //GTK318 if (options.pseudoHiDPISupport) { - fontScale = options.fontSize / (float)RTScalable::baseFontSize; + fontScale = options.fontSize / (float)RTScalable::baseFontSize; } if (options.rtSettings.verbose) { printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale); @@ -196,7 +196,7 @@ RTWindow::RTWindow () pt = fontSize / Pango::SCALE; } if (options.pseudoHiDPISupport) { - fontScale = (float)pt / (float)RTScalable::baseFontSize; + fontScale = (float)pt / (float)RTScalable::baseFontSize; } if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) { css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale); diff --git a/tools/RTProfileBuilderSample.cs b/tools/RTProfileBuilderSample.cs index a097e6883..80474b63b 100644 --- a/tools/RTProfileBuilderSample.cs +++ b/tools/RTProfileBuilderSample.cs @@ -1,293 +1,293 @@ -#region Usings -using System; -using System.Text; -using System.IO; -using System.Globalization; -using System.Diagnostics; -using System.Configuration; -using System.Collections; -using System.Collections.Specialized; -#endregion - -// *** Raw Therapee sample Custom Profile builder (version 2013-08-12) *** -// -// -// WARNING: The command line parameters has changed since this file has been created by Oduis. The new mechanism involves a -// temporary communication file (.ini style) to provide system parameters and metadata read by RawTherapee. This script has -// to be updated by some C# developer in order to work. -// -// -// WARNING: PP3 format may change in the future versions! If this happens there will probably be no automatic migration path, -// you'll have to adjust on your own. This is a sample, and therefore not supported by the RT team (just by oduis) -// -// -// How to use: -// 1. Modify the GetCorrectedSettings function below according to your needs. -// 2. Download and install Microsoft .Net Runtime (latest version is 4.0 as of writing), if it's not already on your machine. -// You can get it for free via Windows Update or from microsoft.com. No need for Visual Studio etc. -// 3. Open a command line and compile this CS-File using the C# 32bit compiler. It is usually installed somewhere here: -// C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe -// Call csc.exe (C#-Compiler) with your .CS file as parameter like this (one big line): -// -// C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc -// /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll -// /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll -// RTProfileBuilderSample.cs -// -// (On most machines it already works with "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc RTProfileBuilderSample.cs") -// CSC will compile it and emit an EXE. -// 4. Open your RT options files and find the entry [Profiles]/CustomProfileBuilder -// 5. Enter the path to your newly built exe here. On Windows, don't forget double slashes (e.g. "C:\\MyDir\\Mybuilder.exe") -// And you're done! The EXE is only called on opening the image editor and there is no PP3 already -// -// If you want to use EXIFTOOL to gather more details information to build queries: -// 1. Download exiftool.exe from http://www.sno.phy.queensu.ca/~phil/exiftool/ -// 2. Rename it to exiftool.exe (NOT exiftool(-k).. or something!) -// 3. Copy the RTProfilerBuilder.exe.config next to your own EXE. If you renamed it, rename config to "(Yourname).exe.config" -// 4. Open the config with notepad (it's an XML file). Set ExifToolPath to your downloaded and renamed exe -// -// If you want to know what parameters are available, call "exiftool.exe -tab -short" -// -// This description is for Windows. The C# code does not use anything fancy, will probably work with MONO on Linux/OSX, too - -namespace RTProfilerBuilder { - /// Main class. Mostly change GetCorrectedSettings. - class RTProfileBuilder { - - /// Adds the Nikkor zoom distortion correction profile. - /// First array is list of focal lengths, second array is the RT setting that should correct the - /// distortion for the corresponding focal length. Values between these values are automatically interpolated. - /// The focal length values must already be ordered. The number of sample points is not limited. - static DistortionCorrectProf distNikkor24120f4 = new DistortionCorrectProf( - new double[] { 24, 28, 35, 50, 70, 85, 120 }, - new double[] { -0.1, -0.063, -0.012, 0.018, 0.034, 0.04, 0.048 } - ); - - - /// This is your personalisation function - /// Full EXIF from EXIFTOOL (if configured). - /// Entry, like "Sharpening/Radius" - /// Current value (from default file) - /// FNumberExposure in seconds - /// Focal length in MMISO value - /// Lens from EXIFCamera from EXIF - /// The value to be written. Simply take the current value if you have nothing to touch. - static string GetCorrectedSetting(NameValueCollection exif, string sectionEntry, string value, - double fNumber, double exposureSecs, double focalLength, long iso, string lens, string camera) { - - string s; - - // We don't do anything to the value if it's not our camera - if (camera.EndsWith("NIKON D700", StringComparison.InvariantCultureIgnoreCase) && lens.Contains("24.0-120.0 mm f/4.0")) { - switch (sectionEntry) { - // Here is the place to adjust your settings - // Pretty simple: "SectionName/EntryName" in options file - - case "Vignetting Correction/Amount": - value = (fNumber < 8 && focalLength < 30) ? "30" : "0"; - break; - - case "RAW/CA": - value = ToBool(fNumber < 11); // Means "Enabled if fnumber<11, otherwise disabled" - break; - - case "Impulse Denoising/Enabled": - value = ToBool(iso >= 3200); - break; - - case "HLRecovery/Enabled": - value = ToBool(iso >= 1600); // Dynamic range decreases, so we'll probably need it - break; - - case "Color Boost/Amount": - if (iso >= 6400) value = "0"; // Colors will get poppy anyway... - break; - - case "Distortion/Amount": - // we already checked in the IF upstairs that this is "our" lens - value = distNikkor24120f4.GetDistortionAmount(focalLength); - break; - - // Add other parameters here. Mention this is case sensitive! - - default: break; // we don't touch values we don't care about - } - } // end if camera=xxx - - - // This is for camera independent settings - switch (sectionEntry) { - // These are parsed from EXIFTOOL and XMP in DNG (see http://en.wikipedia.org/wiki/Extensible_Metadata_Platform) - case "IPTC/City": - s = exif.Get("City"); - if (!String.IsNullOrEmpty(s)) value = s; - break; - - case "IPTC/Country": - s = exif.Get("Country"); - if (!String.IsNullOrEmpty(s)) value = s; - break; - - case "IPTC/Caption": - case "IPTC/Title": - s = exif.Get("Headline"); - if (!String.IsNullOrEmpty(s)) value = s; - break; - - // Add other parameters here. Mention this is case sensitive! - - default: break; // we don't touch values we don't care about - } - return value; - } - - #region * Main and Helpers - static string ToBool(bool condition) { return condition ? "true" : "false"; } - static string ToFloat(float f) { return f.ToString(CultureInfo.InvariantCulture); } - - /// Reads default file and parses it. No need to touch it for your personal settings. - /// Command line args - /// 0 on all OK. - static int Main(string[] args) { - int exitCode = 0; - - try { - #region Parse input parameters - int argNo = 0; - - // Name of raw/JPG to process - string sourceFile = args[argNo++]; - - // What the user selected as his base profile - string defaultProfileFilePath = args[argNo++]; - - // Cache directory, for any logging file - string cachePath = args[argNo++]; - - - // True if the image is only being flagged as inTrash, rank or colorLabel but still need valid PP3 - actually not used by this script - bool forFlaggingPurpose = bool.Parse(args[argNo++], CultureInfo.InvariantCulture); - - // Note that old C++ has no automatic number globalization - double fNumber = double.Parse(args[argNo++], CultureInfo.InvariantCulture); - double exposureSecs = double.Parse(args[argNo++], CultureInfo.InvariantCulture); - double focalLength = double.Parse(args[argNo++], CultureInfo.InvariantCulture); - long iso = long.Parse(args[argNo++], CultureInfo.InvariantCulture); - - string lens = args[argNo++]; - string cameraMake = args[argNo++]; - string cameraModel = args[argNo++]; - string camera = cameraMake + " " + cameraModel; - #endregion - - // Read default file as basis - string[] lines = File.ReadAllLines(defaultProfileFilePath); - - NameValueCollection nvEXIF = ParseFullExifData(sourceFile); - - // File should be Windows ANSI - using (TextWriter tw = new StreamWriter(sourceFile + ".pp3", false, new UTF8Encoding(false))) { - string section = ""; - - foreach (string line in lines) { - string l = line.Trim(); - if (!String.IsNullOrEmpty(line)) { - - if (l.StartsWith("[")) - section = l.Trim(new char[] { '[', ']' }); - else if (char.IsLetterOrDigit(l[0]) && l.Contains("=")) { - int valPos = l.IndexOf("=") + 1; - - string newValue = GetCorrectedSetting(nvEXIF, section + "/" + l.Substring(0, valPos - 1), l.Substring(valPos).Trim(), - fNumber, exposureSecs, focalLength, iso, lens, camera); - - // Merge in new value - l = l.Substring(0, valPos) + (newValue ?? ""); - } - } - - tw.WriteLine(l); - } - } - - } catch (Exception ex) { - Console.WriteLine("Error: " + ex.ToString()); // can be seen in the RT console window - - exitCode = 1; - } - - return exitCode; - } - - - static NameValueCollection ParseFullExifData(string filePath) { - NameValueCollection nv = new NameValueCollection(); - - string exifToolPath = ConfigurationManager.AppSettings["ExifToolPath"]; - if (!String.IsNullOrEmpty(exifToolPath)) { - ProcessStartInfo psi = new ProcessStartInfo(exifToolPath, "\"" + filePath + "\" -tab -short"); - psi.CreateNoWindow = false; - psi.UseShellExecute = false; - psi.StandardOutputEncoding = System.Text.Encoding.UTF8; - psi.RedirectStandardOutput = true; - - Process p = Process.Start(psi); - - using (StreamReader sr = p.StandardOutput) { - while (!sr.EndOfStream) { - string line = sr.ReadLine(); - if (line.Contains("\t")) { - string[] split = line.Split('\t'); - nv.Add(split[0], split[1]); - } - } - } - - p.WaitForExit(); - } - - return nv; - } - - #endregion - } - - #region DistortionCorrectProf - /// Holds a distortion correction profile for one lens. Uses sample points (focal length vs. dist. correction) as input. - class DistortionCorrectProf { - double[] adFocLen, adCorrect; - - /// Parses array to internal structure - /// Focal lengths - /// Correction factors - public DistortionCorrectProf(double[] focLen, double[] correct) { - if (focLen == null || correct == null || focLen.Length != correct.Length || focLen.Length < 2) - throw new Exception("DistortionCorrectProf inputs must be valid and of the same lengths, at least 2 points"); - - adFocLen = focLen; adCorrect = correct; - - for (int i = 0; i < adFocLen.Length - 1; i++) - if (adFocLen[i] >= adFocLen[i + 1]) throw new Exception("The distortion correction focal length points must be ordered!"); - } - - /// Calculates regression value of RT distortion amount for the given focal length. - /// Input focal length. - /// Distortion in RT format. - public string GetDistortionAmount(double focalLength) { - // if it's out of area (which should just happen with e.g. rounding errors), return flat defaults. - if (focalLength <= adFocLen[0]) return adCorrect[0].ToString("G", CultureInfo.InvariantCulture); - if (focalLength >= adFocLen[adFocLen.Length - 1]) return adCorrect[adFocLen.Length - 1].ToString("G", CultureInfo.InvariantCulture); - - for (int i = 0; i < adFocLen.Length - 1; i++) { - if (focalLength >= adFocLen[i] && focalLength < adFocLen[i + 1]) { - // from the sample curves taken so far, it it safe to take a simple linear interpolation here - double corr = adCorrect[i] + (adCorrect[i + 1] - adCorrect[i]) * (focalLength - adFocLen[i]) / (adFocLen[i + 1] - adFocLen[i]); - return corr.ToString("G3", CultureInfo.InvariantCulture); - } - } - - return ""; // should never happen - } - } - #endregion -} +#region Usings +using System; +using System.Text; +using System.IO; +using System.Globalization; +using System.Diagnostics; +using System.Configuration; +using System.Collections; +using System.Collections.Specialized; +#endregion + +// *** Raw Therapee sample Custom Profile builder (version 2013-08-12) *** +// +// +// WARNING: The command line parameters has changed since this file has been created by Oduis. The new mechanism involves a +// temporary communication file (.ini style) to provide system parameters and metadata read by RawTherapee. This script has +// to be updated by some C# developer in order to work. +// +// +// WARNING: PP3 format may change in the future versions! If this happens there will probably be no automatic migration path, +// you'll have to adjust on your own. This is a sample, and therefore not supported by the RT team (just by oduis) +// +// +// How to use: +// 1. Modify the GetCorrectedSettings function below according to your needs. +// 2. Download and install Microsoft .Net Runtime (latest version is 4.0 as of writing), if it's not already on your machine. +// You can get it for free via Windows Update or from microsoft.com. No need for Visual Studio etc. +// 3. Open a command line and compile this CS-File using the C# 32bit compiler. It is usually installed somewhere here: +// C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe +// Call csc.exe (C#-Compiler) with your .CS file as parameter like this (one big line): +// +// C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc +// /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll +// /r:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll +// RTProfileBuilderSample.cs +// +// (On most machines it already works with "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc RTProfileBuilderSample.cs") +// CSC will compile it and emit an EXE. +// 4. Open your RT options files and find the entry [Profiles]/CustomProfileBuilder +// 5. Enter the path to your newly built exe here. On Windows, don't forget double slashes (e.g. "C:\\MyDir\\Mybuilder.exe") +// And you're done! The EXE is only called on opening the image editor and there is no PP3 already +// +// If you want to use EXIFTOOL to gather more details information to build queries: +// 1. Download exiftool.exe from http://www.sno.phy.queensu.ca/~phil/exiftool/ +// 2. Rename it to exiftool.exe (NOT exiftool(-k).. or something!) +// 3. Copy the RTProfilerBuilder.exe.config next to your own EXE. If you renamed it, rename config to "(Yourname).exe.config" +// 4. Open the config with notepad (it's an XML file). Set ExifToolPath to your downloaded and renamed exe +// +// If you want to know what parameters are available, call "exiftool.exe -tab -short" +// +// This description is for Windows. The C# code does not use anything fancy, will probably work with MONO on Linux/OSX, too + +namespace RTProfilerBuilder { + /// Main class. Mostly change GetCorrectedSettings. + class RTProfileBuilder { + + /// Adds the Nikkor zoom distortion correction profile. + /// First array is list of focal lengths, second array is the RT setting that should correct the + /// distortion for the corresponding focal length. Values between these values are automatically interpolated. + /// The focal length values must already be ordered. The number of sample points is not limited. + static DistortionCorrectProf distNikkor24120f4 = new DistortionCorrectProf( + new double[] { 24, 28, 35, 50, 70, 85, 120 }, + new double[] { -0.1, -0.063, -0.012, 0.018, 0.034, 0.04, 0.048 } + ); + + + /// This is your personalisation function + /// Full EXIF from EXIFTOOL (if configured). + /// Entry, like "Sharpening/Radius" + /// Current value (from default file) + /// FNumberExposure in seconds + /// Focal length in MMISO value + /// Lens from EXIFCamera from EXIF + /// The value to be written. Simply take the current value if you have nothing to touch. + static string GetCorrectedSetting(NameValueCollection exif, string sectionEntry, string value, + double fNumber, double exposureSecs, double focalLength, long iso, string lens, string camera) { + + string s; + + // We don't do anything to the value if it's not our camera + if (camera.EndsWith("NIKON D700", StringComparison.InvariantCultureIgnoreCase) && lens.Contains("24.0-120.0 mm f/4.0")) { + switch (sectionEntry) { + // Here is the place to adjust your settings + // Pretty simple: "SectionName/EntryName" in options file + + case "Vignetting Correction/Amount": + value = (fNumber < 8 && focalLength < 30) ? "30" : "0"; + break; + + case "RAW/CA": + value = ToBool(fNumber < 11); // Means "Enabled if fnumber<11, otherwise disabled" + break; + + case "Impulse Denoising/Enabled": + value = ToBool(iso >= 3200); + break; + + case "HLRecovery/Enabled": + value = ToBool(iso >= 1600); // Dynamic range decreases, so we'll probably need it + break; + + case "Color Boost/Amount": + if (iso >= 6400) value = "0"; // Colors will get poppy anyway... + break; + + case "Distortion/Amount": + // we already checked in the IF upstairs that this is "our" lens + value = distNikkor24120f4.GetDistortionAmount(focalLength); + break; + + // Add other parameters here. Mention this is case sensitive! + + default: break; // we don't touch values we don't care about + } + } // end if camera=xxx + + + // This is for camera independent settings + switch (sectionEntry) { + // These are parsed from EXIFTOOL and XMP in DNG (see http://en.wikipedia.org/wiki/Extensible_Metadata_Platform) + case "IPTC/City": + s = exif.Get("City"); + if (!String.IsNullOrEmpty(s)) value = s; + break; + + case "IPTC/Country": + s = exif.Get("Country"); + if (!String.IsNullOrEmpty(s)) value = s; + break; + + case "IPTC/Caption": + case "IPTC/Title": + s = exif.Get("Headline"); + if (!String.IsNullOrEmpty(s)) value = s; + break; + + // Add other parameters here. Mention this is case sensitive! + + default: break; // we don't touch values we don't care about + } + return value; + } + +#region * Main and Helpers + static string ToBool(bool condition) { return condition ? "true" : "false"; } + static string ToFloat(float f) { return f.ToString(CultureInfo.InvariantCulture); } + + /// Reads default file and parses it. No need to touch it for your personal settings. + /// Command line args + /// 0 on all OK. + static int Main(string[] args) { + int exitCode = 0; + + try { +#region Parse input parameters + int argNo = 0; + + // Name of raw/JPG to process + string sourceFile = args[argNo++]; + + // What the user selected as his base profile + string defaultProfileFilePath = args[argNo++]; + + // Cache directory, for any logging file + string cachePath = args[argNo++]; + + + // True if the image is only being flagged as inTrash, rank or colorLabel but still need valid PP3 - actually not used by this script + bool forFlaggingPurpose = bool.Parse(args[argNo++], CultureInfo.InvariantCulture); + + // Note that old C++ has no automatic number globalization + double fNumber = double.Parse(args[argNo++], CultureInfo.InvariantCulture); + double exposureSecs = double.Parse(args[argNo++], CultureInfo.InvariantCulture); + double focalLength = double.Parse(args[argNo++], CultureInfo.InvariantCulture); + long iso = long.Parse(args[argNo++], CultureInfo.InvariantCulture); + + string lens = args[argNo++]; + string cameraMake = args[argNo++]; + string cameraModel = args[argNo++]; + string camera = cameraMake + " " + cameraModel; +#endregion + + // Read default file as basis + string[] lines = File.ReadAllLines(defaultProfileFilePath); + + NameValueCollection nvEXIF = ParseFullExifData(sourceFile); + + // File should be Windows ANSI + using (TextWriter tw = new StreamWriter(sourceFile + ".pp3", false, new UTF8Encoding(false))) { + string section = ""; + + foreach (string line in lines) { + string l = line.Trim(); + if (!String.IsNullOrEmpty(line)) { + + if (l.StartsWith("[")) + section = l.Trim(new char[] { '[', ']' }); + else if (char.IsLetterOrDigit(l[0]) && l.Contains("=")) { + int valPos = l.IndexOf("=") + 1; + + string newValue = GetCorrectedSetting(nvEXIF, section + "/" + l.Substring(0, valPos - 1), l.Substring(valPos).Trim(), + fNumber, exposureSecs, focalLength, iso, lens, camera); + + // Merge in new value + l = l.Substring(0, valPos) + (newValue ?? ""); + } + } + + tw.WriteLine(l); + } + } + + } catch (Exception ex) { + Console.WriteLine("Error: " + ex.ToString()); // can be seen in the RT console window + + exitCode = 1; + } + + return exitCode; + } + + + static NameValueCollection ParseFullExifData(string filePath) { + NameValueCollection nv = new NameValueCollection(); + + string exifToolPath = ConfigurationManager.AppSettings["ExifToolPath"]; + if (!String.IsNullOrEmpty(exifToolPath)) { + ProcessStartInfo psi = new ProcessStartInfo(exifToolPath, "\"" + filePath + "\" -tab -short"); + psi.CreateNoWindow = false; + psi.UseShellExecute = false; + psi.StandardOutputEncoding = System.Text.Encoding.UTF8; + psi.RedirectStandardOutput = true; + + Process p = Process.Start(psi); + + using (StreamReader sr = p.StandardOutput) { + while (!sr.EndOfStream) { + string line = sr.ReadLine(); + if (line.Contains("\t")) { + string[] split = line.Split('\t'); + nv.Add(split[0], split[1]); + } + } + } + + p.WaitForExit(); + } + + return nv; + } + +#endregion + } + +#region DistortionCorrectProf + /// Holds a distortion correction profile for one lens. Uses sample points (focal length vs. dist. correction) as input. + class DistortionCorrectProf { + double[] adFocLen, adCorrect; + + /// Parses array to internal structure + /// Focal lengths + /// Correction factors + public DistortionCorrectProf(double[] focLen, double[] correct) { + if (focLen == null || correct == null || focLen.Length != correct.Length || focLen.Length < 2) + throw new Exception("DistortionCorrectProf inputs must be valid and of the same lengths, at least 2 points"); + + adFocLen = focLen; adCorrect = correct; + + for (int i = 0; i < adFocLen.Length - 1; i++) + if (adFocLen[i] >= adFocLen[i + 1]) throw new Exception("The distortion correction focal length points must be ordered!"); + } + + /// Calculates regression value of RT distortion amount for the given focal length. + /// Input focal length. + /// Distortion in RT format. + public string GetDistortionAmount(double focalLength) { + // if it's out of area (which should just happen with e.g. rounding errors), return flat defaults. + if (focalLength <= adFocLen[0]) return adCorrect[0].ToString("G", CultureInfo.InvariantCulture); + if (focalLength >= adFocLen[adFocLen.Length - 1]) return adCorrect[adFocLen.Length - 1].ToString("G", CultureInfo.InvariantCulture); + + for (int i = 0; i < adFocLen.Length - 1; i++) { + if (focalLength >= adFocLen[i] && focalLength < adFocLen[i + 1]) { + // from the sample curves taken so far, it it safe to take a simple linear interpolation here + double corr = adCorrect[i] + (adCorrect[i + 1] - adCorrect[i]) * (focalLength - adFocLen[i]) / (adFocLen[i + 1] - adFocLen[i]); + return corr.ToString("G3", CultureInfo.InvariantCulture); + } + } + + return ""; // should never happen + } + } +#endregion +} diff --git a/tools/RTProfileBuilderSample.exe.config b/tools/RTProfileBuilderSample.exe.config index 2dbb6b973..c054fce6c 100644 --- a/tools/RTProfileBuilderSample.exe.config +++ b/tools/RTProfileBuilderSample.exe.config @@ -1,8 +1,8 @@ - - - - - - - + + + + + + + diff --git a/tools/camconst_creator.ods b/tools/camconst_creator.ods index 954abe6ac..8930587ba 100644 Binary files a/tools/camconst_creator.ods and b/tools/camconst_creator.ods differ diff --git a/tools/osx/Info.plist-bin.in b/tools/osx/Info.plist-bin.in index 20ce5a741..33abd4f7a 100644 --- a/tools/osx/Info.plist-bin.in +++ b/tools/osx/Info.plist-bin.in @@ -1,10 +1,10 @@ - - CFBundleName - RawTherapee-bin - CFBundleIdentifier - com.rawtherapee.rawtherapee - + + CFBundleName + RawTherapee-bin + CFBundleIdentifier + com.rawtherapee.rawtherapee + diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index e78db0cc4..eec1ab490 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -1,167 +1,167 @@ - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - RawTherapee - CFBundleDocumentTypes - - - CFBundleTypeExtensions - - pp3 - PP3 - - CFBundleTypeIconFile - profile.icns - CFBundleTypeName - RawTherapee Profile Data - CFBundleTypeRole - Editor - LSIsAppleDefaultForType - - LSItemContentTypes - - com.rawtherapee.pp3 - - - - CFBundleTypeExtensions - - 3FR - 3fr - ARW - arw - CR2 - cr2 - CRF - crf - CRW - crw - DCR - dcr - DNG - dng - FFF - fff - IIQ - iiq - KDC - kdc - MEF - mef - MOS - mos - MRW - mrw - NEF - nef - NRW - nrw - ORF - orf - PEF - pef - RAF - raf - RAW - raw - RW2 - rw2 - RWZ - rwz - SR2 - sr2 - SRF - srf - SRW - srw - - CFBundleTypeMIMETypes - - image/raw - - CFBundleTypeName - Camera Raw - CFBundleTypeRole - Viewer - - - CFBundleTypeExtensions - - JPEG - jpeg - JPG - jpg - PNG - png - TIF - tif - TIFF - tiff - - CFBundleTypeName - Image - CFBundleTypeRole - Viewer - - - CFBundleExecutable - rawtherapee - CFBundleGetInfoString - @version@, Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team - CFBundleIconFile - rawtherapee.icns - CFBundleIdentifier - com.rawtherapee.rawtherapee - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - RawTherapee - CFBundlePackageType - APPL - CFBundleShortVersionString - @shortVersion@ - CFBundleSignature - ???? - CFBundleVersion - @shortVersion@ - LSExecutableArchitectures - - @arch@ - - NSHighResolutionCapable - - NSHumanReadableCopyright - Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team - UTExportedTypeDeclarations - - - UTTypeConformsTo - - public.data - - UTTypeDescription - RawTherapee Profile Data - UTTypeIconFile - Icons.icns - UTTypeIdentifier - com.rawtherapee.pp3 - UTTypeReferenceURL - http://www.rawtherapee.com/ - UTTypeTagSpecification - - com.apple.ostype - PP3 - public.filename-extension - - pp3 - PP3 - - - - - + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + RawTherapee + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + pp3 + PP3 + + CFBundleTypeIconFile + profile.icns + CFBundleTypeName + RawTherapee Profile Data + CFBundleTypeRole + Editor + LSIsAppleDefaultForType + + LSItemContentTypes + + com.rawtherapee.pp3 + + + + CFBundleTypeExtensions + + 3FR + 3fr + ARW + arw + CR2 + cr2 + CRF + crf + CRW + crw + DCR + dcr + DNG + dng + FFF + fff + IIQ + iiq + KDC + kdc + MEF + mef + MOS + mos + MRW + mrw + NEF + nef + NRW + nrw + ORF + orf + PEF + pef + RAF + raf + RAW + raw + RW2 + rw2 + RWZ + rwz + SR2 + sr2 + SRF + srf + SRW + srw + + CFBundleTypeMIMETypes + + image/raw + + CFBundleTypeName + Camera Raw + CFBundleTypeRole + Viewer + + + CFBundleTypeExtensions + + JPEG + jpeg + JPG + jpg + PNG + png + TIF + tif + TIFF + tiff + + CFBundleTypeName + Image + CFBundleTypeRole + Viewer + + + CFBundleExecutable + rawtherapee + CFBundleGetInfoString + @version@, Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team + CFBundleIconFile + rawtherapee.icns + CFBundleIdentifier + com.rawtherapee.rawtherapee + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + RawTherapee + CFBundlePackageType + APPL + CFBundleShortVersionString + @shortVersion@ + CFBundleSignature + ???? + CFBundleVersion + @shortVersion@ + LSExecutableArchitectures + + @arch@ + + NSHighResolutionCapable + + NSHumanReadableCopyright + Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team + UTExportedTypeDeclarations + + + UTTypeConformsTo + + public.data + + UTTypeDescription + RawTherapee Profile Data + UTTypeIconFile + Icons.icns + UTTypeIdentifier + com.rawtherapee.pp3 + UTTypeReferenceURL + http://www.rawtherapee.com/ + UTTypeTagSpecification + + com.apple.ostype + PP3 + public.filename-extension + + pp3 + PP3 + + + + + diff --git a/tools/osx/rt.entitlements b/tools/osx/rt.entitlements index 2236af138..082661401 100644 --- a/tools/osx/rt.entitlements +++ b/tools/osx/rt.entitlements @@ -1,20 +1,20 @@ - - application-identifier - com.rawtherapee.rawtherapee - com.apple.security.temporary-exception.files.absolute-path.read-write - - "/" - - com.apple.security.cs.allow-dyld-environment-variables - - com.apple.security.files.user-selected.read-write - - com.apple.security.app-sandbox - - com.apple.security.files.downloads.read-write - - + + application-identifier + com.rawtherapee.rawtherapee + com.apple.security.temporary-exception.files.absolute-path.read-write + + "/" + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.files.user-selected.read-write + + com.apple.security.app-sandbox + + com.apple.security.files.downloads.read-write + +