diff --git a/rtdata/dcpprofiles/FUJIFILM GFX 50R.dcp b/rtdata/dcpprofiles/FUJIFILM GFX 50R.dcp new file mode 100644 index 000000000..a17d5e02d Binary files /dev/null and b/rtdata/dcpprofiles/FUJIFILM GFX 50R.dcp differ diff --git a/rtdata/dcpprofiles/NIKON D70s.dcp b/rtdata/dcpprofiles/NIKON D70s.dcp new file mode 100644 index 000000000..15c6171cb Binary files /dev/null and b/rtdata/dcpprofiles/NIKON D70s.dcp differ diff --git a/rtdata/profiles/Unclipped.pp3 b/rtdata/profiles/Unclipped.pp3 new file mode 100644 index 000000000..48cf72f86 --- /dev/null +++ b/rtdata/profiles/Unclipped.pp3 @@ -0,0 +1,27 @@ +[Exposure] +ClampOOG=false +Curve=0; +Curve2=0; + +[Black & White] +BeforeCurve=0; +AfterCurve=0; + +[Vibrance] +Enabled=false + +[Color appearance] +Enabled=false + +[Film Simulation] +Enabled=false + +[RGB Curves] +LumaMode=false + +[Color Management] +ApplyLookTable=false + +[RAW] +CA=true +CAAutoIterations=2 diff --git a/rtengine/dcp.cc b/rtengine/dcp.cc index c60e80587..1c99b682c 100644 --- a/rtengine/dcp.cc +++ b/rtengine/dcp.cc @@ -1265,7 +1265,7 @@ void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int float cnewb = FCLIP(newb); float h, s, v; - Color::rgb2hsvdcp(cnewr, cnewg, cnewb, h, s, v); + Color::rgb2hsvtc(cnewr, cnewg, cnewb, h, s, v); hsdApply(look_info, look_table, h, s, v); s = CLIP01(s); @@ -1648,7 +1648,7 @@ std::vector DCPProfile::makeHueSatMap(const ColorTemp& wh return res; } -void DCPProfile::hsdApply(const HsdTableInfo& table_info, const std::vector& table_base, float& h, float& s, float& v) const +inline void DCPProfile::hsdApply(const HsdTableInfo& table_info, const std::vector& table_base, float& h, float& s, float& v) const { // Apply the HueSatMap. Ported from Adobes reference implementation. float hue_shift; diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index cbb8aa5c0..878498bf3 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -300,6 +300,38 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } if (lens == "Unknown") { + const auto lens_from_make_and_model = + [this, exif]() -> bool + { + if (!exif) { + return false; + } + + const rtexif::Tag* const lens_model = exif->getTag(0xA434); + + if (lens_model) { + const rtexif::Tag* const lens_make = exif->getTag(0xA433); + const std::string make = + lens_make + ? lens_make->valueToString() + : std::string(); + const std::string model = lens_model->valueToString(); + + if (!model.empty()) { + lens = make; + + if (!lens.empty()) { + lens += ' '; + } + + lens += model; + + return true; + } + } + + return false; + }; if (mnote) { @@ -341,6 +373,11 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } } } + // If MakeNotes are vague, fall back to Exif LensMake and LensModel if set + // https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#LensType + if (lens == "Manual Lens No CPU") { + lens_from_make_and_model(); + } } } @@ -406,11 +443,15 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rtexif::Tag *lt = mnote->getTag("LensType"); if ( lt ) { - std::string ldata = lt->valueToString (); + if (lt->toInt()) { + std::string ldata = lt->valueToString (); - if (ldata.size() > 1) { - found = true; - lens = "Canon " + ldata; + if (ldata.size() > 1) { + found = true; + lens = "Canon " + ldata; + } + } else { + found = lens_from_make_and_model(); } } @@ -437,7 +478,14 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } } if (mnote->getTag ("LensType")) { - lens = mnote->getTag ("LensType")->valueToString (); + lens = mnote->getTag ("LensType")->valueToString(); + // If MakeNotes are vague, fall back to Exif LensMake and LensModel if set + // https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensType + if (lens == "M-42 or No Lens" || lens == "K or M Lens" || lens == "A Series Lens" || lens == "Sigma") { + lens_from_make_and_model(); + } + } else { + lens_from_make_and_model(); } // Try to get the FocalLength from the LensInfo structure, where length below 10mm will be correctly set @@ -459,6 +507,9 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } else if (mnote && (!make.compare (0, 4, "SONY") || !make.compare (0, 6, "KONICA"))) { if (mnote->getTag ("LensID")) { lens = mnote->getTag ("LensID")->valueToString (); + if (lens == "Unknown") { + lens_from_make_and_model(); + } } } else if (!make.compare (0, 7, "OLYMPUS")) { if (mnote->getTag ("Equipment")) { @@ -468,6 +519,9 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* lens = eq->getTag ("LensType")->valueToString (); } } + if (lens == "Unknown") { + lens_from_make_and_model(); + } } else if (mnote && !make.compare (0, 9, "Panasonic")) { if (mnote->getTag ("LensType")) { std::string panalens = mnote->getTag("LensType")->valueToString(); @@ -482,9 +536,7 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } } else if (exif->getTag ("DNGLensInfo")) { lens = exif->getTag ("DNGLensInfo")->valueToString (); - } else if (exif->getTag ("LensModel")) { - lens = exif->getTag ("LensModel")->valueToString (); - } else if (exif->getTag ("LensInfo")) { + } else if (!lens_from_make_and_model() && exif->getTag ("LensInfo")) { lens = exif->getTag ("LensInfo")->valueToString (); } } @@ -1243,35 +1295,31 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptrexifBase >= 0; rtexif::ExifManager exifManager (f, std::move(rml), firstFrameOnly); - - if (has_rml_exif_base) { - if (exifManager.f && exifManager.rml) { - if (exifManager.rml->exifBase >= 0) { - exifManager.parseRaw (); - - } else if (exifManager.rml->ciffBase >= 0) { - exifManager.parseCIFF (); - } - } - - // copying roots - roots = exifManager.roots; - - // creating FrameData - for (auto currFrame : exifManager.frames) { - frames.push_back(std::unique_ptr(new FrameData(currFrame, currFrame->getRoot(), roots.at(0)))); - } - for (auto currRoot : roots) { - rtexif::Tag* t = currRoot->getTag(0x83BB); - - if (t && !iptc) { - iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ()); - break; - } + if (exifManager.f && exifManager.rml) { + if (exifManager.rml->exifBase >= 0) { + exifManager.parseRaw (); + } else if (exifManager.rml->ciffBase >= 0) { + exifManager.parseCIFF (); } } + + // copying roots + roots = exifManager.roots; + + // creating FrameData + for (auto currFrame : exifManager.frames) { + frames.push_back(std::unique_ptr(new FrameData(currFrame, currFrame->getRoot(), roots.at(0)))); + } + for (auto currRoot : roots) { + rtexif::Tag* t = currRoot->getTag(0x83BB); + + if (t && !iptc) { + iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ()); + break; + } + } + fclose (f); } } else if (hasJpegExtension(fname)) { diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index d0f4df6d3..da2580988 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -313,6 +313,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } else { imgsrc->setBorder(std::max(params->raw.bayersensor.border, 2)); } + } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { + imgsrc->setBorder(params.raw.xtranssensor.border); } bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicAutoContrast : params->raw.xtranssensor.dualDemosaicAutoContrast; double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicContrast : params->raw.xtranssensor.dualDemosaicContrast; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 890e86c72..6d914bb27 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2609,6 +2609,7 @@ RAWParams::XTransSensor::XTransSensor() : method(getMethodString(Method::THREE_PASS)), dualDemosaicAutoContrast(true), dualDemosaicContrast(20), + border(7), ccSteps(0), blackred(0.0), blackgreen(0.0), @@ -2622,6 +2623,7 @@ bool RAWParams::XTransSensor::operator ==(const XTransSensor& other) const method == other.method && dualDemosaicAutoContrast == other.dualDemosaicAutoContrast && dualDemosaicContrast == other.dualDemosaicContrast + && border == other.border && ccSteps == other.ccSteps && blackred == other.blackred && blackgreen == other.blackgreen @@ -3552,6 +3554,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.dualDemosaicAutoContrast, "RAW X-Trans", "DualDemosaicAutoContrast", raw.xtranssensor.dualDemosaicAutoContrast, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.dualDemosaicContrast, "RAW X-Trans", "DualDemosaicContrast", raw.xtranssensor.dualDemosaicContrast, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.border, "RAW X-Trans", "Border", raw.xtranssensor.border, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.ccSteps, "RAW X-Trans", "CcSteps", raw.xtranssensor.ccSteps, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackRed, "RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen, keyFile); @@ -5099,6 +5102,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } } assignFromKeyfile(keyFile, "RAW X-Trans", "DualDemosaicContrast", pedited, raw.xtranssensor.dualDemosaicContrast, pedited->raw.xtranssensor.dualDemosaicContrast); + assignFromKeyfile(keyFile, "RAW X-Trans", "Border", pedited, raw.xtranssensor.border, pedited->raw.xtranssensor.border); assignFromKeyfile(keyFile, "RAW X-Trans", "CcSteps", pedited, raw.xtranssensor.ccSteps, pedited->raw.xtranssensor.ccSteps); assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackRed", pedited, raw.xtranssensor.blackred, pedited->raw.xtranssensor.exBlackRed); assignFromKeyfile(keyFile, "RAW X-Trans", "PreBlackGreen", pedited, raw.xtranssensor.blackgreen, pedited->raw.xtranssensor.exBlackGreen); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 26670c65a..0982fda48 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1444,6 +1444,7 @@ struct RAWParams { Glib::ustring method; bool dualDemosaicAutoContrast; double dualDemosaicContrast; + int border; int ccSteps; double blackred; double blackgreen; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 8dfaf9b25..7b8cb7d5c 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -166,6 +166,8 @@ private: } else { imgsrc->setBorder(std::max(params.raw.bayersensor.border, 2)); } + } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { + imgsrc->setBorder(params.raw.xtranssensor.border); } imgsrc->getFullSize (fw, fh, tr); diff --git a/rtengine/xtrans_demosaic.cc b/rtengine/xtrans_demosaic.cc index 26cd9071b..f32969d17 100644 --- a/rtengine/xtrans_demosaic.cc +++ b/rtengine/xtrans_demosaic.cc @@ -120,6 +120,11 @@ void RawImageSource::xtransborder_interpolate (int border, array2D &red, int xtrans[6][6]; ri->getXtransMatrix(xtrans); + const float weight[3][3] = { + {0.25f, 0.5f, 0.25f}, + {0.5f, 0.f, 0.5f}, + {0.25f, 0.5f, 0.25f} + }; for (int row = 0; row < height; row++) for (int col = 0; col < width; col++) { @@ -129,11 +134,11 @@ void RawImageSource::xtransborder_interpolate (int border, array2D &red, float sum[6] = {0.f}; - for (int y = MAX(0, row - 1); y <= MIN(row + 1, height - 1); y++) - for (int x = MAX(0, col - 1); x <= MIN(col + 1, width - 1); x++) { + for (int y = MAX(0, row - 1), v = row == 0 ? 0 : -1; y <= MIN(row + 1, height - 1); y++, v++) + for (int x = MAX(0, col - 1), h = col == 0 ? 0 : -1; x <= MIN(col + 1, width - 1); x++, h++) { int f = fcol(y, x); - sum[f] += rawData[y][x]; - sum[f + 3]++; + sum[f] += rawData[y][x] * weight[v + 1][h + 1]; + sum[f + 3] += weight[v + 1][h + 1]; } switch(fcol(row, col)) { @@ -197,12 +202,6 @@ void RawImageSource::xtrans_interpolate (const int passes, const bool useCieLab) const int height = H, width = W; -// if (settings->verbose) { -// printf("%d-pass X-Trans interpolation using %s conversion...\n", passes, useCieLab ? "lab" : "yuv"); -// } - - xtransborder_interpolate(6, red, green, blue); - float xyz_cam[3][3]; { float rgb_cam[3][4]; @@ -956,6 +955,7 @@ void RawImageSource::xtrans_interpolate (const int passes, const bool useCieLab) free(buffer); } + xtransborder_interpolate(8, red, green, blue); } #undef CLIP void RawImageSource::fast_xtrans_interpolate (const array2D &rawData, array2D &red, array2D &green, array2D &blue) diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index 7b30d9ae6..2dcbdd96f 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -32,7 +32,7 @@ namespace rtexif class CAOnOffInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int n = t->toInt(); @@ -51,7 +51,7 @@ class CAIntSerNumInterpreter : public Interpreter { public: CAIntSerNumInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { return ""; } @@ -63,7 +63,7 @@ class CAApertureInterpreter : public Interpreter { public: CAApertureInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = pow (2.0, t->toDouble() / 64.0); @@ -92,7 +92,7 @@ CAMacroModeInterpreter caMacroModeInterpreter; class CASelfTimerInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int sec = t->toInt (0, SHORT); @@ -385,7 +385,7 @@ CAExposureModeInterpreter caExposureModeInterpreter; class CAFlashBitsInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream s; unsigned bits = t->toInt (0, SHORT); @@ -533,7 +533,7 @@ CARAWQualityInterpreter caRAWQualityInterpreter; class CAFocalInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { Tag *unitTag = t->getParent()->getRoot()->findTag ("FocalUnits"); double v = unitTag ? unitTag->toDouble() : 1.; @@ -957,7 +957,7 @@ public: }; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int lensID = t->toInt(); @@ -1109,7 +1109,7 @@ CAFocalTypeInterpreter caFocalTypeInterpreter; class CAFocalPlaneInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int val = t->toInt(); @@ -1127,7 +1127,7 @@ CAFocalPlaneInterpreter caFocalPlaneInterpreter; class CAExposureTimeInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double d = pow (2, - t->toInt() / 32.0); @@ -1139,7 +1139,7 @@ CAExposureTimeInterpreter caExposureTimeInterpreter; class CAEVInterpreter : public Interpreter { - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%.1f", t->toDouble() / 32.0 ); @@ -1151,7 +1151,7 @@ CAEVInterpreter caEVInterpreter; class CABaseISOInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt(); @@ -1288,7 +1288,7 @@ CASlowShutterInterpreter caSlowShutterInterpreter; class CAFlashGuideNumberInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int n = t->toInt(); @@ -1349,7 +1349,7 @@ CAControModeInterpreter caControModeInterpreter; class CAFocusDistanceInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%.2f", t->toDouble() / 100 ); @@ -1361,7 +1361,7 @@ CAFocusDistanceInterpreter caFocusDistanceInterpreter; class CAMeasuredEVInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%.1f", t->toDouble() / 8 - 6 ); @@ -1496,7 +1496,7 @@ CAToningEffectInterpreter caToningEffectInterpreter; class CAFileNumberInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { unsigned long val = t->toInt (0, LONG); char buffer[32]; diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index 70246d6b2..a1fa28c34 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -34,7 +34,7 @@ class NAISOInterpreter : public Interpreter { public: NAISOInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->toInt (2)); @@ -47,7 +47,7 @@ class NAISOInfoISOInterpreter : public Interpreter { public: NAISOInfoISOInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt(); @@ -83,7 +83,7 @@ class NAISOExpansionInterpreter : public Interpreter { public: NAISOExpansionInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); @@ -142,7 +142,7 @@ class NALensTypeInterpreter : public Interpreter { public: NALensTypeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); std::ostringstream str; @@ -191,7 +191,7 @@ class NAShootingModeInterpreter : public Interpreter { public: NAShootingModeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); std::ostringstream str; @@ -234,14 +234,26 @@ public: afpchoices[0x9] = "Far Left"; afpchoices[0xa] = "Far Right"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { + const auto get_from_choices = + [](const std::map& choices, int index) -> std::string + { + const std::map::const_iterator choice = choices.find(index); + + if (choice != choices.end()) { + return choice->second; + } + + return {}; + }; + int am = t->toInt (0, BYTE); int afp = t->toInt (1, BYTE); int aff = t->toInt (2, SHORT); std::ostringstream str; - str << "AFAreaMode = " << amchoices[am] << std::endl; - str << "AFAreaMode = " << afpchoices[afp] << std::endl; + str << "AFAreaMode = " << get_from_choices(amchoices, am) << std::endl; + str << "AFAreaMode = " << get_from_choices(afpchoices, afp) << std::endl; std::ostringstream af; @@ -314,7 +326,7 @@ class NALensDataInterpreter : public Interpreter static const std::map lenses; public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { static const unsigned char xlat[2][256] = { diff --git a/rtexif/olympusattribs.cc b/rtexif/olympusattribs.cc index ccf28d0ca..e42763e35 100644 --- a/rtexif/olympusattribs.cc +++ b/rtexif/olympusattribs.cc @@ -33,7 +33,7 @@ class OLOnOffInterpreter : public Interpreter { public: OLOnOffInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { if (t->toInt() == 0) { return "Off"; @@ -48,7 +48,7 @@ class OLYesNoInterpreter : public Interpreter { public: OLYesNoInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { if (t->toInt() == 0) { return "No"; @@ -63,7 +63,7 @@ class OLApertureInterpreter : public Interpreter { public: OLApertureInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; str.precision (2); @@ -194,7 +194,7 @@ public: lenses["03 02 00"] = "Leica D Summilux 25mm f/1.4 Asph."; lenses["05 01 10"] = "Tamron 14-150mm f/3.5-5.8 Di III"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream lid; lid.setf (std::ios_base::hex, std::ios_base::basefield); @@ -203,7 +203,7 @@ public: lid << std::setw (2) << std::setfill ('0') << t->toInt (2) << ' '; //model lid << std::setw (2) << std::setfill ('0') << t->toInt (3); // submodel - std::map::iterator r = lenses.find (lid.str()); + std::map::const_iterator r = lenses.find (lid.str()); if (r != lenses.end()) { return r->second; @@ -465,7 +465,7 @@ class OLNoiseFilterInterpreter : public Interpreter { public: OLNoiseFilterInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0); int b = t->toInt (2); @@ -490,7 +490,7 @@ class OLFlashModeInterpreter : public Interpreter { public: OLFlashModeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int a = t->toInt (); @@ -509,7 +509,7 @@ class OLNoiseReductionInterpreter : public Interpreter { public: OLNoiseReductionInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int a = t->toInt (); diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 971f07ce1..7e861d64f 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -415,7 +415,7 @@ class PAFNumberInterpreter: public Interpreter { public: PAFNumberInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble() / 10; @@ -610,7 +610,7 @@ public: choices[256 * 255 + 0] = "Video (Auto Aperture)"; choices[256 * 255 + 4] = "Video (4)"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int c = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE); const ChoicesIterator r = choices.find (c); @@ -669,12 +669,12 @@ public: choices3[224] = "HDR Auto"; choices3[255] = "Video"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); - std::map::iterator r1 = choices1.find (t->toInt (1, BYTE)); - std::map::iterator r2 = choices2.find (t->toInt (2, BYTE)); - std::map::iterator r3 = choices3.find (t->toInt (3, BYTE)); + std::map::const_iterator r1 = choices1.find (t->toInt (1, BYTE)); + std::map::const_iterator r2 = choices2.find (t->toInt (2, BYTE)); + std::map::const_iterator r3 = choices3.find (t->toInt (3, BYTE)); std::ostringstream s; s << ((r != choices.end()) ? r->second : ""); s << ((r1 != choices1.end()) ? r1->second : "") << " "; @@ -993,7 +993,7 @@ public: choices.insert (p_t (256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1")); choices.insert (p_t (256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8")); } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double *liArray = nullptr; double maxApertureAtFocal = 0.; @@ -1061,7 +1061,7 @@ class PASRResultInterpreter: public Interpreter { public: PASRResultInterpreter() { } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int b = t->toInt (0, BYTE); @@ -1146,7 +1146,7 @@ public: choices[ 2 << 8 | 4 ] = "Auto"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int idx = 0; @@ -1173,7 +1173,7 @@ public: choices[2] = "Standard"; choices[3] = "Fast"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); std::ostringstream s; @@ -1211,7 +1211,7 @@ public: choices[2] = "Medium"; choices[3] = "High"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); std::ostringstream s; @@ -1243,11 +1243,11 @@ public: choices2[8] = "2 EV"; choices2[12] = "3 EV"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); - std::map::iterator r1 = choices1.find (t->toInt (1, BYTE)); - std::map::iterator r2 = choices2.find (t->toInt (2, BYTE)); + std::map::const_iterator r1 = choices1.find (t->toInt (1, BYTE)); + std::map::const_iterator r2 = choices2.find (t->toInt (2, BYTE)); std::ostringstream s; s << ((r != choices.end() ) ? r->second : "") << std::endl; s << ((r1 != choices1.end()) ? r1->second : "") << std::endl; @@ -1290,7 +1290,7 @@ class PALensModelQInterpreter: public Interpreter { public: PALensModelQInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[31]; buffer[0] = 0; // @@ -1308,7 +1308,7 @@ class PALensInfoQInterpreter: public Interpreter { public: PALensInfoQInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[21]; buffer[0] = 0; @@ -1326,7 +1326,7 @@ class PAFlashExposureCompInterpreter: public Interpreter { public: PAFlashExposureCompInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a; @@ -1359,7 +1359,7 @@ class PAFocalLengthInterpreter: public Interpreter { public: PAFocalLengthInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = double (t->toInt (0, LONG)); @@ -1388,7 +1388,7 @@ class PALensDataFocalLengthInterpreter: public Interpreter { public: PALensDataFocalLengthInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); @@ -1419,7 +1419,7 @@ class PAISOfInterpreter: public Interpreter { public: PAISOfInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1439,7 +1439,7 @@ class PAMaxApertureInterpreter: public Interpreter { public: PAMaxApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); a &= 0x7F; @@ -1476,7 +1476,7 @@ class PAAEXvInterpreter: public Interpreter { public: PAAEXvInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1496,7 +1496,7 @@ class PAAEBXvInterpreter: public Interpreter { public: PAAEBXvInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, SBYTE); char buffer[32]; @@ -1516,7 +1516,7 @@ class PAApertureInterpreter: public Interpreter { public: PAApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1536,7 +1536,7 @@ class PAExposureTimeInterpreter: public Interpreter { public: PAExposureTimeInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1556,7 +1556,7 @@ class PANominalMinApertureInterpreter: public Interpreter { public: PANominalMinApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt (0, BYTE); @@ -1576,7 +1576,7 @@ class PANominalMaxApertureInterpreter: public Interpreter { public: PANominalMaxApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt (0, BYTE); @@ -1694,7 +1694,7 @@ class PAExternalFlashGNInterpreter: public Interpreter { public: PAExternalFlashGNInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int b = t->toInt (0, BYTE) & 0x1F; @@ -1708,7 +1708,7 @@ class PAEVStepsInterpreter: public Interpreter { public: PAEVStepsInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; @@ -1727,7 +1727,7 @@ class PAEDialinInterpreter: public Interpreter { public: PAEDialinInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; @@ -1746,7 +1746,7 @@ class PAApertureRingUseInterpreter: public Interpreter { public: PAApertureRingUseInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; @@ -1776,7 +1776,7 @@ public: choices[9] = "Slow-sync, Red-eye reduction"; choices[10] = "Trailing-curtain Sync"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE) >> 4); @@ -1795,7 +1795,7 @@ class PAMeteringMode2Interpreter: public Interpreter { public: PAMeteringMode2Interpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int v = (t->toInt (0, BYTE) & 0xF); @@ -1859,7 +1859,7 @@ class PAProgramLineInterpreter: public Interpreter { public: PAProgramLineInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int c = t->toInt (0, BYTE); @@ -1899,7 +1899,7 @@ class PAAFModeInterpreter: public Interpreter { public: PAAFModeInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { switch (t->toInt (0, BYTE) & 0x3) { case 0: @@ -1925,7 +1925,7 @@ class PAAFPointSelectedInterpreter: public Interpreter { public: PAAFPointSelectedInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int c = t->toInt (0, SHORT); @@ -1949,7 +1949,7 @@ class PADriveMode2Interpreter: public Interpreter { public: PADriveMode2Interpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int c = t->toInt (0, BYTE); diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 33fc84106..571fd4e6b 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1769,7 +1769,7 @@ std::string Tag::nameToString (int i) return buffer; } -std::string Tag::valueToString () +std::string Tag::valueToString () const { if (attrib && attrib->interpreter) { @@ -2118,6 +2118,7 @@ void ExifManager::parseCIFF () } parseCIFF (rml->ciffLength, root); root->sort (); + parse(true); } Tag* ExifManager::saveCIFFMNTag (TagDirectory* root, int len, const char* name) @@ -3441,7 +3442,7 @@ short int int2_to_signed (short unsigned int i) * -mm f/- * NB: no space between separator '-'; no space between focal length and 'mm' */ -bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) +bool extractLensInfo (const std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) { minFocal = 0.0; maxFocal = 0.0; diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 5df0bae2d..43b296746 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -67,7 +67,7 @@ const enum ByteOrder HOSTORDER = MOTOROLA; #endif enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI, TABLESUBDIR}; -bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); +bool extractLensInfo (const std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); unsigned short sget2 (unsigned char *s, ByteOrder order); int sget4 (unsigned char *s, ByteOrder order); @@ -302,7 +302,7 @@ public: int getDistanceFrom (const TagDirectory *root); // additional getter/setter for more comfortable use - std::string valueToString (); + std::string valueToString () const; std::string nameToString (int i = 0); void valueFromString (const std::string& value); void userCommentFromString (const Glib::ustring& text); @@ -381,7 +381,7 @@ class Interpreter public: Interpreter () {} virtual ~Interpreter() {}; - virtual std::string toString (Tag* t) + virtual std::string toString (const Tag* t) const { char buffer[1024]; t->toString (buffer); @@ -502,7 +502,7 @@ protected: Choices choices; public: ChoiceInterpreter () {}; - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const typename std::map::const_iterator r = choices.find(t->toInt()); @@ -521,11 +521,11 @@ class IntLensInterpreter : public Interpreter { protected: typedef std::multimap< T, std::string> container_t; - typedef typename std::multimap< T, std::string>::iterator it_t; + typedef typename std::multimap< T, std::string>::const_iterator it_t; typedef std::pair< T, std::string> p_t; container_t choices; - virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) + virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) const { it_t r; size_t nFound = choices.count ( lensID ); diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index c8bbeb91d..0c6e433ff 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -1158,7 +1158,7 @@ public: }; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int lensID = t->toInt(); Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); @@ -1309,7 +1309,7 @@ public: choices.insert (p_t (51507, "Samyang AF 35mm f/1.4")); } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int lensID = t->toInt(); Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); @@ -2103,7 +2103,7 @@ class SAExposureTimeInterpreter : public Interpreter { public: SAExposureTimeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = t->toDouble(); @@ -2163,7 +2163,7 @@ class SAFNumberInterpreter : public Interpreter { public: SAFNumberInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = double (t->toDouble()); @@ -2223,7 +2223,7 @@ class SAISOSettingInterpreter : public Interpreter { public: SAISOSettingInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); @@ -2264,7 +2264,7 @@ class SAExposureCompSetInterpreter : public Interpreter { public: SAExposureCompSetInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = t->toDouble(); char buffer[32]; @@ -2285,7 +2285,7 @@ class SAAFMicroAdjValueInterpreter : public Interpreter { public: SAAFMicroAdjValueInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->getValue()[0] - 20); @@ -2302,7 +2302,7 @@ class SAAFMicroAdjModeInterpreter : public Interpreter { public: SAAFMicroAdjModeInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->getValue()[0] & 0x80; @@ -2324,7 +2324,7 @@ class SAAFMicroAdjRegisteredLensesInterpreter : public Interpreter { public: SAAFMicroAdjRegisteredLensesInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->getValue()[0] & 0x7f); @@ -2341,7 +2341,7 @@ class SAFocusStatusInterpreter : public Interpreter { public: SAFocusStatusInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::string retval; int a = t->toInt(); @@ -2380,7 +2380,7 @@ class SAColorTemperatureSettingInterpreter : public Interpreter { public: SAColorTemperatureSettingInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->toInt()); diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index aa8ed2b97..ec5534381 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -327,7 +327,7 @@ class FNumberInterpreter : public Interpreter { public: FNumberInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble(); @@ -346,7 +346,7 @@ class ApertureInterpreter : public Interpreter { public: ApertureInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = pow (2.0, t->toDouble() / 2.0); @@ -365,7 +365,7 @@ class ExposureBiasInterpreter : public Interpreter { public: ExposureBiasInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble(); @@ -384,7 +384,7 @@ class ShutterSpeedInterpreter : public Interpreter { public: ShutterSpeedInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double d = pow (2.0, -t->toDouble()); @@ -404,7 +404,7 @@ class ExposureTimeInterpreter : public Interpreter { public: ExposureTimeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double d = t->toDouble(); @@ -424,7 +424,7 @@ class FocalLengthInterpreter : public Interpreter { public: FocalLengthInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble(); @@ -443,7 +443,7 @@ class UserCommentInterpreter : public Interpreter { public: UserCommentInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int count = t->getCount(); @@ -575,7 +575,7 @@ class CFAInterpreter : public Interpreter { public: CFAInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char colors[] = "RGB"; char buffer[1024]; @@ -632,7 +632,7 @@ UTF8BinInterpreter utf8BinInterpreter; class RawImageSegmentationInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int segmentNumber = t->toInt(0, SHORT); int segmentWidth = t->toInt(2, SHORT); diff --git a/rtgui/options.cc b/rtgui/options.cc index fe3b9bf1a..5edac94f7 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -564,7 +564,7 @@ void Options::setDefaults() rtSettings.adobe = "RTv2_Medium"; // put the name of yours profiles (here windows) rtSettings.prophoto = "RTv2_Large"; // these names appear in the menu "output profile" rtSettings.widegamut = "RTv2_Wide"; - rtSettings.srgb = "RTv2_sRGB"; + rtSettings.srgb = "RTv4_sRGB"; rtSettings.bruce = "RTv2_Bruce"; rtSettings.beta = "RTv2_Beta"; rtSettings.best = "RTv2_Best"; @@ -1485,8 +1485,8 @@ void Options::readFromFile(Glib::ustring fname) if (keyFile.has_key("Color Management", "sRGB")) { rtSettings.srgb = keyFile.get_string("Color Management", "sRGB"); - if (rtSettings.srgb == "RT_sRGB" || rtSettings.srgb == "RTv4_sRGB") { - rtSettings.srgb = "RTv2_sRGB"; + if (rtSettings.srgb == "RT_sRGB" || rtSettings.srgb == "RTv2_sRGB") { + rtSettings.srgb = "RTv4_sRGB"; } } diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index b93b3123b..2c29b4f5b 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -436,6 +436,7 @@ void ParamsEdited::set(bool v) raw.xtranssensor.method = v; raw.xtranssensor.dualDemosaicAutoContrast = v; raw.xtranssensor.dualDemosaicContrast = v; + raw.xtranssensor.border = v; raw.xtranssensor.ccSteps = v; raw.xtranssensor.exBlackRed = v; raw.xtranssensor.exBlackGreen = v; @@ -1002,6 +1003,7 @@ void ParamsEdited::initFrom(const std::vector& raw.xtranssensor.method = raw.xtranssensor.method && p.raw.xtranssensor.method == other.raw.xtranssensor.method; raw.xtranssensor.dualDemosaicAutoContrast = raw.xtranssensor.dualDemosaicAutoContrast && p.raw.xtranssensor.dualDemosaicAutoContrast == other.raw.xtranssensor.dualDemosaicAutoContrast; raw.xtranssensor.dualDemosaicContrast = raw.xtranssensor.dualDemosaicContrast && p.raw.xtranssensor.dualDemosaicContrast == other.raw.xtranssensor.dualDemosaicContrast; + raw.xtranssensor.border = raw.xtranssensor.border && p.raw.xtranssensor.border == other.raw.xtranssensor.border; raw.xtranssensor.ccSteps = raw.xtranssensor.ccSteps && p.raw.xtranssensor.ccSteps == other.raw.xtranssensor.ccSteps; raw.xtranssensor.exBlackRed = raw.xtranssensor.exBlackRed && p.raw.xtranssensor.blackred == other.raw.xtranssensor.blackred; raw.xtranssensor.exBlackGreen = raw.xtranssensor.exBlackGreen && p.raw.xtranssensor.blackgreen == other.raw.xtranssensor.blackgreen; @@ -2660,6 +2662,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.raw.xtranssensor.ccSteps = mods.raw.xtranssensor.ccSteps; } + if (raw.xtranssensor.border) { + toEdit.raw.xtranssensor.border = mods.raw.xtranssensor.border; + } + if (raw.xtranssensor.exBlackRed) { toEdit.raw.xtranssensor.blackred = dontforceSet && options.baBehav[ADDSET_RAWEXPOS_BLACKS] ? toEdit.raw.xtranssensor.blackred + mods.raw.xtranssensor.blackred : mods.raw.xtranssensor.blackred; } @@ -3192,7 +3198,7 @@ bool RAWParamsEdited::BayerSensor::isUnchanged() const bool RAWParamsEdited::XTransSensor::isUnchanged() const { - return method && exBlackRed && exBlackGreen && exBlackBlue && dualDemosaicAutoContrast && dualDemosaicContrast; + return method && border && exBlackRed && exBlackGreen && exBlackBlue && dualDemosaicAutoContrast && dualDemosaicContrast; } bool RAWParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 49052cbdf..95701e01a 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -628,6 +628,7 @@ struct RAWParamsEdited { bool method; bool dualDemosaicAutoContrast; bool dualDemosaicContrast; + bool border; bool ccSteps; bool exBlackRed; bool exBlackGreen; diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 1f3ef8b77..734f7c29b 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -841,6 +841,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param if (!raw_border->get_active ()) { filterPE.raw.bayersensor.border = falsePE.raw.bayersensor.border; + filterPE.raw.xtranssensor.border = falsePE.raw.xtranssensor.border; } if (!raw_imagenum->get_active ()) { diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index 866df06e4..e98394735 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -30,6 +30,7 @@ using namespace rtengine::procparams; XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP_RAW_LABEL"), true) { auto m = ProcEventMapper::getInstance(); + EvDemosaicBorder = m->newEvent(DEMOSAIC, "HISTORY_MSG_RAW_BORDER"); EvDemosaicContrast = m->newEvent(DEMOSAIC, "HISTORY_MSG_DUALDEMOSAIC_CONTRAST"); EvDemosaicAutoContrast = m->newEvent(DEMOSAIC, "HISTORY_MSG_DUALDEMOSAIC_AUTO_CONTRAST"); @@ -86,6 +87,18 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP dualDemosaicOptions->pack_start(*dualDemosaicContrast); pack_start( *dualDemosaicOptions, Gtk::PACK_SHRINK, 4); + borderbox = Gtk::manage(new Gtk::HBox()); + border = Gtk::manage(new Adjuster(M("TP_RAW_BORDER"), 0, 16, 1, 7)); + border->setAdjusterListener (this); + + if (border->delay < options.adjusterMaxDelay) { + border->delay = options.adjusterMaxDelay; + } + + border->show(); + borderbox->pack_start(*border); + pack_start(*borderbox, Gtk::PACK_SHRINK, 4); + pack_start( *Gtk::manage( new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0 ); ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"), 0, 5, 1, 0 )); ccSteps->setAdjusterListener (this); @@ -109,6 +122,7 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param disableListener (); methodconn.block (true); + border->setValue(pp->raw.xtranssensor.border); for (size_t i = 0; i < RAWParams::XTransSensor::getMethodStrings().size(); ++i) if( pp->raw.xtranssensor.method == RAWParams::XTransSensor::getMethodStrings()[i]) { method->set_active(i); @@ -117,6 +131,7 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param } if(pedited ) { + border->setEditedState (pedited->raw.xtranssensor.border ? Edited : UnEdited); dualDemosaicContrast->setAutoInconsistent (multiImage && !pedited->raw.xtranssensor.dualDemosaicAutoContrast); dualDemosaicContrast->setEditedState ( pedited->raw.xtranssensor.dualDemosaicContrast ? Edited : UnEdited); ccSteps->setEditedState (pedited->raw.xtranssensor.ccSteps ? Edited : UnEdited); @@ -129,7 +144,7 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param dualDemosaicContrast->setValue (pp->raw.xtranssensor.dualDemosaicContrast); ccSteps->setValue (pp->raw.xtranssensor.ccSteps); - lastAutoContrast = pp->raw.bayersensor.dualDemosaicAutoContrast; + lastAutoContrast = pp->raw.xtranssensor.dualDemosaicAutoContrast; if (!batchMode) { dualDemosaicOptions->set_visible(pp->raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::FOUR_PASS) @@ -145,6 +160,7 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p { pp->raw.xtranssensor.dualDemosaicAutoContrast = dualDemosaicContrast->getAutoValue(); pp->raw.xtranssensor.dualDemosaicContrast = dualDemosaicContrast->getValue(); + pp->raw.xtranssensor.border = border->getIntValue(); pp->raw.xtranssensor.ccSteps = ccSteps->getIntValue(); int currentRow = method->get_active_row_number(); @@ -154,6 +170,7 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p } if (pedited) { + pedited->raw.xtranssensor.border = border->getEditedState (); pedited->raw.xtranssensor.method = method->get_active_text() != M("GENERAL_UNCHANGED"); pedited->raw.xtranssensor.dualDemosaicAutoContrast = !dualDemosaicContrast->getAutoInconsistent (); pedited->raw.xtranssensor.dualDemosaicContrast = dualDemosaicContrast->getEditedState (); @@ -163,6 +180,7 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p void XTransProcess::setAdjusterBehavior (bool falsecoloradd, bool dualDemosaicContrastAdd) { + border->setAddMode(false); dualDemosaicContrast->setAddMode(dualDemosaicContrastAdd); ccSteps->setAddMode(falsecoloradd); } @@ -173,19 +191,23 @@ void XTransProcess::setBatchMode(bool batchMode) method->set_active_text(M("GENERAL_UNCHANGED")); ToolPanel::setBatchMode (batchMode); dualDemosaicContrast->showEditedCB (); + border->showEditedCB (); ccSteps->showEditedCB (); } void XTransProcess::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) { dualDemosaicContrast->setDefault( defParams->raw.xtranssensor.dualDemosaicContrast); + border->setDefault (defParams->raw.xtranssensor.border); ccSteps->setDefault (defParams->raw.xtranssensor.ccSteps); if (pedited) { dualDemosaicContrast->setDefaultEditedState( pedited->raw.xtranssensor.dualDemosaicContrast ? Edited : UnEdited); + border->setDefaultEditedState(pedited->raw.xtranssensor.border ? Edited : UnEdited); ccSteps->setDefaultEditedState(pedited->raw.xtranssensor.ccSteps ? Edited : UnEdited); } else { dualDemosaicContrast->setDefaultEditedState(Irrelevant ); + border->setDefaultEditedState(Irrelevant); ccSteps->setDefaultEditedState(Irrelevant ); } } @@ -197,6 +219,8 @@ void XTransProcess::adjusterChanged(Adjuster* a, double newval) listener->panelChanged (EvDemosaicFalseColorIter, a->getTextValue() ); } else if (a == dualDemosaicContrast) { listener->panelChanged (EvDemosaicContrast, a->getTextValue() ); + } else if (a == border) { + listener->panelChanged (EvDemosaicBorder, a->getTextValue() ); } } } diff --git a/rtgui/xtransprocess.h b/rtgui/xtransprocess.h index cd60337dc..e5389b566 100644 --- a/rtgui/xtransprocess.h +++ b/rtgui/xtransprocess.h @@ -32,6 +32,8 @@ class XTransProcess : public ToolParamBlock, public AdjusterListener, public Che protected: MyComboBoxText* method; + Gtk::HBox* borderbox; + Adjuster* border; Adjuster* ccSteps; Gtk::VBox *dualDemosaicOptions; Adjuster* dualDemosaicContrast; @@ -40,6 +42,8 @@ protected: int oldSelection; sigc::connection methodconn; IdleRegister idle_register; + + rtengine::ProcEvent EvDemosaicBorder; rtengine::ProcEvent EvDemosaicAutoContrast; rtengine::ProcEvent EvDemosaicContrast;