Merge pull request #3798 from Beep6581/wallfix

Compiling with -Wall shows a large amount of warnings which should be fixed , fixes #3790
This commit is contained in:
Ingo Weyrich 2017-04-05 12:26:23 +02:00 committed by GitHub
commit aaf5f80645
82 changed files with 617 additions and 647 deletions

View File

@ -296,7 +296,7 @@ endif (WITH_PROF)
if (OPTION_OMP)
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -Werror=unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -Werror=unknown-pragmas -Wall -Wno-unused-result -Wno-deprecated-declarations")
endif (OPENMP_FOUND)
endif (OPTION_OMP)

View File

@ -241,7 +241,6 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const
for (int row = rr + top, cc = ccmin; cc < ccmax; cc++) {
int col = cc + left;
int c = FC(rr, cc);
int indx = row * width + col;
int indx1 = rr * ts + cc;
rgb[c][indx1] = (rawData[row][col]) / 65535.0f;
}
@ -966,10 +965,9 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const
// copy CA corrected results to temporary image matrix
for (int rr = border; rr < rr1 - border; rr++) {
int c = FC(rr + top, left + border + FC(rr + top, 2) & 1);
int c = FC(rr + top, left + border + (FC(rr + top, 2) & 1));
for (int row = rr + top, cc = border + (FC(rr, 2) & 1), indx = (row * width + cc + left) >> 1; cc < cc1 - border; cc += 2, indx++) {
int col = cc + left;
RawDataTmp[indx] = 65535.0f * rgb[c][(rr) * ts + cc] + 0.5f;
}
}

View File

@ -21,7 +21,7 @@ Takes less memory with OkToModify_b = true, and Preconditioner = nullptr. */
float *SparseConjugateGradient(void Ax(float *Product, float *x, void *Pass), float *b, int n, bool OkToModify_b,
float *x, float RMSResidual, void *Pass, int MaximumIterates, void Preconditioner(float *Product, float *x, void *Pass))
{
int iterate, i;
int iterate;
float* buffer = (float*)malloc(2 * n * sizeof(float) + 128);
float *r = (buffer + 16);
@ -411,7 +411,7 @@ bool MultiDiagonalSymmetricMatrix::CreateIncompleteCholeskyFactorization(int Max
//How many diagonals in the decomposition?
MaxFillAbove++; //Conceptually, now "fill" includes an existing diagonal. Simpler in the math that follows.
int i, j, mic, fp;
int j, mic, fp;
mic = 1;
fp = 1;
@ -441,8 +441,8 @@ bool MultiDiagonalSymmetricMatrix::CreateIncompleteCholeskyFactorization(int Max
}
//It's all initialized? Uhkay. Do the actual math then.
int sss, ss;
int MaxStartRow = StartRows[m - 1]; //Handy number.
int sss;
// int MaxStartRow = StartRows[m - 1]; //Handy number.
float **l = ic->Diagonals;
float *d = ic->Diagonals[0]; //Describes D in LDLt.
int icm = ic->m;

View File

@ -125,7 +125,7 @@ void ImProcFunctions::Median_Denoise(float **src, float **dst, const int width,
medBuffer[1] = dst;
}
float ** medianIn, ** medianOut;
float ** medianIn, ** medianOut = nullptr;
int BufferIndex = 0;
for (int iteration = 1; iteration <= iterations; ++iteration) {
@ -454,10 +454,10 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef
const bool useNoiseLCurve = (noiseLCurve && noiseLCurve.getSum() >= 7.f);
const bool autoch = (settings->leveldnautsimpl == 1 && (dnparams.Cmethod == "AUT" || dnparams.Cmethod == "PRE")) || (settings->leveldnautsimpl == 0 && (dnparams.C2method == "AUTO" || dnparams.C2method == "PREV"));
float** lumcalc;
float* lumcalcBuffer;
float** ccalc;
float* ccalcBuffer;
float** lumcalc = nullptr;
float* lumcalcBuffer = nullptr;
float** ccalc = nullptr;
float* ccalcBuffer = nullptr;
bool ponder = false;
float ponderCC = 1.f;
@ -518,7 +518,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef
ccalc[i] = ccalcBuffer + (i * wid);
}
float cn100Precalc;
float cn100Precalc = 0.f;
if (useNoiseCCurve) {
cn100Precalc = SQR(1.f + ponderCC * (4.f * noiseCCurve[100.f / 60.f]));

View File

@ -599,7 +599,7 @@ public:
vint sumv = (vint)ZEROV;
vfloat avgv = ZEROV;
for(; i < size - 3; i += 4) {
for(; i < static_cast<int>(size) - 3; i += 4) {
vint datav = _mm_loadu_si128((__m128i*)&data[i]);
sumv += datav;
avgv += iv * _mm_cvtepi32_ps(datav);
@ -611,7 +611,7 @@ public:
avg = vhadd(avgv);
#endif
for (; i < size; i++) {
for (; i < static_cast<int>(size); i++) {
T val = data[i];
sum += val;
avg += i * val;

View File

@ -113,7 +113,7 @@ public:
// use as empty declaration, resize before use!
// very useful as a member object
array2D() :
x(0), y(0), owner(0), ptr(nullptr), data(nullptr), lock(0), flags(0)
x(0), y(0), owner(0), flags(0), ptr(nullptr), data(nullptr), lock(0)
{
//printf("got empty array2D init\n");
}

View File

@ -32,7 +32,7 @@ bool loadFile(
bool res = false;
if (fw == fh) {
unsigned int level = 1;
int level = 1;
while (level * level * level < fw) {
++level;

View File

@ -1530,7 +1530,7 @@ void Color::interpolateRGBColor (float realL, float iplow, float iphigh, int alg
int toDo, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float &ro, float &go, float &bo)
{
float X1, Y1, Z1, X2, Y2, Z2, X, Y, Z, XL, YL, ZL;
float L1, L2, LL, a_1 = 0.f, b_1 = 0.f, a_2, b_2, a_L, b_L;
float L1 = 0.f, L2, LL, a_1 = 0.f, b_1 = 0.f, a_2, b_2, a_L, b_L;
// converting color 1 to Lab (image)
Color::rgbxyz(r1, g1, b1, X1, Y1, Z1, xyz_rgb);

View File

@ -309,8 +309,6 @@ double xyCoordToTemperature(const std::array<double, 2>& white_xy)
{ 600, 0.33724, 0.36051, -116.45 }
};
constexpr double tint_scale = -3000.0;
double res = 0;
// Convert to uv space.
@ -847,7 +845,7 @@ DCPProfile::DCPProfile(const Glib::ustring& filename) :
// Saturation maps. Need to be unwinded.
tag = tagDir->getTag(toUnderlying(TagKey::PROFILE_HUE_SAT_MAP_DATA_2));
for (int i = 0; i < delta_info.array_count; ++i) {
for (unsigned int i = 0; i < delta_info.array_count; ++i) {
deltas_2[i].hue_shift = tag->toDouble((i * 3) * tiff_float_size);
deltas_2[i].sat_scale = tag->toDouble((i * 3 + 1) * tiff_float_size);
deltas_2[i].val_scale = tag->toDouble((i * 3 + 2) * tiff_float_size);

View File

@ -1,3 +1,14 @@
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wparentheses"
#if (__GNUC__ == 6)
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#endif
#endif
/*RT*/#include <glib.h>
/*RT*/#include <glib/gstdio.h>
/*RT*/#undef MAX
@ -251,7 +262,11 @@ void CLASS derror()
if (feof(ifp))
fprintf (stderr,_("Unexpected end of file\n"));
else
#ifdef WIN32
fprintf (stderr,_("Corrupt data near 0x%I64x\n"), (INT64) ftello(ifp));
#else
fprintf (stderr,_("Corrupt data near 0x%llx\n"), (INT64) ftello(ifp));
#endif
}
data_error++;
/*RT Issue 2467 longjmp (failure, 1);*/
@ -1840,8 +1855,8 @@ void CLASS parse_hasselblad_gain()
not be seen as clipped).
*/
ushort raw_h, count, ch_count, u16;
int i, offset;
ushort raw_h;
int offset;
off_t base;
base = ftell(ifp);
@ -5897,7 +5912,7 @@ int CLASS parse_tiff_ifd (int base)
break;
case 33422: /* CFAPattern */
if (filters == 9) {
FORC(36) ((char *)xtrans)[c] = fgetc(ifp) & 3;
FORC(36) ((int *)xtrans)[c] = fgetc(ifp) & 3;
break;
}
case 64777: /* Kodak P-series */
@ -9020,7 +9035,7 @@ canon_a5:
}
if (fuji_layout) raw_width *= is_raw;
if (filters == 9)
FORC(36) ((char *)xtrans)[c] =
FORC(36) ((int *)xtrans)[c] =
xtrans_abs[(c/6+top_margin) % 6][(c+left_margin) % 6];
} else if (!strcmp(model,"KD-400Z")) {
height = 1712;
@ -9881,3 +9896,6 @@ struct tiff_hdr {
/*RT*/#undef LIM
/*RT*/#undef ULIM
/*RT*/#undef CLIP
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

View File

@ -76,7 +76,8 @@ protected:
FILE *ofp;
short order;
const char *ifname;
char *meta_data, xtrans[6][6],xtrans_abs[6][6];
char *meta_data;
int xtrans[6][6],xtrans_abs[6][6];
char cdesc[5], desc[512], make[64], model[64], model2[64], model3[64], artist[64];
float flash_used, canon_ev, iso_speed, shutter, aperture, focal_len;
time_t timestamp;

View File

@ -806,7 +806,6 @@ void Crop::update (int todo)
bool wavcontlutili = parent->wavcontlutili;
LUTu dummy;
int moderetinex;
// parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1);
parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy);
parent->ipf.vibrance (labnCrop);

View File

@ -1,4 +1,3 @@
/*
/*
* This file is part of RawTherapee.
*
@ -602,7 +601,7 @@ void RawImageSource::vng4_demosaic ()
const unsigned prefilters = ri->prefilters;
const int width = W, height = H;
const int colors = 4;
constexpr unsigned int colors = 4;
float (*image)[4];
image = (float (*)[4]) calloc (height * width, sizeof * image);
@ -648,7 +647,7 @@ void RawImageSource::vng4_demosaic ()
int colcount = 0;
for (int c = 0; c < colors; c++)
for (unsigned int c = 0; c < colors; c++)
if (c != fc(row, col)) {
*ip++ = c;
csum[row][col][colcount] = sum[c];
@ -671,7 +670,7 @@ void RawImageSource::vng4_demosaic ()
sum[ip[1]] += pix[ip[0]] * mul[row & 15][col & 15][i];
}
for (int i = 0; i < colors - 1; i++, ip++) {
for (unsigned int i = 0; i < colors - 1; i++, ip++) {
pix[ip[0]] = sum[ip[0]] / csum[row & 15][col & 15][i];
}
}
@ -694,7 +693,7 @@ void RawImageSource::vng4_demosaic ()
int x2 = *cp++;
int weight = *cp++;
int grads = *cp++;
int color = fc(row + y1, col + x1);
unsigned int color = fc(row + y1, col + x1);
if (fc(row + y2, col + x2) != color) {
continue;
@ -724,7 +723,7 @@ void RawImageSource::vng4_demosaic ()
int y = *cp++;
int x = *cp++;
*ip++ = (y * width + x) * 4;
int color = fc(row, col);
unsigned int color = fc(row, col);
if (fc(row + y, col + x) != color && fc(row + y * 2, col + x * 2) == color) {
*ip++ = (y * width + x) * 8 + color;
@ -878,7 +877,7 @@ void RawImageSource::vng4_demosaic ()
#define fc(row,col) \
(ri->get_filters() >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)
#define FORCC for (int c=0; c < colors; c++)
#define FORCC for (unsigned int c=0; c < colors; c++)
/*
Patterned Pixel Grouping Interpolation by Alain Desbiolles
@ -887,7 +886,7 @@ void RawImageSource::ppg_demosaic()
{
int width = W, height = H;
int dir[5] = { 1, width, -1, -width, 1 };
int row, col, diff[2], guess[2], c, d, i;
int row, col, diff[2] = {}, guess[2], c, d, i;
float (*pix)[4];
float (*image)[4];
@ -998,7 +997,7 @@ void RawImageSource::ppg_demosaic()
void RawImageSource::border_interpolate(unsigned int border, float (*image)[4], unsigned int start, unsigned int end)
{
unsigned row, col, y, x, f, c, sum[8];
unsigned row, col, y, x, f, sum[8];
unsigned int width = W, height = H;
unsigned int colors = 3;
@ -1338,8 +1337,8 @@ SSEFUNCTION void RawImageSource::lmmse_interpolate_omp(int winw, int winh, array
h2 /= hs;
h3 /= hs;
h4 /= hs;
int passref;
int iter;
int passref = 0;
int iter = 0;
if(iterations <= 4) {
iter = iterations - 1;
@ -2631,7 +2630,7 @@ void RawImageSource::ahd_demosaic(int winx, int winy, int winw, int winh)
int width = W, height = H;
float (*image)[4];
int colors = 3;
unsigned int colors = 3;
const double xyz_rgb[3][3] = { /* XYZ from RGB */
{ 0.412453, 0.357580, 0.180423 },
@ -2661,7 +2660,7 @@ void RawImageSource::ahd_demosaic(int winx, int winy, int winw, int winh)
}
for (i = 0; i < 3; i++)
for (j = 0; j < colors; j++)
for (unsigned int j = 0; j < colors; j++)
for (xyz_cam[i][j] = k = 0; k < 3; k++) {
xyz_cam[i][j] += xyz_rgb[i][k] * imatrices.rgb_cam[k][j] / d65_white[i];
}
@ -3293,12 +3292,12 @@ void RawImageSource::fill_raw( float (*cache )[3], int x0, int y0, float** rawDa
void RawImageSource::fill_border( float (*cache )[3], int border, int x0, int y0)
{
unsigned row, col, y, x, f, c;
unsigned f;
float sum[8];
const unsigned int colors = 3; // used in FORCC
constexpr unsigned int colors = 3; // used in FORCC
for (row = y0; row < y0 + TILESIZE + TILEBORDER && row < H; row++) {
for (col = x0; col < x0 + TILESIZE + TILEBORDER && col < W; col++) {
for (int row = y0; row < y0 + TILESIZE + TILEBORDER && row < H; row++) {
for (int col = x0; col < x0 + TILESIZE + TILEBORDER && col < W; col++) {
if (col >= border && col < W - border && row >= border && row < H - border) {
col = W - border;
@ -3309,8 +3308,8 @@ void RawImageSource::fill_border( float (*cache )[3], int border, int x0, int y0
memset(sum, 0, sizeof sum);
for (y = row - 1; y != row + 2; y++)
for (x = col - 1; x != col + 2; x++)
for (int y = row - 1; y != row + 2; y++)
for (int x = col - 1; x != col + 2; x++)
if (y < H && y < y0 + TILESIZE + TILEBORDER && x < W && x < x0 + TILESIZE + TILEBORDER) {
f = fc(y, x);
sum[f] += cache[(y - y0 + TILEBORDER) * CACHESIZE + TILEBORDER + x - x0][f];
@ -3361,13 +3360,13 @@ void RawImageSource::restore_from_buffer(float (*image)[3], float (*buffer)[2])
void RawImageSource::dcb_hid(float (*image)[3], int x0, int y0)
{
const int u = CACHESIZE;
int rowMin, colMin, rowMax, colMax, c;
int rowMin, colMin, rowMax, colMax;
dcb_initTileLimits(colMin, rowMin, colMax, rowMax, x0, y0, 2);
// simple green bilinear in R and B pixels
for (int row = rowMin; row < rowMax; row++)
for (int col = colMin + (FC(y0 - TILEBORDER + row, x0 - TILEBORDER + colMin) & 1), indx = row * CACHESIZE + col, c = FC(y0 - TILEBORDER + row, x0 - TILEBORDER + col); col < colMax; col += 2, indx += 2) {
assert(indx - u - 1 >= 0 && indx + u + 1 < u * u && c >= 0 && c < 3);
for (int col = colMin + (FC(y0 - TILEBORDER + row, x0 - TILEBORDER + colMin) & 1), indx = row * CACHESIZE + col; col < colMax; col += 2, indx += 2) {
assert(indx - u - 1 >= 0 && indx + u + 1 < u * u);
image[indx][1] = 0.25*(image[indx-1][1]+image[indx+1][1]+image[indx-u][1]+image[indx+u][1]);
}
@ -3418,13 +3417,13 @@ void RawImageSource::dcb_color(float (*image)[3], int x0, int y0)
// green correction
void RawImageSource::dcb_hid2(float (*image)[3], int x0, int y0)
{
const int u = CACHESIZE, v = 2 * CACHESIZE;
const int v = 2 * CACHESIZE;
int rowMin, colMin, rowMax, colMax;
dcb_initTileLimits(colMin, rowMin, colMax, rowMax, x0, y0, 2);
for (int row = rowMin; row < rowMax; row++) {
for (int col = colMin + (FC(y0 - TILEBORDER + row, x0 - TILEBORDER + colMin) & 1), indx = row * CACHESIZE + col, c = FC(y0 - TILEBORDER + row, x0 - TILEBORDER + col); col < colMax; col += 2, indx += 2) {
assert(indx - v >= 0 && indx + v < u * u);
assert(indx - v >= 0 && indx + v < CACHESIZE * CACHESIZE);
//Jacek comment: one multiplication less
image[indx][1] = image[indx][c] +
@ -3592,11 +3591,11 @@ void RawImageSource::dcb_correction2(float (*image)[3], uint8_t *map, int x0, in
// image refinement
void RawImageSource::dcb_refinement(float (*image)[3], uint8_t *map, int x0, int y0)
{
const int u = CACHESIZE, v = 2 * CACHESIZE, w = 3 * CACHESIZE;
const int u = CACHESIZE, v = 2 * CACHESIZE;
int rowMin, colMin, rowMax, colMax;
dcb_initTileLimits(colMin, rowMin, colMax, rowMax, x0, y0, 4);
float f0, f1, f2, g1, h0, h1, h2, g2, current;
float f0, f1, f2, g1, h0, h1, h2, g2;
for (int row = rowMin; row < rowMax; row++)
for (int col = colMin + (FC(y0 - TILEBORDER + row, x0 - TILEBORDER + colMin) & 1), indx = row * CACHESIZE + col, c = FC(y0 - TILEBORDER + row, x0 - TILEBORDER + col); col < colMax; col += 2, indx += 2) {
@ -3937,7 +3936,7 @@ void RawImageSource::xtransborder_interpolate (int border)
{
const int height = H, width = W;
char xtrans[6][6];
int xtrans[6][6];
ri->getXtransMatrix(xtrans);
for (int row = 0; row < height; row++)
@ -4001,7 +4000,7 @@ void RawImageSource::xtrans_interpolate (const int passes, const bool useCieLab)
plistener->setProgress (progress);
}
char xtrans[6][6];
int xtrans[6][6];
ri->getXtransMatrix(xtrans);
constexpr short orth[12] = { 1, 0, 0, 1, -1, 0, 0, -1, 1, 0, 0, 1 },
@ -4012,7 +4011,7 @@ void RawImageSource::xtrans_interpolate (const int passes, const bool useCieLab)
// sgrow/sgcol is the offset in the sensor matrix of the solitary
// green pixels
ushort sgrow, sgcol;
ushort sgrow = 0, sgcol = 0;
const int height = H, width = W;
@ -4721,17 +4720,16 @@ void RawImageSource::xtrans_interpolate (const int passes, const bool useCieLab)
/* Average the most homogeneous pixels for the final result: */
uint8_t hm[8];
uint8_t hm[8] = {};
for (int row = MIN(top, 8); row < mrow - 8; row++)
for (int col = MIN(left, 8); col < mcol - 8; col++) {
int d = 0;
for (; d < 4; d++) {
for (int d = 0; d < 4; d++) {
hm[d] = homosum[d][row][col];
}
for (; d < ndir; d++) {
for (int d = 4; d < ndir; d++) {
hm[d] = homosum[d][row][col];
if (hm[d - 4] < hm[d]) {
@ -4745,7 +4743,7 @@ void RawImageSource::xtrans_interpolate (const int passes, const bool useCieLab)
uint8_t maxval = homosummax[row][col];
for (d = 0; d < ndir; d++)
for (int d = 0; d < ndir; d++)
if (hm[d] >= maxval) {
FORC3 avg[c] += rgb[d][row][col][c];
avg[3]++;
@ -4792,7 +4790,7 @@ void RawImageSource::fast_xtrans_interpolate ()
const int height = H, width = W;
xtransborder_interpolate (1);
char xtrans[6][6];
int xtrans[6][6];
ri->getXtransMatrix(xtrans);
#pragma omp parallel for

View File

@ -149,7 +149,7 @@ SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst,
level ++;
}
float **tmpHue, **tmpChr;
float **tmpHue = nullptr, **tmpChr = nullptr;
if(skinprot != 0.f) {
// precalculate hue and chroma, use SSE, if available

View File

@ -277,7 +277,6 @@ SSEFUNCTION void RawImageSource::fast_demosaic(int winx, int winy, int winw, int
int j, cc;
__m128 wtuv, wtdv, wtlv, wtrv;
__m128 greenv, tempv, absv, abs2v;
__m128 onev = _mm_set1_ps( 1.0f );
__m128 c16v = _mm_set1_ps( 16.0f );
__m128 fourv = _mm_set1_ps( 4.0f );
vmask selmask;

View File

@ -20,7 +20,7 @@ it under the terms of the one of three licenses as you choose:
void CLASS init_fuji_compr (struct fuji_compressed_params* info)
{
int cur_val, i;
int cur_val;
char *qt;
if ((fuji_block_width % 3 && fuji_raw_type == 16) || (fuji_block_width & 1 && fuji_raw_type == 0)) {
@ -171,7 +171,7 @@ void CLASS copy_line_to_xtrans (struct fuji_compressed_block* info, int cur_line
while (row_count < 6) {
pixel_count = 0;
while (pixel_count < cur_block_width) {
while (static_cast<int>(pixel_count) < cur_block_width) {
switch (xtrans_abs[row_count][ (pixel_count % 6)]) {
case 0: // red
line_buf = lineBufR[row_count >> 1];
@ -182,11 +182,12 @@ void CLASS copy_line_to_xtrans (struct fuji_compressed_block* info, int cur_line
break;
case 2: // blue
default:
line_buf = lineBufB[row_count >> 1];
break;
}
index = (((pixel_count * 2 / 3) & 0x7FFFFFFE) | (pixel_count % 3) & 1) + ((pixel_count % 3) >> 1);
index = (((pixel_count * 2 / 3) & 0x7FFFFFFE) | ((pixel_count % 3) & 1)) + ((pixel_count % 3) >> 1);
raw_block_data[pixel_count] = line_buf[index];
++pixel_count;
@ -228,7 +229,7 @@ void CLASS copy_line_to_bayer (struct fuji_compressed_block *info, int cur_line,
while (row_count < 6) {
pixel_count = 0;
while (pixel_count < cur_block_width) {
while (static_cast<int>(pixel_count) < cur_block_width) {
switch (fuji_bayer[row_count & 1][pixel_count & 1]) {
case 0: // red
line_buf = lineBufR[row_count >> 1];
@ -897,12 +898,11 @@ void CLASS fuji_compressed_load_raw()
{
struct fuji_compressed_params common_info;
int cur_block;
unsigned line_size, *block_sizes;
unsigned *block_sizes;
INT64 raw_offset, *raw_block_offsets;
//struct fuji_compressed_block info;
init_fuji_compr (&common_info);
line_size = sizeof (ushort) * (common_info.line_width + 2);
// read block sizes
block_sizes = (unsigned*) malloc (sizeof (unsigned) * fuji_total_blocks);

View File

@ -231,8 +231,8 @@ template<class T> void gaussHorizontal3 (T** src, T** dst, int W, int H, const f
#ifdef __SSE2__
template<class T> SSEFUNCTION void gaussVertical3 (T** src, T** dst, int W, int H, const float c0, const float c1)
{
vfloat Tv, Tm1v, Tp1v;
vfloat Tv1, Tm1v1, Tp1v1;
vfloat Tv = F2V(0.f), Tm1v, Tp1v;
vfloat Tv1 = F2V(0.f), Tm1v1, Tp1v1;
vfloat c0v, c1v;
c0v = F2V(c0);
c1v = F2V(c1);
@ -921,7 +921,7 @@ template<class T> void gaussVertical (T** src, T** dst, const int W, const int H
#pragma omp for nowait
#endif
for (int i = 0; i < W - numcols + 1; i += numcols) {
for (unsigned int i = 0; i < static_cast<unsigned>(std::max(0, W - numcols + 1)); i += numcols) {
for (int k = 0; k < numcols; k++) {
temp2[0][k] = B * src[0][i + k] + b1 * src[0][i + k] + b2 * src[0][i + k] + b3 * src[0][i + k];
temp2[1][k] = B * src[1][i + k] + b1 * temp2[0][k] + b2 * src[0][i + k] + b3 * src[0][i + k];

View File

@ -398,23 +398,20 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b
int height = H;
int width = W;
static const int range = 2;
static const int pitch = 4;
constexpr int range = 2;
constexpr int pitch = 4;
static const int numdirs = 4;
static const float threshpct = 0.25f;
static const float fixthreshpct = 0.7f;
static const float maxpct = 0.95f;
static const float epsilon = 0.00001f;
constexpr float threshpct = 0.25f;
constexpr float maxpct = 0.95f;
constexpr float epsilon = 0.00001f;
//%%%%%%%%%%%%%%%%%%%%
//for blend algorithm:
static const float blendthresh = 1.0;
static const int ColorCount = 3;
constexpr float blendthresh = 1.0;
constexpr int ColorCount = 3;
// Transform matrixes rgb>lab and back
static const float trans[ColorCount][ColorCount] =
constexpr float trans[ColorCount][ColorCount] =
{ { 1.f, 1.f, 1.f }, { 1.7320508f, -1.7320508f, 0.f }, { -1.f, -1.f, 2.f } };
static const float itrans[ColorCount][ColorCount] =
constexpr float itrans[ColorCount][ColorCount] =
{ { 1.f, 0.8660254f, -0.5f }, { 1.f, -0.8660254f, -0.5f }, { 1.f, 0.f, 1.f } };
if(settings->verbose)

View File

@ -216,9 +216,8 @@ int ImageIO::getPNGSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat,
//reading PNG header
unsigned char header[8];
fread (header, 1, 8, file);
if (png_sig_cmp (header, 0, 8)) {
if (fread (header, 1, 8, file) != 8 || png_sig_cmp (header, 0, 8)) {
fclose(file);
return IMIO_HEADERERROR;
}
@ -295,9 +294,8 @@ int ImageIO::loadPNG (Glib::ustring fname)
//reading PNG header
unsigned char header[8];
fread (header, 1, 8, file);
if (png_sig_cmp (header, 0, 8)) {
if (fread (header, 1, 8, file) != 8 || png_sig_cmp (header, 0, 8)) {
fclose(file);
return IMIO_HEADERERROR;
}
@ -1245,7 +1243,7 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed)
// The maximum lenght is strangely not the same than for the JPEG file...
// Which maximum length is the good one ?
if (size > 0 && size <= bufferSize) {
if (size > 0 && size <= static_cast<int>(bufferSize)) {
fwrite (buffer, size, 1, file);
}

View File

@ -38,7 +38,6 @@ ImProcCoordinator::ImProcCoordinator ()
softProof(false), gamutCheck(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false),
allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN),
ctColorCurve(),
hltonecurve(65536),
shtonecurve(65536),
tonecurve(65536, 0), //,1);
@ -48,6 +47,7 @@ ImProcCoordinator::ImProcCoordinator ()
satcurve(65536, 0),
lhskcurve(65536, 0),
clcurve(65536, 0),
conversionBuffer(1, 1),
wavclCurve(65536, 0),
clToningcurve(65536, 0),
cl2Toningcurve(65536, 0),
@ -81,15 +81,16 @@ ImProcCoordinator::ImProcCoordinator ()
rCurve(),
gCurve(),
bCurve(),
ctColorCurve(),
rcurvehist(256), rcurvehistCropped(256), rbeforehist(256),
gcurvehist(256), gcurvehistCropped(256), gbeforehist(256),
bcurvehist(256), bcurvehistCropped(256), bbeforehist(256),
fw(0), fh(0), tr(0),
fullw(1), fullh(1),
pW(-1), pH(-1),
plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), hListener(nullptr),
resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), wavcontlutili(false),
butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), conversionBuffer(1, 1), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f)
plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr),
resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false),
butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), wavcontlutili(false), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f)
{}
void ImProcCoordinator::assign (ImageSource* imgsrc)

View File

@ -246,9 +246,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
//end preparate histogram
int width = lab->W, height = lab->H;
float minQ = 10000.f;
float minM = 10000.f;
float maxQ = -1000.f;
float maxM = -1000.f;
float w_h;
float a_w;
float c_;
@ -256,9 +254,9 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
double Yw;
Yw = 1.0;
double Xw, Zw;
double f, c, nc, yb, la, xw, yw, zw, f2, c2, nc2, yb2, la2;
double f, c, nc, yb = 0., la, xw, yw, zw, f2 = 0., c2 = 0., nc2 = 0., yb2 = 0., la2;
double fl, n, nbb, ncb, aw;
double xwd, ywd, zwd;
double xwd = 0., ywd, zwd = 0.;
int alg = 0;
bool algepd = false;
float sum = 0.f;
@ -1199,9 +1197,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
float t_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[1]) / 100.0f;
float b_r = static_cast<float>(params->dirpyrequalizer.hueskin.value[2]) / 100.0f;
float t_r = static_cast<float>(params->dirpyrequalizer.hueskin.value[3]) / 100.0f;
int choice = 0;
bool alread = false;
float artifact = (float) settings->artifact_cbdl;
if(artifact > 6.f) {
@ -1216,7 +1212,6 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh
float chrom = 50.f;
{
ImProcFunctions::badpixcam (ncie, artifact, 5, 2 , b_l, t_l, t_r, b_r, params->dirpyrequalizer.skinprotect , chrom, hotbad); //enabled remove artifacts for cbDL
alread = true;
}
}
}
@ -1479,7 +1474,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int
float Yw;
Yw = 1.0;
double Xw, Zw;
float f, nc, yb, la, c, xw, yw, zw, f2, c2, nc2, yb2;
float f, nc, yb = 0.f, la, c, xw, yw, zw, f2 = 1.f, c2 = 1.f, nc2 = 1.f, yb2;
float fl, n, nbb, ncb, aw; //d
float xwd, ywd, zwd;
int alg = 0;
@ -1658,24 +1653,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int
// extracting datas from 'params' to avoid cache flush (to be confirmed)
const ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode;
const bool hasColCurve1 = bool(customColCurve1);
bool t1L = false;
bool t1B = false;
if (hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_LIGHT) {
t1L = true;
}
if(hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) {
t1B = true;
}
const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_LIGHT;
const ColorAppearanceParams::eTCModeId curveMode2 = params->colorappearance.curveMode2;
const bool hasColCurve2 = bool(customColCurve2);
bool t2B = false;
if(hasColCurve2 && curveMode2 == ColorAppearanceParams::TC_MODE_BRIGHT) {
t2B = true;
}
const ColorAppearanceParams::eCTCModeId curveMode3 = params->colorappearance.curveMode3;
const bool hasColCurve3 = bool(customColCurve3);
@ -2472,10 +2453,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int
// gamut control in Lab mode; I must study how to do with cIECAM only
if(gamu == 1) {
float HH, Lprov1, Chprov1;
float Lprov1, Chprov1;
Lprov1 = Ll / 327.68f;
Chprov1 = sqrtf(SQR(aa) + SQR(bb)) / 327.68f;
HH = xatan2f(bb, aa);
float2 sincosval;
if(Chprov1 == 0.0f) {
@ -2953,9 +2933,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
BENCHFUN
Imagefloat *tmpImage = nullptr;
// NOTE: We're getting all 3 pointers here, but this function may not need them all, so one could optimize this
Imagefloat* editImgFloat = nullptr;
LabImage* editLab = nullptr;
PlanarWhateverData<float>* editWhatever = nullptr;
EditUniqueID editID = pipetteBuffer ? pipetteBuffer->getEditID() : EUID_None;
@ -2966,7 +2944,6 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
break;
case (BT_LABIMAGE):
editLab = pipetteBuffer->getLabBuffer();
break;
case (BT_SINGLEPLANE_FLOAT):
@ -2975,7 +2952,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
}
}
int h_th, s_th;
int h_th = 0, s_th = 0;
if (shmap) {
h_th = shmap->max_f - params->sh.htonalwidth * (shmap->max_f - shmap->avg) / 100;
@ -3030,10 +3007,10 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
params->chmixer.green[0] != 0 || params->chmixer.green[1] != 100 || params->chmixer.green[2] != 0 ||
params->chmixer.blue[0] != 0 || params->chmixer.blue[1] != 0 || params->chmixer.blue[2] != 100);
FlatCurve* hCurve;
FlatCurve* sCurve;
FlatCurve* vCurve;
FlatCurve* bwlCurve;
FlatCurve* hCurve = nullptr;
FlatCurve* sCurve = nullptr;
FlatCurve* vCurve = nullptr;
FlatCurve* bwlCurve = nullptr;
FlatCurveType hCurveType = (FlatCurveType)params->hsvequalizer.hcurve.at(0);
FlatCurveType sCurveType = (FlatCurveType)params->hsvequalizer.scurve.at(0);
@ -3087,7 +3064,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
std::shared_ptr<HaldCLUT> hald_clut;
bool clutAndWorkingProfilesAreSame = false;
TMatrix xyz2clut, clut2xyz;
TMatrix xyz2clut = {}, clut2xyz = {};
#ifdef __SSE2__
vfloat v_work2xyz[3][3] ALIGNED16;
vfloat v_xyz2clut[3][3] ALIGNED16;
@ -3274,12 +3251,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
tmpImage = new Imagefloat(working->getWidth(), working->getHeight());
}
int W = working->getWidth();
int H = working->getHeight();
// For tonecurve histogram
int toneCurveHistSize = histToneCurve ? histToneCurve.getSize() : 0;
int histToneCurveCompression;
int histToneCurveCompression = 0;
if(toneCurveHistSize > 0) {
histToneCurve.clear();
@ -3310,7 +3284,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
int tH;
// Allocating buffer for the PipetteBuffer
float *editIFloatTmpR, *editIFloatTmpG, *editIFloatTmpB, *editWhateverTmp;
float *editIFloatTmpR = nullptr, *editIFloatTmpG = nullptr, *editIFloatTmpB = nullptr, *editWhateverTmp = nullptr;
if (editImgFloat) {
editIFloatBuffer = (char *) malloc(3 * sizeof(float) * TS * TS + 20 * 64 + 63);
@ -3952,7 +3926,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
else if (params->colorToning.method == "Lab" && opautili) {
int algm = 0;
bool twocol = true;//true=500 color false=2 color
int metchrom;
int metchrom = 0;
if (params->colorToning.twocolor == "Std" ) {
metchrom = 0;
@ -3968,7 +3942,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
twocol = false;
}
float iplow, iphigh;
float iplow = 0.f, iphigh = 0.f;
if(!twocol) {
iplow = (float)ctColorCurve.low;
@ -4660,7 +4634,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
else if (params->colorToning.method == "Lab" && opautili) {
int algm = 0;
bool twocol = true;
int metchrom;
int metchrom = 0;
if (params->colorToning.twocolor == "Std" ) {
metchrom = 0;
@ -4676,7 +4650,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
twocol = false;
}
float iplow, iphigh;
float iplow = 0.f, iphigh = 0.f;
if(!twocol) {
iplow = (float)ctColorCurve.low;
@ -5205,8 +5179,6 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
Color::rgb2hsv(r, g, b, h, s, v);
float ksat = 1.f;
float ksatlow = 1.f;
float s_0 = 0.55f;
float s_1 = 0.85f;
/*
if(mode==0) {//color
if(s < s_0) ksat=SQR((1.f/s_0)*s);
@ -5223,7 +5195,7 @@ void ImProcFunctions::toning2col (float r, float g, float b, float &ro, float &g
float aa, bb, cc;
//fixed value of reducac =0.4;
secondeg_end (reducac, iplow, aa, bb, cc);
float aab, bbb, ccb;
float aab, bbb;
secondeg_begin (0.7f, iplow, aab, bbb);
@ -5458,9 +5430,6 @@ SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBu
// lhskcurve.dump("lh_curve");
//init Flatcurve for C=f(H)
// NOTE: We're getting all 3 pointers here, but this function may not need them all, so one could optimize this
Imagefloat* editImgFloat = nullptr;
LabImage* editLab = nullptr;
PlanarWhateverData<float>* editWhatever = nullptr;
EditUniqueID editID = EUID_None;
bool editPipette = false;
@ -5473,11 +5442,9 @@ SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBu
switch (pipetteBuffer->getDataProvider()->getCurrSubscriber()->getPipetteBufferType()) {
case (BT_IMAGEFLOAT):
editImgFloat = pipetteBuffer->getImgFloatBuffer();
break;
case (BT_LABIMAGE):
editLab = pipetteBuffer->getLabBuffer();
break;
case (BT_SINGLEPLANE_FLOAT):
@ -6404,7 +6371,6 @@ void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w
float sca = params->epd.scale;
float gamm = params->epd.gamma;
float rew = params->epd.reweightingIterates;
unsigned int i, N = Wid * Hei;
float Qpro = ( 4.0 / c_) * ( a_w + 4.0 ) ; //estimate Q max if J=100.0
float *Qpr = ncie->Q_p[0];
@ -6519,7 +6485,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
float *L = lab->L[0];
float *a = lab->a[0];
float *b = lab->b[0];
unsigned int i, N = lab->W * lab->H;
size_t N = lab->W * lab->H;
EdgePreservingDecomposition epd(lab->W, lab->H);
//Due to the taking of logarithms, L must be nonnegative. Further, scale to 0 to 1 using nominal range of L, 0 to 15 bit.
@ -6531,7 +6497,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
float lmaxL = 0.f;
#pragma omp for
for(i = 0; i < N; i++) {
for(size_t i = 0; i < N; i++) {
if(L[i] < lminL) {
lminL = L[i];
}
@ -6542,15 +6508,15 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
}
#pragma omp critical
{
if(lminL < minL) {
minL = lminL;
}
if(lminL < minL) {
minL = lminL;
if(lmaxL > maxL) {
maxL = lmaxL;
}
}
if(lmaxL > maxL) {
maxL = lmaxL;
}
}
if(minL > 0.0f) {
@ -6559,7 +6525,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
#pragma omp parallel for
for(i = 0; i < N; i++)
for(size_t i = 0; i < N; ++i)
//{L[i] = (L[i] - minL)/32767.0f;
{
L[i] = (L[i] - minL) / maxL;
@ -6594,7 +6560,7 @@ void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip)
#pragma omp parallel for // removed schedule(dynamic,10)
#endif
for(int ii = 0; ii < N; ii++) {
for(size_t ii = 0; ii < N; ++ii) {
a[ii] *= s;
b[ii] *= s;
L[ii] = L[ii] * maxL * (1.f / gamm) + minL;
@ -6730,7 +6696,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
// compute clipping points based on the original histograms (linear, without exp comp.)
int clipped = 0;
unsigned int clipped = 0;
int rawmax = (imax) - 1;
while (histogram[rawmax] + clipped <= 0 && rawmax > 1) {
@ -6739,17 +6705,15 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
}
//compute clipped white point
int clippable = (int)(sum * clip / 100.f );
int somm = sum;
unsigned int clippable = (int)(sum * clip / 100.f );
clipped = 0;
int whiteclip = (imax) - 1;
while (whiteclip > 1 && histogram[whiteclip] + clipped <= clippable) {
while (whiteclip > 1 && (histogram[whiteclip] + clipped) <= clippable) {
clipped += histogram[whiteclip];
whiteclip--;
}
int clipwh = clipped;
//compute clipped black point
clipped = 0;
int shc = 0;
@ -6759,8 +6723,6 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
shc++;
}
int clipbl = clipped;
//rescale to 65535 max
rawmax <<= histcompr;
whiteclip <<= histcompr;
@ -6776,7 +6738,6 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
//compute exposure compensation as geometric mean of the amount that
//sets the mean or median at middle gray, and the amount that sets the estimated top
//of the histogram at or near clipping.
float expo = log(midgray * scale / (ave - shc + midgray * shc));
//float expcomp1 = (log(/*(median/ave)*//*(hidev/lodev)*/midgray*scale/(ave-shc+midgray*shc))+log((hidev/lodev)))/log(2.f);
float expcomp1 = (log(/*(median/ave)*//*(hidev/lodev)*/midgray * scale / (ave - shc + midgray * shc))) / log(2.f);
float expcomp2;

View File

@ -82,7 +82,6 @@ SSEFUNCTION void ImProcFunctions::impulse_nr (LabImage* lab, double thresh)
#ifdef __SSE2__
vfloat hfnbravev, hpfabsv;
vfloat impthrDiv24v = F2V( impthrDiv24 );
vfloat onev = F2V( 1.0f );
#endif
#ifdef _OPENMP
#pragma omp for

View File

@ -27,28 +27,29 @@
# include <iostream>
#endif
namespace rtengine
{
static inline float Lanc(float x, float a)
static inline float Lanc (float x, float a)
{
if (x * x < 1e-6f) {
return 1.0f;
} else if (x * x > a * a) {
return 0.0f;
} else {
x = static_cast<float>(rtengine::RT_PI) * x;
return a * xsinf(x) * xsinf(x / a) / (x * x);
x = static_cast<float> (rtengine::RT_PI) * x;
return a * xsinf (x) * xsinf (x / a) / (x * x);
}
}
void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
void ImProcFunctions::Lanczos (const Image16* src, Image16* dst, float scale)
{
const float delta = 1.0f / scale;
const float a = 3.0f;
const float sc = min(scale, 1.0f);
const int support = static_cast<int>(2.0f * a / sc) + 1;
const float sc = min (scale, 1.0f);
const int support = static_cast<int> (2.0f * a / sc) + 1;
#pragma omp parallel
{
@ -67,7 +68,7 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
for (int j = 0; j < dst->getWidth(); j++) {
// x coord of the center of pixel on src image
float x0 = (static_cast<float>(j) + 0.5f) * delta - 0.5f;
float x0 = (static_cast<float> (j) + 0.5f) * delta - 0.5f;
// weights for interpolation in horisontal direction
float * w = wwh + j * support;
@ -75,14 +76,14 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
// sum of weights used for normalization
float ws = 0.0f;
jj0[j] = max(0, static_cast<int>(floorf(x0 - a / sc)) + 1);
jj1[j] = min(src->getWidth(), static_cast<int>(floorf(x0 + a / sc)) + 1);
jj0[j] = max (0, static_cast<int> (floorf (x0 - a / sc)) + 1);
jj1[j] = min (src->getWidth(), static_cast<int> (floorf (x0 + a / sc)) + 1);
// calculate weights
for (int jj = jj0[j]; jj < jj1[j]; jj++) {
int k = jj - jj0[j];
float z = sc * (x0 - static_cast<float>(jj));
w[k] = Lanc(z, a);
float z = sc * (x0 - static_cast<float> (jj));
w[k] = Lanc (z, a);
ws += w[k];
}
@ -98,7 +99,7 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
for (int i = 0; i < dst->getHeight(); i++) {
// y coord of the center of pixel on src image
float y0 = (static_cast<float>(i) + 0.5f) * delta - 0.5f;
float y0 = (static_cast<float> (i) + 0.5f) * delta - 0.5f;
// weights for interpolation in y direction
float w[support];
@ -106,14 +107,14 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
// sum of weights used for normalization
float ws = 0.0f;
int ii0 = max(0, static_cast<int>(floorf(y0 - a / sc)) + 1);
int ii1 = min(src->getHeight(), static_cast<int>(floorf(y0 + a / sc)) + 1);
int ii0 = max (0, static_cast<int> (floorf (y0 - a / sc)) + 1);
int ii1 = min (src->getHeight(), static_cast<int> (floorf (y0 + a / sc)) + 1);
// calculate weights for vertical interpolation
for (int ii = ii0; ii < ii1; ii++) {
int k = ii - ii0;
float z = sc * (y0 - static_cast<float>(ii));
w[k] = Lanc(z, a);
float z = sc * (y0 - static_cast<float> (ii));
w[k] = Lanc (z, a);
ws += w[k];
}
@ -130,9 +131,9 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
for (int ii = ii0; ii < ii1; ii++) {
int k = ii - ii0;
r += w[k] * src->r(ii, j);
g += w[k] * src->g(ii, j);
b += w[k] * src->b(ii, j);
r += w[k] * src->r (ii, j);
g += w[k] * src->g (ii, j);
b += w[k] * src->b (ii, j);
}
lr[j] = r;
@ -141,7 +142,7 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
}
// Do horizontal interpolation
for(int j = 0; j < dst->getWidth(); j++) {
for (int j = 0; j < dst->getWidth(); j++) {
float * wh = wwh + support * j;
@ -155,9 +156,9 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
b += wh[k] * lb[jj];
}
dst->r(i, j) = CLIP(static_cast<int>(r));
dst->g(i, j) = CLIP(static_cast<int>(g));
dst->b(i, j) = CLIP(static_cast<int>(b));
dst->r (i, j) = CLIP (static_cast<int> (r));
dst->g (i, j) = CLIP (static_cast<int> (g));
dst->b (i, j) = CLIP (static_cast<int> (b));
}
}
@ -171,12 +172,12 @@ void ImProcFunctions::Lanczos(const Image16* src, Image16* dst, float scale)
}
SSEFUNCTION void ImProcFunctions::Lanczos(const LabImage* src, LabImage* dst, float scale)
SSEFUNCTION void ImProcFunctions::Lanczos (const LabImage* src, LabImage* dst, float scale)
{
const float delta = 1.0f / scale;
const float a = 3.0f;
const float sc = min(scale, 1.0f);
const int support = static_cast<int>(2.0f * a / sc) + 1;
const float sc = min (scale, 1.0f);
const int support = static_cast<int> (2.0f * a / sc) + 1;
// storage for precomputed parameters for horizontal interpolation
float * wwh = new float[support * dst->W];
@ -187,7 +188,7 @@ SSEFUNCTION void ImProcFunctions::Lanczos(const LabImage* src, LabImage* dst, fl
for (int j = 0; j < dst->W; j++) {
// x coord of the center of pixel on src image
float x0 = (static_cast<float>(j) + 0.5f) * delta - 0.5f;
float x0 = (static_cast<float> (j) + 0.5f) * delta - 0.5f;
// weights for interpolation in horizontal direction
float * w = wwh + j * support;
@ -195,14 +196,14 @@ SSEFUNCTION void ImProcFunctions::Lanczos(const LabImage* src, LabImage* dst, fl
// sum of weights used for normalization
float ws = 0.0f;
jj0[j] = max(0, static_cast<int>(floorf(x0 - a / sc)) + 1);
jj1[j] = min(src->W, static_cast<int>(floorf(x0 + a / sc)) + 1);
jj0[j] = max (0, static_cast<int> (floorf (x0 - a / sc)) + 1);
jj1[j] = min (src->W, static_cast<int> (floorf (x0 + a / sc)) + 1);
// calculate weights
for (int jj = jj0[j]; jj < jj1[j]; jj++) {
int k = jj - jj0[j];
float z = sc * (x0 - static_cast<float>(jj));
w[k] = Lanc(z, a);
float z = sc * (x0 - static_cast<float> (jj));
w[k] = Lanc (z, a);
ws += w[k];
}
@ -230,19 +231,19 @@ SSEFUNCTION void ImProcFunctions::Lanczos(const LabImage* src, LabImage* dst, fl
for (int i = 0; i < dst->H; i++) {
// y coord of the center of pixel on src image
float y0 = (static_cast<float>(i) + 0.5f) * delta - 0.5f;
float y0 = (static_cast<float> (i) + 0.5f) * delta - 0.5f;
// sum of weights used for normalization
float ws = 0.0f;
int ii0 = max(0, static_cast<int>(floorf(y0 - a / sc)) + 1);
int ii1 = min(src->H, static_cast<int>(floorf(y0 + a / sc)) + 1);
int ii0 = max (0, static_cast<int> (floorf (y0 - a / sc)) + 1);
int ii1 = min (src->H, static_cast<int> (floorf (y0 + a / sc)) + 1);
// calculate weights for vertical interpolation
for (int ii = ii0; ii < ii1; ii++) {
int k = ii - ii0;
float z = sc * (y0 - static_cast<float>(ii));
w[k] = Lanc(z, a);
float z = sc * (y0 - static_cast<float> (ii));
w[k] = Lanc (z, a);
ws += w[k];
}
@ -263,15 +264,15 @@ SSEFUNCTION void ImProcFunctions::Lanczos(const LabImage* src, LabImage* dst, fl
for (int ii = ii0; ii < ii1; ii++) {
int k = ii - ii0;
wkv = _mm_set1_ps(w[k]);
Lv += wkv * LVFU(src->L[ii][j]);
av += wkv * LVFU(src->a[ii][j]);
bv += wkv * LVFU(src->b[ii][j]);
wkv = _mm_set1_ps (w[k]);
Lv += wkv * LVFU (src->L[ii][j]);
av += wkv * LVFU (src->a[ii][j]);
bv += wkv * LVFU (src->b[ii][j]);
}
STVF(lL[j], Lv);
STVF(la[j], av);
STVF(lb[j], bv);
STVF (lL[j], Lv);
STVF (la[j], av);
STVF (lb[j], bv);
}
#else
@ -295,7 +296,7 @@ SSEFUNCTION void ImProcFunctions::Lanczos(const LabImage* src, LabImage* dst, fl
}
// Do horizontal interpolation
for(int j = 0; j < dst->W; j++) {
for (int j = 0; j < dst->W; j++) {
float * wh = wwh + support * j;
@ -348,35 +349,35 @@ float ImProcFunctions::resizeScale (const ProcParams* params, int fw, int fh, in
refh = fh;
}
switch(params->resize.dataspec) {
case (1):
// Width
dScale = (double)params->resize.width / (double)refw;
break;
case (2):
// Height
dScale = (double)params->resize.height / (double)refh;
break;
case (3):
// FitBox
if ((double)refw / (double)refh > (double)params->resize.width / (double)params->resize.height) {
switch (params->resize.dataspec) {
case (1):
// Width
dScale = (double)params->resize.width / (double)refw;
} else {
break;
case (2):
// Height
dScale = (double)params->resize.height / (double)refh;
}
break;
break;
case (3):
default:
// Scale
dScale = params->resize.scale;
break;
// FitBox
if ((double)refw / (double)refh > (double)params->resize.width / (double)params->resize.height) {
dScale = (double)params->resize.width / (double)refw;
} else {
dScale = (double)params->resize.height / (double)refh;
}
break;
default:
// Scale
dScale = params->resize.scale;
break;
}
if (fabs(dScale - 1.0) <= 1e-5) {
if (fabs (dScale - 1.0) <= 1e-5) {
return 1.0;
}
@ -388,8 +389,8 @@ float ImProcFunctions::resizeScale (const ProcParams* params, int fw, int fh, in
imh = refh;
}
imw = (int)( (double)imw * dScale + 0.5 );
imh = (int)( (double)imh * dScale + 0.5 );
imw = (int) ( (double)imw * dScale + 0.5 );
imh = (int) ( (double)imh * dScale + 0.5 );
return (float)dScale;
}
@ -399,8 +400,8 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, float dScale)
time_t t1 = clock();
#endif
if(params->resize.method != "Nearest" ) {
Lanczos(src, dst, dScale);
if (params->resize.method != "Nearest" ) {
Lanczos (src, dst, dScale);
} else {
// Nearest neighbour algorithm
#ifdef _OPENMP
@ -409,14 +410,14 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, float dScale)
for (int i = 0; i < dst->getHeight(); i++) {
int sy = i / dScale;
sy = LIM(sy, 0, src->getHeight() - 1);
sy = LIM (sy, 0, src->getHeight() - 1);
for (int j = 0; j < dst->getWidth(); j++) {
int sx = j / dScale;
sx = LIM(sx, 0, src->getWidth() - 1);
dst->r(i, j) = src->r(sy, sx);
dst->g(i, j) = src->g(sy, sx);
dst->b(i, j) = src->b(sy, sx);
sx = LIM (sx, 0, src->getWidth() - 1);
dst->r (i, j) = src->r (sy, sx);
dst->g (i, j) = src->g (sy, sx);
dst->b (i, j) = src->b (sy, sx);
}
}
}
@ -424,7 +425,7 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, float dScale)
#ifdef PROFILE
time_t t2 = clock();
std::cout << "Resize: " << params->resize.method << ": "
<< (float)(t2 - t1) / CLOCKS_PER_SEC << std::endl;
<< (float) (t2 - t1) / CLOCKS_PER_SEC << std::endl;
#endif
}

View File

@ -273,7 +273,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
}
}
float varx;
float varx = 0.f;
float limdx, ilimdx;
if(gradvart != 0) {
@ -345,7 +345,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
src[i] = &srcBuffer[i * W_L];
}
int h_th, s_th;
int h_th = 0, s_th = 0;
int shHighlights = deh.highlights;
int shShadows = deh.shadows;

View File

@ -934,7 +934,7 @@ void ImProcFunctions::sharpeningcam (CieImage* ncie, float** b2)
// Rest is UNSHARP MASK
int W = ncie->W, H = ncie->H;
float** b3;
float** b3 = nullptr;
if (params->sharpening.edgesonly) {
b3 = new float*[H];

View File

@ -25,22 +25,23 @@
#include "rt_math.h"
#include "sleef.c"
using namespace std;
namespace
{
float pow3(float x)
float pow3 (float x)
{
return x * x * x;
}
float pow4(float x)
float pow4 (float x)
{
return (x * x) * (x * x);
}
float pown(float x, int n)
float pown (float x, int n)
{
switch (n) {
@ -51,47 +52,47 @@ float pown(float x, int n)
return x * x;
case 4:
return pow4(x);
return pow4 (x);
case 6:
return (x * x) * pow4(x);
return (x * x) * pow4 (x);
case 8:
return pow4(x) * pow4(x);
return pow4 (x) * pow4 (x);
default:
return pow_F(x, n);
return pow_F (x, n);
}
}
float normn(float a, float b, int n)
float normn (float a, float b, int n)
{
switch (n) {
case 2:
return sqrtf(a * a + b * b);
return sqrtf (a * a + b * b);
case 4:
return sqrtf(sqrtf(pow4(a) + pow4(b)));
return sqrtf (sqrtf (pow4 (a) + pow4 (b)));
case 6:
return sqrtf(xcbrtf(pow3(a) * pow3(a) + pow3(b) * pow3(b)));
return sqrtf (xcbrtf (pow3 (a) * pow3 (a) + pow3 (b) * pow3 (b)));
case 8:
return sqrtf(sqrtf(sqrtf(pow4(a) * pow4(a) + pow4(b) * pow4(b))));
return sqrtf (sqrtf (sqrtf (pow4 (a) * pow4 (a) + pow4 (b) * pow4 (b))));
default:
return pow_F(pown(a, n) + pown(b, n), 1.f / n);
return pow_F (pown (a, n) + pown (b, n), 1.f / n);
}
}
void correct_distortion(const rtengine::LCPMapper *lcp, double &x, double &y,
int cx, int cy)
void correct_distortion (const rtengine::LCPMapper *lcp, double &x, double &y,
int cx, int cy)
{
assert(lcp);
assert (lcp);
x += cx;
y += cy;
lcp->correctDistortion(x, y);
lcp->correctDistortion (x, y);
x -= cx;
y -= cy;
}
@ -127,26 +128,26 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
double oW = W, oH = H;
double w2 = (double) oW / 2.0 - 0.5;
double h2 = (double) oH / 2.0 - 0.5;
double maxRadius = sqrt( (double)( oW * oW + oH * oH ) ) / 2;
double maxRadius = sqrt ( (double) ( oW * oW + oH * oH ) ) / 2;
// auxiliary variables for distortion correction
bool needsDist = needsDistortion(); // for performance
double distAmount = params->distortion.amount;
// auxiliary variables for rotation
double cost = cos(params->rotate.degree * rtengine::RT_PI / 180.0);
double sint = sin(params->rotate.degree * rtengine::RT_PI / 180.0);
double cost = cos (params->rotate.degree * rtengine::RT_PI / 180.0);
double sint = sin (params->rotate.degree * rtengine::RT_PI / 180.0);
// auxiliary variables for vertical perspective correction
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90.0 - vpdeg) / 180.0 * rtengine::RT_PI;
double vpteta = fabs(vpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((vpdeg > 0 ? 1.0 : -1.0) * sqrt((-oW * oW * tan(vpalpha) * tan(vpalpha) + (vpdeg > 0 ? 1.0 : -1.0) * oW * tan(vpalpha) * sqrt(16 * maxRadius * maxRadius + oW * oW * tan(vpalpha) * tan(vpalpha))) / (maxRadius * maxRadius * 8)));
double vpteta = fabs (vpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((vpdeg > 0 ? 1.0 : -1.0) * sqrt ((-oW * oW * tan (vpalpha) * tan (vpalpha) + (vpdeg > 0 ? 1.0 : -1.0) * oW * tan (vpalpha) * sqrt (16 * maxRadius * maxRadius + oW * oW * tan (vpalpha) * tan (vpalpha))) / (maxRadius * maxRadius * 8)));
double vpcospt = (vpdeg >= 0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
// auxiliary variables for horizontal perspective correction
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90.0 - hpdeg) / 180.0 * rtengine::RT_PI;
double hpteta = fabs(hpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((hpdeg > 0 ? 1.0 : -1.0) * sqrt((-oH * oH * tan(hpalpha) * tan(hpalpha) + (hpdeg > 0 ? 1.0 : -1.0) * oH * tan(hpalpha) * sqrt(16 * maxRadius * maxRadius + oH * oH * tan(hpalpha) * tan(hpalpha))) / (maxRadius * maxRadius * 8)));
double hpteta = fabs (hpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((hpdeg > 0 ? 1.0 : -1.0) * sqrt ((-oH * oH * tan (hpalpha) * tan (hpalpha) + (hpdeg > 0 ? 1.0 : -1.0) * oH * tan (hpalpha) * sqrt (16 * maxRadius * maxRadius + oH * oH * tan (hpalpha) * tan (hpalpha))) / (maxRadius * maxRadius * 8)));
double hpcospt = (hpdeg >= 0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = ascaleDef > 0 ? ascaleDef : (params->commonTrans.autofill ? getTransformAutoFill (oW, oH, pLCPMap) : 1.0);
@ -155,7 +156,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
double x_d = src[i].x, y_d = src[i].y;
if (pLCPMap && params->lensProf.useDist) {
correct_distortion(pLCPMap, x_d, y_d, 0, 0);
correct_distortion (pLCPMap, x_d, y_d, 0, 0);
}
y_d = ascale * (y_d - h2);
@ -179,25 +180,25 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &src,
double s = 1;
if (needsDist) {
double r = sqrt(Dx * Dx + Dy * Dy) / maxRadius; // sqrt is slow
double r = sqrt (Dx * Dx + Dy * Dy) / maxRadius; // sqrt is slow
s = 1.0 - distAmount + distAmount * r ;
}
// LCP CA is not reflected in preview (and very small), so don't add it here
red.push_back (Coord2D(Dx * (s + params->cacorrection.red) + w2, Dy * (s + params->cacorrection.red) + h2));
green.push_back (Coord2D(Dx * s + w2, Dy * s + h2));
blue.push_back (Coord2D(Dx * (s + params->cacorrection.blue) + w2, Dy * (s + params->cacorrection.blue) + h2));
red.push_back (Coord2D (Dx * (s + params->cacorrection.red) + w2, Dy * (s + params->cacorrection.red) + h2));
green.push_back (Coord2D (Dx * s + w2, Dy * s + h2));
blue.push_back (Coord2D (Dx * (s + params->cacorrection.blue) + w2, Dy * (s + params->cacorrection.blue) + h2));
}
// Clip all points and track if they were any corrections
for (size_t i = 0; i < src.size(); i++) {
red[i].x = CLIPTOC(red[i].x, 0, W - 1, clipped);
red[i].y = CLIPTOC(red[i].y, 0, H - 1, clipped);
green[i].x = CLIPTOC(green[i].x, 0, W - 1, clipped);
green[i].y = CLIPTOC(green[i].y, 0, H - 1, clipped);
blue[i].x = CLIPTOC(blue[i].x, 0, W - 1, clipped);
blue[i].y = CLIPTOC(blue[i].y, 0, H - 1, clipped);
red[i].x = CLIPTOC (red[i].x, 0, W - 1, clipped);
red[i].y = CLIPTOC (red[i].y, 0, H - 1, clipped);
green[i].x = CLIPTOC (green[i].x, 0, W - 1, clipped);
green[i].y = CLIPTOC (green[i].y, 0, H - 1, clipped);
blue[i].x = CLIPTOC (blue[i].x, 0, W - 1, clipped);
blue[i].y = CLIPTOC (blue[i].y, 0, H - 1, clipped);
}
return clipped;
@ -264,7 +265,7 @@ bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int&
x1d = transCorners[i].x;
}
int x1v = (int)(x1d);
int x1v = (int) (x1d);
double y1d = transCorners[0].y;
@ -273,7 +274,7 @@ bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int&
y1d = transCorners[i].y;
}
int y1v = (int)(y1d);
int y1v = (int) (y1d);
double x2d = transCorners[0].x;
@ -282,7 +283,7 @@ bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int&
x2d = transCorners[i].x;
}
int x2v = (int)ceil(x2d);
int x2v = (int)ceil (x2d);
double y2d = transCorners[0].y;
@ -291,7 +292,7 @@ bool ImProcFunctions::transCoord (int W, int H, int x, int y, int w, int h, int&
y2d = transCorners[i].y;
}
int y2v = (int)ceil(y2d);
int y2v = (int)ceil (y2d);
xv = x1v;
yv = y1v;
@ -308,17 +309,17 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed,
LCPMapper *pLCPMap = nullptr;
if (needsLCP()) { // don't check focal length to allow distortion correction for lenses without chip
LCPProfile *pLCPProf = lcpStore->getProfile(params->lensProf.lcpFile);
LCPProfile *pLCPProf = lcpStore->getProfile (params->lensProf.lcpFile);
if (pLCPProf) {
pLCPMap = new LCPMapper(pLCPProf, focalLen, focalLen35mm,
focusDist, 0, false,
params->lensProf.useDist,
oW, oH, params->coarse, rawRotationDeg);
pLCPMap = new LCPMapper (pLCPProf, focalLen, focalLen35mm,
focusDist, 0, false,
params->lensProf.useDist,
oW, oH, params->coarse, rawRotationDeg);
}
}
if (!(needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP()) && (needsVignetting() || needsPCVignetting() || needsGradient())) {
if (! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP()) && (needsVignetting() || needsPCVignetting() || needsGradient())) {
transformLuminanceOnly (original, transformed, cx, cy, oW, oH, fW, fH);
} else if (!needsCA() && scale != 1) {
transformPreview (original, transformed, cx, cy, sx, sy, oW, oH, fW, fH, pLCPMap);
@ -332,7 +333,7 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed,
}
// helper function
void ImProcFunctions::calcVignettingParams(int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul)
void ImProcFunctions::calcVignettingParams (int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul)
{
// vignette center is a point with coordinates between -1 and +1
double x = vignetting.centerX / 100.0;
@ -343,12 +344,12 @@ void ImProcFunctions::calcVignettingParams(int oW, int oH, const VignettingParam
h2 = (double) oH / 2.0 - 0.5 + y * oH;
// max vignette radius in pixels
maxRadius = sqrt( (double)( oW * oW + oH * oH ) ) / 2.;
maxRadius = sqrt ( (double) ( oW * oW + oH * oH ) ) / 2.;
// vignette variables with applied strength
v = 1.0 + vignetting.strength * fabs(vignetting.amount) * 3.0 / 400.0;
v = 1.0 + vignetting.strength * fabs (vignetting.amount) * 3.0 / 400.0;
b = 1.0 + vignetting.radius * 7.0 / 100.0;
mul = (1.0 - v) / tanh(b);
mul = (1.0 - v) / tanh (b);
}
struct grad_params {
@ -359,7 +360,7 @@ struct grad_params {
float top_edge_0;
int h;
};
static void calcGradientParams(int oW, int oH, const GradientParams& gradient, struct grad_params& gp)
static void calcGradientParams (int oW, int oH, const GradientParams& gradient, struct grad_params& gp)
{
int w = oW;
int h = oH;
@ -371,7 +372,7 @@ static void calcGradientParams(int oW, int oH, const GradientParams& gradient, s
//fprintf(stderr, "%f %f %f %f %f %d %d\n", gradient_stops, gradient_span, gradient_center_x, gradient_center_y, gradient_angle, w, h);
// make 0.0 <= gradient_angle < 2 * rtengine::RT_PI
gradient_angle = fmod(gradient_angle, 2 * rtengine::RT_PI);
gradient_angle = fmod (gradient_angle, 2 * rtengine::RT_PI);
if (gradient_angle < 0.0) {
gradient_angle += 2.0 * rtengine::RT_PI;
@ -381,21 +382,21 @@ static void calcGradientParams(int oW, int oH, const GradientParams& gradient, s
gp.transpose = false;
gp.angle_is_zero = false;
gp.h = h;
double cosgrad = cos(gradient_angle);
double cosgrad = cos (gradient_angle);
if (fabs(cosgrad) < 0.707) {
if (fabs (cosgrad) < 0.707) {
// we transpose to avoid division by zero at 90 degrees
// (actually we could transpose only for 90 degrees, but this way we avoid
// division with extremely small numbers
gp.transpose = true;
gradient_angle += 0.5 * rtengine::RT_PI;
cosgrad = cos(gradient_angle);
cosgrad = cos (gradient_angle);
double gxc = gradient_center_x;
gradient_center_x = 1.0 - gradient_center_y;
gradient_center_y = gxc;
}
gradient_angle = fmod(gradient_angle, 2 * rtengine::RT_PI);
gradient_angle = fmod (gradient_angle, 2 * rtengine::RT_PI);
if (gradient_angle > 0.5 * rtengine::RT_PI && gradient_angle < rtengine::RT_PI) {
gradient_angle += rtengine::RT_PI;
@ -405,7 +406,7 @@ static void calcGradientParams(int oW, int oH, const GradientParams& gradient, s
gp.bright_top = true;
}
if (fabs(gradient_angle) < 0.001 || fabs(gradient_angle - 2 * rtengine::RT_PI) < 0.001) {
if (fabs (gradient_angle) < 0.001 || fabs (gradient_angle - 2 * rtengine::RT_PI) < 0.001) {
gradient_angle = 0;
gp.angle_is_zero = true;
}
@ -420,7 +421,7 @@ static void calcGradientParams(int oW, int oH, const GradientParams& gradient, s
h = tmp;
}
gp.scale = 1.0 / pow(2, gradient_stops);
gp.scale = 1.0 / pow (2, gradient_stops);
if (gp.bright_top) {
gp.topmul = 1.0;
@ -430,10 +431,10 @@ static void calcGradientParams(int oW, int oH, const GradientParams& gradient, s
gp.botmul = 1.0;
}
gp.ta = tan(gradient_angle);
gp.ta = tan (gradient_angle);
gp.xc = w * gradient_center_x;
gp.yc = h * gradient_center_y;
gp.ys = sqrt((float)h * h + (float)w * w) * (gradient_span / cos(gradient_angle));
gp.ys = sqrt ((float)h * h + (float)w * w) * (gradient_span / cos (gradient_angle));
gp.ys_inv = 1.0 / gp.ys;
gp.top_edge_0 = gp.yc - gp.ys / 2.0;
@ -443,18 +444,17 @@ static void calcGradientParams(int oW, int oH, const GradientParams& gradient, s
}
}
static float calcGradientFactor(const struct grad_params& gp, int x, int y)
static float calcGradientFactor (const struct grad_params& gp, int x, int y)
{
if (gp.angle_is_zero) {
int gy = gp.transpose ? x : y;
int gx = gp.transpose ? y : x;
if (gy < gp.top_edge_0) {
return gp.topmul;
} else if (gy >= gp.top_edge_0 + gp.ys) {
return gp.botmul;
} else {
float val = ((float)(gy - gp.top_edge_0) * gp.ys_inv);
float val = ((float) (gy - gp.top_edge_0) * gp.ys_inv);
if (gp.bright_top) {
val = 1.f - val;
@ -463,9 +463,9 @@ static float calcGradientFactor(const struct grad_params& gp, int x, int y)
val *= rtengine::RT_PI_F_2;
if (gp.scale < 1.f) {
val = pow3(xsinf(val));
val = pow3 (xsinf (val));
} else {
val = 1.f - pow3(xcosf(val));
val = 1.f - pow3 (xcosf (val));
}
return gp.scale + val * (1.0 - gp.scale);
@ -480,16 +480,16 @@ static float calcGradientFactor(const struct grad_params& gp, int x, int y)
} else if (gy >= top_edge + gp.ys) {
return gp.botmul;
} else {
float val = ((float)(gy - top_edge) * gp.ys_inv);
float val = ((float) (gy - top_edge) * gp.ys_inv);
val = gp.bright_top ? 1.f - val : val;
val *= rtengine::RT_PI_F_2;
if (gp.scale < 1.f) {
val = pow3(xsinf(val));
val = pow3 (xsinf (val));
} else {
val = 1.f - pow3(xcosf(val));
val = 1.f - pow3 (xcosf (val));
}
return gp.scale + val * (1.0 - gp.scale);
@ -507,7 +507,7 @@ struct pcv_params {
float scale;
float fadeout_mul;
};
static void calcPCVignetteParams(int fW, int fH, int oW, int oH, const PCVignetteParams& pcvignette, const CropParams &crop, struct pcv_params& pcv)
static void calcPCVignetteParams (int fW, int fH, int oW, int oH, const PCVignetteParams& pcvignette, const CropParams &crop, struct pcv_params& pcv)
{
// ellipse formula: (x/a)^2 + (y/b)^2 = 1
@ -528,49 +528,49 @@ static void calcPCVignetteParams(int fW, int fH, int oW, int oH, const PCVignett
pcv.h = oH;
}
pcv.fadeout_mul = 1.0 / (0.05 * sqrtf(oW * oW + oH * oH));
pcv.fadeout_mul = 1.0 / (0.05 * sqrtf (oW * oW + oH * oH));
float short_side = (pcv.w < pcv.h) ? pcv.w : pcv.h;
float long_side = (pcv.w > pcv.h) ? pcv.w : pcv.h;
pcv.sep = 2;
pcv.sepmix = 0;
pcv.oe_a = sqrt(2.0) * long_side * 0.5;
pcv.oe_a = sqrt (2.0) * long_side * 0.5;
pcv.oe_b = pcv.oe_a * short_side / long_side;
pcv.ie_mul = (1.0 / sqrt(2.0)) * (1.0 - pcv.feather);
pcv.ie_mul = (1.0 / sqrt (2.0)) * (1.0 - pcv.feather);
pcv.is_super_ellipse_mode = false;
pcv.is_portrait = (pcv.w < pcv.h);
if (roundness < 0.5) {
// make super-ellipse of higher and higher degree
pcv.is_super_ellipse_mode = true;
float sepf = 2 + 4 * powf(1.0 - 2 * roundness, 1.3); // gamma 1.3 used to balance the effect in the 0.0...0.5 roundness range
float sepf = 2 + 4 * powf (1.0 - 2 * roundness, 1.3); // gamma 1.3 used to balance the effect in the 0.0...0.5 roundness range
pcv.sep = ((int)sepf) & ~0x1;
pcv.sepmix = (sepf - pcv.sep) * 0.5; // 0.0 to 1.0
pcv.oe1_a = powf(2.0, 1.0 / pcv.sep) * long_side * 0.5;
pcv.oe1_a = powf (2.0, 1.0 / pcv.sep) * long_side * 0.5;
pcv.oe1_b = pcv.oe1_a * short_side / long_side;
pcv.ie1_mul = (1.0 / powf(2.0, 1.0 / pcv.sep)) * (1.0 - pcv.feather);
pcv.oe2_a = powf(2.0, 1.0 / (pcv.sep + 2)) * long_side * 0.5;
pcv.ie1_mul = (1.0 / powf (2.0, 1.0 / pcv.sep)) * (1.0 - pcv.feather);
pcv.oe2_a = powf (2.0, 1.0 / (pcv.sep + 2)) * long_side * 0.5;
pcv.oe2_b = pcv.oe2_a * short_side / long_side;
pcv.ie2_mul = (1.0 / powf(2.0, 1.0 / (pcv.sep + 2))) * (1.0 - pcv.feather);
pcv.ie2_mul = (1.0 / powf (2.0, 1.0 / (pcv.sep + 2))) * (1.0 - pcv.feather);
}
if (roundness > 0.5) {
// scale from fitted ellipse towards circle
float rad = sqrtf(pcv.w * pcv.w + pcv.h * pcv.h) / 2.0;
float rad = sqrtf (pcv.w * pcv.w + pcv.h * pcv.h) / 2.0;
float diff_a = rad - pcv.oe_a;
float diff_b = rad - pcv.oe_b;
pcv.oe_a = pcv.oe_a + diff_a * 2 * (roundness - 0.5);
pcv.oe_b = pcv.oe_b + diff_b * 2 * (roundness - 0.5);
}
pcv.scale = powf(2, -pcvignette.strength);
pcv.scale = powf (2, -pcvignette.strength);
if (pcvignette.strength >= 6.0) {
pcv.scale = 0.0;
}
}
static float calcPCVignetteFactor(const struct pcv_params& pcv, int x, int y)
static float calcPCVignetteFactor (const struct pcv_params& pcv, int x, int y)
{
float fo = 1.f;
@ -592,25 +592,25 @@ static float calcPCVignetteFactor(const struct pcv_params& pcv, int x, int y)
dist_y = 0;
}
fo = sqrtf(dist_x * dist_x + dist_y * dist_y) * pcv.fadeout_mul;
fo = sqrtf (dist_x * dist_x + dist_y * dist_y) * pcv.fadeout_mul;
if (fo >= 1.f) {
return 1.f;
}
}
float a = fabs((x - pcv.x1) - pcv.w * 0.5f);
float b = fabs((y - pcv.y1) - pcv.h * 0.5f);
float a = fabs ((x - pcv.x1) - pcv.w * 0.5f);
float b = fabs ((y - pcv.y1) - pcv.h * 0.5f);
if(pcv.is_portrait) {
std::swap(a, b);
if (pcv.is_portrait) {
std::swap (a, b);
}
float dist = normn(a, b, 2);
float dist = normn (a, b, 2);
float dist_oe, dist_ie;
float2 sincosval;
if(dist == 0.0f) {
if (dist == 0.0f) {
sincosval.y = 1.0f; // cos
sincosval.x = 0.0f; // sin
} else {
@ -619,14 +619,14 @@ static float calcPCVignetteFactor(const struct pcv_params& pcv, int x, int y)
}
if (pcv.is_super_ellipse_mode) {
float dist_oe1 = pcv.oe1_a * pcv.oe1_b / normn(pcv.oe1_b * sincosval.y, pcv.oe1_a * sincosval.x, pcv.sep);
float dist_oe2 = pcv.oe2_a * pcv.oe2_b / normn(pcv.oe2_b * sincosval.y, pcv.oe2_a * sincosval.x, pcv.sep + 2);
float dist_oe1 = pcv.oe1_a * pcv.oe1_b / normn (pcv.oe1_b * sincosval.y, pcv.oe1_a * sincosval.x, pcv.sep);
float dist_oe2 = pcv.oe2_a * pcv.oe2_b / normn (pcv.oe2_b * sincosval.y, pcv.oe2_a * sincosval.x, pcv.sep + 2);
float dist_ie1 = pcv.ie1_mul * dist_oe1;
float dist_ie2 = pcv.ie2_mul * dist_oe2;
dist_oe = dist_oe1 * (1.f - pcv.sepmix) + dist_oe2 * pcv.sepmix;
dist_ie = dist_ie1 * (1.f - pcv.sepmix) + dist_ie2 * pcv.sepmix;
} else {
dist_oe = pcv.oe_a * pcv.oe_b / sqrtf(SQR(pcv.oe_b * sincosval.y) + SQR(pcv.oe_a * sincosval.x));
dist_oe = pcv.oe_a * pcv.oe_b / sqrtf (SQR (pcv.oe_b * sincosval.y) + SQR (pcv.oe_a * sincosval.x));
dist_ie = pcv.ie_mul * dist_oe;
}
@ -642,9 +642,9 @@ static float calcPCVignetteFactor(const struct pcv_params& pcv, int x, int y)
val = rtengine::RT_PI_F_2 * (dist - dist_ie) / (dist_oe - dist_ie);
if (pcv.scale < 1.f) {
val = pow4(xcosf(val));
val = pow4 (xcosf (val));
} else {
val = 1 - pow4(xsinf(val));
val = 1 - pow4 (xsinf (val));
}
val = pcv.scale + val * (1.f - pcv.scale);
@ -667,20 +667,20 @@ void ImProcFunctions::transformLuminanceOnly (Imagefloat* original, Imagefloat*
double vig_w2, vig_h2, maxRadius, v, b, mul;
if (applyVignetting) {
calcVignettingParams(oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul);
calcVignettingParams (oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul);
}
struct grad_params gp;
if (applyGradient) {
calcGradientParams(oW, oH, params->gradient, gp);
calcGradientParams (oW, oH, params->gradient, gp);
}
struct pcv_params pcv;
if (applyPCVignetting) {
//fprintf(stderr, "%d %d | %d %d | %d %d | %d %d [%d %d]\n", fW, fH, oW, oH, transformed->getWidth(), transformed->getHeight(), cx, cy, params->crop.w, params->crop.h);
calcPCVignetteParams(fW, fH, oW, oH, params->pcvignette, params->crop, pcv);
calcPCVignetteParams (fW, fH, oW, oH, params->pcvignette, params->crop, pcv);
}
bool darkening = (params->vignetting.amount <= 0.0);
@ -694,26 +694,26 @@ void ImProcFunctions::transformLuminanceOnly (Imagefloat* original, Imagefloat*
if (applyVignetting) {
double vig_x_d = (double) (x + cx) - vig_w2 ;
double r = sqrt(vig_x_d * vig_x_d + vig_y_d * vig_y_d);
double r = sqrt (vig_x_d * vig_x_d + vig_y_d * vig_y_d);
if(darkening) {
factor /= std::max(v + mul * tanh (b * (maxRadius - r) / maxRadius), 0.001);
if (darkening) {
factor /= std::max (v + mul * tanh (b * (maxRadius - r) / maxRadius), 0.001);
} else {
factor = v + mul * tanh (b * (maxRadius - r) / maxRadius);
}
}
if (applyGradient) {
factor *= calcGradientFactor(gp, cx + x, cy + y);
factor *= calcGradientFactor (gp, cx + x, cy + y);
}
if (applyPCVignetting) {
factor *= calcPCVignetteFactor(pcv, cx + x, cy + y);
factor *= calcPCVignetteFactor (pcv, cx + x, cy + y);
}
transformed->r(y, x) = original->r(y, x) * factor;
transformed->g(y, x) = original->g(y, x) * factor;
transformed->b(y, x) = original->b(y, x) * factor;
transformed->r (y, x) = original->r (y, x) * factor;
transformed->g (y, x) = original->g (y, x) * factor;
transformed->b (y, x) = original->b (y, x) * factor;
}
}
}
@ -726,18 +726,18 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
double h2 = (double) oH / 2.0 - 0.5;
double vig_w2, vig_h2, maxRadius, v, b, mul;
calcVignettingParams(oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul);
calcVignettingParams (oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul);
struct grad_params gp;
if (needsGradient()) {
calcGradientParams(oW, oH, params->gradient, gp);
calcGradientParams (oW, oH, params->gradient, gp);
}
struct pcv_params pcv;
if (needsPCVignetting()) {
calcPCVignetteParams(fW, fH, oW, oH, params->pcvignette, params->crop, pcv);
calcPCVignetteParams (fW, fH, oW, oH, params->pcvignette, params->crop, pcv);
}
float** chOrig[3];
@ -761,21 +761,21 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
double distAmount = params->distortion.amount;
// auxiliary variables for rotation
double cost = cos(params->rotate.degree * rtengine::RT_PI / 180.0);
double sint = sin(params->rotate.degree * rtengine::RT_PI / 180.0);
double cost = cos (params->rotate.degree * rtengine::RT_PI / 180.0);
double sint = sin (params->rotate.degree * rtengine::RT_PI / 180.0);
// auxiliary variables for vertical perspective correction
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90.0 - vpdeg) / 180.0 * rtengine::RT_PI;
double vpteta = fabs(vpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((vpdeg > 0 ? 1.0 : -1.0) * sqrt((-SQR(oW * tan(vpalpha)) + (vpdeg > 0 ? 1.0 : -1.0) *
oW * tan(vpalpha) * sqrt(SQR(4 * maxRadius) + SQR(oW * tan(vpalpha)))) / (SQR(maxRadius) * 8)));
double vpteta = fabs (vpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((vpdeg > 0 ? 1.0 : -1.0) * sqrt ((-SQR (oW * tan (vpalpha)) + (vpdeg > 0 ? 1.0 : -1.0) *
oW * tan (vpalpha) * sqrt (SQR (4 * maxRadius) + SQR (oW * tan (vpalpha)))) / (SQR (maxRadius) * 8)));
double vpcospt = (vpdeg >= 0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
// auxiliary variables for horizontal perspective correction
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90.0 - hpdeg) / 180.0 * rtengine::RT_PI;
double hpteta = fabs(hpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((hpdeg > 0 ? 1.0 : -1.0) * sqrt((-SQR(oH * tan(hpalpha)) + (hpdeg > 0 ? 1.0 : -1.0) *
oH * tan(hpalpha) * sqrt(SQR(4 * maxRadius) + SQR(oH * tan(hpalpha)))) / (SQR(maxRadius) * 8)));
double hpteta = fabs (hpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((hpdeg > 0 ? 1.0 : -1.0) * sqrt ((-SQR (oH * tan (hpalpha)) + (hpdeg > 0 ? 1.0 : -1.0) *
oH * tan (hpalpha) * sqrt (SQR (4 * maxRadius) + SQR (oH * tan (hpalpha)))) / (SQR (maxRadius) * 8)));
double hpcospt = (hpdeg >= 0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, true /*fullImage*/ ? pLCPMap : nullptr) : 1.0;
@ -799,13 +799,13 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
double x_d = x, y_d = y;
if (enableLCPDist) {
correct_distortion(pLCPMap, x_d, y_d, cx, cy); // must be first transform
correct_distortion (pLCPMap, x_d, y_d, cx, cy); // must be first transform
}
x_d = ascale * (x_d + cx - w2); // centering x coord & scale
y_d = ascale * (y_d + cy - h2); // centering y coord & scale
double vig_x_d, vig_y_d;
double vig_x_d = 0., vig_y_d = 0.;
if (needsVignetting()) {
vig_x_d = ascale * (x + cx - vig_w2); // centering x coord & scale
@ -830,16 +830,16 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
double s = 1;
if (needsDist) {
double r = sqrt(Dxc * Dxc + Dyc * Dyc) / maxRadius; // sqrt is slow
double r = sqrt (Dxc * Dxc + Dyc * Dyc) / maxRadius; // sqrt is slow
s = 1.0 - distAmount + distAmount * r ;
}
double r2;
double r2 = 0.;
if (needsVignetting()) {
double vig_Dx = vig_x_d * cost - vig_y_d * sint;
double vig_Dy = vig_x_d * sint + vig_y_d * cost;
r2 = sqrt(vig_Dx * vig_Dx + vig_Dy * vig_Dy);
r2 = sqrt (vig_Dx * vig_Dx + vig_Dy * vig_Dy);
}
for (int c = 0; c < (enableCA ? 3 : 1); c++) {
@ -852,7 +852,7 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
// LCP CA
if (enableLCPCA) {
pLCPMap->correctCA(Dx, Dy, c);
pLCPMap->correctCA (Dx, Dy, c);
}
// Extract integer and fractions of source screen coordinates
@ -870,41 +870,41 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
double vignmul = 1.0;
if (needsVignetting()) {
if(darkening) {
vignmul /= std::max(v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001);
if (darkening) {
vignmul /= std::max (v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001);
} else {
vignmul *= (v + mul * tanh (b * (maxRadius - s * r2) / maxRadius));
}
}
if (needsGradient()) {
vignmul *= calcGradientFactor(gp, cx + x, cy + y);
vignmul *= calcGradientFactor (gp, cx + x, cy + y);
}
if (needsPCVignetting()) {
vignmul *= calcPCVignetteFactor(pcv, cx + x, cy + y);
vignmul *= calcPCVignetteFactor (pcv, cx + x, cy + y);
}
if (yc > 0 && yc < original->getHeight() - 2 && xc > 0 && xc < original->getWidth() - 2) {
// all interpolation pixels inside image
if (enableCA) {
interpolateTransformChannelsCubic (chOrig[c], xc - 1, yc - 1, Dx, Dy, &(chTrans[c][y][x]), vignmul);
interpolateTransformChannelsCubic (chOrig[c], xc - 1, yc - 1, Dx, Dy, & (chTrans[c][y][x]), vignmul);
} else {
interpolateTransformCubic (original, xc - 1, yc - 1, Dx, Dy, &(transformed->r(y, x)), &(transformed->g(y, x)), &(transformed->b(y, x)), vignmul);
interpolateTransformCubic (original, xc - 1, yc - 1, Dx, Dy, & (transformed->r (y, x)), & (transformed->g (y, x)), & (transformed->b (y, x)), vignmul);
}
} else {
// edge pixels
int y1 = LIM(yc, 0, original->getHeight() - 1);
int y2 = LIM(yc + 1, 0, original->getHeight() - 1);
int x1 = LIM(xc, 0, original->getWidth() - 1);
int x2 = LIM(xc + 1, 0, original->getWidth() - 1);
int y1 = LIM (yc, 0, original->getHeight() - 1);
int y2 = LIM (yc + 1, 0, original->getHeight() - 1);
int x1 = LIM (xc, 0, original->getWidth() - 1);
int x2 = LIM (xc + 1, 0, original->getWidth() - 1);
if (enableCA) {
chTrans[c][y][x] = vignmul * (chOrig[c][y1][x1] * (1.0 - Dx) * (1.0 - Dy) + chOrig[c][y1][x2] * Dx * (1.0 - Dy) + chOrig[c][y2][x1] * (1.0 - Dx) * Dy + chOrig[c][y2][x2] * Dx * Dy);
} else {
transformed->r(y, x) = vignmul * (original->r(y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->r(y1, x2) * Dx * (1.0 - Dy) + original->r(y2, x1) * (1.0 - Dx) * Dy + original->r(y2, x2) * Dx * Dy);
transformed->g(y, x) = vignmul * (original->g(y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->g(y1, x2) * Dx * (1.0 - Dy) + original->g(y2, x1) * (1.0 - Dx) * Dy + original->g(y2, x2) * Dx * Dy);
transformed->b(y, x) = vignmul * (original->b(y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->b(y1, x2) * Dx * (1.0 - Dy) + original->b(y2, x1) * (1.0 - Dx) * Dy + original->b(y2, x2) * Dx * Dy);
transformed->r (y, x) = vignmul * (original->r (y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->r (y1, x2) * Dx * (1.0 - Dy) + original->r (y2, x1) * (1.0 - Dx) * Dy + original->r (y2, x2) * Dx * Dy);
transformed->g (y, x) = vignmul * (original->g (y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->g (y1, x2) * Dx * (1.0 - Dy) + original->g (y2, x1) * (1.0 - Dx) * Dy + original->g (y2, x2) * Dx * Dy);
transformed->b (y, x) = vignmul * (original->b (y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->b (y1, x2) * Dx * (1.0 - Dy) + original->b (y2, x1) * (1.0 - Dx) * Dy + original->b (y2, x2) * Dx * Dy);
}
}
} else {
@ -912,9 +912,9 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr
// not valid (source pixel x,y not inside source image, etc.)
chTrans[c][y][x] = 0;
} else {
transformed->r(y, x) = 0;
transformed->g(y, x) = 0;
transformed->b(y, x) = 0;
transformed->r (y, x) = 0;
transformed->g (y, x) = 0;
transformed->b (y, x) = 0;
}
}
}
@ -930,18 +930,18 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf
double h2 = (double) oH / 2.0 - 0.5;
double vig_w2, vig_h2, maxRadius, v, b, mul;
calcVignettingParams(oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul);
calcVignettingParams (oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul);
struct grad_params gp;
if (needsGradient()) {
calcGradientParams(oW, oH, params->gradient, gp);
calcGradientParams (oW, oH, params->gradient, gp);
}
struct pcv_params pcv;
if (needsPCVignetting()) {
calcPCVignetteParams(fW, fH, oW, oH, params->pcvignette, params->crop, pcv);
calcPCVignetteParams (fW, fH, oW, oH, params->pcvignette, params->crop, pcv);
}
// auxiliary variables for distortion correction
@ -949,19 +949,19 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf
double distAmount = params->distortion.amount;
// auxiliary variables for rotation
double cost = cos(params->rotate.degree * rtengine::RT_PI / 180.0);
double sint = sin(params->rotate.degree * rtengine::RT_PI / 180.0);
double cost = cos (params->rotate.degree * rtengine::RT_PI / 180.0);
double sint = sin (params->rotate.degree * rtengine::RT_PI / 180.0);
// auxiliary variables for vertical perspective correction
double vpdeg = params->perspective.vertical / 100.0 * 45.0;
double vpalpha = (90 - vpdeg) / 180.0 * rtengine::RT_PI;
double vpteta = fabs(vpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((vpdeg > 0 ? 1.0 : -1.0) * sqrt((-oW * oW * tan(vpalpha) * tan(vpalpha) + (vpdeg > 0 ? 1.0 : -1.0) * oW * tan(vpalpha) * sqrt(16 * maxRadius * maxRadius + oW * oW * tan(vpalpha) * tan(vpalpha))) / (maxRadius * maxRadius * 8)));
double vpteta = fabs (vpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((vpdeg > 0 ? 1.0 : -1.0) * sqrt ((-oW * oW * tan (vpalpha) * tan (vpalpha) + (vpdeg > 0 ? 1.0 : -1.0) * oW * tan (vpalpha) * sqrt (16 * maxRadius * maxRadius + oW * oW * tan (vpalpha) * tan (vpalpha))) / (maxRadius * maxRadius * 8)));
double vpcospt = (vpdeg >= 0 ? 1.0 : -1.0) * cos (vpteta), vptanpt = tan (vpteta);
// auxiliary variables for horizontal perspective correction
double hpdeg = params->perspective.horizontal / 100.0 * 45.0;
double hpalpha = (90 - hpdeg) / 180.0 * rtengine::RT_PI;
double hpteta = fabs(hpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((hpdeg > 0 ? 1.0 : -1.0) * sqrt((-oH * oH * tan(hpalpha) * tan(hpalpha) + (hpdeg > 0 ? 1.0 : -1.0) * oH * tan(hpalpha) * sqrt(16 * maxRadius * maxRadius + oH * oH * tan(hpalpha) * tan(hpalpha))) / (maxRadius * maxRadius * 8)));
double hpteta = fabs (hpalpha - rtengine::RT_PI / 2) < 3e-4 ? 0.0 : acos ((hpdeg > 0 ? 1.0 : -1.0) * sqrt ((-oH * oH * tan (hpalpha) * tan (hpalpha) + (hpdeg > 0 ? 1.0 : -1.0) * oH * tan (hpalpha) * sqrt (16 * maxRadius * maxRadius + oH * oH * tan (hpalpha) * tan (hpalpha))) / (maxRadius * maxRadius * 8)));
double hpcospt = (hpdeg >= 0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta);
double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, pLCPMap) : 1.0;
@ -976,13 +976,13 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf
double x_d = x, y_d = y;
if (pLCPMap && params->lensProf.useDist) {
correct_distortion(pLCPMap, x_d, y_d, cx, cy); // must be first transform
correct_distortion (pLCPMap, x_d, y_d, cx, cy); // must be first transform
}
y_d = ascale * (y_d + cy - h2); // centering y coord & scale
x_d = ascale * (x_d + cx - w2); // centering x coord & scale
double vig_x_d, vig_y_d;
double vig_x_d = 0., vig_y_d = 0.;
if (needsVignetting()) {
vig_x_d = ascale * (x + cx - vig_w2); // centering x coord & scale
@ -1007,18 +1007,18 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf
double s = 1;
if (needsDist) {
double r = sqrt(Dx * Dx + Dy * Dy) / maxRadius; // sqrt is slow
double r = sqrt (Dx * Dx + Dy * Dy) / maxRadius; // sqrt is slow
s = 1.0 - distAmount + distAmount * r ;
Dx *= s;
Dy *= s;
}
double r2;
double r2 = 0.;
if (needsVignetting()) {
double vig_Dx = vig_x_d * cost - vig_y_d * sint;
double vig_Dy = vig_x_d * sint + vig_y_d * cost;
r2 = sqrt(vig_Dx * vig_Dx + vig_Dy * vig_Dy);
r2 = sqrt (vig_Dx * vig_Dx + vig_Dy * vig_Dy);
}
// de-center
@ -1040,41 +1040,41 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf
double vignmul = 1.0;
if (needsVignetting()) {
if(darkening) {
vignmul /= std::max(v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001);
if (darkening) {
vignmul /= std::max (v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001);
} else {
vignmul = v + mul * tanh (b * (maxRadius - s * r2) / maxRadius);
}
}
if (needsGradient()) {
vignmul *= calcGradientFactor(gp, cx + x, cy + y);
vignmul *= calcGradientFactor (gp, cx + x, cy + y);
}
if (needsPCVignetting()) {
vignmul *= calcPCVignetteFactor(pcv, cx + x, cy + y);
vignmul *= calcPCVignetteFactor (pcv, cx + x, cy + y);
}
if (yc < original->getHeight() - 1 && xc < original->getWidth() - 1) {
// all interpolation pixels inside image
transformed->r(y, x) = vignmul * (original->r(yc, xc) * (1.0 - Dx) * (1.0 - Dy) + original->r(yc, xc + 1) * Dx * (1.0 - Dy) + original->r(yc + 1, xc) * (1.0 - Dx) * Dy + original->r(yc + 1, xc + 1) * Dx * Dy);
transformed->g(y, x) = vignmul * (original->g(yc, xc) * (1.0 - Dx) * (1.0 - Dy) + original->g(yc, xc + 1) * Dx * (1.0 - Dy) + original->g(yc + 1, xc) * (1.0 - Dx) * Dy + original->g(yc + 1, xc + 1) * Dx * Dy);
transformed->b(y, x) = vignmul * (original->b(yc, xc) * (1.0 - Dx) * (1.0 - Dy) + original->b(yc, xc + 1) * Dx * (1.0 - Dy) + original->b(yc + 1, xc) * (1.0 - Dx) * Dy + original->b(yc + 1, xc + 1) * Dx * Dy);
transformed->r (y, x) = vignmul * (original->r (yc, xc) * (1.0 - Dx) * (1.0 - Dy) + original->r (yc, xc + 1) * Dx * (1.0 - Dy) + original->r (yc + 1, xc) * (1.0 - Dx) * Dy + original->r (yc + 1, xc + 1) * Dx * Dy);
transformed->g (y, x) = vignmul * (original->g (yc, xc) * (1.0 - Dx) * (1.0 - Dy) + original->g (yc, xc + 1) * Dx * (1.0 - Dy) + original->g (yc + 1, xc) * (1.0 - Dx) * Dy + original->g (yc + 1, xc + 1) * Dx * Dy);
transformed->b (y, x) = vignmul * (original->b (yc, xc) * (1.0 - Dx) * (1.0 - Dy) + original->b (yc, xc + 1) * Dx * (1.0 - Dy) + original->b (yc + 1, xc) * (1.0 - Dx) * Dy + original->b (yc + 1, xc + 1) * Dx * Dy);
} else {
// edge pixels
int y1 = LIM(yc, 0, original->getHeight() - 1);
int y2 = LIM(yc + 1, 0, original->getHeight() - 1);
int x1 = LIM(xc, 0, original->getWidth() - 1);
int x2 = LIM(xc + 1, 0, original->getWidth() - 1);
transformed->r(y, x) = vignmul * (original->r(y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->r(y1, x2) * Dx * (1.0 - Dy) + original->r(y2, x1) * (1.0 - Dx) * Dy + original->r(y2, x2) * Dx * Dy);
transformed->g(y, x) = vignmul * (original->g(y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->g(y1, x2) * Dx * (1.0 - Dy) + original->g(y2, x1) * (1.0 - Dx) * Dy + original->g(y2, x2) * Dx * Dy);
transformed->b(y, x) = vignmul * (original->b(y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->b(y1, x2) * Dx * (1.0 - Dy) + original->b(y2, x1) * (1.0 - Dx) * Dy + original->b(y2, x2) * Dx * Dy);
int y1 = LIM (yc, 0, original->getHeight() - 1);
int y2 = LIM (yc + 1, 0, original->getHeight() - 1);
int x1 = LIM (xc, 0, original->getWidth() - 1);
int x2 = LIM (xc + 1, 0, original->getWidth() - 1);
transformed->r (y, x) = vignmul * (original->r (y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->r (y1, x2) * Dx * (1.0 - Dy) + original->r (y2, x1) * (1.0 - Dx) * Dy + original->r (y2, x2) * Dx * Dy);
transformed->g (y, x) = vignmul * (original->g (y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->g (y1, x2) * Dx * (1.0 - Dy) + original->g (y2, x1) * (1.0 - Dx) * Dy + original->g (y2, x2) * Dx * Dy);
transformed->b (y, x) = vignmul * (original->b (y1, x1) * (1.0 - Dx) * (1.0 - Dy) + original->b (y1, x2) * Dx * (1.0 - Dy) + original->b (y2, x1) * (1.0 - Dx) * Dy + original->b (y2, x2) * Dx * Dy);
}
} else {
// not valid (source pixel x,y not inside source image, etc.)
transformed->r(y, x) = 0;
transformed->g(y, x) = 0;
transformed->b(y, x) = 0;
transformed->r (y, x) = 0;
transformed->g (y, x) = 0;
transformed->b (y, x) = 0;
}
}
}
@ -1126,12 +1126,12 @@ bool ImProcFunctions::needsPerspective ()
bool ImProcFunctions::needsGradient ()
{
return params->gradient.enabled && fabs(params->gradient.strength) > 1e-15;
return params->gradient.enabled && fabs (params->gradient.strength) > 1e-15;
}
bool ImProcFunctions::needsPCVignetting ()
{
return params->pcvignette.enabled && fabs(params->pcvignette.strength) > 1e-15;
return params->pcvignette.enabled && fabs (params->pcvignette.strength) > 1e-15;
}
bool ImProcFunctions::needsVignetting ()

View File

@ -33,6 +33,7 @@
#include <omp.h>
#endif
using namespace std;
namespace rtengine
@ -44,7 +45,7 @@ using namespace procparams;
extern const Settings* settings;
void fillCurveArrayVib(DiagonalCurve* diagCurve, LUTf &outCurve)
void fillCurveArrayVib (DiagonalCurve* diagCurve, LUTf &outCurve)
{
if (diagCurve) {
@ -56,7 +57,7 @@ void fillCurveArrayVib(DiagonalCurve* diagCurve, LUTf &outCurve)
// change to [0,1] range
// apply custom/parametric/NURBS curve, if any
// and store result in a temporary array
outCurve[i] = 65535.f * diagCurve->getVal( double(i) / 65535.0 );
outCurve[i] = 65535.f * diagCurve->getVal ( double (i) / 65535.0 );
}
} else {
outCurve.makeIdentity();
@ -111,8 +112,8 @@ void ImProcFunctions::vibrance (LabImage* lab)
// I use diagonal because I think it's better
LUTf skin_curve (65536, 0);
if(skinCurveIsSet) {
fillCurveArrayVib(dcurve, skin_curve);
if (skinCurveIsSet) {
fillCurveArrayVib (dcurve, skin_curve);
}
if (dcurve) {
@ -123,10 +124,10 @@ void ImProcFunctions::vibrance (LabImage* lab)
// skin_curve.dump("skin_curve");
const float chromaPastel = float(params->vibrance.pastels) / 100.0f;
const float chromaSatur = float(params->vibrance.saturated) / 100.0f;
const float chromaPastel = float (params->vibrance.pastels) / 100.0f;
const float chromaSatur = float (params->vibrance.saturated) / 100.0f;
const float p00 = 0.07f;
const float limitpastelsatur = (static_cast<float>(params->vibrance.psthreshold.value[ThresholdSelector::TS_TOPLEFT]) / 100.0f) * (1.0f - p00) + p00;
const float limitpastelsatur = (static_cast<float> (params->vibrance.psthreshold.value[ThresholdSelector::TS_TOPLEFT]) / 100.0f) * (1.0f - p00) + p00;
const float maxdp = (limitpastelsatur - p00) / 4.0f;
const float maxds = (1.0 - limitpastelsatur) / 4.0f;
const float p0 = p00 + maxdp;
@ -135,10 +136,10 @@ void ImProcFunctions::vibrance (LabImage* lab)
const float s0 = limitpastelsatur + maxds;
const float s1 = limitpastelsatur + 2.0f * maxds;
const float s2 = limitpastelsatur + 3.0f * maxds;
const float transitionweighting = static_cast<float>(params->vibrance.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]) / 100.0f;
const float transitionweighting = static_cast<float> (params->vibrance.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]) / 100.0f;
float chromamean = 0.0f;
if(chromaPastel != chromaSatur) {
if (chromaPastel != chromaSatur) {
//if sliders pastels and saturated are different: transition with a double linear interpolation: between p2 and limitpastelsatur, and between limitpastelsatur and s0
//modify the "mean" point in function of double threshold => differential transition
chromamean = maxdp * (chromaSatur - chromaPastel) / (s0 - p2) + chromaPastel;
@ -208,8 +209,8 @@ void ImProcFunctions::vibrance (LabImage* lab)
if (settings->verbose) {
#endif
printf("vibrance: p0=%1.2f p1=%1.2f p2=%1.2f s0=%1.2f s1=%1.2f s2=%1.2f\n", p0, p1, p2, s0, s1, s2);
printf(" pastel=%f satur=%f limit= %1.2f chromamean=%0.5f\n", 1.0f + chromaPastel, 1.0f + chromaSatur, limitpastelsatur, chromamean);
printf ("vibrance: p0=%1.2f p1=%1.2f p2=%1.2f s0=%1.2f s1=%1.2f s2=%1.2f\n", p0, p1, p2, s0, s1, s2);
printf (" pastel=%f satur=%f limit= %1.2f chromamean=%0.5f\n", 1.0f + chromaPastel, 1.0f + chromaSatur, limitpastelsatur, chromamean);
}
#pragma omp for schedule(dynamic, 16)
@ -217,12 +218,12 @@ void ImProcFunctions::vibrance (LabImage* lab)
for (int i = 0; i < height; i++)
for (int j = 0; j < width; j++) {
float LL = lab->L[i][j] / 327.68f;
float CC = sqrt(SQR(lab->a[i][j]) + SQR(lab->b[i][j])) / 327.68f;
float HH = xatan2f(lab->b[i][j], lab->a[i][j]);
float CC = sqrt (SQR (lab->a[i][j]) + SQR (lab->b[i][j])) / 327.68f;
float HH = xatan2f (lab->b[i][j], lab->a[i][j]);
float satredu = 1.0f; //reduct sat in function of skin
if(protectskins) {
if (protectskins) {
Color::SkinSat (LL, HH, CC, satredu);// for skin colors
}
@ -234,7 +235,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
float R, G, B;
float2 sincosval;
if(CC == 0.0f) {
if (CC == 0.0f) {
sincosval.y = 1.f;
sincosval.x = 0.0f;
} else {
@ -246,26 +247,26 @@ void ImProcFunctions::vibrance (LabImage* lab)
bool neg = false;
bool more_rgb = false;
//gamut control : Lab values are in gamut
Color::gamutLchonly(HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f, neg, more_rgb);
Color::gamutLchonly (HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f, neg, more_rgb);
if(neg) {
if (neg) {
negat++;
}
if(more_rgb) {
if (more_rgb) {
moreRGB++;
}
#else
//gamut control : Lab values are in gamut
Color::gamutLchonly(HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f);
Color::gamutLchonly (HH, sincosval, Lprov, Chprov, R, G, B, wip, highlight, 0.15f, 0.98f);
#endif
if(Chprov > 6.0f) {
const float saturation = SAT(R, G, B);
if (Chprov > 6.0f) {
const float saturation = SAT (R, G, B);
if(saturation > 0.0f) {
if(satredu != 1.0f) {
if (saturation > 0.0f) {
if (satredu != 1.0f) {
// for skin, no differentiation
sathue [0] = sathue [1] = sathue [2] = sathue [3] = sathue[4] = 1.0f;
sathue2[0] = sathue2[1] = sathue2[2] = sathue2[3] = 1.0f;
@ -274,7 +275,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
//I try to take into account: Munsell response (human vision) and Gamut..(less response for red): preferably using Prophoto or WideGamut
//blue: -1.80 -3.14 green = 2.1 3.14 green-yellow=1.4 2.1 red:0 1.4 blue-purple:-0.7 -1.4 purple: 0 -0.7
//these values allow a better and differential response
if(LL < 20.0f) {//more for blue-purple, blue and red modulate
if (LL < 20.0f) { //more for blue-purple, blue and red modulate
if (/*HH> -3.1415f &&*/ HH < -1.5f ) {
sathue[0] = 1.3f; //blue
sathue[1] = 1.2f;
@ -285,7 +286,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.1f ;
sathue2[2] = 1.05f;
sathue2[3] = 1.0f;
} else if(/*HH>=-1.5f &&*/ HH < -0.7f ) {
} else if (/*HH>=-1.5f &&*/ HH < -0.7f ) {
sathue[0] = 1.6f; //blue purple 1.2 1.1
sathue[1] = 1.4f;
sathue[2] = 1.3f;
@ -295,7 +296,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.15f;
sathue2[2] = 1.1f ;
sathue2[3] = 1.0f;
} else if(/*HH>=-0.7f &&*/ HH < 0.0f ) {
} else if (/*HH>=-0.7f &&*/ HH < 0.0f ) {
sathue[0] = 1.2f; //purple
sathue[1] = 1.0f;
sathue[2] = 1.0f;
@ -307,7 +308,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[3] = 1.0f;
}
// else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=1.1f;sathue[1]=1.1f;sathue[2]=1.1f;sathue[3]=1.0f ;sathue[4]=0.4f;sathue2[0]=1.0f ;sathue2[1]=1.0f ;sathue2[2]=1.0f ;sathue2[3]=1.0f;}//red 0.8 0.7
else if(/*HH>= 0.0f &&*/ HH <= 1.4f ) {
else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) {
sathue[0] = 1.3f; //red 0.8 0.7
sathue[1] = 1.2f;
sathue[2] = 1.1f;
@ -317,7 +318,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.0f ;
sathue2[2] = 1.0f ;
sathue2[3] = 1.0f;
} else if(/*HH> 1.4f &&*/ HH <= 2.1f ) {
} else if (/*HH> 1.4f &&*/ HH <= 2.1f ) {
sathue[0] = 1.0f; //green yellow 1.2 1.1
sathue[1] = 1.0f;
sathue[2] = 1.0f;
@ -349,7 +350,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.1f ;
sathue2[2] = 1.05f;
sathue2[3] = 1.0f;
} else if(/*HH>=-1.5f &&*/ HH < -0.7f ) {
} else if (/*HH>=-1.5f &&*/ HH < -0.7f ) {
sathue[0] = 1.3f; //blue purple 1.2 1.1
sathue[1] = 1.2f;
sathue[2] = 1.1f;
@ -359,7 +360,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.05f;
sathue2[2] = 1.0f ;
sathue2[3] = 1.0f;
} else if(/*HH>=-0.7f &&*/ HH < 0.0f ) {
} else if (/*HH>=-0.7f &&*/ HH < 0.0f ) {
sathue[0] = 1.2f; //purple
sathue[1] = 1.0f;
sathue[2] = 1.0f;
@ -371,7 +372,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[3] = 1.0f;
}
// else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=0.8f;sathue[1]=0.8f;sathue[2]=0.8f;sathue[3]=0.8f ;sathue[4]=0.4f;sathue2[0]=0.8f ;sathue2[1]=0.8f ;sathue2[2]=0.8f ;sathue2[3]=0.8f;}//red 0.8 0.7
else if(/*HH>= 0.0f &&*/ HH <= 1.4f ) {
else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) {
sathue[0] = 1.1f; //red 0.8 0.7
sathue[1] = 1.0f;
sathue[2] = 0.9f;
@ -381,7 +382,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 0.8f ;
sathue2[2] = 0.8f ;
sathue2[3] = 0.8f;
} else if(/*HH> 1.4f &&*/ HH <= 2.1f ) {
} else if (/*HH> 1.4f &&*/ HH <= 2.1f ) {
sathue[0] = 1.1f; //green yellow 1.2 1.1
sathue[1] = 1.1f;
sathue[2] = 1.1f;
@ -414,7 +415,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.1f ;
sathue2[2] = 1.05f;
sathue2[3] = 1.0f;
} else if(/*HH>=-1.5f &&*/ HH < -0.7f ) {
} else if (/*HH>=-1.5f &&*/ HH < -0.7f ) {
sathue[0] = 1.3f; //blue purple 1.2 1.1
sathue[1] = 1.2f;
sathue[2] = 1.15f;
@ -424,7 +425,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 1.05f;
sathue2[2] = 1.0f ;
sathue2[3] = 1.0f;
} else if(/*HH>=-0.7f &&*/ HH < 0.0f ) {
} else if (/*HH>=-0.7f &&*/ HH < 0.0f ) {
sathue[0] = 1.2f; //purple
sathue[1] = 1.0f;
sathue[2] = 1.0f ;
@ -436,7 +437,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[3] = 1.0f;
}
// else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=0.8f;sathue[1]=0.8f;sathue[2]=0.8f ;sathue[3]=0.8f ;sathue[4]=0.3f;sathue2[0]=0.8f ;sathue2[1]=0.8f ;sathue2[2]=0.8f ;sathue2[3]=0.8f;}//red 0.8 0.7
else if(/*HH>= 0.0f &&*/ HH <= 1.4f ) {
else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) {
sathue[0] = 1.1f; //red 0.8 0.7
sathue[1] = 1.0f;
sathue[2] = 0.9f ;
@ -446,7 +447,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 0.8f ;
sathue2[2] = 0.8f ;
sathue2[3] = 0.8f;
} else if(/*HH> 1.4f &&*/ HH <= 2.1f ) {
} else if (/*HH> 1.4f &&*/ HH <= 2.1f ) {
sathue[0] = 1.3f; //green yellow 1.2 1.1
sathue[1] = 1.2f;
sathue[2] = 1.1f ;
@ -478,7 +479,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 0.8f ;
sathue2[2] = 0.8f ;
sathue2[3] = 0.8f;
} else if(/*HH>=-1.5f &&*/ HH < -0.7f ) {
} else if (/*HH>=-1.5f &&*/ HH < -0.7f ) {
sathue[0] = 1.0f; //blue purple 1.2 1.1
sathue[1] = 1.0f;
sathue[2] = 0.9f;
@ -488,7 +489,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 0.8f ;
sathue2[2] = 0.8f ;
sathue2[3] = 0.8f;
} else if(/*HH>=-0.7f &&*/ HH < 0.0f ) {
} else if (/*HH>=-0.7f &&*/ HH < 0.0f ) {
sathue[0] = 1.2f; //purple
sathue[1] = 1.0f;
sathue[2] = 1.0f;
@ -500,7 +501,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[3] = 0.8f;
}
// else if( HH>= 0.0f && HH<= 1.4f ) {sathue[0]=0.8f;sathue[1]=0.8f;sathue[2]=0.8f;sathue[3]=0.8f;sathue[4]=0.2f;sathue2[0]=0.8f;sathue2[1]=0.8f ;sathue2[2]=0.8f ;sathue2[3]=0.8f;}//red 0.8 0.7
else if(/*HH>= 0.0f &&*/ HH <= 1.4f ) {
else if (/*HH>= 0.0f &&*/ HH <= 1.4f ) {
sathue[0] = 1.1f; //red 0.8 0.7
sathue[1] = 1.0f;
sathue[2] = 0.9f;
@ -510,7 +511,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
sathue2[1] = 0.8f ;
sathue2[2] = 0.8f ;
sathue2[3] = 0.8f;
} else if(/*HH> 1.4f &&*/ HH <= 2.1f ) {
} else if (/*HH> 1.4f &&*/ HH <= 2.1f ) {
sathue[0] = 1.6f; //green yellow 1.2 1.1
sathue[1] = 1.5f;
sathue[2] = 1.4f;
@ -534,7 +535,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
}
}
float chmodpastel, chmodsat;
float chmodpastel = 0.f, chmodsat = 0.f;
// variables to improve transitions
float pa, pb;// transition = pa*saturation + pb
float chl00 = chromaPastel * satredu * sathue[4];
@ -585,16 +586,16 @@ void ImProcFunctions::vibrance (LabImage* lab)
chmodsat = pa * saturation + pb;
}
if(chromaPastel != chromaSatur) {
if (chromaPastel != chromaSatur) {
// Pastels
if(saturation > p2 && saturation < limitpastelsatur) {
if (saturation > p2 && saturation < limitpastelsatur) {
float newchromaPastel = chromaPastel_a * saturation + chromaPastel_b;
chmodpastel = newchromaPastel * satredu * sathue[3];
}
// Saturated
if(saturation < s0 && saturation >= limitpastelsatur) {
if (saturation < s0 && saturation >= limitpastelsatur) {
float newchromaSatur = chromaSatur_a * saturation + chromaSatur_b;
chmodsat = newchromaSatur * satredu * sathue2[0];
}
@ -603,25 +604,25 @@ void ImProcFunctions::vibrance (LabImage* lab)
if (saturation <= limitpastelsatur) {
if (chmodpastel > 2.0f ) {
chmodpastel = 2.0f; //avoid too big values
} else if(chmodpastel < -0.93f) {
} else if (chmodpastel < -0.93f) {
chmodpastel = -0.93f; //avoid negative values
}
Chprov *= (1.0f + chmodpastel);
if(Chprov < 6.0f) {
if (Chprov < 6.0f) {
Chprov = 6.0f;
}
} else { //if (saturation > limitpastelsatur)
if (chmodsat > 1.8f ) {
chmodsat = 1.8f; //saturated
} else if(chmodsat < -0.93f) {
} else if (chmodsat < -0.93f) {
chmodsat = -0.93f;
}
Chprov *= 1.0f + chmodsat;
if(Chprov < 6.0f) {
if (Chprov < 6.0f) {
Chprov = 6.0f;
}
}
@ -631,15 +632,15 @@ void ImProcFunctions::vibrance (LabImage* lab)
bool hhModified = false;
// Vibrance's Skin curve
if(skinCurveIsSet) {
if (skinCurveIsSet) {
if (HH > skbeg && HH < skend) {
if(Chprov < 60.0f) {//skin hue : todo ==> transition
if (Chprov < 60.0f) { //skin hue : todo ==> transition
float HHsk = ask * HH + bsk;
float Hn = (skin_curve[HHsk] - bsk) / ask;
float Hc = (Hn * xx + HH * (1.0f - xx));
HH = Hc;
hhModified = true;
} else if(Chprov < (60.0f + dchr)) { //transition chroma
} else if (Chprov < (60.0f + dchr)) { //transition chroma
float HHsk = ask * HH + bsk;
float Hn = (skin_curve[HHsk] - bsk) / ask;
float Hc = (Hn * xx + HH * (1.0f - xx));
@ -650,7 +651,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
}
}
//transition hue
else if(HH > (skbeg - dhue) && HH <= skbeg && Chprov < (60.0f + dchr * 0.5f)) {
else if (HH > (skbeg - dhue) && HH <= skbeg && Chprov < (60.0f + dchr * 0.5f)) {
float HHsk = ask * skbeg + bsk;
float Hn = (skin_curve[HHsk] - bsk) / ask;
float Hcc = (Hn * xx + skbeg * (1.0f - xx));
@ -658,7 +659,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
float bdh = Hcc - adh * skbeg;
HH = adh * HH + bdh;
hhModified = true;
} else if(HH >= skend && HH < (skend + dhue) && Chprov < (60.0f + dchr * 0.5f)) {
} else if (HH >= skend && HH < (skend + dhue) && Chprov < (60.0f + dchr * 0.5f)) {
float HHsk = ask * skend + bsk;
float Hn = (skin_curve[HHsk] - bsk) / ask;
float Hcc = (Hn * xx + skend * (1.0f - xx));
@ -671,8 +672,8 @@ void ImProcFunctions::vibrance (LabImage* lab)
//Munsell correction
// float2 sincosval;
if(!avoidcolorshift && hhModified) {
sincosval = xsincosf(HH);
if (!avoidcolorshift && hhModified) {
sincosval = xsincosf (HH);
}
float aprovn, bprovn;
@ -681,18 +682,18 @@ void ImProcFunctions::vibrance (LabImage* lab)
do {
inGamut = true;
if(avoidcolorshift) {
if (avoidcolorshift) {
float correctionHue = 0.0f;
float correctlum = 0.0f;
#ifdef _DEBUG
Color::AllMunsellLch(/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum, MunsDebugInfo);
Color::AllMunsellLch (/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum, MunsDebugInfo);
#else
Color::AllMunsellLch(/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum);
Color::AllMunsellLch (/*lumaMuns*/false, Lprov, Lprov, HH, Chprov, CC, correctionHue, correctlum);
#endif
if(correctionHue != 0.f || hhModified) {
sincosval = xsincosf(HH + correctionHue);
if (correctionHue != 0.f || hhModified) {
sincosval = xsincosf (HH + correctionHue);
hhModified = false;
}
}
@ -703,14 +704,14 @@ void ImProcFunctions::vibrance (LabImage* lab)
float fyy = (0.00862069f * Lprov ) + 0.137932f;
float fxx = (0.002f * aprovn) + fyy;
float fzz = fyy - (0.005f * bprovn);
float xx_ = 65535.f * Color::f2xyz(fxx) * Color::D50x;
float xx_ = 65535.f * Color::f2xyz (fxx) * Color::D50x;
// float yy_ = 65535.0f * Color::f2xyz(fyy);
float zz_ = 65535.f * Color::f2xyz(fzz) * Color::D50z;
float zz_ = 65535.f * Color::f2xyz (fzz) * Color::D50z;
float yy_ = 65535.f * ((Lprov > Color::epskap) ? fyy * fyy*fyy : Lprov / Color::kappa);
Color::xyz2rgb(xx_, yy_, zz_, R, G, B, wip);
Color::xyz2rgb (xx_, yy_, zz_, R, G, B, wip);
if(R < 0.0f || G < 0.0f || B < 0.0f) {
if (R < 0.0f || G < 0.0f || B < 0.0f) {
#ifdef _DEBUG
negsat++;
#endif
@ -719,7 +720,7 @@ void ImProcFunctions::vibrance (LabImage* lab)
}
// if "highlight reconstruction" enabled don't control Gamut for highlights
if((!highlight) && (R > 65535.0f || G > 65535.0f || B > 65535.0f)) {
if ((!highlight) && (R > 65535.0f || G > 65535.0f || B > 65535.0f)) {
#ifdef _DEBUG
moresat++;
#endif
@ -740,11 +741,11 @@ void ImProcFunctions::vibrance (LabImage* lab)
t2e.set();
if (settings->verbose) {
printf("Vibrance (performed in %d usec):\n", t2e.etime(t1e));
printf(" Gamut: G1negat=%iiter G165535=%iiter G2negsat=%iiter G265535=%iiter\n", negat, moreRGB, negsat, moresat);
printf ("Vibrance (performed in %d usec):\n", t2e.etime (t1e));
printf (" Gamut: G1negat=%iiter G165535=%iiter G2negsat=%iiter G265535=%iiter\n", negat, moreRGB, negsat, moresat);
if (MunsDebugInfo) {
printf(" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad depass=%u\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass);
printf (" Munsell chrominance: MaxBP=%1.2frad MaxRY=%1.2frad MaxGY=%1.2frad MaxRP=%1.2frad depass=%u\n", MunsDebugInfo->maxdhue[0], MunsDebugInfo->maxdhue[1], MunsDebugInfo->maxdhue[2], MunsDebugInfo->maxdhue[3], MunsDebugInfo->depass);
}
}

View File

@ -250,7 +250,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int
cp.edgampl = (float) params->wavelet.edgeampli;
}
int N = imheight * imwidth;
//int N = imheight * imwidth;
int maxmul = params->wavelet.thres;
cp.maxilev = maxmul;
static const float scales[10] = {1.f, 2.f, 4.f, 8.f, 16.f, 32.f, 64.f, 128.f, 256.f, 512.f};
@ -699,7 +699,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int
int width = tileright - tileleft;
int height = tilebottom - tiletop;
LabImage * labco;
float **Lold;
float **Lold = nullptr;
float *LoldBuffer = nullptr;
if(numtiles == 1) { // untiled processing => we can use output buffer for labco
@ -2597,7 +2597,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
float bedstr = 1.f - 10.f * aedstr;
if(cp.val > 0 && cp.edgeena) {
float * koe;
float * koe = nullptr;
float maxkoe = 0.f;
if(!lipschitz) {
@ -2766,7 +2766,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
float asig = 0.166f / sigma[level];
float bsig = 0.5f - asig * mean[level];
float amean = 0.5f / mean[level];
float absciss;
float absciss = 0.f;
float kinterm;
float kmul;
int borderL = 1;

View File

@ -640,31 +640,31 @@ static void _am_getGradientWinAffine(
}
/*********************************************************************
* _computeAffineMappedImage
* used only for DEBUG output
*
*/
static void _am_computeAffineMappedImage(
_KLT_FloatImage img, /* images */
float x, float y, /* center of window */
float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */
int width, int height, /* size of window */
_FloatWindow imgdiff) /* output */
{
int hw = width/2, hh = height/2;
int i, j;
float mi, mj;
/* Compute values */
for (j = -hh ; j <= hh ; j++)
for (i = -hw ; i <= hw ; i++) {
mi = Axx * i + Axy * j;
mj = Ayx * i + Ayy * j;
*imgdiff++ = _interpolate(x+mi, y+mj, img);
}
}
///*********************************************************************
// * _computeAffineMappedImage
// * used only for DEBUG output
// *
//*/
//
//static void _am_computeAffineMappedImage(
// _KLT_FloatImage img, /* images */
// float x, float y, /* center of window */
// float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */
// int width, int height, /* size of window */
// _FloatWindow imgdiff) /* output */
//{
// int hw = width/2, hh = height/2;
// int i, j;
// float mi, mj;
//
// /* Compute values */
// for (j = -hh ; j <= hh ; j++)
// for (i = -hw ; i <= hw ; i++) {
// mi = Axx * i + Axy * j;
// mj = Ayx * i + Ayy * j;
// *imgdiff++ = _interpolate(x+mi, y+mj, img);
// }
//}
/*********************************************************************
@ -986,7 +986,7 @@ static int _am_trackFeatureAffine(
_FloatWindow imgdiff, gradx, grady;
float gxx, gxy, gyy, ex, ey, dx, dy;
float gxx, gxy, gyy, ex, ey, dx = 0.f, dy = 0.f;
int iteration = 0;
int status = 0;
int hw = width/2;
@ -1253,7 +1253,7 @@ void KLTTrackFeatures(
pyramid2, pyramid2_gradx, pyramid2_grady;
float subsampling = (float) tc->subsampling;
float xloc, yloc, xlocout, ylocout;
int val;
int val = 0;
int indx, r;
KLT_BOOL floatimg1_created = FALSE;
int i;

View File

@ -866,7 +866,6 @@ Glib::ustring LCPStore::getDefaultCommonDirectory() const
#ifdef WIN32
WCHAR pathW[MAX_PATH] = {0};
char pathA[MAX_PATH];
if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_COMMON_APPDATA, false)) {
char pathA[MAX_PATH];

View File

@ -364,7 +364,7 @@ int fscanf (IMFILE* f, const char* s ...)
char buf[50], *endptr = nullptr;
int copy_sz = f->size - f->pos;
if (copy_sz > sizeof(buf)) {
if (copy_sz > static_cast<int>(sizeof(buf))) {
copy_sz = sizeof(buf) - 1;
}

View File

@ -68,7 +68,10 @@ inline void fseek (IMFILE* f, int p, int how)
} else if (how == SEEK_CUR) {
f->pos += p;
} else if (how == SEEK_END) {
f->pos = f->size + p;
if(p <= 0 && -p <= f->size) {
f->pos = f->size + p;
}
return;
}
if (f->pos < 0 || f->pos > f->size) {

View File

@ -71,9 +71,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
int w, h;
double scale = 1.;
if (tpp) {
tpp->getDimensions(w, h, scale);
}
tpp->getDimensions(w, h, scale);
previewImage = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, w, h);
previewImage->flush();
@ -141,7 +139,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
if (data) {
int w, h;
double scale = 1.;
// double scale = 1.;
w = output->getWidth();
h = output->getHeight();
previewImage = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, w, h);

View File

@ -442,7 +442,7 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro
return 2;
}
if(!strcmp(make,"Fujifilm") && raw_height * raw_width * 2 != raw_size) {
if(!strcmp(make,"Fujifilm") && raw_height * raw_width * 2u != raw_size) {
parse_fuji_compressed_header();
}
@ -779,7 +779,7 @@ RawImage::is_ppmThumb() const
!thumb_load_raw );
}
void RawImage::getXtransMatrix( char XtransMatrix[6][6])
void RawImage::getXtransMatrix( int XtransMatrix[6][6])
{
for(int row = 0; row < 6; row++)
for(int col = 0; col < 6; col++) {

View File

@ -180,7 +180,7 @@ public:
eSensorType getSensorType();
void getRgbCam (float rgbcam[3][4]);
void getXtransMatrix ( char xtransMatrix[6][6]);
void getXtransMatrix ( int xtransMatrix[6][6]);
void clearXtransCblack( )
{
for(int c = 0; c < 4; c++) {

View File

@ -425,25 +425,6 @@ RawImageSource::RawImageSource ()
: ImageSource()
, W(0), H(0)
, plistener(nullptr)
, border(4)
, ri(nullptr)
, cache(nullptr)
, rawData(0, 0)
, green(0, 0)
, red(0, 0)
, blue(0, 0)
, lc00(0.0)
, lc01(0.0)
, lc02(0.0)
, lc10(0.0)
, lc11(0.0)
, lc12(0.0)
, lc20(0.0)
, lc21(0.0)
, lc22(0.0)
, hlmax{}
, clmax{}
, chmax{}
, scale_mul{}
, c_black{}
, c_white{}
@ -458,10 +439,29 @@ RawImageSource::RawImageSource ()
, cam_xyz{}
, fuji(false)
, d1x(false)
, border(4)
, chmax{}
, hlmax{}
, clmax{}
, initialGain(0.0)
, camInitialGain(0.0)
, defGain(0.0)
, ri(nullptr)
, lc00(0.0)
, lc01(0.0)
, lc02(0.0)
, lc10(0.0)
, lc11(0.0)
, lc12(0.0)
, lc20(0.0)
, lc21(0.0)
, lc22(0.0)
, cache(nullptr)
, threshold(0)
, rawData(0, 0)
, green(0, 0)
, red(0, 0)
, blue(0, 0)
{
camProfile = nullptr;
embProfile = nullptr;
@ -672,7 +672,7 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima
defGain = 0.0;
// compute image area to render in order to provide the requested part of the image
int sx1, sy1, imwidth, imheight, fw, d1xHeightOdd;
int sx1, sy1, imwidth, imheight, fw, d1xHeightOdd = 0;
transformRect (pp, tran, sx1, sy1, imwidth, imheight, fw);
// check possible overflows
@ -748,7 +748,7 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima
if (ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS || ri->get_colors() == 1) {
for (int j = 0, jx = sx1; j < imwidth; j++, jx += skip) {
jx = jx >= (maxx - skip) ? jx = maxx - skip - 1 : jx; // avoid trouble
jx = std::min(jx, maxx - skip - 1); // avoid trouble
float rtot = 0.f, gtot = 0.f, btot = 0.f;
@ -896,6 +896,11 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima
case ST_FUJI_XTRANS:
processFalseColorCorrection (image, raw.xtranssensor.ccSteps);
break;
case ST_FOVEON:
case ST_NONE:
break;
}
}
}
@ -1169,8 +1174,7 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads )
}
float wtdsum = 0.f, norm = 0.f;
int pixelColor = ri->XTRANSFC(row, col);
float oldval = rawData[row][col];
unsigned int pixelColor = ri->XTRANSFC(row, col);
if(pixelColor == 1) {
// green channel. A green pixel can either be a solitary green pixel or a member of a 2x2 square of green pixels
@ -1782,7 +1786,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
if(numFrames == 4) {
int bufferNumber = 0;
for(int i=0; i<4; ++i) {
for(unsigned int i=0; i<4; ++i) {
if(i==currFrame) {
copyOriginalPixels(raw, ri, rid, rif, rawData);
rawDataFrames[i] = &rawData;
@ -2107,7 +2111,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar
conversionBuffer[2] (W - 2 * border, H - 2 * border);
conversionBuffer[3] (W - 2 * border, H - 2 * border);
LUTf *retinexgamtab;//gamma before and after Retinex to restore tones
LUTf *retinexgamtab = nullptr;//gamma before and after Retinex to restore tones
LUTf lutTonereti;
if(retinexParams.gammaretinex == "low") {
@ -2380,7 +2384,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
LUTf lutToneireti;
lutToneireti(65536);
LUTf *retinexigamtab;//gamma before and after Retinex to restore tones
LUTf *retinexigamtab = nullptr;//gamma before and after Retinex to restore tones
if(deh.gammaretinex == "low") {
retinexigamtab = &(Color::igammatab_115_2);
@ -2840,7 +2844,7 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile
float limitFactor = 1.f;
if(raw.ff_AutoClipControl) {
int clipControlGui = 0;
// int clipControlGui = 0;
for (int m = 0; m < 2; m++)
for (int n = 0; n < 2; n++) {
@ -2885,7 +2889,7 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile
}
}
clipControlGui = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui
// clipControlGui = (1.f - limitFactor) * 100.f; // this value can be used to set the clip control slider in gui
} else {
limitFactor = max((float)(100 - raw.ff_clipControl) / 100.f, 0.01f);
}
@ -5019,7 +5023,7 @@ ColorTemp RawImageSource::getSpotWB (std::vector<Coord2D> &red, std::vector<Coor
int x;
int y;
double reds = 0, greens = 0, blues = 0;
int rn = 0;
unsigned int rn = 0;
if (ri->getSensorType() != ST_BAYER) {
if(ri->getSensorType() == ST_FUJI_XTRANS) {
@ -5210,7 +5214,7 @@ ColorTemp RawImageSource::getSpotWB (std::vector<Coord2D> &red, std::vector<Coor
}
}
if (2 * rn < red.size()) {
if (2u * rn < red.size()) {
return ColorTemp (equal);
} else {
reds = reds / rn * refwb_red;
@ -5343,7 +5347,7 @@ void RawImageSource::init ()
std::vector<double> cInversePoints;
cInversePoints.push_back(double(DCT_Spline)); // The first value is the curve type
for (int i = 0; i < sizeof(phase_one_forward) / sizeof(phase_one_forward[0]); i += 2) {
for (unsigned int i = 0; i < sizeof(phase_one_forward) / sizeof(phase_one_forward[0]); i += 2) {
cForwardPoints.push_back(phase_one_forward[i + 0]);
cForwardPoints.push_back(phase_one_forward[i + 1]);
cInversePoints.push_back(phase_one_forward[i + 1]);

View File

@ -50,7 +50,7 @@ namespace
return false;
}
const std::size_t length =
const ssize_t length =
fdata(raw_image.get_thumbOffset(), raw_image.get_file())[1] != 0xD8 && raw_image.is_ppmThumb()
? raw_image.get_thumbWidth() * raw_image.get_thumbHeight() * (raw_image.get_thumbBPS() / 8) * 3
: raw_image.get_thumbLength();
@ -254,7 +254,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
std::string fname = ri->get_filename();
std::string suffix = fname.length() > 4 ? fname.substr(fname.length() - 3) : "";
for (int i = 0; i < suffix.length(); i++) {
for (unsigned int i = 0; i < suffix.length(); i++) {
suffix[i] = std::tolower(suffix[i]);
}
@ -500,8 +500,8 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
for (int row = 0; row < high; row++)
for (int col = 0; col < wide; col++) {
unsigned ur = r = fw + (row - col) * step;
unsigned uc = c = (row + col) * step;
int ur = r = fw + (row - col) * step;
int uc = c = (row + col) * step;
if (ur > tmph - 2 || uc > tmpw - 2) {
continue;
@ -779,17 +779,33 @@ void Thumbnail::init ()
}
Thumbnail::Thumbnail () :
iColorMatrix{}, cam2xyz{}, scale(1.0), colorMatrix{}, isRaw(true),
camProfile(nullptr), thumbImg(nullptr),
camwbRed(1.0), camwbGreen(1.0), camwbBlue(1.0),
redAWBMul(-1.0), greenAWBMul(-1.0), blueAWBMul(-1.0),
autoWBTemp(2700), autoWBGreen(1.0), wbEqual(-1.0), wbTempBias(0.0),
embProfileLength(0), embProfileData(nullptr), embProfile(nullptr),
redMultiplier(1.0), greenMultiplier(1.0), blueMultiplier(1.0),
camProfile(nullptr),
iColorMatrix{},
cam2xyz{},
thumbImg(nullptr),
camwbRed(1.0),
camwbGreen(1.0),
camwbBlue(1.0),
redAWBMul(-1.0),
greenAWBMul(-1.0),
blueAWBMul(-1.0),
autoWBTemp(2700),
autoWBGreen(1.0),
wbEqual(-1.0),
wbTempBias(0.0),
aeHistCompression(3),
embProfileLength(0),
embProfileData(nullptr),
embProfile(nullptr),
redMultiplier(1.0),
greenMultiplier(1.0),
blueMultiplier(1.0),
scale(1.0),
defGain(1.0),
scaleForSave(8192),
gammaCorrected(false),
aeHistCompression(3)
colorMatrix{},
isRaw(true)
{
}
@ -959,7 +975,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
LUTu hist16 (65536);
double gamma = isRaw ? Color::sRGBGamma : 0; // usually in ImageSource, but we don't have that here
ipf.firstAnalysis (baseImg, params, hist16);
// perform transform
@ -967,7 +982,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
Imagefloat* trImg = new Imagefloat (fw, fh);
int origFW;
int origFH;
double tscale;
double tscale = 0.0;
getDimensions(origFW, origFH, tscale);
ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, origFW * tscale + 0.5, origFH * tscale + 0.5, focalLen, focalLen35mm, focusDist, 0, true); // Raw rotate degree not detectable here
delete baseImg;
@ -1193,7 +1208,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
LUTf CAMBrightCurveQ;
float CAMMean;
int sk;
int scale;
sk = 16;
int rtt = 0;
CieImage* cieView = new CieImage (fw, fh);

View File

@ -376,7 +376,7 @@ SSEFUNCTION void SHMap::dirpyr_shmap(float ** data_fine, float ** data_coarse, i
#endif
{
#if defined( __SSE2__ ) && defined( __x86_64__ )
__m128 dirwtv, valv, normv, dftemp1v, dftemp2v, fg;
vfloat dirwtv, valv, normv, dftemp1v, dftemp2v;
#endif // __SSE2__
int j;
#ifdef _OPENMP
@ -483,7 +483,7 @@ SSEFUNCTION void SHMap::dirpyr_shmap(float ** data_fine, float ** data_coarse, i
#endif
{
#if defined( __SSE2__ ) && defined( __x86_64__ )
__m128 dirwtv, valv, normv, dftemp1v, dftemp2v, fgg;
vfloat dirwtv, valv, normv, dftemp1v, dftemp2v;
float domkerv[5][5][4] ALIGNED16 = {{{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}, {{1, 1, 1, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {1, 1, 1, 1}}, {{1, 1, 1, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {1, 1, 1, 1}}, {{1, 1, 1, 1}, {2, 2, 2, 2}, {2, 2, 2, 2}, {2, 2, 2, 2}, {1, 1, 1, 1}}, {{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}};
#endif // __SSE2__

View File

@ -20,7 +20,6 @@ void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif_)
TagDirectory *exif = exif_->getDirectory();
char *value = (char *)textualInfo->getValue();
int valuesize = textualInfo->getValueSize();
char *p = value;
char *pc, *plf;

View File

@ -781,7 +781,7 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam
if (options.savePathTemplate[ix] == 'p') {
ix++;
int i = options.savePathTemplate[ix] - '0';
unsigned int i = options.savePathTemplate[ix] - '0';
if (i < pa.size()) {
path = path + pa[pa.size() - i - 1] + '/';
@ -790,7 +790,7 @@ Glib::ustring BatchQueue::calcAutoFileNameBase (const Glib::ustring& origFileNam
ix++;
} else if (options.savePathTemplate[ix] == 'd') {
ix++;
int i = options.savePathTemplate[ix] - '0';
unsigned i = options.savePathTemplate[ix] - '0';
if (i < da.size()) {
path = path + da[da.size() - i - 1];

View File

@ -32,7 +32,7 @@ Glib::RefPtr<Gdk::Pixbuf> BatchQueueEntry::savedAsIcon;
BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm)
: ThumbBrowserEntryBase(fname),
opreview(nullptr), origpw(prevw), origph(prevh), opreviewDone(false),
job(pjob), progress(0), outFileName(""), sequence(0), forceFormatOpts(false), params(pparams)
job(pjob), params(pparams), progress(0), outFileName(""), sequence(0), forceFormatOpts(false)
{
thumbnail = thm;

View File

@ -18,11 +18,12 @@
*/
#include "browserfilter.h"
BrowserFilter::BrowserFilter () : exifFilterEnabled (false),
BrowserFilter::BrowserFilter () :
showTrash (true),
showNotTrash (true),
showOriginal (false),
multiselect (false)
multiselect (false),
exifFilterEnabled (false)
{
for (int i = 0; i < 6; i++) {
showRanked[i] = true;

View File

@ -27,7 +27,6 @@ CheckBox::CheckBox (Glib::ustring label, bool const& multiImageVal)
: Gtk::CheckButton (label)
, listener (nullptr)
, lastActive (false)
, inBatchMode (false)
, multiImage (multiImageVal)
{
conn = signal_toggled().connect( sigc::mem_fun(*this, &CheckBox::buttonToggled) );
@ -36,7 +35,7 @@ CheckBox::CheckBox (Glib::ustring label, bool const& multiImageVal)
void CheckBox::buttonToggled ()
{
CheckValue newValue;
CheckValue newValue = CheckValue::unchanged;
if (multiImage) {
if (get_inconsistent()) {

View File

@ -48,7 +48,6 @@ class CheckBox : public Gtk::CheckButton // Should ideally be private, but in t
CheckBoxListener *listener;
bool lastActive;
bool inBatchMode;
bool const& multiImage;
sigc::connection conn;
void buttonToggled ();

View File

@ -20,7 +20,7 @@
Clipboard clipboard;
Clipboard::Clipboard () : partProfile (false), _hasIPTC(false), hasDiagonalCurveDataType(DCT_Empty), hasFlatCurveDataType(FCT_Empty) {}
Clipboard::Clipboard () : _hasIPTC(false), partProfile (false), hasDiagonalCurveDataType(DCT_Empty), hasFlatCurveDataType(FCT_Empty) {}
Clipboard::~Clipboard ()
{

View File

@ -1055,7 +1055,7 @@ bool ColorAppearance::adapCamComputed_ ()
void ColorAppearance::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
valY = 0.5;

View File

@ -952,7 +952,7 @@ void ColorToning::autoOpenCurve ()
void ColorToning::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (callerId == 1) { // ch - main curve
Color::hsv2rgb01(float(valY), 1.0f, 0.5f, R, G, B);

View File

@ -50,7 +50,7 @@ public:
void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller);
private:
Gtk::HSeparator* satLimiterSep;
//Gtk::HSeparator* satLimiterSep;
Gtk::HSeparator* colorSep;
CurveEditorGroup* colorCurveEditorG;
CurveEditorGroup* opacityCurveEditorG;
@ -83,20 +83,16 @@ private:
Adjuster* satProtectionThreshold;
Adjuster* saturatedOpacity;
Adjuster* strength;
Gtk::Image* itot;
Gtk::Image* iby;
Gtk::Image* irg;
Gtk::Button* neutral;
Gtk::HBox* neutrHBox;
Gtk::HBox* chromaHbox;
Gtk::Label* chroLabel;
int nextbw;
int nextsatth;
int nextsatpr;
Glib::ustring nextbalcolor;
Glib::ustring balcolor;
bool lasttwocolor;
sigc::connection neutralconn, twocconn; //, neutralcurvesconn;
bool lastautosat;
sigc::connection autosatConn;

View File

@ -30,7 +30,7 @@
using namespace rtengine;
CropHandler::CropHandler ()
: zoom(100), ww(0), wh(0), imx(-1), imy(-1), imw(0), imh(0), cax(-1), cay(-1),
: zoom(100), ww(0), wh(0), cax(-1), cay(-1),
cx(0), cy(0), cw(0), ch(0), cropX(0), cropY(0), cropW(0), cropH(0), enabled(false),
cropimg(nullptr), cropimgtrue(nullptr), cropimg_width(0), cropimg_height(0),
cix(0), ciy(0), ciw(0), cih(0), cis(1),

View File

@ -108,7 +108,6 @@ private:
int zoom; // scale factor (e.g. 5 if 1:5 scale) ; if 1:1 scale and bigger, factor is multiplied by 1000 (i.e. 1000 for 1:1 scale, 2000 for 2:1, etc...)
int ww, wh; // size of the crop's canvas on the screen ; might be bigger than the displayed image, but not smaller
int imx, imy, imw, imh; // this is a copy of the cropwindow's parameters
int cax, cay; // clamped crop anchor's coordinate, i.e. point of the image that coincide to the center of the display area, expressed in image coordinates; cannot be outside the image's bounds; but if cax==cay==-1, designate the center of the image
int cx, cy, cw, ch; // position and size of the requested crop ; position expressed in image coordinates, so cx and cy might be negative and cw and ch higher than the image's 1:1 size
int cropX, cropY, cropW, cropH; // cropPixbuf's displayed area (position and size), i.e. coordinates in 1:1 scale, i.e. cx, cy, cw & ch trimmed to the image's bounds

View File

@ -36,7 +36,7 @@ using namespace rtengine;
CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow)
: ObjectMOBuffer(parent), state(SNormal), press_x(0), press_y(0), action_x(0), action_y(0), pickedObject(-1), pickModifierKey(0), rot_deg(0), onResizeArea(false), deleted(false),
fitZoomEnabled(true), fitZoom(false), isLowUpdatePriority(isLowUpdatePriority_), hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")),
fitZoomEnabled(true), fitZoom(false), /*isLowUpdatePriority(isLowUpdatePriority_),*/ hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")),
backColor(options.bgcolor), decorated(true), isFlawnOver(false), titleHeight(30), sideBorderWidth(3), lowerBorderWidth(3),
upperBorderWidth(1), sepWidth(2), xpos(30), ypos(30), width(0), height(0), imgAreaX(0), imgAreaY(0), imgAreaW(0), imgAreaH(0),
imgX(-1), imgY(-1), imgW(1), imgH(1), iarea(parent), cropZoom(0), zoomVersion(0), exposeVersion(0), cropgl(nullptr),
@ -1627,7 +1627,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
int delta = 0;
// for efficiency, pre-calculate currWS_L as it may be needed in both
// if (showch) and if (showcs) branches
int currWS_L;
int currWS_L = 0;
if (showL && (showch || showcs)) {
currWS_L = (int)(0.299f * currWS[0] + 0.587f * currWS[1] + 0.114f * currWS[2]);

View File

@ -58,7 +58,7 @@ class CropWindow : public LWButtonListener, public CropDisplayHandler, public Ed
bool deleted;
bool fitZoomEnabled;
bool fitZoom;
bool isLowUpdatePriority;
//bool isLowUpdatePriority;
CursorShape cursor_type;
// color pickers

View File

@ -68,7 +68,7 @@ Defringe::~Defringe ()
void Defringe::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
valY = 0.5;

View File

@ -40,7 +40,6 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
Gtk::PositionType sideStart = options.curvebboxpos == 0 || options.curvebboxpos == 2 ? Gtk::POS_LEFT : Gtk::POS_TOP;
Gtk::PositionType sideEnd = options.curvebboxpos == 0 || options.curvebboxpos == 2 ? Gtk::POS_RIGHT : Gtk::POS_BOTTOM;
bool vExpand = options.curvebboxpos == 0 || options.curvebboxpos == 2;
valLinear = (int)DCT_Linear;
valUnchanged = (int)DCT_Unchanged;

View File

@ -21,7 +21,8 @@
#include <iostream>
#include <cstring>
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <windows.h>
#endif
@ -348,7 +349,7 @@ void DirBrowser::updateDir (const Gtk::TreeModel::iterator& iter)
auto dir = Gio::File::create_for_path (iter->get_value (dtColumns.dirname));
auto subDirs = listSubDirs (dir, options.fbShowHidden);
for (int i = 0; i < subDirs.size(); i++) {
for (size_t i = 0; i < subDirs.size(); i++) {
bool found = false;
for (Gtk::TreeModel::iterator it = iter->children().begin(); it != iter->children().end() && !found ; ++it) {

View File

@ -1247,7 +1247,7 @@ void DirPyrDenoise::setAdjusterBehavior (bool lumaadd, bool lumdetadd, bool chro
void DirPyrDenoise::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
valY = 0.5;

View File

@ -505,7 +505,6 @@ void DynamicProfilePanel::on_button_edit()
}
EditDialog d(M("DYNPROFILEEDITOR_EDIT_RULE"),
static_cast<Gtk::Window &>(*get_toplevel()));
auto it = s->get_selected();
Gtk::TreeModel::Row row = *(s->get_selected());
d.set_rule(to_rule(row));
int status = d.run();

View File

@ -374,7 +374,7 @@ public:
};
EditorPanel::EditorPanel (FilePanel* filePanel)
: realized(false), iHistoryShow(nullptr), iHistoryHide(nullptr), iTopPanel_1_Show(nullptr), iTopPanel_1_Hide(nullptr), iRightPanel_1_Show(nullptr), iRightPanel_1_Hide(nullptr), iBeforeLockON(nullptr), iBeforeLockOFF(nullptr), beforePreviewHandler(nullptr), beforeIarea(nullptr), beforeBox(nullptr), afterBox(nullptr), afterHeaderBox(nullptr), parent(nullptr), openThm(nullptr), ipc(nullptr), beforeIpc(nullptr), isProcessing(false), catalogPane(nullptr)
: catalogPane(nullptr), realized(false), iHistoryShow(nullptr), iHistoryHide(nullptr), iTopPanel_1_Show(nullptr), iTopPanel_1_Hide(nullptr), iRightPanel_1_Show(nullptr), iRightPanel_1_Hide(nullptr), iBeforeLockON(nullptr), iBeforeLockOFF(nullptr), beforePreviewHandler(nullptr), beforeIarea(nullptr), beforeBox(nullptr), afterBox(nullptr), afterHeaderBox(nullptr), parent(nullptr), openThm(nullptr), ipc(nullptr), beforeIpc(nullptr), isProcessing(false)
{
epih = new EditorPanelIdleHelper;

View File

@ -193,7 +193,6 @@ private:
ToolPanelCoordinator* tpc;
RTWindow* parent;
//SaveAsDialog* saveAsDialog;
BatchToolPanelCoordinator* btpCoordinator;
FilePanel* fPanel;
bool firstProcessingDone;

View File

@ -36,8 +36,8 @@ public:
double shutterTo;
double focalFrom;
double focalTo;
int isoFrom;
int isoTo;
unsigned isoFrom;
unsigned isoTo;
bool filterFNumber;
bool filterShutter;

View File

@ -27,8 +27,6 @@ class ExifPanel : public Gtk::VBox, public ToolPanel
private:
const rtengine::ImageMetaData* idata;
int fullw, fullh, cx, cy, cw, ch;
bool crenabled;
rtengine::procparams::ExifPairs changeList;
rtengine::procparams::ExifPairs defChangeList;
bool recursiveOp;

View File

@ -325,9 +325,7 @@ bool ExtProgStore::openInCustomEditor (const Glib::ustring& fileName)
const auto cmdLine = Glib::ustring("\"") + options.customEditorProg + Glib::ustring("\"");
auto success = ShellExecute( NULL, "open", cmdLine.c_str(), fileName.c_str(), NULL, SW_SHOWNORMAL );
if ((uintptr_t)success > 32) {
return true;
}
return (uintptr_t)success > 32;
#elif defined __APPLE__

View File

@ -405,7 +405,7 @@ FileBrowser::FileBrowser ()
colorlabel[i]->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), colorlabel[i]));
}
for (int i = 0; i < mMenuExtProgs.size(); i++) {
for (size_t i = 0; i < mMenuExtProgs.size(); i++) {
amiExtProg[i]->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), amiExtProg[i]));
}
@ -730,14 +730,14 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
return;
}
for (int j = 0; j < mMenuExtProgs.size(); j++) {
for (size_t j = 0; j < mMenuExtProgs.size(); j++) {
if (m == amiExtProg[j]) {
const auto pAct = mMenuExtProgs[m->get_label()];
// Build vector of all file names
std::vector<Glib::ustring> selFileNames;
for (int i = 0; i < mselected.size(); i++) {
for (size_t i = 0; i < mselected.size(); i++) {
Glib::ustring fn = mselected[i]->thumbnail->getFileName();
// Maybe batch processed version
@ -1505,11 +1505,11 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) // true -> entry
int iFilenameMatch = 0;
std::vector<Glib::ustring> vFilterStrings = Glib::Regex::split_simple(",", decodedQueryFileName.uppercase());
for(int i = 0; i < vFilterStrings.size(); i++) {
for(size_t i = 0; i < vFilterStrings.size(); i++) {
// ignore empty vFilterStrings. Otherwise filter will always return true if
// e.g. filter.queryFileName ends on "," and will stop being a filter
if (!vFilterStrings.at(i).empty()) {
if (FileName.find(vFilterStrings.at(i)) != -1) {
if (FileName.find(vFilterStrings.at(i)) != Glib::ustring::npos) {
iFilenameMatch++;
}
}

View File

@ -635,6 +635,7 @@ bool FileBrowserEntry::onArea (CursorArea a, int x, int y)
y1 < cropParams.y + cropParams.h - 1 &&
x1 > cropParams.x &&
x1 < cropParams.x + cropParams.w - 1;
default: /* do nothing */ ;
}
return false;

View File

@ -748,12 +748,12 @@ void FileCatalog::previewReady (int dir_id, FileBrowserEntry* fdn)
dirEFS.shutterTo = cfs->shutter;
}
if (cfs->iso > 0 && (int)cfs->iso < dirEFS.isoFrom) {
dirEFS.isoFrom = (int)cfs->iso;
if (cfs->iso > 0 && cfs->iso < dirEFS.isoFrom) {
dirEFS.isoFrom = cfs->iso;
}
if (cfs->iso > 0 && (int)cfs->iso > dirEFS.isoTo) {
dirEFS.isoTo = (int)cfs->iso;
if (cfs->iso > 0 && cfs->iso > dirEFS.isoTo) {
dirEFS.isoTo = cfs->iso;
}
if (cfs->focalLen < dirEFS.focalFrom) {

View File

@ -1478,7 +1478,7 @@ void BackBuffer::copyRGBCharData(const unsigned char *srcData, int srcX, int src
return;
}
for (unsigned int i = 0; i < (unsigned int)(srcH); ++i) {
for (int i = 0; i < srcH; ++i) {
if (dstY + i >= surfH) {
break;
}
@ -1486,7 +1486,7 @@ void BackBuffer::copyRGBCharData(const unsigned char *srcData, int srcX, int src
src = srcData + i * srcRowStride;
dst = dstData + ((dstY + i) * surfW + dstX) * 4;
for (unsigned int j = 0; j < (unsigned int)(srcW); ++j) {
for (int j = 0; j < srcW; ++j) {
if (dstX + j >= surfW) {
break;
}
@ -1620,8 +1620,8 @@ void BackBuffer::copySurface(Cairo::RefPtr<Cairo::Context> crDest, Gdk::Rectangl
int offsetY = rtengine::LIM<int>(offset.y, 0, surface->get_height());
// now copy the off-screen Surface to the destination Surface
int srcSurfW = surface->get_width();
int srcSurfH = surface->get_height();
// int srcSurfW = surface->get_width();
// int srcSurfH = surface->get_height();
//printf("srcSurf: w: %d, h: %d\n", srcSurfW, srcSurfH);
crDest->set_line_width(0.);

View File

@ -114,7 +114,7 @@ public:
class ConnectionBlocker
{
public:
explicit ConnectionBlocker (Gtk::Widget *associatedWidget, sigc::connection& connection) : connection (associatedWidget ? &connection : nullptr)
explicit ConnectionBlocker (Gtk::Widget *associatedWidget, sigc::connection& connection) : connection (associatedWidget ? &connection : nullptr), wasBlocked(false)
{
if (this->connection) {
wasBlocked = connection.block();

View File

@ -1007,7 +1007,7 @@ SSEFUNCTION void HistogramArea::updateBackBuffer ()
// does not take into account 0 and 255 values
// them are handled separately
int fullhistheight = 0;
unsigned int fullhistheight = 0;
for (int i = 1; i < 255; i++) {
if (needLuma && lhisttemp[i] > fullhistheight) {
@ -1042,7 +1042,7 @@ SSEFUNCTION void HistogramArea::updateBackBuffer ()
vint iv = (vint)ZEROV;
#endif
for (int i = 0; i < fullhistheight; i++) {
for (unsigned i = 0; i < fullhistheight; i++) {
#ifdef __SSE2__
vint areatempv = (vint)ZEROV;

View File

@ -88,8 +88,6 @@ private:
sigc::connection onamesconn;
PopUpButton* ointent;
sigc::connection ointentconn;
Gtk::RadioButton* ofromdir;
Gtk::RadioButton* ofromfile;
Gtk::RadioButton* iunchanged;
MyFileChooserButton* ipDialog;
Gtk::RadioButton::Group opts;
@ -99,7 +97,6 @@ private:
ICMPanelListener* icmplistener;
double dcpTemperatures[2];
bool enableLastICCWorkDirChange;
Glib::ustring lastRefFilename;
Glib::ustring camName;
void updateDCP(int dcpIlluminant, Glib::ustring dcp_name);

View File

@ -559,7 +559,7 @@ void LCurve::adjusterChanged (Adjuster* a, double newval)
void LCurve::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
valY = 0.5;

View File

@ -72,7 +72,7 @@ void LWButtonSet::arrangeButtons (int x, int y, int w, int h)
for (size_t i = 0; i < buttons.size(); i++) {
LWButton::Alignment halign, valign;
int bx, by, bw, bh;
int bx = 0, by = 0, bw = 0, bh = 0;
buttons[i]->getSize (bw, bh);
buttons[i]->getAlignment (halign, valign);

View File

@ -175,7 +175,7 @@ bool MyCurve::snapCoordinateY(double testedVal, double realVal)
float MyCurve::getVal(LUTf &curve, int x)
{
if ((graphW - 2) == curve.getSize()) {
if (size_t(graphW - 2) == curve.getSize()) {
return curve[x];
} else {
return curve.getVal01(float(x) / (graphW - 3));

View File

@ -398,7 +398,7 @@ void MyDiagonalCurve::draw (int handle)
double y2 = double(graphY) - 1.5 - double(graphH - 3) * points[pos + 1]; // project (curve.y.at(i), 0, 1, graphH);
// set the color of the line when the point is snapped to the cage
if (curve.x.size() == nbPoints && snapToElmt >= 1000 && ((i == (snapToElmt - 1000)) || (i == (snapToElmt - 999)))) {
if (curve.x.size() == nbPoints && snapToElmt >= 1000 && ((int(i) == (snapToElmt - 1000)) || (int(i) == (snapToElmt - 999)))) {
cr->set_source_rgb (1.0, 0.0, 0.0);
} else {
cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue());
@ -606,7 +606,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
edited_point = lit_point;
std::vector<CoordinateAdjuster::Boundaries> newBoundaries(2);
unsigned int size = curve.x.size();
int size = curve.x.size();
if (edited_point == 0) {
newBoundaries.at(0).minVal = 0.;
@ -655,7 +655,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
draw (lit_point);
std::vector<CoordinateAdjuster::Boundaries> newBoundaries;
newBoundaries.resize(2);
unsigned int size = curve.x.size();
int size = curve.x.size();
if (edited_point == 0) {
newBoundaries.at(0).minVal = 0.;
@ -888,7 +888,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
} else {
// snapping point to specific values
if (snapTo && curve.x.at(grab_point) != -1.) {
if (grab_point > 0 && grab_point < (curve.y.size() - 1)) {
if (grab_point > 0 && unsigned(grab_point) < (curve.y.size() - 1)) {
double prevX = curve.x.at(grab_point - 1);
double prevY = curve.y.at(grab_point - 1);
double nextX = curve.x.at(grab_point + 1);
@ -910,7 +910,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event)
}
}
if (grab_point < (curve.y.size() - 1)) {
if (grab_point < int(curve.y.size() - 1)) {
int nextP = grab_point + 1;
if (snapCoordinateY(curve.y.at(nextP), ugpY)) {
@ -1208,7 +1208,7 @@ void MyDiagonalCurve::pipetteDrag(EditDataProvider *provider, int modifierKey)
// snapping point to specific values
if (snapTo && curve.x.at(grab_point) != -1.) {
if (grab_point > 0 && grab_point < (curve.y.size() - 1)) {
if (grab_point > 0 && unsigned(grab_point) < (curve.y.size() - 1)) {
double prevX = curve.x.at(grab_point - 1);
double prevY = curve.y.at(grab_point - 1);
double nextX = curve.x.at(grab_point + 1);
@ -1230,7 +1230,7 @@ void MyDiagonalCurve::pipetteDrag(EditDataProvider *provider, int modifierKey)
}
}
if (grab_point < (curve.y.size() - 1)) {
if (grab_point < int(curve.y.size() - 1)) {
int nextP = grab_point + 1;
if (snapCoordinateY(curve.y.at(nextP), ugpY)) {

View File

@ -711,7 +711,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
setDirty(true);
draw ();
std::vector<CoordinateAdjuster::Boundaries> newBoundaries(4);
unsigned int size = curve.x.size();
int size = curve.x.size();
if (edited_point == 0) {
newBoundaries.at(0).minVal = 0.;
@ -761,7 +761,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event)
setDirty(true);
draw ();
std::vector<CoordinateAdjuster::Boundaries> newBoundaries(4);
unsigned int size = curve.x.size();
int size = curve.x.size();
if (edited_point == 0) {
newBoundaries.at(0).minVal = 0.;
@ -1544,7 +1544,7 @@ void MyFlatCurve::movePoint(bool moveX, bool moveY, bool pipetteDrag)
}
if (curve.y.size() > 2) {
if (lit_point == (curve.y.size() - 1)) {
if (lit_point == int(curve.y.size()) - 1) {
if (snapCoordinateY(curve.y.at(0), ugpY)) {
snapToElmt = 0;
}

View File

@ -26,9 +26,9 @@
#include "guiutils.h"
PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label)
: selected (-1) // -1 means that the button is invalid
: buttonImage (nullptr)
, menu (nullptr)
, buttonImage (nullptr)
, selected (-1) // -1 means that the button is invalid
{
button = thisButton;
hasMenu = false;
@ -107,8 +107,8 @@ void PopUpCommon::entrySelected (int i)
void PopUpCommon::setItemSensitivity (int index, bool isSensitive) {
const auto items = menu->get_children ();
if (index < items.size ()) {
items[index]->set_sensitive (isSensitive);
if (size_t(index) < items.size ()) {
items[size_t(index)]->set_sensitive (isSensitive);
}
}

View File

@ -1513,7 +1513,7 @@ void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histL
void Retinex::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
valY = 0.5;

View File

@ -204,7 +204,7 @@ void SHCSelector::updateBackBuffer()
cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue());
cr->stroke ();
}
/*
/ *
else if (i==litCursor) {
// prelight
Gdk::RGBA c = style->get_background_color(Gtk::STATE_FLAG_PRELIGHT);

View File

@ -25,7 +25,7 @@
using namespace std;
ThumbBrowserBase::ThumbBrowserBase ()
: lastClicked(nullptr), previewHeight(options.thumbSize), numOfCols(1), inspector(nullptr), isInspectorActive(false), location(THLOC_FILEBROWSER)
: location(THLOC_FILEBROWSER), inspector(nullptr), isInspectorActive(false), lastClicked(nullptr), previewHeight(options.thumbSize), numOfCols(1)
{
inW = -1;
inH = -1;

View File

@ -64,7 +64,7 @@ Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageDa
Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5)
: fname(fname), cachemgr(cm), ref(1), enqueueNumber(0), tpp(nullptr), pparamsValid(false),
pparamsSet(false), needsReProcessing(true), imageLoading(false), lastImg(nullptr),
needsReProcessing(true), imageLoading(false), lastImg(nullptr),
lastW(0), lastH(0), lastScale(0.0), initial_(true)
{

View File

@ -49,7 +49,6 @@ class Thumbnail
rtengine::procparams::ProcParams pparams;
bool pparamsValid;
bool pparamsSet;
bool needsReProcessing;
bool imageLoading;

View File

@ -2863,7 +2863,7 @@ void Wavelet::tmrToggled ()
void Wavelet::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller)
{
float R, G, B;
float R = 0.f, G = 0.f, B = 0.f;
if (elemType == ColorCaller::CCET_VERTICAL_BAR) {
valY = 0.5;

View File

@ -355,7 +355,6 @@ void WhiteBalance::adjusterChanged (Adjuster* a, double newval)
int tVal = (int)temp->getValue();
double gVal = green->getValue();
double eVal = equal->getValue();
double tempBiasVal = tempBias->getValue();
Gtk::TreeModel::Row row = getActiveMethod();
if (row == refTreeModel->children().end()) {