diff --git a/CMakeLists.txt b/CMakeLists.txt index d7368f115..bbc129eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,7 +263,11 @@ if(APPLE) if("${NOTARY}") set(NOTARY "${NOTARY}" CACHE STRING "Notarization Identity") endif() - + if("${LOCAL_PREFIX}") + set(LOCAL_PREFIX "${LOCAL_PREFIX}" CACHE STRING "macos/gtk parent directory ie /usr or /opt") + elseif(NOT DEFINED LOCAL_PREFIX) + set(LOCAL_PREFIX "/usr") + endif() endif() # Enforce absolute paths for non-bundle builds: diff --git a/rtdata/dcpprofiles/Canon EOS RP.dcp b/rtdata/dcpprofiles/Canon EOS RP.dcp new file mode 100644 index 000000000..8379d9703 Binary files /dev/null and b/rtdata/dcpprofiles/Canon EOS RP.dcp differ diff --git a/rtdata/dcpprofiles/FUJIFILM X-T10.dcp b/rtdata/dcpprofiles/FUJIFILM X-T10.dcp new file mode 100644 index 000000000..e77837f3e Binary files /dev/null and b/rtdata/dcpprofiles/FUJIFILM X-T10.dcp differ diff --git a/rtdata/dcpprofiles/FUJIFILM X-T30.dcp b/rtdata/dcpprofiles/FUJIFILM X-T30.dcp new file mode 100644 index 000000000..97917b810 Binary files /dev/null and b/rtdata/dcpprofiles/FUJIFILM X-T30.dcp differ diff --git a/rtdata/dcpprofiles/SONY ILCE-6300.dcp b/rtdata/dcpprofiles/SONY ILCE-6300.dcp new file mode 100644 index 000000000..53194d35d Binary files /dev/null and b/rtdata/dcpprofiles/SONY ILCE-6300.dcp differ diff --git a/rtdata/dcpprofiles/SONY ILCE-6500.dcp b/rtdata/dcpprofiles/SONY ILCE-6500.dcp new file mode 100644 index 000000000..66be8b1de Binary files /dev/null and b/rtdata/dcpprofiles/SONY ILCE-6500.dcp differ diff --git a/rtengine/array2D.h b/rtengine/array2D.h index 208dab1aa..de6381aeb 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -188,6 +188,16 @@ public: } } + void fill(const T val, bool multiThread = false) + { +#ifdef _OPENMP + #pragma omp parallel for if(multiThread) +#endif + for (int i = 0; i < x * y; ++i) { + data[i] = val; + } + } + void free() { if ((owner) && (data)) { diff --git a/rtengine/capturesharpening.cc b/rtengine/capturesharpening.cc index d357eb59c..072935dc2 100644 --- a/rtengine/capturesharpening.cc +++ b/rtengine/capturesharpening.cc @@ -99,31 +99,7 @@ void compute3x3kernel(float sigma, float kernel[3][3]) { } } -inline void initTile(float** dst, const int tileSize) -{ - - // first rows - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < tileSize; ++j) { - dst[i][j] = 1.f; - } - } - - // left and right border - for (int i = 3; i < tileSize - 3; ++i) { - dst[i][0] = dst[i][1] = dst[i][2] = 1.f; - dst[i][tileSize - 3] = dst[i][tileSize - 2] = dst[i][tileSize - 1] = 1.f; - } - - // last rows - for (int i = tileSize - 3 ; i < tileSize; ++i) { - for (int j = 0; j < tileSize; ++j) { - dst[i][j] = 1.f; - } - } -} - -inline void gauss3x3div (float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int tileSize, const float kernel[3][3]) +void gauss3x3div (float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int tileSize, const float kernel[3][3]) { const float c11 = kernel[0][0]; @@ -145,7 +121,7 @@ inline void gauss3x3div (float** RESTRICT src, float** RESTRICT dst, float** RES } } -inline void gauss5x5div (float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int tileSize, const float kernel[5][5]) +void gauss5x5div (float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int tileSize, const float kernel[5][5]) { const float c21 = kernel[0][1]; @@ -173,7 +149,7 @@ inline void gauss5x5div (float** RESTRICT src, float** RESTRICT dst, float** RES } } -inline void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int tileSize, const float kernel[7][7]) +void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** RESTRICT divBuffer, const int tileSize, const float kernel[7][7]) { const float c31 = kernel[0][2]; @@ -207,7 +183,7 @@ inline void gauss7x7div(float** RESTRICT src, float** RESTRICT dst, float** REST } } -inline void gauss3x3mult(float** RESTRICT src, float** RESTRICT dst, const int tileSize, const float kernel[3][3]) +void gauss3x3mult(float** RESTRICT src, float** RESTRICT dst, const int tileSize, const float kernel[3][3]) { const float c11 = kernel[0][0]; const float c10 = kernel[0][1]; @@ -229,7 +205,7 @@ inline void gauss3x3mult(float** RESTRICT src, float** RESTRICT dst, const int t } -inline void gauss5x5mult (float** RESTRICT src, float** RESTRICT dst, const int tileSize, const float kernel[5][5]) +void gauss5x5mult (float** RESTRICT src, float** RESTRICT dst, const int tileSize, const float kernel[5][5]) { const float c21 = kernel[0][1]; @@ -257,7 +233,7 @@ inline void gauss5x5mult (float** RESTRICT src, float** RESTRICT dst, const int } } -inline void gauss7x7mult(float** RESTRICT src, float** RESTRICT dst, const int tileSize, const float kernel[7][7]) +void gauss7x7mult(float** RESTRICT src, float** RESTRICT dst, const int tileSize, const float kernel[7][7]) { const float c31 = kernel[0][2]; @@ -578,9 +554,9 @@ BENCHFUN int progresscounter = 0; array2D tmpIThr(fullTileSize, fullTileSize); array2D tmpThr(fullTileSize, fullTileSize); + tmpThr.fill(1.f); array2D lumThr(fullTileSize, fullTileSize); array2D iterCheck(tileSize, tileSize); - initTile(tmpThr, fullTileSize); #ifdef _OPENMP #pragma omp for schedule(dynamic,16) collapse(2) #endif @@ -705,13 +681,13 @@ BENCHFUN // special handling for small tiles at end of row or column for (int k = border, ii = endOfCol ? H - fullTileSize : i - border; k < fullTileSize - border; ++k) { for (int l = border, jj = endOfRow ? W - fullTileSize : j - border; l < fullTileSize - border; ++l) { - luminance[ii + k][jj + l] = rtengine::intp(blend[ii + k][jj + l], std::max(tmpIThr[k][l], 0.0f), luminance[ii + k][jj + l]); + luminance[ii + k][jj + l] = rtengine::intp(blend[ii + k][jj + l], tmpIThr[k][l], luminance[ii + k][jj + l]); } } } else { for (int ii = border; ii < fullTileSize - border; ++ii) { for (int jj = border; jj < fullTileSize - border; ++jj) { - luminance[i + ii - border][j + jj - border] = rtengine::intp(blend[i + ii - border][j + jj - border], std::max(tmpIThr[ii][jj], 0.0f), luminance[i + ii - border][j + jj - border]); + luminance[i + ii - border][j + jj - border] = rtengine::intp(blend[i + ii - border][j + jj - border], tmpIThr[ii][jj], luminance[i + ii - border][j + jj - border]); } } } diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 1d3f2f494..e366184b0 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -38,14 +38,8 @@ namespace { inline void copyAndClampLine(const float *src, unsigned char *dst, const int W) { - for (int j = 0, iy = 0; j < W; ++j) { - float r = src[iy] * MAXVALF; - float g = src[iy+1] * MAXVALF; - float b = src[iy+2] * MAXVALF; - dst[iy] = uint16ToUint8Rounded(CLIP(r)); - dst[iy+1] = uint16ToUint8Rounded(CLIP(g)); - dst[iy+2] = uint16ToUint8Rounded(CLIP(b)); - iy += 3; + for (int j = 0; j < W * 3; ++j) { + dst[j] = uint16ToUint8Rounded(CLIP(src[j] * MAXVALF)); } } @@ -90,8 +84,8 @@ void ImProcFunctions::lab2monitorRgb(LabImage* lab, Image8* image) { if (monitorTransform) { - int W = lab->W; - int H = lab->H; + const int W = lab->W; + const int H = lab->H; unsigned char * data = image->data; // cmsDoTransform is relatively expensive @@ -100,18 +94,19 @@ void ImProcFunctions::lab2monitorRgb(LabImage* lab, Image8* image) #endif { AlignedBuffer pBuf(3 * lab->W); - AlignedBuffer mBuf(3 * lab->W); + AlignedBuffer mBuf; AlignedBuffer gwBuf1; AlignedBuffer gwBuf2; if (gamutWarning) { gwBuf1.resize(3 * lab->W); gwBuf2.resize(3 * lab->W); + mBuf.resize(3 * lab->W); } float *buffer = pBuf.data; - float *outbuffer = mBuf.data; + float *outbuffer = gamutWarning ? mBuf.data : pBuf.data; // make in place transformations when gamutWarning is not needed #ifdef _OPENMP #pragma omp for schedule(dynamic,16) @@ -132,7 +127,7 @@ void ImProcFunctions::lab2monitorRgb(LabImage* lab, Image8* image) buffer[iy++] = rb[j] / 327.68f; } - cmsDoTransform (monitorTransform, buffer, outbuffer, W); + cmsDoTransform(monitorTransform, buffer, outbuffer, W); copyAndClampLine(outbuffer, data + ix, W); if (gamutWarning) { diff --git a/rtengine/sleef.h b/rtengine/sleef.h index b7655258b..fc23cbad9 100644 --- a/rtengine/sleef.h +++ b/rtengine/sleef.h @@ -929,7 +929,7 @@ __inline float mulsignf(float x, float y) { return intBitsToFloat(floatToRawIntBits(x) ^ (floatToRawIntBits(y) & (1 << 31))); } -__inline float signf(float d) { return copysign(1, d); } +__inline float signf(float d) { return std::copysign(1.f, d); } __inline float mlaf(float x, float y, float z) { return x * y + z; } __inline int xisnanf(float x) { return x != x; } diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index 669528ac1..10ef61566 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -293,36 +293,32 @@ void DirBrowser::row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk:: auto dir = Gio::File::create_for_path (iter->get_value (dtColumns.dirname)); auto subDirs = listSubDirs (dir, options.fbShowHidden); - if (subDirs.empty()) { - dirtree->collapse_row(path); - } else { - Gtk::TreeNodeChildren children = iter->children(); - std::list forErase(children.begin(), children.end()); + Gtk::TreeNodeChildren children = iter->children(); + std::list forErase(children.begin(), children.end()); - std::sort (subDirs.begin (), subDirs.end (), [] (const Glib::ustring& firstDir, const Glib::ustring& secondDir) - { - switch (options.dirBrowserSortType) { - default: - case Gtk::SORT_ASCENDING: - return firstDir < secondDir; - case Gtk::SORT_DESCENDING: - return firstDir > secondDir; - } - }); - - for (auto it = subDirs.begin(), end = subDirs.end(); it != end; ++it) { - addDir(iter, *it); + std::sort (subDirs.begin (), subDirs.end (), [] (const Glib::ustring& firstDir, const Glib::ustring& secondDir) + { + switch (options.dirBrowserSortType) { + default: + case Gtk::SORT_ASCENDING: + return firstDir < secondDir; + case Gtk::SORT_DESCENDING: + return firstDir > secondDir; } + }); - for (auto it = forErase.begin(), end = forErase.end(); it != end; ++it) { - dirTreeModel->erase(*it); - } - - dirTreeModel->set_sort_column(prevSortColumn, prevSortType); - - expandSuccess = true; + for (auto it = subDirs.begin(), end = subDirs.end(); it != end; ++it) { + addDir(iter, *it); } + for (auto it = forErase.begin(), end = forErase.end(); it != end; ++it) { + dirTreeModel->erase(*it); + } + + dirTreeModel->set_sort_column(prevSortColumn, prevSortType); + + expandSuccess = true; + Glib::RefPtr monitor = dir->monitor_directory (); iter->set_value (dtColumns.monitor, monitor); monitor->signal_changed().connect (sigc::bind(sigc::mem_fun(*this, &DirBrowser::file_changed), iter, dir->get_parse_name())); @@ -383,8 +379,10 @@ void DirBrowser::row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewC Glib::ustring dname = dirTreeModel->get_iter (path)->get_value (dtColumns.dirname); - if (Glib::file_test (dname, Glib::FILE_TEST_IS_DIR)) + if (Glib::file_test (dname, Glib::FILE_TEST_IS_DIR)) { dirSelectionSignal (dname, Glib::ustring()); + dirtree->expand_row(path, false); + } } Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 3958326e8..cb8839455 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -92,6 +92,9 @@ GTK_PREFIX: ${GTK_PREFIX} PWD: ${PWD} __EOS__ +LOCAL_PREFIX="$(cmake .. -LA -N | grep "LOCAL_PREFIX" | cut -d "=" -f2)" +EXPATLIB="$(cmake .. -LA -N | grep "pkgcfg_lib_EXPAT_expat" | cut -d "=" -f2)" + APP="${PROJECT_NAME}.app" CONTENTS="${APP}/Contents" RESOURCES="${CONTENTS}/Resources" @@ -99,7 +102,7 @@ MACOS="${CONTENTS}/MacOS" LIB="${CONTENTS}/Frameworks" ETC="${RESOURCES}/etc" EXECUTABLE="${MACOS}/rawtherapee" -GDK_PREFIX="/usr/local/opt/gdk-pixbuf" +GDK_PREFIX="${LOCAL_PREFIX}/local/opt/gdk-pixbuf" msg "Removing old files:" rm -rf "${APP}" "${PROJECT_NAME}_*.dmg" "*zip" @@ -141,45 +144,46 @@ rm -r "${LIB}"/gdk-pixbuf-2.0 sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|/Applications/RawTherapee.app/Contents/|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" mkdir -p ${RESOURCES}/share/glib-2.0 -cp -pRL {"/usr/local","${RESOURCES}"}/share/glib-2.0/schemas -"/usr/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" +cp -pRL {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas +"${LOCAL_PREFIX}/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" msg "Copying shared files from ${GTK_PREFIX}:" -cp -pRL {"/usr/local","${RESOURCES}"}/share/mime +cp -pRL {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime # GTK3 themes -ditto {"/usr/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css -ditto {"/usr/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css # Adwaita icons iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices") for f in "${iconfolders[@]}"; do mkdir -p ${RESOURCES}/share/icons/Adwaita/${f} - cp /usr/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} + cp ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} done -ditto {"/usr/local","${RESOURCES}"}/share/icons/Adwaita/index.theme -"/usr/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme +"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" # Copy libjpeg-turbo into the app bundle -cp /usr/local/lib/libjpeg.*.dylib "${CONTENTS}/Frameworks" +cp ${LOCAL_PREFIX}/local/lib/libjpeg.*.dylib "${CONTENTS}/Frameworks" # Copy libexpat into the app bundle (which is keg-only) -cp /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks" + +if [[ -d /usr/local/Cellar/expat ]]; then cp /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks"; else cp "${EXPATLIB}" "${CONTENTS}/Frameworks"; fi # Copy libz into the app bundle cp /usr/lib/libz.1.dylib "${CONTENTS}/Frameworks" # Copy libtiff into the app bundle -cp /usr/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks" +cp ${LOCAL_PREFIX}/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks" # Copy the Lensfun database into the app bundle mkdir -p "${RESOURCES}/share/lensfun" -cp /usr/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +cp ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" # Copy liblensfun to Frameworks -cp /usr/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks" +cp ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks" # Copy libomp to Frameworks -cp /usr/local/lib/libomp.dylib "${CONTENTS}/Frameworks" +cp ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" # Install names find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do