From c16115cdde0b0a63aae75de2a23bc113ad35adae Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 30 Aug 2017 14:49:27 +0200 Subject: [PATCH 01/72] Speedup for loading of Phase One files --- rtengine/dcraw.cc | 253 ++++++++++++++++++++++++++++++++++------------ rtengine/dcraw.h | 31 +++++- 2 files changed, 218 insertions(+), 66 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index d6bac40de..784c6f9d8 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -25,6 +25,8 @@ /*RT*/#include "jpeg.h" #include "opthelper.h" +#define BENCHMARK +#include "StopWatch.h" /* dcraw.c -- Dave Coffin's raw photo decoder @@ -1435,56 +1437,69 @@ int CLASS raw (unsigned row, unsigned col) void CLASS phase_one_flat_field (int is_float, int nc) { - ushort head[8]; - unsigned wide, high, y, x, c, rend, cend, row, col; - float *mrow, num, mult[4]; + ushort uhead[8]; - read_shorts (head, 8); - if (head[2] * head[3] * head[4] * head[5] == 0) return; - wide = head[2] / head[4] + (head[2] % head[4] != 0); - high = head[3] / head[5] + (head[3] % head[5] != 0); - mrow = (float *) calloc (nc*wide, sizeof *mrow); - merror (mrow, "phase_one_flat_field()"); - for (y=0; y < high; y++) { - for (x=0; x < wide; x++) - for (c=0; c < nc; c+=2) { - num = is_float ? getreal(11) : get2()/32768.0; - if (y==0) mrow[c*wide+x] = num; - else mrow[(c+1)*wide+x] = (num - mrow[c*wide+x]) / head[5]; - } - if (y==0) continue; - rend = head[1] + y*head[5]; - for (row = rend-head[5]; - row < raw_height && row < rend && - row < head[1]+head[3]-head[5]; row++) { - for (x=1; x < wide; x++) { - for (c=0; c < nc; c+=2) { - mult[c] = mrow[c*wide+x-1]; - mult[c+1] = (mrow[c*wide+x] - mult[c]) / head[4]; - } - cend = head[0] + x*head[4]; - for (col = cend-head[4]; - col < raw_width && - col < cend && col < head[0]+head[2]-head[4]; col++) { - c = nc > 2 ? FC(row-top_margin,col-left_margin) : 0; - if (!(c & 1)) { - c = RAW(row,col) * mult[c]; - RAW(row,col) = LIM(c,0,65535); - } - for (c=0; c < nc; c+=2) - mult[c] += mult[c+1]; - } - } - for (x=0; x < wide; x++) - for (c=0; c < nc; c+=2) - mrow[c*wide+x] += mrow[(c+1)*wide+x]; + read_shorts (uhead, 8); + if (uhead[2] * uhead[3] * uhead[4] * uhead[5] == 0) { + return; } - } - free (mrow); + const unsigned wide = uhead[2] / uhead[4] + (uhead[2] % uhead[4] != 0); + const unsigned high = uhead[3] / uhead[5] + (uhead[3] % uhead[5] != 0); + const unsigned colLimit = std::min(uhead[0] + uhead[2] - uhead[4], (int)raw_width); + + const float head4 = 1.0 / uhead[4]; + const float head5 = 1.0 / uhead[5]; + + float* mrow = (float *) calloc(nc * wide, sizeof *mrow); + merror(mrow, "phase_one_flat_field()"); + for (unsigned x=0; x < wide; x++) { + for (unsigned c=0; c < nc; c+=2) { + float num = is_float ? getreal(11) : get2() / 32768.f; + mrow[c * wide + x] = num; + } + } + for (unsigned y=1; y < high; y++) { + for (unsigned x=0; x < wide; x++) { + for (unsigned c=0; c < nc; c+=2) { + float num = is_float ? getreal(11) : get2() / 32768.f; + mrow[(c + 1) * wide + x] = (num - mrow[c * wide + x]) * head5; + } + } + const unsigned rend = uhead[1] + y * uhead[5]; + for (unsigned row = rend - uhead[5]; row < raw_height && row < rend && row < uhead[1] + uhead[3] - uhead[5]; row++) { + unsigned cend = uhead[0] + uhead[4]; + const unsigned c0 = FC(row - top_margin, cend - uhead[4] - left_margin); + const unsigned c = nc > 2 ? (c0 & 1) ? FC(row - top_margin, cend - uhead[4] - left_margin + 1) : c0 : 0; + for (unsigned x=1; x < wide; x++, cend += uhead[4]) { + float mult0 = mrow[c * wide + x - 1]; + float mult1 = (mrow[c * wide + x] - mult0) * head4; + if (nc > 2) { + mult0 += (c0 & 1) ? mult1 : 0; + for (unsigned col = cend - uhead[4] + (c0 & 1); col < std::min(colLimit, cend); col += 2) { + RAW(row, col) *= mult0; + mult0 += mult1; + mult0 += mult1; // <= this could be reduced to one addition inside the loop, but then the result is not exactly the same as with old code, though it should be even more accurate then + } + } else { + for (unsigned col = cend - uhead[4]; col < std::min(colLimit, cend); col++) { + RAW(row, col) *= mult0; + mult0 += mult1; + } + } + } + for (unsigned x=0; x < wide; x++) { + for (unsigned c=0; c < nc; c+=2) { + mrow[c * wide + x] += mrow[(c + 1) * wide + x]; + } + } + } + } + free(mrow); } void CLASS phase_one_correct() { + BENCHFUN unsigned entries, tag, data, save, col, row, type; int len, i, j, k, cip, val[4], dev[4], sum, max; int head[9], diff, mindiff=INT_MAX, off_412=0; @@ -1725,11 +1740,38 @@ unsigned CLASS ph1_bithuff_t::operator() (int nbits, ushort *huff) vbits -= nbits; return c; } -#define ph1_bits(n) ph1_bithuff(n,0) + +inline unsigned CLASS ph1_bithuff_t::operator() (int nbits) +{ +/*RT static UINT64 bitbuf=0; */ +/*RT static int vbits=0; */ + + if (vbits < nbits) { + bitbuf = bitbuf << 32 | get4(); + vbits += 32; + } + unsigned c = bitbuf << (64-vbits) >> (64-nbits); + vbits -= nbits; + return c; +} + +inline unsigned CLASS ph1_bithuff_t::operator() () +{ +/*RT static UINT64 bitbuf=0; */ +/*RT static int vbits=0; */ + return bitbuf = vbits = 0; +} + + +#define ph1_init() ph1_bithuff() +#define ph1_bits(n) ph1_bithuff(n) +#define hb_bits(n) ph1_bithuff(n,0) #define ph1_huff(h) ph1_bithuff(*h,h+1) +#ifndef MYFILE_MMAP void CLASS phase_one_load_raw_c() { + BENCHFUN static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; int *offset, len[2], pred[2], row, col, i, j; ushort *pixel; @@ -1753,7 +1795,7 @@ void CLASS phase_one_load_raw_c() curve[i] = i*i / 3.969 + 0.5; for (row=0; row < raw_height; row++) { fseek (ifp, data_offset + offset[row], SEEK_SET); - ph1_bits(-1); + ph1_init(); pred[0] = pred[1] = 0; for (col=0; col < raw_width; col++) { if (col >= (raw_width & -8)) @@ -1781,7 +1823,91 @@ void CLASS phase_one_load_raw_c() free (pixel); maximum = 0xfffc - ph1.black; } +#else +void CLASS phase_one_load_raw_c() +{ +BENCHFUN + static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; + short (*cblack)[2], (*rblack)[2]; + int *offset = (int *) calloc(raw_width * 2 + raw_height * 4, 2); + fseek(ifp, strip_offset, SEEK_SET); + for (int row=0; row < raw_height; row++) { + offset[row] = get4(); + } + cblack = (short (*)[2]) (offset + raw_height); + fseek(ifp, ph1.black_col, SEEK_SET); + if (ph1.black_col) { + read_shorts ((ushort *) cblack[0], raw_height * 2); + } + rblack = cblack + raw_height; + fseek(ifp, ph1.black_row, SEEK_SET); + if (ph1.black_row) { + read_shorts ((ushort *) rblack[0], raw_width * 2); + } + for (int i=0; i < 256; i++) { + curve[i] = i * i / 3.969 + 0.5; + } + +#pragma omp parallel +{ + int len[2], pred[2]; + IMFILE *ifpthr = new IMFILE; + ifpthr->fd = ifp->fd; + ifpthr->pos = ifp->pos; + ifpthr->size = ifp->size; + ifpthr->data = ifp->data; + ifpthr->eof = ifp->eof; + ifpthr->plistener = nullptr; + ifpthr->progress_range = ifp->progress_range; + ifpthr->progress_next = ifp->progress_next; + ifpthr->progress_current = ifp->progress_current; + + ph1_bithuff_t ph1_bithuff(this, ifpthr, order); + ushort pixel; + + #pragma omp for schedule(dynamic,16) + for (int row=0; row < raw_height; row++) { + int shift = 2*(ph1.format != 8); + fseek(ifpthr, data_offset + offset[row], SEEK_SET); + ph1_init(); + pred[0] = pred[1] = 0; + for (int col=0; col < raw_width; col++) { + if (col >= (raw_width & -8)) { + len[0] = len[1] = 14; + } else if ((col & 7) == 0) { + for (int i=0; i < 2; i++) { + int j; + for (j=0; j < 5 && !ph1_bits(1); j++); + if (j--) { + len[i] = length[j*2 + ph1_bits(1)]; + } + } + } + int i; + if ((i = len[col & 1]) == 14) { + pixel = pred[col & 1] = ph1_bits(16); + } else { + pixel = pred[col & 1] += ph1_bits(i) + 1 - (1 << (i - 1)); + } + if (UNLIKELY(pred[col & 1] >> 16)) { + derror(); + } + if (ph1.format == 5 && pixel < 256) { + pixel = curve[pixel]; + } + int rawVal = (pixel << shift) - ph1.black + + cblack[row][col >= ph1.split_col] + + rblack[col][row >= ph1.split_row]; + RAW(row,col) = std::max(rawVal, 0); + } + } + delete ifpthr; +} + free(offset); + maximum = 0xfffc - ph1.black; +} +#endif void CLASS parse_hasselblad_gain() { /* @@ -2122,7 +2248,7 @@ void CLASS hasselblad_load_raw() if (!ljpeg_start (&jh, 0)) return; order = 0x4949; - ph1_bits(-1); + hb_bits(-1); back[4] = (int *) calloc (raw_width, 3*sizeof **back); merror (back[4], "hasselblad_load_raw()"); FORC3 back[c] = back[4] + c*raw_width; @@ -2134,7 +2260,7 @@ void CLASS hasselblad_load_raw() for (s=0; s < tiff_samples*2; s+=2) { FORC(2) len[c] = ph1_huff(jh.huff[0]); FORC(2) { - diff[s+c] = ph1_bits(len[c]); + diff[s+c] = hb_bits(len[c]); if ((diff[s+c] & (1 << (len[c]-1))) == 0) diff[s+c] -= (1 << len[c]) - 1; if (diff[s+c] == 65535) diff[s+c] = -32768; @@ -3088,19 +3214,19 @@ void CLASS samsung_load_raw() for (row=0; row < raw_height; row++) { fseek (ifp, strip_offset+row*4, SEEK_SET); fseek (ifp, data_offset+get4(), SEEK_SET); - ph1_bits(-1); + hb_bits(-1); FORC4 len[c] = row < 2 ? 7:4; for (col=0; col < raw_width; col+=16) { - dir = ph1_bits(1); - FORC4 op[c] = ph1_bits(2); + dir = hb_bits(1); + FORC4 op[c] = hb_bits(2); FORC4 switch (op[c]) { - case 3: len[c] = ph1_bits(4); break; + case 3: len[c] = hb_bits(4); break; case 2: len[c]--; break; case 1: len[c]++; } for (c=0; c < 16; c+=2) { i = len[((c & 1) << 1) | (c >> 3)]; - RAW(row,col+c) = ((signed) ph1_bits(i) << (32-i) >> (32-i)) + + RAW(row,col+c) = ((signed) hb_bits(i) << (32-i) >> (32-i)) + (dir ? RAW(row+(~c | -2),col+c) : col ? RAW(row,col+(c | -2)) : 128); if (c == 14) c = -1; } @@ -3144,25 +3270,25 @@ void CLASS samsung3_load_raw() init = (get2(),get2()); for (row=0; row < raw_height; row++) { fseek (ifp, (data_offset-ftell(ifp)) & 15, SEEK_CUR); - ph1_bits(-1); + hb_bits(-1); mag = 0; pmode = 7; FORC(6) ((ushort *)lent)[c] = row < 2 ? 7:4; prow[ row & 1] = &RAW(row-1,1-((row & 1) << 1)); // green prow[~row & 1] = &RAW(row-2,0); // red and blue for (tab=0; tab+15 < raw_width; tab+=16) { if (~opt & 4 && !(tab & 63)) { - i = ph1_bits(2); - mag = i < 3 ? mag-'2'+"204"[i] : ph1_bits(12); + i = hb_bits(2); + mag = i < 3 ? mag-'2'+"204"[i] : hb_bits(12); } if (opt & 2) - pmode = 7 - 4*ph1_bits(1); - else if (!ph1_bits(1)) - pmode = ph1_bits(3); - if (opt & 1 || !ph1_bits(1)) { - FORC4 len[c] = ph1_bits(2); + pmode = 7 - 4*hb_bits(1); + else if (!hb_bits(1)) + pmode = hb_bits(3); + if (opt & 1 || !hb_bits(1)) { + FORC4 len[c] = hb_bits(2); FORC4 { i = ((row & 1) << 1 | (c & 1)) % 3; - len[c] = len[c] < 3 ? lent[i][0]-'1'+"120"[len[c]] : ph1_bits(4); + len[c] = len[c] < 3 ? lent[i][0]-'1'+"120"[len[c]] : hb_bits(4); lent[i][0] = lent[i][1]; lent[i][1] = len[c]; } @@ -3173,7 +3299,7 @@ void CLASS samsung3_load_raw() ? (tab ? RAW(row,tab-2+(col & 1)) : init) : (prow[col & 1][col-'4'+"0224468"[pmode]] + prow[col & 1][col-'4'+"0244668"[pmode]] + 1) >> 1; - diff = ph1_bits (i = len[c >> 2]); + diff = hb_bits (i = len[c >> 2]); if (diff >> (i-1)) diff -= 1 << i; diff = diff * (mag*2+1) + mag; RAW(row,col) = pred + diff; @@ -4103,7 +4229,6 @@ void CLASS crop_masked_pixels() } } } else { - #pragma omp parallel for for (int row=0; row < height; row++) for (int col=0; col < width; col++) diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index a109b43c2..0fa0f2175 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -318,10 +318,37 @@ class ph1_bithuff_t { public: ph1_bithuff_t(DCraw *p,IMFILE *&i,short &o):parent(p),order(o),ifp(i),bitbuf(0),vbits(0){} unsigned operator()(int nbits, ushort *huff); + unsigned operator()(int nbits); + unsigned operator()(); + ushort get2() { + uchar str[2] = { 0xff,0xff }; + fread (str, 1, 2, ifp); + if (order == 0x4949) { /* "II" means little-endian */ + return str[0] | str[1] << 8; + } else { /* "MM" means big-endian */ + return str[0] << 8 | str[1]; + } + } private: - unsigned get4(){ - return parent->get4(); + inline unsigned get4() { + unsigned val = 0xffffff; + uchar* str = (uchar*)&val; + fread (str, 1, 4, ifp); + if (order == 0x4949) { +#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ + return val; +#else + return str[0] | str[1] << 8 | str[2] << 16 | str[3] << 24; +#endif + } else { +#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ + return str[0] << 24 | str[1] << 16 | str[2] << 8 | str[3]; +#else + return val; +#endif + } } + DCraw *parent; short ℴ IMFILE *&ifp; From 61a69ba1930ed5400cacde1323409cd83956d331 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 30 Aug 2017 16:44:46 +0200 Subject: [PATCH 02/72] Fixed artifacts in clipped highlights of phase one files I introduced with recent commit --- rtengine/dcraw.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 784c6f9d8..3f4c1736c 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1476,13 +1476,15 @@ void CLASS phase_one_flat_field (int is_float, int nc) if (nc > 2) { mult0 += (c0 & 1) ? mult1 : 0; for (unsigned col = cend - uhead[4] + (c0 & 1); col < std::min(colLimit, cend); col += 2) { - RAW(row, col) *= mult0; + int val = RAW(row, col) * mult0; + RAW(row, col) = LIM(val, 0, 65535); mult0 += mult1; mult0 += mult1; // <= this could be reduced to one addition inside the loop, but then the result is not exactly the same as with old code, though it should be even more accurate then } } else { for (unsigned col = cend - uhead[4]; col < std::min(colLimit, cend); col++) { - RAW(row, col) *= mult0; + int val = RAW(row, col) * mult0; + RAW(row, col) = LIM(val, 0, 65535); mult0 += mult1; } } From fd1909e4da39f0730786ad1a57abab87b81a75a5 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 30 Aug 2017 18:55:30 +0200 Subject: [PATCH 03/72] Additional optimizations for Phase One P45+ and P65+ --- rtengine/dcraw.cc | 403 ++++++++++++++++++++++++---------------------- 1 file changed, 207 insertions(+), 196 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 3f4c1736c..ec06afee6 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1501,204 +1501,215 @@ void CLASS phase_one_flat_field (int is_float, int nc) void CLASS phase_one_correct() { - BENCHFUN - unsigned entries, tag, data, save, col, row, type; - int len, i, j, k, cip, val[4], dev[4], sum, max; - int head[9], diff, mindiff=INT_MAX, off_412=0; - static const signed char dir[12][2] = - { {-1,-1}, {-1,1}, {1,-1}, {1,1}, {-2,0}, {0,-2}, {0,2}, {2,0}, - {-2,-2}, {-2,2}, {2,-2}, {2,2} }; - float poly[8], num, cfrac, frac, mult[2], *yval[2]; - ushort *xval[2]; - int qmult_applied = 0, qlin_applied = 0; +BENCHFUN + unsigned entries, tag, data, save, col, row, type; + int len, i, j, k, cip, val[4], dev[4], sum, max; + int head[9], diff, mindiff=INT_MAX, off_412=0; + static const signed char dir[12][2] = { {-1,-1}, {-1,1}, {1,-1}, {1,1}, {-2,0}, {0,-2}, {0,2}, {2,0}, {-2,-2}, {-2,2}, {2,-2}, {2,2} }; + float poly[8], num, cfrac, frac, mult[2], *yval[2]; + ushort *xval[2]; + int qmult_applied = 0, qlin_applied = 0; - if (half_size || !meta_length) return; - if (verbose) fprintf (stderr,_("Phase One correction...\n")); - fseek (ifp, meta_offset, SEEK_SET); - order = get2(); - fseek (ifp, 6, SEEK_CUR); - fseek (ifp, meta_offset+get4(), SEEK_SET); - entries = get4(); get4(); - while (entries--) { - tag = get4(); - len = get4(); - data = get4(); - save = ftell(ifp); - fseek (ifp, meta_offset+data, SEEK_SET); - if (tag == 0x419) { /* Polynomial curve */ - for (get4(), i=0; i < 8; i++) - poly[i] = getreal(11); - poly[3] += (ph1.tag_210 - poly[7]) * poly[6] + 1; - for (i=0; i < 0x10000; i++) { - num = (poly[5]*i + poly[3])*i + poly[1]; - curve[i] = LIM(num,0,65535); - } goto apply; /* apply to right half */ - } else if (tag == 0x41a) { /* Polynomial curve */ - for (i=0; i < 4; i++) - poly[i] = getreal(11); - for (i=0; i < 0x10000; i++) { - for (num=0, j=4; j--; ) - num = num * i + poly[j]; - curve[i] = LIM(num+i,0,65535); - } apply: /* apply to whole image */ - for (row=0; row < raw_height; row++) - for (col = (tag & 1)*ph1.split_col; col < raw_width; col++) - RAW(row,col) = curve[RAW(row,col)]; - } else if (tag == 0x400) { /* Sensor defects */ - while ((len -= 8) >= 0) { - col = get2(); - row = get2(); - type = get2(); get2(); - if (col >= raw_width) continue; - if (type == 131 || type == 137) /* Bad column */ - for (row=0; row < raw_height; row++) - if (FC(row-top_margin,col-left_margin) == 1) { - for (sum=i=0; i < 4; i++) - sum += val[i] = raw (row+dir[i][0], col+dir[i][1]); - for (max=i=0; i < 4; i++) { - dev[i] = abs((val[i] << 2) - sum); - if (dev[max] < dev[i]) max = i; - } - RAW(row,col) = (sum - val[max])/3.0 + 0.5; - } else { - for (sum=0, i=8; i < 12; i++) - sum += raw (row+dir[i][0], col+dir[i][1]); - RAW(row,col) = 0.5 + sum * 0.0732233 + - (raw(row,col-2) + raw(row,col+2)) * 0.3535534; - } - else if (type == 129) { /* Bad pixel */ - if (row >= raw_height) continue; - j = (FC(row-top_margin,col-left_margin) != 1) * 4; - for (sum=0, i=j; i < j+8; i++) - sum += raw (row+dir[i][0], col+dir[i][1]); - RAW(row,col) = (sum + 4) >> 3; - } - } - } else if (tag == 0x401) { /* All-color flat fields */ - phase_one_flat_field (1, 2); - } else if (tag == 0x416 || tag == 0x410) { - phase_one_flat_field (0, 2); - } else if (tag == 0x40b) { /* Red+blue flat field */ - phase_one_flat_field (0, 4); - } else if (tag == 0x412) { - fseek (ifp, 36, SEEK_CUR); - diff = abs (get2() - ph1.tag_21a); - if (mindiff > diff) { - mindiff = diff; - off_412 = ftell(ifp) - 38; - } - } else if (tag == 0x41f && !qlin_applied) { /* Quadrant linearization */ - ushort lc[2][2][16], ref[16]; - int qr, qc; - for (qr = 0; qr < 2; qr++) - for (qc = 0; qc < 2; qc++) - for (i = 0; i < 16; i++) - lc[qr][qc][i] = get4(); - for (i = 0; i < 16; i++) { - int v = 0; - for (qr = 0; qr < 2; qr++) - for (qc = 0; qc < 2; qc++) - v += lc[qr][qc][i]; - ref[i] = (v + 2) >> 2; - } - for (qr = 0; qr < 2; qr++) { - for (qc = 0; qc < 2; qc++) { - int cx[19], cf[19]; - for (i = 0; i < 16; i++) { - cx[1+i] = lc[qr][qc][i]; - cf[1+i] = ref[i]; - } - cx[0] = cf[0] = 0; - cx[17] = cf[17] = ((unsigned) ref[15] * 65535) / lc[qr][qc][15]; - cx[18] = cf[18] = 65535; - cubic_spline(cx, cf, 19); - for (row = (qr ? ph1.split_row : 0); - row < (qr ? raw_height : ph1.split_row); row++) - for (col = (qc ? ph1.split_col : 0); - col < (qc ? raw_width : ph1.split_col); col++) - RAW(row,col) = curve[RAW(row,col)]; - } - } - qlin_applied = 1; - } else if (tag == 0x41e && !qmult_applied) { /* Quadrant multipliers */ - float qmult[2][2] = { { 1, 1 }, { 1, 1 } }; - get4(); get4(); get4(); get4(); - qmult[0][0] = 1.0 + getreal(11); - get4(); get4(); get4(); get4(); get4(); - qmult[0][1] = 1.0 + getreal(11); - get4(); get4(); get4(); - qmult[1][0] = 1.0 + getreal(11); - get4(); get4(); get4(); - qmult[1][1] = 1.0 + getreal(11); - for (row=0; row < raw_height; row++) - for (col=0; col < raw_width; col++) { - i = qmult[row >= ph1.split_row][col >= ph1.split_col] * RAW(row,col); - RAW(row,col) = LIM(i,0,65535); - } - qmult_applied = 1; - } else if (tag == 0x431 && !qmult_applied) { /* Quadrant combined */ - ushort lc[2][2][7], ref[7]; - int qr, qc; - for (i = 0; i < 7; i++) - ref[i] = get4(); - for (qr = 0; qr < 2; qr++) - for (qc = 0; qc < 2; qc++) - for (i = 0; i < 7; i++) - lc[qr][qc][i] = get4(); - for (qr = 0; qr < 2; qr++) { - for (qc = 0; qc < 2; qc++) { - int cx[9], cf[9]; - for (i = 0; i < 7; i++) { - cx[1+i] = ref[i]; - cf[1+i] = ((unsigned) ref[i] * lc[qr][qc][i]) / 10000; - } - cx[0] = cf[0] = 0; - cx[8] = cf[8] = 65535; - cubic_spline(cx, cf, 9); - for (row = (qr ? ph1.split_row : 0); - row < (qr ? raw_height : ph1.split_row); row++) - for (col = (qc ? ph1.split_col : 0); - col < (qc ? raw_width : ph1.split_col); col++) - RAW(row,col) = curve[RAW(row,col)]; - } - } - qmult_applied = 1; - qlin_applied = 1; + if (half_size || !meta_length) { + return; + } + if (verbose) { + fprintf (stderr,_("Phase One correction...\n")); + } + fseek (ifp, meta_offset, SEEK_SET); + order = get2(); + fseek (ifp, 6, SEEK_CUR); + fseek (ifp, meta_offset+get4(), SEEK_SET); + entries = get4(); get4(); + while (entries--) { + tag = get4(); + len = get4(); + data = get4(); + save = ftell(ifp); + fseek (ifp, meta_offset+data, SEEK_SET); + if (tag == 0x419) { /* Polynomial curve */ + for (get4(), i=0; i < 8; i++) { + poly[i] = getreal(11); + } + poly[3] += (ph1.tag_210 - poly[7]) * poly[6] + 1; + for (i=0; i < 0x10000; i++) { + num = (poly[5]*i + poly[3])*i + poly[1]; + curve[i] = LIM(num,0,65535); + } + goto apply; /* apply to right half */ + } else if (tag == 0x41a) { /* Polynomial curve */ + for (i=0; i < 4; i++) { + poly[i] = getreal(11); + } + for (i=0; i < 0x10000; i++) { + for (num=0, j=4; j--;) { + num = num * i + poly[j]; + } + curve[i] = LIM(num+i,0,65535); + } + apply: /* apply to whole image */ + #pragma omp parallel for schedule(dynamic,16) + for (int row=0; row < raw_height; row++) { + for (int col = (tag & 1)*ph1.split_col; col < raw_width; col++) { + RAW(row,col) = curve[RAW(row,col)]; + } + } + } else if (tag == 0x400) { /* Sensor defects */ + while ((len -= 8) >= 0) { + col = get2(); + row = get2(); + type = get2(); + get2(); + if (col >= raw_width) continue; + if (type == 131 || type == 137) { /* Bad column */ + for (row=0; row < raw_height; row++) { + if (FC(row-top_margin,col-left_margin) == 1) { + for (sum=i=0; i < 4; i++) + sum += val[i] = raw (row+dir[i][0], col+dir[i][1]); + for (max=i=0; i < 4; i++) { + dev[i] = abs((val[i] << 2) - sum); + if (dev[max] < dev[i]) max = i; + } + RAW(row,col) = (sum - val[max])/3.0 + 0.5; + } else { + for (sum=0, i=8; i < 12; i++) + sum += raw (row+dir[i][0], col+dir[i][1]); + RAW(row,col) = 0.5 + sum * 0.0732233 + (raw(row,col-2) + raw(row,col+2)) * 0.3535534; + } + } + } else if (type == 129) { /* Bad pixel */ + if (row >= raw_height) continue; + j = (FC(row-top_margin,col-left_margin) != 1) * 4; + for (sum=0, i=j; i < j+8; i++) + sum += raw (row+dir[i][0], col+dir[i][1]); + RAW(row,col) = (sum + 4) >> 3; + } + } + } else if (tag == 0x401) { /* All-color flat fields */ + phase_one_flat_field (1, 2); + } else if (tag == 0x416 || tag == 0x410) { + phase_one_flat_field (0, 2); + } else if (tag == 0x40b) { /* Red+blue flat field */ + phase_one_flat_field (0, 4); + } else if (tag == 0x412) { + fseek (ifp, 36, SEEK_CUR); + diff = abs (get2() - ph1.tag_21a); + if (mindiff > diff) { + mindiff = diff; + off_412 = ftell(ifp) - 38; + } + } else if (tag == 0x41f && !qlin_applied) { /* Quadrant linearization */ + ushort lc[2][2][16], ref[16]; + int qr, qc; + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + for (i = 0; i < 16; i++) + lc[qr][qc][i] = get4(); + for (i = 0; i < 16; i++) { + int v = 0; + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + v += lc[qr][qc][i]; + ref[i] = (v + 2) >> 2; + } + for (qr = 0; qr < 2; qr++) { + for (qc = 0; qc < 2; qc++) { + int cx[19], cf[19]; + for (i = 0; i < 16; i++) { + cx[1+i] = lc[qr][qc][i]; + cf[1+i] = ref[i]; + } + cx[0] = cf[0] = 0; + cx[17] = cf[17] = ((unsigned) ref[15] * 65535) / lc[qr][qc][15]; + cx[18] = cf[18] = 65535; + cubic_spline(cx, cf, 19); + #pragma omp parallel for schedule(dynamic,16) + for (int row = (qr ? ph1.split_row : 0); row < (qr ? raw_height : ph1.split_row); row++) + for (int col = (qc ? ph1.split_col : 0); col < (qc ? raw_width : ph1.split_col); col++) + RAW(row,col) = curve[RAW(row,col)]; + } + } + qlin_applied = 1; + } else if (tag == 0x41e && !qmult_applied) { /* Quadrant multipliers */ + float qmult[2][2] = { { 1, 1 }, { 1, 1 } }; + get4(); get4(); get4(); get4(); + qmult[0][0] = 1.0 + getreal(11); + get4(); get4(); get4(); get4(); get4(); + qmult[0][1] = 1.0 + getreal(11); + get4(); get4(); get4(); + qmult[1][0] = 1.0 + getreal(11); + get4(); get4(); get4(); + qmult[1][1] = 1.0 + getreal(11); + #pragma omp parallel for schedule(dynamic,16) + for (int row=0; row < raw_height; row++) { + for (int col=0; col < raw_width; col++) { + int i = qmult[row >= ph1.split_row][col >= ph1.split_col] * RAW(row,col); + RAW(row,col) = LIM(i,0,65535); + } + } + qmult_applied = 1; + } else if (tag == 0x431 && !qmult_applied) { /* Quadrant combined */ + ushort lc[2][2][7], ref[7]; + int qr, qc; + for (i = 0; i < 7; i++) + ref[i] = get4(); + for (qr = 0; qr < 2; qr++) + for (qc = 0; qc < 2; qc++) + for (i = 0; i < 7; i++) + lc[qr][qc][i] = get4(); + for (qr = 0; qr < 2; qr++) { + for (qc = 0; qc < 2; qc++) { + int cx[9], cf[9]; + for (i = 0; i < 7; i++) { + cx[1+i] = ref[i]; + cf[1+i] = ((unsigned) ref[i] * lc[qr][qc][i]) / 10000; + } + cx[0] = cf[0] = 0; + cx[8] = cf[8] = 65535; + cubic_spline(cx, cf, 9); + for (row = (qr ? ph1.split_row : 0); row < (qr ? raw_height : ph1.split_row); row++) + for (col = (qc ? ph1.split_col : 0); col < (qc ? raw_width : ph1.split_col); col++) + RAW(row,col) = curve[RAW(row,col)]; + } + } + qmult_applied = 1; + qlin_applied = 1; + } + fseek (ifp, save, SEEK_SET); + } + if (off_412) { + fseek (ifp, off_412, SEEK_SET); + for (i=0; i < 9; i++) + head[i] = get4() & 0x7fff; + yval[0] = (float *) calloc (head[1]*head[3] + head[2]*head[4], 6); + merror (yval[0], "phase_one_correct()"); + yval[1] = (float *) (yval[0] + head[1]*head[3]); + xval[0] = (ushort *) (yval[1] + head[2]*head[4]); + xval[1] = (ushort *) (xval[0] + head[1]*head[3]); + get2(); + for (i=0; i < 2; i++) + for (j=0; j < head[i+1]*head[i+3]; j++) + yval[i][j] = getreal(11); + for (i=0; i < 2; i++) + for (j=0; j < head[i+1]*head[i+3]; j++) + xval[i][j] = get2(); + for (row=0; row < raw_height; row++) + for (col=0; col < raw_width; col++) { + cfrac = (float) col * head[3] / raw_width; + cfrac -= cip = cfrac; + num = RAW(row,col) * 0.5; + for (i=cip; i < cip+2; i++) { + for (k=j=0; j < head[1]; j++) + if (num < xval[0][k = head[1]*i+j]) + break; + frac = (j == 0 || j == head[1]) ? 0 : (xval[0][k] - num) / (xval[0][k] - xval[0][k-1]); + mult[i-cip] = yval[0][k-1] * frac + yval[0][k] * (1-frac); + } + i = ((mult[0] * (1-cfrac) + mult[1] * cfrac) * row + num) * 2; + RAW(row,col) = LIM(i,0,65535); + } + free (yval[0]); } - fseek (ifp, save, SEEK_SET); - } - if (off_412) { - fseek (ifp, off_412, SEEK_SET); - for (i=0; i < 9; i++) head[i] = get4() & 0x7fff; - yval[0] = (float *) calloc (head[1]*head[3] + head[2]*head[4], 6); - merror (yval[0], "phase_one_correct()"); - yval[1] = (float *) (yval[0] + head[1]*head[3]); - xval[0] = (ushort *) (yval[1] + head[2]*head[4]); - xval[1] = (ushort *) (xval[0] + head[1]*head[3]); - get2(); - for (i=0; i < 2; i++) - for (j=0; j < head[i+1]*head[i+3]; j++) - yval[i][j] = getreal(11); - for (i=0; i < 2; i++) - for (j=0; j < head[i+1]*head[i+3]; j++) - xval[i][j] = get2(); - for (row=0; row < raw_height; row++) - for (col=0; col < raw_width; col++) { - cfrac = (float) col * head[3] / raw_width; - cfrac -= cip = cfrac; - num = RAW(row,col) * 0.5; - for (i=cip; i < cip+2; i++) { - for (k=j=0; j < head[1]; j++) - if (num < xval[0][k = head[1]*i+j]) break; - frac = (j == 0 || j == head[1]) ? 0 : - (xval[0][k] - num) / (xval[0][k] - xval[0][k-1]); - mult[i-cip] = yval[0][k-1] * frac + yval[0][k] * (1-frac); - } - i = ((mult[0] * (1-cfrac) + mult[1] * cfrac) * row + num) * 2; - RAW(row,col) = LIM(i,0,65535); - } - free (yval[0]); - } } void CLASS phase_one_load_raw() From 6a67dd350012c117550fa007ae1ae6e439573b36 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 30 Aug 2017 19:47:26 +0200 Subject: [PATCH 04/72] Additional speedup for phase_one_flat_field() --- rtengine/dcraw.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ec06afee6..9b4015d43 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1476,15 +1476,15 @@ void CLASS phase_one_flat_field (int is_float, int nc) if (nc > 2) { mult0 += (c0 & 1) ? mult1 : 0; for (unsigned col = cend - uhead[4] + (c0 & 1); col < std::min(colLimit, cend); col += 2) { - int val = RAW(row, col) * mult0; - RAW(row, col) = LIM(val, 0, 65535); + unsigned val = RAW(row, col) * mult0; + RAW(row, col) = rtengine::min(val, 65535u); mult0 += mult1; mult0 += mult1; // <= this could be reduced to one addition inside the loop, but then the result is not exactly the same as with old code, though it should be even more accurate then } } else { for (unsigned col = cend - uhead[4]; col < std::min(colLimit, cend); col++) { - int val = RAW(row, col) * mult0; - RAW(row, col) = LIM(val, 0, 65535); + unsigned val = RAW(row, col) * mult0; + RAW(row, col) = rtengine::min(val, 65535u); mult0 += mult1; } } From 51804a15a0aa2bfde65b18269a68b9be55a35e97 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 23 Sep 2017 11:03:07 +0200 Subject: [PATCH 05/72] phase_one_load_raw_c() cleanup --- rtengine/dcraw.cc | 73 +++++++++++++++++++++++++---------------------- rtengine/dcraw.h | 2 +- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index d02dfa99e..623547962 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1489,8 +1489,8 @@ void CLASS phase_one_flat_field (int is_float, int nc) } } } - for (unsigned x=0; x < wide; x++) { - for (unsigned c=0; c < nc; c+=2) { + for (unsigned x = 0; x < wide; x++) { + for (unsigned c = 0; c < nc; c += 2) { mrow[c * wide + x] += mrow[(c + 1) * wide + x]; } } @@ -1841,81 +1841,86 @@ void CLASS phase_one_load_raw_c() { BENCHFUN static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; - short (*cblack)[2], (*rblack)[2]; - int *offset = (int *) calloc(raw_width * 2 + raw_height * 4, 2); + int *offset = (int *)calloc(raw_width * 2 + raw_height * 4, 2); fseek(ifp, strip_offset, SEEK_SET); - for (int row=0; row < raw_height; row++) { + for (int row = 0; row < raw_height; row++) { offset[row] = get4(); } - cblack = (short (*)[2]) (offset + raw_height); + + short (*cblack)[2] = (short (*)[2]) (offset + raw_height); fseek(ifp, ph1.black_col, SEEK_SET); if (ph1.black_col) { read_shorts ((ushort *) cblack[0], raw_height * 2); } - rblack = cblack + raw_height; + + short (*rblack)[2] = cblack + raw_height; fseek(ifp, ph1.black_row, SEEK_SET); if (ph1.black_row) { read_shorts ((ushort *) rblack[0], raw_width * 2); } - for (int i=0; i < 256; i++) { + + for (int i = 0; i < 256; i++) { curve[i] = i * i / 3.969 + 0.5; } +#ifdef _OPENMP #pragma omp parallel +#endif { int len[2], pred[2]; - IMFILE *ifpthr = new IMFILE; - ifpthr->fd = ifp->fd; - ifpthr->pos = ifp->pos; - ifpthr->size = ifp->size; - ifpthr->data = ifp->data; - ifpthr->eof = ifp->eof; - ifpthr->plistener = nullptr; - ifpthr->progress_range = ifp->progress_range; - ifpthr->progress_next = ifp->progress_next; - ifpthr->progress_current = ifp->progress_current; + IMFILE ifpthr = *ifp; + ifpthr.plistener = nullptr; - ph1_bithuff_t ph1_bithuff(this, ifpthr, order); - ushort pixel; +#ifdef _OPENMP +#pragma omp master +#endif +{ + ifpthr.plistener = ifp->plistener; +} + ph1_bithuff_t ph1_bithuff(this, &ifpthr, order); + +#ifdef _OPENMP #pragma omp for schedule(dynamic,16) - for (int row=0; row < raw_height; row++) { - int shift = 2*(ph1.format != 8); - fseek(ifpthr, data_offset + offset[row], SEEK_SET); +#endif + + for (int row = 0; row < raw_height; row++) { + const int shift = 2 * (ph1.format != 8); + fseek(&ifpthr, data_offset + offset[row], SEEK_SET); ph1_init(); pred[0] = pred[1] = 0; - for (int col=0; col < raw_width; col++) { + for (int col = 0; col < raw_width; col++) { if (col >= (raw_width & -8)) { len[0] = len[1] = 14; } else if ((col & 7) == 0) { - for (int i=0; i < 2; i++) { + for (int i = 0; i < 2; i++) { int j; - for (j=0; j < 5 && !ph1_bits(1); j++); + for (j = 0; j < 5 && !ph1_bits(1); j++) + ; if (j--) { - len[i] = length[j*2 + ph1_bits(1)]; + len[i] = length[j * 2 + ph1_bits(1)]; } } } - int i; - if ((i = len[col & 1]) == 14) { + + int i = len[col & 1]; + ushort pixel; + if (i == 14) { pixel = pred[col & 1] = ph1_bits(16); } else { pixel = pred[col & 1] += ph1_bits(i) + 1 - (1 << (i - 1)); } - if (UNLIKELY(pred[col & 1] >> 16)) { + if (UNLIKELY(pixel >> 16)) { derror(); } if (ph1.format == 5 && pixel < 256) { pixel = curve[pixel]; } - int rawVal = (pixel << shift) - ph1.black - + cblack[row][col >= ph1.split_col] - + rblack[col][row >= ph1.split_row]; + int rawVal = (pixel << shift) - ph1.black + cblack[row][col >= ph1.split_col] + rblack[col][row >= ph1.split_row]; RAW(row,col) = std::max(rawVal, 0); } } - delete ifpthr; } free(offset); maximum = 0xfffc - ph1.black; diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 0fa0f2175..569b3cebc 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -316,7 +316,7 @@ void parse_qt (int end); // ph1_bithuff(int nbits, ushort *huff); class ph1_bithuff_t { public: - ph1_bithuff_t(DCraw *p,IMFILE *&i,short &o):parent(p),order(o),ifp(i),bitbuf(0),vbits(0){} + ph1_bithuff_t(DCraw *p,IMFILE *i,short &o):parent(p),order(o),ifp(i),bitbuf(0),vbits(0){} unsigned operator()(int nbits, ushort *huff); unsigned operator()(int nbits); unsigned operator()(); From e776f32033be232e1916f1a861145c403ea06a5f Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 25 Sep 2017 01:55:36 +0200 Subject: [PATCH 06/72] Fixed warning in ImProcFunctions::ciecam_02float() --- rtengine/improcfun.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 3bc154446..1676dc433 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -1891,12 +1891,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } } - float meanQ; if (std::isnan (mean)) { mean = (sum / ((height) * width)) / 327.68f; //for Yb for all image...if one day "pipette" we can adapt Yb for each zone - meanQ = (sumQ / ((height) * width));//in case of - } } From 9e812bb25b30ace7c21f50192a43f78643bf623a Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 21 Oct 2017 17:43:02 +0200 Subject: [PATCH 07/72] Make compilation unit rtengine/FTblockDN.cc -Wextra clean --- rtengine/FTblockDN.cc | 38 +++++++++++--------------------------- rtengine/dcrop.cc | 4 ++-- rtengine/improcfun.h | 12 ++++++------ rtengine/simpleprocess.cc | 4 ++-- 4 files changed, 21 insertions(+), 37 deletions(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 50b178388..2344c9f30 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -424,7 +424,7 @@ void ImProcFunctions::Tile_calc(int tilesize, int overlap, int kall, int imwidth int denoiseNestedLevels = 1; enum nrquality {QUALITY_STANDARD, QUALITY_HIGH}; -SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &chaut, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &nresi, float &highresi) +SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &nresi, float &highresi) { //#ifdef _DEBUG MyTime t1e, t2e; @@ -2797,10 +2797,10 @@ SSEFUNCTION void ImProcFunctions::ShrinkAllAB(wavelet_decomposition &WaveletCoef } -SSEFUNCTION void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_a, float ** WavCoeffs_b, int level, - int W_ab, int H_ab, int skip_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, int width, int height, float noisevar_abr, float noisevar_abb, LabImage * noi, float &chaut, int &Nb, float &redaut, float &blueaut, - float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, bool autoch, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, - float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb, bool multiThread) +SSEFUNCTION void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_a, float ** WavCoeffs_b, + int W_ab, int H_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, + float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, + float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb) { //simple wavelet shrinkage @@ -2916,8 +2916,8 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_a, float ** void ImProcFunctions::WaveletDenoiseAll_info(int levwav, wavelet_decomposition &WaveletCoeffs_a, - wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, int width, int height, float noisevar_abr, float noisevar_abb, LabImage * noi, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, bool autoch, - float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb, bool multiThread) + wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, + float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb) { int maxlvl = levwav; @@ -2927,14 +2927,12 @@ void ImProcFunctions::WaveletDenoiseAll_info(int levwav, wavelet_decomposition & int Wlvl_ab = WaveletCoeffs_a.level_W(lvl); int Hlvl_ab = WaveletCoeffs_a.level_H(lvl); - int skip_ab = WaveletCoeffs_a.level_stride(lvl); - float ** WavCoeffs_a = WaveletCoeffs_a.level_coeffs(lvl); float ** WavCoeffs_b = WaveletCoeffs_b.level_coeffs(lvl); - ShrinkAll_info(WavCoeffs_a, WavCoeffs_b, lvl, Wlvl_ab, Hlvl_ab, - skip_ab, noisevarlum, noisevarchrom, noisevarhue, width, height, noisevar_abr, noisevar_abb, noi, chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, - autoch, schoice, lvl, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc, maxchred, maxchblue, minchred, minchblue, nb, chau, chred, chblue, denoiseMethodRgb, multiThread); + ShrinkAll_info(WavCoeffs_a, WavCoeffs_b, Wlvl_ab, Hlvl_ab, + noisevarlum, noisevarchrom, noisevarhue, chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, + schoice, lvl, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc, maxchred, maxchblue, minchred, minchblue, nb, chau, chred, chblue, denoiseMethodRgb); } } @@ -3235,9 +3233,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat noisevarhue[i] = new float[(width + 1) / 2]; } - // init luma noisevarL - float noisevarab_b, noisevarab_r; - float realred, realblue; float interm_med = static_cast( dnparams.chroma) / 10.0; float intermred, intermblue; @@ -3467,8 +3462,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat //and whether to subsample the image after wavelet filtering. Subsampling is coded as //binary 1 or 0 for each level, eg subsampling = 0 means no subsampling, 1 means subsample //the first level only, 7 means subsample the first three levels, etc. - noisevarab_r = SQR(realred) + 0.01f; - noisevarab_b = SQR(realblue) + 0.01f; wavelet_decomposition* adecomp; wavelet_decomposition* bdecomp; @@ -3497,8 +3490,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat bdecomp = new wavelet_decomposition (labdn->data + 2 * datalen, labdn->W, labdn->H, levwav, 1); } } - const bool autoch = (settings->leveldnautsimpl == 1 && (dnparams.Cmethod == "AUT" || dnparams.Cmethod == "PRE")) || (settings->leveldnautsimpl == 0 && (dnparams.C2method == "AUTO" || dnparams.C2method == "PREV")); - if (comptlevel == 0) { WaveletDenoiseAll_info( @@ -3508,11 +3499,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat noisevarlum, noisevarchrom, noisevarhue, - width, - height, - noisevarab_r, - noisevarab_b, - labdn, chaut, Nb, redaut, @@ -3522,7 +3508,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat minredaut, minblueaut, schoice, - autoch, chromina, sigma, lumema, @@ -3538,8 +3523,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat chau, chred, chblue, - denoiseMethodRgb, - multiThread + denoiseMethodRgb ); // Enhance mode } diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 0738e48b0..5918d167a 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -653,8 +653,8 @@ void Crop::update (int todo) if (skip == 1 && denoiseParams.enabled) { int kall = 0; - float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi; - parent->ipf.RGB_denoise (kall, origCrop, origCrop, calclum, parent->denoiseInfoStore.ch_M, parent->denoiseInfoStore.max_r, parent->denoiseInfoStore.max_b, parent->imgsrc->isRAW(), /*Roffset,*/ denoiseParams, parent->imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi); + float nresi, highresi; + parent->ipf.RGB_denoise (kall, origCrop, origCrop, calclum, parent->denoiseInfoStore.ch_M, parent->denoiseInfoStore.max_r, parent->denoiseInfoStore.max_b, parent->imgsrc->isRAW(), /*Roffset,*/ denoiseParams, parent->imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); if (parent->adnListener) { parent->adnListener->noiseChanged (nresi, highresi); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 6c5ded3b6..f9ed02a85 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -305,7 +305,7 @@ public: void Median_Denoise ( float **src, float **dst, int width, int height, Median medianType, int iterations, int numThreads, float **buffer = nullptr); - void RGB_denoise (int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &chaut, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &nresi, float &highresi); + void RGB_denoise (int kall, Imagefloat * src, Imagefloat * dst, Imagefloat * calclum, float * ch_M, float *max_r, float *max_b, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, const NoiseCurve & noiseLCurve, const NoiseCurve & noiseCCurve, float &nresi, float &highresi); void RGB_denoise_infoGamCurve (const procparams::DirPyrDenoiseParams & dnparams, const bool isRAW, LUTf &gamcurve, float &gam, float &gamthresh, float &gamslope); void RGB_denoise_info (Imagefloat * src, Imagefloat * provicalc, bool isRAW, LUTf &gamcurve, float gam, float gamthresh, float gamslope, const procparams::DirPyrDenoiseParams & dnparams, const double expcomp, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float & maxblueaut, float &minredaut, float & minblueaut, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, bool multiThread = false); void RGBtile_denoise (float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer ); //for DCT @@ -313,8 +313,8 @@ public: bool WaveletDenoiseAllL (wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3], float * vari, int edge); bool WaveletDenoiseAllAB (wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb); void WaveletDenoiseAll_info (int levwav, wavelet_decomposition &WaveletCoeffs_a, - wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, int width, int height, float noisevar_abr, float noisevar_abb, LabImage * noi, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float & minblueaut, int schoice, bool autoch, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, - float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb, bool multiThread); + wavelet_decomposition &WaveletCoeffs_b, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float & minblueaut, int schoice, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, + float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb); bool WaveletDenoiseAll_BiShrinkL (wavelet_decomposition &WaveletCoeffs_L, float *noisevarlum, float madL[8][3]); bool WaveletDenoiseAll_BiShrinkAB (wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float *noisevarchrom, float madL[8][3], float noisevar_ab, @@ -322,9 +322,9 @@ public: void ShrinkAllL (wavelet_decomposition &WaveletCoeffs_L, float **buffer, int level, int dir, float *noisevarlum, float * madL, float * vari, int edge); void ShrinkAllAB (wavelet_decomposition &WaveletCoeffs_L, wavelet_decomposition &WaveletCoeffs_ab, float **buffer, int level, int dir, float *noisevarchrom, float noisevar_ab, const bool useNoiseCCurve, bool autoch, bool denoiseMethodRgb, float * madL, float * madaab = nullptr, bool madCalculated = false); - void ShrinkAll_info (float ** WavCoeffs_a, float ** WavCoeffs_b, int level, - int W_ab, int H_ab, int skip_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, int width, int height, float noisevar_abr, float noisevar_abb, LabImage * noi, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, bool autoch, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, - float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb, bool multiThread); + void ShrinkAll_info (float ** WavCoeffs_a, float ** WavCoeffs_b, + int W_ab, int H_ab, float **noisevarlum, float **noisevarchrom, float **noisevarhue, float &chaut, int &Nb, float &redaut, float &blueaut, float &maxredaut, float &maxblueaut, float &minredaut, float &minblueaut, int schoice, int lvl, float &chromina, float &sigma, float &lumema, float &sigma_L, float &redyel, float &skinc, float &nsknc, + float &maxchred, float &maxchblue, float &minchred, float &minchblue, int &nb, float &chau, float &chred, float &chblue, bool denoiseMethodRgb); void Noise_residualAB (wavelet_decomposition &WaveletCoeffs_ab, float &chresid, float &chmaxresid, bool denoiseMethodRgb); void calcautodn_info (float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc); float MadMax (float * DataList, int &max, int datalen); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index cc199389a..384f427b7 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -778,9 +778,9 @@ private: // CurveFactory::denoiseLL(lldenoiseutili, denoiseParams.lcurve, Noisecurve,1); //denoiseParams.getCurves(noiseLCurve); // ipf.RGB_denoise(baseImg, baseImg, calclum, imgsrc->isRAW(), denoiseParams, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, lldenoiseutili); - float chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi; + float nresi, highresi; int kall = 2; - ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, chaut, redaut, blueaut, maxredaut, maxblueaut, nresi, highresi); + ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); } From 06f07820bdaaac52f5144770206a21fd787fd084 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 21 Oct 2017 19:52:41 +0200 Subject: [PATCH 08/72] Make compilation unit rtengine/ipwavelet.cc -Wextra clean, #4155 --- rtengine/dcrop.cc | 3 +-- rtengine/improccoordinator.cc | 2 +- rtengine/improcfun.h | 22 +++++++++--------- rtengine/ipwavelet.cc | 44 ++++++++++++++++------------------- rtengine/simpleprocess.cc | 2 +- 5 files changed, 34 insertions(+), 39 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 5918d167a..57d8f9309 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -801,7 +801,6 @@ void Crop::update (int todo) bool ccutili = parent->ccutili; bool clcutili = parent->clcutili; bool cclutili = parent->cclutili; - bool wavcontlutili = parent->wavcontlutili; LUTu dummy; // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); @@ -921,7 +920,7 @@ void Crop::update (int todo) params.wavelet.getCurves (wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); - parent->ipf.ip_wavelet (labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, wavcontlutili, skip); + parent->ipf.ip_wavelet (labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); } // } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 9d265f90b..96787c257 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -706,7 +706,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int kall = 0; progress ("Wavelet...", 100 * readyphase / numofphases); // ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, scale); - ipf.ip_wavelet (nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, wavcontlutili, scale); + ipf.ip_wavelet (nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); } diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index f9ed02a85..e683d0e19 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -263,9 +263,9 @@ public: void EPDToneMapResid (float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params& cp, int W_L, int H_L, float max0, float min0); - float *CompressDR (float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Compressed); - void ContrastResid (float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params &cp, int W_L, int H_L, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx); - float *ContrastDR (float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast = nullptr); + float *CompressDR (float *Source, int W_L, int H_L, float Compression, float DetailBoost, float *Compressed); + void ContrastResid (float * WavCoeffs_L0, struct cont_params &cp, int W_L, int H_L, float max0, float min0); + float *ContrastDR (float *Source, int W_L, int H_L, float *Contrast = nullptr); void EPDToneMap (LabImage *lab, unsigned int Iterates = 0, int skip = 1); void EPDToneMapCIE (CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); @@ -278,25 +278,25 @@ public: int pitch, int scale, const int luma, const int chroma/*, LUTf & Lcurve, LUTf & abcurve*/ ); void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip); - void ip_wavelet (LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, bool wavcontlutili, int skip); + void ip_wavelet (LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, int skip); void WaveletcontAllL (LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_L, - struct cont_params &cp, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, FlatCurve* ChCurve, bool Chutili); + struct cont_params &cp, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili); void WaveletcontAllLfinal (wavelet_decomposition &WaveletCoeffs_L, struct cont_params &cp, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL); void WaveletcontAllAB (LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_a, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, const bool useChannelA); - void WaveletAandBAllAB (LabImage * lab, float **varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_a, wavelet_decomposition &WaveletCoeffs_b, - struct cont_params &cp, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* hhcurve, bool hhutili); + void WaveletAandBAllAB (wavelet_decomposition &WaveletCoeffs_a, wavelet_decomposition &WaveletCoeffs_b, + struct cont_params &cp, FlatCurve* hhcurve, bool hhutili); void ContAllL (float **koeLi, float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * lab, float **varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, - int W_L, int H_L, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili); + int W_L, int H_L, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili); void finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, int W_L, int H_L, float *mean, float *sigma, float *MaxP, const WavOpacityCurveWL & waOpacityCurveWL); void ContAllAB (LabImage * lab, int maxlvl, float **varhue, float **varchrom, float ** WavCoeffs_a, float * WavCoeffs_a0, int level, int dir, const WavOpacityCurveW & waOpacityCurveW, struct cont_params &cp, int W_ab, int H_ab, const bool useChannelA); void Evaluate2 (wavelet_decomposition &WaveletCoeffs_L, - const struct cont_params& cp, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float madL[8][3]); - void Eval2 (float ** WavCoeffs_L, int level, const struct cont_params& cp, - int W_L, int H_L, int skip_L, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float *madL); + float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN); + void Eval2 (float ** WavCoeffs_L, int level, + int W_L, int H_L, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN); void Aver (float * HH_Coeffs, int datalen, float &averagePlus, float &averageNeg, float &max, float &min); void Sigma (float * HH_Coeffs, int datalen, float averagePlus, float averageNeg, float &sigmaPlus, float &sigmaNeg); diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index dd2a32e10..85b35ef18 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -140,7 +140,7 @@ struct cont_params { int wavNestedLevels = 1; -SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, bool wavcontlutili, int skip) +SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, int skip) { @@ -883,7 +883,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int } } - int ind = 0; bool ref = false; if((cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f || cp.lev3s > 0.f) && cp.noiseena) { @@ -899,7 +898,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int } if(cp.val > 0 || ref || contr) {//edge - Evaluate2(*Ldecomp, cp, ind, mean, meanN, sigma, sigmaN, MaxP, MaxN, madL); + Evaluate2(*Ldecomp, mean, meanN, sigma, sigmaN, MaxP, MaxN); } //init for edge and denoise @@ -921,7 +920,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int WaveletDenoiseAllL(*Ldecomp, noisevarlum, madL, vari, edge); } - ind = 1; //Flat curve for Contrast=f(H) in levels FlatCurve* ChCurve = new FlatCurve(params->wavelet.Chcurve); //curve C=f(H) bool Chutili = false; @@ -936,10 +934,10 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int } - WaveletcontAllL(labco, varhue, varchro, *Ldecomp, cp, skip, mean, meanN, sigma, sigmaN, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, waOpacityCurveWL, ChCurve, Chutili); + WaveletcontAllL(labco, varhue, varchro, *Ldecomp, cp, skip, mean, sigma, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, ChCurve, Chutili); if(cp.val > 0 || ref || contr || cp.diagcurv) {//edge - Evaluate2(*Ldecomp, cp, ind, mean, meanN, sigma, sigmaN, MaxP, MaxN, madL); + Evaluate2(*Ldecomp, mean, meanN, sigma, sigmaN, MaxP, MaxN); } WaveletcontAllLfinal(*Ldecomp, cp, mean, sigma, MaxP, waOpacityCurveWL); @@ -1025,7 +1023,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int if(!adecomp->memoryAllocationFailed && !bdecomp->memoryAllocationFailed) { WaveletcontAllAB(labco, varhue, varchro, *adecomp, waOpacityCurveW, cp, true); WaveletcontAllAB(labco, varhue, varchro, *bdecomp, waOpacityCurveW, cp, false); - WaveletAandBAllAB(labco, varhue, varchro, *adecomp, *bdecomp, cp, waOpacityCurveW, hhCurve, hhutili ); + WaveletAandBAllAB(*adecomp, *bdecomp, cp, hhCurve, hhutili ); adecomp->reconstruct(labco->data + datalen, cp.strength); bdecomp->reconstruct(labco->data + 2 * datalen, cp.strength); @@ -1366,7 +1364,7 @@ void ImProcFunctions::Sigma( float * RESTRICT DataList, int datalen, float aver } void ImProcFunctions::Evaluate2(wavelet_decomposition &WaveletCoeffs_L, - const struct cont_params& cp, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float madL[8][3]) + float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN) { //StopWatch Stop1("Evaluate2"); int maxlvl = WaveletCoeffs_L.maxlevel(); @@ -1376,16 +1374,14 @@ void ImProcFunctions::Evaluate2(wavelet_decomposition &WaveletCoeffs_L, int Wlvl_L = WaveletCoeffs_L.level_W(lvl); int Hlvl_L = WaveletCoeffs_L.level_H(lvl); - int skip_L = WaveletCoeffs_L.level_stride(lvl); - float ** WavCoeffs_L = WaveletCoeffs_L.level_coeffs(lvl); - Eval2 (WavCoeffs_L, lvl, cp, Wlvl_L, Hlvl_L, skip_L, ind, mean, meanN, sigma, sigmaN, MaxP, MaxN, madL[lvl]); + Eval2 (WavCoeffs_L, lvl, Wlvl_L, Hlvl_L, mean, meanN, sigma, sigmaN, MaxP, MaxN); } } -void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, const struct cont_params& cp, - int W_L, int H_L, int skip_L, int ind, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, float *madL) +void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, + int W_L, int H_L, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN) { float avLP[4], avLN[4]; @@ -1429,7 +1425,7 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, const struct cont MaxN[level] = maxLN; } -float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast) +float *ImProcFunctions::ContrastDR(float *Source, int W_L, int H_L, float *Contrast) { int n = W_L * H_L; @@ -1449,7 +1445,7 @@ float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params & return Contrast; } -SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Compressed) +SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int W_L, int H_L, float Compression, float DetailBoost, float *Compressed) { const float eps = 0.000001f; @@ -1485,7 +1481,7 @@ SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int skip, struct c #endif - float *ucr = ContrastDR(Source, skip, cp, W_L, H_L, Compression, DetailBoost, max0, min0, ave, ah, bh, al, bl, factorx); + float *ucr = ContrastDR(Source, W_L, H_L); if(Compressed == nullptr) { Compressed = ucr; @@ -1563,7 +1559,7 @@ SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int skip, struct c } -void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, unsigned int Iterates, int skip, struct cont_params &cp, int W_L, int H_L, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx) +void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, struct cont_params &cp, int W_L, int H_L, float max0, float min0) { float stren = cp.tmstrength; float gamm = params->wavelet.gamma; @@ -1593,7 +1589,7 @@ void ImProcFunctions::ContrastResid(float * WavCoeffs_L0, unsigned int Iterates } - CompressDR(WavCoeffs_L0, skip, cp, W_L, H_L, Compression, DetailBoost, max0, min0, ave, ah, bh, al, bl, factorx, WavCoeffs_L0); + CompressDR(WavCoeffs_L0, W_L, H_L, Compression, DetailBoost, WavCoeffs_L0); #ifdef _RT_NESTED_OPENMP @@ -1679,7 +1675,7 @@ void ImProcFunctions::WaveletcontAllLfinal(wavelet_decomposition &WaveletCoeffs_ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_L, - struct cont_params &cp, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, FlatCurve* ChCurve, bool Chutili) + struct cont_params &cp, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) { int maxlvl = WaveletCoeffs_L.maxlevel(); int W_L = WaveletCoeffs_L.level_W(0); @@ -1824,7 +1820,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * #ifdef _RT_NESTED_OPENMP #pragma omp single #endif - ContrastResid(WavCoeffs_L0, 5, skip, cp, W_L, H_L, maxp, minp, ave, ah, bh, al, bl, factorx ); + ContrastResid(WavCoeffs_L0, cp, W_L, H_L, maxp, minp); } #ifdef _RT_NESTED_OPENMP @@ -2032,7 +2028,7 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * float ** WavCoeffs_L = WaveletCoeffs_L.level_coeffs(lvl); - ContAllL (koeLi, maxkoeLi, true, maxlvl, labco, varhue, varchrom, WavCoeffs_L, WavCoeffs_L0, lvl, dir, cp, Wlvl_L, Hlvl_L, skip, mean, meanN, sigma, sigmaN, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, ChCurve, Chutili); + ContAllL (koeLi, maxkoeLi, true, maxlvl, labco, varhue, varchrom, WavCoeffs_L, WavCoeffs_L0, lvl, dir, cp, Wlvl_L, Hlvl_L, skip, mean, sigma, MaxP, MaxN, wavCLVCcurve, waOpacityCurveW, ChCurve, Chutili); } @@ -2045,8 +2041,8 @@ void ImProcFunctions::WaveletcontAllL(LabImage * labco, float ** varhue, float * } } -void ImProcFunctions::WaveletAandBAllAB(LabImage * labco, float ** varhue, float **varchrom, wavelet_decomposition &WaveletCoeffs_a, wavelet_decomposition &WaveletCoeffs_b, - struct cont_params &cp, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* hhCurve, bool hhutili) +void ImProcFunctions::WaveletAandBAllAB(wavelet_decomposition &WaveletCoeffs_a, wavelet_decomposition &WaveletCoeffs_b, + struct cont_params &cp, FlatCurve* hhCurve, bool hhutili) { // StopWatch Stop1("WaveletAandBAllAB"); if (hhutili && cp.resena) { // H=f(H) @@ -2573,7 +2569,7 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, } void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * labco, float ** varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, - int W_L, int H_L, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) + int W_L, int H_L, int skip, float *mean, float *sigma, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) { assert (level >= 0); assert (maxlvl > level); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 384f427b7..49d15532a 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1078,7 +1078,7 @@ private: CurveFactory::curveWavContL (wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); if (params.wavelet.enabled) { - ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, wavcontlutili, 1); + ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); } wavCLVCurve.Reset(); From 04cdcca26cdc457779b8c3cce1128810e482b939 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 21 Oct 2017 21:26:07 +0200 Subject: [PATCH 09/72] Make compilation unit rtengine/improcfun.cc -Wextra clean, #4155 --- rtengine/dcrop.cc | 9 ++++----- rtengine/improccoordinator.cc | 6 ++---- rtengine/improcfun.cc | 33 +++++++++++++++------------------ rtengine/improcfun.h | 14 +++++++------- rtengine/rawimagesource.cc | 2 +- rtengine/rtthumbnail.cc | 9 ++++----- rtengine/simpleprocess.cc | 18 ++++++++---------- 7 files changed, 41 insertions(+), 50 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 57d8f9309..71b600ae5 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -943,7 +943,6 @@ void Crop::update (int todo) // end calculation adaptation scene luminosity } - int begh = 0, endh = labnCrop->H; bool execsharp = false; if (skip == 1) { @@ -956,13 +955,13 @@ void Crop::update (int todo) if (settings->ciecamfloat) { float d, dj, yb; // not used after this block - parent->ipf.ciecam_02float (cieCrop, float (adap), begh, endh, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, + parent->ipf.ciecam_02float (cieCrop, float (adap), 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1); } else { - double dd, dj, yb; // not used after this block + double dd, dj; // not used after this block - parent->ipf.ciecam_02 (cieCrop, adap, begh, endh, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, - dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, dd, dj, yb, 1); + parent->ipf.ciecam_02 (cieCrop, adap, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, + dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, dd, dj, 1); } } else { // CIECAM is disbaled, we free up its image buffer to save some space diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 96787c257..1f043989d 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -443,7 +443,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) LUTu aehist; int aehistcompr; imgsrc->getAutoExpHistogram (aehist, aehistcompr); - ipf.getAutoExp (aehist, aehistcompr, imgsrc->getDefGain(), params.toneCurve.clip, params.toneCurve.expcomp, + ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, params.toneCurve.expcomp, params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh); if (aeListener) @@ -759,8 +759,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // end calculation adaptation scene luminosity } - int begh = 0; - int endh = pH; float d, dj, yb; bool execsharp = false; @@ -781,7 +779,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) CAMBrightCurveJ.dirty = true; CAMBrightCurveQ.dirty = true; - ipf.ciecam_02float (ncie, float (adap), begh, endh, pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); + ipf.ciecam_02float (ncie, float (adap), pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); if ((params.colorappearance.autodegree || params.colorappearance.autodegreeout) && acListener && params.colorappearance.enabled) { acListener->autoCamChanged (100.* (double)d, 100.* (double)dj); diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 516e0ee9d..72928d77f 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -208,9 +208,9 @@ void ImProcFunctions::firstAnalysis (const Imagefloat* const original, const Pro } // Copyright (c) 2012 Jacques Desmis -void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, +void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2, const ColorAppearance & customColCurve3, - LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, double &yb, int rtt) + LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, int rtt) { if (params->colorappearance.enabled) { //int lastskip; @@ -256,7 +256,6 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int width = lab->W, height = lab->H; float minQ = 10000.f; float maxQ = -1000.f; - float w_h; float a_w; float c_; float f_l; @@ -607,7 +606,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh #ifndef _DEBUG - #pragma omp parallel default(shared) firstprivate(lab,xw1,xw2,yw1,yw2,zw1,zw2,pilot,jli,chr,yb,la,yb2,la2,fl,nc,f,c, height,width,begh, endh,nc2,f2,c2, alg,algepd, gamu, highlight, rstprotection, pW, scale) + #pragma omp parallel default(shared) firstprivate(lab,xw1,xw2,yw1,yw2,zw1,zw2,pilot,jli,chr,yb,la,yb2,la2,fl,nc,f,c, height,width,nc2,f2,c2, alg,algepd, gamu, highlight, rstprotection, pW, scale) #endif { //matrix for current working space @@ -661,7 +660,6 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Qpro = Q; Mpro = M; spro = s; - w_h = wh + epsil; a_w = aw; c_ = c; f_l = fl; @@ -1347,14 +1345,14 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh || (params->colorappearance.badpixsl > 0 && settings->autocielab)) { if (params->epd.enabled && params->colorappearance.tonecie && algepd) { - ImProcFunctions::EPDToneMapCIE (ncie, a_w, c_, w_h, width, height, begh, endh, minQ, maxQ, Iterates, scale ); + ImProcFunctions::EPDToneMapCIE (ncie, a_w, c_, width, height, minQ, maxQ, Iterates, scale ); } //EPDToneMapCIE adapted to CIECAM #ifndef _DEBUG - #pragma omp parallel default(shared) firstprivate(lab,xw2,yw2,zw2,chr,yb,la2,yb2, height,width,begh, endh, nc2,f2,c2, gamu, highlight,pW) + #pragma omp parallel default(shared) firstprivate(lab,xw2,yw2,zw2,chr,yb,la2,yb2, height,width, nc2,f2,c2, gamu, highlight,pW) #endif { TMatrix wiprofa = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.working); @@ -1521,7 +1519,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh // Copyright (c) 2012 Jacques Desmis -void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, +void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2, const ColorAppearance & customColCurve3, LUTu & histLCAM, LUTu & histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt) { @@ -1982,7 +1980,6 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int const float pow1n = pow_F ( 1.64f - pow_F ( 0.29f, nj ), 0.73f ); const float epsil = 0.0001f; - const float w_h = wh + epsil; const float coefQ = 32767.f / wh; const float a_w = aw; const float c_ = c; @@ -2810,7 +2807,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int if (epdEnabled && params->colorappearance.tonecie && algepd) { lab->deleteLab(); - ImProcFunctions::EPDToneMapCIE (ncie, a_w, c_, w_h, width, height, begh, endh, minQ, maxQ, Iterates, scale ); + ImProcFunctions::EPDToneMapCIE (ncie, a_w, c_, width, height, minQ, maxQ, Iterates, scale ); lab->reallocLab(); } @@ -4064,7 +4061,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer float lumbefore = 0.299f * r + 0.587f * g + 0.114f * b; float ro, go, bo; int mode = 0; - toningsmh (r, g, b, ro, go, bo, RedLow, GreenLow, BlueLow, RedMed, GreenMed, BlueMed, RedHigh, GreenHigh, BlueHigh, reducac, mode, preser, strProtect); + toningsmh (r, g, b, ro, go, bo, RedLow, GreenLow, BlueLow, RedMed, GreenMed, BlueMed, RedHigh, GreenHigh, BlueHigh, reducac, mode, strProtect); float lumafter = 0.299f * ro + 0.587f * go + 0.114f * bo; float preserv = 1.f; @@ -4743,7 +4740,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer if (lumbefore < 65000.f && lumbefore > 500.f) { //reduct artifacts for highlights an extrem shadows float ro, go, bo; int mode = 1; - toningsmh (r, g, b, ro, go, bo, RedLow, GreenLow, BlueLow, RedMed, GreenMed, BlueMed, RedHigh, GreenHigh, BlueHigh, reducac, mode, preser, strProtect); + toningsmh (r, g, b, ro, go, bo, RedLow, GreenLow, BlueLow, RedMed, GreenMed, BlueMed, RedHigh, GreenHigh, BlueHigh, reducac, mode, strProtect); float lumafter = 0.299f * ro + 0.587f * go + 0.114f * bo; float preserv = 1.f; @@ -5085,7 +5082,7 @@ void ImProcFunctions::secondeg_begin (float reducac, float vend, float &aam, flo * @param mode ? * @param preser whether to preserve luminance (if 1) or not **/ -void ImProcFunctions::toningsmh (float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, int preser, float strProtect) +void ImProcFunctions::toningsmh (float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect) { float bmu = mode == 1 ? 0.5f : 0.4f; float RedL = 1.f + (RedLow - 1.f) * 0.4f; @@ -6378,8 +6375,8 @@ SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBu //#include "cubic.cc" -void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) -{ +//void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) +//{ /* LUT cmultiplier(181021); @@ -6456,7 +6453,7 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) } */ //delete [] cmultiplier; -} +//} void ImProcFunctions::impulsedenoise (LabImage* lab) { @@ -6539,7 +6536,7 @@ void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) dirpyr_equalizer (lab->L, lab->L, lab->W, lab->H, lab->a, lab->b, lab->a, lab->b, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, params->dirpyrequalizer.gamutlab, b_l, t_l, t_r, b_r, choice, scale); } } -void ImProcFunctions::EPDToneMapCIE (CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates, int skip) +void ImProcFunctions::EPDToneMapCIE (CieImage *ncie, float a_w, float c_, int Wid, int Hei, float minQ, float maxQ, unsigned int Iterates, int skip) { if (!params->epd.enabled) { @@ -6752,7 +6749,7 @@ void ImProcFunctions::EPDToneMap (LabImage *lab, unsigned int Iterates, int skip } -void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double defgain, double clip, +void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh) { diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index e683d0e19..1065c5833 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -220,7 +220,7 @@ public: double expcomp, int hlcompr, int hlcomprthresh, DCPProfile *dcpProf, const DCPProfile::ApplyState &asIn, LUTu &histToneCurve); void labtoning (float r, float g, float b, float &ro, float &go, float &bo, int algm, int metchrom, int twoc, float satLimit, float satLimitOpacity, const ColorGradientCurve & ctColorCurve, const OpacityCurve & ctOpacityCurve, LUTf & clToningcurve, LUTf & cl2Toningcurve, float iplow, float iphigh, double wp[3][3], double wip[3][3] ); void toning2col (float r, float g, float b, float &ro, float &go, float &bo, float iplow, float iphigh, float rl, float gl, float bl, float rh, float gh, float bh, float SatLow, float SatHigh, float balanS, float balanH, float reducac, int mode, int preser, float strProtect); - void toningsmh (float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, int preser, float strProtect); + void toningsmh (float r, float g, float b, float &ro, float &go, float &bo, float RedLow, float GreenLow, float BlueLow, float RedMed, float GreenMed, float BlueMed, float RedHigh, float GreenHigh, float BlueHigh, float reducac, int mode, float strProtect); void toningsmh2 (float r, float g, float b, float &ro, float &go, float &bo, float low[3], float satLow, float med[3], float satMed, float high[3], float satHigh, float reducac, int mode, int preser); void secondeg_begin (float reducac, float vend, float &aam, float &bbm); void secondeg_end (float reducac, float vinf, float &aa, float &bb, float &cc); @@ -229,15 +229,15 @@ public: void moyeqt (Imagefloat* working, float &moyS, float &eqty); void luminanceCurve (LabImage* lold, LabImage* lnew, LUTf &curve); - void ciecam_02float (CieImage* ncie, float adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, + void ciecam_02float (CieImage* ncie, float adap, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, float &d, float &dj, float &yb, int rtt); - void ciecam_02 (CieImage* ncie, double adap, int begh, int endh, int pW, int pwb, LabImage* lab, const ProcParams* params, + void ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, LabImage* lab, const ProcParams* params, const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, - LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, double &yb, int rtt); + LUTu &histLCAM, LUTu &histCCAM, LUTf & CAMBrightCurveJ, LUTf & CAMBrightCurveQ, float &mean, int Iterates, int scale, bool execsharp, double &d, double &dj, int rtt); void chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); void vibrance (LabImage* lab);//Jacques' vibrance - void colorCurve (LabImage* lold, LabImage* lnew); +// void colorCurve (LabImage* lold, LabImage* lnew); void sharpening (LabImage* lab, float** buffer, SharpeningParams &sharpenParam); void sharpeningcam (CieImage* ncie, float** buffer); void transform (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const FramesMetaData *metadata, int rawRotationDeg, bool fullImage); @@ -268,7 +268,7 @@ public: float *ContrastDR (float *Source, int W_L, int H_L, float *Contrast = nullptr); void EPDToneMap (LabImage *lab, unsigned int Iterates = 0, int skip = 1); - void EPDToneMapCIE (CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); + void EPDToneMapCIE (CieImage *ncie, float a_w, float c_, int Wid, int Hei, float minQ, float maxQ, unsigned int Iterates = 0, int skip = 1); // pyramid denoise procparams::DirPyrDenoiseParams dnparams; @@ -353,7 +353,7 @@ public: bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); bool transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); - static void getAutoExp (const LUTu & histogram, int histcompr, double defgain, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); + static void getAutoExp (const LUTu & histogram, int histcompr, double clip, double& expcomp, int& bright, int& contr, int& black, int& hlcompr, int& hlcomprthresh); static double getAutoDistor (const Glib::ustring& fname, int thumb_size); double getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap = nullptr); void rgb2lab (const Imagefloat &src, LabImage &dst, const Glib::ustring &workingSpace); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 6ab9076aa..820c64bec 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2003,7 +2003,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le double clip = 0; int brightness, contrast, black, hlcompr, hlcomprthresh; getAutoExpHistogram (aehist, aehistcompr); - ImProcFunctions::getAutoExp (aehist, aehistcompr, getDefGain(), clip, dirpyrdenoiseExpComp, brightness, contrast, black, hlcompr, hlcomprthresh); + ImProcFunctions::getAutoExp (aehist, aehistcompr, clip, dirpyrdenoiseExpComp, brightness, contrast, black, hlcompr, hlcomprthresh); } t2.set(); diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 9bdee796b..c790c9378 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1126,8 +1126,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT int hlcomprthresh = params.toneCurve.hlcomprthresh; if (params.toneCurve.autoexp && aeHistogram) { - double logDefGain = 0.0; - ipf.getAutoExp (aeHistogram, aeHistCompression, logDefGain, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); + ipf.getAutoExp (aeHistogram, aeHistCompression, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); } LUTf curve1 (65536); @@ -1290,7 +1289,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT customColCurve2, customColCurve3, 16); - int begh = 0, endh = labView->H; + bool execsharp = false; float d, dj, yb; float fnum = fnumber;// F number @@ -1323,7 +1322,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT CAMMean = NAN; CAMBrightCurveJ.dirty = true; CAMBrightCurveQ.dirty = true; - ipf.ciecam_02float (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, sk, execsharp, d, dj, yb, rtt); + ipf.ciecam_02float (cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, sk, execsharp, d, dj, yb, rtt); delete cieView; } @@ -1433,7 +1432,7 @@ void Thumbnail::applyAutoExp (procparams::ProcParams& params) if (params.toneCurve.autoexp && aeHistogram) { ImProcFunctions ipf (¶ms, false); - ipf.getAutoExp (aeHistogram, aeHistCompression, log (defGain) / log (2.0), params.toneCurve.clip, params.toneCurve.expcomp, + ipf.getAutoExp (aeHistogram, aeHistCompression, params.toneCurve.clip, params.toneCurve.expcomp, params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh); } } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 49d15532a..78608c24e 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -718,7 +718,7 @@ private: LUTu aehist; int aehistcompr; imgsrc->getAutoExpHistogram (aehist, aehistcompr); - ipf.getAutoExp (aehist, aehistcompr, imgsrc->getDefGain(), params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); + ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); } // at this stage, we can flush the raw data to free up quite an important amount of memory @@ -1086,7 +1086,6 @@ private: //Colorappearance and tone-mapping associated int f_w = 1, f_h = 1; - int begh = 0, endh = fh; if (params.colorappearance.tonecie || params.colorappearance.enabled) { f_w = fw; @@ -1094,8 +1093,7 @@ private: } CieImage *cieView = new CieImage (f_w, (f_h)); - begh = 0; - endh = fh; + CurveFactory::curveLightBrightColor ( params.colorappearance.curve, params.colorappearance.curve2, @@ -1137,18 +1135,18 @@ private: if (params.sharpening.enabled) { if (settings->ciecamfloat) { float d, dj, yb; - ipf.ciecam_02float (cieView, float (adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); + ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } else { - double dd, dj, yb; - ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, yb, 1); + double dd, dj; + ipf.ciecam_02 (cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); } } else { if (settings->ciecamfloat) { float d, dj, yb; - ipf.ciecam_02float (cieView, float (adap), begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); + ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } else { - double dd, dj, yb; - ipf.ciecam_02 (cieView, adap, begh, endh, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, yb, 1); + double dd, dj; + ipf.ciecam_02 (cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); } } } From c8ac93676e1af480880c59957ab629e3f0711740 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 21 Oct 2017 22:01:42 +0200 Subject: [PATCH 10/72] Make compilation unit rtengine/demosaic_algos.cc -Wextra clean, #4155 --- rtengine/demosaic_algos.cc | 2 +- rtengine/rawimagesource.cc | 2 +- rtengine/rawimagesource.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 6a5b8eba8..88d369969 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -2612,7 +2612,7 @@ void RawImageSource::igv_interpolate(int winw, int winh) #define FORC(cnt) for (c=0; c < cnt; c++) #define FORC3 FORC(3) -void RawImageSource::ahd_demosaic(int winx, int winy, int winw, int winh) +void RawImageSource::ahd_demosaic() { int i, j, k, top, left, row, col, tr, tc, c, d, val, hm[2]; float (*pix)[4], (*rix)[3]; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 820c64bec..bea20e64c 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2032,7 +2032,7 @@ void RawImageSource::demosaic(const RAWParams &raw) } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::vng4] ) { vng4_demosaic (); } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ahd] ) { - ahd_demosaic (0, 0, W, H); + ahd_demosaic (); } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze] ) { amaze_demosaic_RT (0, 0, W, H, rawData, red, green, blue); } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift] ) { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 99cc9af64..d512274bc 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -247,7 +247,7 @@ protected: void amaze_demosaic_RT(int winx, int winy, int winw, int winh, array2D &rawData, array2D &red, array2D &green, array2D &blue);//Emil's code for AMaZE void fast_demosaic(int winx, int winy, int winw, int winh );//Emil's code for fast demosaicing void dcb_demosaic(int iterations, bool dcb_enhance); - void ahd_demosaic(int winx, int winy, int winw, int winh); + void ahd_demosaic(); void border_interpolate(unsigned int border, float (*image)[4], unsigned int start = 0, unsigned int end = 0); void border_interpolate2(int winw, int winh, int lborders); void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border); From 3570550ac915a076587c9303a87cebf57d920c00 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 21 Oct 2017 22:55:07 +0200 Subject: [PATCH 11/72] Make compilation unit rtengine/labimage.cc -Wextra clean, #4155 --- rtengine/labimage.cc | 63 ++++++++++++++++++++++++++++++++++++++++++-- rtengine/labimage.h | 42 +++-------------------------- 2 files changed, 64 insertions(+), 41 deletions(-) diff --git a/rtengine/labimage.cc b/rtengine/labimage.cc index 36d3e0f67..4cd5ce31a 100644 --- a/rtengine/labimage.cc +++ b/rtengine/labimage.cc @@ -1,9 +1,29 @@ +/* + * This file is part of RawTherapee. + * + * Copyright (c) 2004-2017 Gabor Horvath + * + * RawTherapee is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RawTherapee is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RawTherapee. If not, see . + */ + #include "labimage.h" -#include +#include + namespace rtengine { -LabImage::LabImage (int w, int h) : fromImage(false), W(w), H(h) +LabImage::LabImage (int w, int h) : W(w), H(h) { allocLab(w, h); } @@ -42,4 +62,43 @@ void LabImage::getPipetteData (float &v1, float &v2, float &v3, int posX, int po v3 = n ? accumulator_b / float(n) : 0.f; } +void LabImage::allocLab(int w, int h) +{ + L = new float*[h]; + a = new float*[h]; + b = new float*[h]; + + data = new float [w * h * 3]; + float * index = data; + + for (int i = 0; i < h; i++) { + L[i] = index + i * w; + } + + index += w * h; + + for (int i = 0; i < h; i++) { + a[i] = index + i * w; + } + + index += w * h; + + for (int i = 0; i < h; i++) { + b[i] = index + i * w; + } +} + +void LabImage::deleteLab() +{ + delete [] L; + delete [] a; + delete [] b; + delete [] data; +} + +void LabImage::reallocLab() +{ + allocLab(W, H); +}; + } diff --git a/rtengine/labimage.h b/rtengine/labimage.h index 4b7db93c0..93f3887b6 100644 --- a/rtengine/labimage.h +++ b/rtengine/labimage.h @@ -25,32 +25,8 @@ namespace rtengine class LabImage { private: - bool fromImage; - void allocLab(int w, int h) - { - L = new float*[H]; - a = new float*[H]; - b = new float*[H]; + void allocLab(int w, int h); - data = new float [W * H * 3]; - float * index = data; - - for (int i = 0; i < H; i++) { - L[i] = index + i * W; - } - - index += W * H; - - for (int i = 0; i < H; i++) { - a[i] = index + i * W; - } - - index += W * H; - - for (int i = 0; i < H; i++) { - b[i] = index + i * W; - } - }; public: int W, H; float * data; @@ -64,20 +40,8 @@ public: //Copies image data in Img into this instance. void CopyFrom(LabImage *Img); void getPipetteData (float &L, float &a, float &b, int posX, int posY, int squareSize); - void deleteLab( ) - { - if (!fromImage) { - delete [] L; - delete [] a; - delete [] b; - delete [] data; - } - } - void reallocLab( ) - { - allocLab(W, H); - }; - + void deleteLab(); + void reallocLab(); }; } From 15108af3a7682d9bcbe82b625ce24f26fedea4fe Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 01:54:12 +0200 Subject: [PATCH 12/72] Make compilation unit rtengine/ciecam02.cc -Wextra clean, #4155 --- rtengine/ciecam02.cc | 10 +++++----- rtengine/ciecam02.h | 10 ++++------ rtengine/curves.cc | 2 +- rtengine/improcfun.cc | 13 +++++-------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/rtengine/ciecam02.cc b/rtengine/ciecam02.cc index 625b77f05..7b5ef63fe 100644 --- a/rtengine/ciecam02.cc +++ b/rtengine/ciecam02.cc @@ -780,7 +780,7 @@ void Ciecam02::initcam2float (float gamu, float yb, float pilotd, float f, float void Ciecam02::xyz2jchqms_ciecam02 ( double &J, double &C, double &h, double &Q, double &M, double &s, double &aw, double &fl, double &wh, double x, double y, double z, double xw, double yw, double zw, - double yb, double la, double f, double c, double nc, double pilotd, int gamu, double n, double nbb, double ncb, double pfl, double cz, double d) + double c, double nc, int gamu, double n, double nbb, double ncb, double pfl, double cz, double d) { double r, g, b; double rw, gw, bw; @@ -1040,8 +1040,8 @@ void Ciecam02::xyz2jch_ciecam02float ( float &J, float &C, float &h, float aw, f void Ciecam02::jch2xyz_ciecam02 ( double &x, double &y, double &z, double J, double C, double h, - double xw, double yw, double zw, double yb, double la, - double f, double c, double nc, int gamu, double n, double nbb, double ncb, double fl, double cz, double d, double aw ) + double xw, double yw, double zw, + double c, double nc, int gamu, double n, double nbb, double ncb, double fl, double cz, double d, double aw ) { double r, g, b; double rc, gc, bc; @@ -1075,7 +1075,7 @@ void Ciecam02::jch2xyz_ciecam02 ( double &x, double &y, double &z, double J, dou void Ciecam02::jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, float C, float h, float xw, float yw, float zw, - float f, float c, float nc, int gamu, float pow1, float nbb, float ncb, float fl, float cz, float d, float aw) + float c, float nc, int gamu, float pow1, float nbb, float ncb, float fl, float cz, float d, float aw) { float r, g, b; float rc, gc, bc; @@ -1110,7 +1110,7 @@ void Ciecam02::jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, fl #ifdef __SSE2__ void Ciecam02::jch2xyz_ciecam02float ( vfloat &x, vfloat &y, vfloat &z, vfloat J, vfloat C, vfloat h, vfloat xw, vfloat yw, vfloat zw, - vfloat f, vfloat nc, vfloat pow1, vfloat nbb, vfloat ncb, vfloat fl, vfloat d, vfloat aw, vfloat reccmcz) + vfloat nc, vfloat pow1, vfloat nbb, vfloat ncb, vfloat fl, vfloat d, vfloat aw, vfloat reccmcz) { vfloat r, g, b; vfloat rc, gc, bc; diff --git a/rtengine/ciecam02.h b/rtengine/ciecam02.h index 1e0f755c1..55d807b7e 100644 --- a/rtengine/ciecam02.h +++ b/rtengine/ciecam02.h @@ -82,19 +82,18 @@ public: static void jch2xyz_ciecam02 ( double &x, double &y, double &z, double J, double C, double h, double xw, double yw, double zw, - double yb, double la, - double f, double c, double nc, int gamu, double n, double nbb, double ncb, double fl, double cz, double d, double aw); + double c, double nc, int gamu, double n, double nbb, double ncb, double fl, double cz, double d, double aw); static void jch2xyz_ciecam02float ( float &x, float &y, float &z, float J, float C, float h, float xw, float yw, float zw, - float f, float c, float nc, int gamu, float n, float nbb, float ncb, float fl, float cz, float d, float aw ); + float c, float nc, int gamu, float n, float nbb, float ncb, float fl, float cz, float d, float aw ); #ifdef __SSE2__ static void jch2xyz_ciecam02float ( vfloat &x, vfloat &y, vfloat &z, vfloat J, vfloat C, vfloat h, vfloat xw, vfloat yw, vfloat zw, - vfloat f, vfloat nc, vfloat n, vfloat nbb, vfloat ncb, vfloat fl, vfloat d, vfloat aw, vfloat reccmcz ); + vfloat nc, vfloat n, vfloat nbb, vfloat ncb, vfloat fl, vfloat d, vfloat aw, vfloat reccmcz ); #endif /** * Forward transform from XYZ to CIECAM02 JCh. @@ -115,8 +114,7 @@ public: double &Q, double &M, double &s, double &aw, double &fl, double &wh, double x, double y, double z, double xw, double yw, double zw, - double yb, double la, - double f, double c, double nc, double pilotd, int gamu, double n, double nbb, double ncb, double pfl, double cz, double d ); + double c, double nc, int gamu, double n, double nbb, double ncb, double pfl, double cz, double d ); static void xyz2jch_ciecam02float ( float &J, float &C, float &h, float aw, float fl, diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 3096f19f4..ee589bc74 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1986,7 +1986,7 @@ void PerceptualToneCurve::Apply(float &r, float &g, float &b, PerceptualToneCurv Ciecam02::jch2xyz_ciecam02float( x, y, z, J, C, h, xw, yw, zw, - f, c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw ); + c, nc, 1, pow1, nbb, ncb, fl, cz, d, aw ); if (!isfinite(x) || !isfinite(y) || !isfinite(z)) { // can happen for colors on the rim of being outside gamut, that worked without chroma scaling but not with. Then we return only the curve's result. diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 72928d77f..c87d4edd4 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -652,8 +652,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L Q, M, s, aw, fl, wh, x, y, z, xw1, yw1, zw1, - yb, la, - f, c, nc, pilot, gamu, n, nbb, ncb, pfl, cz, d ); + c, nc, gamu, n, nbb, ncb, pfl, cz, d ); Jpro = J; Cpro = C; hpro = h; @@ -1178,8 +1177,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L Ciecam02::jch2xyz_ciecam02 ( xx, yy, zz, J, C, h, xw2, yw2, zw2, - yb2, la2, - f2, c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); + c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); x = (float)xx * 655.35; y = (float)yy * 655.35; z = (float)zz * 655.35; @@ -1447,8 +1445,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L Ciecam02::jch2xyz_ciecam02 ( xx, yy, zz, ncie->J_p[i][j], ncie->C_p[i][j], ncie->h_p[i][j], xw2, yw2, zw2, - yb2, la2, - f2, c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); + c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); x = (float)xx * 655.35; y = (float)yy * 655.35; z = (float)zz * 655.35; @@ -2602,7 +2599,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw Ciecam02::jch2xyz_ciecam02float ( x, y, z, LVF (Jbuffer[k]), LVF (Cbuffer[k]), LVF (hbuffer[k]), F2V (xw2), F2V (yw2), F2V (zw2), - F2V (f2), F2V (nc2), F2V (pow1n), F2V (nbbj), F2V (ncbj), F2V (flj), F2V (dj), F2V (awj), F2V (reccmcz)); + F2V (nc2), F2V (pow1n), F2V (nbbj), F2V (ncbj), F2V (flj), F2V (dj), F2V (awj), F2V (reccmcz)); STVF (xbuffer[k], x * c655d35); STVF (ybuffer[k], y * c655d35); STVF (zbuffer[k], z * c655d35); @@ -2946,7 +2943,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw Ciecam02::jch2xyz_ciecam02float ( x, y, z, LVF (Jbuffer[k]), LVF (Cbuffer[k]), LVF (hbuffer[k]), F2V (xw2), F2V (yw2), F2V (zw2), - F2V (f2), F2V (nc2), F2V (pow1n), F2V (nbbj), F2V (ncbj), F2V (flj), F2V (dj), F2V (awj), F2V (reccmcz)); + F2V (nc2), F2V (pow1n), F2V (nbbj), F2V (ncbj), F2V (flj), F2V (dj), F2V (awj), F2V (reccmcz)); x *= c655d35; y *= c655d35; z *= c655d35; From d5ceb850f33618742e20055c299463d2d2f61629 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 13:43:28 +0200 Subject: [PATCH 13/72] Make compilation unit rtengine/rawimagesource.cc -Wextra clean, #4155 --- rtengine/clutstore.cc | 2 +- rtengine/dcrop.cc | 12 ++++++------ rtengine/imagesource.h | 6 +++--- rtengine/improccoordinator.cc | 6 +++--- rtengine/loadinitial.cc | 6 +----- rtengine/previewimage.cc | 4 ++-- rtengine/rawimagesource.cc | 10 +++++----- rtengine/rawimagesource.h | 6 +++--- rtengine/simpleprocess.cc | 8 ++++---- rtengine/stdimagesource.cc | 4 ++-- rtengine/stdimagesource.h | 4 ++-- 11 files changed, 32 insertions(+), 36 deletions(-) diff --git a/rtengine/clutstore.cc b/rtengine/clutstore.cc index 5731773a4..565db8faa 100644 --- a/rtengine/clutstore.cc +++ b/rtengine/clutstore.cc @@ -52,7 +52,7 @@ bool loadFile( rtengine::procparams::ColorManagementParams icm; icm.working = working_color_space; - img_src.getImage(curr_wb, TR_NONE, img_float.get(), pp, rtengine::procparams::ToneCurveParams(), icm, rtengine::procparams::RAWParams()); + img_src.getImage(curr_wb, TR_NONE, img_float.get(), pp, rtengine::procparams::ToneCurveParams(), rtengine::procparams::RAWParams()); if (!working_color_space.empty()) { img_src.convertColorSpace(img_float.get(), icm, curr_wb); diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 71b600ae5..19cb654ec 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -228,18 +228,18 @@ void Crop::update (int todo) if (settings->leveldnautsimpl == 1) { if (params.dirpyrDenoise.Cmethod == "MAN" || params.dirpyrDenoise.Cmethod == "PON" ) { PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.icm, params.raw ); + parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); } } else { if (params.dirpyrDenoise.C2method == "MANU") { PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.icm, params.raw ); + parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); } } if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "PRE") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "PREV")) { PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.icm, params.raw ); + parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); if ((!isDetailWindow) && parent->adnListener && skip == 1 && params.dirpyrDenoise.enabled) { float lowdenoise = 1.f; @@ -451,7 +451,7 @@ void Crop::update (int todo) for (int wcr = 0; wcr <= 2; wcr++) { for (int hcr = 0; hcr <= 2; hcr++) { PreviewProps ppP (coordW[wcr], coordH[hcr], crW, crH, 1); - parent->imgsrc->getImage (parent->currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw ); + parent->imgsrc->getImage (parent->currWB, tr, origCropPart, ppP, params.toneCurve, params.raw ); // we only need image reduced to 1/4 here for (int ii = 0; ii < crH; ii += 2) { @@ -613,7 +613,7 @@ void Crop::update (int todo) // if(params.dirpyrDenoise.Cmethod=="AUT" || params.dirpyrDenoise.Cmethod=="PON") {//reinit origCrop after Auto if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { //reinit origCrop after Auto PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.icm, params.raw ); + parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); } DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; @@ -763,7 +763,7 @@ void Crop::update (int todo) if (todo & M_RGBCURVE) { double rrm, ggm, bbm; DCPProfile::ApplyState as; - DCPProfile *dcpProf = parent->imgsrc->getDCP (params.icm, parent->currWB, as); + DCPProfile *dcpProf = parent->imgsrc->getDCP (params.icm, as); LUTu histToneCurve; parent->ipf.rgbProc (baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve, cshmap, diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 757e6f5a7..b76a962eb 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -66,7 +66,7 @@ public: embProfile(nullptr), idata(nullptr), dirpyrdenoiseExpComp(INFINITY) {} virtual ~ImageSource () {} - virtual int load (const Glib::ustring &fname, int imageNum = 0, bool batch = false) = 0; + virtual int load (const Glib::ustring &fname) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse, bool prepareDenoise = true) {}; virtual void demosaic (const RAWParams &raw) {}; virtual void retinex (ColorManagementParams cmp, const RetinexParams &deh, ToneCurveParams Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; @@ -85,7 +85,7 @@ public: // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* - virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hlp, const ColorManagementParams &cmp, const RAWParams &raw) = 0; + virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hlp, const RAWParams &raw) = 0; virtual eSensorType getSensorType () const = 0; // true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource virtual bool isWBProviderReady () = 0; @@ -110,7 +110,7 @@ public: virtual FrameData* getImageData (unsigned int frameNum) = 0; virtual ImageMatrices* getImageMatrices () = 0; virtual bool isRAW () const = 0; - virtual DCPProfile* getDCP (const ColorManagementParams &cmp, ColorTemp &wb, DCPProfile::ApplyState &as) + virtual DCPProfile* getDCP (const ColorManagementParams &cmp, DCPProfile::ApplyState &as) { return nullptr; }; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 1f043989d..9366bec27 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -333,7 +333,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // Tells to the ImProcFunctions' tools what is the preview scale, which may lead to some simplifications ipf.setScale (scale); - imgsrc->getImage (currWB, tr, orig_prev, pp, params.toneCurve, params.icm, params.raw); + imgsrc->getImage (currWB, tr, orig_prev, pp, params.toneCurve, params.raw); denoiseInfoStore.valid = false; //ColorTemp::CAT02 (orig_prev, ¶ms) ; // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); @@ -556,7 +556,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) double bbm = 33.; DCPProfile::ApplyState as; - DCPProfile *dcpProf = imgsrc->getDCP (params.icm, currWB, as); + DCPProfile *dcpProf = imgsrc->getDCP (params.icm, as); ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, dcpProf, as, histToneCurve); @@ -1223,7 +1223,7 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring& fname, bool currWB = ColorTemp(); // = no white balance } - imgsrc->getImage (currWB, tr, im, pp, ppar.toneCurve, ppar.icm, ppar.raw); + imgsrc->getImage (currWB, tr, im, pp, ppar.toneCurve, ppar.raw); ImProcFunctions ipf (&ppar, true); if (ipf.needsTransform()) { diff --git a/rtengine/loadinitial.cc b/rtengine/loadinitial.cc index c29d60621..6192ca6db 100644 --- a/rtengine/loadinitial.cc +++ b/rtengine/loadinitial.cc @@ -36,11 +36,7 @@ InitialImage* InitialImage::load (const Glib::ustring& fname, bool isRaw, int* e isrc->setProgressListener (pl); - if(isRaw && pl == nullptr) { - *errorCode = isrc->load (fname, true); - } else { - *errorCode = isrc->load (fname); - } + *errorCode = isrc->load (fname); if (*errorCode) { delete isrc; diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index e6703aed5..1bd72a354 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -97,7 +97,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext if ((mode == PIM_EmbeddedOrRaw && !tpp) || mode == PIM_ForceRaw) { RawImageSource rawImage; - int error = rawImage.load(fname, true); + int error = rawImage.load(fname); if (!error) { const unsigned char *data = nullptr; @@ -115,7 +115,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext rawImage.preprocess(params.raw, params.lensProf, params.coarse); rawImage.demosaic(params.raw); Imagefloat image(fw, fh); - rawImage.getImage (wb, TR_NONE, &image, pp, params.toneCurve, params.icm, params.raw); + rawImage.getImage (wb, TR_NONE, &image, pp, params.toneCurve, params.raw); rtengine::Image8 output(fw, fh); rawImage.convertColorSpace(&image, params.icm, wb); #pragma omp parallel for schedule(dynamic, 10) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index bea20e64c..3e234bef5 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -87,7 +87,7 @@ void transLineStandard (const float* const red, const float* const green, const rotateLine (blue, image->b, tran, i, imwidth, imheight); } -void transLineFuji (const float* const red, const float* const green, const float* const blue, const int i, rtengine::Imagefloat* const image, const int tran, const int imwidth, const int imheight, const int fw) +void transLineFuji (const float* const red, const float* const green, const float* const blue, const int i, rtengine::Imagefloat* const image, const int tran, const int imheight, const int fw) { // Fuji SuperCCD rotation + coarse rotation @@ -623,7 +623,7 @@ float calculate_scale_mul(float scale_mul[4], const float pre_mul_[4], const flo return gain; } -void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const ColorManagementParams &cmp, const RAWParams &raw ) +void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw ) { MyMutex::MyLock lock(getImageMutex); @@ -824,7 +824,7 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima if(d1x) { transLineD1x (line_red, line_grn, line_blue, ix, image, tran, imwidth, imheight, d1xHeightOdd, doClip); } else if(fuji) { - transLineFuji (line_red, line_grn, line_blue, ix, image, tran, imwidth, imheight, fw); + transLineFuji (line_red, line_grn, line_blue, ix, image, tran, imheight, fw); } else { transLineStandard (line_red, line_grn, line_blue, ix, image, tran, imwidth, imheight); } @@ -910,7 +910,7 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima } } -DCPProfile *RawImageSource::getDCP(const ColorManagementParams &cmp, ColorTemp &wb, DCPProfile::ApplyState &as) +DCPProfile *RawImageSource::getDCP(const ColorManagementParams &cmp, DCPProfile::ApplyState &as) { DCPProfile *dcpProf = nullptr; cmsHPROFILE dummy; @@ -1518,7 +1518,7 @@ void RawImageSource::vflip (Imagefloat* image) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -int RawImageSource::load (const Glib::ustring &fname, int imageNum, bool batch) +int RawImageSource::load (const Glib::ustring &fname) { MyTime t1, t2; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index d512274bc..9da7d44f4 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -116,7 +116,7 @@ public: RawImageSource (); ~RawImageSource (); - int load (const Glib::ustring &fname, int imageNum = 0, bool batch = false); + int load (const Glib::ustring &fname); void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse, bool prepareDenoise = true); void demosaic (const RAWParams &raw); void retinex (ColorManagementParams cmp, const RetinexParams &deh, ToneCurveParams Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI); @@ -138,7 +138,7 @@ public: void cfaboxblur (RawImage *riFlatFile, float* cfablur, int boxH, int boxW); void scaleColors (int winx, int winy, int winw, int winh, const RAWParams &raw, array2D &rawData); // raw for cblack - void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const ColorManagementParams &cmp, const RAWParams &raw); + void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw); eSensorType getSensorType () const { return ri != nullptr ? ri->getSensorType() : ST_NONE; @@ -185,7 +185,7 @@ public: } void getAutoExpHistogram (LUTu & histogram, int& histcompr); void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw); - DCPProfile *getDCP(const ColorManagementParams &cmp, ColorTemp &wb, DCPProfile::ApplyState &as); + DCPProfile *getDCP(const ColorManagementParams &cmp, DCPProfile::ApplyState &as); void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb); static bool findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 78608c24e..e8bcb7054 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -318,7 +318,7 @@ private: int beg_tileW = wcr * tileWskip + tileWskip / 2.f - crW / 2.f; int beg_tileH = hcr * tileHskip + tileHskip / 2.f - crH / 2.f; PreviewProps ppP (beg_tileW, beg_tileH, crW, crH, skipP); - imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw ); + imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw ); //baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve); // we only need image reduced to 1/4 here @@ -538,7 +538,7 @@ private: for (int wcr = 0; wcr <= 2; wcr++) { for (int hcr = 0; hcr <= 2; hcr++) { PreviewProps ppP (coordW[wcr], coordH[hcr], crW, crH, 1); - imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.icm, params.raw); + imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); //baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve); @@ -698,7 +698,7 @@ private: } baseImg = new Imagefloat (fw, fh); - imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw); + imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.raw); if (pl) { pl->setProgress (0.50); @@ -931,7 +931,7 @@ private: autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000) DCPProfile::ApplyState as; - DCPProfile *dcpProf = imgsrc->getDCP (params.icm, currWB, as); + DCPProfile *dcpProf = imgsrc->getDCP (params.icm, as); LUTu histToneCurve; diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index d4e6a62f1..61bf90b31 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -102,7 +102,7 @@ void StdImageSource::getSampleFormat (const Glib::ustring &fname, IIOSampleForma * and RT's image data type (Image8, Image16 and Imagefloat), then it will * load the image into it */ -int StdImageSource::load (const Glib::ustring &fname, int imageNum, bool batch) +int StdImageSource::load (const Glib::ustring &fname) { fileName = fname; @@ -187,7 +187,7 @@ int StdImageSource::load (const Glib::ustring &fname, int imageNum, bool batch) return 0; } -void StdImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const ColorManagementParams &cmp, const RAWParams &raw) +void StdImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw) { // the code will use OpenMP as of now. diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 1450d745e..304bc3d8d 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -42,8 +42,8 @@ public: StdImageSource (); ~StdImageSource (); - int load (const Glib::ustring &fname, int imageNum = 0, bool batch = false); - void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const ColorManagementParams &cmp, const RAWParams &raw); + int load (const Glib::ustring &fname); + void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hrp, const RAWParams &raw); ColorTemp getWB () const { return wb; From e489fc7bea243ba1964a610926aef06162c85497 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 14:01:07 +0200 Subject: [PATCH 14/72] Make compilation unit rtengine/rtthumbnail.cc -Wextra clean, #4155 --- rtengine/improcfun.cc | 2 +- rtengine/rtthumbnail.cc | 6 +++--- rtengine/rtthumbnail.h | 6 +++--- rtgui/thumbnail.cc | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index c87d4edd4..9cc3e7d28 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -7064,7 +7064,7 @@ double ImProcFunctions::getAutoDistor (const Glib::ustring &fname, int thumb_si return 0.0; } - Thumbnail* raw = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, w_raw, h_raw, 1, 1.0, FALSE, 0); + Thumbnail* raw = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, w_raw, h_raw, 1, 1.0, FALSE); if (!raw) { delete thumb; diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index c790c9378..b458464b8 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -381,7 +381,7 @@ RawMetaDataLocation Thumbnail::loadMetaDataFromRaw (const Glib::ustring& fname) return rml; } -Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, int imageNum) +Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate) { RawImage *ri = new RawImage (fname); unsigned int tempImageNum = 0; @@ -929,7 +929,7 @@ Thumbnail::~Thumbnail () } // Simple processing of RAW internal JPGs -IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int rheight, rtengine::TypeInterpolation interp, double& myscale) +IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int rheight, rtengine::TypeInterpolation interp) { int rwidth; @@ -1761,7 +1761,7 @@ unsigned char* Thumbnail::getGrayscaleHistEQ (int trim_width) return tmpdata; } -bool Thumbnail::writeImage (const Glib::ustring& fname, int format) +bool Thumbnail::writeImage (const Glib::ustring& fname) { if (!thumbImg) { diff --git a/rtengine/rtthumbnail.h b/rtengine/rtthumbnail.h index 4987cc88c..2ee08de50 100644 --- a/rtengine/rtthumbnail.h +++ b/rtengine/rtthumbnail.h @@ -72,12 +72,12 @@ public: void init (); IImage8* processImage (const procparams::ProcParams& pparams, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& scale); - IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale); + IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp); int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio); void getDimensions (int& w, int& h, double& scaleFac); static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode = false); - static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, int imageNum); + static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate); static Thumbnail* loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh, double wbEq, bool inspectorMode = false); static RawMetaDataLocation loadMetaDataFromRaw (const Glib::ustring& fname); @@ -88,7 +88,7 @@ public: void applyAutoExp (procparams::ProcParams& pparams); unsigned char* getGrayscaleHistEQ (int trim_width); - bool writeImage (const Glib::ustring& fname, int format); + bool writeImage (const Glib::ustring& fname); bool readImage (const Glib::ustring& fname); bool readData (const Glib::ustring& fname); diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index de02be130..bfb1b8797 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -140,7 +140,7 @@ void Thumbnail::_generateThumbnailImage () if ( tpp == nullptr ) { quick = false; - tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, tw, th, 1, pparams.wb.equal, TRUE, pparams.raw.bayersensor.imageNum); + tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, sensorType, tw, th, 1, pparams.wb.equal, TRUE); } cfs.sensortype = sensorType; @@ -612,7 +612,7 @@ rtengine::IImage8* Thumbnail::processThumbImage (const rtengine::procparams::Pro if ( cfs.thumbImgType == CacheImageData::QUICK_THUMBNAIL ) { // RAW internal thumbnail, no profile yet: just do some rotation etc. - image = tpp->quickProcessImage (pparams, h, rtengine::TI_Nearest, scale); + image = tpp->quickProcessImage (pparams, h, rtengine::TI_Nearest); } else { // Full thumbnail: apply profile // image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.getCamera(), cfs.focalLen, cfs.focalLen35mm, cfs.focusDist, cfs.shutter, cfs.fnumber, cfs.iso, cfs.expcomp, scale ); @@ -883,7 +883,7 @@ void Thumbnail::_saveThumbnail () } // save thumbnail image - tpp->writeImage (getCacheFileName ("images", ""), 1); + tpp->writeImage (getCacheFileName ("images", "")); // save aehistogram tpp->writeAEHistogram (getCacheFileName ("aehistograms", "")); From a75058546a1f6477548e215546ecd97f8c9e4ad9 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 14:36:56 +0200 Subject: [PATCH 15/72] Make compilation unit rtengine/color.cc -Wextra clean, #4155 --- rtengine/color.cc | 8 ++++---- rtengine/color.h | 6 +++--- rtengine/iccstore.cc | 4 ++-- rtengine/improcfun.cc | 10 +++------- rtengine/rawimagesource.cc | 8 ++++---- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/rtengine/color.cc b/rtengine/color.cc index 0957ac71e..edfe04528 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -1526,9 +1526,9 @@ void Color::interpolateRGBColor (const float balance, const float r1, const floa void Color::interpolateRGBColor (float realL, float iplow, float iphigh, int algm, const float balance, int twoc, int metchrom, - bool chr, bool lum, float chromat, float luma, const float r1, const float g1, const float b1, + float chromat, float luma, const float r1, const float g1, const float b1, const float xl, const float yl, const float zl, const float x2, const float y2, const float z2, - int toDo, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float &ro, float &go, float &bo) + 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 = 0.f, L2, LL, a_1 = 0.f, b_1 = 0.f, a_2 = 0.f, b_2 = 0.f, a_L, b_L; @@ -1620,7 +1620,7 @@ void Color::interpolateRGBColor (float realL, float iplow, float iphigh, int alg Color::xyz2rgb(X, Y, Z, ro, go, bo, rgb_xyz);// ro go bo in gamut } -void Color::calcGamma (double pwr, double ts, int mode, int imax, GammaValues &gamma) +void Color::calcGamma (double pwr, double ts, int mode, GammaValues &gamma) { //from Dcraw (D.Coffin) int i; @@ -2604,7 +2604,7 @@ void Color::gamutLchonly (float2 sincosval, float &Lprov1, float &Chprov1, const * const double wip[3][3]: matrix for working profile * bool multiThread : parallelize the loop */ -SSEFUNCTION void Color::LabGamutMunsell(float *labL, float *laba, float *labb, const int N, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const double wip[3][3], bool multiThread ) +SSEFUNCTION void Color::LabGamutMunsell(float *labL, float *laba, float *labb, const int N, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const double wip[3][3]) { #ifdef _DEBUG MyTime t1e, t2e; diff --git a/rtengine/color.h b/rtengine/color.h index 5889095ca..59e189810 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -733,7 +733,7 @@ public: * @param go green channel of output color [0 ; 65535] (return value) * @param bo blue channel of output color [0 ; 65535] (return value) */ - static void interpolateRGBColor (float realL, float iplow, float iphigh, int algm, const float balance, int twoc, int metchrom, bool chr, bool lum, float chromat, float luma, const float r1, const float g1, const float b1, const float xl, const float yl, const float zl, const float x2, const float y2, const float z2, int channels, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float &ro, float &go, float &bo); + static void interpolateRGBColor (float realL, float iplow, float iphigh, int algm, const float balance, int twoc, int metchrom, float chromat, float luma, const float r1, const float g1, const float b1, const float xl, const float yl, const float zl, const float x2, const float y2, const float z2, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float &ro, float &go, float &bo); /** @@ -898,7 +898,7 @@ public: * gamma4 used in ip2Lab2rgb [0 ; 1], usually near 0.03(return value) * gamma5 used in ip2Lab2rgb [0 ; 1], usually near 0.5 (return value) */ - static void calcGamma (double pwr, double ts, int mode, int imax, GammaValues &gamma); + static void calcGamma (double pwr, double ts, int mode, GammaValues &gamma); /** @@ -1310,7 +1310,7 @@ public: * @param wip matrix for working profile * @param multiThread whether to parallelize the loop or not */ - static void LabGamutMunsell (float *labL, float *laba, float *labb, const int N, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const double wip[3][3], bool multiThread ); + static void LabGamutMunsell (float *labL, float *laba, float *labb, const int N, bool corMunsell, bool lumaMuns, bool isHLEnabled, bool gamut, const double wip[3][3]); /* diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index dc4fe6ffb..891fb1600 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -809,8 +809,8 @@ void rtengine::ICCStore::getGammaArray(const procparams::ColorManagementParams & double ts = icm.slpos; double slope = icm.slpos == 0 ? eps : icm.slpos; - int mode = 0, imax = 0; - Color::calcGamma(pwr, ts, mode, imax, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2 + int mode = 0; + Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope : return parameters for LCMS2 ga[4] = g_a[3] * ts; //printf("g_a.gamma0=%f g_a.gamma1=%f g_a.gamma2=%f g_a.gamma3=%f g_a.gamma4=%f\n", g_a.gamma0,g_a.gamma1,g_a.gamma2,g_a.gamma3,g_a.gamma4); ga[0] = icm.gampos; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 9cc3e7d28..b0796702f 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5556,8 +5556,6 @@ void ImProcFunctions::labtoning (float r, float g, float b, float &ro, float &go float opacity2 = (1.f - min (s / satLimit, 1.f) * (1.f - satLimitOpacity)); //float ro, go, bo; - bool chr = true; - bool lum = false; float lm = l; float chromat, luma; @@ -5573,12 +5571,10 @@ void ImProcFunctions::labtoning (float r, float g, float b, float &ro, float &go luma = 1.f - SQR (SQR ((lm * 65535.f) / (cl2Toningcurve[ (lm) * 65535.f]))); //apply C2=f(L) acts only on 'b' } - int todo = 1; - if (algm == 1) { - Color::interpolateRGBColor (realL, iplow, iphigh, algm, opacity, twoc, metchrom, chr, lum, chromat, luma, r, g, b, xl, yl, zl, x2, y2, z2, todo, wp, wip, ro, go, bo); + Color::interpolateRGBColor (realL, iplow, iphigh, algm, opacity, twoc, metchrom, chromat, luma, r, g, b, xl, yl, zl, x2, y2, z2, wp, wip, ro, go, bo); } else { - Color::interpolateRGBColor (realL, iplow, iphigh, algm, opacity2, twoc, metchrom, chr, lum, chromat, luma, r, g, b, xl, yl, zl, x2, y2, z2, todo, wp, wip, ro, go, bo); + Color::interpolateRGBColor (realL, iplow, iphigh, algm, opacity2, twoc, metchrom, chromat, luma, r, g, b, xl, yl, zl, x2, y2, z2, wp, wip, ro, go, bo); } } @@ -5818,7 +5814,7 @@ SSEFUNCTION void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBu // only if user activate Lab adjustments if (autili || butili || ccutili || cclutili || chutili || lhutili || hhutili || clcutili || utili || chromaticity) { - Color::LabGamutMunsell (lold->L[i], lold->a[i], lold->b[i], W, /*corMunsell*/true, /*lumaMuns*/false, params->toneCurve.hrenabled, /*gamut*/true, wip, multiThread); + Color::LabGamutMunsell (lold->L[i], lold->a[i], lold->b[i], W, /*corMunsell*/true, /*lumaMuns*/false, params->toneCurve.hrenabled, /*gamut*/true, wip); } #ifdef __SSE2__ diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 3e234bef5..78fa1f829 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2117,8 +2117,8 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, const Reti std::swap(pwr, gamm); } - int mode = 0, imax = 0; - Color::calcGamma(pwr, ts, mode, imax, g_a); // call to calcGamma with selected gamma and slope + int mode = 0; + Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); double start; @@ -2384,13 +2384,13 @@ void RawImageSource::retinex(ColorManagementParams cmp, const RetinexParams &deh double gamm = deh.gam; double gamm2 = gamm; double ts = deh.slope; - int mode = 0, imax = 0; + int mode = 0; if(gamm2 < 1.) { std::swap(pwr, gamm); } - Color::calcGamma(pwr, ts, mode, imax, g_a); // call to calcGamma with selected gamma and slope + Color::calcGamma(pwr, ts, mode, g_a); // call to calcGamma with selected gamma and slope double mul = 1. + g_a[4]; double add; From 7c9d42827f314ba3dd5302380167d2c05ec2306e Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 14:49:45 +0200 Subject: [PATCH 16/72] Make compilation unit rtengine/colortemp.cc -Wextra clean, #4155 --- rtengine/colortemp.cc | 2 +- rtengine/colortemp.h | 2 +- rtengine/improcfun.cc | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index ea90f2735..08c58176c 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -1025,7 +1025,7 @@ void ColorTemp::cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, dou } -void ColorTemp::temp2mulxyz (double tem, double gree, const std::string &method, double &Xxyz, double &Zxyz) +void ColorTemp::temp2mulxyz (double tem, const std::string &method, double &Xxyz, double &Zxyz) { double xD, yD, x_D, y_D, interm; double x, y, z; diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index 2d346dd81..6f8ed089e 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -95,7 +95,7 @@ public: } void mul2temp (const double rmul, const double gmul, const double bmul, const double equal, double& temp, double& green) const; - static void temp2mulxyz (double tem, double gree, const std::string &method, double &Xxyz, double &Zxyz); + static void temp2mulxyz (double tem, const std::string &method, double &Xxyz, double &Zxyz); static void cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, double &CAM02BB01, double &CAM02BB02, double &CAM02BB10, double &CAM02BB11, double &CAM02BB12, double &CAM02BB20, double &CAM02BB21, double &CAM02BB22, double adap ); //static void CAT02 (Imagefloat* baseImg, const ProcParams* params); diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index b0796702f..3b5bd3275 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -275,9 +275,9 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L bool ciedata = params->colorappearance.datacie; - ColorTemp::temp2mulxyz (params->wb.temperature, params->wb.green, params->wb.method, Xw, Zw); //compute white Xw Yw Zw : white current WB - ColorTemp::temp2mulxyz (params->colorappearance.tempout, params->colorappearance.greenout, "Custom", Xwout, Zwout); - ColorTemp::temp2mulxyz (params->colorappearance.tempsc, params->colorappearance.greensc, "Custom", Xwsc, Zwsc); + ColorTemp::temp2mulxyz (params->wb.temperature, params->wb.method, Xw, Zw); //compute white Xw Yw Zw : white current WB + ColorTemp::temp2mulxyz (params->colorappearance.tempout, "Custom", Xwout, Zwout); + ColorTemp::temp2mulxyz (params->colorappearance.tempsc, "Custom", Xwsc, Zwsc); //viewing condition for surrsrc if (params->colorappearance.surrsrc == "Average") { @@ -1558,9 +1558,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw || (params->dirpyrequalizer.enabled && settings->autocielab) || (params->defringe.enabled && settings->autocielab) || (params->sharpenMicro.enabled && settings->autocielab) || (params->impulseDenoise.enabled && settings->autocielab) || (params->colorappearance.badpixsl > 0 && settings->autocielab)); - ColorTemp::temp2mulxyz (params->wb.temperature, params->wb.green, params->wb.method, Xw, Zw); //compute white Xw Yw Zw : white current WB - ColorTemp::temp2mulxyz (params->colorappearance.tempout, params->colorappearance.greenout, "Custom", Xwout, Zwout); - ColorTemp::temp2mulxyz (params->colorappearance.tempsc, params->colorappearance.greensc, "Custom", Xwsc, Zwsc); + ColorTemp::temp2mulxyz (params->wb.temperature, params->wb.method, Xw, Zw); //compute white Xw Yw Zw : white current WB + ColorTemp::temp2mulxyz (params->colorappearance.tempout, "Custom", Xwout, Zwout); + ColorTemp::temp2mulxyz (params->colorappearance.tempsc, "Custom", Xwsc, Zwsc); //viewing condition for surrsrc if (params->colorappearance.surrsrc == "Average") { From 8bd9f174dcdd2cc81283a1b0486073d1e27b5cbb Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 20:05:27 +0200 Subject: [PATCH 17/72] Reworked colortemp and pow_F defines --- rtengine/EdgePreservingDecomposition.cc | 1 - rtengine/ciecam02.cc | 1 - rtengine/color.cc | 2 - rtengine/colortemp.cc | 355 ++++++------------------ rtengine/colortemp.h | 23 +- rtengine/opthelper.h | 2 + 6 files changed, 99 insertions(+), 285 deletions(-) diff --git a/rtengine/EdgePreservingDecomposition.cc b/rtengine/EdgePreservingDecomposition.cc index 1424af1b3..1c2d0219f 100644 --- a/rtengine/EdgePreservingDecomposition.cc +++ b/rtengine/EdgePreservingDecomposition.cc @@ -6,7 +6,6 @@ #endif #include "sleef.c" #include "opthelper.h" -#define pow_F(a,b) (xexpf(b*xlogf(a))) #define DIAGONALS 5 #define DIAGONALSP1 6 diff --git a/rtengine/ciecam02.cc b/rtengine/ciecam02.cc index 7b5ef63fe..77c57048a 100644 --- a/rtengine/ciecam02.cc +++ b/rtengine/ciecam02.cc @@ -30,7 +30,6 @@ #undef CLIPD #define CLIPD(a) ((a)>0.0?((a)<1.0?(a):1.0):0.0) #define MAXR(a,b) ((a) > (b) ? (a) : (b)) -#define pow_F(a,b) (xexpf(b*xlogf(a))) namespace rtengine { diff --git a/rtengine/color.cc b/rtengine/color.cc index edfe04528..7964cc472 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -25,8 +25,6 @@ #include "opthelper.h" #include "iccstore.h" -#define pow_F(a,b) (xexpf(b*xlogf(a))) - using namespace std; namespace rtengine diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index 08c58176c..ab318aa73 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -24,11 +24,6 @@ #include "sleef.c" #include "settings.h" -#undef CLIPD -#define CLIPD(a) ((a)>0.0?((a)<1.0?(a):1.0):0.0) -#define CLIPQQ(a) ((a)>0?((a)<250?(a):250):0) -#define MAXR(a,b) ((a) > (b) ? (a) : (b)) - namespace rtengine { @@ -70,48 +65,22 @@ static const double cie_colour_match_jd[97][3] = {//350nm to 830nm 5 nm J.Desm {0.000001251141, 0.00000045181, 0.000000} }; -ColorTemp::ColorTemp (double t, double g, double e, const Glib::ustring &m) : temp(t), green(g), equal(e), method(m) +ColorTemp::ColorTemp (double t, double g, double e, const std::string &m) : temp(t), green(g), equal(e), method(m) { - clip (temp, green, equal); } void ColorTemp::clip (double &temp, double &green) { - - if (temp < MINTEMP) { - temp = MINTEMP; - } else if (temp > MAXTEMP) { - temp = MAXTEMP; - } - - if (green < MINGREEN) { - green = MINGREEN; - } else if (green > MAXGREEN) { - green = MAXGREEN; - } + temp = rtengine::LIM(temp, MINTEMP, MAXTEMP); + green = rtengine::LIM(green, MINGREEN, MAXGREEN); } void ColorTemp::clip (double &temp, double &green, double &equal) { - - if (temp < MINTEMP) { - temp = MINTEMP; - } else if (temp > MAXTEMP) { - temp = MAXTEMP; - } - - if (green < MINGREEN) { - green = MINGREEN; - } else if (green > MAXGREEN) { - green = MAXGREEN; - } - - if(equal < MINEQUAL) { - equal = MINEQUAL; - } else if(equal > MAXEQUAL) { - equal = MAXEQUAL; - } + temp = rtengine::LIM(temp, MINTEMP, MAXTEMP); + green = rtengine::LIM(green, MINGREEN, MAXGREEN); + equal = rtengine::LIM(equal, MINEQUAL, MAXEQUAL); } ColorTemp::ColorTemp (double mulr, double mulg, double mulb, double e) : equal(e), method("Custom") @@ -122,7 +91,7 @@ ColorTemp::ColorTemp (double mulr, double mulg, double mulb, double e) : equal(e void ColorTemp::mul2temp (const double rmul, const double gmul, const double bmul, const double equal, double& temp, double& green) const { - double maxtemp = double(MAXTEMP), mintemp = double(MINTEMP); + double maxtemp = MAXTEMP, mintemp = MINTEMP; double tmpr, tmpg, tmpb; temp = (maxtemp + mintemp) / 2; @@ -354,6 +323,37 @@ const double ColorTemp::Flash6500_spect[97] = { 55.72, 51.97, 54.72, 57.46, 58.89, 60.33 }; +const std::map ColorTemp::spectMap = { + {"Daylight", Daylight5300_spect}, + {"Cloudy", Cloudy6200_spect}, + {"Shade", Shade7600_spect}, + {"Tungsten", A2856_spect}, + {"Fluo F1", FluoF1_spect}, + {"Fluo F2", FluoF2_spect}, + {"Fluo F3", FluoF3_spect}, + {"Fluo F4", FluoF4_spect}, + {"Fluo F5", FluoF5_spect}, + {"Fluo F6", FluoF6_spect}, + {"Fluo F7", FluoF7_spect}, + {"Fluo F8", FluoF8_spect}, + {"Fluo F9", FluoF9_spect}, + {"Fluo F10", FluoF10_spect}, + {"Fluo F11", FluoF11_spect}, + {"Fluo F12", FluoF12_spect}, + {"HMI Lamp", HMI_spect}, + {"GTI Lamp", GTI_spect}, + {"JudgeIII Lamp", JudgeIII_spect}, + {"Solux Lamp 3500K", Solux3500_spect}, + {"Solux Lamp 4100K", Solux4100_spect}, + {"Solux Lamp 4700K", Solux4700_spect}, + {"NG Solux Lamp 4700K", NG_Solux4700_spect}, + {"LED LSI Lumelex 2040", NG_LEDLSI2040_spect}, + {"LED CRS SP12 WWMR16", NG_CRSSP12WWMR16_spect}, + {"Flash 5500K", Flash5500_spect}, + {"Flash 6000K", Flash6000_spect}, + {"Flash 6500K", Flash6500_spect} + }; + // Data for Color ==> CRI (Color Rendering Index and Palette // actually 20 color that must be good enough for CRI @@ -844,10 +844,7 @@ const double ColorTemp::ColabSky42_0_m24_spect[97] = { * Gunter Wyszecki and W. S. Stiles, John Wiley & Sons, 1982, pp. 227, 228. */ //adaptation to RT by J.Desmis -#include -/* LERP(a,b,c) = linear interpolation macro, is 'a' when c == 0.0 and 'b' when c == 1.0 */ -#define LERP(a,b,c) (((b) - (a)) * (c) + (a)) int ColorTemp::XYZtoCorColorTemp(double x0, double y0, double z0, double &temp) const { @@ -922,13 +919,13 @@ int ColorTemp::XYZtoCorColorTemp(double x0, double y0, double z0, double &temp) } if (i == 31) { - return(-1); /* bad XYZ input, color temp would be less than minimum of 1666.7 degrees, or too far towards blue */ + return -1; /* bad XYZ input, color temp would be less than minimum of 1666.7 degrees, or too far towards blue */ } di = di / sqrt(1.0 + uvt[i ].t * uvt[i ].t); dm = dm / sqrt(1.0 + uvt[i - 1].t * uvt[i - 1].t); p = dm / (dm - di); /* p = interpolation parameter, 0.0 : i-1, 1.0 : i */ - p = 1.0 / (LERP(rt[i - 1], rt[i], p)); + p = 1.0 / rtengine::intp(p, rt[i], rt[i - 1]); temp = p; return 0; /* success */ } @@ -1025,192 +1022,15 @@ void ColorTemp::cieCAT02(double Xw, double Yw, double Zw, double &CAM02BB00, dou } -void ColorTemp::temp2mulxyz (double tem, const std::string &method, double &Xxyz, double &Zxyz) +void ColorTemp::temp2mulxyz (double temp, const std::string &method, double &Xxyz, double &Zxyz) { - double xD, yD, x_D, y_D, interm; double x, y, z; - if (method == "Daylight" ) { - spectrum_to_xyz_preset(Daylight5300_spect, x, y, z); - } else if(method == "Cloudy" ) { - spectrum_to_xyz_preset(Cloudy6200_spect, x, y, z); - } else if(method == "Shade" ) { - spectrum_to_xyz_preset(Shade7600_spect, x, y, z); - } else if(method == "Tungsten" ) { - spectrum_to_xyz_preset(A2856_spect, x, y, z); - } else if(method == "Fluo F1" ) { - spectrum_to_xyz_preset(FluoF1_spect, x, y, z); - } else if(method == "Fluo F2" ) { - spectrum_to_xyz_preset(FluoF2_spect, x, y, z); - } else if(method == "Fluo F3" ) { - spectrum_to_xyz_preset(FluoF3_spect, x, y, z); - } else if(method == "Fluo F4" ) { - spectrum_to_xyz_preset(FluoF4_spect, x, y, z); - } else if(method == "Fluo F5" ) { - spectrum_to_xyz_preset(FluoF5_spect, x, y, z); - } else if(method == "Fluo F6" ) { - spectrum_to_xyz_preset(FluoF6_spect, x, y, z); - } else if(method == "Fluo F7" ) { - spectrum_to_xyz_preset(FluoF7_spect, x, y, z); - } else if(method == "Fluo F8" ) { - spectrum_to_xyz_preset(FluoF8_spect, x, y, z); - } else if(method == "Fluo F9" ) { - spectrum_to_xyz_preset(FluoF9_spect, x, y, z); - } else if(method == "Fluo F10" ) { - spectrum_to_xyz_preset(FluoF10_spect, x, y, z); - } else if(method == "Fluo F11" ) { - spectrum_to_xyz_preset(FluoF11_spect, x, y, z); - } else if(method == "Fluo F12" ) { - spectrum_to_xyz_preset(FluoF12_spect, x, y, z); - } else if(method == "HMI Lamp" ) { - spectrum_to_xyz_preset(HMI_spect, x, y, z); - } else if(method == "GTI Lamp" ) { - spectrum_to_xyz_preset(GTI_spect, x, y, z); - } else if(method == "JudgeIII Lamp" ) { - spectrum_to_xyz_preset(JudgeIII_spect, x, y, z); - } else if(method == "Solux Lamp 3500K" ) { - spectrum_to_xyz_preset(Solux3500_spect, x, y, z); - } else if(method == "Solux Lamp 4100K" ) { - spectrum_to_xyz_preset(Solux4100_spect, x, y, z); - } else if(method == "Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(Solux4700_spect, x, y, z); - } else if(method == "NG Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(NG_Solux4700_spect, x, y, z); - } else if(method == "LED LSI Lumelex 2040") { - spectrum_to_xyz_preset(NG_LEDLSI2040_spect, x, y, z); - } else if(method == "LED CRS SP12 WWMR16" ) { - spectrum_to_xyz_preset(NG_CRSSP12WWMR16_spect, x, y, z); - } else if(method == "Flash 5500K" ) { - spectrum_to_xyz_preset(Flash5500_spect, x, y, z); - } else if(method == "Flash 6000K" ) { - spectrum_to_xyz_preset(Flash6000_spect, x, y, z); - } else if(method == "Flash 6500K" ) { - spectrum_to_xyz_preset(Flash6500_spect, x, y, z); - } else { - // otherwise we use the Temp+Green generic solution - if (tem <= INITIALBLACKBODY) { - // if temperature is between 2000K and 4000K we use blackbody, because there will be no Daylight reference below 4000K... - // of course, the previous version of RT used the "magical" but wrong formula of U.Fuchs (Ufraw). - spectrum_to_xyz_blackbody(tem, x, y, z); - } else { - // from 4000K up to 25000K: using the D illuminant (daylight) which is standard - double m1, m2; - - if (tem <= 7000) { - x_D = -4.6070e9 / (tem * tem * tem) + 2.9678e6 / (tem * tem) + 0.09911e3 / tem + 0.244063; - } else if (tem <= 25000) { - x_D = -2.0064e9 / (tem * tem * tem) + 1.9018e6 / (tem * tem) + 0.24748e3 / tem + 0.237040; - } else /*if (tem > 25000)*/ { - x_D = -2.0064e9 / (tem * tem * tem) + 1.9018e6 / (tem * tem) + 0.24748e3 / tem + 0.237040 - ((tem - 25000) / 25000) * 0.025; //Jacques empirical adjustemnt for very high temp (underwater !) - } - - y_D = -3.0 * x_D * x_D + 2.87 * x_D - 0.275; - //calculate D -daylight in function of s0, s1, s2 and temp ==> x_D y_D - //S(lamda)=So(lambda)+m1*s1(lambda)+m2*s2(lambda) - interm = (0.0241 + 0.2562 * x_D - 0.734 * y_D); - m1 = (-1.3515 - 1.7703 * x_D + 5.9114 * y_D) / interm; - m2 = (0.03 - 31.4424 * x_D + 30.0717 * y_D) / interm; - spectrum_to_xyz_daylight(m1, m2, x, y, z); - xD = x; - yD = y; - } - - } - - xD = x; - yD = y; - - double X = xD / yD; - double Z = (1.0 - xD - yD) / yD; - Xxyz = X; - Zxyz = Z; - //printf("Xxyz=%f Zxyz=%f\n",Xxyz,Zxyz); -} - -void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, double& gmul, double& bmul) const -{ - - clip (temp, green, equal); - - //printf("temp=%d green=%.3f equal=%.3f\n", (int)temp, (float) green, (float) equal); - - //variables for CRI and display Lab, and palette - double xD, yD, x_D, y_D, interm; - double m1, m2; - - double x, y, z; - double Xchk[50], Ychk[50], Zchk[50]; //50 : I think it's a good limit for number of color : for CRI and Palette - double Xcam02[50], Ycam02[50], Zcam02[50]; - - double XchkLamp[50], YchkLamp[50], ZchkLamp[50]; - double Xcam02Lamp[50], Ycam02Lamp[50], Zcam02Lamp[50]; - const double epsilon = 0.008856; //Lab - const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculate with this tool : spect 5nm - double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02 - - double xr[50], yr[50], zr[50]; - double fx[50], fy[50], fz[50]; - -// bool palette = false; - // double tempalet; // correlated temperature - // We first test for specially handled methods - if (method == "Daylight" ) { - spectrum_to_xyz_preset(Daylight5300_spect, x, y, z); - } else if(method == "Cloudy" ) { - spectrum_to_xyz_preset(Cloudy6200_spect, x, y, z); - } else if(method == "Shade" ) { - spectrum_to_xyz_preset(Shade7600_spect, x, y, z); - } else if(method == "Tungsten" ) { - spectrum_to_xyz_preset(A2856_spect, x, y, z); - } else if(method == "Fluo F1" ) { - spectrum_to_xyz_preset(FluoF1_spect, x, y, z); - } else if(method == "Fluo F2" ) { - spectrum_to_xyz_preset(FluoF2_spect, x, y, z); - } else if(method == "Fluo F3" ) { - spectrum_to_xyz_preset(FluoF3_spect, x, y, z); - } else if(method == "Fluo F4" ) { - spectrum_to_xyz_preset(FluoF4_spect, x, y, z); - } else if(method == "Fluo F5" ) { - spectrum_to_xyz_preset(FluoF5_spect, x, y, z); - } else if(method == "Fluo F6" ) { - spectrum_to_xyz_preset(FluoF6_spect, x, y, z); - } else if(method == "Fluo F7" ) { - spectrum_to_xyz_preset(FluoF7_spect, x, y, z); - } else if(method == "Fluo F8" ) { - spectrum_to_xyz_preset(FluoF8_spect, x, y, z); - } else if(method == "Fluo F9" ) { - spectrum_to_xyz_preset(FluoF9_spect, x, y, z); - } else if(method == "Fluo F10" ) { - spectrum_to_xyz_preset(FluoF10_spect, x, y, z); - } else if(method == "Fluo F11" ) { - spectrum_to_xyz_preset(FluoF11_spect, x, y, z); - } else if(method == "Fluo F12" ) { - spectrum_to_xyz_preset(FluoF12_spect, x, y, z); - } else if(method == "HMI Lamp" ) { - spectrum_to_xyz_preset(HMI_spect, x, y, z); - } else if(method == "GTI Lamp" ) { - spectrum_to_xyz_preset(GTI_spect, x, y, z); - } else if(method == "JudgeIII Lamp" ) { - spectrum_to_xyz_preset(JudgeIII_spect, x, y, z); - } else if(method == "Solux Lamp 3500K" ) { - spectrum_to_xyz_preset(Solux3500_spect, x, y, z); - } else if(method == "Solux Lamp 4100K" ) { - spectrum_to_xyz_preset(Solux4100_spect, x, y, z); - } else if(method == "Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(Solux4700_spect, x, y, z); - } else if(method == "NG Solux Lamp 4700K" ) { - spectrum_to_xyz_preset(NG_Solux4700_spect, x, y, z); - } else if(method == "LED LSI Lumelex 2040") { - spectrum_to_xyz_preset(NG_LEDLSI2040_spect, x, y, z); - } else if(method == "LED CRS SP12 WWMR16" ) { - spectrum_to_xyz_preset(NG_CRSSP12WWMR16_spect, x, y, z); - } else if(method == "Flash 5500K" ) { - spectrum_to_xyz_preset(Flash5500_spect, x, y, z); - } else if(method == "Flash 6000K" ) { - spectrum_to_xyz_preset(Flash6000_spect, x, y, z); - } else if(method == "Flash 6500K" ) { - spectrum_to_xyz_preset(Flash6500_spect, x, y, z); + const auto iterator = spectMap.find(method); + + if (iterator != spectMap.end()) { + spectrum_to_xyz_preset(iterator->second, x, y, z); } else { // otherwise we use the Temp+Green generic solution if (temp <= INITIALBLACKBODY) { @@ -1219,48 +1039,42 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, spectrum_to_xyz_blackbody(temp, x, y, z); } else { // from 4000K up to 25000K: using the D illuminant (daylight) which is standard + double x_D, y_D; if (temp <= 7000) { x_D = -4.6070e9 / (temp * temp * temp) + 2.9678e6 / (temp * temp) + 0.09911e3 / temp + 0.244063; } else if (temp <= 25000) { x_D = -2.0064e9 / (temp * temp * temp) + 1.9018e6 / (temp * temp) + 0.24748e3 / temp + 0.237040; - } else /*if (temp > 25000)*/ { // above 25000 it's unknown..then I have modified to adjust for underwater - x_D = -2.0064e9 / (temp * temp * temp) + 1.9018e6 / (temp * temp) + 0.24748e3 / temp + 0.237040 - ((temp - 25000) / 25000) * 0.025; //Jacques empirical adjustemnt for very high temp (underwater !) + } else /*if (temp > 25000)*/ { + x_D = -2.0064e9 / (temp * temp * temp) + 1.9018e6 / (temp * temp) + 0.24748e3 / temp + 0.237040 - ((temp - 25000) / 25000) * 0.025; //Jacques empirical adjustment for very high temp (underwater !) } - y_D = (-3.0 * x_D * x_D + 2.87 * x_D - 0.275); //modify blue / red action + y_D = -3.0 * x_D * x_D + 2.87 * x_D - 0.275; //modify blue / red action //calculate D -daylight in function of s0, s1, s2 and temp ==> x_D y_D //S(lamda)=So(lambda)+m1*s1(lambda)+m2*s2(lambda) - interm = (0.0241 + 0.2562 * x_D - 0.734 * y_D); - m1 = (-1.3515 - 1.7703 * x_D + 5.9114 * y_D) / interm; - m2 = (0.03 - 31.4424 * x_D + 30.0717 * y_D) / interm; + double interm = 0.0241 + 0.2562 * x_D - 0.734 * y_D; + double m1 = (-1.3515 - 1.7703 * x_D + 5.9114 * y_D) / interm; + double m2 = (0.03 - 31.4424 * x_D + 30.0717 * y_D) / interm; spectrum_to_xyz_daylight(m1, m2, x, y, z); - xD = x; - yD = y; } } - xD = x; - yD = y; + Xxyz = x / y; + Zxyz = (1.0 - x - y) / y; +} + +void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, double& gmul, double& bmul) const +{ + clip(temp, green, equal); + double Xwb, Zwb; + temp2mulxyz(temp, method, Xwb, Zwb); + float adj = 1.f; if(equal < 0.9999 || equal > 1.0001 ) { adj = (100.f + ( 1000.f - (1000.f * (float)equal) ) / 20.f) / 100.f; } - //printf("adj=%f\n",adj); - double Xwb = xD / yD; - double Ywb = 1.0; - double Zwb = (1.0 - xD - yD) / yD; - - if (settings->verbose) { - // double u=4*xD/(-2*xD+12*yD+3); - // double v=6*yD/(-2*xD+12*yD+3); - // printf("xD=%f yD=%f u=%f v=%f\n",xD,yD,u,v); - if(settings->CRI_color != 0) { - printf("xD=%f yD=%f === Xwb=%f Ywb=%f Zwb=%f\n", xD, yD, Xwb, Ywb, Zwb); - } - } /*if (isRaw) { rmul = sRGB_xyz[0][0]*X + sRGB_xyz[0][1]*Y + sRGB_xyz[0][2]*Z; @@ -1268,36 +1082,41 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, bmul = sRGB_xyz[2][0]*X + sRGB_xyz[2][1]*Y + sRGB_xyz[2][2]*Z; } else {*/ //recalculate channels multipliers with new values of XYZ tue to whitebalance - rmul = sRGBd65_xyz[0][0] * Xwb * adj + sRGBd65_xyz[0][1] * Ywb + sRGBd65_xyz[0][2] * Zwb / adj; // Jacques' empirical modification 5/2013 - gmul = sRGBd65_xyz[1][0] * Xwb + sRGBd65_xyz[1][1] * Ywb + sRGBd65_xyz[1][2] * Zwb; - bmul = sRGBd65_xyz[2][0] * Xwb * adj + sRGBd65_xyz[2][1] * Ywb + sRGBd65_xyz[2][2] * Zwb / adj; + rmul = sRGBd65_xyz[0][0] * Xwb * adj + sRGBd65_xyz[0][1] + sRGBd65_xyz[0][2] * Zwb / adj; // Jacques' empirical modification 5/2013 + gmul = sRGBd65_xyz[1][0] * Xwb + sRGBd65_xyz[1][1] + sRGBd65_xyz[1][2] * Zwb; + bmul = sRGBd65_xyz[2][0] * Xwb * adj + sRGBd65_xyz[2][1] + sRGBd65_xyz[2][2] * Zwb / adj; //}; gmul /= green; //printf("rmul=%f gmul=%f bmul=%f\n",rmul, gmul, bmul); - double max = rmul; - - if (gmul > max) { - max = gmul; - } - - if (bmul > max) { - max = bmul; - } + double max = rtengine::max(rmul, gmul, bmul); rmul /= max; gmul /= max; bmul /= max; - // begin CRI_RT : color rendering index RT - adaptation of CRI by J.Desmis - // CRI = 100 for Blackbody and Daylight - // calculate from spectral data values X, Y, Z , for color of colorchecker24 , SG, DC, JDC_468 - //only for lamp different of tungstene - //first calcul with illuminant (choice) - // and calcul with : blackbody at equivalent temp of lamp - if(settings->CRI_color != 0) //activate if CRi_color !=0 + if(settings->CRI_color != 0) { //activate if CRi_color !=0 + // begin CRI_RT : color rendering index RT - adaptation of CRI by J.Desmis + // CRI = 100 for Blackbody and Daylight + // calculate from spectral data values X, Y, Z , for color of colorchecker24 , SG, DC, JDC_468 + // only for lamp different of tungstene + // first calcul with illuminant (choice) + // and calcul with : blackbody at equivalent temp of lamp // CRI_color-1 = dispaly Lab values of color CRI_color -1 - { + const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculate with this tool : spect 5nm + double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02 + double Xchk[50], Ychk[50], Zchk[50]; //50 : I think it's a good limit for number of color : for CRI and Palette + double Xcam02[50], Ycam02[50], Zcam02[50]; + + double XchkLamp[50], YchkLamp[50], ZchkLamp[50]; + double Xcam02Lamp[50], Ycam02Lamp[50], Zcam02Lamp[50]; + const double epsilon = 0.008856; //Lab + + double xr[50], yr[50], zr[50]; + double fx[50], fy[50], fz[50]; + double x, y, z; + double Ywb = 1.0; + int illum; int numero_color = settings->CRI_color - 1; diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index 6f8ed089e..d96e6f5ce 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -19,22 +19,19 @@ #ifndef _COLORTEMP_ #define _COLORTEMP_ -#include #include - -#define pow_F(a,b) (xexpf(b*xlogf(a))) +#include namespace rtengine { -#define MINTEMP 1500 -#define MAXTEMP 60000 -#define MINGREEN 0.02 -#define MAXGREEN 10.0 -#define MINEQUAL 0.8 -#define MAXEQUAL 1.5 - -#define INITIALBLACKBODY 4000 +constexpr double MINTEMP = 1500.0; +constexpr double MAXTEMP = 60000.0; +constexpr double MINGREEN = 0.02; +constexpr double MAXGREEN = 10.0; +constexpr double MINEQUAL = 0.8; +constexpr double MAXEQUAL = 1.5; +constexpr double INITIALBLACKBODY = 4000.0; class ColorTemp @@ -49,12 +46,12 @@ private: static void clip (double &temp, double &green, double &equal); int XYZtoCorColorTemp(double x0, double y0 , double z0, double &temp) const; void temp2mul (double temp, double green, double equal, double& rmul, double& gmul, double& bmul) const; - + const static std::map spectMap; public: ColorTemp () : temp(-1.), green(-1.), equal (1.), method("Custom") {} explicit ColorTemp (double e) : temp(-1.), green(-1.), equal (e), method("Custom") {} - ColorTemp (double t, double g, double e, const Glib::ustring &m); + ColorTemp (double t, double g, double e, const std::string &m); ColorTemp (double mulr, double mulg, double mulb, double e); void update (const double rmul, const double gmul, const double bmul, const double equal, const double tempBias=0.0) diff --git a/rtengine/opthelper.h b/rtengine/opthelper.h index 5e9b97931..d6af9a745 100644 --- a/rtengine/opthelper.h +++ b/rtengine/opthelper.h @@ -22,6 +22,8 @@ #ifndef OPTHELPER_H #define OPTHELPER_H + #define pow_F(a,b) (xexpf(b*xlogf(a))) + #ifdef __SSE2__ #include "sleefsseavx.c" #ifdef __GNUC__ From 8de8775264791fc7ccf88db7a04a1344bfd05955 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 21:06:24 +0200 Subject: [PATCH 18/72] eliminate AlignedBufferMP, also eliminate some unsused functions in boxblur.h --- rtengine/FTblockDN.cc | 1 - rtengine/alignedbuffer.h | 52 ----- rtengine/boxblur.h | 494 --------------------------------------- rtengine/iimage.h | 1 + 4 files changed, 1 insertion(+), 547 deletions(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 2344c9f30..bf79f5445 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -3261,7 +3261,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat realblue = 0.001f; } - //TODO: implement using AlignedBufferMP //fill tile from image; convert RGB to "luma/chroma" if (isRAW) {//image is raw; use channel differences for chroma channels diff --git a/rtengine/alignedbuffer.h b/rtengine/alignedbuffer.h index 44fd43e81..dd9d7b278 100644 --- a/rtengine/alignedbuffer.h +++ b/rtengine/alignedbuffer.h @@ -18,12 +18,8 @@ */ #ifndef _ALIGNEDBUFFER_ #define _ALIGNEDBUFFER_ -#include #include -#include #include -#include -#include "../rtgui/threadutils.h" // Aligned buffer that should be faster template class AlignedBuffer @@ -111,7 +107,6 @@ public: } if (real) { - //data = (T*)( (uintptr_t)real + (alignment-((uintptr_t)real)%alignment) ); data = (T*)( ( uintptr_t(real) + uintptr_t(alignment - 1)) / alignment * alignment); inUse = true; } else { @@ -142,51 +137,4 @@ public: } }; -// Multi processor version, use with OpenMP -template class AlignedBufferMP -{ -private: - MyMutex mtx; - std::vector*> buffers; - size_t size; - -public: - explicit AlignedBufferMP(size_t sizeP) - { - size = sizeP; - } - - ~AlignedBufferMP() - { - for (size_t i = 0; i < buffers.size(); i++) { - delete buffers[i]; - } - } - - AlignedBuffer* acquire() - { - MyMutex::MyLock lock(mtx); - - // Find available buffer - for (size_t i = 0; i < buffers.size(); i++) { - if (!buffers[i]->inUse) { - buffers[i]->inUse = true; - return buffers[i]; - } - } - - // Add new buffer if nothing is free - AlignedBuffer* buffer = new AlignedBuffer(size); - buffers.push_back(buffer); - - return buffer; - } - - void release(AlignedBuffer* buffer) - { - MyMutex::MyLock lock(mtx); - - buffer->inUse = false; - } -}; #endif diff --git a/rtengine/boxblur.h b/rtengine/boxblur.h index 0fa31fc2a..5475e8ffc 100644 --- a/rtengine/boxblur.h +++ b/rtengine/boxblur.h @@ -34,8 +34,6 @@ namespace rtengine template void boxblur (T** src, A** dst, int radx, int rady, int W, int H) { - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //box blur image; box range = (radx,rady) AlignedBuffer* buffer = new AlignedBuffer (W * H); @@ -125,8 +123,6 @@ template void boxblur (T** src, A** dst, int radx, int rady, i template SSEFUNCTION void boxblur (T** src, A** dst, T* buffer, int radx, int rady, int W, int H) { - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //box blur image; box range = (radx,rady) float* temp = buffer; @@ -313,13 +309,8 @@ template SSEFUNCTION void boxblur (T** src, A** dst, T* buffer } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - template SSEFUNCTION void boxblur (T* src, A* dst, A* buffer, int radx, int rady, int W, int H) { - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //box blur image; box range = (radx,rady) i.e. box size is (2*radx+1)x(2*rady+1) float* temp = buffer; @@ -505,489 +496,6 @@ template SSEFUNCTION void boxblur (T* src, A* dst, A* buffer, } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -template void boxvar (T* src, T* dst, int radx, int rady, int W, int H) -{ - - AlignedBuffer buffer1(W * H); - AlignedBuffer buffer2(W * H); - float* tempave = buffer1.data; - float* tempsqave = buffer2.data; - - AlignedBufferMP buffer3(H); - - //float image_ave = 0; - - //box blur image channel; box size = 2*box+1 - //horizontal blur -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - int len = radx + 1; - tempave[row * W + 0] = src[row * W + 0] / len; - tempsqave[row * W + 0] = SQR(src[row * W + 0]) / len; - - for (int j = 1; j <= radx; j++) { - tempave[row * W + 0] += src[row * W + j] / len; - tempsqave[row * W + 0] += SQR(src[row * W + j]) / len; - } - - for (int col = 1; col <= radx; col++) { - tempave[row * W + col] = (tempave[row * W + col - 1] * len + src[row * W + col + radx]) / (len + 1); - tempsqave[row * W + col] = (tempsqave[row * W + col - 1] * len + SQR(src[row * W + col + radx])) / (len + 1); - len ++; - } - - for (int col = radx + 1; col < W - radx; col++) { - tempave[row * W + col] = tempave[row * W + col - 1] + (src[row * W + col + radx] - src[row * W + col - radx - 1]) / len; - tempsqave[row * W + col] = tempsqave[row * W + col - 1] + (SQR(src[row * W + col + radx]) - SQR(src[row * W + col - radx - 1])) / len; - } - - for (int col = W - radx; col < W; col++) { - tempave[row * W + col] = (tempave[row * W + col - 1] * len - src[row * W + col - radx - 1]) / (len - 1); - tempsqave[row * W + col] = (tempsqave[row * W + col - 1] * len - SQR(src[row * W + col - radx - 1])) / (len - 1); - len --; - } - } - - //vertical blur -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int col = 0; col < W; col++) { - AlignedBuffer* pBuf3 = buffer3.acquire(); - T* tempave2 = (T*)pBuf3->data; - - int len = rady + 1; - tempave2[0] = tempave[0 * W + col] / len; - dst[0 * W + col] = tempsqave[0 * W + col] / len; - - for (int i = 1; i <= rady; i++) { - tempave2[0] += tempave[i * W + col] / len; - dst[0 * W + col] += tempsqave[i * W + col] / len; - } - - for (int row = 1; row <= rady; row++) { - tempave2[row] = (tempave2[(row - 1)] * len + tempave[(row + rady) * W + col]) / (len + 1); - dst[row * W + col] = (dst[(row - 1) * W + col] * len + tempsqave[(row + rady) * W + col]) / (len + 1); - len ++; - } - - for (int row = rady + 1; row < H - rady; row++) { - tempave2[row] = tempave2[(row - 1)] + (tempave[(row + rady) * W + col] - tempave[(row - rady - 1) * W + col]) / len; - dst[row * W + col] = dst[(row - 1) * W + col] + (tempsqave[(row + rady) * W + col] - tempsqave[(row - rady - 1) * W + col]) / len; - } - - for (int row = H - rady; row < H; row++) { - tempave2[row] = (tempave2[(row - 1)] * len - tempave[(row - rady - 1) * W + col]) / (len - 1); - dst[row * W + col] = (dst[(row - 1) * W + col] * len - tempsqave[(row - rady - 1) * W + col]) / (len - 1); - len --; - } - - //now finish off - for (int row = 0; row < H; row++) { - dst[row * W + col] = fabs(dst[row * W + col] - SQR(tempave2[row])); - //image_ave += src[row*W+col]; - } - - buffer3.release(pBuf3); - } - - //image_ave /= (W*H); -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -template void boxdev (T* src, T* dst, int radx, int rady, int W, int H) -{ - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //box blur image; box range = (radx,rady) i.e. box size is (2*radx+1)x(2*rady+1) - - AlignedBuffer* buffer1 = new AlignedBuffer (W * H); - float* temp = buffer1->data; - - AlignedBuffer* buffer2 = new AlignedBuffer (W * H); - float* tempave = buffer2->data; - - if (radx == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) - for (int col = 0; col < W; col++) { - temp[row * W + col] = src[row * W + col]; - } - } else { - //horizontal blur -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - int len = radx + 1; - temp[row * W + 0] = (float)src[row * W + 0] / len; - - for (int j = 1; j <= radx; j++) { - temp[row * W + 0] += (float)src[row * W + j] / len; - } - - for (int col = 1; col <= radx; col++) { - temp[row * W + col] = (temp[row * W + col - 1] * len + src[row * W + col + radx]) / (len + 1); - len ++; - } - - for (int col = radx + 1; col < W - radx; col++) { - temp[row * W + col] = temp[row * W + col - 1] + ((float)(src[row * W + col + radx] - src[row * W + col - radx - 1])) / len; - } - - for (int col = W - radx; col < W; col++) { - temp[row * W + col] = (temp[row * W + col - 1] * len - src[row * W + col - radx - 1]) / (len - 1); - len --; - } - } - } - - if (rady == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - for (int col = 0; col < W; col++) { - tempave[row * W + col] = temp[row * W + col]; - } - } - } else { - //vertical blur -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int col = 0; col < W; col++) { - int len = rady + 1; - tempave[0 * W + col] = temp[0 * W + col] / len; - - for (int i = 1; i <= rady; i++) { - tempave[0 * W + col] += temp[i * W + col] / len; - } - - for (int row = 1; row <= rady; row++) { - tempave[row * W + col] = (tempave[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1); - len ++; - } - - for (int row = rady + 1; row < H - rady; row++) { - tempave[row * W + col] = tempave[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len; - } - - for (int row = H - rady; row < H; row++) { - tempave[row * W + col] = (tempave[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1); - len --; - } - } - } - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //box blur absolute deviation - - - if (radx == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) - for (int col = 0; col < W; col++) { - temp[row * W + col] = fabs(src[row * W + col] - tempave[row * W + col]); - } - } else { - //horizontal blur -//OpenMP here -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - int len = radx + 1; - temp[row * W + 0] = fabs(src[row * W + 0] - tempave[row * W + 0]) / len; - - for (int j = 1; j <= radx; j++) { - temp[row * W + 0] += fabs(src[row * W + j] - tempave[row * W + j]) / len; - } - - for (int col = 1; col <= radx; col++) { - temp[row * W + col] = (temp[row * W + col - 1] * len + fabs(src[row * W + col + radx] - tempave[row * W + col + radx])) / (len + 1); - len ++; - } - - for (int col = radx + 1; col < W - radx; col++) { - temp[row * W + col] = temp[row * W + col - 1] + (fabs(src[row * W + col + radx] - tempave[row * W + col + radx]) - \ - fabs(src[row * W + col - radx - 1] - tempave[row * W + col - radx - 1])) / len; - } - - for (int col = W - radx; col < W; col++) { - temp[row * W + col] = (temp[row * W + col - 1] * len - fabs(src[row * W + col - radx - 1] - tempave[row * W + col - radx - 1])) / (len - 1); - len --; - } - } - } - - if (rady == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) - for (int col = 0; col < W; col++) { - dst[row * W + col] = temp[row * W + col]; - } - } else { - //vertical blur -//OpenMP here -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int col = 0; col < W; col++) { - int len = rady + 1; - dst[0 * W + col] = temp[0 * W + col] / len; - - for (int i = 1; i <= rady; i++) { - dst[0 * W + col] += temp[i * W + col] / len; - } - - for (int row = 1; row <= rady; row++) { - dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1); - len ++; - } - - for (int row = rady + 1; row < H - rady; row++) { - dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len; - } - - for (int row = H - rady; row < H; row++) { - dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1); - len --; - } - } - } - - delete buffer1; - delete buffer2; - -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -template void boxsqblur (T* src, A* dst, int radx, int rady, int W, int H) -{ - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //box blur image; box range = (radx,rady) i.e. box size is (2*radx+1)x(2*rady+1) - - AlignedBuffer* buffer = new AlignedBuffer (W * H); - float* temp = buffer->data; - - if (radx == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) - for (int col = 0; col < W; col++) { - temp[row * W + col] = SQR(src[row * W + col]); - } - } else { - //horizontal blur -//OpenMP here -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) { - int len = radx + 1; - temp[row * W + 0] = SQR((float)src[row * W + 0]) / len; - - for (int j = 1; j <= radx; j++) { - temp[row * W + 0] += SQR((float)src[row * W + j]) / len; - } - - for (int col = 1; col <= radx; col++) { - temp[row * W + col] = (temp[row * W + col - 1] * len + SQR(src[row * W + col + radx])) / (len + 1); - len ++; - } - - for (int col = radx + 1; col < W - radx; col++) { - temp[row * W + col] = temp[row * W + col - 1] + ((float)(SQR(src[row * W + col + radx]) - SQR(src[row * W + col - radx - 1]))) / len; - } - - for (int col = W - radx; col < W; col++) { - temp[row * W + col] = (temp[row * W + col - 1] * len - SQR(src[row * W + col - radx - 1])) / (len - 1); - len --; - } - } - } - - if (rady == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) - for (int col = 0; col < W; col++) { - dst[row * W + col] = temp[row * W + col]; - } - } else { - //vertical blur -//OpenMP here -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int col = 0; col < W; col++) { - int len = rady + 1; - dst[0 * W + col] = temp[0 * W + col] / len; - - for (int i = 1; i <= rady; i++) { - dst[0 * W + col] += temp[i * W + col] / len; - } - - for (int row = 1; row <= rady; row++) { - dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1); - len ++; - } - - for (int row = rady + 1; row < H - rady; row++) { - dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len; - } - - for (int row = H - rady; row < H; row++) { - dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1); - len --; - } - } - } - - delete buffer; - -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -template void boxcorrelate (T* src, A* dst, int dx, int dy, int radx, int rady, int W, int H) -{ - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //box blur image; box range = (radx,rady) i.e. box size is (2*radx+1)x(2*rady+1) - - AlignedBuffer* buffer = new AlignedBuffer (W * H); - float* temp = buffer->data; - - if (radx == 0) { - for (int row = 0; row < H; row++) { - int rr = min(H - 1, max(0, row + dy)); - - for (int col = 0; col < W; col++) { - int cc = min(W - 1, max(0, col + dx)); - temp[row * W + col] = dy > 0 ? (src[row * W + col]) * (src[rr * W + cc]) : 0; - } - } - } else { - //horizontal blur - for (int row = 0; row < H; row++) { - int len = radx + 1; - int rr = min(H - 1, max(0, row + dy)); - int cc = min(W - 1, max(0, 0 + dx)); - temp[row * W + 0] = ((float)src[row * W + 0]) * (src[rr * W + cc]) / len; - - for (int j = 1; j <= radx; j++) { - int cc = min(W - 1, max(0, j + dx)); - temp[row * W + 0] += ((float)src[row * W + j]) * (src[rr * W + cc]) / len; - } - - for (int col = 1; col <= radx; col++) { - int cc = min(W - 1, max(0, col + dx + radx)); - temp[row * W + col] = (temp[row * W + col - 1] * len + (src[row * W + col + radx]) * (src[rr * W + cc])) / (len + 1); - len ++; - } - - for (int col = radx + 1; col < W - radx; col++) { - int cc = min(W - 1, max(0, col + dx + radx)); - int cc1 = min(W - 1, max(0, col + dx - radx - 1)); - temp[row * W + col] = temp[row * W + col - 1] + ((float)((src[row * W + col + radx]) * (src[rr * W + cc]) - - (src[row * W + col - radx - 1]) * (src[rr * W + cc1]))) / len; - } - - for (int col = W - radx; col < W; col++) { - int cc1 = min(W - 1, max(0, col + dx - radx - 1)); - temp[row * W + col] = (temp[row * W + col - 1] * len - (src[row * W + col - radx - 1]) * (src[rr * W + cc1])) / (len - 1); - len --; - } - } - } - - if (rady == 0) { -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int row = 0; row < H; row++) - for (int col = 0; col < W; col++) { - dst[row * W + col] = temp[row * W + col]; - } - } else { - //vertical blur -//OpenMP here -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int col = 0; col < W; col++) { - int len = rady + 1; - dst[0 * W + col] = temp[0 * W + col] / len; - - for (int i = 1; i <= rady; i++) { - dst[0 * W + col] += temp[i * W + col] / len; - } - - for (int row = 1; row <= rady; row++) { - dst[row * W + col] = (dst[(row - 1) * W + col] * len + temp[(row + rady) * W + col]) / (len + 1); - len ++; - } - - for (int row = rady + 1; row < H - rady; row++) { - dst[row * W + col] = dst[(row - 1) * W + col] + (temp[(row + rady) * W + col] - temp[(row - rady - 1) * W + col]) / len; - } - - for (int row = H - rady; row < H; row++) { - dst[row * W + col] = (dst[(row - 1) * W + col] * len - temp[(row - rady - 1) * W + col]) / (len - 1); - len --; - } - } - } - - delete buffer; - -} - - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - template SSEFUNCTION void boxabsblur (T* src, A* dst, int radx, int rady, int W, int H, float * temp) { @@ -1131,7 +639,5 @@ template SSEFUNCTION void boxabsblur (T* src, A* dst, int radx } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - } #endif /* _BOXBLUR_H_ */ diff --git a/rtengine/iimage.h b/rtengine/iimage.h index 149ed3787..e2cd6b951 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -28,6 +28,7 @@ #include "coord2d.h" #include "procparams.h" #include "color.h" +#include "../rtgui/threadutils.h" #define TR_NONE 0 #define TR_R90 1 From 123c8b44431aa38f6f5afdfc7ffd602b06ed78e5 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 22:25:05 +0200 Subject: [PATCH 19/72] Make compilation unit rtengine/curves.cc -Wextra clean, #4155 --- rtengine/curves.cc | 20 ++++++++------------ rtengine/curves.h | 10 +++++----- rtengine/improccoordinator.cc | 2 +- rtengine/procparams.cc | 6 +++--- rtengine/rtthumbnail.cc | 4 ++-- rtengine/simpleprocess.cc | 2 +- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index ee589bc74..db6c4c5f5 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -476,14 +476,10 @@ void CurveFactory::complexsgnCurve (bool & autili, bool & butili, bool & ccutil } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, - procparams::ToneCurveParams::eTCModeId curveMode, const std::vector& curvePoints, - procparams::ToneCurveParams::eTCModeId curveMode2, const std::vector& curvePoints2, + const std::vector& curvePoints, + const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, @@ -1360,7 +1356,7 @@ void ColorGradientCurve::Reset() lut3.reset(); } -void ColorGradientCurve::SetXYZ(const Curve *pCurve, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float satur, float lumin) +void ColorGradientCurve::SetXYZ(const Curve *pCurve, const double xyz_rgb[3][3], float satur, float lumin) { if (pCurve->isIdentity()) { lut1.reset(); @@ -1500,7 +1496,7 @@ void ColorGradientCurve::SetXYZ(const Curve *pCurve, const double xyz_rgb[3][3], */ } -void ColorGradientCurve::SetXYZ(const std::vector &curvePoints, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float satur, float lumin) +void ColorGradientCurve::SetXYZ(const std::vector &curvePoints, const double xyz_rgb[3][3], float satur, float lumin) { std::unique_ptr tcurve; @@ -1509,11 +1505,11 @@ void ColorGradientCurve::SetXYZ(const std::vector &curvePoints, const do } if (tcurve) { - SetXYZ(tcurve.get(), xyz_rgb, rgb_xyz, satur, lumin); + SetXYZ(tcurve.get(), xyz_rgb, satur, lumin); } } -void ColorGradientCurve::SetRGB(const Curve *pCurve, const double xyz_rgb[3][3], const double rgb_xyz[3][3]) +void ColorGradientCurve::SetRGB(const Curve *pCurve) { if (pCurve->isIdentity()) { lut1.reset(); @@ -1599,7 +1595,7 @@ void ColorGradientCurve::SetRGB(const Curve *pCurve, const double xyz_rgb[3][3], */ } -void ColorGradientCurve::SetRGB(const std::vector &curvePoints, const double xyz_rgb[3][3], const double rgb_xyz[3][3]) +void ColorGradientCurve::SetRGB(const std::vector &curvePoints) { std::unique_ptr tcurve; @@ -1608,7 +1604,7 @@ void ColorGradientCurve::SetRGB(const std::vector &curvePoints, const do } if (tcurve) { - SetRGB(tcurve.get(), xyz_rgb, rgb_xyz); + SetRGB(tcurve.get()); } } diff --git a/rtengine/curves.h b/rtengine/curves.h index c20b78772..10f62fb13 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -281,7 +281,7 @@ public: public: static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, - procparams::ToneCurveParams::eTCModeId curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::eTCModeId curveMode2, const std::vector& curvePoints2, + const std::vector& curvePoints, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, int skip = 1); @@ -687,10 +687,10 @@ public: virtual ~ColorGradientCurve() {}; void Reset(); - void SetXYZ(const Curve *pCurve, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float satur, float lumin); - void SetXYZ(const std::vector &curvePoints, const double xyz_rgb[3][3], const double rgb_xyz[3][3], float satur, float lumin); - void SetRGB(const Curve *pCurve, const double xyz_rgb[3][3], const double rgb_xyz[3][3]); - void SetRGB(const std::vector &curvePoints, const double xyz_rgb[3][3], const double rgb_xyz[3][3]); + void SetXYZ(const Curve *pCurve, const double xyz_rgb[3][3], float satur, float lumin); + void SetXYZ(const std::vector &curvePoints, const double xyz_rgb[3][3], float satur, float lumin); + void SetRGB(const Curve *pCurve); + void SetRGB(const std::vector &curvePoints); /** * @brief Get the value of Red, Green and Blue corresponding to the requested index diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 9366bec27..9a216ed46 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -461,7 +461,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) CurveFactory::complexCurve (params.toneCurve.expcomp, params.toneCurve.black / 65535.0, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.shcompr, params.toneCurve.brightness, params.toneCurve.contrast, - params.toneCurve.curveMode, params.toneCurve.curve, params.toneCurve.curveMode2, params.toneCurve.curve2, + params.toneCurve.curve, params.toneCurve.curve2, vhist16, hltonecurve, shtonecurve, tonecurve, histToneCurve, customToneCurve1, customToneCurve2, 1); CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7a3fec1ea..3e78d9879 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -584,13 +584,13 @@ void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCur satur = 0.9f; } - colorCurveLUT.SetXYZ (cCurve, xyz_rgb, rgb_xyz, satur, lumin); + colorCurveLUT.SetXYZ (cCurve, xyz_rgb, satur, lumin); opacityCurveLUT.Set (oCurve, opautili); } else if (method == "Splitlr" || method == "Splitco") { - colorCurveLUT.SetXYZ (cCurve, xyz_rgb, rgb_xyz, satur, lumin); + colorCurveLUT.SetXYZ (cCurve, xyz_rgb, satur, lumin); opacityCurveLUT.Set (oCurve, opautili); } else if (method.substr (0, 3) == "RGB") { - colorCurveLUT.SetRGB (cCurve, xyz_rgb, rgb_xyz); + colorCurveLUT.SetRGB (cCurve); opacityCurveLUT.Set (oCurve, opautili); } } diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index b458464b8..c26a788bb 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1152,8 +1152,8 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT ToneCurve customToneCurvebw2; CurveFactory::complexCurve (expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, - params.toneCurve.curveMode, params.toneCurve.curve, - params.toneCurve.curveMode2, params.toneCurve.curve2, + params.toneCurve.curve, + params.toneCurve.curve2, hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2, 16); LUTf rCurve; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index e8bcb7054..9bbaf856b 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -870,7 +870,7 @@ private: //if(params.blackwhite.enabled) params.toneCurve.hrenabled=false; CurveFactory::complexCurve (expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, - params.toneCurve.curveMode, params.toneCurve.curve, params.toneCurve.curveMode2, params.toneCurve.curve2, + params.toneCurve.curve, params.toneCurve.curve2, hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2 ); CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1); From 31c75864d43a64b5a8248590b36e5683a129f5ab Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 23:08:02 +0200 Subject: [PATCH 20/72] Make compilation unit rtengine/dirpyr_equalizer.cc -Wextra clean, #4155 --- rtengine/dirpyr_equalizer.cc | 58 +++++++++++++----------------------- rtengine/improcfun.cc | 11 ++----- rtengine/improcfun.h | 6 ++-- 3 files changed, 26 insertions(+), 49 deletions(-) diff --git a/rtengine/dirpyr_equalizer.cc b/rtengine/dirpyr_equalizer.cc index 8f3ebae9f..e20bc04e7 100644 --- a/rtengine/dirpyr_equalizer.cc +++ b/rtengine/dirpyr_equalizer.cc @@ -20,38 +20,27 @@ #include #include -#include "curves.h" -#include "labimage.h" -#include "color.h" -#include "mytime.h" #include "improcfun.h" -#include "rawimagesource.h" #include "array2D.h" #include "rt_math.h" #include "opthelper.h" -#ifdef _OPENMP -#include -#endif -#define CLIPI(a) ((a)>0 ?((a)<32768 ?(a):32768):0) #define RANGEFN(i) ((1000.0f / (i + 1000.0f))) -#define CLIPC(a) ((a)>-32000?((a)<32000?(a):32000):-32000) #define DIRWT(i1,j1,i,j) ( domker[(i1-i)/scale+halfwin][(j1-j)/scale+halfwin] * RANGEFN(fabsf((data_fine[i1][j1]-data_fine[i][j]))) ) namespace rtengine { -static const int maxlevel = 6; -static const float noise = 2000; +constexpr int maxlevel = 6; +constexpr float noise = 2000; //sequence of scales -static const int scales[6] = {1, 2, 4, 8, 16, 32}; +constexpr int scales[maxlevel] = {1, 2, 4, 8, 16, 32}; extern const Settings* settings; //sequence of scales - -SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, float ** dest_a, float ** dest_b, const double * mult, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev) +SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scaleprev) { int lastlevel = maxlevel; @@ -94,10 +83,10 @@ SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, } int level; - float multi[6] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f}; - float scalefl[6]; + float multi[maxlevel] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f}; + float scalefl[maxlevel]; - for(int lv = 0; lv < 6; lv++) { + for(int lv = 0; lv < maxlevel; lv++) { scalefl[lv] = ((float) scales[lv]) / (float) scaleprev; if(lv >= 1) { @@ -226,12 +215,12 @@ SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, float ** buffer = dirpyrlo[lastlevel - 1]; for(int level = lastlevel - 1; level > 0; level--) { - idirpyr_eq_channel(dirpyrlo[level], dirpyrlo[level - 1], buffer, srcwidth, srcheight, level, multi, dirpyrThreshold, tmpHue, tmpChr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice ); + idirpyr_eq_channel(dirpyrlo[level], dirpyrlo[level - 1], buffer, srcwidth, srcheight, level, multi, dirpyrThreshold, tmpHue, tmpChr, skinprot, b_l, t_l, t_r); } scale = scales[0]; - idirpyr_eq_channel(dirpyrlo[0], dst, buffer, srcwidth, srcheight, 0, multi, dirpyrThreshold, tmpHue, tmpChr, skinprot, gamutlab, b_l, t_l, t_r, b_r, choice ); + idirpyr_eq_channel(dirpyrlo[0], dst, buffer, srcwidth, srcheight, 0, multi, dirpyrThreshold, tmpHue, tmpChr, skinprot, b_l, t_l, t_r); if(skinprot != 0.f) { for (int i = 0; i < srcheight; i++) { @@ -247,7 +236,6 @@ SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, delete [] tmpHue; } - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #pragma omp parallel for for (int i = 0; i < srcheight; i++) @@ -259,7 +247,7 @@ SSEFUNCTION void ImProcFunctions :: dirpyr_equalizer(float ** src, float ** dst, -void ImProcFunctions :: dirpyr_equalizercam (CieImage *ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scaleprev) +void ImProcFunctions :: dirpyr_equalizercam (CieImage *ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, float b_l, float t_l, float t_r, int scaleprev) { int lastlevel = maxlevel; @@ -303,10 +291,10 @@ void ImProcFunctions :: dirpyr_equalizercam (CieImage *ncie, float ** src, float int level; - float multi[6] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f}; - float scalefl[6]; + float multi[maxlevel] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f}; + float scalefl[maxlevel]; - for(int lv = 0; lv < 6; lv++) { + for(int lv = 0; lv < maxlevel; lv++) { scalefl[lv] = ((float) scales[lv]) / (float) scaleprev; // if(scalefl[lv] < 1.f) multi[lv] = 1.f; else multi[lv]=(float) mult[lv]; @@ -371,7 +359,6 @@ void ImProcFunctions :: dirpyr_equalizercam (CieImage *ncie, float ** src, float idirpyr_eq_channelcam(dirpyrlo[0], dst, buffer, srcwidth, srcheight, 0, multi, dirpyrThreshold, h_p, C_p, skinprot, b_l, t_l, t_r); - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if(execdir) { #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -385,20 +372,17 @@ void ImProcFunctions :: dirpyr_equalizercam (CieImage *ncie, float ** src, float dst[i][j] = src[i][j]; } } - } else + } else { for (int i = 0; i < srcheight; i++) for (int j = 0; j < srcwidth; j++) { dst[i][j] = CLIP( buffer[i][j] ); // TODO: Really a clip necessary? } - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + } } - SSEFUNCTION void ImProcFunctions::dirpyr_channel(float ** data_fine, float ** data_coarse, int width, int height, int level, int scale) { - //scale is spacing of directional averaging weights - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // scale is spacing of directional averaging weights // calculate weights, compute directionally weighted average if(level > 1) { @@ -620,9 +604,7 @@ SSEFUNCTION void ImProcFunctions::dirpyr_channel(float ** data_fine, float ** da } } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -void ImProcFunctions::idirpyr_eq_channel(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float mult[6], const double dirpyrThreshold, float ** hue, float ** chrom, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r , int choice) +void ImProcFunctions::idirpyr_eq_channel(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float mult[maxlevel], const double dirpyrThreshold, float ** hue, float ** chrom, const double skinprot, float b_l, float t_l, float t_r) { const float skinprotneg = -skinprot; const float factorHard = (1.f - skinprotneg / 100.f); @@ -635,7 +617,7 @@ void ImProcFunctions::idirpyr_eq_channel(float ** data_coarse, float ** data_fin offs = -1.f; } - float multbis[6]; + float multbis[maxlevel]; multbis[level] = mult[level]; //multbis to reduce artifacts for high values mult @@ -714,7 +696,7 @@ void ImProcFunctions::idirpyr_eq_channel(float ** data_coarse, float ** data_fin } -void ImProcFunctions::idirpyr_eq_channelcam(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float mult[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r) +void ImProcFunctions::idirpyr_eq_channelcam(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float mult[maxlevel], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r) { const float skinprotneg = -skinprot; @@ -728,7 +710,7 @@ void ImProcFunctions::idirpyr_eq_channelcam(float ** data_coarse, float ** data_ offs = -1.f; } - float multbis[6]; + float multbis[maxlevel]; multbis[level] = mult[level]; //multbis to reduce artifacts for high values mult diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 3b5bd3275..efdef778a 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -1310,10 +1310,8 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L if (rtt == 1) { float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; - int choice = 0; //not disabled in case of ! always 0 - dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, params->dirpyrequalizer.gamutlab, b_l, t_l, t_r, b_r, choice, scale); //contrast by detail adapted to CIECAM + dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, b_l, t_l, t_r, scale); //contrast by detail adapted to CIECAM } } @@ -2757,11 +2755,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw if (rtt == 1) { float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; - int choice = 0; // I have not suppress this statement in case of !! always to 0 lab->deleteLab(); - dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, params->dirpyrequalizer.gamutlab, b_l, t_l, t_r, b_r, choice, scale); //contrast by detail adapted to CIECAM + dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, b_l, t_l, t_r, scale); //contrast by detail adapted to CIECAM lab->reallocLab(); } @@ -6506,7 +6502,6 @@ void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; - int choice = 0; //I have not disabled this statement in case of ! always 0 // if (params->dirpyrequalizer.algo=="FI") choice=0; // else if(params->dirpyrequalizer.algo=="LA") choice=1; float artifact = (float) settings->artifact_cbdl; @@ -6526,7 +6521,7 @@ void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) } //dirpyrLab_equalizer(lab, lab, params->dirpyrequalizer.mult); - dirpyr_equalizer (lab->L, lab->L, lab->W, lab->H, lab->a, lab->b, lab->a, lab->b, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, params->dirpyrequalizer.gamutlab, b_l, t_l, t_r, b_r, choice, scale); + dirpyr_equalizer (lab->L, lab->L, lab->W, lab->H, lab->a, lab->b, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, b_l, t_l, t_r, scale); } } void ImProcFunctions::EPDToneMapCIE (CieImage *ncie, float a_w, float c_, int Wid, int Hei, float minQ, float maxQ, unsigned int Iterates, int skip) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 1065c5833..d6bbdff32 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -332,10 +332,10 @@ public: float MadRgb (float * DataList, const int datalen); // pyramid wavelet - void dirpyr_equalizer (float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, float ** dest_a, float ** dest_b, const double * mult, const double dirpyrThreshold, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale);//Emil's directional pyramid wavelet - void dirpyr_equalizercam (CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice, int scale);//Emil's directional pyramid wavelet + void dirpyr_equalizer (float ** src, float ** dst, int srcwidth, int srcheight, float ** l_a, float ** l_b, const double * mult, const double dirpyrThreshold, const double skinprot, float b_l, float t_l, float t_r, int scale);//Emil's directional pyramid wavelet + void dirpyr_equalizercam (CieImage* ncie, float ** src, float ** dst, int srcwidth, int srcheight, float ** h_p, float ** C_p, const double * mult, const double dirpyrThreshold, const double skinprot, bool execdir, float b_l, float t_l, float t_r, int scale);//Emil's directional pyramid wavelet void dirpyr_channel (float ** data_fine, float ** data_coarse, int width, int height, int level, int scale); - void idirpyr_eq_channel (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, const bool gamutlab, float b_l, float t_l, float t_r, float b_r, int choice); + void idirpyr_eq_channel (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); void idirpyr_eq_channelcam (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); void defringe (LabImage* lab); void defringecam (CieImage* ncie); From 330ee9a91fa37254fbdd60727fa0bbdea6dd1b79 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 22 Oct 2017 23:48:38 +0200 Subject: [PATCH 21/72] Make compilation unit rtengine/procparams.cc -Wextra clean, #4155 --- rtengine/improccoordinator.cc | 8 +------- rtengine/procparams.cc | 6 +++--- rtengine/procparams.h | 4 ++-- rtengine/rtthumbnail.cc | 8 +------- rtengine/simpleprocess.cc | 8 +------- 5 files changed, 8 insertions(+), 26 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 9a216ed46..ccf517329 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -478,13 +478,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params.icm.working); - double wip[3][3] = { - {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, - {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, - {wiprof[2][0], wiprof[2][1], wiprof[2][2]} - }; - params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, wip, opautili); + params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili); CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, scale == 1 ? 1 : 16); CurveFactory::curveToning (params.colorToning.cl2curve, cl2Toningcurve, scale == 1 ? 1 : 16); } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3e78d9879..1c29f3e4b 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -18,7 +18,6 @@ */ #include #include "procparams.h" -#include "rt_math.h" #include "curves.h" #include "../rtgui/multilangmgr.h" #include "../rtgui/version.h" @@ -26,6 +25,7 @@ #include "../rtgui/paramsedited.h" #include "../rtgui/options.h" #include + #define APPVERSION RTVERSION using namespace std; @@ -558,7 +558,7 @@ void ColorToningParams::slidersToCurve (std::vector &colorCurve, std::ve opacityCurve.at (8) = 0.35; } -void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool &opautili) const +void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], bool &opautili) const { float satur = 0.8f; float lumin = 0.5f; //middle of luminance for optimization of gamut - no real importance...as we work in XYZ and gamut control @@ -8829,7 +8829,7 @@ void PartialProfile::clearGeneral () } } -const void PartialProfile::applyTo (ProcParams *destParams) const +void PartialProfile::applyTo (ProcParams *destParams) const { if (destParams && pparams && pedited) { pedited->combine (*destParams, *pparams, true); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index aaf62c53f..616e75537 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -435,7 +435,7 @@ public: /// @brief Specifically transform the sliders values to their curve equivalences void slidersToCurve (std::vector &colorCurve, std::vector &opacityCurve) const; /// @brief Fill the ColorGradientCurve and OpacityCurve LUTf from the control points curve or sliders value - void getCurves (ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], const double rgb_xyz[3][3], bool &opautili) const; + void getCurves (ColorGradientCurve &colorCurveLUT, OpacityCurve &opacityCurveLUT, const double xyz_rgb[3][3], bool &opautili) const; static void getDefaultColorCurve (std::vector &curve); static void getDefaultOpacityCurve (std::vector &curve); @@ -1493,7 +1493,7 @@ public: void clearGeneral (); int load (const Glib::ustring &fName); void set (bool v); - const void applyTo (ProcParams *destParams) const ; + void applyTo (ProcParams *destParams) const ; }; /** diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index c26a788bb..8398ea2d2 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1172,13 +1172,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params.icm.working); - double wip[3][3] = { - {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, - {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, - {wiprof[2][0], wiprof[2][1], wiprof[2][2]} - }; - params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, wip, opautili); + params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili); clToningcurve (65536); CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, scale == 1 ? 1 : 16); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 9bbaf856b..30d7a8ec7 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -886,13 +886,7 @@ private: {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params.icm.working); - double wip[3][3] = { - {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, - {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, - {wiprof[2][0], wiprof[2][1], wiprof[2][2]} - }; - params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, wip, opautili); + params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili); clToningcurve (65536, 0); CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, 1); cl2Toningcurve (65536, 0); From 54a07be45d2d94848e0e48bd33fc696555c14013 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 23 Oct 2017 00:16:22 +0200 Subject: [PATCH 22/72] Make compilation unit rtengine/PF_correct_RT.cc -Wextra clean, #4155 --- rtengine/PF_correct_RT.cc | 4 ++-- rtengine/improcfun.cc | 28 +++++++++------------------- rtengine/improcfun.h | 8 ++++---- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/rtengine/PF_correct_RT.cc b/rtengine/PF_correct_RT.cc index 6e1fe75d6..a31c78767 100644 --- a/rtengine/PF_correct_RT.cc +++ b/rtengine/PF_correct_RT.cc @@ -655,7 +655,7 @@ SSEFUNCTION void ImProcFunctions::PF_correct_RTcam(CieImage * src, CieImage * ds free(fringe); } -SSEFUNCTION void ImProcFunctions::Badpixelscam(CieImage * src, CieImage * dst, double radius, int thresh, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom, int hotbad) +SSEFUNCTION void ImProcFunctions::Badpixelscam(CieImage * src, CieImage * dst, double radius, int thresh, int mode, float skinprot, float chrom, int hotbad) { const int halfwin = ceil(2 * radius) + 1; MyTime t1, t2; @@ -1263,7 +1263,7 @@ SSEFUNCTION void ImProcFunctions::Badpixelscam(CieImage * src, CieImage * dst, d } -SSEFUNCTION void ImProcFunctions::BadpixelsLab(LabImage * src, LabImage * dst, double radius, int thresh, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom) +SSEFUNCTION void ImProcFunctions::BadpixelsLab(LabImage * src, LabImage * dst, double radius, int thresh, int mode, float skinprot, float chrom) { const int halfwin = ceil(2 * radius) + 1; MyTime t1, t2; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index efdef778a..883b8bd78 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -1264,11 +1264,6 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L //if(params->dirpyrequalizer.enabled) if(execsharp) { if (params->dirpyrequalizer.enabled) { if (params->dirpyrequalizer.gamutlab /*&& execsharp*/) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; - float artifact = (float) settings->artifact_cbdl; if (artifact > 6.f) { @@ -1282,14 +1277,14 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L float chrom = 50.f; { int hotbad = 0; - ImProcFunctions::badpixcam (ncie, artifact, 5, 2, b_l, t_l, t_r, b_r, params->dirpyrequalizer.skinprotect, chrom, hotbad); //enabled remove artifacts for cbDL + ImProcFunctions::badpixcam (ncie, artifact, 5, 2, params->dirpyrequalizer.skinprotect, chrom, hotbad); //enabled remove artifacts for cbDL } } } if (params->colorappearance.badpixsl > 0) if (execsharp) { int mode = params->colorappearance.badpixsl; - ImProcFunctions::badpixcam (ncie, 3.4, 5, mode, 0, 0, 0, 0, 0, 0, 1);//for bad pixels CIECAM + ImProcFunctions::badpixcam (ncie, 3.4, 5, mode, 0, 0, 1);//for bad pixels CIECAM } if (params->sharpenMicro.enabled)if (execsharp) { @@ -2699,10 +2694,6 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw //if(params->dirpyrequalizer.enabled) if(execsharp) { if (params->dirpyrequalizer.enabled) { if (params->dirpyrequalizer.gamutlab /*&& execsharp*/) { //remove artifacts by gaussian blur - skin control - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; float artifact = (float) settings->artifact_cbdl; if (artifact > 6.f) { @@ -2716,7 +2707,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw int hotbad = 0; float chrom = 50.f; lab->deleteLab(); - ImProcFunctions::badpixcam (ncie, artifact, 5, 2, b_l, t_l, t_r, b_r, params->dirpyrequalizer.skinprotect, chrom, hotbad); //enabled remove artifacts for cbDL + ImProcFunctions::badpixcam (ncie, artifact, 5, 2, params->dirpyrequalizer.skinprotect, chrom, hotbad); //enabled remove artifacts for cbDL lab->reallocLab(); } } @@ -2725,7 +2716,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw if (params->colorappearance.badpixsl > 0) if (execsharp) { int mode = params->colorappearance.badpixsl; lab->deleteLab(); - ImProcFunctions::badpixcam (ncie, 3.0, 10, mode, 0, 0, 0, 0, 0, 0, 1);//for bad pixels CIECAM + ImProcFunctions::badpixcam (ncie, 3.0, 10, mode, 0, 0, 1);//for bad pixels CIECAM lab->reallocLab(); } @@ -6481,17 +6472,17 @@ void ImProcFunctions::defringecam (CieImage* ncie) } } -void ImProcFunctions::badpixcam (CieImage* ncie, double rad, int thr, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom, int hotbad) +void ImProcFunctions::badpixcam (CieImage* ncie, double rad, int thr, int mode, float skinprot, float chrom, int hotbad) { if (ncie->W >= 8 && ncie->H >= 8) { - Badpixelscam (ncie, ncie, rad, thr, mode, b_l, t_l, t_r, b_r, skinprot, chrom, hotbad); + Badpixelscam (ncie, ncie, rad, thr, mode, skinprot, chrom, hotbad); } } -void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom) +void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, int mode, float skinprot, float chrom) { if (lab->W >= 8 && lab->H >= 8) { - BadpixelsLab (lab, lab, rad, thr, mode, b_l, t_l, t_r, b_r, skinprot, chrom); + BadpixelsLab (lab, lab, rad, thr, mode, skinprot, chrom); } } @@ -6500,7 +6491,6 @@ void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) if (params->dirpyrequalizer.enabled && lab->W >= 8 && lab->H >= 8) { float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float b_r = static_cast (params->dirpyrequalizer.hueskin.value[2]) / 100.0f; float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; // if (params->dirpyrequalizer.algo=="FI") choice=0; // else if(params->dirpyrequalizer.algo=="LA") choice=1; @@ -6517,7 +6507,7 @@ void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) float chrom = 50.f; if (params->dirpyrequalizer.gamutlab) { - ImProcFunctions::badpixlab (lab, artifact, 5, 3, b_l, t_l, t_r, b_r, params->dirpyrequalizer.skinprotect, chrom); //for artifacts + ImProcFunctions::badpixlab (lab, artifact, 5, 3, params->dirpyrequalizer.skinprotect, chrom); //for artifacts } //dirpyrLab_equalizer(lab, lab, params->dirpyrequalizer.mult); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index d6bbdff32..37bbf61cf 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -339,13 +339,13 @@ public: void idirpyr_eq_channelcam (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, float multi[6], const double dirpyrThreshold, float ** l_a_h, float ** l_b_c, const double skinprot, float b_l, float t_l, float t_r); void defringe (LabImage* lab); void defringecam (CieImage* ncie); - void badpixcam (CieImage* ncie, double rad, int thr, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom, int hotbad); - void badpixlab (LabImage* lab, double rad, int thr, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom); + void badpixcam (CieImage* ncie, double rad, int thr, int mode, float skinprot, float chrom, int hotbad); + void badpixlab (LabImage* lab, double rad, int thr, int mode, float skinprot, float chrom); void PF_correct_RT (LabImage * src, LabImage * dst, double radius, int thresh); void PF_correct_RTcam (CieImage * src, CieImage * dst, double radius, int thresh); - void Badpixelscam (CieImage * src, CieImage * dst, double radius, int thresh, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom, int hotbad); - void BadpixelsLab (LabImage * src, LabImage * dst, double radius, int thresh, int mode, float b_l, float t_l, float t_r, float b_r, float skinprot, float chrom); + void Badpixelscam (CieImage * src, CieImage * dst, double radius, int thresh, int mode, float skinprot, float chrom, int hotbad); + void BadpixelsLab (LabImage * src, LabImage * dst, double radius, int thresh, int mode, float skinprot, float chrom); Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm); Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool bw, GammaValues *ga = nullptr); From fa4444d6d3915fb122f423b76f2ac35f5f85c497 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 23 Oct 2017 14:06:04 +0200 Subject: [PATCH 23/72] Make rtengine/fujicompressed.cc -Wextra clean, #4155 --- rtengine/dcraw.h | 4 ++-- rtengine/fujicompressed.cc | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index a109b43c2..d01e265ad 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -285,8 +285,8 @@ void fuji_extend_generic(ushort *linebuf[_ltotal], int line_width, int start, in void fuji_extend_red(ushort *linebuf[_ltotal], int line_width); void fuji_extend_green(ushort *linebuf[_ltotal], int line_width); void fuji_extend_blue(ushort *linebuf[_ltotal], int line_width); -void xtrans_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params, int cur_line); -void fuji_bayer_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params, int cur_line); +void xtrans_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params); +void fuji_bayer_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params); void fuji_decode_strip(const struct fuji_compressed_params* info_common, int cur_block, INT64 raw_offset, unsigned dsize); void fuji_compressed_load_raw(); void fuji_decode_loop(const struct fuji_compressed_params* common_info, int count, INT64* raw_block_offsets, unsigned *block_sizes); diff --git a/rtengine/fujicompressed.cc b/rtengine/fujicompressed.cc index 156c338d5..e00e037fc 100644 --- a/rtengine/fujicompressed.cc +++ b/rtengine/fujicompressed.cc @@ -534,7 +534,7 @@ void CLASS fuji_extend_blue (ushort *linebuf[_ltotal], int line_width) fuji_extend_generic (linebuf, line_width, _B2, _B4); } -void CLASS xtrans_decode_block (struct fuji_compressed_block* info, const struct fuji_compressed_params *params, int cur_line) +void CLASS xtrans_decode_block (struct fuji_compressed_block* info, const struct fuji_compressed_params *params) { int r_even_pos = 0, r_odd_pos = 1; int g_even_pos = 0, g_odd_pos = 1; @@ -699,8 +699,7 @@ void CLASS xtrans_decode_block (struct fuji_compressed_block* info, const struct } } -void CLASS fuji_bayer_decode_block (struct fuji_compressed_block *info, const struct fuji_compressed_params *params, - int cur_line) +void CLASS fuji_bayer_decode_block (struct fuji_compressed_block *info, const struct fuji_compressed_params *params) { int r_even_pos = 0, r_odd_pos = 1; int g_even_pos = 0, g_odd_pos = 1; @@ -867,9 +866,9 @@ void CLASS fuji_decode_strip (const struct fuji_compressed_params* info_common, for (cur_line = 0; cur_line < fuji_total_lines; cur_line++) { if (fuji_raw_type == 16) { - xtrans_decode_block (&info, info_common, cur_line); + xtrans_decode_block (&info, info_common); } else { - fuji_bayer_decode_block (&info, info_common, cur_line); + fuji_bayer_decode_block (&info, info_common); } // copy data from line buffers and advance From d0d96dbf5e2c812c88b6469ba0258af6dfd19b48 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 23 Oct 2017 11:36:02 -0700 Subject: [PATCH 24/72] License file for libiomp5.dylib To prevent a crash during quit on mac, Intel's OSS libiomp5 is used in place of the older libomp provided by clang. This is the license file provided by Intel to cover the binary's redistribution. For even more info, see: https://github.com/Beep6581/RawTherapee/issues/3971 --- licenses/osx_libiomp5_LICENSE.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 licenses/osx_libiomp5_LICENSE.txt diff --git a/licenses/osx_libiomp5_LICENSE.txt b/licenses/osx_libiomp5_LICENSE.txt new file mode 100644 index 000000000..18fca0d43 --- /dev/null +++ b/licenses/osx_libiomp5_LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2013-2016, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 841679c6db496f75b08467e6bad8f2ac1051a92a Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 23 Oct 2017 20:41:20 +0200 Subject: [PATCH 25/72] Remove some duplicate code in rtengine/curves.cc --- rtengine/curves.h | 158 ++---------------------------------------- rtengine/improcfun.cc | 12 ++-- 2 files changed, 12 insertions(+), 158 deletions(-) diff --git a/rtengine/curves.h b/rtengine/curves.h index 10f62fb13..c616c94da 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -801,11 +801,6 @@ class StandardToneCurve : public ToneCurve public: void Apply(float& r, float& g, float& b) const; }; -class StandardToneCurvebw : public ToneCurve -{ -public: - void Apply(float& r, float& g, float& b) const; -}; class AdobeToneCurve : public ToneCurve { @@ -816,27 +811,12 @@ public: void Apply(float& r, float& g, float& b) const; }; -class AdobeToneCurvebw : public ToneCurve -{ -private: - void RGBTone(float& r, float& g, float& b) const; // helper for tone curve - -public: - void Apply(float& r, float& g, float& b) const; -}; - class SatAndValueBlendingToneCurve : public ToneCurve { public: void Apply(float& r, float& g, float& b) const; }; -class SatAndValueBlendingToneCurvebw : public ToneCurve -{ -public: - void Apply(float& r, float& g, float& b) const; -}; - class WeightedStdToneCurve : public ToneCurve { private: @@ -884,14 +864,6 @@ public: void Apply(float& r, float& g, float& b, PerceptualToneCurveState & state) const; }; -class WeightedStdToneCurvebw : public ToneCurve -{ -private: - float Triangle(float refX, float refY, float X2) const; -public: - void Apply(float& r, float& g, float& b) const; -}; - // Standard tone curve inline void StandardToneCurve::Apply (float& r, float& g, float& b) const { @@ -902,16 +874,6 @@ inline void StandardToneCurve::Apply (float& r, float& g, float& b) const g = lutToneCurve[g]; b = lutToneCurve[b]; } -// Standard tone curve -inline void StandardToneCurvebw::Apply (float& r, float& g, float& b) const -{ - - assert (lutToneCurve); - - r = lutToneCurve[r]; - g = lutToneCurve[g]; - b = lutToneCurve[b]; -} // Tone curve according to Adobe's reference implementation // values in 0xffff space @@ -943,33 +905,6 @@ inline void AdobeToneCurve::Apply (float& r, float& g, float& b) const } } } -inline void AdobeToneCurvebw::Apply (float& r, float& g, float& b) const -{ - - assert (lutToneCurve); - - if (r >= g) { - if (g > b) { - RGBTone (r, g, b); // Case 1: r >= g > b - } else if (b > r) { - RGBTone (b, r, g); // Case 2: b > r >= g - } else if (b > g) { - RGBTone (r, b, g); // Case 3: r >= b > g - } else { // Case 4: r >= g == b - r = lutToneCurve[r]; - g = lutToneCurve[g]; - b = g; - } - } else { - if (r >= b) { - RGBTone (g, r, b); // Case 5: g > r >= b - } else if (b > g) { - RGBTone (b, g, r); // Case 6: b > g > r - } else { - RGBTone (g, b, r); // Case 7: g >= b > r - } - } -} inline void AdobeToneCurve::RGBTone (float& r, float& g, float& b) const { @@ -979,14 +914,6 @@ inline void AdobeToneCurve::RGBTone (float& r, float& g, float& b) const b = lutToneCurve[bold]; g = b + ((r - b) * (gold - bold) / (rold - bold)); } -inline void AdobeToneCurvebw::RGBTone (float& r, float& g, float& b) const -{ - float rold = r, gold = g, bold = b; - - r = lutToneCurve[rold]; - b = lutToneCurve[bold]; - g = b + ((r - b) * (gold - bold) / (rold - bold)); -} // Modifying the Luminance channel only inline void LuminanceToneCurve::Apply(float &r, float &g, float &b) const @@ -1019,23 +946,6 @@ inline float WeightedStdToneCurve::Triangle(float a, float a1, float b) const return a1; } -inline float WeightedStdToneCurvebw::Triangle(float a, float a1, float b) const -{ - if (a != b) { - float b1; - float a2 = a1 - a; - - if (b < a) { - b1 = b + a2 * b / a ; - } else { - b1 = b + a2 * (65535.f - b) / (65535.f - a); - } - - return b1; - } - - return a1; -} // Tone curve modifying the value channel only, preserving hue and saturation // values in 0xffff space @@ -1061,28 +971,6 @@ inline void WeightedStdToneCurve::Apply (float& r, float& g, float& b) const b = CLIP(b1 * 0.25f + b2 * 0.25f + b3 * 0.50f); } -inline void WeightedStdToneCurvebw::Apply (float& r, float& g, float& b) const -{ - - assert (lutToneCurve); - - float r1 = lutToneCurve[r]; - float g1 = Triangle(r, r1, g); - float b1 = Triangle(r, r1, b); - - float g2 = lutToneCurve[g]; - float r2 = Triangle(g, g2, r); - float b2 = Triangle(g, g2, b); - - float b3 = lutToneCurve[b]; - float r3 = Triangle(b, b3, r); - float g3 = Triangle(b, b3, g); - - r = CLIP( r1 * 0.50f + r2 * 0.25f + r3 * 0.25f); - g = CLIP(g1 * 0.25f + g2 * 0.50f + g3 * 0.25f); - b = CLIP(b1 * 0.25f + b2 * 0.25f + b3 * 0.50f); -} - // Tone curve modifying the value channel only, preserving hue and saturation // values in 0xffff space inline void SatAndValueBlendingToneCurve::Apply (float& r, float& g, float& b) const @@ -1099,54 +987,20 @@ inline void SatAndValueBlendingToneCurve::Apply (float& r, float& g, float& b) c return; } - bool increase = newLum > lum; - Color::rgb2hsv(r, g, b, h, s, v); - if (increase) { + float dV; + if (newLum > lum) { // Linearly targeting Value = 1 and Saturation = 0 float coef = (newLum - lum) / (65535.f - lum); - float dV = (1.f - v) * coef; + dV = (1.f - v) * coef; s *= 1.f - coef; - Color::hsv2rgb(h, s, v + dV, r, g, b); } else { // Linearly targeting Value = 0 - float coef = (lum - newLum) / lum ; - float dV = v * coef; - Color::hsv2rgb(h, s, v - dV, r, g, b); - } -} - -inline void SatAndValueBlendingToneCurvebw::Apply (float& r, float& g, float& b) const -{ - - assert (lutToneCurve); - - float h, s, v; - float lum = (r + g + b) / 3.f; - //float lum = Color::rgbLuminance(r, g, b); - float newLum = lutToneCurve[lum]; - - if (newLum == lum) { - return; - } - - bool increase = newLum > lum; - - Color::rgb2hsv(r, g, b, h, s, v); - - if (increase) { - // Linearly targeting Value = 1 and Saturation = 0 - float coef = (newLum - lum) / (65535.f - lum); - float dV = (1.f - v) * coef; - s *= 1.f - coef; - Color::hsv2rgb(h, s, v + dV, r, g, b); - } else { - // Linearly targeting Value = 0 - float coef = (lum - newLum) / lum ; - float dV = v * coef; - Color::hsv2rgb(h, s, v - dV, r, g, b); + float coef = (newLum - lum) / lum ; + dV = v * coef; } + Color::hsv2rgb(h, s, v + dV, r, g, b); } } diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 883b8bd78..8236aaf37 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -4196,21 +4196,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer if (beforeCurveMode == BlackWhiteParams::TC_MODE_STD_BW) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { - const StandardToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); + const StandardToneCurve& userToneCurvebw = static_cast (customToneCurvebw1); userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_FILMLIKE_BW) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { - const AdobeToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); + const AdobeToneCurve& userToneCurvebw = static_cast (customToneCurvebw1); userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { - const SatAndValueBlendingToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); + const SatAndValueBlendingToneCurve& userToneCurvebw = static_cast (customToneCurvebw1); rtemp[ti * TS + tj] = CLIP (rtemp[ti * TS + tj]); gtemp[ti * TS + tj] = CLIP (gtemp[ti * TS + tj]); btemp[ti * TS + tj] = CLIP (btemp[ti * TS + tj]); @@ -4220,7 +4220,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { - const WeightedStdToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); + const WeightedStdToneCurve& userToneCurvebw = static_cast (customToneCurvebw1); rtemp[ti * TS + tj] = CLIP (rtemp[ti * TS + tj]); gtemp[ti * TS + tj] = CLIP (gtemp[ti * TS + tj]); btemp[ti * TS + tj] = CLIP (btemp[ti * TS + tj]); @@ -4660,7 +4660,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer for (int i = 0; i < tH; i++) { for (int j = 0; j < tW; j++) { - const StandardToneCurvebw& userToneCurve = static_cast (customToneCurvebw2); + const StandardToneCurve& userToneCurve = static_cast (customToneCurvebw2); userToneCurve.Apply (tmpImage->r (i, j), tmpImage->g (i, j), tmpImage->b (i, j)); } } @@ -4671,7 +4671,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer for (int i = 0; i < tH; i++) { //for ulterior usage if bw data modified for (int j = 0; j < tW; j++) { - const WeightedStdToneCurvebw& userToneCurve = static_cast (customToneCurvebw2); + const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurvebw2); tmpImage->r (i, j) = CLIP (tmpImage->r (i, j)); tmpImage->g (i, j) = CLIP (tmpImage->g (i, j)); From 0719b5f27a8d63a99b21cb6ba2e6d6de2e577b46 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 23 Oct 2017 11:43:12 -0700 Subject: [PATCH 26/72] Copy libiomp5 license file into the app bundle. --- tools/osx/macosx_bundle.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 250bc23e2..7828363cb 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -158,6 +158,9 @@ ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme mkdir -p "${RESOURCES}/share/lensfun" cp /opt/local/share/lensfun/version_1/* "${RESOURCES}/share/lensfun" +# Copy the libiomp5 license into the app bundle +cp "${PROJECT_SOURCE_DATA_DIR}/licenses/osx_libiomp5_LICENSE.txt" "${RESOURCES}" + # Install names find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do msg "Modifying install names: ${x}" From 80b23e7168a7a66a39a5f3284e3cd5e1eaabaa21 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 23 Oct 2017 20:59:47 +0200 Subject: [PATCH 27/72] Make compilation unit rtengine/imagedata.cc -Wextra clean, #4155 --- rtengine/imagedata.cc | 4 ++-- rtengine/imagedata.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index b498f69f1..d90053476 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -24,7 +24,7 @@ #include "iptcpairs.h" #include "imagesource.h" #include "rt_math.h" - +#pragma GCC diagnostic warning "-Wextra" #define PRINT_HDR_PS_DETECTION 0 using namespace rtengine; @@ -1041,7 +1041,7 @@ failure: } -FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr rml, bool firstFrameOnly, bool loadAll) : +FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr rml, bool firstFrameOnly) : iptc(nullptr), dcrawFrameCount (0) { if (rml && (rml->exifBase >= 0 || rml->ciffBase >= 0)) { diff --git a/rtengine/imagedata.h b/rtengine/imagedata.h index 2da97a5d1..b9f955611 100644 --- a/rtengine/imagedata.h +++ b/rtengine/imagedata.h @@ -95,7 +95,7 @@ private: unsigned int dcrawFrameCount; public: - FramesData (const Glib::ustring& fname, std::unique_ptr rml = nullptr, bool firstFrameOnly = false, bool loadAll = false); + FramesData (const Glib::ustring& fname, std::unique_ptr rml = nullptr, bool firstFrameOnly = false); ~FramesData (); void setDCRawFrameCount (unsigned int frameCount); From ba63016e9844cbc894f5f13c3c3e159605eb89ea Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 23 Oct 2017 21:16:07 +0200 Subject: [PATCH 28/72] Make rtengine/impulse_denoise a compilation unit --- rtengine/CMakeLists.txt | 1 + rtengine/improcfun.cc | 1 - rtengine/{impulse_denoise.h => impulse_denoise.cc} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename rtengine/{impulse_denoise.h => impulse_denoise.cc} (100%) diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 424b3352e..0b003909f 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -72,6 +72,7 @@ set(RTENGINESOURCEFILES imageio.cc improccoordinator.cc improcfun.cc + impulse_denoise.cc init.cc iplab2rgb.cc ipresize.cc diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 8236aaf37..c22d7b509 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -28,7 +28,6 @@ #include "curves.h" #include "mytime.h" #include "iccstore.h" -#include "impulse_denoise.h" #include "imagesource.h" #include "rtthumbnail.h" #include "utils.h" diff --git a/rtengine/impulse_denoise.h b/rtengine/impulse_denoise.cc similarity index 100% rename from rtengine/impulse_denoise.h rename to rtengine/impulse_denoise.cc From 08b1b41770ef5e2382f6d4fab9bec6de0d80e8c6 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Wed, 25 Oct 2017 01:07:06 -0700 Subject: [PATCH 29/72] Update macosx_bundle.sh --- tools/osx/macosx_bundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 7828363cb..8b9cbccb6 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -159,7 +159,7 @@ mkdir -p "${RESOURCES}/share/lensfun" cp /opt/local/share/lensfun/version_1/* "${RESOURCES}/share/lensfun" # Copy the libiomp5 license into the app bundle -cp "${PROJECT_SOURCE_DATA_DIR}/licenses/osx_libiomp5_LICENSE.txt" "${RESOURCES}" +cp "${PROJECT_SOURCE_DIR}/licenses/osx_libiomp5_LICENSE.txt" "${RESOURCES}" # Install names find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do From 87c109a10e3e0461b1874bb29bff79256cd994ed Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 12:56:23 +0200 Subject: [PATCH 30/72] Make compilation unit rtengine/cJSON.c -Wextra clean, #4155 --- rtengine/cJSON.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/cJSON.c b/rtengine/cJSON.c index 31c43dd2e..cf5ebef56 100644 --- a/rtengine/cJSON.c +++ b/rtengine/cJSON.c @@ -31,6 +31,7 @@ #include #include #include "cJSON.h" +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" static const char *ep; From beb6347a4878bac653431b954f68de32840f5a44 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 13:11:15 +0200 Subject: [PATCH 31/72] Make compilation unit rtengine/fast_demo.cc -Wextra clean, #4155 --- rtengine/expo_before_b.cc | 2 +- rtengine/fast_demo.cc | 2 +- rtengine/rawimagesource.cc | 2 +- rtengine/rawimagesource.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/expo_before_b.cc b/rtengine/expo_before_b.cc index 98fed04f7..f94b2c292 100644 --- a/rtengine/expo_before_b.cc +++ b/rtengine/expo_before_b.cc @@ -80,7 +80,7 @@ void RawImageSource::processRawWhitepoint(float expos, float preser, array2DgetSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS) { // Demosaic to allow calculation of luminosity. if(ri->getSensorType() == ST_BAYER) { - fast_demosaic (0, 0, W, H); + fast_demosaic(); } else { fast_xtrans_interpolate(); } diff --git a/rtengine/fast_demo.cc b/rtengine/fast_demo.cc index 12286d9f1..6143d172e 100644 --- a/rtengine/fast_demo.cc +++ b/rtengine/fast_demo.cc @@ -52,7 +52,7 @@ LUTf RawImageSource::initInvGrad() #endif //LUTf RawImageSource::invGrad = RawImageSource::initInvGrad(); -SSEFUNCTION void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) +SSEFUNCTION void RawImageSource::fast_demosaic() { double progress = 0.0; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 78fa1f829..5eb7aa7b9 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2046,7 +2046,7 @@ void RawImageSource::demosaic(const RAWParams &raw) } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::lmmse]) { lmmse_interpolate_omp(W, H, rawData, red, green, blue, raw.bayersensor.lmmse_iterations); } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast] ) { - fast_demosaic (0, 0, W, H); + fast_demosaic(); } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] ) { nodemosaic(true); } else { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 9da7d44f4..d2ce77fed 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -245,7 +245,7 @@ protected: void igv_interpolate(int winw, int winh); void lmmse_interpolate_omp(int winw, int winh, array2D &rawData, array2D &red, array2D &green, array2D &blue, int iterations); void amaze_demosaic_RT(int winx, int winy, int winw, int winh, array2D &rawData, array2D &red, array2D &green, array2D &blue);//Emil's code for AMaZE - void fast_demosaic(int winx, int winy, int winw, int winh );//Emil's code for fast demosaicing + void fast_demosaic();//Emil's code for fast demosaicing void dcb_demosaic(int iterations, bool dcb_enhance); void ahd_demosaic(); void border_interpolate(unsigned int border, float (*image)[4], unsigned int start = 0, unsigned int end = 0); From 7542cfc45682a5223d1ff0dabdfb2b0a92a4666e Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 13:26:14 +0200 Subject: [PATCH 32/72] Make compilation unit rtengine/icons.cc -Wextra clean, #4155 --- rtengine/icons.cc | 3 ++- rtengine/icons.h | 2 +- rtgui/main-cli.cc | 2 +- rtgui/main.cc | 2 +- rtgui/preferences.cc | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rtengine/icons.cc b/rtengine/icons.cc index 2c5075007..b4477f09c 100644 --- a/rtengine/icons.cc +++ b/rtengine/icons.cc @@ -21,6 +21,7 @@ #include "icons.h" #include +#pragma GCC diagnostic warning "-Wextra" namespace rtengine { @@ -86,7 +87,7 @@ Glib::ustring findIconAbsolutePath (const Glib::ustring& iconName) return Glib::ustring(); } -void setPaths (const Options& options) +void setPaths () { // TODO: Forcing the Dark theme, so reading the icon set files is useless for now... diff --git a/rtengine/icons.h b/rtengine/icons.h index 9f6654a9c..a890555b2 100644 --- a/rtengine/icons.h +++ b/rtengine/icons.h @@ -26,7 +26,7 @@ namespace rtengine { Glib::ustring findIconAbsolutePath (const Glib::ustring& iconName); -void setPaths (const Options& options); +void setPaths (); } diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index 1cb63ef6d..76ed84489 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -163,7 +163,7 @@ int main (int argc, char **argv) return -2; } - rtengine::setPaths (options); + rtengine::setPaths(); TIFFSetWarningHandler (nullptr); // avoid annoying message boxes diff --git a/rtgui/main.cc b/rtgui/main.cc index 6dd9ccf7f..bd8f381c4 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -257,7 +257,7 @@ RTWindow *create_rt_window() Glib::RefPtr defaultIconTheme = Gtk::IconTheme::get_default(); defaultIconTheme->append_search_path (icon_path); - rtengine::setPaths (options); + rtengine::setPaths(); MyExpander::init(); // has to stay AFTER rtengine::setPaths // ------- loading theme files diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 974ba5450..8fd33673f 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -2147,7 +2147,7 @@ void Preferences::cancelPressed () { // set the initial theme back if (themeFNames.at (theme->get_active_row_number ()).longFName != options.theme) { - rtengine::setPaths (options); + rtengine::setPaths(); RTImage::updateImages(); switchThemeTo (options.theme); } @@ -2205,7 +2205,7 @@ void Preferences::themeChanged () { moptions.theme = themeFNames.at (theme->get_active_row_number ()).longFName; - rtengine::setPaths (moptions); + rtengine::setPaths(); RTImage::updateImages(); switchThemeTo (moptions.theme); } From fb02e6883e80aff04f83854e2808b94c7f7b19c5 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 13:27:02 +0200 Subject: [PATCH 33/72] remove #pragma... --- rtengine/icons.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/rtengine/icons.cc b/rtengine/icons.cc index b4477f09c..aa3b67cbf 100644 --- a/rtengine/icons.cc +++ b/rtengine/icons.cc @@ -21,7 +21,6 @@ #include "icons.h" #include -#pragma GCC diagnostic warning "-Wextra" namespace rtengine { From 7b3c36c7c6152598b8f7d03a456e83aca43fe261 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 16:50:03 +0200 Subject: [PATCH 34/72] reduce scope of warning silencing --- rtengine/cJSON.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rtengine/cJSON.c b/rtengine/cJSON.c index cf5ebef56..bf46c98c4 100644 --- a/rtengine/cJSON.c +++ b/rtengine/cJSON.c @@ -31,7 +31,6 @@ #include #include #include "cJSON.h" -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" static const char *ep; @@ -192,12 +191,21 @@ static const char *parse_string(cJSON *item,const char *str) len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len; +#ifdef __GNUC__ // silence warning +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + switch (len) { case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6; case 1: *--ptr2 =(uc | firstByteMark[len]); } + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif ptr2+=len; break; default: *ptr2++=*ptr; break; From 9a17962f4b72eb5f88bff3551a0a845b51dcf9d5 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 16:53:17 +0200 Subject: [PATCH 35/72] Make compilation unit rtengine/iptransform.cc -Wextra clean, #4155 --- rtengine/iptransform.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index f227af2ed..43a110a5f 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -788,6 +788,10 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag bool enableLCPDist = false; bool enableCA = false; +#ifdef __GNUC__ // silence warning +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif switch (mode) { case ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE: { enableLCPCA = pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable(); @@ -809,6 +813,9 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag break; } } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif if (!enableCA) { chDist[0] = 0.0; From 2e645debb440199fda1269c9922e9de4c9c8f839 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 17:09:46 +0200 Subject: [PATCH 36/72] =?UTF-8?q?Fix=20two=20issues=20detected=20by=20Fl?= =?UTF-8?q?=C3=B6ssie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtengine/imagedata.cc | 3 +-- rtengine/labimage.cc | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index d90053476..47688fca6 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -857,8 +857,7 @@ bool FramesData::hasIPTC (unsigned int frame) const tm FramesData::getDateTime (unsigned int frame) const { if (frames.empty() || frame >= frames.size() ) { - tm emptytm = {0, 0, 0, 0, 0, 0, 0, 0, 0}; - return emptytm; + return {}; } else { return frames.at(frame)->getDateTime (); } diff --git a/rtengine/labimage.cc b/rtengine/labimage.cc index 4cd5ce31a..bcadda0ed 100644 --- a/rtengine/labimage.cc +++ b/rtengine/labimage.cc @@ -17,9 +17,11 @@ * along with RawTherapee. If not, see . */ -#include "labimage.h" +#include #include +#include "labimage.h" + namespace rtengine { From d1ba2091a0f548a1bb0cc4dbef5df5ee8559b1de Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 17:22:42 +0200 Subject: [PATCH 37/72] Make compilation unit rtengine/myfile.cc -Wextra clean, #4155 --- rtengine/myfile.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc index 903fd8354..920421188 100644 --- a/rtengine/myfile.cc +++ b/rtengine/myfile.cc @@ -33,6 +33,11 @@ #define PROT_READ 1 #define MAP_FAILED (void *)-1 +#ifdef __GNUC__ // silence warning +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + void* mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { HANDLE handle = CreateFileMapping((HANDLE)_get_osfhandle(fd), NULL, PAGE_WRITECOPY, 0, 0, NULL); @@ -51,6 +56,9 @@ int munmap(void *start, size_t length) UnmapViewOfFile(start); return 0; } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif #else // WIN32 From f3690d00ac52490495efde79a11a96852d8fded2 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 17:36:43 +0200 Subject: [PATCH 38/72] Make compilation unit rtengine/rtlensfun.cc -Wextra clean, #4155 --- rtengine/rtlensfun.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index ed19f44f0..29dfacb17 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -75,11 +75,19 @@ bool LFModifier::isCACorrectionAvailable() const return false; } +#ifdef __GNUC__ // silence warning, can be removed when function is implemented +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif void LFModifier::correctCA(double &x, double &y, int channel) const { } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + void LFModifier::processVignetteLine(int width, int y, float *line) const { From 2b2bbd69f4a7fbfd5279897e62af737958b35519 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 25 Oct 2017 19:07:38 +0200 Subject: [PATCH 39/72] Make compilation unit rtengine/iplab2rgb.cc -Wextra clean, #4155 --- rtengine/improcfun.h | 2 +- rtengine/iplab2rgb.cc | 2 +- rtengine/simpleprocess.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 37bbf61cf..5746ce285 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -348,7 +348,7 @@ public: void BadpixelsLab (LabImage * src, LabImage * dst, double radius, int thresh, int mode, float skinprot, float chrom); Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm); - Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool bw, GammaValues *ga = nullptr); + Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, GammaValues *ga = nullptr); // CieImage *ciec; bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr); diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index dac24411d..abef0a878 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -262,7 +262,7 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, * If a custom gamma profile can be created, divide by 327.68, convert to xyz and apply the custom gamma transform * otherwise divide by 327.68, convert to xyz and apply the sRGB transform, before converting with gamma2curve */ -Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool bw, GammaValues *ga) +Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, GammaValues *ga) { if (cx < 0) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 30d7a8ec7..056575be5 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1232,7 +1232,7 @@ private: GammaValues ga; // if(params.blackwhite.enabled) params.toneCurve.hrenabled=false; - readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, bwonly, &ga); + readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, &ga); customGamma = true; //or selected Free gamma @@ -1246,7 +1246,7 @@ private: // if Default gamma mode: we use the profile selected in the "Output profile" combobox; // gamma come from the selected profile, otherwise it comes from "Free gamma" tool - readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, bwonly); + readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm); if (settings->verbose) { printf ("Output profile_: \"%s\"\n", params.icm.output.c_str()); From a29287eaa08268b46e728d5e6d79bf81952ee6fe Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 26 Oct 2017 22:51:03 +0200 Subject: [PATCH 40/72] started working on enabling full support for CA correction with a lens profile --- rtengine/improcfun.h | 3 +- rtengine/iptransform.cc | 128 +++++++++++++++++++++++++--------------- 2 files changed, 82 insertions(+), 49 deletions(-) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 6c5ded3b6..3b835a124 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -57,7 +57,8 @@ class ImProcFunctions enum TransformMode { TRANSFORM_PREVIEW, TRANSFORM_HIGH_QUALITY, - TRANSFORM_HIGH_QUALITY_FULLIMAGE + TRANSFORM_HIGH_QUALITY_FULLIMAGE, + TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA }; void transformLuminanceOnly (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); void transformGeneral(TransformMode mode, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index d06872a64..5a50fafe9 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -315,7 +315,7 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, pLCPMap.reset( new LCPMapper (pLCPProf, focalLen, focalLen35mm, focusDist, fNumber, false, - params->lensProf.useDist, + false, oW, oH, params->coarse, rawRotationDeg ) ); @@ -326,12 +326,26 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, transformLuminanceOnly (original, transformed, cx, cy, oW, oH, fW, fH); } else { TransformMode mode; + std::unique_ptr tmpimg; if (!needsCA() && scale != 1) { mode = TRANSFORM_PREVIEW; } else if (!fullImage) { mode = TRANSFORM_HIGH_QUALITY; } else { mode = TRANSFORM_HIGH_QUALITY_FULLIMAGE; + // agriggio: CA correction via the lens profile has to be + // performed before all the other transformations (except for the + // coarse rotation/flipping). In order to not change the code too + // much, I simply introduced a new mode + // TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA, which applies *only* + // profile-based CA correction. So, the correction in this case + // occurs in two steps, using an intermediate temporary + // image. There's room for optimization of course... + if (pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()) { + tmpimg.reset(new Imagefloat(transformed->getWidth(), transformed->getHeight())); + transformGeneral(TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA, original, tmpimg.get(), cx, cy, sx, sy, oW, oH, fW, fH, pLCPMap.get()); + original = tmpimg.get(); + } } transformGeneral(mode, original, transformed, cx, cy, sx, sy, oW, oH, fW, fH, pLCPMap.get()); } @@ -725,21 +739,59 @@ void ImProcFunctions::transformLuminanceOnly (Imagefloat* original, Imagefloat* void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap) { + // set up stuff, depending on the mode we are + bool enableLCPDist = pLCPMap && params->lensProf.useDist; + bool enableLCPCA = pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable(); + bool enableCA = needsCA(); + bool enableGradient = needsGradient(); + bool enablePCVignetting = needsPCVignetting(); + bool enableVignetting = needsVignetting(); + bool enablePerspective = needsPerspective(); + bool enableDistortion = needsDistortion(); + + switch (mode) { + case ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA: + enableLCPDist = false; + enablePerspective = false; + enableDistortion = false; + enableGradient = false; + enableVignetting = false; + enablePCVignetting = false; + enableCA = false; + break; + case ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE: + enableLCPCA = false; + break; + case ImProcFunctions::TRANSFORM_HIGH_QUALITY: + if (enableLCPDist) { + enableLCPCA = false; + } + break; + case ImProcFunctions::TRANSFORM_PREVIEW: + enableLCPCA = false; + enableCA = false; + break; + } + + bool useCA = enableCA || enableLCPCA; + double w2 = (double) oW / 2.0 - 0.5; 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); + if (enableVignetting) { + calcVignettingParams (oW, oH, params->vignetting, vig_w2, vig_h2, maxRadius, v, b, mul); + } struct grad_params gp; - if (needsGradient()) { + if (enableGradient) { calcGradientParams (oW, oH, params->gradient, gp); } struct pcv_params pcv; - if (needsPCVignetting()) { + if (enablePCVignetting) { calcPCVignetteParams (fW, fH, oW, oH, params->pcvignette, params->crop, pcv); } @@ -755,12 +807,11 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag // auxiliary variables for c/a correction double chDist[3]; - chDist[0] = params->cacorrection.red; + chDist[0] = enableCA ? params->cacorrection.red : 0.0; chDist[1] = 0.0; - chDist[2] = params->cacorrection.blue; + chDist[2] = enableCA ? params->cacorrection.blue : 0.0; // auxiliary variables for distortion correction - bool needsDist = needsDistortion(); // for performance double distAmount = params->distortion.amount; // auxiliary variables for rotation @@ -781,39 +832,20 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag 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, pLCPMap) : 1.0; - - // smaller crop images are a problem, so only when processing fully - bool enableLCPCA = false; - bool enableLCPDist = false; - bool enableCA = false; - - switch (mode) { - case ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE: { - enableLCPCA = pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable(); - } - //no break on purpose - - case ImProcFunctions::TRANSFORM_HIGH_QUALITY: { - enableLCPDist = pLCPMap && params->lensProf.useDist; - enableCA = enableLCPCA || needsCA(); - } - //no break on purpose - - default: - case ImProcFunctions::TRANSFORM_PREVIEW: { - enableLCPDist = pLCPMap && params->lensProf.useDist; - break; - } + //double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, pLCPMap) : 1.0; + double ascale = 1.0; + if (mode != ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA && + params->commonTrans.autofill) { + ascale = getTransformAutoFill (oW, oH, pLCPMap); } - if (enableLCPCA) { - enableLCPDist = false; - } + // if (enableLCPCA) { + // enableLCPDist = false; + // } - if (!enableCA) { - chDist[0] = 0.0; - } + // if (!enableCA) { + // chDist[0] = 0.0; + // } // main cycle bool darkening = (params->vignetting.amount <= 0.0); @@ -835,12 +867,12 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag double vig_x_d = 0., vig_y_d = 0.; - if (needsVignetting()) { + if (enableVignetting) { vig_x_d = ascale * (x + cx - vig_w2); // centering x coord & scale vig_y_d = ascale * (y + cy - vig_h2); // centering y coord & scale } - if (needsPerspective()) { + if (enablePerspective) { // horizontal perspective transformation y_d *= maxRadius / (maxRadius + x_d * hptanpt); x_d *= maxRadius * hpcospt / (maxRadius + x_d * hptanpt); @@ -857,20 +889,20 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag // distortion correction double s = 1; - if (needsDist) { + if (enableDistortion) { double r = sqrt (Dxc * Dxc + Dyc * Dyc) / maxRadius; // sqrt is slow s = 1.0 - distAmount + distAmount * r ; } double r2 = 0.; - if (needsVignetting()) { + if (enableVignetting) { 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); } - for (int c = 0; c < (enableCA ? 3 : 1); c++) { + for (int c = 0; c < (useCA ? 3 : 1); c++) { double Dx = Dxc * (s + chDist[c]); double Dy = Dyc * (s + chDist[c]); @@ -897,7 +929,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag // multiplier for vignetting correction double vignmul = 1.0; - if (needsVignetting()) { + if (enableVignetting) { if (darkening) { vignmul /= std::max (v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001); } else { @@ -905,17 +937,17 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag } } - if (needsGradient()) { + if (enableGradient) { vignmul *= calcGradientFactor (gp, cx + x, cy + y); } - if (needsPCVignetting()) { + if (enablePCVignetting) { 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) { + if (useCA) { interpolateTransformChannelsCubic (chOrig[c], xc - 1, yc - 1, Dx, Dy, & (chTrans[c][y][x]), vignmul); } else if (mode == ImProcFunctions::TRANSFORM_PREVIEW) { 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); @@ -931,7 +963,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag int x1 = LIM (xc, 0, original->getWidth() - 1); int x2 = LIM (xc + 1, 0, original->getWidth() - 1); - if (enableCA) { + if (useCA) { 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); @@ -940,7 +972,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag } } } else { - if (enableCA) { + if (useCA) { // not valid (source pixel x,y not inside source image, etc.) chTrans[c][y][x] = 0; } else { From 830fd6fdbb3933a616cb0e2125f8055a3d2bbe4c Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 26 Oct 2017 23:55:52 +0200 Subject: [PATCH 41/72] added support for CA correction via lensfun Performance could be improved (see the comments marked "agriggio" in iptransform.cc and rtlensfun.cc) --- rtengine/rtlensfun.cc | 35 +++++++++++++++++++++++++++++++++-- rtengine/rtlensfun.h | 1 + rtgui/lensprofile.cc | 10 ++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index ed19f44f0..99315c20d 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -72,12 +72,29 @@ void LFModifier::correctDistortion(double &x, double &y, int cx, int cy, double bool LFModifier::isCACorrectionAvailable() const { - return false; + return (flags_ & LF_MODIFY_TCA); } void LFModifier::correctCA(double &x, double &y, int channel) const { + assert(channel >= 0 && channel <= 2); + + // agriggio: RT currently applies the CA correction per channel, whereas + // lensfun applies it to all the three channels simultaneously. This means + // we do the work 3 times, because each time we discard 2 of the 3 + // channels. We could consider caching the info to speed this up + + float pos[6]; + if (swap_xy_) { + std::swap(x, y); + } + data_->ApplySubpixelDistortion(x, y, 1, 1, pos); + x = pos[2*channel]; + y = pos[2*channel+1]; + if (swap_xy_) { + std::swap(x, y); + } } @@ -109,6 +126,11 @@ Glib::ustring LFModifier::getDisplayString() const ret += "vignetting"; sep = ", "; } + if (flags_ & LF_MODIFY_TCA) { + ret += sep; + ret += "CA"; + sep = ", "; + } if (flags_ & LF_MODIFY_SCALE) { ret += sep; ret += "autoscaling"; @@ -245,6 +267,15 @@ bool LFLens::hasDistortionCorrection() const } } +bool LFLens::hasCACorrection() const +{ + if (data_) { + return data_->CalibTCA; + } else { + return false; + } +} + //----------------------------------------------------------------------------- // LFDatabase @@ -428,7 +459,7 @@ std::unique_ptr LFDatabase::getModifier(const LFCamera &camera, cons if (data_) { if (camera && lens) { lfModifier *mod = lfModifier::Create(lens.data_, camera.getCropFactor(), width, height); - int flags = LF_MODIFY_DISTORTION | LF_MODIFY_SCALE; + int flags = LF_MODIFY_DISTORTION | LF_MODIFY_SCALE | LF_MODIFY_TCA; if (aperture > 0) { flags |= LF_MODIFY_VIGNETTING; } diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index 207e4e86e..ddc6d885a 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -90,6 +90,7 @@ public: float getCropFactor() const; bool hasVignettingCorrection() const; bool hasDistortionCorrection() const; + bool hasCACorrection() const; private: friend class LFDatabase; diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index 6415c1fce..d158f44f4 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -254,6 +254,16 @@ void LensProfilePanel::updateLensfunWarning() } ckbUseVign->set_sensitive(l.hasVignettingCorrection()); ckbUseDist->set_sensitive(l.hasDistortionCorrection()); + ckbUseCA->set_sensitive(l.hasCACorrection()); + if (!isRaw || !l.hasVignettingCorrection()) { + ckbUseVign->set_active(false); + } + if (!l.hasDistortionCorrection()) { + ckbUseDist->set_active(false); + } + if (!l.hasCACorrection()) { + ckbUseCA->set_active(false); + } } } From 5a05b04e0973feb28a5fac9e3abcd5b883fa7608 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 29 Oct 2017 21:41:19 +0100 Subject: [PATCH 42/72] profile-based CA correction applied during 1:1 preview --- rtengine/improcfun.h | 2 +- rtengine/iptransform.cc | 24 +++++++++++++----------- rtengine/lcp.cc | 8 +++++++- rtengine/lcp.h | 4 ++-- rtengine/rtlensfun.cc | 6 +++++- rtengine/rtlensfun.h | 2 +- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 3b835a124..699193632 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -58,7 +58,7 @@ class ImProcFunctions TRANSFORM_PREVIEW, TRANSFORM_HIGH_QUALITY, TRANSFORM_HIGH_QUALITY_FULLIMAGE, - TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA + TRANSFORM_HIGH_QUALITY_CA }; void transformLuminanceOnly (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); void transformGeneral(TransformMode mode, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 5a50fafe9..87ab7b922 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -329,21 +329,23 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, std::unique_ptr tmpimg; if (!needsCA() && scale != 1) { mode = TRANSFORM_PREVIEW; - } else if (!fullImage) { - mode = TRANSFORM_HIGH_QUALITY; } else { - mode = TRANSFORM_HIGH_QUALITY_FULLIMAGE; + if (!fullImage) { + mode = TRANSFORM_HIGH_QUALITY; + } else { + mode = TRANSFORM_HIGH_QUALITY_FULLIMAGE; + } // agriggio: CA correction via the lens profile has to be // performed before all the other transformations (except for the // coarse rotation/flipping). In order to not change the code too // much, I simply introduced a new mode - // TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA, which applies *only* + // TRANSFORM_HIGH_QUALITY_CA, which applies *only* // profile-based CA correction. So, the correction in this case // occurs in two steps, using an intermediate temporary // image. There's room for optimization of course... if (pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()) { - tmpimg.reset(new Imagefloat(transformed->getWidth(), transformed->getHeight())); - transformGeneral(TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA, original, tmpimg.get(), cx, cy, sx, sy, oW, oH, fW, fH, pLCPMap.get()); + tmpimg.reset(new Imagefloat(original->getWidth(), original->getHeight())); + transformGeneral(TRANSFORM_HIGH_QUALITY_CA, original, tmpimg.get(), 0, 0, 0, 0, fW, fH, fW, fH, pLCPMap.get()); original = tmpimg.get(); } } @@ -750,7 +752,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag bool enableDistortion = needsDistortion(); switch (mode) { - case ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA: + case ImProcFunctions::TRANSFORM_HIGH_QUALITY_CA: enableLCPDist = false; enablePerspective = false; enableDistortion = false; @@ -763,9 +765,9 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag enableLCPCA = false; break; case ImProcFunctions::TRANSFORM_HIGH_QUALITY: - if (enableLCPDist) { + // if (enableLCPDist) { enableLCPCA = false; - } + // } break; case ImProcFunctions::TRANSFORM_PREVIEW: enableLCPCA = false; @@ -834,7 +836,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag //double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, pLCPMap) : 1.0; double ascale = 1.0; - if (mode != ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE_CA && + if (mode != ImProcFunctions::TRANSFORM_HIGH_QUALITY_CA && params->commonTrans.autofill) { ascale = getTransformAutoFill (oW, oH, pLCPMap); } @@ -912,7 +914,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag // LCP CA if (enableLCPCA) { - pLCPMap->correctCA (Dx, Dy, c); + pLCPMap->correctCA (Dx, Dy, cx, cy, c); } // Extract integer and fractions of source screen coordinates diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index 3824d2b2f..44a470e17 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -1077,12 +1077,15 @@ void rtengine::LCPMapper::correctDistortion(double &x, double &y, int cx, int cy y -= cy * scale; } -void rtengine::LCPMapper::correctCA(double& x, double& y, int channel) const +void rtengine::LCPMapper::correctCA(double& x, double& y, int cx, int cy, int channel) const { if (!enableCA) { return; } + x += cx; + y += cy; + double xgreen, ygreen; // First calc the green channel like normal distortion @@ -1123,6 +1126,9 @@ void rtengine::LCPMapper::correctCA(double& x, double& y, int channel) const x = (chrom[channel].scale_factor * ( xd * commonSum + xfac * rsqr )) * chrom[channel].fx + chrom[channel].x0; y = (chrom[channel].scale_factor * ( yd * commonSum + yfac * rsqr )) * chrom[channel].fy + chrom[channel].y0; } + + x -= cx; + x -= cy; } SSEFUNCTION void rtengine::LCPMapper::processVignetteLine(int width, int y, float* line) const diff --git a/rtengine/lcp.h b/rtengine/lcp.h index 17eb892c8..b50fd335e 100644 --- a/rtengine/lcp.h +++ b/rtengine/lcp.h @@ -164,7 +164,7 @@ public: virtual ~LensCorrection() {} virtual void correctDistortion(double &x, double &y, int cx, int cy, double scale) const = 0; virtual bool isCACorrectionAvailable() const = 0; - virtual void correctCA(double &x, double &y, int channel) const = 0; + virtual void correctCA(double &x, double &y, int cx, int cy, int channel) const = 0; virtual void processVignetteLine(int width, int y, float *line) const = 0; virtual void processVignetteLine3Channels(int width, int y, float *line) const = 0; }; @@ -192,7 +192,7 @@ public: void correctDistortion(double &x, double &y, int cx, int cy, double scale) const; // MUST be the first stage bool isCACorrectionAvailable() const; - void correctCA(double& x, double& y, int channel) const; + void correctCA(double& x, double& y, int cx, int cy, int channel) const; void processVignetteLine(int width, int y, float* line) const; void processVignetteLine3Channels(int width, int y, float* line) const; diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index 99315c20d..cc4f6f53c 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -76,7 +76,7 @@ bool LFModifier::isCACorrectionAvailable() const } -void LFModifier::correctCA(double &x, double &y, int channel) const +void LFModifier::correctCA(double &x, double &y, int cx, int cy, int channel) const { assert(channel >= 0 && channel <= 2); @@ -84,6 +84,8 @@ void LFModifier::correctCA(double &x, double &y, int channel) const // lensfun applies it to all the three channels simultaneously. This means // we do the work 3 times, because each time we discard 2 of the 3 // channels. We could consider caching the info to speed this up + x += cx; + y += cy; float pos[6]; if (swap_xy_) { @@ -95,6 +97,8 @@ void LFModifier::correctCA(double &x, double &y, int channel) const if (swap_xy_) { std::swap(x, y); } + x -= cx; + y -= cy; } diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index ddc6d885a..60ef461c7 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -44,7 +44,7 @@ public: void correctDistortion(double &x, double &y, int cx, int cy, double scale) const override; bool isCACorrectionAvailable() const override; - void correctCA(double &x, double &y, int channel) const override; + void correctCA(double &x, double &y, int cx, int cy, int channel) const override; void processVignetteLine(int width, int y, float *line) const override; void processVignetteLine3Channels(int width, int y, float *line) const override; From dfff9812bfb9851f2fe80409e8f9ba6569c0784b Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 31 Oct 2017 00:51:01 +0100 Subject: [PATCH 43/72] improved profile-based CA correction in preview also cleaned up the code --- rtengine/improcfun.h | 9 +-- rtengine/iptransform.cc | 135 ++++++++++++++++++++++------------------ 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 699193632..7f9acc9e7 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -54,14 +54,9 @@ class ImProcFunctions void calcVignettingParams (int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul); - enum TransformMode { - TRANSFORM_PREVIEW, - TRANSFORM_HIGH_QUALITY, - TRANSFORM_HIGH_QUALITY_FULLIMAGE, - TRANSFORM_HIGH_QUALITY_CA - }; void transformLuminanceOnly (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); - void transformGeneral(TransformMode mode, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); + void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); + void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, int oW, int oH, const LensCorrection *pLCPMap); void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, int W, int H, const SharpeningParams &sharpenParam); void sharpenHaloCtrl (LabImage* lab, float** blurmap, float** base, int W, int H, SharpeningParams &sharpenParam); diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 87ab7b922..9871c7a57 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -325,16 +325,12 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, if (! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient())) { transformLuminanceOnly (original, transformed, cx, cy, oW, oH, fW, fH); } else { - TransformMode mode; + bool highQuality; std::unique_ptr tmpimg; if (!needsCA() && scale != 1) { - mode = TRANSFORM_PREVIEW; + highQuality = false; } else { - if (!fullImage) { - mode = TRANSFORM_HIGH_QUALITY; - } else { - mode = TRANSFORM_HIGH_QUALITY_FULLIMAGE; - } + highQuality = true; // agriggio: CA correction via the lens profile has to be // performed before all the other transformations (except for the // coarse rotation/flipping). In order to not change the code too @@ -345,14 +341,15 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, // image. There's room for optimization of course... if (pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()) { tmpimg.reset(new Imagefloat(original->getWidth(), original->getHeight())); - transformGeneral(TRANSFORM_HIGH_QUALITY_CA, original, tmpimg.get(), 0, 0, 0, 0, fW, fH, fW, fH, pLCPMap.get()); + transformLCPCAOnly(original, tmpimg.get(), cx, cy, oW, oH, pLCPMap.get()); original = tmpimg.get(); } } - transformGeneral(mode, original, transformed, cx, cy, sx, sy, oW, oH, fW, fH, pLCPMap.get()); + transformGeneral(highQuality, original, transformed, cx, cy, sx, sy, oW, oH, fW, fH, pLCPMap.get()); } } + // helper function void ImProcFunctions::calcVignettingParams (int oW, int oH, const VignettingParams& vignetting, double &w2, double &h2, double& maxRadius, double &v, double &b, double &mul) { @@ -739,44 +736,17 @@ void ImProcFunctions::transformLuminanceOnly (Imagefloat* original, Imagefloat* } -void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap) +void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap) { // set up stuff, depending on the mode we are bool enableLCPDist = pLCPMap && params->lensProf.useDist; - bool enableLCPCA = pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable(); - bool enableCA = needsCA(); + bool enableCA = highQuality && needsCA(); bool enableGradient = needsGradient(); bool enablePCVignetting = needsPCVignetting(); bool enableVignetting = needsVignetting(); bool enablePerspective = needsPerspective(); bool enableDistortion = needsDistortion(); - switch (mode) { - case ImProcFunctions::TRANSFORM_HIGH_QUALITY_CA: - enableLCPDist = false; - enablePerspective = false; - enableDistortion = false; - enableGradient = false; - enableVignetting = false; - enablePCVignetting = false; - enableCA = false; - break; - case ImProcFunctions::TRANSFORM_HIGH_QUALITY_FULLIMAGE: - enableLCPCA = false; - break; - case ImProcFunctions::TRANSFORM_HIGH_QUALITY: - // if (enableLCPDist) { - enableLCPCA = false; - // } - break; - case ImProcFunctions::TRANSFORM_PREVIEW: - enableLCPCA = false; - enableCA = false; - break; - } - - bool useCA = enableCA || enableLCPCA; - double w2 = (double) oW / 2.0 - 0.5; double h2 = (double) oH / 2.0 - 0.5; @@ -834,20 +804,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag 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, pLCPMap) : 1.0; - double ascale = 1.0; - if (mode != ImProcFunctions::TRANSFORM_HIGH_QUALITY_CA && - params->commonTrans.autofill) { - ascale = getTransformAutoFill (oW, oH, pLCPMap); - } - - // if (enableLCPCA) { - // enableLCPDist = false; - // } - - // if (!enableCA) { - // chDist[0] = 0.0; - // } + double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, pLCPMap) : 1.0; // main cycle bool darkening = (params->vignetting.amount <= 0.0); @@ -904,7 +861,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag r2 = sqrt (vig_Dx * vig_Dx + vig_Dy * vig_Dy); } - for (int c = 0; c < (useCA ? 3 : 1); c++) { + for (int c = 0; c < (enableCA ? 3 : 1); c++) { double Dx = Dxc * (s + chDist[c]); double Dy = Dyc * (s + chDist[c]); @@ -912,11 +869,6 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag Dx += w2; Dy += h2; - // LCP CA - if (enableLCPCA) { - pLCPMap->correctCA (Dx, Dy, cx, cy, c); - } - // Extract integer and fractions of source screen coordinates int xc = (int)Dx; Dx -= (double)xc; @@ -949,9 +901,9 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag if (yc > 0 && yc < original->getHeight() - 2 && xc > 0 && xc < original->getWidth() - 2) { // all interpolation pixels inside image - if (useCA) { + if (enableCA) { interpolateTransformChannelsCubic (chOrig[c], xc - 1, yc - 1, Dx, Dy, & (chTrans[c][y][x]), vignmul); - } else if (mode == ImProcFunctions::TRANSFORM_PREVIEW) { + } else if (!highQuality) { 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); @@ -965,7 +917,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag int x1 = LIM (xc, 0, original->getWidth() - 1); int x2 = LIM (xc + 1, 0, original->getWidth() - 1); - if (useCA) { + 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); @@ -974,7 +926,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag } } } else { - if (useCA) { + if (enableCA) { // not valid (source pixel x,y not inside source image, etc.) chTrans[c][y][x] = 0; } else { @@ -989,6 +941,65 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag } +void ImProcFunctions::transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, int oW, int oH, const LensCorrection *pLCPMap) +{ + assert(pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()); + + double w2 = (double) oW / 2.0 - 0.5; + double h2 = (double) oH / 2.0 - 0.5; + + float** chOrig[3]; + chOrig[0] = original->r.ptrs; + chOrig[1] = original->g.ptrs; + chOrig[2] = original->b.ptrs; + + float** chTrans[3]; + chTrans[0] = transformed->r.ptrs; + chTrans[1] = transformed->g.ptrs; + chTrans[2] = transformed->b.ptrs; + + #pragma omp parallel for if (multiThread) + + for (int y = 0; y < transformed->getHeight(); y++) { + for (int x = 0; x < transformed->getWidth(); x++) { + for (int c = 0; c < 3; c++) { + double Dx = x; + double Dy = y; + + pLCPMap->correctCA(Dx, Dy, cx, cy, c); + + // Extract integer and fractions of coordinates + int xc = (int)Dx; + Dx -= (double)xc; + int yc = (int)Dy; + Dy -= (double)yc; + + // Convert only valid pixels + if (yc >= 0 && yc < original->getHeight() && xc >= 0 && xc < original->getWidth()) { + + // multiplier for vignetting correction + if (yc > 0 && yc < original->getHeight() - 2 && xc > 0 && xc < original->getWidth() - 2) { + // all interpolation pixels inside image + interpolateTransformChannelsCubic (chOrig[c], xc - 1, yc - 1, Dx, Dy, & (chTrans[c][y][x]), 1.0); + } 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); + + chTrans[c][y][x] = (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 { + // not valid (source pixel x,y not inside source image, etc.) + chTrans[c][y][x] = 0; + } + } + } + } +} + + double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrection *pLCPMap) { if (!needsCA() && !needsDistortion() && !needsRotation() && !needsPerspective() && (!params->lensProf.useDist || pLCPMap == nullptr)) { From 770479f643e0dde2629d97917025bd17f0df4b02 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 31 Oct 2017 09:38:27 +0100 Subject: [PATCH 44/72] removed unused parameters from transformLCPCAOnly --- rtengine/improcfun.h | 2 +- rtengine/iptransform.cc | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 7f9acc9e7..136e9491b 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -56,7 +56,7 @@ class ImProcFunctions void transformLuminanceOnly (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int oW, int oH, int fW, int fH); void transformGeneral(bool highQuality, Imagefloat *original, Imagefloat *transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LensCorrection *pLCPMap); - void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, int oW, int oH, const LensCorrection *pLCPMap); + void transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap); void sharpenHaloCtrl (float** luminance, float** blurmap, float** base, int W, int H, const SharpeningParams &sharpenParam); void sharpenHaloCtrl (LabImage* lab, float** blurmap, float** base, int W, int H, SharpeningParams &sharpenParam); diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 9871c7a57..cb14727a9 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -341,7 +341,7 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, // image. There's room for optimization of course... if (pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()) { tmpimg.reset(new Imagefloat(original->getWidth(), original->getHeight())); - transformLCPCAOnly(original, tmpimg.get(), cx, cy, oW, oH, pLCPMap.get()); + transformLCPCAOnly(original, tmpimg.get(), cx, cy, pLCPMap.get()); original = tmpimg.get(); } } @@ -941,13 +941,10 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I } -void ImProcFunctions::transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, int oW, int oH, const LensCorrection *pLCPMap) +void ImProcFunctions::transformLCPCAOnly(Imagefloat *original, Imagefloat *transformed, int cx, int cy, const LensCorrection *pLCPMap) { assert(pLCPMap && params->lensProf.useCA && pLCPMap->isCACorrectionAvailable()); - double w2 = (double) oW / 2.0 - 0.5; - double h2 = (double) oH / 2.0 - 0.5; - float** chOrig[3]; chOrig[0] = original->r.ptrs; chOrig[1] = original->g.ptrs; From 2006a1755b49799f919a2242fbb46dcd5ee0b035 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 31 Oct 2017 10:49:40 +0100 Subject: [PATCH 45/72] fixed regression in ImProcFunctions::transformGeneral introduced by recent refactorings --- rtengine/iptransform.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index cb14727a9..4d71b236b 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -751,9 +751,7 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I double h2 = (double) oH / 2.0 - 0.5; double vig_w2, vig_h2, maxRadius, v, b, mul; - if (enableVignetting) { - 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; From d6a26f68122e86b99fbe9e34917a67ed8ecb12c2 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 1 Nov 2017 20:19:38 +0100 Subject: [PATCH 46/72] Fix a bug in Hasselblad decoder I introduced with my changes for phase one decoder --- rtengine/dcraw.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index bf46d0c91..9da4b151d 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2272,6 +2272,7 @@ void CLASS hasselblad_load_raw() FORC3 back[c] = back[4] + c*raw_width; cblack[6] >>= sh = tiff_samples > 1; shot = LIM(shot_select, 1, tiff_samples) - 1; + ph1_bithuff_t ph1_bithuff(this, ifp, order); for (row=0; row < raw_height; row++) { FORC4 back[(c+3) & 3] = back[c]; for (col=0; col < raw_width; col+=2) { From 6b001692605980f5191617b746a3956ae7400596 Mon Sep 17 00:00:00 2001 From: TooWaBoo Date: Sat, 4 Nov 2017 13:55:18 +0100 Subject: [PATCH 47/72] Update TooWaBlue theme to version 2.60 small cosmetic changes --- rtdata/themes/TooWaBlue-GTK3-20_.css | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rtdata/themes/TooWaBlue-GTK3-20_.css b/rtdata/themes/TooWaBlue-GTK3-20_.css index a22314c2e..1e196bff8 100644 --- a/rtdata/themes/TooWaBlue-GTK3-20_.css +++ b/rtdata/themes/TooWaBlue-GTK3-20_.css @@ -2,7 +2,7 @@ This file is part of RawTherapee. Copyright (c) 2016-2017 TooWaBoo - Version 2.59 + Version 2.60 RawTherapee is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -463,6 +463,9 @@ menu separator { background-color: @view-grid-border; margin: 0.33334em 0; } +#MyFileChooserButton separator { + background-color: transparent; +} #PlacesPaned .view.separator { color: @border-color; @@ -884,12 +887,15 @@ window.csd:not(.fullscreen) #MainNotebook > header.top { border-radius: 0; } +#MetaPanelNotebook > stack > box:nth-child(1) > :nth-child(1) { + border: 0.08334em solid @bg-dark-grey; +} #MetaPanelNotebook > stack > box:nth-child(2) > scrolledwindow scrolledwindow { background-color: @bg-dark-grey; padding: 0; margin: 0; } -#MetaPanelNotebook .view { +#MetaPanelNotebook > stack > box:nth-child(2) .view { border: 0.08334em solid @bg-dark-grey; padding: 0.16667em; margin: 0; @@ -1036,9 +1042,8 @@ window.csd:not(.fullscreen) #MainNotebook > header.top { } #EditorTopPanel > box:nth-child(9) > button.image-button { - min-width: 0; - padding-left: 0.25em; - padding-right: 0.25em; + min-width: 1.05em; + padding: 0; } /*Button editor bottom*/ From 2cdc5fc69ac281978da665e100abbfda6b6044ee Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 11 Nov 2017 16:18:38 +0100 Subject: [PATCH 48/72] move Fattal before transform --- rtengine/dcrop.cc | 83 ++++++++++++++++++++++++++--------- rtengine/improccoordinator.cc | 47 ++++++++++---------- rtengine/rtthumbnail.cc | 8 ++-- rtengine/simpleprocess.cc | 8 ++-- 4 files changed, 93 insertions(+), 53 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 41867d1c9..62f755aee 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -690,14 +690,46 @@ void Crop::update (int todo) // has to be called after setCropSizes! Tools prior to this point can't handle the Edit mechanism, but that shouldn't be a problem. createBuffer (cropw, croph); + std::unique_ptr fattalCrop; + bool need_cropping = false; + bool has_fattal = false; + + if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.fattal.enabled) { + has_fattal = true; + Imagefloat *f = baseCrop; + if (f == origCrop) { + fattalCrop.reset(baseCrop->copy()); + f = fattalCrop.get(); + } + parent->ipf.ToneMapFattal02(f); + need_cropping = (cropx || cropy || trafw != cropw || trafh != croph); + baseCrop = f; + } + // transform if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) { + int tx = cropx; + int ty = cropy; + int tw = cropw; + int th = croph; + + if (has_fattal) { + tx = 0; + ty = 0; + tw = trafw; + th = trafh; + if (transCrop) { + delete transCrop; + transCrop = nullptr; + } + } + if (!transCrop) { - transCrop = new Imagefloat (cropw, croph); + transCrop = new Imagefloat (tw, th); } if (needstransform) - parent->ipf.transform (baseCrop, transCrop, cropx / skip, cropy / skip, trafx / skip, trafy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), + parent->ipf.transform (baseCrop, transCrop, tx / skip, ty / skip, trafx / skip, trafy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), parent->imgsrc->getMetaData(), parent->imgsrc->getRotateDegree(), false); else { @@ -715,17 +747,28 @@ void Crop::update (int todo) transCrop = nullptr; } - std::unique_ptr fattalCrop; - if ((todo & M_RGBCURVE) && params.fattal.enabled) { - Imagefloat *f = baseCrop; - if (f == origCrop) { - fattalCrop.reset(baseCrop->copy()); - f = fattalCrop.get(); + if (need_cropping) { + Imagefloat *c = new Imagefloat(cropw, croph); + + int oy = skips(cropy, skip); + int ox = skips(cropx, skip); +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int y = 0; y < croph; ++y) { + int cy = y + oy; + for (int x = 0; x < cropw; ++x) { + int cx = x + ox; + c->r(y, x) = baseCrop->r(cy, cx); + c->g(y, x) = baseCrop->g(cy, cx); + c->b(y, x) = baseCrop->b(cy, cx); + } } - parent->ipf.ToneMapFattal02(f); - baseCrop = f; + fattalCrop.reset(c); + baseCrop = c; } + if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = baseCrop->getWidth(); @@ -1156,13 +1199,6 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte orw = bw; orh = bh; - if (check_need_full_image(parent->params)) { - orx = bx1 = 0; - ory = by1 = 0; - orw = bw = parent->fullw; - orh = bh = parent->fullh; - } - ProcParams& params = parent->params; parent->ipf.transCoord (parent->fw, parent->fh, bx1, by1, bw, bh, orx, ory, orw, orh); @@ -1202,6 +1238,16 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte orh = min (y2 - y1, parent->fh - ory); } + leftBorder = skips (rqx1 - bx1, skip); + upperBorder = skips (rqy1 - by1, skip); + + if (check_need_full_image(parent->params)) { + orx = 0; + ory = 0; + orw = parent->fullw; + orh = parent->fullh; + } + PreviewProps cp (orx, ory, orw, orh, skip); int orW, orH; parent->imgsrc->getSize (cp, orW, orH); @@ -1212,9 +1258,6 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte int cw = skips (bw, skip); int ch = skips (bh, skip); - leftBorder = skips (rqx1 - bx1, skip); - upperBorder = skips (rqy1 - by1, skip); - if (settings->verbose) { printf ("setsizes starts (%d, %d, %d, %d, %d, %d)\n", orW, orH, trafw, trafh, cw, ch); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index dffd9572e..f456cc4c6 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -385,36 +385,33 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) readyphase++; - progress ("Rotate / Distortion...", 100 * readyphase / numofphases); - // Remove transformation if unneeded - bool needstransform = ipf.needsTransform(); - - if (!needstransform && ! ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) && orig_prev != oprevi) { - delete oprevi; - oprevi = orig_prev; - } - - if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) ) { - if (!oprevi || oprevi == orig_prev) { - oprevi = new Imagefloat (pW, pH); - } - - if (needstransform) - ipf.transform (orig_prev, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, - imgsrc->getMetaData(), imgsrc->getRotateDegree(), false); - else { - orig_prev->copyData (oprevi); - } - } - - if ((todo & M_RGBCURVE) && params.fattal.enabled) { - Imagefloat *fattalprev = oprevi->copy(); + if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.fattal.enabled) { + Imagefloat *fattalprev = orig_prev->copy(); ipf.ToneMapFattal02(fattalprev); if (oprevi != orig_prev) { delete oprevi; } oprevi = fattalprev; - } + } else { + oprevi = orig_prev; + } + + progress ("Rotate / Distortion...", 100 * readyphase / numofphases); + // Remove transformation if unneeded + bool needstransform = ipf.needsTransform(); + + if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) ) { + assert(oprevi); + Imagefloat *op = oprevi; + oprevi = new Imagefloat (pW, pH); + + if (needstransform) + ipf.transform (op, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, + imgsrc->getMetaData(), imgsrc->getRotateDegree(), false); + else { + op->copyData (oprevi); + } + } if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = oprevi->getWidth(); diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index efe5d7868..0d5fcf574 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1090,6 +1090,10 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT ipf.firstAnalysis (baseImg, params, hist16); + if (params.fattal.enabled) { + ipf.ToneMapFattal02(baseImg); + } + // perform transform if (ipf.needsTransform()) { Imagefloat* trImg = new Imagefloat (fw, fh); @@ -1102,10 +1106,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT baseImg = trImg; } - if (params.fattal.enabled) { - ipf.ToneMapFattal02(baseImg); - } - // update blurmap SHMap* shmap = nullptr; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c8d45acf8..cb1ea9c45 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -810,6 +810,10 @@ private: ipf.firstAnalysis (baseImg, params, hist16); + if (params.fattal.enabled) { + ipf.ToneMapFattal02(baseImg); + } + // perform transform (excepted resizing) if (ipf.needsTransform()) { Imagefloat* trImg = nullptr; @@ -833,10 +837,6 @@ private: //ImProcFunctions ipf (¶ms, true); ImProcFunctions &ipf = * (ipf_p.get()); - if (params.fattal.enabled) { - ipf.ToneMapFattal02(baseImg); - } - if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = baseImg->getWidth(); const int H = baseImg->getHeight(); From 8fa477793defe51ff892a957c8d5740d9c60194c Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 11 Nov 2017 18:31:37 +0100 Subject: [PATCH 49/72] Speedup for initial thumb creation from raw files, fixes #4109 --- rtengine/rtthumbnail.cc | 242 ++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 143 deletions(-) diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 8398ea2d2..5572984f9 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -38,7 +38,6 @@ #include "improccoordinator.h" #include - namespace { @@ -659,69 +658,18 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati tpp->scale = (double) height / (rotate_90 ? w : h); } - // generate histogram for auto exposure + // generate histogram for auto exposure, also calculate autoWB tpp->aeHistCompression = 3; - tpp->aeHistogram (65536 >> tpp->aeHistCompression); + tpp->aeHistogram(65536 >> tpp->aeHistCompression); tpp->aeHistogram.clear(); - int radd = 4; - int gadd = 4; - int badd = 4; - if (!filter) { - radd = gadd = badd = 1; - } + const unsigned int add = filter ? 1 : 4 / ri->get_colors(); - for (int i = 8; i < height - 8; i++) { - int start, end; - - if (ri->get_FujiWidth() != 0) { - int fw = ri->get_FujiWidth(); - start = ABS (fw - i) + 8; - end = min (height + width - fw - i, fw + i) - 8; - } else { - start = 8; - end = width - 8; - } - - if (ri->get_colors() == 1) { - for (int j = start; j < end; j++) { - tpp->aeHistogram[ ((int) (image[i * width + j][0])) >> tpp->aeHistCompression] += radd; - tpp->aeHistogram[ ((int) (image[i * width + j][0])) >> tpp->aeHistCompression] += gadd; - tpp->aeHistogram[ ((int) (image[i * width + j][0])) >> tpp->aeHistCompression] += badd; - } - } else if (ri->getSensorType() == ST_BAYER) { - for (int j = start; j < end; j++) - if (FISGREEN (filter, i, j)) { - tpp->aeHistogram[ ((int) (tpp->camwbGreen * image[i * width + j][1])) >> tpp->aeHistCompression] += gadd; - } else if (FISRED (filter, i, j)) { - tpp->aeHistogram[ ((int) (tpp->camwbRed * image[i * width + j][0])) >> tpp->aeHistCompression] += radd; - } else if (FISBLUE (filter, i, j)) { - tpp->aeHistogram[ ((int) (tpp->camwbBlue * image[i * width + j][2])) >> tpp->aeHistCompression] += badd; - } - } else if (ri->getSensorType() == ST_FUJI_XTRANS) { - for (int j = start; j < end; j++) - if (ri->ISXTRANSGREEN (i, j)) { - tpp->aeHistogram[ ((int) (tpp->camwbGreen * image[i * width + j][1])) >> tpp->aeHistCompression] += gadd; - } else if (ri->ISXTRANSRED (i, j)) { - tpp->aeHistogram[ ((int) (tpp->camwbRed * image[i * width + j][0])) >> tpp->aeHistCompression] += radd; - } else if (ri->ISXTRANSBLUE (i, j)) { - tpp->aeHistogram[ ((int) (tpp->camwbBlue * image[i * width + j][2])) >> tpp->aeHistCompression] += badd; - } - } else { /* if(ri->getSensorType()==ST_FOVEON) */ - for (int j = start; j < end; j++) { - tpp->aeHistogram[ ((int) (image[i * width + j][0] * 2.f)) >> tpp->aeHistCompression] += radd; - tpp->aeHistogram[ ((int) (image[i * width + j][1])) >> tpp->aeHistCompression] += gadd; - tpp->aeHistogram[ ((int) (image[i * width + j][2] * 0.5f)) >> tpp->aeHistCompression] += badd; - } - } - } - - // generate autoWB - double avg_r = 0; - double avg_g = 0; - double avg_b = 0; - - unsigned int rn = 0, gn = 0, bn = 0; + double pixSum[3] = {0.0}; + unsigned int n[3] = {0}; + const double compression = pow(2.0, tpp->aeHistCompression); + const double camWb[3] = {tpp->camwbRed / compression, tpp->camwbGreen / compression, tpp->camwbBlue / compression}; + const double clipval = 64000.0 / tpp->defGain; for (int i = 32; i < height - 32; i++) { int start, end; @@ -735,110 +683,118 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati end = width - 32; } - if (ri->getSensorType() == ST_BAYER) { + if (ri->get_colors() == 1) { for (int j = start; j < end; j++) { - if (!filter) { - double d = tpp->defGain * image[i * width + j][0]; - - if (d > 64000.) { - continue; - } - - avg_g += d; - avg_r += d; - avg_b += d; - rn++; - gn++; - bn++; - } else if (FISGREEN (filter, i, j)) { - double d = tpp->defGain * image[i * width + j][1]; - - if (d > 64000.) { - continue; - } - - avg_g += d; - gn++; - } else if (FISRED (filter, i, j)) { - double d = tpp->defGain * image[i * width + j][0]; - - if (d > 64000.) { - continue; - } - - avg_r += d; - rn++; - } else if (FISBLUE (filter, i, j)) { - double d = tpp->defGain * image[i * width + j][2]; - - if (d > 64000.) { - continue; - } - - avg_b += d; - bn++; + tpp->aeHistogram[image[i * width + j][0] >> tpp->aeHistCompression]++; + } + } else if (ri->getSensorType() == ST_BAYER) { + int c0 = ri->FC(i, start); + int c1 = ri->FC(i, start + 1); + int j = start; + int n0 = 0; + int n1 = 0; + double pixSum0 = 0.0; + double pixSum1 = 0.0; + for (; j < end - 1; j+=2) { + double v0 = image[i * width + j][c0]; + tpp->aeHistogram[(int)(camWb[c0] * v0)]++; + if (v0 <= clipval) { + pixSum0 += v0; + n0++; + } + double v1 = image[i * width + j + 1][c1]; + tpp->aeHistogram[(int)(camWb[c1] * v1)]++; + if (v1 <= clipval) { + pixSum1 += v1; + n1++; } } + if (j < end) { + double v0 = image[i * width + j][c0]; + tpp->aeHistogram[(int)(camWb[c0] * v0)]++; + if (v0 <= clipval) { + pixSum0 += v0; + n0++; + } + } + n[c0] += n0; + n[c1] += n1; + pixSum[c0] += pixSum0; + pixSum[c1] += pixSum1; } else if (ri->getSensorType() == ST_FUJI_XTRANS) { - for (int j = start; j < end; j++) { + int c[6]; + for(int cc = 0; cc < 6; ++cc) { + c[cc] = ri->XTRANSFC(i, start + cc); + } + int j = start; + for (; j < end - 5; j += 6) { + for(int cc = 0; cc < 6; ++cc) { + double d = image[i * width + j + cc][c[cc]]; + tpp->aeHistogram[(int)(camWb[c[cc]] * d)]++; + if (d <= clipval) { + pixSum[c[cc]] += d; + n[c[cc]]++; + } + } + } + for (; j < end; j++) { if (ri->ISXTRANSGREEN (i, j)) { - double d = tpp->defGain * image[i * width + j][1]; - - if (d > 64000.) { - continue; + double d = image[i * width + j][1]; + tpp->aeHistogram[(int)(camWb[1] * d)]++; + if (d <= clipval) { + pixSum[1] += d; + n[1]++; } - - avg_g += d; - gn++; } else if (ri->ISXTRANSRED (i, j)) { - double d = tpp->defGain * image[i * width + j][0]; - - if (d > 64000.) { - continue; + double d = image[i * width + j][0]; + tpp->aeHistogram[(int)(camWb[0] * d)]++; + if (d <= clipval) { + pixSum[0] += d; + n[0]++; } - - avg_r += d; - rn++; } else if (ri->ISXTRANSBLUE (i, j)) { - double d = tpp->defGain * image[i * width + j][2]; - - if (d > 64000.) { - continue; + double d = image[i * width + j][2]; + tpp->aeHistogram[(int)(camWb[2] * d)]++; + if (d <= clipval) { + pixSum[2] += d; + n[2]++; } - - avg_b += d; - bn++; } } } else { /* if(ri->getSensorType()==ST_FOVEON) */ for (int j = start; j < end; j++) { - double d = tpp->defGain * image[i * width + j][0]; - - if (d <= 64000.) { - avg_r += d; - rn++; + double r = image[i * width + j][0]; + if (r <= clipval) { + pixSum[0] += r; + n[0]++; } - - d = tpp->defGain * image[i * width + j][1]; - - if (d <= 64000.) { - avg_g += d; - gn++; + double g = image[i * width + j][1]; + if (g <= clipval) { + pixSum[1] += g; + n[1]++; } - - d = tpp->defGain * image[i * width + j][2]; - - if (d <= 64000.) { - avg_b += d; - bn++; + tpp->aeHistogram[((int)g) >> tpp->aeHistCompression] += add; + double b = image[i * width + j][2]; + if (b <= clipval) { + pixSum[2] += b; + n[2]++; } + tpp->aeHistogram[((int) (b * 0.5f)) >> tpp->aeHistCompression] += add; } } } - double reds = avg_r / std::max(rn, 1u) * tpp->camwbRed; - double greens = avg_g / std::max(gn, 1u) * tpp->camwbGreen; - double blues = avg_b / std::max(bn, 1u) * tpp->camwbBlue; + if (ri->get_colors() == 1) { + pixSum[0] = pixSum[1] = pixSum[2] = 1.; + n[0] = n[1] = n[2] = 1; + } + pixSum[0] *= tpp->defGain; + pixSum[1] *= tpp->defGain; + pixSum[2] *= tpp->defGain; + + double reds = pixSum[0] / std::max(n[0], 1u) * tpp->camwbRed; + double greens = pixSum[1] / std::max(n[1], 1u) * tpp->camwbGreen; + double blues = pixSum[2] / std::max(n[2], 1u) * tpp->camwbBlue; tpp->redAWBMul = ri->get_rgb_cam (0, 0) * reds + ri->get_rgb_cam (0, 1) * greens + ri->get_rgb_cam (0, 2) * blues; tpp->greenAWBMul = ri->get_rgb_cam (1, 0) * reds + ri->get_rgb_cam (1, 1) * greens + ri->get_rgb_cam (1, 2) * blues; From 4754d5a6cc7721a3e0c882dfc631801cb0129aab Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 11 Nov 2017 18:48:44 +0100 Subject: [PATCH 50/72] Speedup for loading of Phase One files, fixes #4050 --- rtengine/dcraw.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ddbe6103b..b5d769fde 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -25,8 +25,6 @@ /*RT*/#include "jpeg.h" #include "opthelper.h" -#define BENCHMARK -#include "StopWatch.h" /* dcraw.c -- Dave Coffin's raw photo decoder @@ -1501,7 +1499,6 @@ void CLASS phase_one_flat_field (int is_float, int nc) void CLASS phase_one_correct() { -BENCHFUN unsigned entries, tag, data, save, col, row, type; int len, i, j, k, cip, val[4], dev[4], sum, max; int head[9], diff, mindiff=INT_MAX, off_412=0; @@ -1784,7 +1781,6 @@ inline unsigned CLASS ph1_bithuff_t::operator() () #ifndef MYFILE_MMAP void CLASS phase_one_load_raw_c() { - BENCHFUN static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; int *offset, len[2], pred[2], row, col, i, j; ushort *pixel; @@ -1839,7 +1835,6 @@ void CLASS phase_one_load_raw_c() #else void CLASS phase_one_load_raw_c() { -BENCHFUN static const int length[] = { 8,7,6,9,11,10,5,12,14,13 }; int *offset = (int *)calloc(raw_width * 2 + raw_height * 4, 2); From bd9592cb1f200f9463fb56261e85b6baf6783662 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 12 Nov 2017 13:42:25 +0100 Subject: [PATCH 51/72] Fix two warnings when using gcc < 7 --- rtengine/cJSON.c | 4 ++-- rtengine/iptransform.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/cJSON.c b/rtengine/cJSON.c index bf46c98c4..8e9cdcccf 100644 --- a/rtengine/cJSON.c +++ b/rtengine/cJSON.c @@ -191,7 +191,7 @@ static const char *parse_string(cJSON *item,const char *str) len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len; -#ifdef __GNUC__ // silence warning +#if defined( __GNUC__ ) && __GNUC__ >= 7// silence warning #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #endif @@ -203,7 +203,7 @@ static const char *parse_string(cJSON *item,const char *str) case 1: *--ptr2 =(uc | firstByteMark[len]); } -#ifdef __GNUC__ +#if defined( __GNUC__ ) && __GNUC__ >= 7 #pragma GCC diagnostic pop #endif ptr2+=len; diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index bfdf484d3..d73dc8ac0 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -788,7 +788,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag bool enableLCPDist = false; bool enableCA = false; -#ifdef __GNUC__ // silence warning +#if defined( __GNUC__ ) && __GNUC__ >= 7// silence warning #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #endif @@ -810,7 +810,7 @@ void ImProcFunctions::transformGeneral(ImProcFunctions::TransformMode mode, Imag break; } } -#ifdef __GNUC__ +#if defined( __GNUC__ ) && __GNUC__ >= 7 #pragma GCC diagnostic pop #endif From 46e4dece2e4dab0dbb82c906501a3919e44f02ed Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 13 Nov 2017 09:51:21 -0800 Subject: [PATCH 52/72] Enable detection of non-Apple clang Clang features Ups macOS cmake requirement to 3.3 and sets policy 25, to differentiate compiler features between AppleClang and plain ole' clang. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 490cfa7ca..32921dcae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ if(WIN32) cmake_minimum_required(VERSION 2.8.4) +elseif(APPLE) + cmake_minimum_required(VERSION 3.3) + CMAKE_POLICY(SET CMP0025 NEW) else() cmake_minimum_required(VERSION 2.6) endif() From 7507b74d6fe0668343732b6c468b5fd5b1ba5a6d Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 Nov 2017 18:56:18 +0100 Subject: [PATCH 53/72] explicitly set -ftree-vectorize to get auto vectorizations even for builds using -o2 instead of -o3 (some distros do that for whatever reason) --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 490cfa7ca..dffefbc25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,8 @@ set(CACHE_NAME_SUFFIX "" CACHE STRING "RawTherapee's cache folder suffix") set(PROC_TARGET_NUMBER 0 CACHE STRING "Selected target processor from the list above (taken from ProcessorTargets.cmake)") # Set special compilation flags for rtengine which get added to CMAKE_CXX_FLAGS: -set(RTENGINE_CXX_FLAGS "" CACHE STRING "Special compilation flags for RTEngine") +# Some Linux distros build with -O2 instead of -O3. We explicitly enable auto vectorization by using -ftree-vectorize +set(RTENGINE_CXX_FLAGS "-ftree-vectorize" CACHE STRING "Special compilation flags for RTEngine") # Loads the ProcessorTargets list: include(ProcessorTargets.cmake) From 0efee599a1e7f4b4bc04017594aec5324fb68a2f Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 Nov 2017 18:57:44 +0100 Subject: [PATCH 54/72] Fix bugs I introduced with the speedup for Phase One decoder --- rtengine/dcraw.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index b5d769fde..8da29761f 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1906,9 +1906,6 @@ void CLASS phase_one_load_raw_c() } else { pixel = pred[col & 1] += ph1_bits(i) + 1 - (1 << (i - 1)); } - if (UNLIKELY(pixel >> 16)) { - derror(); - } if (ph1.format == 5 && pixel < 256) { pixel = curve[pixel]; } @@ -3261,6 +3258,7 @@ void CLASS samsung_load_raw() int row, col, c, i, dir, op[4], len[4]; order = 0x4949; + ph1_bithuff_t ph1_bithuff(this, ifp, order); for (row=0; row < raw_height; row++) { fseek (ifp, strip_offset+row*4, SEEK_SET); fseek (ifp, data_offset+get4(), SEEK_SET); @@ -3318,6 +3316,7 @@ void CLASS samsung3_load_raw() fseek (ifp, 9, SEEK_CUR); opt = fgetc(ifp); init = (get2(),get2()); + ph1_bithuff_t ph1_bithuff(this, ifp, order); for (row=0; row < raw_height; row++) { fseek (ifp, (data_offset-ftell(ifp)) & 15, SEEK_CUR); hb_bits(-1); From 99f41baf4f0d6ae8adb59b44b7efa8200d486c1d Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 14 Nov 2017 22:52:57 +0100 Subject: [PATCH 55/72] disable LCP-based CA correction, as it is currently broken --- rtengine/lcp.cc | 2 +- rtgui/lensprofile.cc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index 44a470e17..cd338258f 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -1023,7 +1023,7 @@ rtengine::LCPMapper::LCPMapper( bool rtengine::LCPMapper::isCACorrectionAvailable() const { - return enableCA; + return false /*enableCA*/; // agriggio TODO -- this is currently broken } void rtengine::LCPMapper::correctDistortion(double &x, double &y, int cx, int cy, double scale) const diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index d158f44f4..d96d65cb6 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -192,7 +192,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa ckbUseDist->set_active (pp->lensProf.useDist); ckbUseVign->set_active (pp->lensProf.useVign && isRaw); - ckbUseCA->set_active (pp->lensProf.useCA && isRaw); + ckbUseCA->set_active(pp->lensProf.useCA && isRaw && ckbUseCA->get_sensitive()); const LFDatabase *db = LFDatabase::getInstance(); LFCamera c; @@ -380,7 +380,8 @@ void LensProfilePanel::updateDisabled(bool enable) { ckbUseDist->set_sensitive(enable); ckbUseVign->set_sensitive(enable && isRaw); - ckbUseCA->set_sensitive(enable && allowFocusDep); + // agriggio TODO -- CA correction via LCP is currently broken + ckbUseCA->set_sensitive(false);//enable && allowFocusDep); } void LensProfilePanel::setBatchMode(bool yes) From 18f775d805ec349a1a95ff397b0baf50bcadef05 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 15 Nov 2017 00:54:05 +0100 Subject: [PATCH 56/72] review of ph1_bithuff --- rtengine/dcraw.cc | 3 ++- rtengine/dcraw.h | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 8da29761f..e0ef59c9b 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1802,6 +1802,7 @@ void CLASS phase_one_load_raw_c() read_shorts ((ushort *) rblack[0], raw_width*2); for (i=0; i < 256; i++) curve[i] = i*i / 3.969 + 0.5; + ph1_bithuff_t ph1_bithuff(this, ifp, order); for (row=0; row < raw_height; row++) { fseek (ifp, data_offset + offset[row], SEEK_SET); ph1_init(); @@ -2258,13 +2259,13 @@ void CLASS hasselblad_load_raw() if (!ljpeg_start (&jh, 0)) return; order = 0x4949; + ph1_bithuff_t ph1_bithuff(this, ifp, order); hb_bits(-1); back[4] = (int *) calloc (raw_width, 3*sizeof **back); merror (back[4], "hasselblad_load_raw()"); FORC3 back[c] = back[4] + c*raw_width; cblack[6] >>= sh = tiff_samples > 1; shot = LIM(shot_select, 1, tiff_samples) - 1; - ph1_bithuff_t ph1_bithuff(this, ifp, order); for (row=0; row < raw_height; row++) { FORC4 back[(c+3) & 3] = back[c]; for (col=0; col < raw_width; col+=2) { diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index f30c0c6f1..0a3316d63 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -59,7 +59,6 @@ public: ,RT_blacklevel_from_constant(0) ,RT_matrix_from_constant(0) ,getbithuff(this,ifp,zero_after_ff) - ,ph1_bithuff(this,ifp,order) ,pana_bits(ifp,load_flags) { memset(&hbd, 0, sizeof(hbd)); @@ -316,7 +315,7 @@ void parse_qt (int end); // ph1_bithuff(int nbits, ushort *huff); class ph1_bithuff_t { public: - ph1_bithuff_t(DCraw *p,IMFILE *i,short &o):parent(p),order(o),ifp(i),bitbuf(0),vbits(0){} + ph1_bithuff_t(DCraw *p, IMFILE *i, short &o):parent(p),order(o),ifp(i),bitbuf(0),vbits(0){} unsigned operator()(int nbits, ushort *huff); unsigned operator()(int nbits); unsigned operator()(); @@ -355,7 +354,6 @@ private: UINT64 bitbuf; int vbits; }; -ph1_bithuff_t ph1_bithuff; void phase_one_load_raw_c(); void hasselblad_correct(); From 76ac9b02880765dfc7b21d98265923706f3a4de4 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 15 Nov 2017 14:56:57 +0100 Subject: [PATCH 57/72] =?UTF-8?q?Fix=20for=20ph1=5Fbithuff=5Ft,=20thanks?= =?UTF-8?q?=20to=20Fl=C3=B6ssie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtengine/dcraw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 0a3316d63..2c47ee7e5 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -350,7 +350,7 @@ private: DCraw *parent; short ℴ - IMFILE *&ifp; + IMFILE* const ifp; UINT64 bitbuf; int vbits; }; From 652044e863635281c95db9a85817fc39bbd88950 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 15 Nov 2017 22:33:06 +0100 Subject: [PATCH 58/72] Don't create panasonic bithuff when panasonic_load_raw() is not used --- rtengine/dcraw.cc | 1 + rtengine/dcraw.h | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index e0ef59c9b..b7e6fd82f 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2492,6 +2492,7 @@ unsigned CLASS pana_bits_t::operator() (int nbits) void CLASS panasonic_load_raw() { + pana_bits_t pana_bits(ifp,load_flags); int row, col, i, j, sh=0, pred[2], nonz[2]; pana_bits(0); diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 2c47ee7e5..cc1f36484 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -59,7 +59,6 @@ public: ,RT_blacklevel_from_constant(0) ,RT_matrix_from_constant(0) ,getbithuff(this,ifp,zero_after_ff) - ,pana_bits(ifp,load_flags) { memset(&hbd, 0, sizeof(hbd)); aber[0]=aber[1]=aber[2]=aber[3]=1; @@ -68,7 +67,6 @@ public: greybox[0]=greybox[1]=0; greybox[2]=greybox[3]= UINT_MAX; } - //int main (int argc, const char **argv); protected: int exif_base, ciff_base, ciff_len; IMFILE *ifp; @@ -366,18 +364,16 @@ void imacon_full_load_raw(); void packed_load_raw(); void nokia_load_raw(); -// pana_bits(int nbits); class pana_bits_t{ public: - pana_bits_t(IMFILE *&i,unsigned &u):ifp(i),load_flags(u),vbits(0){} + pana_bits_t(IMFILE *i, unsigned &u): ifp(i), load_flags(u), vbits(0) {} unsigned operator()(int nbits); private: - IMFILE *&ifp; + IMFILE *ifp; unsigned &load_flags; uchar buf[0x4000]; int vbits; }; -pana_bits_t pana_bits; void canon_rmf_load_raw(); void panasonic_load_raw(); From 619b3e9c6370ffb2689bb144ae40e4c50bcb0864 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 16 Nov 2017 17:35:21 +0100 Subject: [PATCH 59/72] fixed off-by-one error leading to segfault --- rtengine/dcrop.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 62f755aee..0fe9402f1 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -750,8 +750,8 @@ void Crop::update (int todo) if (need_cropping) { Imagefloat *c = new Imagefloat(cropw, croph); - int oy = skips(cropy, skip); - int ox = skips(cropx, skip); + int oy = cropy / skip; + int ox = cropx / skip; #ifdef _OPENMP #pragma omp parallel for #endif From 339c7943598775371efd7d17eb538635c30047db Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 16 Nov 2017 21:22:17 +0100 Subject: [PATCH 60/72] Fixed bug (typo) in LCP-based CA correction (now reenabled) --- rtengine/lcp.cc | 4 ++-- rtgui/lensprofile.cc | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index cd338258f..834fc65c3 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -1023,7 +1023,7 @@ rtengine::LCPMapper::LCPMapper( bool rtengine::LCPMapper::isCACorrectionAvailable() const { - return false /*enableCA*/; // agriggio TODO -- this is currently broken + return enableCA; } void rtengine::LCPMapper::correctDistortion(double &x, double &y, int cx, int cy, double scale) const @@ -1128,7 +1128,7 @@ void rtengine::LCPMapper::correctCA(double& x, double& y, int cx, int cy, int ch } x -= cx; - x -= cy; + y -= cy; } SSEFUNCTION void rtengine::LCPMapper::processVignetteLine(int width, int y, float* line) const diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index b9ec44d7c..f5c9a11ab 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -380,8 +380,7 @@ void LensProfilePanel::updateDisabled(bool enable) { ckbUseDist->set_sensitive(enable); ckbUseVign->set_sensitive(enable && isRaw); - // agriggio TODO -- CA correction via LCP is currently broken - ckbUseCA->set_sensitive(false);//enable && allowFocusDep); + ckbUseCA->set_sensitive(enable && allowFocusDep); } void LensProfilePanel::setBatchMode(bool yes) From b25bac8c532844961225467d4baf7ad1ad6cd62e Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Nov 2017 15:27:56 +0100 Subject: [PATCH 61/72] improved performance of Fattal in dcrop Now only Fattal works on the full image, the rest of the pipeline (including denoising) always operates only on the visible crop --- rtengine/dcrop.cc | 116 +++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 0fe9402f1..4cf98859e 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -691,45 +691,79 @@ void Crop::update (int todo) createBuffer (cropw, croph); std::unique_ptr fattalCrop; - bool need_cropping = false; - bool has_fattal = false; - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.fattal.enabled) { - has_fattal = true; Imagefloat *f = baseCrop; + int fw = skips(parent->fw, skip); + int fh = skips(parent->fh, skip); + bool need_cropping = false; + + if (cropx || cropy || trafw != fw || trafh != fh) { + need_cropping = true; + // fattal needs to work on the full image. So here we get the full + // image from imgsrc, and replace the denoised crop in case + f = new Imagefloat(fw, fh); + PreviewProps pp (0, 0, parent->fw, parent->fh, skip); + int tr = getCoarseBitMask(params.coarse); + parent->imgsrc->getImage(parent->currWB, tr, f, pp, params.toneCurve, params.icm, params.raw); + parent->imgsrc->convertColorSpace(f, params.icm, parent->currWB); + + if (params.dirpyrDenoise.enabled) { + // copy the denoised crop + int oy = cropy / skip; + int ox = cropx / skip; +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int y = 0; y < baseCrop->getHeight(); ++y) { + int dy = oy + y; + for (int x = 0; x < baseCrop->getWidth(); ++x) { + int dx = ox + x; + f->r(dy, dx) = baseCrop->r(y, x); + f->g(dy, dx) = baseCrop->g(y, x); + f->b(dy, dx) = baseCrop->b(y, x); + } + } + } + } if (f == origCrop) { fattalCrop.reset(baseCrop->copy()); f = fattalCrop.get(); } parent->ipf.ToneMapFattal02(f); - need_cropping = (cropx || cropy || trafw != cropw || trafh != croph); - baseCrop = f; + + // crop back to the size expected by the rest of the pipeline + if (need_cropping) { + Imagefloat *c = new Imagefloat(cropw, croph); + + int oy = cropy / skip; + int ox = cropx / skip; +#ifdef _OPENMP +#pragma omp parallel for +#endif + for (int y = 0; y < croph; ++y) { + int cy = y + oy; + for (int x = 0; x < cropw; ++x) { + int cx = x + ox; + c->r(y, x) = f->r(cy, cx); + c->g(y, x) = f->g(cy, cx); + c->b(y, x) = f->b(cy, cx); + } + } + fattalCrop.reset(c); + baseCrop = c; + } else { + baseCrop = f; + } } // transform if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) { - int tx = cropx; - int ty = cropy; - int tw = cropw; - int th = croph; - - if (has_fattal) { - tx = 0; - ty = 0; - tw = trafw; - th = trafh; - if (transCrop) { - delete transCrop; - transCrop = nullptr; - } - } - if (!transCrop) { - transCrop = new Imagefloat (tw, th); + transCrop = new Imagefloat (cropw, croph); } if (needstransform) - parent->ipf.transform (baseCrop, transCrop, tx / skip, ty / skip, trafx / skip, trafy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), + parent->ipf.transform (baseCrop, transCrop, cropx / skip, cropy / skip, trafx / skip, trafy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), parent->imgsrc->getMetaData(), parent->imgsrc->getRotateDegree(), false); else { @@ -747,28 +781,6 @@ void Crop::update (int todo) transCrop = nullptr; } - if (need_cropping) { - Imagefloat *c = new Imagefloat(cropw, croph); - - int oy = cropy / skip; - int ox = cropx / skip; -#ifdef _OPENMP - #pragma omp parallel for -#endif - for (int y = 0; y < croph; ++y) { - int cy = y + oy; - for (int x = 0; x < cropw; ++x) { - int cx = x + ox; - c->r(y, x) = baseCrop->r(cy, cx); - c->g(y, x) = baseCrop->g(cy, cx); - c->b(y, x) = baseCrop->b(cy, cx); - } - } - fattalCrop.reset(c); - baseCrop = c; - } - - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = baseCrop->getWidth(); @@ -1131,11 +1143,6 @@ void Crop::freeAll () namespace { -bool check_need_full_image(const ProcParams ¶ms) -{ - return params.fattal.enabled; // agriggio - maybe we can do this for wavelets too? -} - bool check_need_larger_crop_for_lcp_distortion (int fw, int fh, int x, int y, int w, int h, const ProcParams ¶ms) { if (x == 0 && y == 0 && w == fw && h == fh) { @@ -1241,13 +1248,6 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte leftBorder = skips (rqx1 - bx1, skip); upperBorder = skips (rqy1 - by1, skip); - if (check_need_full_image(parent->params)) { - orx = 0; - ory = 0; - orw = parent->fullw; - orh = parent->fullh; - } - PreviewProps cp (orx, ory, orw, orh, skip); int orW, orH; parent->imgsrc->getSize (cp, orW, orH); From 1467b858c5e009ac66b66dc34d9b6ff6ff5f06b1 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Nov 2017 15:34:48 +0100 Subject: [PATCH 62/72] fixed missing memory deallocation --- rtengine/dcrop.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 4cf98859e..c8baf42df 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -702,6 +702,7 @@ void Crop::update (int todo) // fattal needs to work on the full image. So here we get the full // image from imgsrc, and replace the denoised crop in case f = new Imagefloat(fw, fh); + fattalCrop.reset(f); PreviewProps pp (0, 0, parent->fw, parent->fh, skip); int tr = getCoarseBitMask(params.coarse); parent->imgsrc->getImage(parent->currWB, tr, f, pp, params.toneCurve, params.icm, params.raw); From 071e19bfd971caaf7372244bfb7f41a5164210ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Fri, 17 Nov 2017 16:43:17 +0100 Subject: [PATCH 63/72] Don't access `job` in `BatchQueue::saveBatchQueue()` (fixes #4183) --- rtgui/batchqueue.cc | 2 +- rtgui/batchqueueentry.cc | 17 +++++++++++++---- rtgui/batchqueueentry.h | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 3d773d874..c2f4e860c 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -248,7 +248,7 @@ bool BatchQueue::saveBatchQueue () << saveFormat.pngBits << '|' << saveFormat.pngCompression << '|' << saveFormat.tiffBits << '|' << saveFormat.tiffUncompressed << '|' << saveFormat.saveParams << '|' << entry->forceFormatOpts << '|' - << entry->job->fastPipeline() << '|' + << entry->fast_pipeline << '|' << std::endl; } } diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index 8386a8ee6..98c21f160 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -29,10 +29,19 @@ bool BatchQueueEntry::iconsLoaded(false); Glib::RefPtr 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), params(pparams), progress(0), outFileName(""), sequence(0), forceFormatOpts(false) +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), + params(pparams), + progress(0), + outFileName(""), + sequence(0), + forceFormatOpts(false), + fast_pipeline(job->fastPipeline()) { thumbnail = thm; diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index 384e12e80..caf1b8eff 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -53,6 +53,7 @@ public: int sequence; SaveFormat saveFormat; bool forceFormatOpts; + bool fast_pipeline; BatchQueueEntry (rtengine::ProcessingJob* job, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm = nullptr); ~BatchQueueEntry (); From 6212d6e0c6366df28296a042bdd547126a4ab3b7 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Nov 2017 17:46:13 +0100 Subject: [PATCH 64/72] better (local) caching of fattal results in dcrop Use new M_HDR todo code instead of using M_RGBCURVE for fattal (ported from Hombre's commit a9d02a7dca0b5dcd31f642046d94e1663b17c9ff) --- rtengine/dcrop.cc | 17 ++++-------- rtengine/improccoordinator.cc | 11 +++----- rtengine/refreshmap.cc | 6 ++-- rtengine/refreshmap.h | 52 ++++++++++++++++++----------------- 4 files changed, 40 insertions(+), 46 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index c8baf42df..c6b888a08 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -168,7 +168,7 @@ void Crop::update (int todo) bool needstransform = parent->ipf.needsTransform(); - if (todo & (M_INIT | M_LINDENOISE)) { + if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { MyMutex::MyLock lock (parent->minit); // Also used in improccoord int tr = getCoarseBitMask (params.coarse); @@ -691,8 +691,8 @@ void Crop::update (int todo) createBuffer (cropw, croph); std::unique_ptr fattalCrop; - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.fattal.enabled) { - Imagefloat *f = baseCrop; + if ((todo & M_HDR) && params.fattal.enabled) { + Imagefloat *f = origCrop; int fw = skips(parent->fw, skip); int fh = skips(parent->fh, skip); bool need_cropping = false; @@ -726,18 +726,14 @@ void Crop::update (int todo) } } } - if (f == origCrop) { - fattalCrop.reset(baseCrop->copy()); - f = fattalCrop.get(); - } parent->ipf.ToneMapFattal02(f); // crop back to the size expected by the rest of the pipeline if (need_cropping) { - Imagefloat *c = new Imagefloat(cropw, croph); + Imagefloat *c = origCrop; - int oy = cropy / skip; - int ox = cropx / skip; + int oy = trafy / skip; + int ox = trafx / skip; #ifdef _OPENMP #pragma omp parallel for #endif @@ -750,7 +746,6 @@ void Crop::update (int todo) c->b(y, x) = f->b(cy, cx); } } - fattalCrop.reset(c); baseCrop = c; } else { baseCrop = f; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index f456cc4c6..9172fbf96 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -280,7 +280,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - if (todo & (M_INIT | M_LINDENOISE)) { + if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { MyMutex::MyLock initLock (minit); // Also used in crop window imgsrc->HLRecovery_Global ( params.toneCurve); // this handles Color HLRecovery @@ -385,16 +385,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) readyphase++; - if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.fattal.enabled) { - Imagefloat *fattalprev = orig_prev->copy(); - ipf.ToneMapFattal02(fattalprev); + if ((todo & M_HDR) && params.fattal.enabled) { + ipf.ToneMapFattal02(orig_prev); if (oprevi != orig_prev) { delete oprevi; } - oprevi = fattalprev; - } else { - oprevi = orig_prev; } + oprevi = orig_prev; progress ("Rotate / Distortion...", 100 * readyphase / numofphases); // Remove transformation if unneeded diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index fa6b52c4e..c95b53c0a 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -514,9 +514,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DARKFRAME, // EvLensCorrMode DARKFRAME, // EvLensCorrLensfunCamera DARKFRAME, // EvLensCorrLensfunLens - RGBCURVE, // EvTMFattalEnabled - RGBCURVE, // EvTMFattalThreshold - RGBCURVE // EvTMFattalAmount + ALLNORAW, // EvTMFattalEnabled + HDR, // EvTMFattalThreshold + HDR // EvTMFattalAmount }; diff --git a/rtengine/refreshmap.h b/rtengine/refreshmap.h index e262c9394..cea6b3c8e 100644 --- a/rtengine/refreshmap.h +++ b/rtengine/refreshmap.h @@ -20,22 +20,23 @@ #define __REFRESHMAP__ // Use M_VOID if you wish to update the proc params without updating the preview at all ! -#define M_VOID (1<<16) +#define M_VOID (1<<17) // Use M_MINUPDATE if you wish to update the preview without modifying the image (think about it like a "refreshPreview") // Must NOT be used with other event (i.e. will be used for MINUPDATE only) -#define M_MINUPDATE (1<<15) +#define M_MINUPDATE (1<<16) // Force high quality -#define M_HIGHQUAL (1<<14) +#define M_HIGHQUAL (1<<15) // Elementary functions that can be done to // the preview image when an event occurs -#define M_MONITOR (1<<13) -#define M_RETINEX (1<<12) -#define M_CROP (1<<11) -#define M_PREPROC (1<<10) -#define M_RAW (1<<9) -#define M_INIT (1<<8) -#define M_LINDENOISE (1<<7) +#define M_MONITOR (1<<14) +#define M_RETINEX (1<<13) +#define M_CROP (1<<12) +#define M_PREPROC (1<<11) +#define M_RAW (1<<10) +#define M_INIT (1<<9) +#define M_LINDENOISE (1<<8) +#define M_HDR (1<<7) #define M_TRANSFORM (1<<6) #define M_BLURMAP (1<<5) #define M_AUTOEXP (1<<4) @@ -46,21 +47,22 @@ // Bitfield of functions to do to the preview image when an event occurs // Use those or create new ones for your new events -#define FIRST (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR|M_MONITOR) // without HIGHQUAL -#define ALL (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) // without HIGHQUAL -#define DARKFRAME (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define FLATFIELD (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define DEMOSAIC (M_RAW|M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define ALLNORAW (M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define TRANSFORM (M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define AUTOEXP (M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define RGBCURVE (M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define LUMINANCECURVE (M_LUMACURVE|M_LUMINANCE|M_COLOR) -#define SHARPENING (M_LUMINANCE|M_COLOR) -#define IMPULSEDENOISE (M_LUMINANCE|M_COLOR) -#define DEFRINGE (M_LUMINANCE|M_COLOR) -#define DIRPYRDENOISE (M_LUMINANCE|M_COLOR) -#define DIRPYREQUALIZER (M_LUMINANCE|M_COLOR) +#define FIRST (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR|M_MONITOR) // without HIGHQUAL +#define ALL (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) // without HIGHQUAL +#define DARKFRAME (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define FLATFIELD (M_PREPROC|M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define DEMOSAIC (M_RAW|M_INIT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define ALLNORAW (M_INIT|M_LINDENOISE|M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define HDR (M_HDR|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define TRANSFORM (M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define AUTOEXP (M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define RGBCURVE (M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define LUMINANCECURVE (M_LUMACURVE|M_LUMINANCE|M_COLOR) +#define SHARPENING (M_LUMINANCE|M_COLOR) +#define IMPULSEDENOISE (M_LUMINANCE|M_COLOR) +#define DEFRINGE (M_LUMINANCE|M_COLOR) +#define DIRPYRDENOISE (M_LUMINANCE|M_COLOR) +#define DIRPYREQUALIZER (M_LUMINANCE|M_COLOR) #define GAMMA M_MONITOR #define CROP M_CROP #define RESIZE M_VOID From 7b9252be3363a930b3308d510cd1923a49aefcc3 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Nov 2017 21:02:19 +0100 Subject: [PATCH 65/72] fattal: correctly crop the image to the dimensions required for distortion correction Fix for #4187 --- rtengine/dcrop.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index c6b888a08..71030f35b 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -697,7 +697,7 @@ void Crop::update (int todo) int fh = skips(parent->fh, skip); bool need_cropping = false; - if (cropx || cropy || trafw != fw || trafh != fh) { + if (trafx || trafy || trafw != fw || trafh != fh) { need_cropping = true; // fattal needs to work on the full image. So here we get the full // image from imgsrc, and replace the denoised crop in case @@ -710,8 +710,8 @@ void Crop::update (int todo) if (params.dirpyrDenoise.enabled) { // copy the denoised crop - int oy = cropy / skip; - int ox = cropx / skip; + int oy = trafy / skip; + int ox = trafx / skip; #ifdef _OPENMP #pragma omp parallel for #endif @@ -737,9 +737,9 @@ void Crop::update (int todo) #ifdef _OPENMP #pragma omp parallel for #endif - for (int y = 0; y < croph; ++y) { + for (int y = 0; y < trafh; ++y) { int cy = y + oy; - for (int x = 0; x < cropw; ++x) { + for (int x = 0; x < trafw; ++x) { int cx = x + ox; c->r(y, x) = f->r(cy, cx); c->g(y, x) = f->g(cy, cx); From e384edba55bf9c9700aa425cbf8e6e284af4a793 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Nov 2017 21:28:17 +0100 Subject: [PATCH 66/72] fattal: use a common cache for 1:1 detail crops when denoise is turned off --- rtengine/dcrop.cc | 51 +++++++++++++++++++++-------------- rtengine/improccoordinator.cc | 10 ++++++- rtengine/improccoordinator.h | 1 + 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 71030f35b..513039ad6 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -696,37 +696,48 @@ void Crop::update (int todo) int fw = skips(parent->fw, skip); int fh = skips(parent->fh, skip); bool need_cropping = false; + bool need_fattal = true; if (trafx || trafy || trafw != fw || trafh != fh) { need_cropping = true; // fattal needs to work on the full image. So here we get the full // image from imgsrc, and replace the denoised crop in case - f = new Imagefloat(fw, fh); - fattalCrop.reset(f); - PreviewProps pp (0, 0, parent->fw, parent->fh, skip); - int tr = getCoarseBitMask(params.coarse); - parent->imgsrc->getImage(parent->currWB, tr, f, pp, params.toneCurve, params.icm, params.raw); - parent->imgsrc->convertColorSpace(f, params.icm, parent->currWB); + if (!params.dirpyrDenoise.enabled && skip == 1 && parent->fattal_11_dcrop_cache) { + f = parent->fattal_11_dcrop_cache; + need_fattal = false; + } else { + f = new Imagefloat(fw, fh); + fattalCrop.reset(f); + PreviewProps pp (0, 0, parent->fw, parent->fh, skip); + int tr = getCoarseBitMask(params.coarse); + parent->imgsrc->getImage(parent->currWB, tr, f, pp, params.toneCurve, params.icm, params.raw); + parent->imgsrc->convertColorSpace(f, params.icm, parent->currWB); - if (params.dirpyrDenoise.enabled) { - // copy the denoised crop - int oy = trafy / skip; - int ox = trafx / skip; + if (params.dirpyrDenoise.enabled) { + // copy the denoised crop + int oy = trafy / skip; + int ox = trafx / skip; #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int y = 0; y < baseCrop->getHeight(); ++y) { - int dy = oy + y; - for (int x = 0; x < baseCrop->getWidth(); ++x) { - int dx = ox + x; - f->r(dy, dx) = baseCrop->r(y, x); - f->g(dy, dx) = baseCrop->g(y, x); - f->b(dy, dx) = baseCrop->b(y, x); + for (int y = 0; y < baseCrop->getHeight(); ++y) { + int dy = oy + y; + for (int x = 0; x < baseCrop->getWidth(); ++x) { + int dx = ox + x; + f->r(dy, dx) = baseCrop->r(y, x); + f->g(dy, dx) = baseCrop->g(y, x); + f->b(dy, dx) = baseCrop->b(y, x); + } } + } else if (skip == 1) { + parent->fattal_11_dcrop_cache = f; // cache this globally + fattalCrop.release(); } } } - parent->ipf.ToneMapFattal02(f); + if (need_fattal) { + parent->ipf.ToneMapFattal02(f); + } // crop back to the size expected by the rest of the pipeline if (need_cropping) { @@ -735,7 +746,7 @@ void Crop::update (int todo) int oy = trafy / skip; int ox = trafx / skip; #ifdef _OPENMP -#pragma omp parallel for + #pragma omp parallel for #endif for (int y = 0; y < trafh; ++y) { int cy = y + oy; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 9172fbf96..532068eee 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -33,7 +33,7 @@ namespace rtengine extern const Settings* settings; ImProcCoordinator::ImProcCoordinator () - : orig_prev (nullptr), oprevi (nullptr), oprevl (nullptr), nprevl (nullptr), previmg (nullptr), workimg (nullptr), + : orig_prev (nullptr), oprevi (nullptr), oprevl (nullptr), nprevl (nullptr), fattal_11_dcrop_cache(nullptr), previmg (nullptr), workimg (nullptr), ncie (nullptr), imgsrc (nullptr), shmap (nullptr), lastAwbEqual (0.), lastAwbTempBias (0.0), ipf (¶ms, true), monitorIntent (RI_RELATIVE), softProof (false), gamutCheck (false), scale (10), highDetailPreprocessComputed (false), highDetailRawComputed (false), allocated (false), bwAutoR (-9000.f), bwAutoG (-9000.f), bwAutoB (-9000.f), CAMMean (NAN), @@ -111,6 +111,10 @@ ImProcCoordinator::~ImProcCoordinator () mProcessing.lock(); mProcessing.unlock(); freeAll (); + if (fattal_11_dcrop_cache) { + delete fattal_11_dcrop_cache; + fattal_11_dcrop_cache = nullptr; + } std::vector toDel = crops; @@ -386,6 +390,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) readyphase++; if ((todo & M_HDR) && params.fattal.enabled) { + if (fattal_11_dcrop_cache) { + delete fattal_11_dcrop_cache; + fattal_11_dcrop_cache = nullptr; + } ipf.ToneMapFattal02(orig_prev); if (oprevi != orig_prev) { delete oprevi; diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 41b901e93..2f5fe52e5 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -57,6 +57,7 @@ protected: Imagefloat *oprevi; LabImage *oprevl; LabImage *nprevl; + Imagefloat *fattal_11_dcrop_cache; // global cache for ToneMapFattal02 used in 1:1 detail windows (except when denoise is active) Image8 *previmg; // displayed image in monitor color space, showing the output profile as well (soft-proofing enabled, which then correspond to workimg) or not Image8 *workimg; // internal image in output color space for analysis CieImage *ncie; From 4d81812d137213a6b71bed64aa5aa57601960246 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Nov 2017 23:38:27 +0100 Subject: [PATCH 67/72] LCP: applied fix by @kznsq for LCP files with attributes in a "PerspectiveModel" tag (issue #4137) --- rtengine/lcp.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index 834fc65c3..15e68d9f1 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -797,12 +797,12 @@ void XMLCALL rtengine::LCPProfile::XmlStartHandler(void* pLCPProfile, const char if (src_str == "PerspectiveModel") { pProf->firstLIDone = true; pProf->inPerspect = true; - return; + parseAttr = true; } else if (src_str == "FisheyeModel") { pProf->firstLIDone = true; pProf->inPerspect = true; pProf->isFisheye = true; // just misses third param, and different path, rest is the same - return; + parseAttr = true; } else if (src_str == "Description") { parseAttr = true; } From 5ddd42f7214e520e4188dadcb6afa8324c7907c7 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 18 Nov 2017 12:56:37 +0100 Subject: [PATCH 68/72] Faster png save with still good compression, fixes #4045 --- rtdata/languages/default | 1 - rtengine/iimage.h | 2 +- rtengine/image16.h | 4 ++-- rtengine/image8.h | 4 ++-- rtengine/imagefloat.h | 4 ++-- rtengine/imageio.cc | 6 ++++-- rtengine/imageio.h | 2 +- rtgui/batchqueue.cc | 6 ++---- rtgui/batchqueueentry.cc | 2 -- rtgui/editorpanel.cc | 4 ++-- rtgui/main-cli.cc | 4 ++-- rtgui/options.cc | 12 ------------ rtgui/options.h | 2 -- rtgui/saveformatpanel.cc | 16 ---------------- rtgui/saveformatpanel.h | 1 - 15 files changed, 18 insertions(+), 52 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index f610a03bc..84037a6a6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1194,7 +1194,6 @@ SAVEDLG_AUTOSUFFIX;Automatically add a suffix if the file already exists SAVEDLG_FILEFORMAT;File format SAVEDLG_FORCEFORMATOPTS;Force saving options SAVEDLG_JPEGQUAL;JPEG quality -SAVEDLG_PNGCOMPR;PNG compression SAVEDLG_PUTTOQUEUE;Put into processing queue SAVEDLG_PUTTOQUEUEHEAD;Put to the head of the processing queue SAVEDLG_PUTTOQUEUETAIL;Put to the end of the processing queue diff --git a/rtengine/iimage.h b/rtengine/iimage.h index e2cd6b951..0a73a87cc 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -1751,7 +1751,7 @@ public: * @param compression is the amount of compression (0-6), -1 corresponds to the default * @param bps can be 8 or 16 depending on the bits per pixels the output file will have @return the error code, 0 if none */ - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) = 0; + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) = 0; /** @brief Saves the image to file in a jpg format. * @param fname is the name of the file * @param quality is the quality of the jpeg (0...100), set it to -1 to use default diff --git a/rtengine/image16.h b/rtengine/image16.h index 0612dc614..4d74dfbc4 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -75,9 +75,9 @@ public: { return save (fname); } - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) { - return savePNG (fname, compression, bps); + return savePNG (fname, bps); } virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3) { diff --git a/rtengine/image8.h b/rtengine/image8.h index d0d7445e0..c4651a07d 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -70,9 +70,9 @@ public: { return save (fname); } - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) { - return savePNG (fname, compression, bps); + return savePNG (fname, bps); } virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3) { diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index 1083ac609..7348588df 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -79,9 +79,9 @@ public: { return save (fname); } - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) { - return savePNG (fname, compression, bps); + return savePNG (fname, bps); } virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3) { diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 01bbddf13..ff9c9b559 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -905,7 +905,7 @@ int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s return IMIO_SUCCESS; } -int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps) +int ImageIO::savePNG (Glib::ustring fname, volatile int bps) { if (getWidth() < 1 || getHeight() < 1) { return IMIO_HEADERERROR; @@ -945,7 +945,9 @@ int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps) png_set_write_fn (png, file, png_write_data, png_flush); - png_set_compression_level(png, compression); + png_set_filter(png, 0, PNG_FILTER_PAETH); + png_set_compression_level(png, 6); + png_set_compression_strategy(png, 3); int width = getWidth (); int height = getHeight (); diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 372f42380..4c0cd56c5 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -136,7 +136,7 @@ public: int loadJPEGFromMemory (const char* buffer, int bufsize); int loadPPMFromMemory(const char* buffer, int width, int height, bool swap, int bps); - int savePNG (Glib::ustring fname, int compression = -1, volatile int bps = -1); + int savePNG (Glib::ustring fname, volatile int bps = -1); int saveJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3); int saveTIFF (Glib::ustring fname, int bps = -1, bool uncompressed = false); diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index c2f4e860c..43ee5d79d 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -245,7 +245,7 @@ bool BatchQueue::saveBatchQueue () file << entry->filename << '|' << entry->savedParamsFile << '|' << entry->outFileName << '|' << saveFormat.format << '|' #endif << saveFormat.jpegQuality << '|' << saveFormat.jpegSubSamp << '|' - << saveFormat.pngBits << '|' << saveFormat.pngCompression << '|' + << saveFormat.pngBits << '|' << saveFormat.tiffBits << '|' << saveFormat.tiffUncompressed << '|' << saveFormat.saveParams << '|' << entry->forceFormatOpts << '|' << entry->fast_pipeline << '|' @@ -310,7 +310,6 @@ bool BatchQueue::loadBatchQueue () const auto jpegQuality = nextIntOr (options.saveFormat.jpegQuality); const auto jpegSubSamp = nextIntOr (options.saveFormat.jpegSubSamp); const auto pngBits = nextIntOr (options.saveFormat.pngBits); - const auto pngCompression = nextIntOr (options.saveFormat.pngCompression); const auto tiffBits = nextIntOr (options.saveFormat.tiffBits); const auto tiffUncompressed = nextIntOr (options.saveFormat.tiffUncompressed); const auto saveParams = nextIntOr (options.saveFormat.saveParams); @@ -352,7 +351,6 @@ bool BatchQueue::loadBatchQueue () saveFormat.jpegQuality = jpegQuality; saveFormat.jpegSubSamp = jpegSubSamp; saveFormat.pngBits = pngBits; - saveFormat.pngCompression = pngCompression; saveFormat.tiffBits = tiffBits; saveFormat.tiffUncompressed = tiffUncompressed != 0; saveFormat.saveParams = saveParams != 0; @@ -612,7 +610,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) if (saveFormat.format == "tif") { err = img->saveAsTIFF (fname, saveFormat.tiffBits, saveFormat.tiffUncompressed); } else if (saveFormat.format == "png") { - err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits); + err = img->saveAsPNG (fname, saveFormat.pngBits); } else if (saveFormat.format == "jpg") { err = img->saveAsJPEG (fname, saveFormat.jpegQuality, saveFormat.jpegSubSamp); } diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index 98c21f160..3092d6db4 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -186,8 +186,6 @@ Glib::ustring BatchQueueEntry::getToolTip (int x, int y) saveFormat.jpegSubSamp == 1 ? M("SAVEDLG_SUBSAMP_1") : saveFormat.jpegSubSamp == 2 ? M("SAVEDLG_SUBSAMP_2") : M("SAVEDLG_SUBSAMP_3")); - } else if (saveFormat.format == "png") { - tooltip += Glib::ustring::compose("\n%1: %2", M("SAVEDLG_PNGCOMPR"), saveFormat.pngCompression); } else if (saveFormat.format == "tif") { if (saveFormat.tiffUncompressed) { tooltip += Glib::ustring::compose("\n%1", M("SAVEDLG_TIFFUNCOMPRESSED")); diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index f5c6aa679..c2bec8692 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1767,7 +1767,7 @@ bool EditorPanel::idle_saveImage (ProgressConnector *pc, Gl ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsTIFF), fname, sf.tiffBits, sf.tiffUncompressed), sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf, pparams)); else if (sf.format == "png") - ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsPNG), fname, sf.pngCompression, sf.pngBits), + ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsPNG), fname, sf.pngBits), sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf, pparams)); else if (sf.format == "jpg") ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsJPEG), fname, sf.jpegQuality, sf.jpegSubSamp), @@ -1982,7 +1982,7 @@ bool EditorPanel::saveImmediately (const Glib::ustring &filename, const SaveForm if (sf.format == "tif") { err = img->saveAsTIFF (filename, sf.tiffBits, sf.tiffUncompressed); } else if (sf.format == "png") { - err = img->saveAsPNG (filename, sf.pngCompression, sf.pngBits); + err = img->saveAsPNG (filename, sf.pngBits); } else if (sf.format == "jpg") { err = img->saveAsJPEG (filename, sf.jpegQuality, sf.jpegSubSamp); } else { diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index 76ed84489..1d1917e8c 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -611,7 +611,7 @@ int processLineParams ( int argc, char **argv ) std::cout << " -t[z] Specify output to be TIFF." << std::endl; std::cout << " Uncompressed by default, or deflate compression with 'z'." << std::endl; std::cout << " -n Specify output to be compressed PNG." << std::endl; - std::cout << " Compression is hard-coded to 6." << std::endl; + std::cout << " Compression is hard-coded to PNG_FILTER_PAETH, Z_RLE" << std::endl; std::cout << " -Y Overwrite output if present." << std::endl; std::cout << " -f Use the custom fast-export processing pipeline." << std::endl; std::cout << std::endl; @@ -837,7 +837,7 @@ int processLineParams ( int argc, char **argv ) } else if ( outputType == "tif" ) { errorCode = resultImage->saveAsTIFF ( outputFile, bits, compression == 0 ); } else if ( outputType == "png" ) { - errorCode = resultImage->saveAsPNG ( outputFile, compression, bits ); + errorCode = resultImage->saveAsPNG ( outputFile, bits ); } else { errorCode = resultImage->saveToFile (outputFile); } diff --git a/rtgui/options.cc b/rtgui/options.cc index 3906a293d..d1b91c3ac 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -309,7 +309,6 @@ void Options::setDefaults () saveFormat.format = "jpg"; saveFormat.jpegQuality = 92; saveFormat.jpegSubSamp = 2; - saveFormat.pngCompression = 6; saveFormat.pngBits = 8; saveFormat.tiffBits = 16; saveFormat.tiffUncompressed = true; @@ -318,7 +317,6 @@ void Options::setDefaults () saveFormatBatch.format = "jpg"; saveFormatBatch.jpegQuality = 92; saveFormatBatch.jpegSubSamp = 2; - saveFormatBatch.pngCompression = 6; saveFormatBatch.pngBits = 8; saveFormatBatch.tiffBits = 16; saveFormatBatch.tiffUncompressed = true; @@ -790,10 +788,6 @@ void Options::readFromFile (Glib::ustring fname) saveFormat.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSamp"); } - if (keyFile.has_key ("Output", "PngCompression")) { - saveFormat.pngCompression = keyFile.get_integer ("Output", "PngCompression"); - } - if (keyFile.has_key ("Output", "PngBps")) { saveFormat.pngBits = keyFile.get_integer ("Output", "PngBps"); } @@ -823,10 +817,6 @@ void Options::readFromFile (Glib::ustring fname) saveFormatBatch.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSampBatch"); } - if (keyFile.has_key ("Output", "PngCompressionBatch")) { - saveFormatBatch.pngCompression = keyFile.get_integer ("Output", "PngCompressionBatch"); - } - if (keyFile.has_key ("Output", "PngBpsBatch")) { saveFormatBatch.pngBits = keyFile.get_integer ("Output", "PngBpsBatch"); } @@ -1927,7 +1917,6 @@ void Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Output", "Format", saveFormat.format); keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); @@ -1936,7 +1925,6 @@ void Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format); keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality); keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression); keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits); keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits); keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed); diff --git a/rtgui/options.h b/rtgui/options.h index 5bf77fa65..947d3b615 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -47,7 +47,6 @@ struct SaveFormat { SaveFormat() : format ("jpg"), pngBits (8), - pngCompression (6), jpegQuality (90), jpegSubSamp (2), tiffBits (8), @@ -58,7 +57,6 @@ struct SaveFormat { Glib::ustring format; int pngBits; - int pngCompression; int jpegQuality; int jpegSubSamp; // 1=best compression, 3=best quality int tiffBits; diff --git a/rtgui/saveformatpanel.cc b/rtgui/saveformatpanel.cc index cc4088741..13e687595 100644 --- a/rtgui/saveformatpanel.cc +++ b/rtgui/saveformatpanel.cc @@ -82,15 +82,6 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr) jpegOpts->attach(*jpegSubSamp, 1, 1, 1, 1); jpegOpts->show_all (); - // --------------------- PNG OPTIONS - - - pngCompr = new Adjuster (M("SAVEDLG_PNGCOMPR"), 0, 6, 1, 6); - setExpandAlignProperties(pngCompr, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); - pngCompr->setAdjusterListener (this); - pngCompr->show_all (); - - // --------------------- TIFF OPTIONS @@ -113,13 +104,11 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr) attach (*hb1, 0, 0, 1, 1); attach (*jpegOpts, 0, 1, 1, 1); attach (*tiffUncompressed, 0, 2, 1, 1); - attach (*pngCompr, 0, 3, 1, 1); attach (*savesPP, 0, 4, 1, 2); } SaveFormatPanel::~SaveFormatPanel () { delete jpegQual; - delete pngCompr; delete tiffUncompressed; } @@ -143,7 +132,6 @@ void SaveFormatPanel::init (SaveFormat &sf) jpegSubSamp->set_active (sf.jpegSubSamp - 1); - pngCompr->setValue (sf.pngCompression); jpegQual->setValue (sf.jpegQuality); savesPP->set_active (sf.saveParams); tiffUncompressed->set_active (sf.tiffUncompressed); @@ -170,7 +158,6 @@ SaveFormat SaveFormatPanel::getFormat () sf.tiffBits = 8; } - sf.pngCompression = (int) pngCompr->getValue (); sf.jpegQuality = (int) jpegQual->getValue (); sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1; sf.tiffUncompressed = tiffUncompressed->get_active(); @@ -192,15 +179,12 @@ void SaveFormatPanel::formatChanged () if (fr == "jpg") { jpegOpts->show_all(); tiffUncompressed->hide(); - pngCompr->hide(); } else if (fr == "png") { jpegOpts->hide(); tiffUncompressed->hide(); - pngCompr->show_all(); } else if (fr == "tif") { jpegOpts->hide(); tiffUncompressed->show_all(); - pngCompr->hide(); } if (listener) { diff --git a/rtgui/saveformatpanel.h b/rtgui/saveformatpanel.h index c71759399..76ae7055d 100644 --- a/rtgui/saveformatpanel.h +++ b/rtgui/saveformatpanel.h @@ -37,7 +37,6 @@ class SaveFormatPanel : public Gtk::Grid, public AdjusterListener protected: Adjuster* jpegQual; - Adjuster* pngCompr; Gtk::CheckButton* tiffUncompressed; MyComboBoxText* format; MyComboBoxText* jpegSubSamp; From e9d30532654055f1c6cc289c52092812920cae13 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 18 Nov 2017 17:03:57 +0100 Subject: [PATCH 69/72] run tmo_fattal02.cc through astyle --- rtengine/tmo_fattal02.cc | 1311 ++++++++++++++++++++------------------ 1 file changed, 683 insertions(+), 628 deletions(-) diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index d537cce3f..6e4b45ccb 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -3,7 +3,7 @@ * This file is part of RawTherapee. * * Ported from LuminanceHDR by Alberto Griggio - * + * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -73,7 +73,8 @@ #include "StopWatch.h" #include "sleef.c" #include "opthelper.h" -namespace rtengine { +namespace rtengine +{ /****************************************************************************** * RT code @@ -84,66 +85,68 @@ extern MyMutex *fftwMutex; using namespace std; -namespace { +namespace +{ -class Array2Df: public array2D { +class Array2Df: public array2D +{ typedef array2D Super; public: Array2Df(): Super() {} - Array2Df(int w, int h): Super(w, h) {} + Array2Df (int w, int h): Super (w, h) {} - float &operator()(int w, int h) + float &operator() (int w, int h) { return (*this)[h][w]; } - const float &operator()(int w, int h) const + const float &operator() (int w, int h) const { return (*this)[h][w]; } - float &operator()(int i) + float &operator() (int i) { - return static_cast(*this)[i]; + return static_cast (*this)[i]; } - const float &operator()(int i) const + const float &operator() (int i) const { - return const_cast(*this).operator()(i); + return const_cast (*this).operator() (i); } int getRows() const { - return const_cast(*this).height(); + return const_cast (*this).height(); } int getCols() const { - return const_cast(*this).width(); + return const_cast (*this).width(); } float *data() { - return static_cast(*this); + return static_cast (*this); } const float *data() const { - return const_cast(*this).data(); + return const_cast (*this).data(); } }; // upper bound on image dimension used in tmo_fattal02 -- see the comment there const int RT_dimension_cap = 1920; -void rescale_bilinear(const Array2Df &src, Array2Df &dst, bool multithread); +void rescale_bilinear (const Array2Df &src, Array2Df &dst, bool multithread); /****************************************************************************** * Luminance HDR code (modifications are marked with an RT comment) ******************************************************************************/ -void downSample(const Array2Df& A, Array2Df& B) +void downSample (const Array2Df& A, Array2Df& B) { const int width = B.getCols(); const int height = B.getRows(); @@ -153,163 +156,164 @@ void downSample(const Array2Df& A, Array2Df& B) // speed improvements. The main issue is the pde solver and in case of the // fft solver uses optimised threaded fftw routines. //#pragma omp parallel for - for ( int y=0 ; ygetCols(); - int height = H->getRows(); - const int size = width*height; + int width = H->getCols(); + int height = H->getRows(); + const int size = width * height; + + pyramids[0] = new Array2Df (width, height); - pyramids[0] = new Array2Df(width,height); //#pragma omp parallel for shared(pyramids, H) - for( int i=0 ; i 2 && height > 2) { - width /= 2; - height /= 2; - pyramids[k] = new Array2Df(width,height); - downSample(*L, *pyramids[k]); - } else { - // RT - now nlevels is fixed in tmo_fattal02 (see the comment in - // there), so it might happen that we have to add some padding to - // the gaussian pyramids - pyramids[k] = new Array2Df(width,height); - for (int j = 0, n = width*height; j < n; ++j) { - (*pyramids[k])(j) = (*L)(j); - } - } - - if(k < nlevels -1) { - delete L; - L = new Array2Df(width,height); - gaussianBlur( *pyramids[k], *L ); + for ( int i = 0 ; i < size ; i++ ) { + (*pyramids[0]) (i) = (*H) (i); } - } - delete L; + Array2Df* L = new Array2Df (width, height); + gaussianBlur ( *pyramids[0], *L ); + + for ( int k = 1 ; k < nlevels ; k++ ) { + if (width > 2 && height > 2) { + width /= 2; + height /= 2; + pyramids[k] = new Array2Df (width, height); + downSample (*L, *pyramids[k]); + } else { + // RT - now nlevels is fixed in tmo_fattal02 (see the comment in + // there), so it might happen that we have to add some padding to + // the gaussian pyramids + pyramids[k] = new Array2Df (width, height); + + for (int j = 0, n = width * height; j < n; ++j) { + (*pyramids[k]) (j) = (*L) (j); + } + } + + if (k < nlevels - 1) { + delete L; + L = new Array2Df (width, height); + gaussianBlur ( *pyramids[k], *L ); + } + } + + delete L; } //-------------------------------------------------------------------- -float calculateGradients(Array2Df* H, Array2Df* G, int k) +float calculateGradients (Array2Df* H, Array2Df* G, int k) { - const int width = H->getCols(); - const int height = H->getRows(); - const float divider = pow( 2.0f, k+1 ); - float avgGrad = 0.0f; + const int width = H->getCols(); + const int height = H->getRows(); + const float divider = pow ( 2.0f, k + 1 ); + float avgGrad = 0.0f; -#pragma omp parallel for reduction(+:avgGrad) - for( int y=0 ; y(x * 0.5f); //x / 2.f; - int ay = static_cast(y * 0.5f); //y / 2.f; - ax = (ax (x * 0.5f); //x / 2.f; + int ay = static_cast (y * 0.5f); //y / 2.f; + ax = (ax < awidth) ? ax : awidth - 1; + ay = (ay < aheight) ? ay : aheight - 1; - B(x,y) = A(ax,ay); + B (x, y) = A (ax, ay); } } + //--- this code below produces 'use of uninitialized value error' // int width = A->getCols(); // int height = A->getRows(); @@ -345,84 +348,78 @@ void upSample(const Array2Df& A, Array2Df& B) } -void calculateFiMatrix(Array2Df* FI, Array2Df* gradients[], - float avgGrad[], int nlevels, int detail_level, - float alfa, float beta, float noise) +void calculateFiMatrix (Array2Df* FI, Array2Df* gradients[], + float avgGrad[], int nlevels, int detail_level, + float alfa, float beta, float noise) { const bool newfattal = true; - int width = gradients[nlevels-1]->getCols(); - int height = gradients[nlevels-1]->getRows(); + int width = gradients[nlevels - 1]->getCols(); + int height = gradients[nlevels - 1]->getRows(); Array2Df** fi = new Array2Df*[nlevels]; - fi[nlevels-1] = new Array2Df(width,height); - if (newfattal) - { + fi[nlevels - 1] = new Array2Df (width, height); + + if (newfattal) { //#pragma omp parallel for shared(fi) - for ( int k = 0 ; k < width*height ; k++ ) - { - (*fi[nlevels-1])(k) = 1.0f; + for ( int k = 0 ; k < width * height ; k++ ) { + (*fi[nlevels - 1]) (k) = 1.0f; } } - for ( int k = nlevels-1; k >= 0 ; k-- ) - { + for ( int k = nlevels - 1; k >= 0 ; k-- ) { width = gradients[k]->getCols(); height = gradients[k]->getRows(); // only apply gradients to levels>=detail_level but at least to the coarsest if ( k >= detail_level - ||k==nlevels-1 - || newfattal == false) - { + || k == nlevels - 1 + || newfattal == false) { //DEBUG_STR << "calculateFiMatrix: apply gradient to level " << k << endl; #pragma omp parallel for shared(fi,avgGrad) - for ( int y = 0; y < height; y++ ) - { - for ( int x = 0; x < width; x++ ) - { - float grad = ((*gradients[k])(x,y) < 1e-4f) ? 1e-4 : (*gradients[k])(x,y); + for ( int y = 0; y < height; y++ ) { + for ( int x = 0; x < width; x++ ) { + float grad = ((*gradients[k]) (x, y) < 1e-4f) ? 1e-4 : (*gradients[k]) (x, y); float a = alfa * avgGrad[k]; - float value = pow((grad+noise)/a, beta - 1.0f); + float value = pow ((grad + noise) / a, beta - 1.0f); - if (newfattal) - (*fi[k])(x,y) *= value; - else - (*fi[k])(x,y) = value; + if (newfattal) { + (*fi[k]) (x, y) *= value; + } else { + (*fi[k]) (x, y) = value; + } } } } // create next level - if ( k>1 ) - { - width = gradients[k-1]->getCols(); - height = gradients[k-1]->getRows(); - fi[k-1] = new Array2Df(width,height); + if ( k > 1 ) { + width = gradients[k - 1]->getCols(); + height = gradients[k - 1]->getRows(); + fi[k - 1] = new Array2Df (width, height); + } else { + fi[0] = FI; // highest level -> result } - else - fi[0] = FI; // highest level -> result - if ( k>0 && newfattal ) - { - upSample(*fi[k], *fi[k-1]); // upsample to next level - gaussianBlur(*fi[k-1], *fi[k-1]); + if ( k > 0 && newfattal ) { + upSample (*fi[k], *fi[k - 1]); // upsample to next level + gaussianBlur (*fi[k - 1], *fi[k - 1]); } } - for ( int k=1 ; k 0) { // interpolate + + if (k > 0) { // interpolate int count_ = count - histo[k - 1]; float c0 = count - minPrct * size; float c1 = minPrct * size - count_; minLum = (c1 * k + c0 * (k - 1)) / ((c0 + c1) * 65535.f); } else { - minLum = k /65535.f; + minLum = k / 65535.f; } // find (maxPrct*size) smallest value - while(count < maxPrct*size) { + while (count < maxPrct * size) { count += histo[k++]; } - if(k > 0) { // interpolate + + if (k > 0) { // interpolate int count_ = count - histo[k - 1]; float c0 = count - maxPrct * size; float c1 = maxPrct * size - count_; maxLum = (c1 * k + c0 * (k - 1)) / ((c0 + c1) * 65535.f); } else { - maxLum = k /65535.f; + maxLum = k / 65535.f; } } -void solve_pde_fft(Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread); +void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread); -void tmo_fattal02(size_t width, - size_t height, - const Array2Df& Y, - Array2Df& L, - float alfa, - float beta, - float noise, - int detail_level, - bool multithread) +void tmo_fattal02 (size_t width, + size_t height, + const Array2Df& Y, + Array2Df& L, + float alfa, + float beta, + float noise, + int detail_level, + bool multithread) { // #ifdef TIMER_PROFILING // msec_timer stop_watch; @@ -507,12 +507,18 @@ void tmo_fattal02(size_t width, static const float black_point = 0.1f; static const float white_point = 0.5f; static const float gamma = 1.0f; // 0.8f; - // static const int detail_level = 3; - if ( detail_level < 0 ) detail_level = 0; - if ( detail_level > 3 ) detail_level = 3; - // ph.setValue(2); - // if (ph.canceled()) return; + // static const int detail_level = 3; + if ( detail_level < 0 ) { + detail_level = 0; + } + + if ( detail_level > 3 ) { + detail_level = 3; + } + + // ph.setValue(2); + // if (ph.canceled()) return; /* RT -- we use a hardcoded value for nlevels, to limit the * dependency of the result on the image size. When using an auto computed @@ -520,247 +526,274 @@ void tmo_fattal02(size_t width, * image sizes, making it essentially impossible to preview the tool * inside RT. With a hardcoded value, the results for the preview are much * closer to those for the final image */ - // int MSIZE = 32; // minimum size of gaussian pyramid - // // I believe a smaller value than 32 results in slightly better overall - // // quality but I'm only applying this if the newly implemented fft solver - // // is used in order not to change behaviour of the old version - // // TODO: best let the user decide this value - // // if (fftsolver) - // { - // MSIZE = 8; - // } - + // int MSIZE = 32; // minimum size of gaussian pyramid + // // I believe a smaller value than 32 results in slightly better overall + // // quality but I'm only applying this if the newly implemented fft solver + // // is used in order not to change behaviour of the old version + // // TODO: best let the user decide this value + // // if (fftsolver) + // { + // MSIZE = 8; + // } - int size = width*height; - // find max value, normalize to range 0..100 and take logarithm - float minLum = Y(0,0); - float maxLum = Y(0,0); + int size = width * height; - #pragma omp parallel for reduction(max:maxLum) - for ( int i=0 ; i RT_dimension_cap) { - float s = float(RT_dimension_cap) / float(dim); - Array2Df *HH = new Array2Df(width * s, height * s); - rescale_bilinear(*H, *HH, multithread); - fullH = H; - H = HH; - width = H->getCols(); - height = H->getRows(); - } - /** RT */ - - // create gaussian pyramids - // int mins = (width= MSIZE ) - // { - // nlevels++; - // mins /= 2; - // } - // // std::cout << "DEBUG: nlevels = " << nlevels << ", mins = " << mins << std::endl; - // // The following lines solves a bug with images particularly small - // if (nlevels == 0) nlevels = 1; - const int nlevels = 7; // RT -- see above - - Array2Df** pyramids = new Array2Df*[nlevels]; - createGaussianPyramids(H, pyramids, nlevels); - // ph.setValue(8); - - // calculate gradients and its average values on pyramid levels - Array2Df** gradients = new Array2Df*[nlevels]; - float* avgGrad = new float[nlevels]; - for ( int k=0 ; kgetCols(), pyramids[k]->getRows()); - avgGrad[k] = calculateGradients(pyramids[k],gradients[k], k); - delete pyramids[k]; - } - delete[] pyramids; - // ph.setValue(12); - - // calculate fi matrix - Array2Df* FI = new Array2Df(width, height); - calculateFiMatrix(FI, gradients, avgGrad, nlevels, detail_level, alfa, beta, noise); -// dumpPFS( "FI.pfs", FI, "Y" ); - for ( int i=0 ; i= height ? height-2 : y+1); - for ( size_t x=0 ; x= width ? width-2 : x+1); - // forward differences in H, so need to use between-points approx of FI - (*Gx)(x,y) = ((*H)(xp1,y)-(*H)(x,y)) * 0.5 * ((*FI)(xp1,y)+(*FI)(x,y)); - (*Gy)(x,y) = ((*H)(x,yp1)-(*H)(x,y)) * 0.5 * ((*FI)(x,yp1)+(*FI)(x,y)); - } + for ( int i = 0 ; i < size ; i++ ) { + maxLum = std::max (maxLum, Y (i)); } - delete H; - // calculate divergence -#pragma omp parallel for - for ( size_t y = 0; y < height; ++y ) - { - for ( size_t x = 0; x < width; ++x ) - { - (*FI)(x,y) = (*Gx)(x,y) + (*Gy)(x,y); - if ( x > 0 ) (*FI)(x,y) -= (*Gx)(x-1,y); - if ( y > 0 ) (*FI)(x,y) -= (*Gy)(x,y-1); + Array2Df* H = new Array2Df (width, height); + float temp = 100.f / maxLum; + float eps = 1e-4f; + #pragma omp parallel + { +#ifdef __SSE2__ + vfloat epsv = F2V (eps); + vfloat tempv = F2V (temp); +#endif + #pragma omp for schedule(dynamic,16) - // if (fftsolver) - { - if (x==0) (*FI)(x,y) += (*Gx)(x,y); - if (y==0) (*FI)(x,y) += (*Gy)(x,y); - } + for (size_t i = 0 ; i < height ; ++i) { + size_t j = 0; +#ifdef __SSE2__ - } - } - //delete Gx; // RT - reused as temp buffer in solve_pde_fft, deleted later - delete Gy; + for (; j < width - 3; j += 4) { + STVFU ((*H)[i][j], xlogf (tempv * LVFU (Y[i][j]) + epsv)); + } - // solve pde and exponentiate (ie recover compressed image) - { - // if (fftsolver) - { - MyMutex::MyLock lock(*fftwMutex); - solve_pde_fft(FI, &L, Gx, multithread);//, ph); - } - delete Gx; - delete FI; - // else - // { - // solve_pde_multigrid(&DivG, &U, ph); - // } +#endif + + for (; j < width; ++j) { + (*H)[i][j] = xlogf (temp * Y[i][j] + eps); + } + } + } + + /** RT - this is also here to reduce the dependency of the results on the + * input image size, with the primary aim of having a preview in RT that is + * reasonably close to the actual output image. Intuitively, what we do is + * to put a cap on the dimension of the image processed, so that it is close + * in size to the typical preview that you will see on a normal consumer + * monitor. (That's where the 1920 value for RT_dimension_cap comes from.) + * However, we can't simply downscale the input Y array and then upscale it + * on output, because that would cause a big loss of sharpness (confirmed by + * testing). + * So, we use a different method: we downscale the H array, so that we + * compute a downscaled gaussian pyramid and a downscaled FI matrix. Then, + * we upscale the FI matrix later on, before it gets combined with the + * original input luminance array H. This seems to preserve the input + * sharpness and at the same time significantly reduce the dependency of the + * result on the input size. Clearly this is a hack, and keep in mind that I + * do not really know how Fattal works (it comes from LuminanceHDR almost + * verbatim), so this should probably be revised/reviewed by someone who + * knows better... also, we use a quite naive bilinear interpolation + * algorithm (see rescale_bilinear below), which could definitely be + * improved */ + int fullwidth = width; + int fullheight = height; + int dim = std::max (width, height); + Array2Df *fullH = nullptr; + + if (dim > RT_dimension_cap) { + float s = float (RT_dimension_cap) / float (dim); + Array2Df *HH = new Array2Df (width * s, height * s); + rescale_bilinear (*H, *HH, multithread); + fullH = H; + H = HH; + width = H->getCols(); + height = H->getRows(); + } + + /** RT */ + + // create gaussian pyramids + // int mins = (width= MSIZE ) + // { + // nlevels++; + // mins /= 2; + // } + // // std::cout << "DEBUG: nlevels = " << nlevels << ", mins = " << mins << std::endl; + // // The following lines solves a bug with images particularly small + // if (nlevels == 0) nlevels = 1; + const int nlevels = 7; // RT -- see above + + Array2Df** pyramids = new Array2Df*[nlevels]; + createGaussianPyramids (H, pyramids, nlevels); + // ph.setValue(8); + + // calculate gradients and its average values on pyramid levels + Array2Df** gradients = new Array2Df*[nlevels]; + float* avgGrad = new float[nlevels]; + + for ( int k = 0 ; k < nlevels ; k++ ) { + gradients[k] = new Array2Df (pyramids[k]->getCols(), pyramids[k]->getRows()); + avgGrad[k] = calculateGradients (pyramids[k], gradients[k], k); + delete pyramids[k]; + } + + delete[] pyramids; + // ph.setValue(12); + + // calculate fi matrix + Array2Df* FI = new Array2Df (width, height); + calculateFiMatrix (FI, gradients, avgGrad, nlevels, detail_level, alfa, beta, noise); + +// dumpPFS( "FI.pfs", FI, "Y" ); + for ( int i = 0 ; i < nlevels ; i++ ) { + delete gradients[i]; + } + + delete[] gradients; + delete[] avgGrad; + // ph.setValue(16); + // if (ph.canceled()){ + // delete FI; + // delete H; + // return; + // } + + /** - RT - bring back the FI image to the input size if it was downscaled */ + if (fullH) { + Array2Df *FI2 = new Array2Df (fullwidth, fullheight); + rescale_bilinear (*FI, *FI2, multithread); + delete FI; + FI = FI2; + width = fullwidth; + height = fullheight; + delete H; + H = fullH; + } + + /** RT */ + + // attenuate gradients + Array2Df* Gx = new Array2Df (width, height); + Array2Df* Gy = new Array2Df (width, height); + + // the fft solver solves the Poisson pde but with slightly different + // boundary conditions, so we need to adjust the assembly of the right hand + // side accordingly (basically fft solver assumes U(-1) = U(1), whereas zero + // Neumann conditions assume U(-1)=U(0)), see also divergence calculation + // if (fftsolver) + #pragma omp parallel for + + for ( size_t y = 0 ; y < height ; y++ ) { + // sets index+1 based on the boundary assumption H(N+1)=H(N-1) + unsigned int yp1 = (y + 1 >= height ? height - 2 : y + 1); + + for ( size_t x = 0 ; x < width ; x++ ) { + // sets index+1 based on the boundary assumption H(N+1)=H(N-1) + unsigned int xp1 = (x + 1 >= width ? width - 2 : x + 1); + // forward differences in H, so need to use between-points approx of FI + (*Gx) (x, y) = ((*H) (xp1, y) - (*H) (x, y)) * 0.5 * ((*FI) (xp1, y) + (*FI) (x, y)); + (*Gy) (x, y) = ((*H) (x, yp1) - (*H) (x, y)) * 0.5 * ((*FI) (x, yp1) + (*FI) (x, y)); + } + } + + delete H; + + // calculate divergence + #pragma omp parallel for + + for ( size_t y = 0; y < height; ++y ) { + for ( size_t x = 0; x < width; ++x ) { + (*FI) (x, y) = (*Gx) (x, y) + (*Gy) (x, y); + + if ( x > 0 ) { + (*FI) (x, y) -= (*Gx) (x - 1, y); + } + + if ( y > 0 ) { + (*FI) (x, y) -= (*Gy) (x, y - 1); + } + + // if (fftsolver) + { + if (x == 0) { + (*FI) (x, y) += (*Gx) (x, y); + } + + if (y == 0) { + (*FI) (x, y) += (*Gy) (x, y); + } + } + + } + } + + //delete Gx; // RT - reused as temp buffer in solve_pde_fft, deleted later + delete Gy; + + // solve pde and exponentiate (ie recover compressed image) + { + // if (fftsolver) + { + MyMutex::MyLock lock (*fftwMutex); + solve_pde_fft (FI, &L, Gx, multithread); //, ph); + } + delete Gx; + delete FI; + // else + // { + // solve_pde_multigrid(&DivG, &U, ph); + // } // #ifndef NDEBUG // printf("\npde residual error: %f\n", residual_pde(&U, &DivG)); // #endif - // ph.setValue(90); - // if ( ph.canceled() ) - // { - // return; - // } - #pragma omp parallel - { + // ph.setValue(90); + // if ( ph.canceled() ) + // { + // return; + // } + #pragma omp parallel + { #ifdef __SSE2__ - vfloat gammav = F2V(gamma); + vfloat gammav = F2V (gamma); #endif - #pragma omp for schedule(dynamic,16) - for (size_t i=0 ; i=0.0f && (cut_max<=1.0f) && (cut_min 1.0 + for (; j < width; j++) { + L[i][j] = xexpf ( gamma * L[i][j]); + } + } + } + } + // ph.setValue(95); + + // remove percentile of min and max values and renormalize + float cut_min = 0.01f * black_point; + float cut_max = 1.0f - 0.01f * white_point; + assert (cut_min >= 0.0f && (cut_max <= 1.0f) && (cut_min < cut_max)); + findMaxMinPercentile (L, cut_min, minLum, cut_max, maxLum); + float dividor = (maxLum - minLum); + + #pragma omp parallel for + + for (size_t i = 0; i < height; ++i) { + for (size_t j = 0; j < width; ++j) { + L[i][j] = std::max ((L[i][j] - minLum) / dividor, 0.f); + // note, we intentionally do not cut off values > 1.0 + } } - } } @@ -836,91 +869,94 @@ void tmo_fattal02(size_t width, // returns T = EVy A EVx^tr // note, modifies input data -void transform_ev2normal(Array2Df *A, Array2Df *T) +void transform_ev2normal (Array2Df *A, Array2Df *T) { - int width = A->getCols(); - int height = A->getRows(); - assert((int)T->getCols()==width && (int)T->getRows()==height); + int width = A->getCols(); + int height = A->getRows(); + assert ((int)T->getCols() == width && (int)T->getRows() == height); - // the discrete cosine transform is not exactly the transform needed - // need to scale input values to get the right transformation - #pragma omp parallel for - for(int y=1 ; ydata(), T->data(), - FFTW_REDFT00, FFTW_REDFT00, FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); + for (int y = 1 ; y < height - 1 ; y++ ) { + (*A) (0, y) *= 0.5; + (*A) (width - 1, y) *= 0.5f; + } + + // note, fftw provides its own memory allocation routines which + // ensure that memory is properly 16/32 byte aligned so it can + // use SSE/AVX operations (2/4 double ops in parallel), if our + // data is not properly aligned fftw won't use SSE/AVX + // (I believe new() aligns memory to 16 byte so avoid overhead here) + // + // double* in = (double*) fftwf_malloc(sizeof(double) * width*height); + // fftwf_free(in); + + // executes 2d discrete cosine transform + fftwf_plan p; + p = fftwf_plan_r2r_2d (height, width, A->data(), T->data(), + FFTW_REDFT00, FFTW_REDFT00, FFTW_ESTIMATE); + fftwf_execute (p); + fftwf_destroy_plan (p); } // returns T = EVy^-1 * A * (EVx^-1)^tr -void transform_normal2ev(Array2Df *A, Array2Df *T) +void transform_normal2ev (Array2Df *A, Array2Df *T) { - int width = A->getCols(); - int height = A->getRows(); - assert((int)T->getCols()==width && (int)T->getRows()==height); + int width = A->getCols(); + int height = A->getRows(); + assert ((int)T->getCols() == width && (int)T->getRows() == height); - // executes 2d discrete cosine transform - fftwf_plan p; - p=fftwf_plan_r2r_2d(height, width, A->data(), T->data(), - FFTW_REDFT00, FFTW_REDFT00, FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); + // executes 2d discrete cosine transform + fftwf_plan p; + p = fftwf_plan_r2r_2d (height, width, A->data(), T->data(), + FFTW_REDFT00, FFTW_REDFT00, FFTW_ESTIMATE); + fftwf_execute (p); + fftwf_destroy_plan (p); - // need to scale the output matrix to get the right transform - float factor = (1.0f/((height-1)*(width-1))); -#pragma omp parallel for - for(int y=0 ; y get_lambda(int n) +std::vector get_lambda (int n) { - assert(n>1); - std::vector v(n); - for (int i=0; i 1); + std::vector v (n); - return v; + for (int i = 0; i < n; i++) { + v[i] = -4.0 * SQR (sin ((double)i / (2 * (n - 1)) * RT_PI)); + } + + return v; } // // makes boundary conditions compatible so that a solution exists @@ -967,99 +1003,105 @@ std::vector get_lambda(int n) // not modified and the equation might not have a solution but an // approximate solution with a minimum error is then calculated // double precision version -void solve_pde_fft(Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/*, pfs::Progress &ph, +void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/*, pfs::Progress &ph, bool adjust_bound)*/ { - // ph.setValue(20); - //DEBUG_STR << "solve_pde_fft: solving Laplace U = F ..." << std::endl; - int width = F->getCols(); - int height = F->getRows(); - assert((int)U->getCols()==width && (int)U->getRows()==height); - assert(buf->getCols()==width && buf->getRows()==height); + // ph.setValue(20); + //DEBUG_STR << "solve_pde_fft: solving Laplace U = F ..." << std::endl; + int width = F->getCols(); + int height = F->getRows(); + assert ((int)U->getCols() == width && (int)U->getRows() == height); + assert (buf->getCols() == width && buf->getRows() == height); - // activate parallel execution of fft routines + // activate parallel execution of fft routines #ifdef RT_FFTW3F_OMP - if (multithread) { - fftwf_init_threads(); - fftwf_plan_with_nthreads( omp_get_max_threads() ); - } + + if (multithread) { + fftwf_init_threads(); + fftwf_plan_with_nthreads ( omp_get_max_threads() ); + } + // #else // fftwf_plan_with_nthreads( 2 ); #endif - // in general there might not be a solution to the Poisson pde - // with Neumann boundary conditions unless the boundary satisfies - // an integral condition, this function modifies the boundary so that - // the condition is exactly satisfied - // if(adjust_bound) - // { - // //DEBUG_STR << "solve_pde_fft: checking boundary conditions" << std::endl; - // make_compatible_boundary(F); - // } + // in general there might not be a solution to the Poisson pde + // with Neumann boundary conditions unless the boundary satisfies + // an integral condition, this function modifies the boundary so that + // the condition is exactly satisfied + // if(adjust_bound) + // { + // //DEBUG_STR << "solve_pde_fft: checking boundary conditions" << std::endl; + // make_compatible_boundary(F); + // } - // transforms F into eigenvector space: Ftr = - //DEBUG_STR << "solve_pde_fft: transform F to ev space (fft)" << std::endl; - Array2Df* F_tr = buf; //new Array2Df(width,height); - transform_normal2ev(F, F_tr); - // TODO: F no longer needed so could release memory, but as it is an - // input parameter we won't do that - // ph.setValue(50); - // if (ph.canceled()) - // { - // delete F_tr; - // return; - // } + // transforms F into eigenvector space: Ftr = + //DEBUG_STR << "solve_pde_fft: transform F to ev space (fft)" << std::endl; + Array2Df* F_tr = buf; //new Array2Df(width,height); + transform_normal2ev (F, F_tr); + // TODO: F no longer needed so could release memory, but as it is an + // input parameter we won't do that + // ph.setValue(50); + // if (ph.canceled()) + // { + // delete F_tr; + // return; + // } - //DEBUG_STR << "solve_pde_fft: F_tr(0,0) = " << (*F_tr)(0,0); - //DEBUG_STR << " (must be 0 for solution to exist)" << std::endl; + //DEBUG_STR << "solve_pde_fft: F_tr(0,0) = " << (*F_tr)(0,0); + //DEBUG_STR << " (must be 0 for solution to exist)" << std::endl; - // in the eigenvector space the solution is very simple - //DEBUG_STR << "solve_pde_fft: solve in eigenvector space" << std::endl; + // in the eigenvector space the solution is very simple + //DEBUG_STR << "solve_pde_fft: solve in eigenvector space" << std::endl; // Array2Df* U_tr = new Array2Df(width,height); - std::vector l1=get_lambda(height); - std::vector l2=get_lambda(width); + std::vector l1 = get_lambda (height); + std::vector l2 = get_lambda (width); -#pragma omp parallel for - for(int y=0 ; y 0); + assert (dim > 0); unsigned int v = dim; v--; v |= v >> 1; @@ -1172,7 +1218,7 @@ inline int round_up_pow2(int dim) return v; } -inline int find_fast_dim(int dim) +inline int find_fast_dim (int dim) { // as per the FFTW docs: // @@ -1183,39 +1229,42 @@ inline int find_fast_dim(int dim) // the above form. This is not exhaustive, but should be ok for pictures // up to 100MPix at least - int d1 = round_up_pow2(dim); + int d1 = round_up_pow2 (dim); std::vector d = { - d1/128 * 65, - d1/64 * 33, - d1/512 * 273, - d1/16 * 9, - d1/8 * 5, - d1/16 * 11, - d1/128 * 91, - d1/4 * 3, - d1/64 * 49, - d1/16 * 13, - d1/8 * 7, + d1 / 128 * 65, + d1 / 64 * 33, + d1 / 512 * 273, + d1 / 16 * 9, + d1 / 8 * 5, + d1 / 16 * 11, + d1 / 128 * 91, + d1 / 4 * 3, + d1 / 64 * 49, + d1 / 16 * 13, + d1 / 8 * 7, d1 }; + for (size_t i = 0; i < d.size(); ++i) { if (d[i] >= dim) { return d[i]; } } - assert(false); + + assert (false); return dim; } } // namespace -void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb) +void ImProcFunctions::ToneMapFattal02 (Imagefloat *rgb) { BENCHFUN const int detail_level = 3; float alpha = 1.f; + if (params->fattal.threshold < 0) { alpha += (params->fattal.threshold * 0.9f) / 100.f; } else if (params->fattal.threshold > 0) { @@ -1223,7 +1272,7 @@ void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb) } float beta = 1.f - (params->fattal.amount * 0.3f) / 100.f; - + // sanity check if (alpha <= 0 || beta <= 0) { return; @@ -1231,35 +1280,38 @@ void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb) int w = rgb->getWidth(); int h = rgb->getHeight(); - - Array2Df Yr(w, h); + + Array2Df Yr (w, h); const float epsilon = 1e-4f; const float luminance_noise_floor = 65.535f; const float min_luminance = 1.f; - TMatrix ws = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); + TMatrix ws = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { - Yr(x, y) = std::max(luminance(rgb->r(y, x), rgb->g(y, x), rgb->b(y, x), ws), min_luminance); // clip really black pixels + Yr (x, y) = std::max (luminance (rgb->r (y, x), rgb->g (y, x), rgb->b (y, x), ws), min_luminance); // clip really black pixels } } + // median filter on the deep shadows, to avoid boosting noise // because w2 >= w and h2 >= h, we can use the L buffer as temporary buffer for Median_Denoise() - int w2 = find_fast_dim(w) + 1; - int h2 = find_fast_dim(h) + 1; - Array2Df L(w2, h2); + int w2 = find_fast_dim (w) + 1; + int h2 = find_fast_dim (h) + 1; + Array2Df L (w2, h2); { #ifdef _OPENMP int num_threads = multiThread ? omp_get_max_threads() : 1; #else int num_threads = 1; #endif - float r = float(std::max(w, h)) / float(RT_dimension_cap); + float r = float (std::max (w, h)) / float (RT_dimension_cap); Median med; + if (r >= 3) { med = Median::TYPE_7X7; } else if (r >= 2) { @@ -1269,7 +1321,8 @@ void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb) } else { med = Median::TYPE_3X3_STRONG; } - Median_Denoise(Yr, Yr, luminance_noise_floor, w, h, med, 1, num_threads, L); + + Median_Denoise (Yr, Yr, luminance_noise_floor, w, h, med, 1, num_threads, L); } float noise = alpha * 0.01f; @@ -1279,27 +1332,29 @@ void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb) << ", detail_level = " << detail_level << std::endl; } - rescale_nearest(Yr, L, multiThread); - tmo_fattal02(w2, h2, L, L, alpha, beta, noise, detail_level, multiThread); + rescale_nearest (Yr, L, multiThread); + tmo_fattal02 (w2, h2, L, L, alpha, beta, noise, detail_level, multiThread); // tmo_fattal02(w, h, Yr, L, alpha, beta, noise, detail_level, multiThread); #ifdef _OPENMP #pragma omp parallel for if(multiThread) #endif + for (int y = 0; y < h; y++) { int yy = y * h2 / h; + for (int x = 0; x < w; x++) { int xx = x * w2 / w; - float Y = Yr(x, y); - float l = std::max(L(xx, yy), epsilon) * (65535.f / Y); - rgb->r(y, x) = std::max(rgb->r(y, x), 0.f) * l; - rgb->g(y, x) = std::max(rgb->g(y, x), 0.f) * l; - rgb->b(y, x) = std::max(rgb->b(y, x), 0.f) * l; - - assert(std::isfinite(rgb->r(y, x))); - assert(std::isfinite(rgb->g(y, x))); - assert(std::isfinite(rgb->b(y, x))); + float Y = Yr (x, y); + float l = std::max (L (xx, yy), epsilon) * (65535.f / Y); + rgb->r (y, x) = std::max (rgb->r (y, x), 0.f) * l; + rgb->g (y, x) = std::max (rgb->g (y, x), 0.f) * l; + rgb->b (y, x) = std::max (rgb->b (y, x), 0.f) * l; + + assert (std::isfinite (rgb->r (y, x))); + assert (std::isfinite (rgb->g (y, x))); + assert (std::isfinite (rgb->b (y, x))); } } } From 5d45cc13ab72de607eca587bd56834bb24e85876 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Sun, 19 Nov 2017 10:25:39 +0100 Subject: [PATCH 70/72] generateTranslationDiffs --- rtdata/languages/Catala | 7 +++++++ rtdata/languages/Chinese (Simplified) | 7 +++++++ rtdata/languages/Chinese (Traditional) | 7 +++++++ rtdata/languages/Czech | 7 +++++++ rtdata/languages/Dansk | 7 +++++++ rtdata/languages/Deutsch | 11 +++++++++++ rtdata/languages/English (UK) | 8 +++++++- rtdata/languages/English (US) | 8 +++++++- rtdata/languages/Espanol | 7 +++++++ rtdata/languages/Euskara | 7 +++++++ rtdata/languages/Francais | 2 +- rtdata/languages/Greek | 7 +++++++ rtdata/languages/Hebrew | 7 +++++++ rtdata/languages/Italiano | 7 +++++++ rtdata/languages/Japanese | 7 +++++++ rtdata/languages/Latvian | 7 +++++++ rtdata/languages/Magyar | 7 +++++++ rtdata/languages/Nederlands | 7 +++++++ rtdata/languages/Norsk BM | 7 +++++++ rtdata/languages/Polish | 7 +++++++ rtdata/languages/Polish (Latin Characters) | 7 +++++++ rtdata/languages/Portugues (Brasil) | 7 +++++++ rtdata/languages/Russian | 7 +++++++ rtdata/languages/Serbian (Cyrilic Characters) | 7 +++++++ rtdata/languages/Serbian (Latin Characters) | 7 +++++++ rtdata/languages/Slovak | 7 +++++++ rtdata/languages/Suomi | 7 +++++++ rtdata/languages/Swedish | 7 +++++++ rtdata/languages/Turkish | 7 +++++++ rtdata/languages/default | 2 +- 30 files changed, 202 insertions(+), 4 deletions(-) diff --git a/rtdata/languages/Catala b/rtdata/languages/Catala index b58aa7004..eda2ad2ad 100644 --- a/rtdata/languages/Catala +++ b/rtdata/languages/Catala @@ -1316,6 +1316,9 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1386,6 +1389,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1999,6 +2003,9 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_RGBCURVES_LUMAMODE_TOOLTIP;Luminosity mode allows to vary the contribution of R, G and B channels to the luminosity of the image, without altering image color. !TP_SAVEDIALOG_OK_TIP;Shortcut: Ctrl-Enter !TP_SHADOWSHLIGHTS_SHARPMASK;Sharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Chinese (Simplified) b/rtdata/languages/Chinese (Simplified) index 655125be1..51aed581d 100644 --- a/rtdata/languages/Chinese (Simplified) +++ b/rtdata/languages/Chinese (Simplified) @@ -1424,6 +1424,9 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1473,6 +1476,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !MONITOR_PROFILE_SYSTEM;System default !OPTIONS_DEFIMG_MISSING;The default profile for non-raw photos could not be found or is not set.\n\nPlease check your profiles' directory, it may be missing or damaged.\n\nDefault internal values will be used. !OPTIONS_DEFRAW_MISSING;The default profile for raw photos could not be found or is not set.\n\nPlease check your profiles' directory, it may be missing or damaged.\n\nDefault internal values will be used. +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PREFERENCES_AUTOSAVE_TP_OPEN;Automatically save tools collapsed/expanded\nstate before exiting !PREFERENCES_BEHADDALLHINT;Set all parameters to the Add mode.\nAdjustments of parameters in the batch tool panel will be deltas to the stored values. !PREFERENCES_BEHSETALLHINT;Set all parameters to the Set mode.\nAdjustments of parameters in the batch tool panel will be absolute, the actual values will be displayed. @@ -1970,6 +1974,9 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Chinese (Traditional) b/rtdata/languages/Chinese (Traditional) index f29361e6a..2476aeb41 100644 --- a/rtdata/languages/Chinese (Traditional) +++ b/rtdata/languages/Chinese (Traditional) @@ -976,6 +976,9 @@ TP_WBALANCE_TEMPERATURE;色溫 !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1115,6 +1118,7 @@ TP_WBALANCE_TEMPERATURE;色溫 !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1944,6 +1948,9 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Czech b/rtdata/languages/Czech index b8cdab54c..29cf45b3d 100644 --- a/rtdata/languages/Czech +++ b/rtdata/languages/Czech @@ -2181,11 +2181,15 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !LENSPROFILE_CORRECTION_AUTOMATCH;Auto-matched correction parameters !LENSPROFILE_CORRECTION_LCPFILE;LCP File !LENSPROFILE_CORRECTION_MANUAL;Manual correction parameters !LENSPROFILE_LENS_WARNING;Warning: the crop factor used for lens profiling is larger than the crop factor of the camera, the results might be wrong. !MAIN_TOOLTIP_BACKCOLOR3;Background color of the preview: Middle grey\nShortcut: 9 +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PREFERENCES_AUTOSAVE_TP_OPEN;Automatically save tools collapsed/expanded\nstate before exiting !PREFERENCES_D50_OLD;5000K !PREFERENCES_DIRECTORIES;Directories @@ -2209,3 +2213,6 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !TP_COLORAPP_YB;Yb% (mean luminance) !TP_COLORAPP_YBSCENE;Yb% (mean luminance) !TP_COLORAPP_YBSCENE_TOOLTIP;if auto enable, Yb is calculated from the mean value of actual image luminance +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold diff --git a/rtdata/languages/Dansk b/rtdata/languages/Dansk index 868dcc418..0b619b706 100644 --- a/rtdata/languages/Dansk +++ b/rtdata/languages/Dansk @@ -972,6 +972,9 @@ TP_WBALANCE_TEMPERATURE;Temperatur !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1113,6 +1116,7 @@ TP_WBALANCE_TEMPERATURE;Temperatur !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1943,6 +1947,9 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch index ea41ee0c3..cda1faa42 100644 --- a/rtdata/languages/Deutsch +++ b/rtdata/languages/Deutsch @@ -2212,3 +2212,14 @@ ZOOMPANEL_ZOOMFITSCREEN;An Bildschirm anpassen\nTaste: f ZOOMPANEL_ZOOMIN;Hineinzoomen\nTaste: + ZOOMPANEL_ZOOMOUT;Herauszoomen\nTaste: - +!!!!!!!!!!!!!!!!!!!!!!!!! +! Untranslated keys follow; remove the ! prefix after an entry is translated. +!!!!!!!!!!!!!!!!!!!!!!!!! + +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold diff --git a/rtdata/languages/English (UK) b/rtdata/languages/English (UK) index 018ae675a..e4bbcacd8 100644 --- a/rtdata/languages/English (UK) +++ b/rtdata/languages/English (UK) @@ -802,6 +802,9 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT;Add !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !HISTORY_SNAPSHOT;Snapshot @@ -999,6 +1002,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENING;Sharpening (USM/RL) !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_VIGNETTING;Vignetting correction !PARTIALPASTE_WAVELETGROUP;Wavelet Levels @@ -1256,7 +1260,6 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !SAVEDLG_FILEFORMAT;File format !SAVEDLG_FORCEFORMATOPTS;Force saving options !SAVEDLG_JPEGQUAL;JPEG quality -!SAVEDLG_PNGCOMPR;PNG compression !SAVEDLG_PUTTOQUEUE;Put into processing queue !SAVEDLG_PUTTOQUEUEHEAD;Put to the head of the processing queue !SAVEDLG_PUTTOQUEUETAIL;Put to the end of the processing queue @@ -1935,6 +1938,9 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones !TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE1;Red/Purple diff --git a/rtdata/languages/English (US) b/rtdata/languages/English (US) index 00e8e48b7..31093bc2b 100644 --- a/rtdata/languages/English (US) +++ b/rtdata/languages/English (US) @@ -720,6 +720,9 @@ !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT;Add !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !HISTORY_SNAPSHOT;Snapshot @@ -926,6 +929,7 @@ !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENING;Sharpening (USM/RL) !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_VIGNETTING;Vignetting correction !PARTIALPASTE_WAVELETGROUP;Wavelet Levels @@ -1195,7 +1199,6 @@ !SAVEDLG_FILEFORMAT;File format !SAVEDLG_FORCEFORMATOPTS;Force saving options !SAVEDLG_JPEGQUAL;JPEG quality -!SAVEDLG_PNGCOMPR;PNG compression !SAVEDLG_PUTTOQUEUE;Put into processing queue !SAVEDLG_PUTTOQUEUEHEAD;Put to the head of the processing queue !SAVEDLG_PUTTOQUEUETAIL;Put to the end of the processing queue @@ -1926,6 +1929,9 @@ !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Espanol b/rtdata/languages/Espanol index ec9b8bddb..ec6dcfb37 100644 --- a/rtdata/languages/Espanol +++ b/rtdata/languages/Espanol @@ -1708,6 +1708,9 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1759,6 +1762,7 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2067,6 +2071,9 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Euskara b/rtdata/languages/Euskara index aa94b6258..8718554f5 100644 --- a/rtdata/languages/Euskara +++ b/rtdata/languages/Euskara @@ -972,6 +972,9 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1113,6 +1116,7 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1943,6 +1947,9 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index e90a61b41..f67b6bf3f 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1896,9 +1896,9 @@ TP_SHARPENMICRO_AMOUNT;Quantité TP_SHARPENMICRO_LABEL;Microcontraste TP_SHARPENMICRO_MATRIX;Matrice 3×3 au lieu de 5×5 TP_SHARPENMICRO_UNIFORMITY;Uniformité +TP_TM_FATTAL_AMOUNT;Quantité TP_TM_FATTAL_LABEL;Compression Tonale HDR (Fattal02) TP_TM_FATTAL_THRESHOLD;Seuil -TP_TM_FATTAL_AMOUNT;Quantité TP_VIBRANCE_AVOIDCOLORSHIFT;Éviter les dérives de teinte TP_VIBRANCE_CURVEEDITOR_SKINTONES;TT TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Tons chair diff --git a/rtdata/languages/Greek b/rtdata/languages/Greek index e6b376c29..4ffc14338 100644 --- a/rtdata/languages/Greek +++ b/rtdata/languages/Greek @@ -971,6 +971,9 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1112,6 +1115,7 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1942,6 +1946,9 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Hebrew b/rtdata/languages/Hebrew index 3bb2528fb..ef8717fa3 100644 --- a/rtdata/languages/Hebrew +++ b/rtdata/languages/Hebrew @@ -972,6 +972,9 @@ TP_WBALANCE_TEMPERATURE;מידת חום !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1113,6 +1116,7 @@ TP_WBALANCE_TEMPERATURE;מידת חום !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1943,6 +1947,9 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Italiano b/rtdata/languages/Italiano index 4e4f59480..034d16928 100644 --- a/rtdata/languages/Italiano +++ b/rtdata/languages/Italiano @@ -1582,6 +1582,9 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1629,6 +1632,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2008,6 +2012,9 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Japanese b/rtdata/languages/Japanese index 494aa13c2..ae9ff5b7f 100644 --- a/rtdata/languages/Japanese +++ b/rtdata/languages/Japanese @@ -1959,6 +1959,9 @@ ZOOMPANEL_ZOOMOUT;ズームアウト\nショートカット: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1997,6 +2000,7 @@ ZOOMPANEL_ZOOMOUT;ズームアウト\nショートカット: - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PREFERENCES_AUTOSAVE_TP_OPEN;Automatically save tools collapsed/expanded\nstate before exiting !PREFERENCES_CMMBPC;Black point compensation !PREFERENCES_D50_OLD;5000K @@ -2201,5 +2205,8 @@ ZOOMPANEL_ZOOMOUT;ズームアウト\nショートカット: - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WBALANCE_TEMPBIAS;AWB temperature bias !TP_WBALANCE_TEMPBIAS_TOOLTIP;Allows to alter the computation of the "auto white balance"\nby biasing it towards warmer or cooler temperatures. The bias\nis expressed as a percentage of the computed temperature,\nso that the result is given by "computedTemp + computedTemp * bias". diff --git a/rtdata/languages/Latvian b/rtdata/languages/Latvian index 353ae8924..56e1fabb7 100644 --- a/rtdata/languages/Latvian +++ b/rtdata/languages/Latvian @@ -972,6 +972,9 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1113,6 +1116,7 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1943,6 +1947,9 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Magyar b/rtdata/languages/Magyar index 8f7d7fac8..abddd957a 100644 --- a/rtdata/languages/Magyar +++ b/rtdata/languages/Magyar @@ -1245,6 +1245,9 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1322,6 +1325,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1992,6 +1996,9 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_RGBCURVES_LUMAMODE_TOOLTIP;Luminosity mode allows to vary the contribution of R, G and B channels to the luminosity of the image, without altering image color. !TP_SAVEDIALOG_OK_TIP;Shortcut: Ctrl-Enter !TP_SHADOWSHLIGHTS_SHARPMASK;Sharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones !TP_VIBRANCE_CURVEEDITOR_SKINTONES_RANGE1;Red/Purple diff --git a/rtdata/languages/Nederlands b/rtdata/languages/Nederlands index c1c0dbc02..0ea147eb8 100644 --- a/rtdata/languages/Nederlands +++ b/rtdata/languages/Nederlands @@ -2153,12 +2153,16 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !LENSPROFILE_CORRECTION_AUTOMATCH;Auto-matched correction parameters !LENSPROFILE_CORRECTION_LCPFILE;LCP File !LENSPROFILE_CORRECTION_MANUAL;Manual correction parameters !LENSPROFILE_LENS_WARNING;Warning: the crop factor used for lens profiling is larger than the crop factor of the camera, the results might be wrong. !MAIN_MSG_TOOMANYOPENEDITORS;Too many open editors.\nPlease close an editor to continue. !MAIN_TOOLTIP_BACKCOLOR3;Background color of the preview: Middle grey\nShortcut: 9 +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PREFERENCES_AUTOSAVE_TP_OPEN;Automatically save tools collapsed/expanded\nstate before exiting !PREFERENCES_D50_OLD;5000K !PREFERENCES_DIRECTORIES;Directories @@ -2190,4 +2194,7 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_RETINEX_GAINOFFS;Gain and Offset (brightness) !TP_RETINEX_GAINTRANSMISSION;Gain transmission !TP_RETINEX_GAINTRANSMISSION_TOOLTIP;Amplify or reduce transmission map to achieve luminance.\nAbscissa: transmission -min from 0, mean, and values (max).\nOrdinate: gain. +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted diff --git a/rtdata/languages/Norsk BM b/rtdata/languages/Norsk BM index b0fe3aa6e..7e68880b8 100644 --- a/rtdata/languages/Norsk BM +++ b/rtdata/languages/Norsk BM @@ -971,6 +971,9 @@ TP_WBALANCE_TEMPERATURE;Temperatur !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1112,6 +1115,7 @@ TP_WBALANCE_TEMPERATURE;Temperatur !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1942,6 +1946,9 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Polish b/rtdata/languages/Polish index 6f0f6a3b2..3c54cc184 100644 --- a/rtdata/languages/Polish +++ b/rtdata/languages/Polish @@ -1665,6 +1665,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1707,6 +1710,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2014,6 +2018,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Polish (Latin Characters) b/rtdata/languages/Polish (Latin Characters) index 10c001a06..85b9e3f0b 100644 --- a/rtdata/languages/Polish (Latin Characters) +++ b/rtdata/languages/Polish (Latin Characters) @@ -1665,6 +1665,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1707,6 +1710,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2014,6 +2018,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Portugues (Brasil) b/rtdata/languages/Portugues (Brasil) index 419e40312..661f24483 100644 --- a/rtdata/languages/Portugues (Brasil) +++ b/rtdata/languages/Portugues (Brasil) @@ -972,6 +972,9 @@ TP_WBALANCE_TEMPERATURE;Temperatura !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1113,6 +1116,7 @@ TP_WBALANCE_TEMPERATURE;Temperatura !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1943,6 +1947,9 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Russian b/rtdata/languages/Russian index 4573fc5f0..a67674975 100644 --- a/rtdata/languages/Russian +++ b/rtdata/languages/Russian @@ -1525,6 +1525,9 @@ ZOOMPANEL_ZOOMOUT;Удалить - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1583,6 +1586,7 @@ ZOOMPANEL_ZOOMOUT;Удалить - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2010,6 +2014,9 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Serbian (Cyrilic Characters) b/rtdata/languages/Serbian (Cyrilic Characters) index 2d231e4c4..b6f614cce 100644 --- a/rtdata/languages/Serbian (Cyrilic Characters) +++ b/rtdata/languages/Serbian (Cyrilic Characters) @@ -1558,6 +1558,9 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1615,6 +1618,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2009,6 +2013,9 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Serbian (Latin Characters) b/rtdata/languages/Serbian (Latin Characters) index eb1f4c5ab..6feba1bf3 100644 --- a/rtdata/languages/Serbian (Latin Characters) +++ b/rtdata/languages/Serbian (Latin Characters) @@ -1558,6 +1558,9 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1615,6 +1618,7 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift !PARTIALPASTE_RETINEX;Retinex +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -2009,6 +2013,9 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_RETINEX_VIEW_TRAN;Transmission - Auto !TP_RETINEX_VIEW_TRAN2;Transmission - Fixed !TP_RETINEX_VIEW_UNSHARP;Unsharp mask +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 diff --git a/rtdata/languages/Slovak b/rtdata/languages/Slovak index 16ac150da..f589c3ee1 100644 --- a/rtdata/languages/Slovak +++ b/rtdata/languages/Slovak @@ -1034,6 +1034,9 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1166,6 +1169,7 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low @@ -1951,6 +1955,9 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Suomi b/rtdata/languages/Suomi index 72fe637d3..ecdcfff8a 100644 --- a/rtdata/languages/Suomi +++ b/rtdata/languages/Suomi @@ -973,6 +973,9 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1114,6 +1117,7 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1943,6 +1947,9 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/Swedish b/rtdata/languages/Swedish index 53bdbc3dc..0f3ddaafd 100644 --- a/rtdata/languages/Swedish +++ b/rtdata/languages/Swedish @@ -1952,6 +1952,9 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. !IPTCPANEL_COPYRIGHT;Copyright notice @@ -1988,6 +1991,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !PARTIALPASTE_RAWCACORR_CAREDBLUE;CA red & blue !PARTIALPASTE_RAW_IMAGENUM;Sub-image !PARTIALPASTE_RAW_PIXELSHIFT;Pixel Shift +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PREFERENCES_AUTOSAVE_TP_OPEN;Automatically save tools collapsed/expanded\nstate before exiting !PREFERENCES_CMMBPC;Black point compensation !PREFERENCES_D50_OLD;5000K @@ -2135,6 +2139,9 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. !TP_RETINEX_VIEW_MASK;Mask !TP_RETINEX_VIEW_METHOD_TOOLTIP;Standard - Normal display.\nMask - Displays the mask.\nUnsharp mask - Displays the image with a high radius unsharp mask.\nTransmission - Auto/Fixed - Displays the file transmission-map, before any action on contrast and brightness.\n\nAttention: the mask does not correspond to reality, but is amplified to make it more visible. +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_WAVELET_CBENAB;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CHRO_TOOLTIP;Sets the wavelet level which will be the threshold between saturated and pastel colors.\n1-x: saturated\nx-9: pastel\n\nIf the value exceeds the amount of wavelet levels you are using then it will be ignored. diff --git a/rtdata/languages/Turkish b/rtdata/languages/Turkish index a05b499db..937e0dabb 100644 --- a/rtdata/languages/Turkish +++ b/rtdata/languages/Turkish @@ -972,6 +972,9 @@ TP_WBALANCE_TEMPERATURE;Isı !HISTORY_MSG_485;Lens Correction !HISTORY_MSG_486;Lens Correction - Camera !HISTORY_MSG_487;Lens Correction - Lens +!HISTORY_MSG_488;HDR Tone Mapping +!HISTORY_MSG_489;HDR TM - Threshold +!HISTORY_MSG_490;HDR TM - Amount !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !IPTCPANEL_CATEGORYHINT;Identifies the subject of the image in the opinion of the provider. !IPTCPANEL_CITYHINT;Enter the name of the city pictured in this image. @@ -1113,6 +1116,7 @@ TP_WBALANCE_TEMPERATURE;Isı !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast +!PARTIALPASTE_TM_FATTAL;HDR Tone mapping !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_ADD;Add @@ -1942,6 +1946,9 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 !TP_SHARPENMICRO_UNIFORMITY;Uniformity +!TP_TM_FATTAL_AMOUNT;Amount +!TP_TM_FATTAL_LABEL;HDR Tone Mapping +!TP_TM_FATTAL_THRESHOLD;Threshold !TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift !TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH !TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones diff --git a/rtdata/languages/default b/rtdata/languages/default index 8320a351b..f428aca47 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1928,9 +1928,9 @@ TP_SHARPENMICRO_AMOUNT;Quantity TP_SHARPENMICRO_LABEL;Microcontrast TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 TP_SHARPENMICRO_UNIFORMITY;Uniformity +TP_TM_FATTAL_AMOUNT;Amount TP_TM_FATTAL_LABEL;HDR Tone Mapping TP_TM_FATTAL_THRESHOLD;Threshold -TP_TM_FATTAL_AMOUNT;Amount TP_VIBRANCE_AVOIDCOLORSHIFT;Avoid color shift TP_VIBRANCE_CURVEEDITOR_SKINTONES;HH TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL;Skin-tones From 6acf170744540501be1d29e76986605aa89b0152 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 19 Nov 2017 17:52:19 +0100 Subject: [PATCH 71/72] use camconst.json matrices (and levels) also for DNGs (issue #4129) --- rtengine/dcraw.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index b7e6fd82f..7fef1146f 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -9693,7 +9693,11 @@ dng_skip: && cmatrix[0][0] > 0.125) { memcpy (rgb_cam, cmatrix, sizeof cmatrix); raw_color = 0; + if (dng_version && !use_camera_wb) { // RT + raw_color = 1; + } } + // RT -- TODO: check if these special cases are still needed! if(!strncmp(make, "Panasonic", 9) && !strncmp(model, "DMC-LX100",9)) adobe_coeff (make, model); if(!strncmp(make, "Samsung", 7) && !strncmp(model, "GX20",4)) From d47e7f67b247f028ca9c20b5021a3b86dd138235 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 19 Nov 2017 18:40:48 +0100 Subject: [PATCH 72/72] fattal: set the lower bound to 1 instead of 0 (so that it's obvious it still has an effect) --- rtengine/procparams.h | 2 +- rtgui/fattaltonemap.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/procparams.h b/rtengine/procparams.h index b3139cdcb..39be8e33e 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -755,7 +755,7 @@ public: { enabled = false; threshold = 0; - amount = 0; + amount = 1; } }; diff --git a/rtgui/fattaltonemap.cc b/rtgui/fattaltonemap.cc index d14b76004..10dba51cf 100644 --- a/rtgui/fattaltonemap.cc +++ b/rtgui/fattaltonemap.cc @@ -29,7 +29,7 @@ FattalToneMapping::FattalToneMapping(): FoldableToolPanel(this, "fattal", M("TP_ // setEnabledTooltipMarkup(M("TP_EPD_TOOLTIP")); - amount = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_AMOUNT"), 0., 100., 1., 0.0)); + amount = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_AMOUNT"), 1., 100., 1., 0.0)); threshold = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_THRESHOLD"), -100., 100., 1., 0.0)); amount->setAdjusterListener(this);