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/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"], diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 894414f8a..9d96975c8 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -805,6 +805,13 @@ 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 @@ -1359,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 @@ -1713,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 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 46de66e59..8516ebc30 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 f39f73c56..e550d745d 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -57,7 +57,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 bcb457a98..93dee7537 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 3da80268c..a566a5e2f 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 1dac27efb..842b4fe0f 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 1d35ecc66..6ed4efa9d 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -63,7 +63,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 24cb2aa67..5c2858fad 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -81,7 +81,7 @@ public: virtual void getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const 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/rtengine/procparams.cc b/rtengine/procparams.cc index aa0444591..62fefbb69 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2928,7 +2928,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); 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 () 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;