diff --git a/rtengine/camconst.json b/rtengine/camconst.json index cbef6d132..ed28618ab 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1003,8 +1003,8 @@ Camera constants: "ranges": { "white": 16300 } }, - { // Quality B - "make_model": [ "Canon PowerShot G7 X", "Canon PowerShot G7 X Mark II" ], + { // Quality B, + "make_model": "Canon PowerShot G7 X", "dcraw_matrix": [ 9602,-3823,-937,-2984,11495,1675,-407,1415,5049 ], // DNG_V8.7 D65 //"raw_crop": [ 116, 24, 5504, 3680 ], // Sensor size 5632x3710. Largest useful frame 120-5616X28-3702 = 5504x3682, 4pix RTborders, Left Border 120-4, Top border 28-4 "raw_crop": [ 128, 36, 5480, 3656 ], // Default official 3/2 frame 5472X3648, 4pix borders, Left Border 132-4, Top border 40-4 @@ -1012,8 +1012,8 @@ Camera constants: "ranges": { "white": 4080 } }, - { // Quality B - "make_model": [ "Canon PowerShot G5 X", "Canon PowerShot G9 X" ], + { // Quality B, + "make_model": [ "Canon PowerShot G5 X", "Canon PowerShot G9 X", "Canon PowerShot G7 X Mark II" ], "dcraw_matrix": [ 9602,-3823,-937,-2984,11495,1675,-407,1415,5049 ], // DNG_V8.7 D65 //"raw_crop": [ 116, 24, 5504, 3680 ], // Sensor size 5632x3710. Largest useful frame 120-5616X28-3702 = 5504x3682, 4pix RTborders, Left Border 120-4, Top border 28-4 "raw_crop": [ 128, 36, 5480, 3656 ], // Default official 3/2 frame 5472X3648, 4pix borders, Left Border 132-4, Top border 40-4 @@ -1332,6 +1332,20 @@ Camera constants: } }, + { // Quality C, 20Mp and 80Mp raw frames, Color matrix copied from EM5MKII which looks to be close. + "make_model": "OLYMPUS E-M1MarkII", + "dcraw_matrix": [ 9422,-3258,-711,-2655,10898,2015,-512,1354,5512 ], // E-M5II dng_v9.5 D65 + "raw_crop": [ 8, 8, -16, -8 ], // full raw 5240X3912, jpeg top12,left12,5184x3888, full hires 10400X7792, jpeg crop 8,8,10368x7776 + "ranges": { + "white": [ + { "iso": [ 64, 100, 125, 160, 200, 250, 320, 400 ], "levels": 4090 }, // normal 4095 + { "iso": [ 500, 640, 800, 1000, 1600 ], "levels": 4080 }, // 4085-4095 + { "iso": [ 2000, 2500, 3200, 4000, 5000, 6400 ], "levels": 4060 }, // 4085-4095 + { "iso": [ 12800, 25600, 51200 ], "levels": 4060 } // guess + ] + } + }, + { // Quality B, missing per ISO samples "make_model": "OLYMPUS E-M1", "dcraw_matrix": [ 7687,-1984,-606,-4327,11928,2721,-1381,2339,6452 ], // dng d65 @@ -1702,6 +1716,22 @@ Camera constants: } }, + { // Quality B, Intemediate ISO samples missing, Pentax_DNG WLtags are after BL sutraction and not valid + "make_model": [ "RICOH PENTAX K-1", "PENTAX K-1" ], + "dcraw_matrix": [ 8596,-2981,-639,-4202,12046,2431,-685,1424,6122 ], // adobe DNG v9.7 D65 + //"dcraw_matrix": [ 8566,-2746,-1201,-3612,12204,1550,-893,1680,6264 ], // PENTAX DNG + "raw_crop": [ 6, 18, 7376, 4932 ], // full frame 7392x4950, cropped to official DNG raw_crop 6,18,7382,4950, official jpeg crop 8,10,7360x4912 + "ranges": { + "white": [ + { "iso": [ 100, 200, 400, 800 ], "levels": 16300 }, // 16380 + { "iso": [ 1600, 3200 ], "levels": 16250 }, // 16360 + { "iso": [ 6400, 12800 ], "levels": 16200 }, // 16330 + { "iso": [ 25600, 51200 ], "levels": 16100 }, // 16300 + { "iso": 102400, "levels": 16000 } // 16200 + ] + } + }, + { // Quality B, intermediate ISOs info missing "make_model": [ "RICOH PENTAX K-3", "PENTAX K-3" ], "dcraw_matrix": [ 7415,-2052,-721,-5186,12788,2682,-1446,2157,6773 ], // adobe dcp d65 diff --git a/rtengine/color.h b/rtengine/color.h index e2b32e834..77db1f4f7 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -17,14 +17,16 @@ * along with RawTherapee. If not, see . */ -#ifndef _COLOR_H_ -#define _COLOR_H_ +#pragma once + +#include #include "rt_math.h" #include "LUT.h" #include "labimage.h" #include "iccmatrices.h" #include "sleef.c" + #define SAT(a,b,c) ((float)max(a,b,c)-(float)min(a,b,c))/(float)max(a,b,c) namespace rtengine @@ -1680,5 +1682,3 @@ public: }; } - -#endif diff --git a/rtengine/iccjpeg.cc b/rtengine/iccjpeg.cc index 21ba86f28..31aa0ec7c 100644 --- a/rtengine/iccjpeg.cc +++ b/rtengine/iccjpeg.cc @@ -142,7 +142,9 @@ marker_is_icc (jpeg_saved_marker_ptr marker) GETJOCTET(marker->data[8]) == 0x49 && GETJOCTET(marker->data[9]) == 0x4C && GETJOCTET(marker->data[10]) == 0x45 && - GETJOCTET(marker->data[11]) == 0x0; + GETJOCTET(marker->data[11]) == 0x0 + ? TRUE + : FALSE; } diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index d3400a8d0..f8e257ddc 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -440,6 +440,16 @@ void ImageData::extractInfo () } } } else if (mnote && (!make.compare (0, 6, "PENTAX") || (!make.compare (0, 5, "RICOH") && !model.compare (0, 6, "PENTAX")))) { + // ISO at max value supported, check manufacturer specific + if (iso_speed == 65535 || iso_speed == 0) { + rtexif::Tag* baseIsoTag = mnote->getTag("ISO"); + if (baseIsoTag) { + std::string isoData = baseIsoTag->valueToString(); + if (isoData.size() > 1) { + iso_speed = stoi(isoData); + } + } + } if (mnote->getTag ("LensType")) { lens = mnote->getTag ("LensType")->valueToString (); } diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index d22fe08f2..7356231cb 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -794,12 +794,13 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr // multiplier for vignetting correction double vignmul = 1.0; - if (needsVignetting()) + if (needsVignetting()) { if(darkening) { vignmul /= std::max(v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001); } else { vignmul *= (v + mul * tanh (b * (maxRadius - s * r2) / maxRadius)); } + } if (needsGradient()) { vignmul *= calcGradientFactor(gp, cx + x, cy + y); @@ -963,12 +964,13 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf // multiplier for vignetting correction double vignmul = 1.0; - if (needsVignetting()) + if (needsVignetting()) { if(darkening) { vignmul /= std::max(v + mul * tanh (b * (maxRadius - s * r2) / maxRadius), 0.001); } else { vignmul = v + mul * tanh (b * (maxRadius - s * r2) / maxRadius); } + } if (needsGradient()) { vignmul *= calcGradientFactor(gp, cx + x, cy + y); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 5a8ee39a6..1ac3cbed2 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1476,6 +1476,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b //save retinex + if (!pedited || pedited->retinex.enabled) { + keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled); + } + if (!pedited || pedited->retinex.str) { keyFile.set_integer ("Retinex", "Str", retinex.str); } @@ -1504,10 +1508,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b keyFile.set_double ("Retinex", "Slope", retinex.slope); } - if (!pedited || pedited->retinex.enabled) { - keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled); - } - if (!pedited || pedited->retinex.medianmap) { keyFile.set_boolean ("Retinex", "Median", retinex.medianmap); } diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c65e89e24..7c2d71aaa 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -206,7 +207,7 @@ public: } }*/ - Threshold & operator= (const Threshold &rhs) + Threshold& operator =(const Threshold &rhs) { value[0] = rhs.value[0]; value[1] = rhs.value[1]; @@ -217,16 +218,34 @@ public: return *this; } - bool operator== (const Threshold &rhs) const + template + typename std::enable_if::value, bool>::type operator ==(const Threshold &rhs) const { - if (_isDouble) - return fabs(value[0] - rhs.value[0]) < 1e-10 - && fabs(value[1] - rhs.value[1]) < 1e-10 - && fabs(value[2] - rhs.value[2]) < 1e-10 - && fabs(value[3] - rhs.value[3]) < 1e-10; - else - return fabs(value[0] - rhs.value[0]) < 1e-10 - && fabs(value[1] - rhs.value[1]) < 1e-10; + if (_isDouble) { + return std::fabs(value[0] - rhs.value[0]) < 1e-10 + && std::fabs(value[1] - rhs.value[1]) < 1e-10 + && std::fabs(value[2] - rhs.value[2]) < 1e-10 + && std::fabs(value[3] - rhs.value[3]) < 1e-10; + } else { + return std::fabs(value[0] - rhs.value[0]) < 1e-10 + && std::fabs(value[1] - rhs.value[1]) < 1e-10; + } + } + + template + typename std::enable_if::value, bool>::type operator ==(const Threshold &rhs) const + { + if (_isDouble) { + return + value[0] == rhs.value[0] + && value[1] == rhs.value[1] + && value[2] == rhs.value[2] + && value[3] == rhs.value[3]; + } else { + return + value[0] == rhs.value[0] + && value[1] == rhs.value[1]; + } } }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b2e3e5e56..049c509f5 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1851,7 +1851,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } - if( totBP ) + if( totBP ) { if ( ri->getSensorType() == ST_BAYER ) { interpolateBadPixelsBayer( *bitmapBads ); } else if ( ri->getSensorType() == ST_FUJI_XTRANS ) { @@ -1859,6 +1859,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } else { interpolateBadPixelsNColours( *bitmapBads, ri->get_colors() ); } + } if ( ri->getSensorType() == ST_BAYER && raw.bayersensor.linenoise > 0 ) { if (plistener) { diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index fc0dd782b..080c44b8e 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -461,7 +461,7 @@ void ExifPanel::addPressed () } else { tcombo->set_active_text (sel); - if (tcombo->get_active () < 0) { + if (!tcombo->get_active ()) { tcombo->append (sel); tcombo->set_active_text (sel); } diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index bddcf838b..0842f4fb1 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -149,16 +149,43 @@ void ImageArea::setInfoText (Glib::ustring text) infotext = text; Glib::RefPtr context = get_pango_context () ; - Pango::FontDescription fontd = context->get_font_description (); + Pango::FontDescription fontd(get_style_context()->get_font()); + + // update font fontd.set_weight (Pango::WEIGHT_BOLD); fontd.set_size (10 * Pango::SCALE); context->set_font_description (fontd); - ilayout = create_pango_layout(""); + + // create text layout + Glib::RefPtr ilayout = create_pango_layout(""); ilayout->set_markup(text); + + // get size of the text block int iw, ih; ilayout->get_pixel_size (iw, ih); - ipixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, true, 8, iw + 8, ih + 8); - ipixbuf->fill (128); + + // create BackBuffer + iBackBuffer.setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, iw + 16, ih + 16, true); + iBackBuffer.setDestPosition(8, 8); + + Cairo::RefPtr cr = iBackBuffer.getContext(); + + // cleaning the back buffer (make it full transparent) + cr->set_source_rgba (0., 0., 0., 0.); + cr->set_operator (Cairo::OPERATOR_CLEAR); + cr->paint (); + cr->set_operator (Cairo::OPERATOR_OVER); + + // paint transparent black background + cr->set_source_rgba (0., 0., 0., 0.5); + cr->paint (); + + // paint text + cr->set_source_rgb (1.0, 1.0, 1.0); + cr->move_to (8, 8); + ilayout->add_to_cairo_context (cr); + cr->fill (); + } void ImageArea::infoEnabled (bool e) @@ -215,15 +242,7 @@ bool ImageArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) } if (options.showInfo && infotext != "") { - int fnw, fnh; - ilayout->get_pixel_size (fnw, fnh); - Gdk::Cairo::set_source_pixbuf(cr, ipixbuf, 4, 4); - cr->rectangle(4, 4, fnw + 8, fnh + 8); - cr->fill(); - cr->set_source_rgb (1.0, 1.0, 1.0); - cr->move_to (8, 8); - ilayout->add_to_cairo_context (cr); - cr->fill (); + iBackBuffer.copySurface(cr); } for (std::list::reverse_iterator i = cropWins.rbegin(); i != cropWins.rend(); ++i) { diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index ff51111d1..91820beb1 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -41,9 +41,8 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public Edi protected: Glib::ustring infotext; - Glib::RefPtr ilayout; Glib::RefPtr deglayout; - Glib::RefPtr ipixbuf; + BackBuffer iBackBuffer; bool showClippedH, showClippedS; ImageAreaPanel* parent; diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index 69fb02acd..0f9b11cf2 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -17,9 +17,11 @@ * along with RawTherapee. If not, see . */ +#include +#include + #include "thresholdselector.h" #include "multilangmgr.h" -#include #include "mycurve.h" ThresholdSelector::ThresholdSelector(double minValueBottom, double maxValueBottom, double defBottom, Glib::ustring labelBottom, unsigned int precisionBottom, @@ -606,7 +608,7 @@ void ThresholdSelector::findLitCursor(int posX, int posY) // we use minValTop since if this block is executed, it means that we are in a simple Threshold where both bottom and top range are the same double cursorX = (posX - hb) * (maxValTop - minValTop) / (w - 2 * hb) + minValTop; - if (cursorX > positions[TS_TOPRIGHT] || abs(cursorX - positions[TS_TOPRIGHT]) < abs(cursorX - positions[TS_TOPLEFT])) { + if (cursorX > positions[TS_TOPRIGHT] || std::fabs(cursorX - positions[TS_TOPRIGHT]) < std::fabs(cursorX - positions[TS_TOPLEFT])) { litCursor = TS_TOPRIGHT; } } @@ -619,7 +621,7 @@ void ThresholdSelector::findLitCursor(int posX, int posY) // we use minValTop since if this block is executed, it means that we are in a simple Threshold where both bottom and top range are the same double cursorX = (posX - hb) * (maxValTop - minValTop) / (w - 2 * hb) + minValTop; - if (cursorX > positions[TS_BOTTOMRIGHT] || abs(cursorX - positions[TS_BOTTOMRIGHT]) < abs(cursorX - positions[TS_BOTTOMLEFT])) { + if (cursorX > positions[TS_BOTTOMRIGHT] || std::fabs(cursorX - positions[TS_BOTTOMRIGHT]) < std::fabs(cursorX - positions[TS_BOTTOMLEFT])) { litCursor = TS_BOTTOMRIGHT; } } diff --git a/rtgui/windirmonitor.h b/rtgui/windirmonitor.h index c3278c931..b9be67a5a 100644 --- a/rtgui/windirmonitor.h +++ b/rtgui/windirmonitor.h @@ -24,8 +24,9 @@ class WinDirChangeListener { - public: + virtual ~WinDirChangeListener() = default; + virtual void winDirChanged () {} };