Merge branch 'dev' into newlocallab

This commit is contained in:
Ingo Weyrich 2019-11-04 23:01:33 +01:00
commit 033d9fe02a
395 changed files with 2523 additions and 2740 deletions

View File

@ -89,6 +89,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PROC_FLAGS}")
# Stop compilation on typos such as std:swap (missing colon will be detected as unused label): # Stop compilation on typos such as std:swap (missing colon will be detected as unused label):
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=unused-label") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=unused-label")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=delete-incomplete")
# Special treatment for x87 and x86-32 SSE (see GitHub issue #4324) # Special treatment for x87 and x86-32 SSE (see GitHub issue #4324)
include(FindX87Math) include(FindX87Math)

View File

@ -28,6 +28,7 @@
#include "gauss.h" #include "gauss.h"
#include "median.h" #include "median.h"
#include "StopWatch.h" #include "StopWatch.h"
namespace { namespace {
bool LinEqSolve(int nDim, double* pfMatr, double* pfVect, double* pfSolution) bool LinEqSolve(int nDim, double* pfMatr, double* pfVect, double* pfSolution)
@ -106,10 +107,6 @@ bool LinEqSolve(int nDim, double* pfMatr, double* pfVect, double* pfSolution)
//end of linear equation solver //end of linear equation solver
} }
namespace rtengine {
extern const Settings* settings;
}
using namespace std; using namespace std;
using namespace rtengine; using namespace rtengine;
@ -198,7 +195,7 @@ float* RawImageSource::CA_correct_RT(
//block CA shift values and weight assigned to block //block CA shift values and weight assigned to block
float* const blockwt = buffer + (height * width); float* const blockwt = buffer + (height * width);
memset(blockwt, 0, vblsz * hblsz * (2 * 2 + 1) * sizeof(float)); memset(blockwt, 0, static_cast<unsigned long>(vblsz) * hblsz * (2 * 2 + 1) * sizeof(float));
float (*blockshifts)[2][2] = (float (*)[2][2])(blockwt + vblsz * hblsz); float (*blockshifts)[2][2] = (float (*)[2][2])(blockwt + vblsz * hblsz);
// Because we can't break parallel processing, we need a switch do handle the errors // Because we can't break parallel processing, we need a switch do handle the errors

View File

@ -124,7 +124,6 @@ set(RTENGINESOURCEFILES
rtthumbnail.cc rtthumbnail.cc
shmap.cc shmap.cc
simpleprocess.cc simpleprocess.cc
slicer.cc
stdimagesource.cc stdimagesource.cc
tmo_fattal02.cc tmo_fattal02.cc
utils.cc utils.cc

View File

@ -4,8 +4,7 @@
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
#include "sleef.c" #include "sleef.h"
#include "opthelper.h"
#define DIAGONALS 5 #define DIAGONALS 5
#define DIAGONALSP1 6 #define DIAGONALSP1 6

View File

@ -23,25 +23,34 @@
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
#include <cmath> #include <cmath>
#include <fftw3.h> #include <fftw3.h>
#include "../rtgui/threadutils.h"
#include "rtengine.h"
#include "improcfun.h"
#include "LUT.h"
#include "array2D.h" #include "array2D.h"
#include "iccmatrices.h"
#include "boxblur.h" #include "boxblur.h"
#include "rt_math.h"
#include "mytime.h"
#include "sleef.c"
#include "opthelper.h"
#include "cplx_wavelet_dec.h" #include "cplx_wavelet_dec.h"
#include "median.h" #include "color.h"
#include "curves.h"
#include "iccmatrices.h"
#include "iccstore.h" #include "iccstore.h"
#include "imagefloat.h"
#include "improcfun.h"
#include "labimage.h"
#include "LUT.h"
#include "median.h"
#include "mytime.h"
#include "opthelper.h"
#include "procparams.h" #include "procparams.h"
#include "rt_math.h"
#include "sleef.h"
#include "../rtgui/threadutils.h"
#include "../rtgui/options.h"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
@ -69,11 +78,7 @@ namespace rtengine
*/ */
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
extern const Settings* settings;
extern MyMutex *fftwMutex; extern MyMutex *fftwMutex;

View File

@ -56,21 +56,18 @@
* LUTuc stands for LUT<unsigned char> * LUTuc stands for LUT<unsigned char>
*/ */
#ifndef LUT_H_ #pragma once
#define LUT_H_
#include <cstring> #include <cstring>
#include <cstdint> #include <cstdint>
#include <cassert> #include <cassert>
#ifndef NDEBUG #ifndef NDEBUG
#include <glibmm.h>
#include <fstream> #include <fstream>
#endif #endif
#include "opthelper.h" #include "opthelper.h"
#include "rt_math.h" #include "rt_math.h"
#include "noncopyable.h"
// Bit representations of flags // Bit representations of flags
enum { enum {
@ -485,26 +482,6 @@ public:
return (p1 + p2 * diff); return (p1 + p2 * diff);
} }
#ifndef NDEBUG
// Debug facility ; dump the content of the LUT in a file. No control of the filename is done
void dump(Glib::ustring fname)
{
if (size) {
Glib::ustring fname_ = fname + ".xyz"; // TopSolid'Design "plot" file format
std::ofstream f (fname_.c_str());
f << "$" << std::endl;
for (unsigned int iter = 0; iter < size; iter++) {
f << iter << ", " << data[iter] << ", 0." << std::endl;
}
f << "$" << std::endl;
f.close ();
}
}
#endif
operator bool (void) const operator bool (void) const
{ {
return size > 0; return size > 0;
@ -649,5 +626,3 @@ public:
}; };
#endif /* LUT_H_ */

View File

@ -29,8 +29,12 @@
#include "gauss.h" #include "gauss.h"
#include "improcfun.h" #include "improcfun.h"
#include "sleef.c" #include "cieimage.h"
#include "../rtgui/myflatcurve.h" #include "color.h"
#include "curves.h"
#include "labimage.h"
#include "sleef.h"
#include "curves.h"
#include "rt_math.h" #include "rt_math.h"
#include "opthelper.h" #include "opthelper.h"
#include "median.h" #include "median.h"

View File

@ -27,7 +27,6 @@
#include "rtengine.h" #include "rtengine.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rt_math.h" #include "rt_math.h"
#include "procparams.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
#include "median.h" #include "median.h"
//#define BENCHMARK //#define BENCHMARK

View File

@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _ALIGNEDBUFFER_ #pragma once
#define _ALIGNEDBUFFER_
#include <cstdint> #include <cstdint>
#include <cstdlib> #include <cstdlib>
@ -142,5 +141,3 @@ public:
return unitSize ? allocatedSize / unitSize : 0; return unitSize ? allocatedSize / unitSize : 0;
} }
}; };
#endif

View File

@ -30,10 +30,9 @@
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rt_math.h" #include "rt_math.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
#include "sleef.c" #include "sleef.h"
#include "opthelper.h" #include "opthelper.h"
#include "median.h" #include "median.h"
#include "procparams.h"
#include "StopWatch.h" #include "StopWatch.h"
namespace rtengine namespace rtengine

View File

@ -52,8 +52,8 @@
* *
* !! locked arrays cannot be resized and cannot be unlocked again !! * !! locked arrays cannot be resized and cannot be unlocked again !!
*/ */
#ifndef ARRAY2D_H_ #pragma once
#define ARRAY2D_H_
#include <csignal> // for raise() #include <csignal> // for raise()
#include <cassert> #include <cassert>
@ -249,7 +249,7 @@ public:
ar_realloc(w, h, offset); ar_realloc(w, h, offset);
if (flags & ARRAY2D_CLEAR_DATA) { if (flags & ARRAY2D_CLEAR_DATA) {
memset(data + offset, 0, w * h * sizeof(T)); memset(data + offset, 0, static_cast<unsigned long>(w) * h * sizeof(T));
} }
} }
@ -313,4 +313,3 @@ public:
return list[index]; return list[index];
} }
}; };
#endif /* array2D_H_ */

View File

@ -20,6 +20,7 @@
#include "array2D.h" #include "array2D.h"
#include "median.h" #include "median.h"
#include "pixelsmap.h" #include "pixelsmap.h"
#include "rawimage.h"
#include "rawimagesource.h" #include "rawimagesource.h"
namespace rtengine namespace rtengine

View File

@ -16,22 +16,16 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _BILATERAL2_ #pragma once
#define _BILATERAL2_
#include <algorithm>
#include <cmath> #include <cmath>
#include <cstring>
#include <cstdio> #include <cstdio>
#include <glibmm.h> #include <cstring>
#include "rtengine.h"
#include "rt_math.h"
#include "mytime.h"
#include "array2D.h" #include "array2D.h"
#ifdef _OPENMP #include "LUT.h"
#include <omp.h> #include "rt_math.h"
#endif
using namespace rtengine; using namespace rtengine;
@ -573,7 +567,7 @@ template<class T> void bilateral (T** src, T** dst, int W, int H, int sigmar, do
// calculate histogram at the beginning of the row // calculate histogram at the beginning of the row
rhist.clear(); rhist.clear();
for (int x = MAX(0, row_from - r); x <= MIN(H, row_from + r); x++) for (int x = std::max(0, row_from - r); x <= std::min(H, row_from + r); x++)
for (int y = 0; y < r + 1; y++) { for (int y = 0; y < r + 1; y++) {
rhist[((int)src[x][y]) >> TRANSBIT]++; rhist[((int)src[x][y]) >> TRANSBIT]++;
} }
@ -584,12 +578,12 @@ template<class T> void bilateral (T** src, T** dst, int W, int H, int sigmar, do
// calculate histogram at the beginning of the row // calculate histogram at the beginning of the row
if (i > r) if (i > r)
for (int x = 0; x <= MIN(H, r); x++) { for (int x = 0; x <= std::min(H, r); x++) {
rhist[((int)src[i - r - 1][x]) >> TRANSBIT]--; rhist[((int)src[i - r - 1][x]) >> TRANSBIT]--;
} }
if (i < H - r) if (i < H - r)
for (int x = 0; x <= MIN(H, r); x++) { for (int x = 0; x <= std::min(H, r); x++) {
rhist[((int)src[i + r][x]) >> TRANSBIT]++; rhist[((int)src[i + r][x]) >> TRANSBIT]++;
} }
@ -599,12 +593,12 @@ template<class T> void bilateral (T** src, T** dst, int W, int H, int sigmar, do
// subtract pixels at the left and add pixels at the right // subtract pixels at the left and add pixels at the right
if (j > r) if (j > r)
for (int x = MAX(0, i - r); x <= MIN(i + r, H - 1); x++) { for (int x = std::max(0, i - r); x <= std::min(i + r, H - 1); x++) {
hist[(int)(src[x][j - r - 1]) >> TRANSBIT]--; hist[(int)(src[x][j - r - 1]) >> TRANSBIT]--;
} }
if (j < W - r) if (j < W - r)
for (int x = MAX(0, i - r); x <= MIN(i + r, H - 1); x++) { for (int x = std::max(0, i - r); x <= std::min(i + r, H - 1); x++) {
hist[((int)src[x][j + r]) >> TRANSBIT]++; hist[((int)src[x][j + r]) >> TRANSBIT]++;
} }
@ -643,5 +637,3 @@ template<class T> void bilateral (T** src, T** dst, int W, int H, int sigmar, do
} }
#undef BINBIT #undef BINBIT
#undef TRANSBIT #undef TRANSBIT
#endif

View File

@ -1,4 +1,3 @@
#ifndef CALC_DISTORTION__H #pragma once
#define CALC_DISTORTION__H
int calcDistortion (unsigned char* img1, unsigned char* img2, int ncols, int nrows, int nfactor, double &distortion); int calcDistortion (unsigned char* img1, unsigned char* img2, int ncols, int nrows, int nfactor, double &distortion);
#endif

View File

@ -2,6 +2,9 @@
* This file is part of RawTherapee. * This file is part of RawTherapee.
*/ */
#include "camconst.h" #include "camconst.h"
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include <glibmm/ustring.h>
#include "settings.h" #include "settings.h"
#include "rt_math.h" #include "rt_math.h"
#include <cstdio> #include <cstdio>
@ -17,8 +20,6 @@
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
CameraConst::CameraConst() : pdafOffset(0) CameraConst::CameraConst() : pdafOffset(0)
{ {
memset(dcraw_matrix, 0, sizeof(dcraw_matrix)); memset(dcraw_matrix, 0, sizeof(dcraw_matrix));

View File

@ -1,11 +1,11 @@
/* /*
* This file is part of RawTherapee. * This file is part of RawTherapee.
*/ */
#ifndef __CAMCONST__ #pragma once
#define __CAMCONST__
#include <glibmm.h> #include <glibmm/ustring.h>
#include <map> #include <map>
#include <vector>
namespace rtengine namespace rtengine
{ {
@ -72,5 +72,3 @@ public:
}; };
} }
#endif

View File

@ -20,18 +20,15 @@
#include <iostream> #include <iostream>
#include "rtengine.h" #include "rtengine.h"
#include "rawimage.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rt_math.h" #include "rt_math.h"
#include "improcfun.h"
#include "procparams.h" #include "procparams.h"
#include "color.h" #include "color.h"
#include "gauss.h" #include "gauss.h"
#include "rt_algo.h" #include "rt_algo.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
#ifdef _OPENMP
#include <omp.h>
#endif
#include "opthelper.h" #include "opthelper.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
@ -583,10 +580,10 @@ BENCHFUN
} else { } else {
if (sigmaCornerOffset != 0.0) { if (sigmaCornerOffset != 0.0) {
const float distance = sqrt(rtengine::SQR(i + tileSize / 2 - H / 2) + rtengine::SQR(j + tileSize / 2 - W / 2)); const float distance = sqrt(rtengine::SQR(i + tileSize / 2 - H / 2) + rtengine::SQR(j + tileSize / 2 - W / 2));
const float sigmaTile = sigma + distanceFactor * distance; const float sigmaTile = static_cast<float>(sigma) + distanceFactor * distance;
if (sigmaTile >= 0.4f) { if (sigmaTile >= 0.4f) {
float lkernel7[7][7]; float lkernel7[7][7];
compute7x7kernel(sigma + distanceFactor * distance, lkernel7); compute7x7kernel(static_cast<float>(sigma) + distanceFactor * distance, lkernel7);
for (int k = 0; k < iterations - 1; ++k) { for (int k = 0; k < iterations - 1; ++k) {
// apply 7x7 gaussian blur and divide luminance by result of gaussian blur // apply 7x7 gaussian blur and divide luminance by result of gaussian blur
gauss7x7div(tmpIThr, tmpThr, lumThr, fullTileSize, fullTileSize, lkernel7); gauss7x7div(tmpIThr, tmpThr, lumThr, fullTileSize, fullTileSize, lkernel7);
@ -605,13 +602,13 @@ BENCHFUN
// special handling for small tiles at end of row or column // special handling for small tiles at end of row or column
for (int k = border, ii = endOfCol ? H - fullTileSize - border : i - border; k < fullTileSize - border; ++k) { for (int k = border, ii = endOfCol ? H - fullTileSize - border : i - border; k < fullTileSize - border; ++k) {
for (int l = border, jj = endOfRow ? W - fullTileSize - border : j - border; l < fullTileSize - border; ++l) { for (int l = border, jj = endOfRow ? W - fullTileSize - border : j - border; l < fullTileSize - border; ++l) {
luminance[ii + k][jj + l] = rtengine::intp(blend[ii + k][jj + l], max(tmpIThr[k][l], 0.0f), luminance[ii + k][jj + l]); luminance[ii + k][jj + l] = rtengine::intp(blend[ii + k][jj + l], std::max(tmpIThr[k][l], 0.0f), luminance[ii + k][jj + l]);
} }
} }
} else { } else {
for (int ii = border; ii < fullTileSize - border; ++ii) { for (int ii = border; ii < fullTileSize - border; ++ii) {
for (int jj = border; jj < fullTileSize - border; ++jj) { for (int jj = border; jj < fullTileSize - border; ++jj) {
luminance[i + ii - border][j + jj - border] = rtengine::intp(blend[i + ii - border][j + jj - border], max(tmpIThr[ii][jj], 0.0f), luminance[i + ii - border][j + jj - border]); luminance[i + ii - border][j + jj - border] = rtengine::intp(blend[i + ii - border][j + jj - border], std::max(tmpIThr[ii][jj], 0.0f), luminance[i + ii - border][j + jj - border]);
} }
} }
} }

View File

@ -24,7 +24,6 @@
#include <cmath> #include <cmath>
#include "rtengine.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rt_math.h" #include "rt_math.h"
@ -63,7 +62,7 @@ void RawImageSource::CLASS cfa_linedn(float noise, bool horizontal, bool vertica
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float noisevar = SQR(3 * noise * 65535); // _noise_ (as a fraction of saturation) is input to the algorithm float noisevar = SQR(3 * noise * 65535); // _noise_ (as a fraction of saturation) is input to the algorithm
float noisevarm4 = 4.0f * noisevar; float noisevarm4 = 4.0f * noisevar;
float* RawDataTmp = (float*)malloc( width * height * sizeof(float)); float* RawDataTmp = (float*)malloc(static_cast<unsigned long>(width) * height * sizeof(float));
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel #pragma omp parallel
#endif #endif

View File

@ -17,10 +17,10 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "ciecam02.h" #include "ciecam02.h"
#include "rtengine.h" #include "rt_math.h"
#include "curves.h" #include "curves.h"
#include <math.h> #include <math.h>
#include "sleef.c" #include "sleef.h"
#ifdef _DEBUG #ifdef _DEBUG
#include "settings.h" #include "settings.h"
@ -34,10 +34,6 @@
namespace rtengine namespace rtengine
{ {
#ifdef _DEBUG
extern const Settings* settings;
#endif
void Ciecam02::curvecolorfloat (float satind, float satval, float &sres, float parsat) void Ciecam02::curvecolorfloat (float satind, float satval, float &sres, float parsat)
{ {
if (satind > 0.f) { if (satind > 0.f) {

View File

@ -16,12 +16,19 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _CIECAM02_ #pragma once
#define _CIECAM02_
#include <cmath> #include <cmath>
#include "LUT.h" #include <cstdint>
#include "opthelper.h" #include "opthelper.h"
template<typename T>
class LUT;
using LUTu = LUT<uint32_t>;
using LUTf = LUT<float>;
namespace rtengine namespace rtengine
{ {
@ -106,4 +113,3 @@ public:
}; };
} }
#endif

View File

@ -1,5 +1,7 @@
#include "cieimage.h" #include "cieimage.h"
#include <memory.h>
#include <new>
#include <cstring>
namespace rtengine namespace rtengine
{ {
@ -10,7 +12,6 @@ CieImage::CieImage (int w, int h) : fromImage(false), W(w), H(h)
M_p = new float*[H]; M_p = new float*[H];
C_p = new float*[H]; C_p = new float*[H];
sh_p = new float*[H]; sh_p = new float*[H];
// ch_p = new float*[H];
h_p = new float*[H]; h_p = new float*[H];
// Initialize the pointers to zero // Initialize the pointers to zero
@ -98,9 +99,6 @@ CieImage::CieImage (int w, int h) : fromImage(false), W(w), H(h)
++c; ++c;
// for (int i=0; i<H; i++)
// ch_p[i] = data[c] + i*W;
// ++c;
for (int i = 0; i < H; i++) { for (int i = 0; i < H; i++) {
h_p[i] = data[c] + i * W; h_p[i] = data[c] + i * W;
} }

View File

@ -16,10 +16,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _CIEIMAGE_H_ #pragma once
#define _CIEIMAGE_H_
#include "image16.h"
#include "noncopyable.h" #include "noncopyable.h"
namespace rtengine namespace rtengine
@ -39,7 +37,6 @@ public:
float** M_p; float** M_p;
float** C_p; float** C_p;
float** sh_p; float** sh_p;
// float** ch_p;
float** h_p; float** h_p;
CieImage (int w, int h); CieImage (int w, int h);
@ -50,4 +47,3 @@ public:
}; };
} }
#endif

View File

@ -1,7 +1,11 @@
#include <algorithm> #include <algorithm>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include "clutstore.h" #include "clutstore.h"
#include "colortemp.h"
#include "iccstore.h" #include "iccstore.h"
#include "imagefloat.h" #include "imagefloat.h"
#include "opthelper.h" #include "opthelper.h"

View File

@ -3,8 +3,6 @@
#include <memory> #include <memory>
#include <cstdint> #include <cstdint>
#include <gtkmm.h>
#include "cache.h" #include "cache.h"
#include "alignedbuffer.h" #include "alignedbuffer.h"
#include "noncopyable.h" #include "noncopyable.h"

View File

@ -20,18 +20,19 @@
#include "rtengine.h" #include "rtengine.h"
#include "color.h" #include "color.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "mytime.h" #include "sleef.h"
#include "sleef.c"
#include "opthelper.h" #include "opthelper.h"
#include "iccstore.h" #include "iccstore.h"
#ifdef _DEBUG
#include "mytime.h"
#endif
using namespace std; using namespace std;
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
cmsToneCurve* Color::linearGammaTRC; cmsToneCurve* Color::linearGammaTRC;
LUTf Color::cachef; LUTf Color::cachef;
LUTf Color::cachefy; LUTf Color::cachefy;

View File

@ -20,14 +20,13 @@
#pragma once #pragma once
#include <array> #include <array>
#include <glibmm.h> #include <glibmm/ustring.h>
#include "rt_math.h" #include "rt_math.h"
#include "LUT.h" #include "LUT.h"
#include "labimage.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "lcms2.h" #include "lcms2.h"
#include "sleef.c" #include "sleef.h"
#define SAT(a,b,c) ((float)max(a,b,c)-(float)min(a,b,c))/(float)max(a,b,c) #define SAT(a,b,c) ((float)max(a,b,c)-(float)min(a,b,c))/(float)max(a,b,c)

View File

@ -16,19 +16,21 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <glibmm/ustring.h>
#include "colortemp.h" #include "colortemp.h"
#include "rtengine.h" #include "iccmatrices.h"
#include "rt_math.h"
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "sleef.c" #include "sleef.h"
#include "settings.h" #include "settings.h"
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desmis 2° Standard Observer. static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desmis 2° Standard Observer.
{0.0000000, 0.000000, 0.000000}, {0.0000000, 0.000000, 0.000000}, {0.0001299, 0.0003917, 0.0006061}, {0.0000000, 0.000000, 0.000000}, {0.0000000, 0.000000, 0.000000}, {0.0001299, 0.0003917, 0.0006061},
{0.0002321, 0.000006965, 0.001086}, {0.0004149, 0.00001239, 0.001946}, {0.0007416, 0.00002202, 0.003846}, {0.0002321, 0.000006965, 0.001086}, {0.0004149, 0.00001239, 0.001946}, {0.0007416, 0.00002202, 0.003846},

View File

@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _COLORTEMP_ #pragma once
#define _COLORTEMP_
#include <cmath> #include <cmath>
#include <map> #include <map>
@ -207,4 +206,3 @@ public:
}; };
} }
#endif

View File

@ -17,8 +17,7 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef __COORD__ #pragma once
#define __COORD__
namespace rtengine namespace rtengine
{ {
@ -253,5 +252,3 @@ inline const PolarCoord operator* (const double lhs, const PolarCoord& rhs)
} }
} }
#endif

View File

@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef __COORD2D__ #pragma once
#define __COORD2D__
namespace rtengine namespace rtengine
{ {
@ -35,5 +34,5 @@ public:
y = y_; y = y_;
} }
}; };
} }
#endif

View File

@ -17,9 +17,7 @@
* 2010 Ilya Popov <ilia_popov@rambler.ru> * 2010 Ilya Popov <ilia_popov@rambler.ru>
* 2012 Emil Martinec <ejmartin@uchicago.edu> * 2012 Emil Martinec <ejmartin@uchicago.edu>
*/ */
#pragma once
#ifndef CPLX_WAVELET_DEC_H_INCLUDED
#define CPLX_WAVELET_DEC_H_INCLUDED
#include <cstddef> #include <cstddef>
#include <cmath> #include <cmath>
@ -266,5 +264,3 @@ void wavelet_decomposition::reconstruct(E * dst, const float blend)
} }
} }
#endif

View File

@ -17,7 +17,7 @@
* 2012 Emil Martinec <ejmartin@uchicago.edu> * 2012 Emil Martinec <ejmartin@uchicago.edu>
* 2014 Jacques Desmis <jdesmis@gmail.com> * 2014 Jacques Desmis <jdesmis@gmail.com>
*/ */
#pragma once
namespace rtengine namespace rtengine
{ {

View File

@ -17,10 +17,8 @@
* 2010 Ilya Popov <ilia_popov@rambler.ru> * 2010 Ilya Popov <ilia_popov@rambler.ru>
* 2012 Emil Martinec <ejmartin@uchicago.edu> * 2012 Emil Martinec <ejmartin@uchicago.edu>
* 2014 Ingo Weyrich <heckflosse@i-weyrich.de> * 2014 Ingo Weyrich <heckflosse@i-weyrich.de>
*/ */
#pragma once
#ifndef CPLX_WAVELET_LEVEL_H_INCLUDED
#define CPLX_WAVELET_LEVEL_H_INCLUDED
#include <cstddef> #include <cstddef>
#include "rt_math.h" #include "rt_math.h"
@ -759,5 +757,3 @@ template<typename T> template<typename E> void wavelet_level<T>::reconstruct_lev
} }
#endif #endif
} }
#endif

View File

@ -23,9 +23,6 @@
#include <cstring> #include <cstring>
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "rt_math.h" #include "rt_math.h"
@ -792,16 +789,16 @@ void CurveFactory::complexsgnCurve(bool & autili, bool & butili, bool & ccutili
} }
void CurveFactory::complexCurve(double ecomp, double black, double hlcompr, double hlcomprthresh, void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh,
double shcompr, double br, double contr, double shcompr, double br, double contr,
const std::vector<double>& curvePoints, const std::vector<double>& curvePoints,
const std::vector<double>& curvePoints2, const std::vector<double>& curvePoints2,
LUTu & histogram, const LUTu & histogram,
LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve,
LUTu & outBeforeCCurveHistogram, LUTu & outBeforeCCurveHistogram,
ToneCurve & customToneCurve1, ToneCurve & customToneCurve1,
ToneCurve & customToneCurve2, ToneCurve & customToneCurve2,
int skip) int skip)
{ {
// the curve shapes are defined in sRGB gamma, but the output curves will operate on linear floating point data, // the curve shapes are defined in sRGB gamma, but the output curves will operate on linear floating point data,

View File

@ -16,24 +16,21 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef __CURVES_H__ #pragma once
#define __CURVES_H__
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <glibmm.h> #include <glibmm/ustring.h>
#include "rt_math.h" #include "rt_math.h"
#include "../rtgui/mycurve.h" #include "flatcurvetypes.h"
#include "../rtgui/myflatcurve.h" #include "diagonalcurvetypes.h"
#include "../rtgui/mydiagonalcurve.h"
#include "color.h"
#include "pipettebuffer.h" #include "pipettebuffer.h"
#include "LUT.h" #include "LUT.h"
#include "sleef.h"
#define CURVES_MIN_POLY_POINTS 1000 #define CURVES_MIN_POLY_POINTS 1000
#include "rt_math.h" #include "rt_math.h"
@ -356,8 +353,7 @@ public:
public: public:
static void complexCurve(double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, static void complexCurve(double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr,
const std::vector<double>& curvePoints, const std::vector<double>& curvePoints2, const std::vector<double>& curvePoints, const std::vector<double>& curvePoints2,
LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, const LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2,
int skip = 1); int skip = 1);
static void complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double cont, double lumare, static void complexCurvelocal(double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double cont, double lumare,
@ -678,7 +674,6 @@ public:
} }
}; };
class LocCCmaskblCurve class LocCCmaskblCurve
{ {
private: private:
@ -1700,12 +1695,6 @@ public:
float *r, float *g, float *b) const; float *r, float *g, float *b) const;
}; };
class SatAndValueBlendingToneCurve : public ToneCurve
{
public:
void Apply(float& r, float& g, float& b) const;
};
class WeightedStdToneCurve : public ToneCurve class WeightedStdToneCurve : public ToneCurve
{ {
private: private:
@ -2085,47 +2074,6 @@ inline void WeightedStdToneCurve::BatchApply(const size_t start, const size_t en
#endif #endif
} }
// Tone curve modifying the value channel only, preserving hue and saturation
// values in 0xffff space
inline void SatAndValueBlendingToneCurve::Apply(float& ir, float& ig, float& ib) const
{
assert(lutToneCurve);
float r = CLIP(ir);
float g = CLIP(ig);
float b = CLIP(ib);
const float lum = (r + g + b) / 3.f;
const float newLum = lutToneCurve[lum];
if (newLum == lum) {
return;
}
float h, s, v;
Color::rgb2hsvtc(r, g, b, h, s, v);
float dV;
if (newLum > lum) {
// Linearly targeting Value = 1 and Saturation = 0
const float coef = (newLum - lum) / (65535.f - lum);
dV = (1.f - v) * coef;
s *= 1.f - coef;
} else {
// Linearly targeting Value = 0
const float coef = (newLum - lum) / lum ;
dV = v * coef;
}
Color::hsv2rgbdcp(h, s, v + dV, r, g, b);
setUnlessOOG(ir, ig, ib, r, g, b);
}
} }
#undef CLIPI #undef CLIPI
#endif

View File

@ -21,22 +21,22 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <functional> #include <functional>
#include <glib/gstdio.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include "dcp.h" #include "dcp.h"
#include "cJSON.h" #include "cJSON.h"
#include "color.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "iccstore.h" #include "iccstore.h"
#include "improcfun.h" #include "imagefloat.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rt_math.h" #include "rt_math.h"
#include "utils.h"
namespace rtengine #include "../rtexif/rtexif.h"
{ #include "../rtgui/options.h"
extern const Settings* settings;
}
using namespace rtengine; using namespace rtengine;
using namespace rtexif; using namespace rtexif;
@ -432,7 +432,7 @@ std::map<std::string, std::string> getAliases(const Glib::ustring& profile_dir)
} }
struct DCPProfile::ApplyState::Data { struct DCPProfileApplyState::Data {
float pro_photo[3][3]; float pro_photo[3][3];
float work[3][3]; float work[3][3];
bool already_pro_photo; bool already_pro_photo;
@ -441,14 +441,12 @@ struct DCPProfile::ApplyState::Data {
float bl_scale; float bl_scale;
}; };
DCPProfile::ApplyState::ApplyState() : DCPProfileApplyState::DCPProfileApplyState() :
data(new Data{}) data(new Data{})
{ {
} }
DCPProfile::ApplyState::~ApplyState() DCPProfileApplyState::~DCPProfileApplyState() = default;
{
}
DCPProfile::DCPProfile(const Glib::ustring& filename) : DCPProfile::DCPProfile(const Glib::ustring& filename) :
has_color_matrix_1(false), has_color_matrix_1(false),
@ -1148,7 +1146,7 @@ void DCPProfile::apply(
} }
} }
void DCPProfile::setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, ApplyState& as_out) void DCPProfile::setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, DCPProfileApplyState& as_out)
{ {
as_out.data->use_tone_curve = use_tone_curve; as_out.data->use_tone_curve = use_tone_curve;
as_out.data->apply_look_table = apply_look_table; as_out.data->apply_look_table = apply_look_table;
@ -1192,7 +1190,7 @@ void DCPProfile::setStep2ApplyState(const Glib::ustring& working_space, bool use
} }
} }
void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int height, int tile_width, const ApplyState& as_in) const void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int height, int tile_width, const DCPProfileApplyState& as_in) const
{ {
#define FCLIP(a) ((a)>0.0?((a)<65535.5?(a):65535.5):0.0) #define FCLIP(a) ((a)>0.0?((a)<65535.5?(a):65535.5):0.0)
@ -1868,7 +1866,7 @@ DCPProfile* DCPStore::getProfile(const Glib::ustring& filename) const
if (res->isValid()) { if (res->isValid()) {
// Add profile // Add profile
profile_cache[key] = res; profile_cache[key] = res;
if (options.rtSettings.verbose) { if (settings->verbose) {
printf("DCP profile '%s' loaded from disk\n", filename.c_str()); printf("DCP profile '%s' loaded from disk\n", filename.c_str());
} }
return res; return res;

View File

@ -24,35 +24,23 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <glibmm.h> #include <glibmm/ustring.h>
#include "../rtgui/threadutils.h" #include "../rtgui/threadutils.h"
#include "imagefloat.h"
#include "curves.h" #include "curves.h"
#include "colortemp.h"
#include "noncopyable.h" #include "noncopyable.h"
namespace rtengine namespace rtengine
{ {
class ColorTemp;
class Imagefloat;
class DCPProfileApplyState;
class DCPProfile final class DCPProfile final
{ {
public: public:
class ApplyState final
{
public:
ApplyState();
~ApplyState();
private:
struct Data;
const std::unique_ptr<Data> data;
friend class DCPProfile;
};
struct Illuminants { struct Illuminants {
short light_source_1; short light_source_1;
short light_source_2; short light_source_2;
@ -86,8 +74,8 @@ public:
const Matrix& cam_wb_matrix, const Matrix& cam_wb_matrix,
bool apply_hue_sat_map = true bool apply_hue_sat_map = true
) const; ) const;
void setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, ApplyState& as_out); void setStep2ApplyState(const Glib::ustring& working_space, bool use_tone_curve, bool apply_look_table, bool apply_baseline_exposure, DCPProfileApplyState& as_out);
void step2ApplyTile(float* r, float* g, float* b, int width, int height, int tile_width, const ApplyState& as_in) const; void step2ApplyTile(float* r, float* g, float* b, int width, int height, int tile_width, const DCPProfileApplyState& as_in) const;
private: private:
struct HsbModify { struct HsbModify {
@ -148,6 +136,20 @@ private:
AdobeToneCurve tone_curve; AdobeToneCurve tone_curve;
}; };
class DCPProfileApplyState final
{
public:
DCPProfileApplyState();
~DCPProfileApplyState();
private:
struct Data;
const std::unique_ptr<Data> data;
friend class DCPProfile;
};
class DCPStore final : class DCPStore final :
public NonCopyable public NonCopyable
{ {

View File

@ -26,12 +26,13 @@
/*RT*/#include <omp.h> /*RT*/#include <omp.h>
/*RT*/#endif /*RT*/#endif
#include <memory>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "opthelper.h" #include "opthelper.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
#include "utils.h"
#include <zlib.h> #include <zlib.h>
#include <stdint.h> #include <stdint.h>

View File

@ -17,8 +17,7 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef DCRAW_H #pragma once
#define DCRAW_H
#include "myfile.h" #include "myfile.h"
#include <csetjmp> #include <csetjmp>
@ -529,6 +528,3 @@ void shiftXtransMatrix( const int offsy, const int offsx) {
void nikon_14bit_load_raw(); // ported from LibRaw void nikon_14bit_load_raw(); // ported from LibRaw
}; };
#endif //DCRAW_H

View File

@ -17,20 +17,18 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "cieimage.h"
#include "curves.h" #include "curves.h"
#include "dcp.h"
#include "dcrop.h" #include "dcrop.h"
#include "image8.h"
#include "imagefloat.h"
#include "labimage.h"
#include "mytime.h" #include "mytime.h"
#include "procparams.h" #include "procparams.h"
#include "refreshmap.h" #include "refreshmap.h"
#include "rt_math.h" #include "rt_math.h"
#include <iostream>
#include <fstream>
#include <string>
#include <unistd.h>
//#include <chrono>
// "ceil" rounding
//#define SKIPS(a,b) ((a) / (b) + ((a) % (b) > 0))
#include "../rtgui/editcallbacks.h" #include "../rtgui/editcallbacks.h"
#pragma GCC diagnostic warning "-Wall" #pragma GCC diagnostic warning "-Wall"
@ -50,8 +48,6 @@ constexpr T skips(T a, T b)
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow)
: PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), reservCrop(nullptr), : PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), reservCrop(nullptr),
cropImg(nullptr), shbuf_real(nullptr), transCrop(nullptr), cieCrop(nullptr), shbuffer(nullptr), cropImg(nullptr), shbuf_real(nullptr), transCrop(nullptr), cieCrop(nullptr), shbuffer(nullptr),
@ -834,7 +830,7 @@ void Crop::update(int todo)
} }
} }
double rrm, ggm, bbm; double rrm, ggm, bbm;
DCPProfile::ApplyState as; DCPProfileApplyState as;
DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as); DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as);
LUTu histToneCurve; LUTu histToneCurve;
@ -1152,7 +1148,7 @@ void Crop::update(int todo)
loclmasCurvecolwav.Reset(); loclmasCurvecolwav.Reset();
if (skip <= 2) { if (skip <= 2) {
usleep(settings->cropsleep); //wait to avoid crash when crop 100% and move window Glib::usleep(settings->cropsleep); //wait to avoid crash when crop 100% and move window
} }
} }
} }

View File

@ -21,8 +21,6 @@
#include "improccoordinator.h" #include "improccoordinator.h"
#include "rtengine.h" #include "rtengine.h"
#include "improcfun.h" #include "improcfun.h"
#include "image8.h"
#include "image16.h"
#include "imagesource.h" #include "imagesource.h"
#include "procevents.h" #include "procevents.h"
#include "pipettebuffer.h" #include "pipettebuffer.h"
@ -31,6 +29,8 @@
namespace rtengine namespace rtengine
{ {
class Image8;
using namespace procparams; using namespace procparams;
class ImProcCoordinator; class ImProcCoordinator;

View File

@ -22,12 +22,10 @@
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rawimage.h" #include "rawimage.h"
#include "mytime.h" #include "mytime.h"
#include "image8.h"
#include "rt_math.h" #include "rt_math.h"
#include "color.h" #include "color.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
#include "procparams.h" #include "sleef.h"
#include "sleef.c"
#include "opthelper.h" #include "opthelper.h"
#include "median.h" #include "median.h"
//#define BENCHMARK //#define BENCHMARK
@ -41,8 +39,6 @@ using namespace std;
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
#undef ABS #undef ABS
#define ABS(a) ((a)<0?-(a):(a)) #define ABS(a) ((a)<0?-(a):(a))
@ -78,7 +74,7 @@ void RawImageSource::ppg_demosaic()
plistener->setProgress (0.0); plistener->setProgress (0.0);
} }
image = (float (*)[4]) calloc (H * W, sizeof * image); image = (float (*)[4]) calloc (static_cast<size_t>(H) * W, sizeof * image);
for (int ii = 0; ii < H; ii++) for (int ii = 0; ii < H; ii++)
for (int jj = 0; jj < W; jj++) { for (int jj = 0; jj < W; jj++) {
@ -376,9 +372,9 @@ void RawImageSource::jdl_interpolate_omp() // from "Lassus"
int row, col, c, d, i, u = width, v = 2 * u, w = 3 * u, x = 4 * u, y = 5 * u, z = 6 * u, indx, (*dif)[2], (*chr)[2]; int row, col, c, d, i, u = width, v = 2 * u, w = 3 * u, x = 4 * u, y = 5 * u, z = 6 * u, indx, (*dif)[2], (*chr)[2];
float f[4], g[4]; float f[4], g[4];
float (*image)[4]; float (*image)[4];
image = (float (*)[4]) calloc (width * height, sizeof * image); image = (float (*)[4]) calloc (static_cast<size_t>(width) * height, sizeof * image);
dif = (int (*)[2]) calloc(width * height, sizeof * dif); dif = (int (*)[2]) calloc(static_cast<size_t>(width) * height, sizeof * dif);
chr = (int (*)[2]) calloc(width * height, sizeof * chr); chr = (int (*)[2]) calloc(static_cast<size_t>(width) * height, sizeof * chr);
if (plistener) { if (plistener) {
// this function seems to be unused // this function seems to be unused
@ -543,14 +539,14 @@ void RawImageSource::lmmse_interpolate_omp(int winw, int winh, array2D<float> &r
float *rix[5]; float *rix[5];
float *qix[5]; float *qix[5];
float *buffer = (float *)calloc(rr1 * cc1 * 5 * sizeof(float), 1); float *buffer = (float *)calloc(static_cast<size_t>(rr1) * cc1 * 5 * sizeof(float), 1);
if(buffer == nullptr) { // allocation of big block of memory failed, try to get 5 smaller ones if(buffer == nullptr) { // allocation of big block of memory failed, try to get 5 smaller ones
printf("lmmse_interpolate_omp: allocation of big memory block failed, try to get 5 smaller ones now...\n"); printf("lmmse_interpolate_omp: allocation of big memory block failed, try to get 5 smaller ones now...\n");
bool allocationFailed = false; bool allocationFailed = false;
for(int i = 0; i < 5; i++) { for(int i = 0; i < 5; i++) {
qix[i] = (float *)calloc(rr1 * cc1 * sizeof(float), 1); qix[i] = (float *)calloc(static_cast<size_t>(rr1) * cc1 * sizeof(float), 1);
if(!qix[i]) { // allocation of at least one small block failed if(!qix[i]) { // allocation of at least one small block failed
allocationFailed = true; allocationFailed = true;
@ -1145,7 +1141,7 @@ void RawImageSource::igv_interpolate(int winw, int winh)
vdif = (float (*)) calloc( width * height / 2, sizeof * vdif ); vdif = (float (*)) calloc( width * height / 2, sizeof * vdif );
hdif = (float (*)) calloc( width * height / 2, sizeof * hdif ); hdif = (float (*)) calloc( width * height / 2, sizeof * hdif );
chrarray = (float (*)) calloc( width * height, sizeof( float ) ); chrarray = (float (*)) calloc(static_cast<size_t>(width) * height, sizeof( float ) );
chr[0] = chrarray; chr[0] = chrarray;
chr[1] = chrarray + (width * height) / 2; chr[1] = chrarray + (width * height) / 2;
@ -2040,7 +2036,7 @@ void RawImageSource::refinement_lassus(int PassCount)
t1e.set(); t1e.set();
int u = W, v = 2 * u, w = 3 * u, x = 4 * u, y = 5 * u; int u = W, v = 2 * u, w = 3 * u, x = 4 * u, y = 5 * u;
float (*image)[3]; float (*image)[3];
image = (float(*)[3]) calloc(W * H, sizeof * image); image = (float(*)[3]) calloc(static_cast<size_t>(W) * H, sizeof * image);
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel shared(image) #pragma omp parallel shared(image)
#endif #endif

View File

@ -16,23 +16,27 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "dfmanager.h"
#include "../rtgui/options.h"
#include <giomm.h>
#include "../rtgui/guiutils.h"
#include "rawimage.h"
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <cstdio> #include <cstdio>
#include "imagedata.h" #include <giomm.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include "dfmanager.h"
#include "../rtgui/options.h"
#include "rawimage.h"
#include "imagedata.h"
#include "utils.h"
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
// *********************** class dfInfo ************************************** // *********************** class dfInfo **************************************
dfInfo::~dfInfo()
{
delete ri;
}
inline dfInfo& dfInfo::operator =(const dfInfo &o) inline dfInfo& dfInfo::operator =(const dfInfo &o)
{ {

View File

@ -19,17 +19,18 @@
#pragma once #pragma once
#include <cmath> #include <cmath>
#include <list>
#include <map> #include <map>
#include <string> #include <string>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include "pixelsmap.h" #include "pixelsmap.h"
#include "rawimage.h"
namespace rtengine namespace rtengine
{ {
class RawImage;
class dfInfo class dfInfo
{ {
public: public:
@ -48,13 +49,7 @@ public:
dfInfo( const dfInfo &o) dfInfo( const dfInfo &o)
: pathname(o.pathname), maker(o.maker), model(o.model), iso(o.iso), shutter(o.shutter), timestamp(o.timestamp), ri(nullptr) {} : pathname(o.pathname), maker(o.maker), model(o.model), iso(o.iso), shutter(o.shutter), timestamp(o.timestamp), ri(nullptr) {}
~dfInfo() ~dfInfo();
{
if( ri ) {
delete ri;
}
}
dfInfo &operator =(const dfInfo &o); dfInfo &operator =(const dfInfo &o);
bool operator <(const dfInfo &e2) const; bool operator <(const dfInfo &e2) const;

View File

@ -0,0 +1,31 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2019 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
// For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget
enum DiagonalCurveType {
DCT_Empty = -1, // Also used for identity curves
DCT_Linear, // 0
DCT_Spline, // 1
DCT_Parametric, // 2
DCT_NURBS, // 3
DCT_CatumullRom, // 4
// Insert new curve type above this line
DCT_Unchanged // Must remain the last of the enum
};

View File

@ -18,13 +18,20 @@
* *
*/ */
#include <cstddef> #include <algorithm>
#include <cmath> #include <cmath>
#include "improcfun.h" #include <cstddef>
#include "array2D.h" #include "array2D.h"
#include "rt_math.h" #include "cieimage.h"
#include "color.h"
#include "curves.h"
#include "improcfun.h"
#include "LUT.h"
#include "opthelper.h" #include "opthelper.h"
#include "boxblur.h" #include "boxblur.h"
#include "rt_math.h"
#include "settings.h"
namespace { namespace {
@ -73,8 +80,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w
float val = 0.f; float val = 0.f;
float norm = 0.f; float norm = 0.f;
for (int inbr = max(0, i - scalewin); inbr <= min(height - 1, i + scalewin); inbr += scale) { for (int inbr = std::max(0, i - scalewin); inbr <= std::min(height - 1, i + scalewin); inbr += scale) {
for (int jnbr = max(0, j - scalewin); jnbr <= j + scalewin; jnbr += scale) { for (int jnbr = std::max(0, j - scalewin); jnbr <= j + scalewin; jnbr += scale) {
const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j]));
val += dirwt * data_fine[inbr][jnbr]; val += dirwt * data_fine[inbr][jnbr];
norm += dirwt; norm += dirwt;
@ -107,7 +114,7 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w
float val = 0.f; float val = 0.f;
float norm = 0.f; float norm = 0.f;
for (int inbr = max(0, i - scalewin); inbr <= min(height - 1, i + scalewin); inbr += scale) { for (int inbr = std::max(0, i - scalewin); inbr <= std::min(height - 1, i + scalewin); inbr += scale) {
for (int jnbr = j - scalewin; jnbr <= j + scalewin; jnbr += scale) { for (int jnbr = j - scalewin; jnbr <= j + scalewin; jnbr += scale) {
const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j]));
val += dirwt * data_fine[inbr][jnbr]; val += dirwt * data_fine[inbr][jnbr];
@ -121,8 +128,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w
float val = 0.f; float val = 0.f;
float norm = 0.f; float norm = 0.f;
for (int inbr = max(0, i - scalewin); inbr <= min(height - 1, i + scalewin); inbr += scale) { for (int inbr = std::max(0, i - scalewin); inbr <= std::min(height - 1, i + scalewin); inbr += scale) {
for (int jnbr = j - scalewin; jnbr <= min(width - 1, j + scalewin); jnbr += scale) { for (int jnbr = j - scalewin; jnbr <= std::min(width - 1, j + scalewin); jnbr += scale) {
const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); const float dirwt = domker[(inbr - i) / scale + halfwin][(jnbr - j)/ scale + halfwin] * rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j]));
val += dirwt * data_fine[inbr][jnbr]; val += dirwt * data_fine[inbr][jnbr];
norm += dirwt; norm += dirwt;
@ -151,8 +158,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w
float val = 0.f; float val = 0.f;
float norm = 0.f; float norm = 0.f;
for (int inbr = max(0, i - scale); inbr <= min(height - 1, i + scale); inbr += scale) { for (int inbr = std::max(0, i - scale); inbr <= std::min(height - 1, i + scale); inbr += scale) {
for (int jnbr = max(0, j - scale); jnbr <= j + scale; jnbr += scale) { for (int jnbr = std::max(0, j - scale); jnbr <= j + scale; jnbr += scale) {
const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j]));
val += dirwt * data_fine[inbr][jnbr]; val += dirwt * data_fine[inbr][jnbr];
norm += dirwt; norm += dirwt;
@ -184,7 +191,7 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w
float val = 0.f; float val = 0.f;
float norm = 0.f; float norm = 0.f;
for (int inbr = max(0, i - scale); inbr <= min(height - 1, i + scale); inbr += scale) { for (int inbr = std::max(0, i - scale); inbr <= std::min(height - 1, i + scale); inbr += scale) {
for (int jnbr = j - scale; jnbr <= j + scale; jnbr += scale) { for (int jnbr = j - scale; jnbr <= j + scale; jnbr += scale) {
const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j]));
val += dirwt * data_fine[inbr][jnbr]; val += dirwt * data_fine[inbr][jnbr];
@ -198,8 +205,8 @@ void dirpyr_channel(const float * const * data_fine, float ** data_coarse, int w
float val = 0.f; float val = 0.f;
float norm = 0.f; float norm = 0.f;
for (int inbr = max(0, i - scale); inbr <= min(height - 1, i + scale); inbr += scale) { for (int inbr = std::max(0, i - scale); inbr <= std::min(height - 1, i + scale); inbr += scale) {
for (int jnbr = j - scale; jnbr <= min(width - 1, j + scale); jnbr += scale) { for (int jnbr = j - scale; jnbr <= std::min(width - 1, j + scale); jnbr += scale) {
const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j])); const float dirwt = rangeFn(fabsf(data_fine[inbr][jnbr] - data_fine[i][j]));
val += dirwt * data_fine[inbr][jnbr]; val += dirwt * data_fine[inbr][jnbr];
norm += dirwt; norm += dirwt;
@ -390,8 +397,6 @@ void idirpyr_eq_channelcam(const float * const * data_coarse, const float * cons
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
void ImProcFunctions::dirpyr_equalizer(const float * const * src, float ** dst, int srcwidth, int srcheight, const float * const * l_a, const float * const * l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scaleprev) void ImProcFunctions::dirpyr_equalizer(const float * const * src, float ** dst, int srcwidth, int srcheight, const float * const * l_a, const float * const * l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scaleprev)
{ {
//sequence of scales //sequence of scales

View File

@ -23,36 +23,40 @@
// //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
#include "color.h"
#include "jaggedarray.h" #include "jaggedarray.h"
#include "rtengine.h"
#include "rawimagesource.h"
#include "rt_math.h"
#include "procparams.h" #include "procparams.h"
#include "rawimagesource.h"
#include "rt_algo.h"
#include "rt_math.h"
#include "rtengine.h"
#include "../rtgui/options.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
#include "rt_algo.h"
using namespace std; using namespace std;
namespace rtengine namespace rtengine
{ {
void RawImageSource::dual_demosaic_RT(bool isBayer, const RAWParams &raw, int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, double &contrast, bool autoContrast) void RawImageSource::dual_demosaic_RT(bool isBayer, const procparams::RAWParams &raw, int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, double &contrast, bool autoContrast)
{ {
BENCHFUN BENCHFUN
if (contrast == 0.f && !autoContrast) { if (contrast == 0.f && !autoContrast) {
// contrast == 0.0 means only first demosaicer will be used // contrast == 0.0 means only first demosaicer will be used
if(isBayer) { if(isBayer) {
if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4) ) { if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4) ) {
amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure); amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCBVNG4) ) { } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBVNG4) ) {
dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance); dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::RCDVNG4) ) { } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::RCDVNG4) ) {
rcd_demosaic(options.chunkSizeRCD, options.measure); rcd_demosaic(options.chunkSizeRCD, options.measure);
} }
} else { } else {
if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FOUR_PASS) ) { if (raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::FOUR_PASS) ) {
xtrans_interpolate (3, true, options.chunkSizeXT, options.measure); xtrans_interpolate (3, true, options.chunkSizeXT, options.measure);
} else { } else {
xtrans_interpolate (1, false, options.chunkSizeXT, options.measure); xtrans_interpolate (1, false, options.chunkSizeXT, options.measure);
@ -70,15 +74,15 @@ void RawImageSource::dual_demosaic_RT(bool isBayer, const RAWParams &raw, int wi
if (isBayer) { if (isBayer) {
vng4_demosaic(rawData, redTmp, greenTmp, blueTmp); vng4_demosaic(rawData, redTmp, greenTmp, blueTmp);
if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZEVNG4) || raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT)) { if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4) || raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) {
amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure); amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCBVNG4) ) { } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBVNG4) ) {
dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance); dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::RCDVNG4) ) { } else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::RCDVNG4) ) {
rcd_demosaic(options.chunkSizeRCD, options.measure); rcd_demosaic(options.chunkSizeRCD, options.measure);
} }
} else { } else {
if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FOUR_PASS) ) { if (raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::FOUR_PASS) ) {
xtrans_interpolate (3, true, options.chunkSizeXT, options.measure); xtrans_interpolate (3, true, options.chunkSizeXT, options.measure);
} else { } else {
xtrans_interpolate (1, false, options.chunkSizeXT, options.measure); xtrans_interpolate (1, false, options.chunkSizeXT, options.measure);

View File

@ -17,10 +17,15 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "../rtengine/dynamicprofile.h" #include "dynamicprofile.h"
#include <stdlib.h> #include <stdlib.h>
#include <glibmm/regex.h> #include <glibmm/regex.h>
#include <glibmm/miscutils.h>
#include <glibmm/keyfile.h>
#include "rtengine.h"
#include "../rtgui/options.h"
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
@ -176,7 +181,7 @@ bool DynamicProfileRules::loadRules()
return false; return false;
} }
if (options.rtSettings.verbose) { if (settings->verbose) {
printf ("loading dynamic profiles...\n"); printf ("loading dynamic profiles...\n");
} }
@ -195,7 +200,7 @@ bool DynamicProfileRules::loadRules()
return false; return false;
} }
if (options.rtSettings.verbose) { if (settings->verbose) {
printf (" loading rule %d\n", serial); printf (" loading rule %d\n", serial);
} }
@ -225,7 +230,7 @@ bool DynamicProfileRules::loadRules()
bool DynamicProfileRules::storeRules() bool DynamicProfileRules::storeRules()
{ {
if (options.rtSettings.verbose) { if (settings->verbose) {
printf ("saving dynamic profiles...\n"); printf ("saving dynamic profiles...\n");
} }

View File

@ -16,12 +16,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _DYNAMICPROFILE_H_ #pragma once
#define _DYNAMICPROFILE_H_
#include <glibmm.h> #include <glibmm/ustring.h>
#include <vector> #include <vector>
#include "../rtgui/options.h"
namespace rtengine
{
class FramesMetaData;
}
class DynamicProfileRule class DynamicProfileRule
{ {
@ -76,5 +79,3 @@ public:
const std::vector<DynamicProfileRule> &getRules(); const std::vector<DynamicProfileRule> &getRules();
void setRules (const std::vector<DynamicProfileRule> &r); void setRules (const std::vector<DynamicProfileRule> &r);
}; };
#endif // _DYNAMICPROFILE_H_

View File

@ -20,14 +20,13 @@
#include <cmath> #include <cmath>
#include "color.h" #include "color.h"
#include "rawimage.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rawimagesource_i.h" #include "rawimagesource_i.h"
#include "jaggedarray.h" #include "jaggedarray.h"
#include "rawimage.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "rt_math.h" #include "rt_math.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
#include "procparams.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"

View File

@ -25,7 +25,6 @@
#include <cmath> #include <cmath>
#include "rawimagesource.h" #include "rawimagesource.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
#include "procparams.h"
#include "opthelper.h" #include "opthelper.h"
using namespace std; using namespace std;

View File

@ -16,6 +16,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <giomm/file.h>
#include <glibmm/miscutils.h>
#include "ffmanager.h" #include "ffmanager.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
#include "rawimage.h" #include "rawimage.h"
@ -26,8 +30,6 @@
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
// *********************** class ffInfo ************************************** // *********************** class ffInfo **************************************
inline ffInfo& ffInfo::operator =(const ffInfo &o) inline ffInfo& ffInfo::operator =(const ffInfo &o)
@ -50,6 +52,11 @@ inline ffInfo& ffInfo::operator =(const ffInfo &o)
return *this; return *this;
} }
ffInfo::~ffInfo()
{
delete ri;
}
bool ffInfo::operator <(const ffInfo &e2) const bool ffInfo::operator <(const ffInfo &e2) const
{ {
if( this->maker.compare( e2.maker) >= 0 ) { if( this->maker.compare( e2.maker) >= 0 ) {

View File

@ -19,16 +19,16 @@
#pragma once #pragma once
#include <cmath> #include <cmath>
#include <list>
#include <map> #include <map>
#include <string> #include <string>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include "rawimage.h"
namespace rtengine namespace rtengine
{ {
class RawImage;
class ffInfo class ffInfo
{ {
public: public:
@ -48,13 +48,8 @@ public:
ffInfo( const ffInfo &o) ffInfo( const ffInfo &o)
: pathname(o.pathname), maker(o.maker), model(o.model), lens(o.lens), aperture(o.aperture), focallength(o.focallength), timestamp(o.timestamp), ri(nullptr) {} : pathname(o.pathname), maker(o.maker), model(o.model), lens(o.lens), aperture(o.aperture), focallength(o.focallength), timestamp(o.timestamp), ri(nullptr) {}
~ffInfo()
{
if( ri ) {
delete ri;
}
}
~ffInfo();
ffInfo &operator =(const ffInfo &o); ffInfo &operator =(const ffInfo &o);
bool operator <(const ffInfo &e2) const; bool operator <(const ffInfo &e2) const;

View File

@ -19,28 +19,19 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#ifdef _OPENMP #include "rawimage.h"
#include <omp.h>
#endif
#include "rawimagesource.h" #include "rawimagesource.h"
#include "coord.h"
#include "mytime.h" #include "mytime.h"
#include "opthelper.h" #include "opthelper.h"
#include "procparams.h" #include "procparams.h"
#include "rt_algo.h" #include "rt_algo.h"
#include "rtengine.h" #include "rtengine.h"
#include "sleef.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
namespace rtengine
{
extern const Settings* settings;
}
namespace namespace
{ {
@ -98,7 +89,7 @@ bool channelsAvg(
} }
bool rtengine::RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams &currentParams, std::array<float, 3>& newExps) bool rtengine::RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D spotB, int tran, const procparams::FilmNegativeParams &currentParams, std::array<float, 3>& newExps)
{ {
newExps = { newExps = {
static_cast<float>(currentParams.redRatio * currentParams.greenExp), static_cast<float>(currentParams.redRatio * currentParams.greenExp),

View File

@ -18,23 +18,17 @@
*/ */
#include <cmath> #include <cmath>
#include "LUT.h"
#include "rtengine.h" #include "rtengine.h"
#include "rtthumbnail.h" #include "rtthumbnail.h"
#include "opthelper.h" #include "opthelper.h"
#include "sleef.h"
#include "rt_algo.h" #include "rt_algo.h"
#include "rtengine.h"
#include "settings.h" #include "settings.h"
#include "procparams.h" #include "procparams.h"
#define BENCHMARK #define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
namespace rtengine
{
extern const Settings* settings;
}
void rtengine::Thumbnail::processFilmNegative( void rtengine::Thumbnail::processFilmNegative(
const procparams::ProcParams &params, const procparams::ProcParams &params,
const Imagefloat* baseImg, const Imagefloat* baseImg,

View File

@ -1,7 +1,7 @@
/* /*
* This file is part of RawTherapee. * This file is part of RawTherapee.
* *
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com> * Copyright (c) 2004-2019 Gabor Horvath <hgabor@rawtherapee.com>
* *
* RawTherapee is free software: you can redistribute it and/or modify * RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -15,23 +15,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _ILABEL_ #pragma once
#define _ILABEL_
#include <gtkmm.h> // For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget
enum FlatCurveType {
class ILabel : public Gtk::DrawingArea FCT_Empty = -1, // Also used for identity curves
{ FCT_Linear, // 0
FCT_MinMaxCPoints, // 1
Glib::ustring label; //FCT_Parametric, // 2
// Insert new curve type above this line
public: FCT_Unchanged // Must remain the last of the enum
explicit ILabel (const Glib::ustring &lab);
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override;
void on_realize() override;
void on_style_updated () override;
}; };
#endif

View File

@ -23,10 +23,14 @@
* also distributed under the GPL V3+ * also distributed under the GPL V3+
*/ */
#include "gamutwarning.h"
#include <iostream> #include <iostream>
namespace rtengine { #include "gamutwarning.h"
#include "iccstore.h"
#include "image8.h"
namespace rtengine
{
GamutWarning::GamutWarning(cmsHPROFILE iprof, cmsHPROFILE gamutprof, RenderingIntent intent, bool gamutbpc): GamutWarning::GamutWarning(cmsHPROFILE iprof, cmsHPROFILE gamutprof, RenderingIntent intent, bool gamutbpc):
lab2ref(nullptr), lab2ref(nullptr),
@ -126,5 +130,4 @@ inline void GamutWarning::mark(Image8 *image, int y, int x)
image->b(y, x) = 255; image->b(y, x) = 255;
} }
} // namespace rtengine } // namespace rtengine

View File

@ -25,11 +25,14 @@
#pragma once #pragma once
#include "iccstore.h" #include <lcms2.h>
#include "noncopyable.h"
#include "image8.h"
namespace rtengine { #include "noncopyable.h"
namespace rtengine
{
class Image8;
enum RenderingIntent : int; enum RenderingIntent : int;

View File

@ -16,13 +16,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _GAUSS_H_ #pragma once
#define _GAUSS_H_
enum eGaussType {GAUSS_STANDARD, GAUSS_MULT, GAUSS_DIV}; enum eGaussType {GAUSS_STANDARD, GAUSS_MULT, GAUSS_DIV};
static constexpr auto GAUSS_SKIP = 0.25; static constexpr auto GAUSS_SKIP = 0.25;
void gaussianBlur(float** src, float** dst, const int W, const int H, const double sigma, bool useBoxBlur = false, eGaussType gausstype = GAUSS_STANDARD, float** buffer2 = nullptr); void gaussianBlur(float** src, float** dst, const int W, const int H, const double sigma, bool useBoxBlur = false, eGaussType gausstype = GAUSS_STANDARD, float** buffer2 = nullptr);
#endif

View File

@ -28,32 +28,20 @@
* available at https://arxiv.org/abs/1505.00996 * available at https://arxiv.org/abs/1505.00996
*/ */
#include "guidedfilter.h"
#include "boxblur.h" #include "boxblur.h"
#include "sleef.c" #include "guidedfilter.h"
#include "rescale.h"
#include "imagefloat.h" #include "imagefloat.h"
#include "rescale.h"
#include "sleef.h"
namespace rtengine { #define BENCHMARK
#include "StopWatch.h"
#if 0 namespace rtengine
# 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
namespace { {
int calculate_subsampling(int w, int h, int r) int calculate_subsampling(int w, int h, int r)
{ {
@ -76,7 +64,6 @@ int calculate_subsampling(int w, int h, int r)
} // namespace } // namespace
void guidedFilter(const array2D<float> &guide, const array2D<float> &src, array2D<float> &dst, int r, float epsilon, bool multithread, int subsampling) void guidedFilter(const array2D<float> &guide, const array2D<float> &src, array2D<float> &dst, int r, float epsilon, bool multithread, int subsampling)
{ {
@ -166,54 +153,39 @@ void guidedFilter(const array2D<float> &guide, const array2D<float> &src, array2
f_subsample(I1, I); f_subsample(I1, I);
f_subsample(p1, p); f_subsample(p1, p);
DEBUG_DUMP(I);
DEBUG_DUMP(p);
DEBUG_DUMP(I1);
DEBUG_DUMP(p1);
float r1 = float(r) / subsampling; float r1 = float(r) / subsampling;
array2D<float> meanI(w, h); array2D<float> meanI(w, h);
f_mean(meanI, I1, r1); f_mean(meanI, I1, r1);
DEBUG_DUMP(meanI);
array2D<float> meanp(w, h); array2D<float> meanp(w, h);
f_mean(meanp, p1, r1); f_mean(meanp, p1, r1);
DEBUG_DUMP(meanp);
array2D<float> &corrIp = p1; array2D<float> &corrIp = p1;
apply(MUL, corrIp, I1, p1); apply(MUL, corrIp, I1, p1);
f_mean(corrIp, corrIp, r1); f_mean(corrIp, corrIp, r1);
DEBUG_DUMP(corrIp);
array2D<float> &corrI = I1; array2D<float> &corrI = I1;
apply(MUL, corrI, I1, I1); apply(MUL, corrI, I1, I1);
f_mean(corrI, corrI, r1); f_mean(corrI, corrI, r1);
DEBUG_DUMP(corrI);
array2D<float> &varI = corrI; array2D<float> &varI = corrI;
apply(SUBMUL, varI, meanI, meanI, corrI); apply(SUBMUL, varI, meanI, meanI, corrI);
DEBUG_DUMP(varI);
array2D<float> &covIp = corrIp; array2D<float> &covIp = corrIp;
apply(SUBMUL, covIp, meanI, meanp, corrIp); apply(SUBMUL, covIp, meanI, meanp, corrIp);
DEBUG_DUMP(covIp);
array2D<float> &a = varI; array2D<float> &a = varI;
apply(DIVEPSILON, a, covIp, varI); apply(DIVEPSILON, a, covIp, varI);
DEBUG_DUMP(a);
array2D<float> &b = covIp; array2D<float> &b = covIp;
apply(SUBMUL, b, a, meanI, meanp); apply(SUBMUL, b, a, meanI, meanp);
DEBUG_DUMP(b);
array2D<float> &meana = a; array2D<float> &meana = a;
f_mean(meana, a, r1); f_mean(meana, a, r1);
DEBUG_DUMP(meana);
array2D<float> &meanb = b; array2D<float> &meanb = b;
f_mean(meanb, b, r1); f_mean(meanb, b, r1);
DEBUG_DUMP(meanb);
// speedup by heckflosse67 // speedup by heckflosse67
const int Ws = meana.width(); const int Ws = meana.width();

View File

@ -22,7 +22,8 @@
#include "array2D.h" #include "array2D.h"
namespace rtengine { namespace rtengine
{
void guidedFilter(const array2D<float> &guide, const array2D<float> &src, array2D<float> &dst, int r, float epsilon, bool multithread, int subsampling=0); void guidedFilter(const array2D<float> &guide, const array2D<float> &src, array2D<float> &dst, int r, float epsilon, bool multithread, int subsampling=0);

View File

@ -288,8 +288,6 @@ void boxblur_resamp(const float* const* src, float** dst, float** temp, int H, i
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue) void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue)
{ {
double progress = 0.0; double progress = 0.0;

View File

@ -18,23 +18,22 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "rawimagesource.h"
#include "rtthumbnail.h"
#include "curves.h"
#include "color.h"
#include "rt_math.h"
#include "iccstore.h"
#include "procparams.h"
#include "../rtgui/mydiagonalcurve.h"
#include "improcfun.h"
//#define BENCHMARK
#include "StopWatch.h"
#include <iostream> #include <iostream>
#include "color.h"
#include "curves.h"
#include "improcfun.h"
#include "procparams.h"
#include "rawimagesource.h"
#include "rt_math.h"
#include "rtthumbnail.h"
#include "settings.h"
namespace rtengine { //#define BENCHMARK
#include "StopWatch.h"
extern const Settings *settings; namespace rtengine
{
namespace { namespace {

View File

@ -18,12 +18,11 @@
*/ */
#include <cmath> #include <cmath>
#include "rawimage.h"
#include "rawimagesource.h" #include "rawimagesource.h"
#include "rawimagesource_i.h" #include "rawimagesource_i.h"
#include "jaggedarray.h" #include "jaggedarray.h"
#include "rawimage.h"
#include "rt_math.h" #include "rt_math.h"
#include "procparams.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
#include "opthelper.h" #include "opthelper.h"
//#define BENCHMARK //#define BENCHMARK

View File

@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _ICCMATRICES_ #pragma once
#define _ICCMATRICES_
// Bradford transform between illuminants // Bradford transform between illuminants
constexpr double d65_d50[3][3] = { constexpr double d65_d50[3][3] = {
@ -296,4 +295,3 @@ constexpr double d50_best[3][3] = {
{-0.253000840399762, 0.0215532098817316,1.22569552576991} {-0.253000840399762, 0.0215532098817316,1.22569552576991}
}; };
*/ */
#endif

View File

@ -18,7 +18,9 @@
*/ */
#include <cstring> #include <cstring>
#include <glibmm.h> #include <glibmm/ustring.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#ifdef WIN32 #ifdef WIN32
@ -32,6 +34,7 @@
#include "iccstore.h" #include "iccstore.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "utils.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
#include "../rtgui/threadutils.h" #include "../rtgui/threadutils.h"
@ -41,12 +44,6 @@
#include "cJSON.h" #include "cJSON.h"
#define inkc_constant 0x696E6B43 #define inkc_constant 0x696E6B43
namespace rtengine
{
extern const Settings* settings;
}
namespace namespace
{ {

View File

@ -19,15 +19,14 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <glibmm.h> #include <glibmm/ustring.h>
#include <lcms2.h> #include <lcms2.h>
#include "color.h"
namespace rtengine namespace rtengine
{ {

View File

@ -17,6 +17,7 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "color.h"
#include "procparams.h" #include "procparams.h"
#include "rtengine.h" #include "rtengine.h"
@ -45,3 +46,7 @@ int rtengine::getCoarseBitMask( const procparams::CoarseTransformParams &coarse)
return tr; return tr;
} }
const LUTf& rtengine::getigammatab() {
return Color::igammatab_srgb;
}

View File

@ -16,17 +16,19 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _IIMAGE_ #pragma once
#define _IIMAGE_
#include <glibmm.h>
#include <vector> #include <vector>
#include "rt_math.h"
#include <glibmm/ustring.h>
#include <lcms2.h>
#include "alignedbuffer.h" #include "alignedbuffer.h"
#include "coord2d.h"
#include "imagedimensions.h" #include "imagedimensions.h"
#include "LUT.h" #include "LUT.h"
#include "coord2d.h" #include "rt_math.h"
#include "color.h"
#include "../rtgui/threadutils.h" #include "../rtgui/threadutils.h"
#define TR_NONE 0 #define TR_NONE 0
@ -57,6 +59,7 @@ extern const char sImage16[];
extern const char sImagefloat[]; extern const char sImagefloat[];
int getCoarseBitMask(const procparams::CoarseTransformParams& coarse); int getCoarseBitMask(const procparams::CoarseTransformParams& coarse);
const LUTf& getigammatab();
enum TypeInterpolation { TI_Nearest, TI_Bilinear }; enum TypeInterpolation { TI_Nearest, TI_Bilinear };
@ -955,17 +958,35 @@ public:
histogram(65536 >> histcompr); histogram(65536 >> histcompr);
histogram.clear(); histogram.clear();
const LUTf& igammatab = getigammatab();
for (int i = 0; i < height; i++) #ifdef _OPENMP
for (int j = 0; j < width; j++) { #pragma omp parallel
float r_, g_, b_; #endif
convertTo<T, float>(r(i, j), r_); {
convertTo<T, float>(g(i, j), g_); LUTu histThr(histogram.getSize());
convertTo<T, float>(b(i, j), b_); histThr.clear();
histogram[(int)Color::igamma_srgb (r_) >> histcompr]++; #ifdef _OPENMP
histogram[(int)Color::igamma_srgb (g_) >> histcompr]++; #pragma omp for schedule(dynamic,16) nowait
histogram[(int)Color::igamma_srgb (b_) >> histcompr]++; #endif
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
float r_, g_, b_;
convertTo<T, float>(r(i, j), r_);
convertTo<T, float>(g(i, j), g_);
convertTo<T, float>(b(i, j), b_);
histThr[static_cast<int>(igammatab[r_]) >> histcompr]++;
histThr[static_cast<int>(igammatab[g_]) >> histcompr]++;
histThr[static_cast<int>(igammatab[b_]) >> histcompr]++;
}
} }
#ifdef _OPENMP
#pragma omp critical
#endif
{
histogram += histThr;
}
}
} }
void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) const override void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) const override
@ -973,16 +994,16 @@ public:
histogram.clear(); histogram.clear();
avg_r = avg_g = avg_b = 0.; avg_r = avg_g = avg_b = 0.;
n = 0; n = 0;
const LUTf& igammatab = getigammatab();
for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int i = 0; i < (unsigned int)(height); i++)
for (unsigned int j = 0; j < (unsigned int)(width); j++) { for (unsigned int j = 0; j < (unsigned int)(width); j++) {
float r_, g_, b_; float r_, g_, b_;
convertTo<T, float>(r(i, j), r_); convertTo<T, float>(r(i, j), r_);
convertTo<T, float>(g(i, j), g_); convertTo<T, float>(g(i, j), g_);
convertTo<T, float>(b(i, j), b_); convertTo<T, float>(b(i, j), b_);
int rtemp = Color::igamma_srgb (r_); int rtemp = igammatab[r_];
int gtemp = Color::igamma_srgb (g_); int gtemp = igammatab[g_];
int btemp = Color::igamma_srgb (b_); int btemp = igammatab[b_];
histogram[rtemp >> compression]++; histogram[rtemp >> compression]++;
histogram[gtemp >> compression] += 2; histogram[gtemp >> compression] += 2;
@ -1009,6 +1030,9 @@ public:
int n = 0; int n = 0;
//int p = 6; //int p = 6;
#ifdef _OPENMP
#pragma omp parallel for reduction(+:avg_r,avg_g,avg_b,n) schedule(dynamic,16)
#endif
for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int i = 0; i < (unsigned int)(height); i++)
for (unsigned int j = 0; j < (unsigned int)(width); j++) { for (unsigned int j = 0; j < (unsigned int)(width); j++) {
float r_, g_, b_; float r_, g_, b_;
@ -1564,17 +1588,35 @@ public:
histogram(65536 >> histcompr); histogram(65536 >> histcompr);
histogram.clear(); histogram.clear();
const LUTf& igammatab = getigammatab();
for (int i = 0; i < height; i++) #ifdef _OPENMP
for (int j = 0; j < width; j++) { #pragma omp parallel
float r_, g_, b_; #endif
convertTo<T, float>(r(i, j), r_); {
convertTo<T, float>(g(i, j), g_); LUTu histThr(histogram.getSize());
convertTo<T, float>(b(i, j), b_); histThr.clear();
histogram[(int)Color::igamma_srgb (r_) >> histcompr]++; #ifdef _OPENMP
histogram[(int)Color::igamma_srgb (g_) >> histcompr]++; #pragma omp for schedule(dynamic,16) nowait
histogram[(int)Color::igamma_srgb (b_) >> histcompr]++; #endif
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
float r_, g_, b_;
convertTo<T, float>(r(i, j), r_);
convertTo<T, float>(g(i, j), g_);
convertTo<T, float>(b(i, j), b_);
histThr[static_cast<int>(igammatab[r_]) >> histcompr]++;
histThr[static_cast<int>(igammatab[g_]) >> histcompr]++;
histThr[static_cast<int>(igammatab[b_]) >> histcompr]++;
}
} }
#ifdef _OPENMP
#pragma omp critical
#endif
{
histogram += histThr;
}
}
} }
void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) const override void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) const override
@ -1582,6 +1624,7 @@ public:
histogram.clear(); histogram.clear();
avg_r = avg_g = avg_b = 0.; avg_r = avg_g = avg_b = 0.;
n = 0; n = 0;
const LUTf& igammatab = getigammatab();
for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int i = 0; i < (unsigned int)(height); i++)
for (unsigned int j = 0; j < (unsigned int)(width); j++) { for (unsigned int j = 0; j < (unsigned int)(width); j++) {
@ -1589,9 +1632,9 @@ public:
convertTo<T, float>(r(i, j), r_); convertTo<T, float>(r(i, j), r_);
convertTo<T, float>(g(i, j), g_); convertTo<T, float>(g(i, j), g_);
convertTo<T, float>(b(i, j), b_); convertTo<T, float>(b(i, j), b_);
int rtemp = Color::igamma_srgb (r_); int rtemp = igammatab[r_];
int gtemp = Color::igamma_srgb (g_); int gtemp = igammatab[g_];
int btemp = Color::igamma_srgb (b_); int btemp = igammatab[b_];
histogram[rtemp >> compression]++; histogram[rtemp >> compression]++;
histogram[gtemp >> compression] += 2; histogram[gtemp >> compression] += 2;
@ -1618,6 +1661,9 @@ public:
int n = 0; int n = 0;
//int p = 6; //int p = 6;
#ifdef _OPENMP
#pragma omp parallel for reduction(+:avg_r,avg_g,avg_b,n) schedule(dynamic,16)
#endif
for (unsigned int i = 0; i < (unsigned int)(height); i++) for (unsigned int i = 0; i < (unsigned int)(height); i++)
for (unsigned int j = 0; j < (unsigned int)(width); j++) { for (unsigned int j = 0; j < (unsigned int)(width); j++) {
float r_, g_, b_; float r_, g_, b_;
@ -1808,5 +1854,3 @@ public:
}; };
} }
#endif

View File

@ -16,11 +16,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <cstdio>
#include "colortemp.h"
#include "image16.h" #include "image16.h"
#include "imagefloat.h" #include "imagefloat.h"
#include "image8.h" #include "image8.h"
#include <cstdio> #include "rt_math.h"
#include "rtengine.h"
namespace namespace
{ {

View File

@ -19,17 +19,15 @@
// //
// A class representing a 16 bit rgb image with separate planes and 16 byte aligned data // A class representing a 16 bit rgb image with separate planes and 16 byte aligned data
// //
#ifndef _IMAGE16_ #pragma once
#define _IMAGE16_
#include "imageio.h" #include "imageio.h"
#include "rtengine.h"
#include "imagefloat.h"
namespace rtengine namespace rtengine
{ {
class Image8; class Image8;
class Imagefloat;
class Image16 : public IImage16, public ImageIO class Image16 : public IImage16, public ImageIO
{ {
@ -109,4 +107,3 @@ public:
}; };
} }
#endif

View File

@ -18,7 +18,10 @@
*/ */
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include "colortemp.h"
#include "image8.h" #include "image8.h"
#include "imagefloat.h"
#include "rtengine.h" #include "rtengine.h"
using namespace rtengine; using namespace rtengine;

View File

@ -19,15 +19,13 @@
// //
// A class representing a 8 bit rgb image without alpha channel // A class representing a 8 bit rgb image without alpha channel
// //
#ifndef _IMAGE8_ #pragma once
#define _IMAGE8_
#include "imageio.h" #include "imageio.h"
#include "rtengine.h"
#include "imagefloat.h"
namespace rtengine namespace rtengine
{ {
class Imagefloat;
class Image8 : public IImage8, public ImageIO class Image8 : public IImage8, public ImageIO
{ {
@ -104,4 +102,3 @@ public:
}; };
} }
#endif

View File

@ -17,15 +17,22 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <functional> #include <functional>
#include <strings.h> #include <strings.h>
#include <glib/gstdio.h>
#include <tiff.h> #include <tiff.h>
#include <glib/gstdio.h>
#include <glibmm/convert.h>
#include "imagedata.h" #include "imagedata.h"
#include "iptcpairs.h"
#include "imagesource.h" #include "imagesource.h"
#include "rt_math.h" #include "iptcpairs.h"
#include "procparams.h" #include "procparams.h"
#include "rt_math.h"
#include "utils.h"
#include "../rtexif/rtexif.h"
#pragma GCC diagnostic warning "-Wextra" #pragma GCC diagnostic warning "-Wextra"
#define PRINT_HDR_PS_DETECTION 0 #define PRINT_HDR_PS_DETECTION 0

View File

@ -16,17 +16,24 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef __IMAGEDATA_H__ #pragma once
#define __IMAGEDATA_H__
#include <cstdio> #include <cstdio>
#include <memory> #include <memory>
#include "rawimage.h"
#include <string> #include <string>
#include <glibmm.h> #include <vector>
#include "../rtexif/rtexif.h"
#include <glibmm/ustring.h>
#include <libiptcdata/iptc-data.h> #include <libiptcdata/iptc-data.h>
#include "rtengine.h"
#include "imageio.h"
namespace rtexif
{
class TagDirectory;
}
namespace rtengine namespace rtengine
{ {
@ -133,4 +140,3 @@ public:
} }
#endif

View File

@ -17,12 +17,14 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <tiffio.h> #include <tiffio.h>
#include "colortemp.h"
#include "imagefloat.h" #include "imagefloat.h"
#include "image16.h" #include "image16.h"
#include "image8.h" #include "image8.h"
#include "labimage.h"
#include <cstring> #include <cstring>
#include "rtengine.h" #include "rtengine.h"
#include "mytime.h"
#include "iccstore.h" #include "iccstore.h"
#include "alignedbuffer.h" #include "alignedbuffer.h"
#include "rt_math.h" #include "rt_math.h"

View File

@ -19,11 +19,9 @@
// //
// A class representing a 16 bit rgb image with separate planes and 16 byte aligned data // A class representing a 16 bit rgb image with separate planes and 16 byte aligned data
// //
#ifndef _IMAGEFLOAT_ #pragma once
#define _IMAGEFLOAT_
#include "imageio.h" #include "imageio.h"
#include "rtengine.h"
namespace rtengine namespace rtengine
{ {
@ -31,6 +29,7 @@ using namespace procparams;
class Image8; class Image8;
class Image16; class Image16;
class LabImage;
/* /*
* Image type used by most tools; expected range: [0.0 ; 65535.0] * Image type used by most tools; expected range: [0.0 ; 65535.0]
@ -227,4 +226,3 @@ public:
}; };
} }
#endif

View File

@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _IMAGEFORMAT_ #pragma once
#define _IMAGEFORMAT_
namespace rtengine namespace rtengine
{ {
@ -51,5 +50,3 @@ typedef enum SensorType {
} eSensorType; } eSensorType;
} }
#endif

View File

@ -27,8 +27,10 @@
#include <libiptcdata/iptc-jpeg.h> #include <libiptcdata/iptc-jpeg.h>
#include "rt_math.h" #include "rt_math.h"
#include "procparams.h" #include "procparams.h"
#include "utils.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
#include "../rtgui/version.h" #include "../rtgui/version.h"
#include "../rtexif/rtexif.h"
#ifdef WIN32 #ifdef WIN32
#include <winsock2.h> #include <winsock2.h>
@ -810,7 +812,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname)
* TIFFTAG_SMAXSAMPLEVALUE, but for now, we normalize the image to the * TIFFTAG_SMAXSAMPLEVALUE, but for now, we normalize the image to the
* effective minimum and maximum values * effective minimum and maximum values
*/ */
if (options.rtSettings.verbose) { if (settings->verbose) {
printf("Information of \"%s\":\n", fname.c_str()); printf("Information of \"%s\":\n", fname.c_str());
uint16 tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit; uint16 tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit;
if (TIFFGetField(in, TIFFTAG_DEFAULTSCALE, &tiffDefaultScale)) { if (TIFFGetField(in, TIFFTAG_DEFAULTSCALE, &tiffDefaultScale)) {

View File

@ -16,35 +16,51 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _IMAGEIO_ #pragma once
#define _IMAGEIO_
#define IMIO_SUCCESS 0
#define IMIO_CANNOTREADFILE 1
#define IMIO_INVALIDHEADER 2
#define IMIO_HEADERERROR 3
#define IMIO_READERROR 4
#define IMIO_VARIANTNOTSUPPORTED 5
#define IMIO_FILETYPENOTSUPPORTED 6
#define IMIO_CANNOTWRITEFILE 7
#include <memory> #include <memory>
#include <glibmm.h> #include <glibmm/ustring.h>
#include <libiptcdata/iptc-data.h> #include <libiptcdata/iptc-data.h>
#include "rtengine.h"
#include "imageformat.h"
#include "../rtexif/rtexif.h"
#include "imagedimensions.h"
#include "iimage.h" #include "iimage.h"
#include "colortemp.h" #include "imagedimensions.h"
#include "imageformat.h"
#include "rtengine.h"
enum {
IMIO_SUCCESS,
IMIO_CANNOTREADFILE,
IMIO_INVALIDHEADER,
IMIO_HEADERERROR,
IMIO_READERROR,
IMIO_VARIANTNOTSUPPORTED,
IMIO_FILETYPENOTSUPPORTED,
IMIO_CANNOTWRITEFILE
};
namespace rtexif
{
class TagDirectory;
}
namespace rtengine namespace rtengine
{ {
class ColorTemp;
class ProgressListener; class ProgressListener;
class Imagefloat; class Imagefloat;
namespace procparams
{
class ExifPairs;
}
class ImageIO : virtual public ImageDatas class ImageIO : virtual public ImageDatas
{ {
@ -111,4 +127,3 @@ public:
}; };
} }
#endif

View File

@ -21,21 +21,31 @@
#include <array> #include <array>
#include <vector> #include <vector>
#include <glibmm.h> #include <glibmm/ustring.h>
#include "colortemp.h"
#include "coord2d.h" #include "coord2d.h"
#include "dcp.h"
#include "image16.h"
#include "image8.h"
#include "imagedata.h" #include "imagedata.h"
#include "imagefloat.h"
#include "LUT.h" #include "LUT.h"
#include "rtengine.h" #include "rtengine.h"
template<typename T>
class LUT;
using LUTf = LUT<float>;
template<typename T, const size_t num>
class multi_array2D;
namespace rtengine namespace rtengine
{ {
class ColorTemp;
class DCPProfile;
class DCPProfileApplyState;
class Imagefloat;
class RetinexgaintransmissionCurve;
class RetinextransmissionCurve;
namespace procparams namespace procparams
{ {
@ -47,7 +57,7 @@ struct RAWParams;
struct RetinexParams; struct RetinexParams;
struct ToneCurveParams; struct ToneCurveParams;
struct CaptureSharpeningParams; struct CaptureSharpeningParams;
} };
class ImageMatrices class ImageMatrices
{ {
@ -82,7 +92,7 @@ public:
virtual int load (const Glib::ustring &fname) = 0; virtual int load (const Glib::ustring &fname) = 0;
virtual void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) {}; virtual void preprocess (const procparams::RAWParams &raw, const procparams::LensProfParams &lensProf, const procparams::CoarseTransformParams& coarse, bool prepareDenoise = true) {};
virtual void filmNegativeProcess (const procparams::FilmNegativeParams &params) {}; virtual void filmNegativeProcess (const procparams::FilmNegativeParams &params) {};
virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const FilmNegativeParams& currentParams, std::array<float, 3>& newExps) { return false; }; virtual bool getFilmNegativeExponents (Coord2D spotA, Coord2D spotB, int tran, const procparams::FilmNegativeParams& currentParams, std::array<float, 3>& newExps) { return false; };
virtual void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold, bool cache = false) {}; virtual void demosaic (const procparams::RAWParams &raw, bool autoContrast, double &contrastThreshold, bool cache = false) {};
virtual void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D<float, 4> &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; virtual void retinex (const procparams::ColorManagementParams& cmp, const procparams::RetinexParams &deh, const procparams::ToneCurveParams& Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D<float, 4> &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {};
virtual void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; virtual void retinexPrepareCurves (const procparams::RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {};
@ -101,13 +111,13 @@ public:
// use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat*
virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hlp, const RAWParams &raw) = 0; virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const procparams::ToneCurveParams &hlp, const procparams::RAWParams &raw) = 0;
virtual eSensorType getSensorType () const = 0; virtual eSensorType getSensorType () const = 0;
virtual bool isMono () const = 0; virtual bool isMono () const = 0;
// true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource // true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource
virtual bool isWBProviderReady () = 0; virtual bool isWBProviderReady () = 0;
virtual void convertColorSpace (Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb) = 0; // DIRTY HACK: this method is derived in rawimagesource and strimagesource, but (...,RAWParams raw) will be used ONLY for raw images virtual void convertColorSpace (Imagefloat* image, const procparams::ColorManagementParams &cmp, const ColorTemp &wb) = 0; // DIRTY HACK: this method is derived in rawimagesource and strimagesource, but (...,RAWParams raw) will be used ONLY for raw images
virtual void getAutoWBMultipliers (double &rm, double &gm, double &bm) = 0; virtual void getAutoWBMultipliers (double &rm, double &gm, double &bm) = 0;
virtual ColorTemp getWB () const = 0; virtual ColorTemp getWB () const = 0;
virtual ColorTemp getSpotWB (std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, int tran, double equal) = 0; virtual ColorTemp getSpotWB (std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, int tran, double equal) = 0;
@ -126,7 +136,7 @@ public:
virtual ImageMatrices* getImageMatrices () = 0; virtual ImageMatrices* getImageMatrices () = 0;
virtual bool isRAW () const = 0; virtual bool isRAW () const = 0;
virtual DCPProfile* getDCP (const procparams::ColorManagementParams &cmp, DCPProfile::ApplyState &as) virtual DCPProfile* getDCP (const procparams::ColorManagementParams &cmp, DCPProfileApplyState &as)
{ {
return nullptr; return nullptr;
}; };

View File

@ -16,33 +16,39 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "improccoordinator.h"
#include "curves.h"
#include "mytime.h"
#include "refreshmap.h"
#include "../rtgui/ppversion.h"
#include "colortemp.h"
#include "improcfun.h"
#include <iostream>
#include <fstream> #include <fstream>
#include <iostream>
#include <string> #include <string>
#include <unistd.h> #include <glibmm/thread.h>
#include "jaggedarray.h"
#include "iccstore.h" #include "improccoordinator.h"
#include "procparams.h"
#include <iostream> #include "cieimage.h"
#include <fstream>
#include <string>
#include "color.h" #include "color.h"
#include "colortemp.h"
#include "jaggedarray.h"
#include "curves.h"
#include "dcp.h"
#include "iccstore.h"
#include "image8.h"
#include "imagefloat.h"
#include "improcfun.h"
#include "labimage.h"
#include "lcp.h"
#include "procparams.h"
#include "refreshmap.h"
#include "../rtgui/options.h"
#include "../rtgui/ppversion.h"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
ImProcCoordinator::ImProcCoordinator() : ImProcCoordinator::ImProcCoordinator() :
orig_prev(nullptr), orig_prev(nullptr),
oprevi(nullptr), oprevi(nullptr),
@ -814,7 +820,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
double ggm = 33.; double ggm = 33.;
double bbm = 33.; double bbm = 33.;
DCPProfile::ApplyState as; DCPProfileApplyState as;
DCPProfile *dcpProf = imgsrc->getDCP(params->icm, as); DCPProfile *dcpProf = imgsrc->getDCP(params->icm, as);
ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params->toneCurve.saturation, ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, params->toneCurve.saturation,

View File

@ -16,21 +16,27 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _IMPROCCOORDINATOR_H_ #pragma once
#define _IMPROCCOORDINATOR_H_
#include <memory> #include <memory>
#include "rtengine.h" #include "array2D.h"
#include "improcfun.h" #include "colortemp.h"
#include "image8.h" #include "curves.h"
#include "image16.h"
#include "imagesource.h"
#include "procevents.h"
#include "dcrop.h" #include "dcrop.h"
#include "imagesource.h"
#include "improcfun.h"
#include "LUT.h" #include "LUT.h"
#include "procevents.h"
#include "rtengine.h"
#include "../rtgui/threadutils.h" #include "../rtgui/threadutils.h"
namespace Glib
{
class Thread;
}
namespace rtengine namespace rtengine
{ {
@ -538,5 +544,5 @@ public:
} denoiseInfoStore; } denoiseInfoStore;
}; };
} }
#endif

View File

@ -18,16 +18,18 @@
*/ */
#include <cmath> #include <cmath>
#include <glib.h> #include <glib.h>
#include <glibmm.h> #include <glibmm/ustring.h>
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
#include "alignedbuffer.h" #include "alignedbuffer.h"
#include "cieimage.h"
#include "labimage.h"
#include "rtengine.h" #include "rtengine.h"
#include "improcfun.h" #include "improcfun.h"
#include "curves.h" #include "curves.h"
#include "mytime.h" #include "dcp.h"
#include "iccstore.h" #include "iccstore.h"
#include "imagesource.h" #include "imagesource.h"
#include "rtthumbnail.h" #include "rtthumbnail.h"
@ -40,12 +42,16 @@
#include "improccoordinator.h" #include "improccoordinator.h"
#include "clutstore.h" #include "clutstore.h"
#include "ciecam02.h" #include "ciecam02.h"
#include "satandvalueblendingcurve.h"
#include "StopWatch.h" #include "StopWatch.h"
#include "procparams.h" #include "procparams.h"
#include "../rtgui/ppversion.h" #include "../rtgui/ppversion.h"
#include "../rtgui/guiutils.h"
#include "../rtgui/editcallbacks.h" #include "../rtgui/editcallbacks.h"
#ifdef _DEBUG
#include "mytime.h"
#endif
#undef CLIPD #undef CLIPD
#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) #define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f)
@ -273,10 +279,7 @@ namespace rtengine
using namespace procparams; using namespace procparams;
extern const Settings* settings; ImProcFunctions::~ImProcFunctions ()
ImProcFunctions::~ImProcFunctions()
{ {
if (monitorTransform) { if (monitorTransform) {
cmsDeleteTransform(monitorTransform); cmsDeleteTransform(monitorTransform);
@ -2065,25 +2068,17 @@ filmlike_clip(float *r, float *g, float *b)
} }
} }
void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure)
void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure)
{ {
rgbProc (working, lab, pipetteBuffer, hltonecurve, shtonecurve, tonecurve, sat, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, asIn, histToneCurve, chunkSize, measure); rgbProc (working, lab, pipetteBuffer, hltonecurve, shtonecurve, tonecurve, sat, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, params->toneCurve.expcomp, params->toneCurve.hlcompr, params->toneCurve.hlcomprthresh, dcpProf, asIn, histToneCurve, chunkSize, measure);
} }
// Process RGB image and convert to LAB space // Process RGB image and convert to LAB space
void ImProcFunctions::rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clToningcurve, LUTf & cl2Toningcurve,
const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure) const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize, bool measure)
{ {
std::unique_ptr<StopWatch> stop; std::unique_ptr<StopWatch> stop;

View File

@ -16,29 +16,57 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _IMPROCFUN_H_ #pragma once
#define _IMPROCFUN_H_
#include <memory>
#include "imagefloat.h"
#include "image16.h"
#include "image8.h"
#include "shmap.h"
#include "coord2d.h" #include "coord2d.h"
#include "color.h"
#include "labimage.h"
#include "cieimage.h"
#include "LUT.h"
#include "lcp.h"
#include "dcp.h"
#include "curves.h"
#include "cplx_wavelet_dec.h"
#include "pipettebuffer.h"
#include "gamutwarning.h" #include "gamutwarning.h"
#include "jaggedarray.h" #include "jaggedarray.h"
#include "pipettebuffer.h"
#include "shmap.h"
template<typename T>
class LUT;
using LUTu = LUT<uint32_t>;
using LUTf = LUT<float>;
template<typename T, const size_t num>
class multi_array2D;
namespace rtengine namespace rtengine
{ {
class ColorAppearance;
class ColorGradientCurve;
class DCPProfile;
class DCPProfileApplyState;
class FlatCurve;
class FramesMetaData;
class LensCorrection;
class LocCCmaskCurve;
class LocLLmaskCurve;
class LocHHmaskCurve;
class LocwavCurve;
class LocretigainCurve;
class LocretitransCurve;
class LocLHCurve;
class LocHHCurve;
class NoiseCurve;
class OpacityCurve;
class ToneCurve;
class WavCurve;
class WavOpacityCurveBY;
class WavOpacityCurveRG;
class WavOpacityCurveW;
class WavOpacityCurveWL;
class CieImage;
class Image8;
class Imagefloat;
class LabImage;
class wavelet_decomposition;
namespace procparams namespace procparams
{ {
@ -46,6 +74,7 @@ class ProcParams;
struct DehazeParams; struct DehazeParams;
struct FattalToneMappingParams; struct FattalToneMappingParams;
struct ColorManagementParams;
struct DirPyrDenoiseParams; struct DirPyrDenoiseParams;
struct LocalContrastParams; struct LocalContrastParams;
struct LocallabParams; struct LocallabParams;
@ -64,7 +93,7 @@ class ImProcFunctions
cmsHTRANSFORM monitorTransform; cmsHTRANSFORM monitorTransform;
std::unique_ptr<GamutWarning> gamutWarning; std::unique_ptr<GamutWarning> gamutWarning;
const ProcParams* params; const procparams::ProcParams* params;
double scale; double scale;
bool multiThread; bool multiThread;
@ -102,7 +131,7 @@ public:
double lumimul[3]; double lumimul[3];
explicit ImProcFunctions(const ProcParams* iparams, bool imultiThread = true) explicit ImProcFunctions(const procparams::ProcParams* iparams, bool imultiThread = true)
: monitorTransform(nullptr), params(iparams), scale(1), multiThread(imultiThread), lumimul{} {} : monitorTransform(nullptr), params(iparams), scale(1), multiThread(imultiThread), lumimul{} {}
~ImProcFunctions(); ~ImProcFunctions();
bool needsLuminanceOnly() bool needsLuminanceOnly()
@ -118,11 +147,11 @@ public:
void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck); void updateColorProfiles(const Glib::ustring& monitorProfile, RenderingIntent monitorIntent, bool softProof, bool gamutCheck);
void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false); const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false);
void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, void rgbProc(Imagefloat* working, LabImage* lab, PipetteBuffer *pipetteBuffer, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve,
int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, bool opautili, LUTf & clcurve, LUTf & cl2curve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob, const ToneCurve & customToneCurvebw1, const ToneCurve & customToneCurvebw2, double &rrm, double &ggm, double &bbm, float &autor, float &autog, float &autob,
double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false); double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfileApplyState &asIn, LUTu &histToneCurve, size_t chunkSize = 1, bool measure = false);
void labtoning(float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve, LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3]); void labtoning(float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve, LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3]);
void toning2col(float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float rl, float gl, float bl, float rh, float gh, float bh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect); void toning2col(float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float rl, float gl, float bl, float rh, float gh, float bh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect);
void toningsmh(float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect); void toningsmh(float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect);
@ -134,10 +163,9 @@ public:
void moyeqt(Imagefloat* working, float &moyS, float &eqty); void moyeqt(Imagefloat* working, float &moyS, float &eqty);
void luminanceCurve(LabImage* lold, LabImage* lnew, LUTf &curve); void luminanceCurve(LabImage* lold, LabImage* lnew, LUTf &curve);
void ciecamloc_02float(int sp, LabImage* lab); void ciecamloc_02float(int sp, LabImage* lab);
void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params, void ciecam_02float(CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const procparams::ProcParams* params,
const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3,
LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt, LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt,
bool showSharpMask = false); bool showSharpMask = false);
@ -149,7 +177,7 @@ public:
void sharpening(LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask = false); void sharpening(LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask = false);
void sharpeningcam(CieImage* ncie, float** buffer, bool showMask = false); void sharpeningcam(CieImage* ncie, float** buffer, bool showMask = false);
void transform(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage); void transform(Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage);
float resizeScale(const ProcParams* params, int fw, int fh, int &imw, int &imh); float resizeScale(const procparams::ProcParams* params, int fw, int fh, int &imw, int &imh);
void lab2monitorRgb(LabImage* lab, Image8* image); void lab2monitorRgb(LabImage* lab, Image8* image);
void resize(Imagefloat* src, Imagefloat* dst, float dScale); void resize(Imagefloat* src, Imagefloat* dst, float dScale);
void Lanczos(const LabImage* src, LabImage* dst, float scale); void Lanczos(const LabImage* src, LabImage* dst, float scale);
@ -354,14 +382,14 @@ public:
void Badpixelscam(CieImage * ncie, double radius, int thresh, int mode, float chrom, bool hotbad); void Badpixelscam(CieImage * ncie, double radius, int thresh, int mode, float chrom, bool hotbad);
void BadpixelsLab(LabImage * lab, double radius, int thresh, float chrom); void BadpixelsLab(LabImage * lab, double radius, int thresh, float chrom);
void dehaze(Imagefloat *rgb, const DehazeParams &dehazeParams); void dehaze(Imagefloat *rgb, const procparams::DehazeParams &dehazeParams);
void ToneMapFattal02(Imagefloat *rgb, const FattalToneMappingParams &fatParams, int detail_level); void ToneMapFattal02(Imagefloat *rgb, const procparams::FattalToneMappingParams &fatParams, int detail_level);
void localContrast(LabImage *lab, float **destination, const LocalContrastParams &localContrastParams, bool fftwlc, double scale); void localContrast(LabImage *lab, float **destination, const procparams::LocalContrastParams &localContrastParams, bool fftwlc, double scale);
void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread); void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread);
// void shadowsHighlights(LabImage *lab); // void shadowsHighlights(LabImage *lab);
void shadowsHighlights(LabImage *lab, bool ena, int labmode, int hightli, int shado, int rad, int scal, int hltonal, int shtonal); void shadowsHighlights(LabImage *lab, bool ena, int labmode, int hightli, int shado, int rad, int scal, int hltonal, int shtonal);
void softLight(LabImage *lab, const SoftLightParams &softLightParams); void softLight(LabImage *lab, const procparams::SoftLightParams &softLightParams);
void labColorCorrectionRegions(LabImage *lab); void labColorCorrectionRegions(LabImage *lab);
Image8* lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool consider_histogram_settings = true); Image8* lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool consider_histogram_settings = true);
@ -377,5 +405,5 @@ public:
void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); void rgb2lab(const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace);
void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace); void lab2rgb(const LabImage &src, Imagefloat &dst, const Glib::ustring &workingSpace);
}; };
} }
#endif

View File

@ -22,7 +22,7 @@
#include "labimage.h" #include "labimage.h"
#include "improcfun.h" #include "improcfun.h"
#include "cieimage.h" #include "cieimage.h"
#include "sleef.c" #include "sleef.h"
#include "opthelper.h" #include "opthelper.h"
#include "gauss.h" #include "gauss.h"

View File

@ -18,6 +18,7 @@
*/ */
#include <fftw3.h> #include <fftw3.h>
#include "../rtgui/profilestorecombobox.h" #include "../rtgui/profilestorecombobox.h"
#include "color.h"
#include "rtengine.h" #include "rtengine.h"
#include "iccstore.h" #include "iccstore.h"
#include "dcp.h" #include "dcp.h"
@ -42,7 +43,7 @@ const Settings* settings;
MyMutex* lcmsMutex = nullptr; MyMutex* lcmsMutex = nullptr;
MyMutex *fftwMutex = nullptr; MyMutex *fftwMutex = nullptr;
int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir, bool loadAll) int init (const Settings* s, const Glib::ustring& baseDir, const Glib::ustring& userSettingsDir, bool loadAll)
{ {
settings = s; settings = s;
ProcParams::init(); ProcParams::init();

View File

@ -32,17 +32,22 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "color.h"
#include "guidedfilter.h" #include "guidedfilter.h"
#include "iccstore.h"
#include "imagefloat.h"
#include "improcfun.h" #include "improcfun.h"
#include "procparams.h" #include "procparams.h"
#include "rescale.h" #include "rescale.h"
#include "rt_math.h" #include "rt_math.h"
extern Options options; #include "../rtgui/options.h"
namespace rtengine { namespace rtengine
{
namespace { namespace
{
float normalize(Imagefloat *rgb, bool multithread) float normalize(Imagefloat *rgb, bool multithread)
{ {
@ -198,7 +203,7 @@ float estimate_ambient_light(const array2D<float> &R, const array2D<float> &G, c
} }
} }
if (options.rtSettings.verbose) { if (settings->verbose) {
std::cout << "dehaze: computing ambient light from " << patches.size() std::cout << "dehaze: computing ambient light from " << patches.size()
<< " patches" << std::endl; << " patches" << std::endl;
} }
@ -269,7 +274,6 @@ void extract_channels(Imagefloat *img, array2D<float> &r, array2D<float> &g, arr
} // namespace } // namespace
void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams) void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
{ {
if (!dehazeParams.enabled || dehazeParams.strength == 0.0) { if (!dehazeParams.enabled || dehazeParams.strength == 0.0) {
@ -282,7 +286,7 @@ void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
const int H = img->getHeight(); const int H = img->getHeight();
const float strength = LIM01(float(dehazeParams.strength) / 100.f * 0.9f); const float strength = LIM01(float(dehazeParams.strength) / 100.f * 0.9f);
if (options.rtSettings.verbose) { if (settings->verbose) {
std::cout << "dehaze: strength = " << strength << std::endl; std::cout << "dehaze: strength = " << strength << std::endl;
} }
@ -324,7 +328,7 @@ void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
} }
if (min(ambient[0], ambient[1], ambient[2]) < 0.01f) { if (min(ambient[0], ambient[1], ambient[2]) < 0.01f) {
if (options.rtSettings.verbose) { if (settings->verbose) {
std::cout << "dehaze: no haze detected" << std::endl; std::cout << "dehaze: no haze detected" << std::endl;
} }
restore(img, maxChannel, multiThread); restore(img, maxChannel, multiThread);
@ -332,7 +336,7 @@ void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
} }
patchsize = max(max(W, H) / 600, 2); patchsize = max(max(W, H) / 600, 2);
if (options.rtSettings.verbose) { if (settings->verbose) {
std::cout << "dehaze: ambient light is " std::cout << "dehaze: ambient light is "
<< ambient[0] << ", " << ambient[1] << ", " << ambient[2] << ambient[0] << ", " << ambient[1] << ", " << ambient[2]
<< std::endl; << std::endl;
@ -347,7 +351,7 @@ void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
array2D<float> guideB(W, H, img->b.ptrs, ARRAY2D_BYREFERENCE); array2D<float> guideB(W, H, img->b.ptrs, ARRAY2D_BYREFERENCE);
guidedFilter(guideB, dark, dark, radius, epsilon, multiThread); guidedFilter(guideB, dark, dark, radius, epsilon, multiThread);
if (options.rtSettings.verbose) { if (settings->verbose) {
std::cout << "dehaze: max distance is " << maxDistance << std::endl; std::cout << "dehaze: max distance is " << maxDistance << std::endl;
} }
@ -429,5 +433,4 @@ void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
} }
} }
} // namespace rtengine } // namespace rtengine

View File

@ -39,10 +39,7 @@
along with darktable. If not, see <http://www.gnu.org/licenses/>. along with darktable. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef _OPENMP #include "imagefloat.h"
#include <omp.h>
#endif
#include "improcfun.h" #include "improcfun.h"
#include "rt_math.h" #include "rt_math.h"

View File

@ -17,13 +17,14 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "rtengine.h" #include "rtengine.h"
#include "image8.h"
#include "imagefloat.h"
#include "labimage.h"
#include "improcfun.h" #include "improcfun.h"
#include <glibmm.h> #include <glibmm/ustring.h>
#include "iccstore.h" #include "iccstore.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "../rtgui/options.h"
#include "settings.h" #include "settings.h"
#include "curves.h"
#include "alignedbuffer.h" #include "alignedbuffer.h"
#include "color.h" #include "color.h"
#include "procparams.h" #include "procparams.h"
@ -33,8 +34,6 @@ namespace rtengine
extern void filmlike_clip(float *r, float *g, float *b); extern void filmlike_clip(float *r, float *g, float *b);
extern const Settings* settings;
namespace { namespace {
inline void copyAndClampLine(const float *src, unsigned char *dst, const int W) inline void copyAndClampLine(const float *src, unsigned char *dst, const int W)

View File

@ -18,16 +18,17 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifdef _OPENMP #include "color.h"
#include <omp.h> #include "curves.h"
#endif
#include "improcfun.h"
#include "guidedfilter.h" #include "guidedfilter.h"
#include "iccstore.h"
#include "improcfun.h"
#include "labimage.h"
#include "procparams.h" #include "procparams.h"
#include "sleef.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
#include "sleef.c"
namespace { namespace {
@ -51,7 +52,8 @@ void fastlin2log(float *x, float factor, float base, int w)
} }
namespace rtengine { namespace rtengine
{
void ImProcFunctions::labColorCorrectionRegions(LabImage *lab) void ImProcFunctions::labColorCorrectionRegions(LabImage *lab)
{ {

View File

@ -22,22 +22,17 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifdef _OPENMP
#include <omp.h>
#endif
#include "array2D.h" #include "array2D.h"
#include "gauss.h" #include "gauss.h"
#include "labimage.h"
#include "improcfun.h" #include "improcfun.h"
#include "procparams.h" #include "procparams.h"
#include "settings.h"
namespace rtengine namespace rtengine
{ {
extern const Settings* settings;
LocallabParams locallab; ///< Local lab parameters
void ImProcFunctions::localContrast(LabImage *lab, float **destination, const LocalContrastParams &localContrastParams, bool fftwlc, double scale) void ImProcFunctions::localContrast(LabImage *lab, float **destination, const rtengine::procparams::LocalContrastParams &localContrastParams, bool fftwlc, double scale)
{ {
if (!localContrastParams.enabled) { if (!localContrastParams.enabled) {
return; return;

View File

@ -24,13 +24,17 @@
#include <fftw3.h> #include <fftw3.h>
#include "improcfun.h" #include "improcfun.h"
#include "colortemp.h"
#include "curves.h" #include "curves.h"
#include "gauss.h" #include "gauss.h"
#include "iccmatrices.h" #include "iccstore.h"
#include "imagefloat.h"
#include "labimage.h"
#include "color.h" #include "color.h"
#include "rt_math.h" #include "rt_math.h"
#include "jaggedarray.h" #include "jaggedarray.h"
#include "rt_algo.h" #include "rt_algo.h"
#include "settings.h"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
@ -179,9 +183,6 @@ extern MyMutex *fftwMutex;
using namespace procparams; using namespace procparams;
extern const Settings* settings;
struct local_params { struct local_params {
float yc, xc; float yc, xc;
float ycbuf, xcbuf; float ycbuf, xcbuf;

View File

@ -20,10 +20,12 @@
#include "improcfun.h" #include "improcfun.h"
#include "alignedbuffer.h" #include "alignedbuffer.h"
#include "imagefloat.h"
#include "labimage.h"
#include "opthelper.h" #include "opthelper.h"
#include "rt_math.h" #include "rt_math.h"
#include "procparams.h" #include "procparams.h"
#include "sleef.c" #include "sleef.h"
//#define PROFILE //#define PROFILE

View File

@ -41,8 +41,11 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "color.h"
#include "curves.h"
#include "gauss.h" #include "gauss.h"
#include "improcfun.h" #include "improcfun.h"
#include "labimage.h"
#include "median.h" #include "median.h"
#include "opthelper.h" #include "opthelper.h"
#include "procparams.h" #include "procparams.h"
@ -181,9 +184,7 @@ void mean_stddv2(float **dst, float &mean, float &stddv, int W_L, int H_L, float
namespace rtengine namespace rtengine
{ {
extern const Settings* settings; void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, const LUTf& mapcurve, bool mapcontlutili, int width, int height, const procparams::RetinexParams &deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, const LUTf& mapcurve, bool mapcontlutili, int width, int height, const RetinexParams &deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax)
{ {
BENCHFUN BENCHFUN

View File

@ -20,11 +20,15 @@
#include "improcfun.h" #include "improcfun.h"
#include "color.h"
#include "curves.h"
#include "gauss.h" #include "gauss.h"
#include "guidedfilter.h" #include "guidedfilter.h"
#include "iccstore.h"
#include "labimage.h"
#include "opthelper.h" #include "opthelper.h"
#include "procparams.h" #include "procparams.h"
#include "sleef.c" #include "sleef.h"
namespace rtengine { namespace rtengine {
//modifications to pass parameters needs by locallab, to avoid 2 functions - no change in process - J.Desmis march 2019 //modifications to pass parameters needs by locallab, to avoid 2 functions - no change in process - J.Desmis march 2019

View File

@ -17,22 +17,27 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "improcfun.h"
#include "gauss.h"
#include "bilateral2.h" #include "bilateral2.h"
#include "cieimage.h"
#include "gauss.h"
#include "improcfun.h"
#include "jaggedarray.h" #include "jaggedarray.h"
#include "rt_math.h" #include "labimage.h"
#include "procparams.h"
#include "sleef.c"
#include "opthelper.h" #include "opthelper.h"
#include "procparams.h"
#include "rt_algo.h"
#include "rt_math.h"
#include "settings.h"
#include "sleef.h"
//#define BENCHMARK //#define BENCHMARK
#include "StopWatch.h" #include "StopWatch.h"
#include "rt_algo.h"
using namespace std; using namespace std;
namespace { namespace {
void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, float** blend, int W, int H, const SharpeningParams &sharpenParam) void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, float** blend, int W, int H, const procparams::SharpeningParams &sharpenParam)
{ {
const float scale = (100.f - sharpenParam.halocontrol_amount) * 0.01f; const float scale = (100.f - sharpenParam.halocontrol_amount) * 0.01f;
@ -156,9 +161,7 @@ void dcdamping (float** aI, float** aO, float damping, int W, int H)
namespace rtengine namespace rtengine
{ {
extern const Settings* settings; void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, const float * const * blend, int W, int H, const procparams::SharpeningParams &sharpenParam, double Scale)
void ImProcFunctions::deconvsharpening (float** luminance, float** tmp, const float * const * blend, int W, int H, const SharpeningParams &sharpenParam, double Scale)
{ {
if (sharpenParam.deconvamount == 0 && sharpenParam.blurradius < 0.25f) { if (sharpenParam.deconvamount == 0 && sharpenParam.blurradius < 0.25f) {
return; return;
@ -342,10 +345,7 @@ void ImProcFunctions::deconvsharpeningloc (float** luminance, float** tmp, int W
} }
void ImProcFunctions::sharpening (LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask)
void ImProcFunctions::sharpening (LabImage* lab, const SharpeningParams &sharpenParam, bool showMask)
{ {
if ((!sharpenParam.enabled) || sharpenParam.amount < 1 || lab->W < 8 || lab->H < 8) { if ((!sharpenParam.enabled) || sharpenParam.amount < 1 || lab->W < 8 || lab->H < 8) {

View File

@ -19,7 +19,10 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "color.h"
#include "iccstore.h"
#include "improcfun.h" #include "improcfun.h"
#include "labimage.h"
#include "procparams.h" #include "procparams.h"
@ -59,7 +62,7 @@ inline vfloat sl(vfloat blend, vfloat x)
//} // namespace //} // namespace
void ImProcFunctions::softLight(LabImage *lab, const SoftLightParams &softLightParams) void ImProcFunctions::softLight(LabImage *lab, const rtengine::procparams::SoftLightParams &softLightParams)
{ {
if (!softLightParams.enabled || !softLightParams.strength) { if (!softLightParams.enabled || !softLightParams.strength) {
return; return;

View File

@ -16,9 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef _IPTCPAIRS_ #pragma once
#define _IPTCPAIRS_
struct IptcPair { struct IptcPair {
IptcTag tag; IptcTag tag;
@ -44,6 +42,3 @@ const IptcPair strTags[] = {
{IPTC_TAG_ORIG_TRANS_REF, 32, "TransReference"}, {IPTC_TAG_ORIG_TRANS_REF, 32, "TransReference"},
{IPTC_TAG_DATE_CREATED, 8, "DateCreated"} {IPTC_TAG_DATE_CREATED, 8, "DateCreated"}
}; };
#endif

View File

@ -18,18 +18,14 @@
*/ */
#include <array> #include <array>
#ifdef _OPENMP #include "imagefloat.h"
#include <omp.h>
#endif
#include "improcfun.h" #include "improcfun.h"
#include "mytime.h"
#include "procparams.h" #include "procparams.h"
#include "rt_math.h" #include "rt_math.h"
#include "rtengine.h" #include "rtengine.h"
#include "rtlensfun.h" #include "rtlensfun.h"
#include "sleef.c" #include "sleef.h"
using namespace std; using namespace std;

Some files were not shown because too many files have changed in this diff Show More