From e12b58cfcf32c62823f1ffbd32291d7997576b0c Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Wed, 6 Nov 2019 14:40:05 +0100 Subject: [PATCH 1/8] Decode standard Panasonic DC-S1 and DC-S1R files (pixelshift files are not supported yet), #5204 --- rtengine/camconst.json | 5 ++ rtengine/dcraw.cc | 171 +++++++++++++++++++++++++++++++++++++++++ rtengine/dcraw.h | 15 ++++ 3 files changed, 191 insertions(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 3393dec9f..169b0b0b7 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -2142,6 +2142,11 @@ Camera constants: } }, + { // Quality B, per ISO info missing + "make_model": [ "Panasonic DC-S1", "Panasonic DC-S1R" ], + "ranges": { "white": 16383 } + }, + { // Quality B, per ISO info missing "make_model": "PENTAX K-x", "dcraw_matrix": [ 8843,-2837,-625,-5025,12644,2668,-411,1234,7410 ], // adobe dcp d65 diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ae6f60cd1..7278f867f 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2757,6 +2757,10 @@ void CLASS panasonic_load_raw() } } } + } else if (RT_pana_info.encoding == 6) { + panasonicC6_load_raw(); + } else if (RT_pana_info.encoding == 7) { + panasonicC7_load_raw(); } else { for (row=0; row < height; row++) for (col=0; col < raw_width; col++) { @@ -10759,6 +10763,173 @@ void CLASS nikon_14bit_load_raw() free(buf); } +// Code adapted from libraw +/* -*- C++ -*- + * Copyright 2019 LibRaw LLC (info@libraw.org) + * + LibRaw is free software; you can redistribute it and/or modify + it under the terms of the one of two licenses as you choose: + +1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 + (See file LICENSE.LGPL provided in LibRaw distribution archive for details). + +2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + (See file LICENSE.CDDL provided in LibRaw distribution archive for details). + + */ + +void CLASS pana_cs6_page_decoder::read_page() +{ + if (!buffer || (maxoffset - lastoffset < 16)) + ; +#define wbuffer(i) ((unsigned short)buffer[lastoffset + 15 - i]) + pixelbuffer[0] = (wbuffer(0) << 6) | (wbuffer(1) >> 2); // 14 bit + pixelbuffer[1] = + (((wbuffer(1) & 0x3) << 12) | (wbuffer(2) << 4) | (wbuffer(3) >> 4)) & + 0x3fff; + pixelbuffer[2] = (wbuffer(3) >> 2) & 0x3; + pixelbuffer[3] = ((wbuffer(3) & 0x3) << 8) | wbuffer(4); + pixelbuffer[4] = (wbuffer(5) << 2) | (wbuffer(6) >> 6); + pixelbuffer[5] = ((wbuffer(6) & 0x3f) << 4) | (wbuffer(7) >> 4); + pixelbuffer[6] = (wbuffer(7) >> 2) & 0x3; + pixelbuffer[7] = ((wbuffer(7) & 0x3) << 8) | wbuffer(8); + pixelbuffer[8] = ((wbuffer(9) << 2) & 0x3fc) | (wbuffer(10) >> 6); + pixelbuffer[9] = ((wbuffer(10) << 4) | (wbuffer(11) >> 4)) & 0x3ff; + pixelbuffer[10] = (wbuffer(11) >> 2) & 0x3; + pixelbuffer[11] = ((wbuffer(11) & 0x3) << 8) | wbuffer(12); + pixelbuffer[12] = (((wbuffer(13) << 2) & 0x3fc) | wbuffer(14) >> 6) & 0x3ff; + pixelbuffer[13] = ((wbuffer(14) << 4) | (wbuffer(15) >> 4)) & 0x3ff; +#undef wbuffer + current = 0; + lastoffset += 16; +} + +void CLASS panasonicC6_load_raw() +{ + const int rowstep = 16; + const int blocksperrow = raw_width / 11; + const int rowbytes = blocksperrow * 16; + unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); + merror(iobuf, "panasonicC6_load_raw()"); + + for (int row = 0; row < raw_height - rowstep + 1; + row += rowstep) + { + int rowstoread = MIN(rowstep, raw_height - row); + fread (iobuf, rowbytes, rowstoread, ifp); +// if (libraw_internal_data.internal_data.input->read( +// iobuf, rowbytes, rowstoread) != rowstoread) +// throw LIBRAW_EXCEPTION_IO_EOF; + pana_cs6_page_decoder page(iobuf, rowbytes * rowstoread); + for (int crow = 0, col = 0; crow < rowstoread; crow++, col = 0) + { + unsigned short *rowptr = &raw_image[(row + crow) * raw_width]; + for (int rblock = 0; rblock < blocksperrow; rblock++) + { + page.read_page(); + unsigned oddeven[2] = {0, 0}, nonzero[2] = {0, 0}; + unsigned pmul = 0, pixel_base = 0; + for (int pix = 0; pix < 11; pix++) + { + if (pix % 3 == 2) + { + unsigned base = page.nextpixel(); + if (base > 3); +// throw LIBRAW_EXCEPTION_IO_CORRUPT; // not possible b/c of 2-bit + // field, but.... + if (base == 3) + base = 4; + pixel_base = 0x200 << base; + pmul = 1 << base; + } + unsigned epixel = page.nextpixel(); + if (oddeven[pix % 2]) + { + epixel *= pmul; + if (pixel_base < 0x2000 && nonzero[pix % 2] > pixel_base) + epixel += nonzero[pix % 2] - pixel_base; + nonzero[pix % 2] = epixel; + } + else + { + oddeven[pix % 2] = epixel; + if (epixel) + nonzero[pix % 2] = epixel; + else + epixel = nonzero[pix % 2]; + } + unsigned spix = epixel - 0xf; + if (spix <= 0xffff) + rowptr[col++] = spix & 0xffff; + else + { + epixel = (((signed int)(epixel + 0x7ffffff1)) >> 0x1f); + rowptr[col++] = epixel & 0x3fff; + } + } + } + } + } + free(iobuf); + tiff_bps = RT_pana_info.bpp; +} + +void CLASS panasonicC7_load_raw() +{ + const int rowstep = 16; + int pixperblock = RT_pana_info.bpp == 14 ? 9 : 10; + int rowbytes = raw_width / pixperblock * 16; + unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); + merror(iobuf, "panasonicC7_load_raw()"); + for (int row = 0; row < raw_height - rowstep + 1; + row += rowstep) + { + int rowstoread = MIN(rowstep, raw_height - row); + fread (iobuf, rowbytes, rowstoread, ifp); + unsigned char *bytes = iobuf; + for (int crow = 0; crow < rowstoread; crow++) + { + unsigned short *rowptr = &raw_image[(row + crow)]; + for (int col = 0; col < raw_width - pixperblock + 1; + col += pixperblock, bytes += 16) + { + if (RT_pana_info.bpp == 14) + { + rowptr[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); + rowptr[col + 1] = + (bytes[1] >> 6) + 4 * (bytes[2]) + ((bytes[3] & 0xF) << 10); + rowptr[col + 2] = + (bytes[3] >> 4) + 16 * (bytes[4]) + ((bytes[5] & 3) << 12); + rowptr[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); + rowptr[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); + rowptr[col + 5] = + (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); + rowptr[col + 6] = + (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); + rowptr[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); + rowptr[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); + } + else if (RT_pana_info.bpp == + 12) // have not seen in the wild yet + { + rowptr[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; + rowptr[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); + rowptr[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; + rowptr[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); + rowptr[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; + rowptr[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); + rowptr[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; + rowptr[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); + rowptr[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; + rowptr[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); + } + } + } + } + free(iobuf); + tiff_bps = RT_pana_info.bpp; +} + //----------------------------------------------------------------------------- /* RT: Delete from here */ diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 5e17b47ab..522cc798d 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -411,6 +411,21 @@ private: unsigned encoding; }; +class pana_cs6_page_decoder +{ + unsigned int pixelbuffer[14], lastoffset, maxoffset; + unsigned char current, *buffer; + public: + pana_cs6_page_decoder(unsigned char *_buffer, unsigned int bsize) + : lastoffset(0), maxoffset(bsize), current(0), buffer(_buffer) + { + } + void read_page(); // will throw IO error if not enough space in buffer + unsigned int nextpixel() { return current < 14 ? pixelbuffer[current++] : 0; } +}; +void panasonicC6_load_raw(); +void panasonicC7_load_raw(); + void canon_rmf_load_raw(); void panasonic_load_raw(); void olympus_load_raw(); From 70a00d335acf5d3331da6c6c1e959d09ea91f443 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Wed, 6 Nov 2019 14:53:50 +0100 Subject: [PATCH 2/8] better white level for panasonic dc-s1 --- rtengine/camconst.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 169b0b0b7..32e8bc628 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -2144,7 +2144,7 @@ Camera constants: { // Quality B, per ISO info missing "make_model": [ "Panasonic DC-S1", "Panasonic DC-S1R" ], - "ranges": { "white": 16383 } + "ranges": { "white": 16225 } }, { // Quality B, per ISO info missing From 2da0990433462eda5b099a7b57581012fbf3fdc6 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Wed, 6 Nov 2019 23:07:41 +0100 Subject: [PATCH 3/8] make own compilation unit for panasonic decoders --- rtengine/CMakeLists.txt | 1 + rtengine/dcraw.cc | 260 ------------------------------- rtengine/dcraw.h | 12 -- rtengine/panasonic_decoders.cc | 276 +++++++++++++++++++++++++++++++++ 4 files changed, 277 insertions(+), 272 deletions(-) create mode 100644 rtengine/panasonic_decoders.cc diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 07b0d9f84..c37341c8b 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -104,6 +104,7 @@ set(RTENGINESOURCEFILES lj92.c loadinitial.cc myfile.cc + panasonic_decoders.cc pdaflinesfilter.cc PF_correct_RT.cc pipettebuffer.cc diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 7278f867f..b81594dc4 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -2688,97 +2688,6 @@ void CLASS canon_rmf_load_raw() maximum = curve[0x3ff]; } -unsigned CLASS pana_bits_t::operator() (int nbits, unsigned *bytes) -{ -/*RT static uchar buf[0x4000]; */ -/*RT static int vbits;*/ - int byte; - - if (!nbits && !bytes) return vbits=0; - if (!vbits) { - fread (buf+load_flags, 1, 0x4000-load_flags, ifp); - fread (buf, 1, load_flags, ifp); - } - if (encoding == 5) { - for (byte = 0; byte < 16; byte++) - { - bytes[byte] = buf[vbits++]; - vbits &= 0x3FFF; - } - return 0; - } else { - vbits = (vbits - nbits) & 0x1ffff; - byte = vbits >> 3 ^ 0x3ff0; - return (buf[byte] | buf[byte+1] << 8) >> (vbits & 7) & ~(-1 << nbits); - } -} - -void CLASS panasonic_load_raw() -{ - pana_bits_t pana_bits(ifp,load_flags, RT_pana_info.encoding); - int row, col, i, j, sh=0, pred[2], nonz[2]; - unsigned bytes[16] = {}; - ushort *raw_block_data; - - pana_bits(0, 0); - int enc_blck_size = RT_pana_info.bpp == 12 ? 10 : 9; - if (RT_pana_info.encoding == 5) { - for (row = 0; row < raw_height; row++) - { - raw_block_data = raw_image + row * raw_width; - - for (col = 0; col < raw_width; col += enc_blck_size) { - pana_bits(0, bytes); - - if (RT_pana_info.bpp == 12) { - raw_block_data[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; - raw_block_data[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); - raw_block_data[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; - raw_block_data[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); - raw_block_data[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; - raw_block_data[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); - raw_block_data[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; - raw_block_data[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); - raw_block_data[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; - raw_block_data[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); - } - else if (RT_pana_info.bpp == 14) { - raw_block_data[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); - raw_block_data[col + 1] = (bytes[1] >> 6) + 4 * (bytes[2]) + - ((bytes[3] & 0xF) << 10); - raw_block_data[col + 2] = (bytes[3] >> 4) + 16 * (bytes[4]) + - ((bytes[5] & 3) << 12); - raw_block_data[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); - raw_block_data[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); - raw_block_data[col + 5] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); - raw_block_data[col + 6] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); - raw_block_data[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); - raw_block_data[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); - } - } - } - } else if (RT_pana_info.encoding == 6) { - panasonicC6_load_raw(); - } else if (RT_pana_info.encoding == 7) { - panasonicC7_load_raw(); - } else { - for (row=0; row < height; row++) - for (col=0; col < raw_width; col++) { - if ((i = col % 14) == 0) - pred[0] = pred[1] = nonz[0] = nonz[1] = 0; - if (i % 3 == 2) sh = 4 >> (3 - pana_bits(2)); - if (nonz[i & 1]) { - if ((j = pana_bits(8))) { - if ((pred[i & 1] -= 0x80 << sh) < 0 || sh == 4) - pred[i & 1] &= ~(-1 << sh); - pred[i & 1] += j << sh; - } - } else if ((nonz[i & 1] = pana_bits(8)) || i > 11) - pred[i & 1] = nonz[i & 1] << 4 | pana_bits(4); - if ((RAW(row,col) = pred[col & 1]) > 4098 && col < width) derror(); - } - } -} void CLASS olympus_load_raw() { @@ -10763,175 +10672,6 @@ void CLASS nikon_14bit_load_raw() free(buf); } -// Code adapted from libraw -/* -*- C++ -*- - * Copyright 2019 LibRaw LLC (info@libraw.org) - * - LibRaw is free software; you can redistribute it and/or modify - it under the terms of the one of two licenses as you choose: - -1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 - (See file LICENSE.LGPL provided in LibRaw distribution archive for details). - -2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - (See file LICENSE.CDDL provided in LibRaw distribution archive for details). - - */ - -void CLASS pana_cs6_page_decoder::read_page() -{ - if (!buffer || (maxoffset - lastoffset < 16)) - ; -#define wbuffer(i) ((unsigned short)buffer[lastoffset + 15 - i]) - pixelbuffer[0] = (wbuffer(0) << 6) | (wbuffer(1) >> 2); // 14 bit - pixelbuffer[1] = - (((wbuffer(1) & 0x3) << 12) | (wbuffer(2) << 4) | (wbuffer(3) >> 4)) & - 0x3fff; - pixelbuffer[2] = (wbuffer(3) >> 2) & 0x3; - pixelbuffer[3] = ((wbuffer(3) & 0x3) << 8) | wbuffer(4); - pixelbuffer[4] = (wbuffer(5) << 2) | (wbuffer(6) >> 6); - pixelbuffer[5] = ((wbuffer(6) & 0x3f) << 4) | (wbuffer(7) >> 4); - pixelbuffer[6] = (wbuffer(7) >> 2) & 0x3; - pixelbuffer[7] = ((wbuffer(7) & 0x3) << 8) | wbuffer(8); - pixelbuffer[8] = ((wbuffer(9) << 2) & 0x3fc) | (wbuffer(10) >> 6); - pixelbuffer[9] = ((wbuffer(10) << 4) | (wbuffer(11) >> 4)) & 0x3ff; - pixelbuffer[10] = (wbuffer(11) >> 2) & 0x3; - pixelbuffer[11] = ((wbuffer(11) & 0x3) << 8) | wbuffer(12); - pixelbuffer[12] = (((wbuffer(13) << 2) & 0x3fc) | wbuffer(14) >> 6) & 0x3ff; - pixelbuffer[13] = ((wbuffer(14) << 4) | (wbuffer(15) >> 4)) & 0x3ff; -#undef wbuffer - current = 0; - lastoffset += 16; -} - -void CLASS panasonicC6_load_raw() -{ - const int rowstep = 16; - const int blocksperrow = raw_width / 11; - const int rowbytes = blocksperrow * 16; - unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); - merror(iobuf, "panasonicC6_load_raw()"); - - for (int row = 0; row < raw_height - rowstep + 1; - row += rowstep) - { - int rowstoread = MIN(rowstep, raw_height - row); - fread (iobuf, rowbytes, rowstoread, ifp); -// if (libraw_internal_data.internal_data.input->read( -// iobuf, rowbytes, rowstoread) != rowstoread) -// throw LIBRAW_EXCEPTION_IO_EOF; - pana_cs6_page_decoder page(iobuf, rowbytes * rowstoread); - for (int crow = 0, col = 0; crow < rowstoread; crow++, col = 0) - { - unsigned short *rowptr = &raw_image[(row + crow) * raw_width]; - for (int rblock = 0; rblock < blocksperrow; rblock++) - { - page.read_page(); - unsigned oddeven[2] = {0, 0}, nonzero[2] = {0, 0}; - unsigned pmul = 0, pixel_base = 0; - for (int pix = 0; pix < 11; pix++) - { - if (pix % 3 == 2) - { - unsigned base = page.nextpixel(); - if (base > 3); -// throw LIBRAW_EXCEPTION_IO_CORRUPT; // not possible b/c of 2-bit - // field, but.... - if (base == 3) - base = 4; - pixel_base = 0x200 << base; - pmul = 1 << base; - } - unsigned epixel = page.nextpixel(); - if (oddeven[pix % 2]) - { - epixel *= pmul; - if (pixel_base < 0x2000 && nonzero[pix % 2] > pixel_base) - epixel += nonzero[pix % 2] - pixel_base; - nonzero[pix % 2] = epixel; - } - else - { - oddeven[pix % 2] = epixel; - if (epixel) - nonzero[pix % 2] = epixel; - else - epixel = nonzero[pix % 2]; - } - unsigned spix = epixel - 0xf; - if (spix <= 0xffff) - rowptr[col++] = spix & 0xffff; - else - { - epixel = (((signed int)(epixel + 0x7ffffff1)) >> 0x1f); - rowptr[col++] = epixel & 0x3fff; - } - } - } - } - } - free(iobuf); - tiff_bps = RT_pana_info.bpp; -} - -void CLASS panasonicC7_load_raw() -{ - const int rowstep = 16; - int pixperblock = RT_pana_info.bpp == 14 ? 9 : 10; - int rowbytes = raw_width / pixperblock * 16; - unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); - merror(iobuf, "panasonicC7_load_raw()"); - for (int row = 0; row < raw_height - rowstep + 1; - row += rowstep) - { - int rowstoread = MIN(rowstep, raw_height - row); - fread (iobuf, rowbytes, rowstoread, ifp); - unsigned char *bytes = iobuf; - for (int crow = 0; crow < rowstoread; crow++) - { - unsigned short *rowptr = &raw_image[(row + crow)]; - for (int col = 0; col < raw_width - pixperblock + 1; - col += pixperblock, bytes += 16) - { - if (RT_pana_info.bpp == 14) - { - rowptr[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); - rowptr[col + 1] = - (bytes[1] >> 6) + 4 * (bytes[2]) + ((bytes[3] & 0xF) << 10); - rowptr[col + 2] = - (bytes[3] >> 4) + 16 * (bytes[4]) + ((bytes[5] & 3) << 12); - rowptr[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); - rowptr[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); - rowptr[col + 5] = - (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); - rowptr[col + 6] = - (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); - rowptr[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); - rowptr[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); - } - else if (RT_pana_info.bpp == - 12) // have not seen in the wild yet - { - rowptr[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; - rowptr[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); - rowptr[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; - rowptr[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); - rowptr[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; - rowptr[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); - rowptr[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; - rowptr[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); - rowptr[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; - rowptr[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); - } - } - } - } - free(iobuf); - tiff_bps = RT_pana_info.bpp; -} - -//----------------------------------------------------------------------------- - /* RT: Delete from here */ /*RT*/#undef SQR /*RT*/#undef MAX diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h index 522cc798d..3d753d876 100644 --- a/rtengine/dcraw.h +++ b/rtengine/dcraw.h @@ -411,18 +411,6 @@ private: unsigned encoding; }; -class pana_cs6_page_decoder -{ - unsigned int pixelbuffer[14], lastoffset, maxoffset; - unsigned char current, *buffer; - public: - pana_cs6_page_decoder(unsigned char *_buffer, unsigned int bsize) - : lastoffset(0), maxoffset(bsize), current(0), buffer(_buffer) - { - } - void read_page(); // will throw IO error if not enough space in buffer - unsigned int nextpixel() { return current < 14 ? pixelbuffer[current++] : 0; } -}; void panasonicC6_load_raw(); void panasonicC7_load_raw(); diff --git a/rtengine/panasonic_decoders.cc b/rtengine/panasonic_decoders.cc new file mode 100644 index 000000000..8949a0851 --- /dev/null +++ b/rtengine/panasonic_decoders.cc @@ -0,0 +1,276 @@ + +#include "StopWatch.h" +#include +#include "dcraw.h" +// Code adapted from libraw +/* -*- C++ -*- + * Copyright 2019 LibRaw LLC (info@libraw.org) + * + LibRaw is free software; you can redistribute it and/or modify + it under the terms of the one of two licenses as you choose: + +1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 + (See file LICENSE.LGPL provided in LibRaw distribution archive for details). + +2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + (See file LICENSE.CDDL provided in LibRaw distribution archive for details). + +*/ + + +unsigned DCraw::pana_bits_t::operator() (int nbits, unsigned *bytes) +{ + int byte; + + if (!nbits && !bytes) { + return vbits=0; + } + if (!vbits) { + fread (buf+load_flags, 1, 0x4000-load_flags, ifp); + fread (buf, 1, load_flags, ifp); + } + if (encoding == 5) { + for (byte = 0; byte < 16; byte++) + { + bytes[byte] = buf[vbits++]; + vbits &= 0x3FFF; + } + return 0; + } else { + vbits = (vbits - nbits) & 0x1ffff; + byte = vbits >> 3 ^ 0x3ff0; + return (buf[byte] | buf[byte+1] << 8) >> (vbits & 7) & ~(-1 << nbits); + } +} + +class pana_cs6_page_decoder +{ + unsigned int pixelbuffer[14], lastoffset, maxoffset; + unsigned char current, *buffer; + public: + pana_cs6_page_decoder(unsigned char *_buffer, unsigned int bsize) + : lastoffset(0), maxoffset(bsize), current(0), buffer(_buffer) + { + } + void read_page(); // will throw IO error if not enough space in buffer + unsigned int nextpixel() { return current < 14 ? pixelbuffer[current++] : 0; } +}; + +#define wbuffer(i) ((unsigned short)buffer[lastoffset + 15 - i]) + +void pana_cs6_page_decoder::read_page() +{ + if (!buffer || (maxoffset - lastoffset < 16)) + ; + pixelbuffer[0] = (wbuffer(0) << 6) | (wbuffer(1) >> 2); // 14 bit + pixelbuffer[1] = (((wbuffer(1) & 0x3) << 12) | (wbuffer(2) << 4) | (wbuffer(3) >> 4)) & 0x3fff; + pixelbuffer[2] = (wbuffer(3) >> 2) & 0x3; + pixelbuffer[3] = ((wbuffer(3) & 0x3) << 8) | wbuffer(4); + pixelbuffer[4] = (wbuffer(5) << 2) | (wbuffer(6) >> 6); + pixelbuffer[5] = ((wbuffer(6) & 0x3f) << 4) | (wbuffer(7) >> 4); + pixelbuffer[6] = (wbuffer(7) >> 2) & 0x3; + pixelbuffer[7] = ((wbuffer(7) & 0x3) << 8) | wbuffer(8); + pixelbuffer[8] = ((wbuffer(9) << 2) & 0x3fc) | (wbuffer(10) >> 6); + pixelbuffer[9] = ((wbuffer(10) << 4) | (wbuffer(11) >> 4)) & 0x3ff; + pixelbuffer[10] = (wbuffer(11) >> 2) & 0x3; + pixelbuffer[11] = ((wbuffer(11) & 0x3) << 8) | wbuffer(12); + pixelbuffer[12] = (((wbuffer(13) << 2) & 0x3fc) | wbuffer(14) >> 6) & 0x3ff; + pixelbuffer[13] = ((wbuffer(14) << 4) | (wbuffer(15) >> 4)) & 0x3ff; + current = 0; + lastoffset += 16; +} +#undef wbuffer + +void DCraw::panasonic_load_raw() +{ +StopWatch Stop1("panasonic_load_raw"); + pana_bits_t pana_bits(ifp,load_flags, RT_pana_info.encoding); + int row, col, i, j, sh=0, pred[2], nonz[2]; + unsigned bytes[16] = {}; + + pana_bits(0, 0); + int enc_blck_size = RT_pana_info.bpp == 12 ? 10 : 9; + if (RT_pana_info.encoding == 5 || RT_pana_info.encoding == 7) { + for (row = 0; row < raw_height; row++) { + ushort* raw_block_data = raw_image + row * raw_width; + + for (col = 0; col < raw_width; col += enc_blck_size) { + pana_bits(0, bytes); + + if (RT_pana_info.bpp == 12) { + raw_block_data[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; + raw_block_data[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); + raw_block_data[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; + raw_block_data[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); + raw_block_data[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; + raw_block_data[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); + raw_block_data[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; + raw_block_data[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); + raw_block_data[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; + raw_block_data[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); + } + else if (RT_pana_info.bpp == 14) { + raw_block_data[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); + raw_block_data[col + 1] = (bytes[1] >> 6) + 4 * (bytes[2]) + + ((bytes[3] & 0xF) << 10); + raw_block_data[col + 2] = (bytes[3] >> 4) + 16 * (bytes[4]) + + ((bytes[5] & 3) << 12); + raw_block_data[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); + raw_block_data[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); + raw_block_data[col + 5] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); + raw_block_data[col + 6] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); + raw_block_data[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); + raw_block_data[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); + } + } + } + } else if (RT_pana_info.encoding == 6) { + panasonicC6_load_raw(); + } else if (RT_pana_info.encoding == 7) { + panasonicC7_load_raw(); + } else { + for (row=0; row < height; row++) + for (col=0; col < raw_width; col++) { + if ((i = col % 14) == 0) + pred[0] = pred[1] = nonz[0] = nonz[1] = 0; + if (i % 3 == 2) sh = 4 >> (3 - pana_bits(2)); + if (nonz[i & 1]) { + if ((j = pana_bits(8))) { + if ((pred[i & 1] -= 0x80 << sh) < 0 || sh == 4) + pred[i & 1] &= ~(-1 << sh); + pred[i & 1] += j << sh; + } + } else if ((nonz[i & 1] = pana_bits(8)) || i > 11) + pred[i & 1] = nonz[i & 1] << 4 | pana_bits(4); + if ((raw_image[(row)*raw_width+(col)] = pred[col & 1]) > 4098 && col < width) derror(); + } + } +} + +void DCraw::panasonicC6_load_raw() +{ + const int rowstep = 16; + const int blocksperrow = raw_width / 11; + const int rowbytes = blocksperrow * 16; + unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); + merror(iobuf, "panasonicC6_load_raw()"); + + for (int row = 0; row < raw_height - rowstep + 1; + row += rowstep) + { + int rowstoread = MIN(rowstep, raw_height - row); + fread (iobuf, rowbytes, rowstoread, ifp); +// if (libraw_internal_data.internal_data.input->read( +// iobuf, rowbytes, rowstoread) != rowstoread) +// throw LIBRAW_EXCEPTION_IO_EOF; + pana_cs6_page_decoder page(iobuf, rowbytes * rowstoread); + for (int crow = 0, col = 0; crow < rowstoread; crow++, col = 0) + { + unsigned short *rowptr = &raw_image[(row + crow) * raw_width]; + for (int rblock = 0; rblock < blocksperrow; rblock++) + { + page.read_page(); + unsigned oddeven[2] = {0, 0}, nonzero[2] = {0, 0}; + unsigned pmul = 0, pixel_base = 0; + for (int pix = 0; pix < 11; pix++) + { + if (pix % 3 == 2) + { + unsigned base = page.nextpixel(); + if (base > 3); +// throw LIBRAW_EXCEPTION_IO_CORRUPT; // not possible b/c of 2-bit + // field, but.... + if (base == 3) + base = 4; + pixel_base = 0x200 << base; + pmul = 1 << base; + } + unsigned epixel = page.nextpixel(); + if (oddeven[pix % 2]) + { + epixel *= pmul; + if (pixel_base < 0x2000 && nonzero[pix % 2] > pixel_base) + epixel += nonzero[pix % 2] - pixel_base; + nonzero[pix % 2] = epixel; + } + else + { + oddeven[pix % 2] = epixel; + if (epixel) + nonzero[pix % 2] = epixel; + else + epixel = nonzero[pix % 2]; + } + unsigned spix = epixel - 0xf; + if (spix <= 0xffff) + rowptr[col++] = spix & 0xffff; + else + { + epixel = (((signed int)(epixel + 0x7ffffff1)) >> 0x1f); + rowptr[col++] = epixel & 0x3fff; + } + } + } + } + } + free(iobuf); + tiff_bps = RT_pana_info.bpp; +} + +void DCraw::panasonicC7_load_raw() +{ + constexpr int rowstep = 16; + const int pixperblock = RT_pana_info.bpp == 14 ? 9 : 10; + const int rowbytes = raw_width / pixperblock * 16; + + unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); + merror(iobuf, "panasonicC7_load_raw()"); + for (int row = 0; row < raw_height - rowstep + 1; row += rowstep) { + const int rowstoread = MIN(rowstep, raw_height - row); + fread (iobuf, rowbytes, rowstoread, ifp); + unsigned char *bytes = iobuf; + for (int crow = 0; crow < rowstoread; crow++) { + unsigned short *rowptr = &raw_image[row + crow]; + for (int col = 0; col < raw_width - pixperblock + 1; col += pixperblock, bytes += 16) { + if (RT_pana_info.bpp == 14) { + rowptr[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); + rowptr[col + 1] = (bytes[1] >> 6) + 4 * (bytes[2]) + ((bytes[3] & 0xF) << 10); + rowptr[col + 2] = (bytes[3] >> 4) + 16 * (bytes[4]) + ((bytes[5] & 3) << 12); + rowptr[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); + rowptr[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); + rowptr[col + 5] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); + rowptr[col + 6] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); + rowptr[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); + rowptr[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); + } else if (RT_pana_info.bpp == 12) { // have not seen in the wild yet + rowptr[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; + rowptr[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); + rowptr[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; + rowptr[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); + rowptr[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; + rowptr[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); + rowptr[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; + rowptr[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); + rowptr[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; + rowptr[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); + } + } + } + } + free(iobuf); + tiff_bps = RT_pana_info.bpp; +} + +//----------------------------------------------------------------------------- + +/* RT: Delete from here */ +/*RT*/#undef SQR +/*RT*/#undef MAX +/*RT*/#undef MIN +/*RT*/#undef ABS +/*RT*/#undef LIM +/*RT*/#undef ULIM +/*RT*/#undef CLIP +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif From 254d9494de3248d882a6fd3ab52d778fadac83d7 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Wed, 6 Nov 2019 23:12:52 +0100 Subject: [PATCH 4/8] cleanup --- rtengine/panasonic_decoders.cc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/rtengine/panasonic_decoders.cc b/rtengine/panasonic_decoders.cc index 8949a0851..709f60ab7 100644 --- a/rtengine/panasonic_decoders.cc +++ b/rtengine/panasonic_decoders.cc @@ -260,17 +260,3 @@ void DCraw::panasonicC7_load_raw() free(iobuf); tiff_bps = RT_pana_info.bpp; } - -//----------------------------------------------------------------------------- - -/* RT: Delete from here */ -/*RT*/#undef SQR -/*RT*/#undef MAX -/*RT*/#undef MIN -/*RT*/#undef ABS -/*RT*/#undef LIM -/*RT*/#undef ULIM -/*RT*/#undef CLIP -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif From bc6280afdf95818501e6b063fc63221257168615 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Thu, 7 Nov 2019 15:39:03 +0100 Subject: [PATCH 5/8] Fix decoding of Panasonic Highres files, #5204 --- rtengine/panasonic_decoders.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/panasonic_decoders.cc b/rtengine/panasonic_decoders.cc index 709f60ab7..5630ae3f2 100644 --- a/rtengine/panasonic_decoders.cc +++ b/rtengine/panasonic_decoders.cc @@ -90,7 +90,7 @@ StopWatch Stop1("panasonic_load_raw"); pana_bits(0, 0); int enc_blck_size = RT_pana_info.bpp == 12 ? 10 : 9; - if (RT_pana_info.encoding == 5 || RT_pana_info.encoding == 7) { + if (RT_pana_info.encoding == 5) { for (row = 0; row < raw_height; row++) { ushort* raw_block_data = raw_image + row * raw_width; @@ -230,7 +230,7 @@ void DCraw::panasonicC7_load_raw() fread (iobuf, rowbytes, rowstoread, ifp); unsigned char *bytes = iobuf; for (int crow = 0; crow < rowstoread; crow++) { - unsigned short *rowptr = &raw_image[row + crow]; + ushort *rowptr = &raw_image[(row + crow) * raw_width]; for (int col = 0; col < raw_width - pixperblock + 1; col += pixperblock, bytes += 16) { if (RT_pana_info.bpp == 14) { rowptr[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); From ffa461d3de7d7c7a73619d6c786f5989b06fb3e7 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Thu, 7 Nov 2019 18:47:11 +0100 Subject: [PATCH 6/8] Bottleneck when loading Panasonic RW2 files, #5517 --- rtexif/rtexif.cc | 21 +++++++++++---------- rtexif/rtexif.h | 9 +++++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index b2edc2842..89ff6cd33 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -54,13 +54,13 @@ Interpreter stdInterpreter; //----------------------------------------------------------------------------- TagDirectory::TagDirectory () - : attribs (ifdAttribs), order (HOSTORDER), parent (nullptr) {} + : attribs (ifdAttribs), order (HOSTORDER), parent (nullptr), parseJPEG(true) {} TagDirectory::TagDirectory (TagDirectory* p, const TagAttrib* ta, ByteOrder border) - : attribs (ta), order (border), parent (p) {} + : attribs (ta), order (border), parent (p), parseJPEG(true) {} -TagDirectory::TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* ta, ByteOrder border, bool skipIgnored) - : attribs (ta), order (border), parent (p) +TagDirectory::TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* ta, ByteOrder border, bool skipIgnored, bool parseJpeg) + : attribs (ta), order (border), parent (p), parseJPEG(parseJpeg) { int numOfTags = get2 (f, order); @@ -980,9 +980,10 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) } } - if (tag == 0x002e) { // location of the embedded preview image in raw files of Panasonic cameras + if (parent->getParseJpeg() && tag == 0x002e) { // location of the embedded preview image in raw files of Panasonic cameras ExifManager eManager(f, nullptr, true); const auto fpos = ftell(f); + if (fpos >= 0) { eManager.parseJPEG(fpos); // try to parse the exif data from the preview image @@ -1239,7 +1240,7 @@ defsubdirs: for (size_t j = 0, i = 0; j < count; j++, i++) { int newpos = base + toInt (j * 4, LONG); fseek (f, newpos, SEEK_SET); - directory[i] = new TagDirectory (parent, f, base, attrib->subdirAttribs, order); + directory[i] = new TagDirectory (parent, f, base, attrib->subdirAttribs, order, true, parent->getParseJpeg()); } // set the terminating NULL @@ -1374,7 +1375,7 @@ bool Tag::parseMakerNote (FILE* f, int base, ByteOrder bom ) value = new unsigned char[12]; fread (value, 1, 12, f); directory = new TagDirectory*[2]; - directory[0] = new TagDirectory (parent, f, base, panasonicAttribs, bom); + directory[0] = new TagDirectory (parent, f, base, panasonicAttribs, bom, true, parent->getParseJpeg()); directory[1] = nullptr; } else { return false; @@ -2777,7 +2778,7 @@ void ExifManager::parseStd (bool skipIgnored) { parse(false, skipIgnored); } -void ExifManager::parse (bool isRaw, bool skipIgnored) +void ExifManager::parse (bool isRaw, bool skipIgnored, bool parseJpeg) { int ifdOffset = IFDOffset; @@ -2806,7 +2807,7 @@ void ExifManager::parse (bool isRaw, bool skipIgnored) fseek (f, rml->exifBase + ifdOffset, SEEK_SET); // first read the IFD directory - TagDirectory* root = new TagDirectory (nullptr, f, rml->exifBase, ifdAttribs, order, skipIgnored); + TagDirectory* root = new TagDirectory (nullptr, f, rml->exifBase, ifdAttribs, order, skipIgnored, parseJpeg); // fix ISO issue with nikon and panasonic cameras Tag* make = root->getTag ("Make"); @@ -3174,7 +3175,7 @@ void ExifManager::parseJPEG (int offset) rml.reset(new rtengine::RawMetaDataLocation(0)); } rml->exifBase = tiffbase; - parse (false); + parse (false, true, false); if (rmlCreated) { rml.reset(); } diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 4c5a6cafe..c37533352 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -119,11 +119,12 @@ protected: const TagAttrib* attribs; // descriptor table to decode the tags ByteOrder order; // byte order TagDirectory* parent; // parent directory (NULL if root) + bool parseJPEG; static Glib::ustring getDumpKey (int tagID, const Glib::ustring &tagName); public: TagDirectory (); - TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* ta, ByteOrder border, bool skipIgnored = true); + TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* ta, ByteOrder border, bool skipIgnored = true, bool parseJpeg = true); TagDirectory (TagDirectory* p, const TagAttrib* ta, ByteOrder border); virtual ~TagDirectory (); @@ -135,6 +136,10 @@ public: { return parent; } + inline bool getParseJpeg() const + { + return parseJPEG; + } TagDirectory* getRoot (); inline int getCount () const { @@ -346,7 +351,7 @@ class ExifManager Tag* saveCIFFMNTag (TagDirectory* root, int len, const char* name); void parseCIFF (int length, TagDirectory* root); - void parse (bool isRaw, bool skipIgnored = true); + void parse (bool isRaw, bool skipIgnored = true, bool parseJpeg = true); public: FILE* f; From 9ac34eb33cb999fd105d5c35286970ce8cb4ec08 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Thu, 7 Nov 2019 19:35:02 +0100 Subject: [PATCH 7/8] panasonic decoders: cleanup --- rtengine/panasonic_decoders.cc | 250 ++++++++++++++++++--------------- 1 file changed, 133 insertions(+), 117 deletions(-) diff --git a/rtengine/panasonic_decoders.cc b/rtengine/panasonic_decoders.cc index 5630ae3f2..37f586a6b 100644 --- a/rtengine/panasonic_decoders.cc +++ b/rtengine/panasonic_decoders.cc @@ -1,7 +1,23 @@ +/* + * This file is part of RawTherapee. + * + * 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 "StopWatch.h" #include #include "dcraw.h" + // Code adapted from libraw /* -*- C++ -*- * Copyright 2019 LibRaw LLC (info@libraw.org) @@ -17,7 +33,6 @@ */ - unsigned DCraw::pana_bits_t::operator() (int nbits, unsigned *bytes) { int byte; @@ -45,15 +60,18 @@ unsigned DCraw::pana_bits_t::operator() (int nbits, unsigned *bytes) class pana_cs6_page_decoder { - unsigned int pixelbuffer[14], lastoffset, maxoffset; - unsigned char current, *buffer; - public: - pana_cs6_page_decoder(unsigned char *_buffer, unsigned int bsize) + unsigned int pixelbuffer[14], lastoffset, maxoffset; + unsigned char current, *buffer; +public: + pana_cs6_page_decoder(unsigned char *_buffer, unsigned int bsize) : lastoffset(0), maxoffset(bsize), current(0), buffer(_buffer) - { - } - void read_page(); // will throw IO error if not enough space in buffer - unsigned int nextpixel() { return current < 14 ? pixelbuffer[current++] : 0; } + { + } + void read_page(); // will throw IO error if not enough space in buffer + unsigned int nextpixel() + { + return current < 14 ? pixelbuffer[current++] : 0; + } }; #define wbuffer(i) ((unsigned short)buffer[lastoffset + 15 - i]) @@ -83,44 +101,39 @@ void pana_cs6_page_decoder::read_page() void DCraw::panasonic_load_raw() { -StopWatch Stop1("panasonic_load_raw"); - pana_bits_t pana_bits(ifp,load_flags, RT_pana_info.encoding); - int row, col, i, j, sh=0, pred[2], nonz[2]; - unsigned bytes[16] = {}; - - pana_bits(0, 0); int enc_blck_size = RT_pana_info.bpp == 12 ? 10 : 9; if (RT_pana_info.encoding == 5) { - for (row = 0; row < raw_height; row++) { + pana_bits_t pana_bits(ifp, load_flags, RT_pana_info.encoding); + pana_bits(0, 0); + unsigned bytes[16] = {}; + for (int row = 0; row < raw_height; ++row) { ushort* raw_block_data = raw_image + row * raw_width; - for (col = 0; col < raw_width; col += enc_blck_size) { + for (int col = 0; col < raw_width; col += enc_blck_size) { pana_bits(0, bytes); if (RT_pana_info.bpp == 12) { - raw_block_data[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; - raw_block_data[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); - raw_block_data[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; - raw_block_data[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); - raw_block_data[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; - raw_block_data[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); - raw_block_data[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; - raw_block_data[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); - raw_block_data[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; - raw_block_data[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); + raw_block_data[col] = ((bytes[1] & 0xF) << 8) + bytes[0]; + raw_block_data[col + 1] = 16 * bytes[2] + (bytes[1] >> 4); + raw_block_data[col + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; + raw_block_data[col + 3] = 16 * bytes[5] + (bytes[4] >> 4); + raw_block_data[col + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; + raw_block_data[col + 5] = 16 * bytes[8] + (bytes[7] >> 4); + raw_block_data[col + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; + raw_block_data[col + 7] = 16 * bytes[11] + (bytes[10] >> 4); + raw_block_data[col + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; + raw_block_data[col + 9] = 16 * bytes[14] + (bytes[13] >> 4); } else if (RT_pana_info.bpp == 14) { - raw_block_data[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); - raw_block_data[col + 1] = (bytes[1] >> 6) + 4 * (bytes[2]) + - ((bytes[3] & 0xF) << 10); - raw_block_data[col + 2] = (bytes[3] >> 4) + 16 * (bytes[4]) + - ((bytes[5] & 3) << 12); - raw_block_data[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); - raw_block_data[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); - raw_block_data[col + 5] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); - raw_block_data[col + 6] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); - raw_block_data[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); - raw_block_data[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); + raw_block_data[col] = bytes[0] + ((bytes[1] & 0x3F) << 8); + raw_block_data[col + 1] = (bytes[1] >> 6) + 4 * (bytes[2]) + ((bytes[3] & 0xF) << 10); + raw_block_data[col + 2] = (bytes[3] >> 4) + 16 * (bytes[4]) + ((bytes[5] & 3) << 12); + raw_block_data[col + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); + raw_block_data[col + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); + raw_block_data[col + 5] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); + raw_block_data[col + 6] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); + raw_block_data[col + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); + raw_block_data[col + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); } } } @@ -129,92 +142,95 @@ StopWatch Stop1("panasonic_load_raw"); } else if (RT_pana_info.encoding == 7) { panasonicC7_load_raw(); } else { - for (row=0; row < height; row++) - for (col=0; col < raw_width; col++) { - if ((i = col % 14) == 0) - pred[0] = pred[1] = nonz[0] = nonz[1] = 0; - if (i % 3 == 2) sh = 4 >> (3 - pana_bits(2)); - if (nonz[i & 1]) { - if ((j = pana_bits(8))) { - if ((pred[i & 1] -= 0x80 << sh) < 0 || sh == 4) - pred[i & 1] &= ~(-1 << sh); - pred[i & 1] += j << sh; - } - } else if ((nonz[i & 1] = pana_bits(8)) || i > 11) - pred[i & 1] = nonz[i & 1] << 4 | pana_bits(4); - if ((raw_image[(row)*raw_width+(col)] = pred[col & 1]) > 4098 && col < width) derror(); - } + pana_bits_t pana_bits(ifp, load_flags, RT_pana_info.encoding); + pana_bits(0, 0); + int sh = 0, pred[2], nonz[2]; + for (int row = 0; row < height; ++row) { + for (int col = 0; col < raw_width; ++col) { + int i; + if ((i = col % 14) == 0) { + pred[0] = pred[1] = nonz[0] = nonz[1] = 0; + } + if (i % 3 == 2) { + sh = 4 >> (3 - pana_bits(2)); + } + if (nonz[i & 1]) { + int j; + if ((j = pana_bits(8))) { + if ((pred[i & 1] -= 0x80 << sh) < 0 || sh == 4) { + pred[i & 1] &= ~(-1 << sh); + } + pred[i & 1] += j << sh; + } + } else if ((nonz[i & 1] = pana_bits(8)) || i > 11) { + pred[i & 1] = nonz[i & 1] << 4 | pana_bits(4); + } + if ((raw_image[(row)*raw_width+(col)] = pred[col & 1]) > 4098 && col < width) { + derror(); + } + } + } } } void DCraw::panasonicC6_load_raw() { - const int rowstep = 16; - const int blocksperrow = raw_width / 11; - const int rowbytes = blocksperrow * 16; - unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); - merror(iobuf, "panasonicC6_load_raw()"); + constexpr int rowstep = 16; + const int blocksperrow = raw_width / 11; + const int rowbytes = blocksperrow * 16; + unsigned char *iobuf = (unsigned char *)malloc(rowbytes * rowstep); + merror(iobuf, "panasonicC6_load_raw()"); - for (int row = 0; row < raw_height - rowstep + 1; - row += rowstep) - { - int rowstoread = MIN(rowstep, raw_height - row); - fread (iobuf, rowbytes, rowstoread, ifp); -// if (libraw_internal_data.internal_data.input->read( -// iobuf, rowbytes, rowstoread) != rowstoread) -// throw LIBRAW_EXCEPTION_IO_EOF; - pana_cs6_page_decoder page(iobuf, rowbytes * rowstoread); - for (int crow = 0, col = 0; crow < rowstoread; crow++, col = 0) - { - unsigned short *rowptr = &raw_image[(row + crow) * raw_width]; - for (int rblock = 0; rblock < blocksperrow; rblock++) - { - page.read_page(); - unsigned oddeven[2] = {0, 0}, nonzero[2] = {0, 0}; - unsigned pmul = 0, pixel_base = 0; - for (int pix = 0; pix < 11; pix++) - { - if (pix % 3 == 2) - { - unsigned base = page.nextpixel(); - if (base > 3); -// throw LIBRAW_EXCEPTION_IO_CORRUPT; // not possible b/c of 2-bit - // field, but.... - if (base == 3) - base = 4; - pixel_base = 0x200 << base; - pmul = 1 << base; - } - unsigned epixel = page.nextpixel(); - if (oddeven[pix % 2]) - { - epixel *= pmul; - if (pixel_base < 0x2000 && nonzero[pix % 2] > pixel_base) - epixel += nonzero[pix % 2] - pixel_base; - nonzero[pix % 2] = epixel; - } - else - { - oddeven[pix % 2] = epixel; - if (epixel) - nonzero[pix % 2] = epixel; - else - epixel = nonzero[pix % 2]; - } - unsigned spix = epixel - 0xf; - if (spix <= 0xffff) - rowptr[col++] = spix & 0xffff; - else - { - epixel = (((signed int)(epixel + 0x7ffffff1)) >> 0x1f); - rowptr[col++] = epixel & 0x3fff; - } + for (int row = 0; row < raw_height - rowstep + 1; row += rowstep) { + const int rowstoread = MIN(rowstep, raw_height - row); + fread(iobuf, rowbytes, rowstoread, ifp); + pana_cs6_page_decoder page(iobuf, rowbytes * rowstoread); + for (int crow = 0, col = 0; crow < rowstoread; ++crow, col = 0) { + unsigned short *rowptr = &raw_image[(row + crow) * raw_width]; + for (int rblock = 0; rblock < blocksperrow; rblock++) { + page.read_page(); + unsigned oddeven[2] = {0, 0}, nonzero[2] = {0, 0}; + unsigned pmul = 0, pixel_base = 0; + for (int pix = 0; pix < 11; ++pix) { + if (pix % 3 == 2) { + unsigned base = page.nextpixel(); + if (base > 3) { + derror(); + } + if (base == 3) { + base = 4; + } + pixel_base = 0x200 << base; + pmul = 1 << base; + } + unsigned epixel = page.nextpixel(); + if (oddeven[pix % 2]) { + epixel *= pmul; + if (pixel_base < 0x2000 && nonzero[pix % 2] > pixel_base) { + epixel += nonzero[pix % 2] - pixel_base; + } + nonzero[pix % 2] = epixel; + } else { + oddeven[pix % 2] = epixel; + if (epixel) { + nonzero[pix % 2] = epixel; + } else { + epixel = nonzero[pix % 2]; + } + } + const unsigned spix = epixel - 0xf; + if (spix <= 0xffff) { + rowptr[col++] = spix & 0xffff; + } else { + epixel = (((signed int)(epixel + 0x7ffffff1)) >> 0x1f); + rowptr[col++] = epixel & 0x3fff; + } + } + } } - } } - } - free(iobuf); - tiff_bps = RT_pana_info.bpp; + free(iobuf); + tiff_bps = RT_pana_info.bpp; } void DCraw::panasonicC7_load_raw() From 587652283dc520bc66d8803f396647d1a527cad9 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Sat, 9 Nov 2019 16:51:54 +0100 Subject: [PATCH 8/8] further reduction of include dependencies, also finalised some classes --- rtengine/pipettebuffer.h | 1 - rtgui/batchqueue.cc | 1 + rtgui/batchqueue.h | 3 ++- rtgui/batchqueuepanel.h | 1 + rtgui/bayerpreprocess.h | 2 +- rtgui/bayerprocess.h | 2 +- rtgui/bayerrawexposure.h | 2 +- rtgui/blackwhite.cc | 2 ++ rtgui/blackwhite.h | 7 ++++--- rtgui/cacorrection.h | 2 +- rtgui/chmixer.h | 2 +- rtgui/coarsepanel.h | 2 +- rtgui/colorappearance.cc | 2 ++ rtgui/colorappearance.h | 7 +++++-- rtgui/colortoning.cc | 2 ++ rtgui/colortoning.h | 10 +++++++--- rtgui/curveeditor.cc | 1 + rtgui/curveeditor.h | 6 +++--- rtgui/curveeditorgroup.cc | 1 + rtgui/curveeditorgroup.h | 2 +- rtgui/darkframe.h | 2 +- rtgui/defringe.cc | 2 ++ rtgui/defringe.h | 8 +++++--- rtgui/dehaze.h | 2 +- rtgui/diagonalcurveeditorsubgroup.cc | 1 + rtgui/dirpyrdenoise.cc | 2 ++ rtgui/dirpyrdenoise.h | 6 ++++-- rtgui/dirpyrequalizer.h | 2 +- rtgui/distortion.h | 2 +- rtgui/editbuffer.h | 7 ++++++- rtgui/editorpanel.cc | 1 + rtgui/editorpanel.h | 3 ++- rtgui/epd.h | 2 +- rtgui/fattaltonemap.h | 2 +- rtgui/filebrowserentry.cc | 2 ++ rtgui/filecatalog.cc | 1 + rtgui/filethumbnailbuttonset.h | 1 - rtgui/filmnegative.h | 3 +-- rtgui/filmsimulation.h | 2 +- rtgui/flatcurveeditorsubgroup.cc | 1 + rtgui/flatfield.h | 2 +- rtgui/gradient.h | 2 +- rtgui/hsvequalizer.cc | 2 ++ rtgui/hsvequalizer.h | 9 ++++++--- rtgui/icmpanel.h | 2 +- rtgui/imageareatoollistener.h | 5 ++--- rtgui/impulsedenoise.h | 2 +- rtgui/labcurve.cc | 2 ++ rtgui/labcurve.h | 8 +++++--- rtgui/labgrid.h | 2 +- rtgui/lensgeom.h | 2 +- rtgui/lensprofile.h | 1 - rtgui/localcontrast.h | 2 +- rtgui/pcvignette.h | 2 +- rtgui/perspective.h | 2 +- rtgui/pparamschangelistener.h | 8 ++++++-- rtgui/preprocess.h | 2 +- rtgui/profilechangelistener.h | 6 +++++- rtgui/prsharpening.h | 2 +- rtgui/rawcacorrection.h | 2 +- rtgui/rawexposure.h | 4 +--- rtgui/retinex.cc | 3 +++ rtgui/retinex.h | 9 +++++++-- rtgui/rgbcurves.cc | 2 ++ rtgui/rgbcurves.h | 8 +++++--- rtgui/rotate.cc | 1 + rtgui/rotate.h | 4 ++-- rtgui/rtwindow.cc | 1 + rtgui/sensorbayer.h | 2 +- rtgui/sensorxtrans.h | 2 +- rtgui/shadowshighlights.h | 2 +- rtgui/sharpenedge.h | 2 +- rtgui/sharpening.h | 2 +- rtgui/sharpenmicro.h | 2 +- rtgui/softlight.h | 2 +- rtgui/thumbbrowserbase.cc | 1 + rtgui/thumbbrowserbase.h | 2 +- rtgui/thumbimageupdater.cc | 1 + rtgui/thumbimageupdater.h | 4 +++- rtgui/tonecurve.cc | 2 ++ rtgui/tonecurve.h | 8 +++++--- rtgui/toolbar.h | 2 +- rtgui/toolpanel.h | 3 --- rtgui/toolpanelcoord.cc | 1 + rtgui/vibrance.cc | 3 +++ rtgui/vibrance.h | 8 +++++--- rtgui/vignetting.h | 2 +- rtgui/wavelet.cc | 2 ++ rtgui/wavelet.h | 9 ++++++--- rtgui/whitebalance.h | 2 +- rtgui/xtransprocess.h | 2 +- rtgui/xtransrawexposure.h | 2 +- 92 files changed, 177 insertions(+), 98 deletions(-) diff --git a/rtengine/pipettebuffer.h b/rtengine/pipettebuffer.h index ef8a5f69a..79b6dd8c5 100644 --- a/rtengine/pipettebuffer.h +++ b/rtengine/pipettebuffer.h @@ -19,7 +19,6 @@ #pragma once #include "array2D.h" -#include "coord.h" #include "iimage.h" class EditDataProvider; diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index acb45c266..afbec9efb 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -31,6 +31,7 @@ #include "cachemanager.h" #include "thumbnail.h" #include "batchqueue.h" +#include "batchqueueentry.h" #include "multilangmgr.h" #include "filecatalog.h" #include "batchqueuebuttonset.h" diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index 9ae615965..f0289faa4 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -21,7 +21,6 @@ #include -#include "batchqueueentry.h" #include "lwbutton.h" #include "lwbuttonset.h" #include "threadutils.h" @@ -30,6 +29,8 @@ #include "../rtengine/rtengine.h" #include "../rtengine/noncopyable.h" +class BatchQueueEntry; + class BatchQueueListener { diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index 590ec2347..7c0a367d4 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -29,6 +29,7 @@ class RTWindow; class FileCatalog; class Thumbnail; + class BatchQueuePanel : public Gtk::VBox, public BatchQueueListener, public FormatChangeListener diff --git a/rtgui/bayerpreprocess.h b/rtgui/bayerpreprocess.h index c07bbcba4..16b469626 100644 --- a/rtgui/bayerpreprocess.h +++ b/rtgui/bayerpreprocess.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class BayerPreProcess : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class BayerPreProcess final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel { protected: diff --git a/rtgui/bayerprocess.h b/rtgui/bayerprocess.h index 04985dc66..5c7498986 100644 --- a/rtgui/bayerprocess.h +++ b/rtgui/bayerprocess.h @@ -25,7 +25,7 @@ #include "guiutils.h" #include "toolpanel.h" -class BayerProcess : +class BayerProcess final : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, diff --git a/rtgui/bayerrawexposure.h b/rtgui/bayerrawexposure.h index 247bf6ff0..eb18aa0e3 100644 --- a/rtgui/bayerrawexposure.h +++ b/rtgui/bayerrawexposure.h @@ -24,7 +24,7 @@ #include "checkbox.h" #include "toolpanel.h" -class BayerRAWExposure : +class BayerRAWExposure final : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index b3ebea28a..596d99607 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -21,6 +21,8 @@ #include "blackwhite.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "guiutils.h" #include "rtimage.h" #include "options.h" diff --git a/rtgui/blackwhite.h b/rtgui/blackwhite.h index 9f504fd4f..1aed86997 100644 --- a/rtgui/blackwhite.h +++ b/rtgui/blackwhite.h @@ -22,13 +22,14 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" -#include "mycurve.h" #include "toolpanel.h" +class DiagonalCurveEditor; +class CurveEditorGroup; class EditDataProvider; +class FlatCurveEditor; class BlackWhite final : public ToolParamBlock, diff --git a/rtgui/cacorrection.h b/rtgui/cacorrection.h index 6e1667a00..12d6396eb 100644 --- a/rtgui/cacorrection.h +++ b/rtgui/cacorrection.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class CACorrection : +class CACorrection final: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/chmixer.h b/rtgui/chmixer.h index fb028cf14..d80b89cf7 100644 --- a/rtgui/chmixer.h +++ b/rtgui/chmixer.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class ChMixer : +class ChMixer final: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/coarsepanel.h b/rtgui/coarsepanel.h index c028bbcad..b7b4f8cf7 100644 --- a/rtgui/coarsepanel.h +++ b/rtgui/coarsepanel.h @@ -22,7 +22,7 @@ #include "toolpanel.h" -class CoarsePanel : +class CoarsePanel final : public Gtk::HBox, public ToolPanel { diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 094ffec2f..9a6bee524 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -20,6 +20,8 @@ #include "colorappearance.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "guiutils.h" #include "options.h" #include "rtimage.h" diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index 3d82ee831..170212ffe 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -22,11 +22,14 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" #include "toolpanel.h" +class DiagonalCurveEditor; +class CurveEditorGroup; +class CurveEditor; + class ColorAppearance final : public ToolParamBlock, public AdjusterListener, diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index 1a6a9b918..59768a6ce 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -2,6 +2,8 @@ * This file is part of RawTherapee. */ #include "colortoning.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "mycurve.h" #include "rtimage.h" #include "eventmapper.h" diff --git a/rtgui/colortoning.h b/rtgui/colortoning.h index 9c7a54488..f1024f41c 100644 --- a/rtgui/colortoning.h +++ b/rtgui/colortoning.h @@ -7,15 +7,19 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" -#include "labgrid.h" #include "thresholdadjuster.h" #include "toolpanel.h" #include "../rtengine/procparams.h" +class CurveEditor; +class CurveEditorGroup; +class DiagonalCurveEditor; +class FlatCurveEditor; +class LabGrid; + class ColorToning final : public ToolParamBlock, public FoldableToolPanel, diff --git a/rtgui/curveeditor.cc b/rtgui/curveeditor.cc index 2b3c100e0..8dc88473e 100644 --- a/rtgui/curveeditor.cc +++ b/rtgui/curveeditor.cc @@ -21,6 +21,7 @@ #include #include "guiutils.h" #include "multilangmgr.h" +#include "popuptogglebutton.h" #include "../rtengine/LUT.h" #include diff --git a/rtgui/curveeditor.h b/rtgui/curveeditor.h index 535c1a86d..baae8f492 100644 --- a/rtgui/curveeditor.h +++ b/rtgui/curveeditor.h @@ -20,7 +20,6 @@ #include "coloredbar.h" #include "editcallbacks.h" -#include "popuptogglebutton.h" #include "../rtengine/diagonalcurvetypes.h" #include "../rtengine/flatcurvetypes.h" @@ -29,6 +28,7 @@ class CurveEditorGroup; class CurveEditorSubGroup; +class PopUpToggleButton; /* *********************** Curve Editor *********************** @@ -143,7 +143,7 @@ public: */ -class DiagonalCurveEditor : public CurveEditor +class DiagonalCurveEditor final : public CurveEditor { friend class DiagonalCurveEditorSubGroup; @@ -179,7 +179,7 @@ public: */ -class FlatCurveEditor : public CurveEditor +class FlatCurveEditor final : public CurveEditor { friend class FlatCurveEditorSubGroup; diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index 06def0a8e..cad49d331 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -24,6 +24,7 @@ #include "diagonalcurveeditorsubgroup.h" #include "flatcurveeditorsubgroup.h" #include "multilangmgr.h" +#include "popuptogglebutton.h" #include "rtimage.h" #include "options.h" #include "pathutils.h" diff --git a/rtgui/curveeditorgroup.h b/rtgui/curveeditorgroup.h index e3412546f..7a5d3a074 100644 --- a/rtgui/curveeditorgroup.h +++ b/rtgui/curveeditorgroup.h @@ -41,7 +41,7 @@ class FlatCurveEditorSubGroup; * - to start a new line of curve button, use the 'newLine' method * - if you add more than one curve, you must add a "CurveEditor* ce" parameter to your listener */ -class CurveEditorGroup : public Gtk::Grid, public CurveListener +class CurveEditorGroup final : public Gtk::Grid, public CurveListener { friend class CurveEditor; diff --git a/rtgui/darkframe.h b/rtgui/darkframe.h index 779caf16f..30696e3db 100644 --- a/rtgui/darkframe.h +++ b/rtgui/darkframe.h @@ -41,7 +41,7 @@ public: // add other info here }; -class DarkFrame : +class DarkFrame final: public ToolParamBlock, public FoldableToolPanel { diff --git a/rtgui/defringe.cc b/rtgui/defringe.cc index 7114f9a52..cdec88edc 100644 --- a/rtgui/defringe.cc +++ b/rtgui/defringe.cc @@ -20,6 +20,8 @@ #include #include "defringe.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "options.h" #include "../rtengine/color.h" diff --git a/rtgui/defringe.h b/rtgui/defringe.h index 5dd17b547..ebf1eecd8 100644 --- a/rtgui/defringe.h +++ b/rtgui/defringe.h @@ -22,12 +22,14 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" #include "toolpanel.h" -class Defringe : +class CurveEditorGroup; +class FlatCurveEditor; + +class Defringe final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, diff --git a/rtgui/dehaze.h b/rtgui/dehaze.h index 6a9d31cd1..79d2e015c 100644 --- a/rtgui/dehaze.h +++ b/rtgui/dehaze.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class Dehaze: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class Dehaze final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel { private: Adjuster *strength; diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index cece9be66..eed6c63d3 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -32,6 +32,7 @@ #include "diagonalcurveeditorsubgroup.h" #include "rtimage.h" #include "options.h" +#include "popuptogglebutton.h" #include "../rtengine/curves.h" diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index b429dfc9f..7129542d1 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -21,6 +21,8 @@ #include "dirpyrdenoise.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "editbuffer.h" #include "guiutils.h" #include "options.h" diff --git a/rtgui/dirpyrdenoise.h b/rtgui/dirpyrdenoise.h index 424104314..c754e705c 100644 --- a/rtgui/dirpyrdenoise.h +++ b/rtgui/dirpyrdenoise.h @@ -22,11 +22,13 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" #include "toolpanel.h" +class CurveEditor; +class CurveEditorGroup; +class FlatCurveEditor; class EditDataProvider; class DirPyrDenoise final : diff --git a/rtgui/dirpyrequalizer.h b/rtgui/dirpyrequalizer.h index ff08f36bc..84924099e 100644 --- a/rtgui/dirpyrequalizer.h +++ b/rtgui/dirpyrequalizer.h @@ -25,7 +25,7 @@ #include "thresholdadjuster.h" #include "toolpanel.h" -class DirPyrEqualizer : +class DirPyrEqualizer final : public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, diff --git a/rtgui/distortion.h b/rtgui/distortion.h index dab20bbd9..7ef33d73a 100644 --- a/rtgui/distortion.h +++ b/rtgui/distortion.h @@ -24,7 +24,7 @@ #include "lensgeomlistener.h" #include "toolpanel.h" -class Distortion : +class Distortion final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/editbuffer.h b/rtgui/editbuffer.h index 046ab7364..a5cf8d0e4 100644 --- a/rtgui/editbuffer.h +++ b/rtgui/editbuffer.h @@ -19,9 +19,14 @@ #pragma once #include "editid.h" -#include "../rtengine/coord.h" #include +namespace rtengine { + +struct Coord; + +} + class EditDataProvider; class EditSubscriber; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 108b11ea3..87f4a0b94 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -24,6 +24,7 @@ #include "../rtengine/imagesource.h" #include "../rtengine/iccstore.h" #include "batchqueue.h" +#include "batchqueueentry.h" #include "soundman.h" #include "rtimage.h" #include "rtwindow.h" diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index b577b858f..e348222a5 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -21,7 +21,6 @@ #include -#include "batchqueueentry.h" #include "filepanel.h" #include "histogrampanel.h" #include "history.h" @@ -35,7 +34,9 @@ #include "../rtengine/noncopyable.h" #include "../rtengine/rtengine.h" +class BatchQueueEntry; class EditorPanel; +class FilePanel; class MyProgressBar; class Thumbnail; class ToolPanelCoordinator; diff --git a/rtgui/epd.h b/rtgui/epd.h index 410004d89..6a5160623 100644 --- a/rtgui/epd.h +++ b/rtgui/epd.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class EdgePreservingDecompositionUI : +class EdgePreservingDecompositionUI final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/fattaltonemap.h b/rtgui/fattaltonemap.h index 9f788351c..3d36ec7d2 100644 --- a/rtgui/fattaltonemap.h +++ b/rtgui/fattaltonemap.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class FattalToneMapping: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class FattalToneMapping final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel { protected: Adjuster *threshold; diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 4d31d625e..9da4044c1 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -21,6 +21,7 @@ #include #include +#include "cropguilistener.h" #include "cursormanager.h" #include "guiutils.h" #include "inspector.h" @@ -28,6 +29,7 @@ #include "threadutils.h" #include "thumbbrowserbase.h" #include "thumbnail.h" +#include "toolbar.h" #include "../rtengine/procparams.h" diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 5e93631e5..a2622e52c 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -36,6 +36,7 @@ #include "renamedlg.h" #include "thumbimageupdater.h" #include "batchqueue.h" +#include "batchqueueentry.h" #include "placesbrowser.h" #include "pathutils.h" #include "thumbnail.h" diff --git a/rtgui/filethumbnailbuttonset.h b/rtgui/filethumbnailbuttonset.h index 66d5b5f67..868d3b58a 100644 --- a/rtgui/filethumbnailbuttonset.h +++ b/rtgui/filethumbnailbuttonset.h @@ -22,7 +22,6 @@ #include -#include "filebrowserentry.h" #include "lwbuttonset.h" class FileBrowserEntry; diff --git a/rtgui/filmnegative.h b/rtgui/filmnegative.h index 85919bef9..bca155ceb 100644 --- a/rtgui/filmnegative.h +++ b/rtgui/filmnegative.h @@ -26,7 +26,6 @@ #include "editcallbacks.h" #include "guiutils.h" #include "toolpanel.h" -#include "wbprovider.h" class FilmNegProvider { @@ -36,7 +35,7 @@ public: virtual bool getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array& newExps) = 0; }; -class FilmNegative : +class FilmNegative final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, diff --git a/rtgui/filmsimulation.h b/rtgui/filmsimulation.h index fc9e804e1..cfe7016bb 100644 --- a/rtgui/filmsimulation.h +++ b/rtgui/filmsimulation.h @@ -10,7 +10,7 @@ #include "guiutils.h" #include "toolpanel.h" -class ClutComboBox : +class ClutComboBox final : public MyComboBox { public: diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index b5dc4f726..4e0591ac3 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -33,6 +33,7 @@ #include "flatcurveeditorsubgroup.h" #include "rtimage.h" #include "options.h" +#include "popuptogglebutton.h" #include "../rtengine/curves.h" diff --git a/rtgui/flatfield.h b/rtgui/flatfield.h index 4308e938a..d20a96acd 100644 --- a/rtgui/flatfield.h +++ b/rtgui/flatfield.h @@ -42,7 +42,7 @@ public: // add other info here }; -class FlatField : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::FlatFieldAutoClipListener +class FlatField final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::FlatFieldAutoClipListener { protected: diff --git a/rtgui/gradient.h b/rtgui/gradient.h index 834f08670..f2be47ccc 100644 --- a/rtgui/gradient.h +++ b/rtgui/gradient.h @@ -10,7 +10,7 @@ #include "guiutils.h" #include "toolpanel.h" -class Gradient : +class Gradient final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, diff --git a/rtgui/hsvequalizer.cc b/rtgui/hsvequalizer.cc index b570a23ac..ee3eb90a7 100644 --- a/rtgui/hsvequalizer.cc +++ b/rtgui/hsvequalizer.cc @@ -18,6 +18,8 @@ */ #include "hsvequalizer.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "options.h" #include "../rtengine/color.h" diff --git a/rtgui/hsvequalizer.h b/rtgui/hsvequalizer.h index 7d313cc76..987fd20b2 100644 --- a/rtgui/hsvequalizer.h +++ b/rtgui/hsvequalizer.h @@ -22,12 +22,15 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" #include "toolpanel.h" -class HSVEqualizer : +class CurveEditor; +class CurveEditorGroup; +class FlatCurveEditor; + +class HSVEqualizer final : public ToolParamBlock, public FoldableToolPanel, public CurveListener, diff --git a/rtgui/icmpanel.h b/rtgui/icmpanel.h index 5573bacb8..cc46c5d37 100644 --- a/rtgui/icmpanel.h +++ b/rtgui/icmpanel.h @@ -36,7 +36,7 @@ public: virtual void saveInputICCReference(const Glib::ustring& fname, bool apply_wb) = 0; }; -class ICMPanel : +class ICMPanel final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/imageareatoollistener.h b/rtgui/imageareatoollistener.h index 3c753a5e0..b022aa4b7 100644 --- a/rtgui/imageareatoollistener.h +++ b/rtgui/imageareatoollistener.h @@ -18,10 +18,9 @@ */ #pragma once -#include "cropguilistener.h" -#include "toolbar.h" - +class CropGUIListener; class Thumbnail; +class ToolBar; class ImageAreaToolListener { diff --git a/rtgui/impulsedenoise.h b/rtgui/impulsedenoise.h index e3cfc619a..b8acafcfc 100644 --- a/rtgui/impulsedenoise.h +++ b/rtgui/impulsedenoise.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class ImpulseDenoise : +class ImpulseDenoise final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index bd4b27f14..491b02c4c 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -20,6 +20,8 @@ #include "labcurve.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "options.h" #include "../rtengine/color.h" diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index 46f506d68..e8488a8c6 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -22,13 +22,15 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "toolpanel.h" +class CurveEditorGroup; +class DiagonalCurveEditor; class EditDataProvider; +class FlatCurveEditor; -class LCurve : +class LCurve final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, diff --git a/rtgui/labgrid.h b/rtgui/labgrid.h index 227b4cacc..4693c897c 100644 --- a/rtgui/labgrid.h +++ b/rtgui/labgrid.h @@ -43,7 +43,7 @@ #include "toolpanel.h" -class LabGridArea: public Gtk::DrawingArea, public BackBuffer { +class LabGridArea final : public Gtk::DrawingArea, public BackBuffer { private: rtengine::ProcEvent evt; Glib::ustring evtMsg; diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index e3352a506..18b31a619 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -23,7 +23,7 @@ #include "lensgeomlistener.h" #include "toolpanel.h" -class LensGeometry : +class LensGeometry final : public ToolParamBlock, public FoldableToolPanel { diff --git a/rtgui/lensprofile.h b/rtgui/lensprofile.h index 7e740e26e..7b5b7343c 100644 --- a/rtgui/lensprofile.h +++ b/rtgui/lensprofile.h @@ -21,7 +21,6 @@ #include #include "guiutils.h" -#include "lensgeom.h" #include "toolpanel.h" class LensProfilePanel final : diff --git a/rtgui/localcontrast.h b/rtgui/localcontrast.h index b23bac697..d1d25fb3d 100644 --- a/rtgui/localcontrast.h +++ b/rtgui/localcontrast.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class LocalContrast: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class LocalContrast final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel { private: Adjuster *radius; diff --git a/rtgui/pcvignette.h b/rtgui/pcvignette.h index da0e02dc6..87915703f 100644 --- a/rtgui/pcvignette.h +++ b/rtgui/pcvignette.h @@ -8,7 +8,7 @@ #include "adjuster.h" #include "toolpanel.h" -class PCVignette : +class PCVignette final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/perspective.h b/rtgui/perspective.h index 618ad32cf..0564479de 100644 --- a/rtgui/perspective.h +++ b/rtgui/perspective.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class PerspCorrection : +class PerspCorrection final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/pparamschangelistener.h b/rtgui/pparamschangelistener.h index 56ac5f605..e255b9657 100644 --- a/rtgui/pparamschangelistener.h +++ b/rtgui/pparamschangelistener.h @@ -18,10 +18,14 @@ */ #pragma once -#include - struct ParamsEdited; +namespace Glib +{ + +class ustring; + +} namespace rtengine { diff --git a/rtgui/preprocess.h b/rtgui/preprocess.h index 3b337a450..d10ff5223 100644 --- a/rtgui/preprocess.h +++ b/rtgui/preprocess.h @@ -24,7 +24,7 @@ #include "guiutils.h" #include "toolpanel.h" -class PreProcess : +class PreProcess final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/profilechangelistener.h b/rtgui/profilechangelistener.h index 58c565393..656566867 100644 --- a/rtgui/profilechangelistener.h +++ b/rtgui/profilechangelistener.h @@ -18,8 +18,12 @@ */ #pragma once -#include +namespace Glib +{ +class ustring; + +} namespace rtengine { diff --git a/rtgui/prsharpening.h b/rtgui/prsharpening.h index 54f2f8063..9738a5cd4 100644 --- a/rtgui/prsharpening.h +++ b/rtgui/prsharpening.h @@ -24,7 +24,7 @@ #include "thresholdadjuster.h" #include "toolpanel.h" -class PrSharpening : +class PrSharpening final : public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, diff --git a/rtgui/rawcacorrection.h b/rtgui/rawcacorrection.h index 60c705b19..3c95602a7 100644 --- a/rtgui/rawcacorrection.h +++ b/rtgui/rawcacorrection.h @@ -24,7 +24,7 @@ #include "checkbox.h" #include "toolpanel.h" -class RAWCACorr : +class RAWCACorr final: public ToolParamBlock, public AdjusterListener, public CheckBoxListener, diff --git a/rtgui/rawexposure.h b/rtgui/rawexposure.h index 75b3a9330..33c897113 100644 --- a/rtgui/rawexposure.h +++ b/rtgui/rawexposure.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class RAWExposure : +class RAWExposure final: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel @@ -32,8 +32,6 @@ class RAWExposure : protected: Adjuster* PexPos; -private: -// Gtk::CheckButton* PextwoGreen; public: RAWExposure (); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 33f1c2f6a..c78be375f 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -2,6 +2,9 @@ * This file is part of RawTherapee. */ #include "retinex.h" + +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "mycurve.h" #include "rtimage.h" #include "options.h" diff --git a/rtgui/retinex.h b/rtgui/retinex.h index c82c01d3e..ff524f854 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -7,13 +7,18 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" +#include "curvelistener.h" #include "curveeditorgroup.h" #include "guiutils.h" #include "thresholdadjuster.h" #include "toolpanel.h" -class Retinex : +class CurveEditor; +class CurveEditorGroup; +class DiagonalCurveEditor; +class FlatCurveEditor; + +class Retinex final : public ToolParamBlock, public FoldableToolPanel, public rtengine::RetinexListener, diff --git a/rtgui/rgbcurves.cc b/rtgui/rgbcurves.cc index 7af6cab97..d501cf449 100644 --- a/rtgui/rgbcurves.cc +++ b/rtgui/rgbcurves.cc @@ -18,6 +18,8 @@ */ #include "rgbcurves.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "options.h" #include "../rtengine/procparams.h" diff --git a/rtgui/rgbcurves.h b/rtgui/rgbcurves.h index b73aa22b7..5ed2ea540 100644 --- a/rtgui/rgbcurves.h +++ b/rtgui/rgbcurves.h @@ -22,11 +22,13 @@ #include "adjuster.h" #include "colorprovider.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "toolpanel.h" -class RGBCurves : +class CurveEditorGroup; +class DiagonalCurveEditor; + +class RGBCurves final : public ToolParamBlock, public FoldableToolPanel, public CurveListener, diff --git a/rtgui/rotate.cc b/rtgui/rotate.cc index 7436186c3..06c53cd4e 100644 --- a/rtgui/rotate.cc +++ b/rtgui/rotate.cc @@ -21,6 +21,7 @@ #include "rotate.h" #include "guiutils.h" +#include "lensgeomlistener.h" #include "rtimage.h" #include "../rtengine/procparams.h" diff --git a/rtgui/rotate.h b/rtgui/rotate.h index 5730fd481..41e10eb4d 100644 --- a/rtgui/rotate.h +++ b/rtgui/rotate.h @@ -21,10 +21,10 @@ #include #include "adjuster.h" -#include "lensgeomlistener.h" #include "toolpanel.h" -class Rotate : +class LensGeomListener; +class Rotate final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index c3d735e8f..ae7072d88 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -29,6 +29,7 @@ #include "whitebalance.h" #include "../rtengine/settings.h" #include "batchqueuepanel.h" +#include "batchqueueentry.h" #include "editorpanel.h" #include "filepanel.h" #include "filmsimulation.h" diff --git a/rtgui/sensorbayer.h b/rtgui/sensorbayer.h index 3d6018181..2401bf760 100644 --- a/rtgui/sensorbayer.h +++ b/rtgui/sensorbayer.h @@ -22,7 +22,7 @@ #include "toolpanel.h" -class SensorBayer : +class SensorBayer final : public ToolParamBlock, public FoldableToolPanel { diff --git a/rtgui/sensorxtrans.h b/rtgui/sensorxtrans.h index c1cacb2f4..eee014f6c 100644 --- a/rtgui/sensorxtrans.h +++ b/rtgui/sensorxtrans.h @@ -22,7 +22,7 @@ #include "toolpanel.h" -class SensorXTrans : +class SensorXTrans final: public ToolParamBlock, public FoldableToolPanel { diff --git a/rtgui/shadowshighlights.h b/rtgui/shadowshighlights.h index 4f3ee7577..7bb0bb01c 100644 --- a/rtgui/shadowshighlights.h +++ b/rtgui/shadowshighlights.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class ShadowsHighlights : +class ShadowsHighlights final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/sharpenedge.h b/rtgui/sharpenedge.h index 46a528153..a813d86e1 100644 --- a/rtgui/sharpenedge.h +++ b/rtgui/sharpenedge.h @@ -28,7 +28,7 @@ #include "adjuster.h" #include "toolpanel.h" -class SharpenEdge : +class SharpenEdge final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/sharpening.h b/rtgui/sharpening.h index e922e82c7..bd5e6f1b7 100644 --- a/rtgui/sharpening.h +++ b/rtgui/sharpening.h @@ -24,7 +24,7 @@ #include "thresholdadjuster.h" #include "toolpanel.h" -class Sharpening : +class Sharpening final: public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, diff --git a/rtgui/sharpenmicro.h b/rtgui/sharpenmicro.h index 3120e6e7b..23224dd60 100644 --- a/rtgui/sharpenmicro.h +++ b/rtgui/sharpenmicro.h @@ -28,7 +28,7 @@ #include "adjuster.h" #include "toolpanel.h" -class SharpenMicro : +class SharpenMicro final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/softlight.h b/rtgui/softlight.h index a584d3a73..710da4e34 100644 --- a/rtgui/softlight.h +++ b/rtgui/softlight.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class SoftLight: public ToolParamBlock, public AdjusterListener, public FoldableToolPanel +class SoftLight final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel { private: Adjuster *strength; diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 2774cd206..c9329cf91 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -23,6 +23,7 @@ #include "options.h" #include "rtscalable.h" #include "thumbbrowserbase.h" +#include "thumbbrowserentrybase.h" #include "../rtengine/rt_math.h" diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index 5a55aeeca..d6bafaf69 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -24,13 +24,13 @@ #include "guiutils.h" #include "options.h" -#include "thumbbrowserentrybase.h" /* * Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space */ class Inspector; +class ThumbBrowserEntryBase; class ThumbBrowserBase : public Gtk::Grid diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index bf230fe63..03606bb3d 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -23,6 +23,7 @@ #include #include "thumbimageupdater.h" +#include "thumbbrowserentrybase.h" #include "guiutils.h" #include "threadutils.h" diff --git a/rtgui/thumbimageupdater.h b/rtgui/thumbimageupdater.h index cdf65bd62..a2e2ecb19 100644 --- a/rtgui/thumbimageupdater.h +++ b/rtgui/thumbimageupdater.h @@ -20,7 +20,6 @@ #include -#include "thumbbrowserentrybase.h" #include "../rtengine/noncopyable.h" @@ -36,6 +35,9 @@ namespace procparams } } + +class ThumbBrowserEntryBase; + class ThumbImageUpdateListener { public: diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 68f3ee4de..dc9b17fa9 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -23,6 +23,8 @@ #include "tonecurve.h" #include "adjuster.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "eventmapper.h" #include "ppversion.h" #include "options.h" diff --git a/rtgui/tonecurve.h b/rtgui/tonecurve.h index cba810e15..e0482c5da 100644 --- a/rtgui/tonecurve.h +++ b/rtgui/tonecurve.h @@ -21,14 +21,16 @@ #include #include "adjuster.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "guiutils.h" #include "toolpanel.h" +class CurveEditor; +class CurveEditorGroup; +class DiagonalCurveEditor; class EditDataProvider; -class ToneCurve : +class ToneCurve final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, diff --git a/rtgui/toolbar.h b/rtgui/toolbar.h index 9f0a2818b..e6d99f819 100644 --- a/rtgui/toolbar.h +++ b/rtgui/toolbar.h @@ -37,7 +37,7 @@ public: virtual void editModeSwitchedOff() = 0; }; -class ToolBar : public Gtk::HBox +class ToolBar final : public Gtk::HBox { private: std::unique_ptr handimg; diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index 627200835..0f002e048 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -41,9 +41,6 @@ class ProcParams; } } -class FoldableToolPanel; -class ToolPanel; - class ToolPanelListener { public: diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index e774e3d39..a636994b2 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -21,6 +21,7 @@ #include "metadatapanel.h" #include "options.h" #include "rtimage.h" + #include "../rtengine/imagesource.h" #include "../rtengine/dfmanager.h" #include "../rtengine/ffmanager.h" diff --git a/rtgui/vibrance.cc b/rtgui/vibrance.cc index 67052785a..4a9fab3d3 100644 --- a/rtgui/vibrance.cc +++ b/rtgui/vibrance.cc @@ -18,6 +18,9 @@ */ #include "vibrance.h" + +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "options.h" #include "../rtengine/color.h" diff --git a/rtgui/vibrance.h b/rtgui/vibrance.h index 211f631f9..12acc7948 100644 --- a/rtgui/vibrance.h +++ b/rtgui/vibrance.h @@ -21,12 +21,14 @@ #include #include "adjuster.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "thresholdadjuster.h" #include "toolpanel.h" -class Vibrance : +class CurveEditorGroup; +class DiagonalCurveEditor; + +class Vibrance final : public ToolParamBlock, public AdjusterListener, public ThresholdCurveProvider, diff --git a/rtgui/vignetting.h b/rtgui/vignetting.h index 8cc8c498b..be7765094 100644 --- a/rtgui/vignetting.h +++ b/rtgui/vignetting.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class Vignetting : +class Vignetting final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 4fd3a7b8f..3981457e6 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -20,6 +20,8 @@ #include "wavelet.h" #include +#include "curveeditor.h" +#include "curveeditorgroup.h" #include "editcallbacks.h" #include "guiutils.h" #include "rtimage.h" diff --git a/rtgui/wavelet.h b/rtgui/wavelet.h index 20a0ba4e5..6551b58d4 100644 --- a/rtgui/wavelet.h +++ b/rtgui/wavelet.h @@ -22,15 +22,18 @@ #include #include "adjuster.h" #include "toolpanel.h" -#include "curveeditor.h" -#include "curveeditorgroup.h" +#include "curvelistener.h" #include "thresholdadjuster.h" #include "colorprovider.h" #include "guiutils.h" +class CurveEditor; +class CurveEditorGroup; +class DiagonalCurveEditor; class EditDataProvider; +class FlatCurveEditor; -class Wavelet : +class Wavelet final : public ToolParamBlock, public ThresholdAdjusterListener, public AdjusterListener, diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index 528c81d17..b4d09f119 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -35,7 +35,7 @@ public: virtual void spotWBRequested(int size) = 0; }; -class WhiteBalance : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoWBListener +class WhiteBalance final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoWBListener { enum WB_LabelType { diff --git a/rtgui/xtransprocess.h b/rtgui/xtransprocess.h index b17b56b07..d6cb120e0 100644 --- a/rtgui/xtransprocess.h +++ b/rtgui/xtransprocess.h @@ -25,7 +25,7 @@ #include "guiutils.h" #include "toolpanel.h" -class XTransProcess : +class XTransProcess final : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, diff --git a/rtgui/xtransrawexposure.h b/rtgui/xtransrawexposure.h index 46c418f2f..a8daf6972 100644 --- a/rtgui/xtransrawexposure.h +++ b/rtgui/xtransrawexposure.h @@ -23,7 +23,7 @@ #include "adjuster.h" #include "toolpanel.h" -class XTransRAWExposure : +class XTransRAWExposure final : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel