From 17f343f6825217d6f303a52ce9d90f0b3a803242 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Thu, 25 Jul 2019 17:45:43 +0200 Subject: [PATCH 1/8] add -Wcast-qual switch and fix all related warnings --- CMakeLists.txt | 2 +- rtengine/dcraw.cc | 6 +++--- rtengine/image16.cc | 4 ++-- rtengine/image16.h | 2 +- rtengine/image8.cc | 4 ++-- rtengine/image8.h | 2 +- rtengine/imagefloat.cc | 8 ++++---- rtengine/imagefloat.h | 2 +- rtengine/imageio.cc | 14 +++++++------- rtengine/imageio.h | 2 +- rtexif/rtexif.cc | 8 ++++---- rtexif/rtexif.h | 6 +++--- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 637cc1b9f..b027ea5f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -392,7 +392,7 @@ if(WITH_PROF) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Wno-deprecated-declarations -Wno-unused-result") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result") if(OPTION_OMP) find_package(OpenMP) if(OPENMP_FOUND) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index 280b692e7..a4450a69a 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -240,7 +240,7 @@ int CLASS fcol (int row, int col) #ifndef __GLIBC__ char *my_memmem (char *haystack, size_t haystacklen, - char *needle, size_t needlelen) + const char *needle, size_t needlelen) { char *c; for (c = haystack; c <= haystack + haystacklen - needlelen; c++) @@ -9233,8 +9233,8 @@ void CLASS identify() fseek (ifp, 0, SEEK_SET); fread (head, 1, 32, ifp); /* RT: changed string constant */ - if ((cp = (char *) memmem (head, 32, (char*)"MMMM", 4)) || - (cp = (char *) memmem (head, 32, (char*)"IIII", 4))) { + if ((cp = (char *) memmem (head, 32, "MMMM", 4)) || + (cp = (char *) memmem (head, 32, "IIII", 4))) { parse_phase_one (cp-head); if (cp-head && parse_tiff(0)) apply_tiff(); } else if (order == 0x4949 || order == 0x4d4d) { diff --git a/rtengine/image16.cc b/rtengine/image16.cc index c0e97557a..7d4d3e41d 100644 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -74,7 +74,7 @@ void Image16::getScanline(int row, unsigned char* buffer, int bps, bool isFloat) } } -void Image16::setScanline(int row, unsigned char* buffer, int bps, unsigned int numSamples) +void Image16::setScanline(int row, const unsigned char* buffer, int bps, unsigned int numSamples) { if (data == nullptr) { @@ -101,7 +101,7 @@ void Image16::setScanline(int row, unsigned char* buffer, int bps, unsigned int } case (IIOSF_UNSIGNED_SHORT): { - unsigned short* sbuffer = (unsigned short*) buffer; + const unsigned short* sbuffer = (const unsigned short*) buffer; int ix = 0; for (int i = 0; i < width; ++i) { diff --git a/rtengine/image16.h b/rtengine/image16.h index 9762af990..f31626939 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -56,7 +56,7 @@ public: } void getScanline(int row, unsigned char* buffer, int bps, bool isFloat = false) const override; - void setScanline(int row, unsigned char* buffer, int bps, unsigned int numSamples) override; + void setScanline(int row, const unsigned char* buffer, int bps, unsigned int numSamples) override; // functions inherited from IImage16: MyMutex& getMutex() override diff --git a/rtengine/image8.cc b/rtengine/image8.cc index 513b0049e..850ec87c0 100644 --- a/rtengine/image8.cc +++ b/rtengine/image8.cc @@ -55,7 +55,7 @@ void Image8::getScanline (int row, unsigned char* buffer, int bps, bool isFloat) } } -void Image8::setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples) +void Image8::setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples) { if (data == nullptr) { @@ -74,7 +74,7 @@ void Image8::setScanline (int row, unsigned char* buffer, int bps, unsigned int break; case (IIOSF_UNSIGNED_SHORT): { - unsigned short* sbuffer = (unsigned short*) buffer; + const unsigned short* sbuffer = (const unsigned short*) buffer; for (int i = 0, ix = row * width * 3; i < width * 3; ++i, ++ix) { data[ix] = uint16ToUint8Rounded(sbuffer[i]); diff --git a/rtengine/image8.h b/rtengine/image8.h index 8928cf85b..57852b7af 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -53,7 +53,7 @@ public: } void getScanline (int row, unsigned char* buffer, int bps, bool isFloat = false) const override; - void setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples) override; + void setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples) override; // functions inherited from IImage*: MyMutex& getMutex () override diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index d98a817a2..793915604 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -45,7 +45,7 @@ Imagefloat::~Imagefloat () } // Call this method to handle floating points input values of different size -void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples) +void Imagefloat::setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples) { if (data == nullptr) { @@ -58,7 +58,7 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned switch (sampleFormat) { case (IIOSF_FLOAT16): { int ix = 0; - uint16_t* sbuffer = (uint16_t*) buffer; + const uint16_t* sbuffer = (const uint16_t*) buffer; for (int i = 0; i < width; i++) { r(row, i) = 65535.f * DNG_HalfToFloat(sbuffer[ix++]); @@ -71,7 +71,7 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned //case (IIOSF_FLOAT24): case (IIOSF_FLOAT32): { int ix = 0; - float* sbuffer = (float*) buffer; + const float* sbuffer = (const float*) buffer; for (int i = 0; i < width; i++) { r(row, i) = 65535.f * sbuffer[ix++]; @@ -85,7 +85,7 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned case (IIOSF_LOGLUV24): case (IIOSF_LOGLUV32): { int ix = 0; - float* sbuffer = (float*) buffer; + const float* sbuffer = (const float*) buffer; float xyzvalues[3], rgbvalues[3]; for (int i = 0; i < width; i++) { diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index e1e5086b8..805971e7a 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -62,7 +62,7 @@ public: } void getScanline (int row, unsigned char* buffer, int bps, bool isFloat = false) const override; - void setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples) override; + void setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples) override; // functions inherited from IImagefloat: MyMutex& getMutex () override diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 3b0fdcf6d..1e4f8c008 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -89,7 +89,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot) } if (eroot) { - rtexif::TagDirectory* td = ((rtexif::TagDirectory*)eroot)->clone (nullptr); + rtexif::TagDirectory* td = eroot->clone (nullptr); // make IPTC and XMP pass through td->keepTag(0x83bb); // IPTC @@ -113,7 +113,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr } if (eroot) { - exifRoot = ((rtexif::TagDirectory*)eroot)->clone (nullptr); + exifRoot = eroot->clone (nullptr); } if (iptc != nullptr) { @@ -140,7 +140,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr for (unsigned int j = 0; j < i->second.size(); j++) { IptcDataSet * ds = iptc_dataset_new (); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_KEYWORDS); - iptc_dataset_set_data (ds, (unsigned char*)i->second.at(j).c_str(), min(static_cast(64), i->second.at(j).bytes()), IPTC_DONT_VALIDATE); + iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(j).c_str(), min(static_cast(64), i->second.at(j).bytes()), IPTC_DONT_VALIDATE); iptc_data_add_dataset (iptc, ds); iptc_dataset_unref (ds); } @@ -150,7 +150,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr for (unsigned int j = 0; j < i->second.size(); j++) { IptcDataSet * ds = iptc_dataset_new (); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_SUPPL_CATEGORY); - iptc_dataset_set_data (ds, (unsigned char*)i->second.at(j).c_str(), min(static_cast(32), i->second.at(j).bytes()), IPTC_DONT_VALIDATE); + iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(j).c_str(), min(static_cast(32), i->second.at(j).bytes()), IPTC_DONT_VALIDATE); iptc_data_add_dataset (iptc, ds); iptc_dataset_unref (ds); } @@ -162,7 +162,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr if (i->first == strTags[j].field && !(i->second.empty())) { IptcDataSet * ds = iptc_dataset_new (); iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, strTags[j].tag); - iptc_dataset_set_data (ds, (unsigned char*)i->second.at(0).c_str(), min(strTags[j].size, i->second.at(0).bytes()), IPTC_DONT_VALIDATE); + iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(0).c_str(), min(strTags[j].size, i->second.at(0).bytes()), IPTC_DONT_VALIDATE); iptc_data_add_dataset (iptc, ds); iptc_dataset_unref (ds); } @@ -910,12 +910,12 @@ int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s char swapped[line_length]; for ( int row = 0; row < height; ++row ) { - ::rtengine::swab(((char*)buffer) + (row * line_length), swapped, line_length); + ::rtengine::swab(((const char*)buffer) + (row * line_length), swapped, line_length); setScanline(row, (unsigned char*)&swapped[0], bps); } } else { for ( int row = 0; row < height; ++row ) { - setScanline(row, ((unsigned char*)buffer) + (row * line_length), bps); + setScanline(row, ((const unsigned char*)buffer) + (row * line_length), bps); } } diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 05a11655a..fd2cbc2b9 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -81,7 +81,7 @@ public: virtual void getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* image, PreviewProps pp) const = 0; virtual int getBPS () const = 0; virtual void getScanline (int row, unsigned char* buffer, int bps, bool isFloat = false) const = 0; - virtual void setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples = 3) = 0; + virtual void setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples = 3) = 0; virtual const char* getType () const = 0; int load (const Glib::ustring &fname); diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 312cbd1c7..dcc0ed56d 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -673,7 +673,7 @@ int TagDirectory::calculateSize () return size; } -TagDirectory* TagDirectory::clone (TagDirectory* parent) +TagDirectory* TagDirectory::clone (TagDirectory* parent) const { TagDirectory* td = new TagDirectory (parent, attribs, order); @@ -857,7 +857,7 @@ TagDirectoryTable::TagDirectoryTable (TagDirectory* p, FILE* f, int memsize, int } } } -TagDirectory* TagDirectoryTable::clone (TagDirectory* parent) +TagDirectory* TagDirectoryTable::clone (TagDirectory* parent) const { TagDirectory* td = new TagDirectoryTable (parent, values, valuesSize, zeroOffset, defaultType, attribs, order); @@ -1382,7 +1382,7 @@ bool Tag::parseMakerNote (FILE* f, int base, ByteOrder bom ) return true; } -Tag* Tag::clone (TagDirectory* parent) +Tag* Tag::clone (TagDirectory* parent) const { Tag* t = new Tag (parent, attrib); @@ -1397,7 +1397,7 @@ Tag* Tag::clone (TagDirectory* parent) t->value = new unsigned char [valuesize]; memcpy (t->value, value, valuesize); } else { - value = nullptr; + t->value = nullptr; } t->makerNoteKind = makerNoteKind; diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 43b296746..eadea4fa1 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -180,7 +180,7 @@ public: virtual int calculateSize (); virtual int write (int start, unsigned char* buffer); - virtual TagDirectory* clone (TagDirectory* parent); + virtual TagDirectory* clone (TagDirectory* parent) const; void applyChange (const std::string &field, const Glib::ustring &value); virtual void printAll (unsigned int level = 0) const; // reentrant debug function, keep level=0 on first call ! @@ -204,7 +204,7 @@ public: ~TagDirectoryTable() override; int calculateSize () override; int write (int start, unsigned char* buffer) override; - TagDirectory* clone (TagDirectory* parent) override; + TagDirectory* clone (TagDirectory* parent) const override; }; // a class representing a single tag @@ -310,7 +310,7 @@ public: // functions for writing int calculateSize (); int write (int offs, int dataOffs, unsigned char* buffer); - Tag* clone (TagDirectory* parent); + Tag* clone (TagDirectory* parent) const; // to control if the tag shall be written bool getKeep () From 13a1b59c46e8223b8be6f42b4c2dbe704480787e Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Thu, 1 Aug 2019 21:35:52 +0200 Subject: [PATCH 2/8] Better white level for Canon EOS 400D DIGITAL --- rtengine/camconst.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 894414f8a..ab90a03a3 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -805,6 +805,12 @@ Camera constants: // Canon mid-range DSLRs (Rebels) + { // Quality C + "make_model": [ "Canon EOS 400D DIGITAL" ], + "ranges": { + "white": 4056 + }, + { // Quality B, ISO and aperture WL data by ..... at RawTherapee forums, missing samples safely guessed "make_model": [ "Canon EOS 550D", "Canon EOS Rebel T2i", "Canon EOS Kiss X4" ], "dcraw_matrix": [ 6941,-1164,-857,-3825,11597,2534,-416,1540,6039 ], // dcraw 550d From 2ec224c9ef2f9427e79d87d18367424c8c6cc576 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Thu, 1 Aug 2019 21:48:24 +0200 Subject: [PATCH 3/8] Fix wrong camconst.json entry --- rtengine/camconst.json | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index ab90a03a3..2f0f5ff40 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -809,6 +809,7 @@ Camera constants: "make_model": [ "Canon EOS 400D DIGITAL" ], "ranges": { "white": 4056 + } }, { // Quality B, ISO and aperture WL data by ..... at RawTherapee forums, missing samples safely guessed From b36e14c73185ed2d0fb018f9d2d26ea57df111f2 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Fri, 2 Aug 2019 11:49:25 +0200 Subject: [PATCH 4/8] raw crop for LEICA Q2 --- rtengine/camconst.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 2f0f5ff40..9551d5e16 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1366,6 +1366,11 @@ Camera constants: "raw_crop": [ 4, 4, -4, -4 ] // full raw 6016x4016, Official 6000x4000 }, + { // Quality C + "make_model": "LEICA Q2", + "raw_crop": [ 0, 0, 8392, 5624 ] + }, + { // Quality B, Matrix from Adobe's dcp D65 instead of the internal in Leica's DNG "make_model": "LEICA SL (Typ 601)", "dcraw_matrix": [ 11492,-4930,-1188,-5593,14673,873,-609,1474,6343 ], // DNGv9.3 D65 From 06f224a4eb9f51a7286a882819424ef2f3e80115 Mon Sep 17 00:00:00 2001 From: rom9 <4711834+rom9@users.noreply.github.com> Date: Fri, 2 Aug 2019 13:28:48 +0200 Subject: [PATCH 5/8] Fixes #5397 by requiring thumbnail reprocessing when filmnegative params are changed. --- rtgui/thumbnail.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 6ac3d629b..eedff3029 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -474,6 +474,7 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh || pparams->filmSimulation != pp.filmSimulation || pparams->softlight != pp.softlight || pparams->dehaze != pp.dehaze + || pparams->filmNegative != pp.filmNegative || whoChangedIt == FILEBROWSER || whoChangedIt == BATCHEDITOR; From e7d10bbf76e0c4cd6aed4831b297c565f046b8b1 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Fri, 2 Aug 2019 16:03:03 +0200 Subject: [PATCH 6/8] Fixes broken clear processing profile when image has same rank as thumb --- rtengine/procparams.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 2118213d5..cb27fc2b3 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2878,7 +2878,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo keyFile.set_string("Version", "AppVersion", RTVERSION); keyFile.set_integer("Version", "Version", PPVERSION); - saveToKeyfile(!pedited || pedited->general.rank, "General", "Rank", std::max(rank, 0), keyFile); + saveToKeyfile(!pedited || pedited->general.rank, "General", "Rank", rank, keyFile); saveToKeyfile(!pedited || pedited->general.colorlabel, "General", "ColorLabel", colorlabel, keyFile); saveToKeyfile(!pedited || pedited->general.intrash, "General", "InTrash", inTrash, keyFile); From 1b8dd7c49a524952281fc4812e0baf6d77127156 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Mon, 5 Aug 2019 12:11:18 +0200 Subject: [PATCH 7/8] Added camera model aliases Partly related to #5400 --- rtdata/dcpprofiles/camera_model_aliases.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtdata/dcpprofiles/camera_model_aliases.json b/rtdata/dcpprofiles/camera_model_aliases.json index 61fc2bf57..32db0db52 100644 --- a/rtdata/dcpprofiles/camera_model_aliases.json +++ b/rtdata/dcpprofiles/camera_model_aliases.json @@ -16,6 +16,8 @@ "Canon EOS 1000D": ["Canon EOS Kiss Digital F", "Canon EOS DIGITAL REBEL XS"], "Canon EOS 1200D": ["Canon EOS Kiss X70", "Canon EOS REBEL T5"], "Canon EOS 1300D": ["Canon EOS Kiss X80", "Canon EOS Rebel T6"], + "Canon EOS 2000D": ["Canon EOS 1500D", "Canon EOS Kiss X90", "Canon EOS Rebel T7"], + "Canon EOS 4000D": ["Canon EOS 3000D", "Canon EOS Rebel T100"], "MINOLTA DYNAX 5D": ["Minolta Maxxum 5D", "Minolta Alpha 5D", "Minolta Alpha Sweet"], "MINOLTA DYNAX 7D": ["Minolta Maxxum 7D", "Minolta Alpha 7D"], From 972d6907d560569e97ea41bab315ab5ea0855b17 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Tue, 6 Aug 2019 14:51:30 +0200 Subject: [PATCH 8/8] raw crop for OLYMPUS TG-5 and TG-6 --- rtengine/camconst.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 9551d5e16..9d96975c8 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1725,9 +1725,15 @@ Camera constants: { // Quality B, "make_model": "OLYMPUS TG-5", "dcraw_matrix": [ 10899,-3833,-1082,-2112,10736,1575,-267,1452,5269 ], // DNG_V9.12 D65 + "raw_crop": [ 0, 0, -18, 0 ], // 18 pixels at right are garbage "ranges": { "white": 4050 } // safe for worst case detected, nominal is 4093 }, + { // Quality C, only raw crop + "make_model": "OLYMPUS TG-6", + "raw_crop": [ 0, 0, -24, 0 ] // 24 pixels at right are garbage + }, + { // Quality C, only green equilibration "make_model" : ["OLYMPUS E-3", "OLYMPUS E-520"], "global_green_equilibration" : true