Add initial metadata lens correction handling

This commit is contained in:
Simone Gotti 2024-06-13 09:51:08 +02:00
parent 5159de89cb
commit 2b97de233f
12 changed files with 222 additions and 39 deletions

View File

@ -2837,6 +2837,7 @@ TP_LENSGEOM_FILL;Auto-fill
TP_LENSGEOM_LABEL;Lens / Geometry TP_LENSGEOM_LABEL;Lens / Geometry
TP_LENSGEOM_LIN;Linear TP_LENSGEOM_LIN;Linear
TP_LENSGEOM_LOG;Logarithmic TP_LENSGEOM_LOG;Logarithmic
TP_LENSPROFILE_CORRECTION_METADATA;From file metadata
TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected TP_LENSPROFILE_CORRECTION_AUTOMATCH;Automatically selected
TP_LENSPROFILE_CORRECTION_LCPFILE;LCP file TP_LENSPROFILE_CORRECTION_LCPFILE;LCP file
TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected TP_LENSPROFILE_CORRECTION_MANUAL;Manually selected

View File

@ -148,6 +148,7 @@ set(RTENGINESOURCEFILES
jpeg_ijg/jpeg_memsrc.cc jpeg_ijg/jpeg_memsrc.cc
labimage.cc labimage.cc
lcp.cc lcp.cc
lensmetadata.cc
lmmse_demosaic.cc lmmse_demosaic.cc
loadinitial.cc loadinitial.cc
metadata.cc metadata.cc

View File

@ -1850,7 +1850,7 @@ bool check_need_larger_crop_for_lcp_distortion(int fw, int fh, int x, int y, int
return false; return false;
} }
return (params.lensProf.useDist && (params.lensProf.useLensfun() || params.lensProf.useLcp())); return (params.lensProf.useDist && (params.lensProf.useLensfun() || params.lensProf.useLcp() || params.lensProf.useMetadata()));
} }
} // namespace } // namespace

View File

@ -130,6 +130,7 @@ class ImProcFunctions
bool needsGradient() const; bool needsGradient() const;
bool needsVignetting() const; bool needsVignetting() const;
bool needsLCP() const; bool needsLCP() const;
bool needsMetadata() const;
bool needsLensfun() const; bool needsLensfun() const;
// static cmsUInt8Number* Mempro = NULL; // static cmsUInt8Number* Mempro = NULL;
@ -155,7 +156,7 @@ enum class BlurType {
~ImProcFunctions(); ~ImProcFunctions();
bool needsLuminanceOnly() const bool needsLuminanceOnly() const
{ {
return !(needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient()); return !(needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun() || needsMetadata()) && (needsVignetting() || needsPCVignetting() || needsGradient());
} }
void setScale(double iscale); void setScale(double iscale);

View File

@ -26,6 +26,7 @@
#include "rt_math.h" #include "rt_math.h"
#include "rtengine.h" #include "rtengine.h"
#include "rtlensfun.h" #include "rtlensfun.h"
#include "lensmetadata.h"
#include "sleef.h" #include "sleef.h"
using namespace std; using namespace std;
@ -659,7 +660,13 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed,
std::unique_ptr<const LensCorrection> pLCPMap; std::unique_ptr<const LensCorrection> pLCPMap;
if (needsLensfun()) { if (needsMetadata()) {
auto corr = MetadataLensCorrectionFinder::findCorrection(metadata);
if (corr) {
corr->initCorrections(oW, oH, params->coarse, rawRotationDeg);
pLCPMap = std::move(corr);
}
} else if (needsLensfun()) {
pLCPMap = LFDatabase::getInstance()->findModifier(params->lensProf, metadata, oW, oH, params->coarse, rawRotationDeg); pLCPMap = LFDatabase::getInstance()->findModifier(params->lensProf, metadata, oW, oH, params->coarse, rawRotationDeg);
} else if (needsLCP()) { // don't check focal length to allow distortion correction for lenses without chip } else if (needsLCP()) { // don't check focal length to allow distortion correction for lenses without chip
const std::shared_ptr<LCPProfile> pLCPProf = LCPStore::getInstance()->getProfile (params->lensProf.lcpFile); const std::shared_ptr<LCPProfile> pLCPProf = LCPStore::getInstance()->getProfile (params->lensProf.lcpFile);
@ -675,7 +682,7 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed,
} }
} }
if (! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient())) { if (! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsMetadata() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient())) {
transformLuminanceOnly (original, transformed, cx, cy, oW, oH, fW, fH); transformLuminanceOnly (original, transformed, cx, cy, oW, oH, fW, fH);
} else { } else {
bool highQuality; bool highQuality;
@ -1422,6 +1429,11 @@ bool ImProcFunctions::needsVignetting () const
return params->vignetting.amount; return params->vignetting.amount;
} }
bool ImProcFunctions::needsMetadata () const
{
return params->lensProf.useMetadata();
}
bool ImProcFunctions::needsLCP () const bool ImProcFunctions::needsLCP () const
{ {
return params->lensProf.useLcp(); return params->lensProf.useLcp();
@ -1439,7 +1451,7 @@ bool ImProcFunctions::needsTransform (int oW, int oH, int rawRotationDeg, const
std::unique_ptr<const LensCorrection> pLCPMap = LFDatabase::getInstance()->findModifier(params->lensProf, metadata, oW, oH, params->coarse, rawRotationDeg); std::unique_ptr<const LensCorrection> pLCPMap = LFDatabase::getInstance()->findModifier(params->lensProf, metadata, oW, oH, params->coarse, rawRotationDeg);
needsLf = pLCPMap.get(); needsLf = pLCPMap.get();
} }
return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsLf; return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsMetadata() || needsLf;
} }

42
rtengine/lensmetadata.cc Normal file
View File

@ -0,0 +1,42 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2024 Rawtherapee developers
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#include <array>
#include <iostream>
#include "lensmetadata.h"
namespace rtengine
{
std::unique_ptr<MetadataLensCorrection> MetadataLensCorrectionFinder::findCorrection(const FramesMetaData *meta)
{
static const std::unordered_set<std::string> makers = {};
std::string make = Glib::ustring(meta->getMake()).uppercase();
if (makers.find(make) == makers.end()) {
return nullptr;
}
std::unique_ptr<MetadataLensCorrection> correction;
return correction;
}
} // namespace rtengine

47
rtengine/lensmetadata.h Normal file
View File

@ -0,0 +1,47 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2024 Rawtherapee developers
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <memory>
#include "lcp.h"
#include "metadata.h"
#include "procparams.h"
#include "rtengine.h"
namespace rtengine
{
/* MetadataLensCorrection is an abstract class for various lens correction based on raw file metadata
this metadata is vendor dependent */
class MetadataLensCorrection : public LensCorrection,
public NonCopyable
{
public:
virtual void initCorrections(int width, int height, const procparams::CoarseTransformParams &coarse, int rawRotationDeg) = 0;
};
/* MetadataLensCorrectionFinder tries to find and return MetadataLensCorrection for the provided metadata */
class MetadataLensCorrectionFinder
{
public:
static std::unique_ptr<MetadataLensCorrection> findCorrection(const FramesMetaData *meta);
};
} // namespace rtengine

View File

@ -2064,13 +2064,19 @@ bool LensProfParams::lfManual() const
return lcMode == LcMode::LENSFUNMANUAL; return lcMode == LcMode::LENSFUNMANUAL;
} }
bool LensProfParams::useMetadata() const
{
return lcMode == LcMode::METADATA;
}
const std::vector<const char*>& LensProfParams::getMethodStrings() const const std::vector<const char*>& LensProfParams::getMethodStrings() const
{ {
static const std::vector<const char*> method_strings = { static const std::vector<const char*> method_strings = {
"none", "none",
"lfauto", "lfauto",
"lfmanual", "lfmanual",
"lcp" "lcp",
"metadata"
}; };
return method_strings; return method_strings;
} }

View File

@ -966,7 +966,8 @@ struct LensProfParams {
NONE, // No lens correction NONE, // No lens correction
LENSFUNAUTOMATCH, // Lens correction using auto matched lensfun database entry LENSFUNAUTOMATCH, // Lens correction using auto matched lensfun database entry
LENSFUNMANUAL, // Lens correction using manually selected lensfun database entry LENSFUNMANUAL, // Lens correction using manually selected lensfun database entry
LCP // Lens correction using lcp file LCP, // Lens correction using lcp file
METADATA // Lens correction using embedded metadata
}; };
LcMode lcMode; LcMode lcMode;
@ -985,6 +986,7 @@ struct LensProfParams {
bool lfAutoMatch() const; bool lfAutoMatch() const;
bool useLcp() const; bool useLcp() const;
bool lfManual() const; bool lfManual() const;
bool useMetadata() const;
const std::vector<const char*>& getMethodStrings() const; const std::vector<const char*>& getMethodStrings() const;
Glib::ustring getMethodString(LcMode mode) const; Glib::ustring getMethodString(LcMode mode) const;

View File

@ -44,6 +44,7 @@
#include "rt_math.h" #include "rt_math.h"
#include "rtengine.h" #include "rtengine.h"
#include "rtlensfun.h" #include "rtlensfun.h"
#include "lensmetadata.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
#define BENCHMARK #define BENCHMARK
@ -1583,7 +1584,13 @@ void RawImageSource::preprocess(const RAWParams &raw, const LensProfParams &lens
if (!hasFlatField && lensProf.useVign && lensProf.lcMode != LensProfParams::LcMode::NONE) { if (!hasFlatField && lensProf.useVign && lensProf.lcMode != LensProfParams::LcMode::NONE) {
std::unique_ptr<LensCorrection> pmap; std::unique_ptr<LensCorrection> pmap;
if (lensProf.useLensfun()) { if (lensProf.useMetadata()) {
auto corr = MetadataLensCorrectionFinder::findCorrection(idata);
if (corr) {
corr->initCorrections(W, H, coarse, -1);
pmap = std::move(corr);
}
} else if (lensProf.useLensfun()) {
pmap = LFDatabase::getInstance()->findModifier(lensProf, idata, W, H, coarse, -1); pmap = LFDatabase::getInstance()->findModifier(lensProf, idata, W, H, coarse, -1);
} else { } else {
const std::shared_ptr<LCPProfile> pLCPProf = LCPStore::getInstance()->getProfile(lensProf.lcpFile); const std::shared_ptr<LCPProfile> pLCPProf = LCPStore::getInstance()->getProfile(lensProf.lcpFile);

View File

@ -32,6 +32,7 @@
#include "../rtengine/lcp.h" #include "../rtengine/lcp.h"
#include "../rtengine/procparams.h" #include "../rtengine/procparams.h"
#include "../rtengine/rtlensfun.h" #include "../rtengine/rtlensfun.h"
#include "../rtengine/lensmetadata.h"
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
@ -56,6 +57,7 @@ LensProfilePanel::LensProfilePanel() :
distGrid(Gtk::manage((new Gtk::Grid()))), distGrid(Gtk::manage((new Gtk::Grid()))),
corrUnchangedRB(Gtk::manage((new Gtk::RadioButton(M("GENERAL_UNCHANGED"))))), corrUnchangedRB(Gtk::manage((new Gtk::RadioButton(M("GENERAL_UNCHANGED"))))),
corrOffRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("GENERAL_NONE"))))), corrOffRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("GENERAL_NONE"))))),
corrMetadata(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_METADATA"))))),
corrLensfunAutoRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_AUTOMATCH"))))), corrLensfunAutoRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_AUTOMATCH"))))),
corrLensfunManualRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_MANUAL"))))), corrLensfunManualRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_MANUAL"))))),
corrLcpFileRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_LCPFILE"))))), corrLcpFileRB(Gtk::manage((new Gtk::RadioButton(corrGroup, M("TP_LENSPROFILE_CORRECTION_LCPFILE"))))),
@ -144,17 +146,18 @@ LensProfilePanel::LensProfilePanel() :
// Populate modes grid: // Populate modes grid:
modesGrid->attach(*corrOffRB, 0, 0, 3, 1); modesGrid->attach(*corrOffRB, 0, 0, 3, 1);
modesGrid->attach(*corrLensfunAutoRB, 0, 1, 3, 1); modesGrid->attach(*corrMetadata, 0, 1, 3, 1);
modesGrid->attach(*corrLensfunManualRB, 0, 2, 3, 1); modesGrid->attach(*corrLensfunAutoRB, 0, 2, 3, 1);
modesGrid->attach(*corrLensfunManualRB, 0, 3, 3, 1);
modesGrid->attach(*lensfunCamerasLbl, 0, 3, 1, 1); modesGrid->attach(*lensfunCamerasLbl, 0, 4, 1, 1);
modesGrid->attach(*lensfunCameras, 1, 3, 1, 1); modesGrid->attach(*lensfunCameras, 1, 4, 1, 1);
modesGrid->attach(*lensfunLensesLbl, 0, 4, 1, 1); modesGrid->attach(*lensfunLensesLbl, 0, 5, 1, 1);
modesGrid->attach(*lensfunLenses, 1, 4, 1, 1); modesGrid->attach(*lensfunLenses, 1, 5, 1, 1);
modesGrid->attach(*warning, 2, 3, 1, 2); modesGrid->attach(*warning, 2, 4, 1, 2);
modesGrid->attach(*corrLcpFileRB, 0, 5, 1, 1); modesGrid->attach(*corrLcpFileRB, 0, 6, 1, 1);
modesGrid->attach(*corrLcpFileChooser, 1, 5, 1, 1); modesGrid->attach(*corrLcpFileChooser, 1, 6, 1, 1);
// Populate distortions grid: // Populate distortions grid:
@ -179,6 +182,7 @@ LensProfilePanel::LensProfilePanel() :
lensfunCameras->signal_changed().connect(sigc::mem_fun(*this, &LensProfilePanel::onLensfunCameraChanged)); lensfunCameras->signal_changed().connect(sigc::mem_fun(*this, &LensProfilePanel::onLensfunCameraChanged));
lensfunLenses->signal_changed().connect(sigc::mem_fun(*this, &LensProfilePanel::onLensfunLensChanged)); lensfunLenses->signal_changed().connect(sigc::mem_fun(*this, &LensProfilePanel::onLensfunLensChanged));
corrOffRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrOffRB)); corrOffRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrOffRB));
corrMetadata->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrMetadata));
corrLensfunAutoRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrLensfunAutoRB)); corrLensfunAutoRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrLensfunAutoRB));
corrLensfunManualRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrLensfunManualRB)); corrLensfunManualRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrLensfunManualRB));
corrLcpFileRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrLcpFileRB)); corrLcpFileRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrLcpFileRB));
@ -211,30 +215,52 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
break; break;
} }
case procparams::LensProfParams::LcMode::METADATA: {
if (metadata) {
auto metadataCorrection= rtengine::MetadataLensCorrectionFinder::findCorrection(metadata);
if (metadataCorrection) {
corrMetadata->set_active(true);
corrMetadata->set_sensitive(true);
} else {
corrMetadata->set_sensitive(false);
corrOffRB->set_active(true);
}
} else {
corrMetadata->set_sensitive(false);
}
break;
}
case procparams::LensProfParams::LcMode::NONE: { case procparams::LensProfParams::LcMode::NONE: {
corrOffRB->set_active(true); corrOffRB->set_active(true);
setManualParamsVisibility(false); setManualParamsVisibility(false);
ckbUseDist->set_sensitive(false);
ckbUseVign->set_sensitive(false);
ckbUseCA->set_sensitive(false);
break; break;
} }
} }
if (pp->lensProf.lcpFile.empty()) { if (pp->lensProf.lcMode == procparams::LensProfParams::LcMode::LCP) {
const Glib::ustring lastFolder = corrLcpFileChooser->get_current_folder(); if (pp->lensProf.lcpFile.empty()) {
corrLcpFileChooser->set_current_folder(lastFolder); const Glib::ustring lastFolder = corrLcpFileChooser->get_current_folder();
corrLcpFileChooser->unselect_all(); corrLcpFileChooser->set_current_folder(lastFolder);
bindCurrentFolder(*corrLcpFileChooser, options.lastLensProfileDir); corrLcpFileChooser->unselect_all();
updateDisabled(false); bindCurrentFolder(*corrLcpFileChooser, options.lastLensProfileDir);
} updateLCPDisabled(false);
else if (LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) { }
corrLcpFileChooser->set_filename(pp->lensProf.lcpFile); else if (LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) {
corrLcpFileChooser->set_filename(pp->lensProf.lcpFile);
if (corrLcpFileRB->get_active()) {
updateDisabled(true); if (corrLcpFileRB->get_active()) {
updateLCPDisabled(true);
}
}
else {
corrLcpFileChooser->unselect_filename(corrLcpFileChooser->get_filename());
updateLCPDisabled(false);
} }
}
else {
corrLcpFileChooser->unselect_filename(corrLcpFileChooser->get_filename());
updateDisabled(false);
} }
const LFDatabase* const db = LFDatabase::getInstance(); const LFDatabase* const db = LFDatabase::getInstance();
@ -308,6 +334,9 @@ void LensProfilePanel::write(rtengine::procparams::ProcParams* pp, ParamsEdited*
if (corrLcpFileRB->get_active()) { if (corrLcpFileRB->get_active()) {
pp->lensProf.lcMode = procparams::LensProfParams::LcMode::LCP; pp->lensProf.lcMode = procparams::LensProfParams::LcMode::LCP;
} }
else if (corrMetadata->get_active()) {
pp->lensProf.lcMode = procparams::LensProfParams::LcMode::METADATA;
}
else if (corrLensfunManualRB->get_active()) { else if (corrLensfunManualRB->get_active()) {
pp->lensProf.lcMode = procparams::LensProfParams::LcMode::LENSFUNMANUAL; pp->lensProf.lcMode = procparams::LensProfParams::LcMode::LENSFUNMANUAL;
} }
@ -367,12 +396,18 @@ void LensProfilePanel::setRawMeta(bool raw, const rtengine::FramesMetaData* pMet
// CA is very focus layer dependent, otherwise it might even worsen things // CA is very focus layer dependent, otherwise it might even worsen things
allowFocusDep = false; allowFocusDep = false;
ckbUseCA->set_active(false);
ckbUseCA->set_sensitive(false);
enableListener(); enableListener();
} }
corrMetadata->set_sensitive(false);
if (pMeta) {
metadataCorrection = MetadataLensCorrectionFinder::findCorrection(pMeta);
if (metadataCorrection) {
corrMetadata->set_sensitive(true);
}
}
isRaw = raw; isRaw = raw;
metadata = pMeta; metadata = pMeta;
} }
@ -381,7 +416,7 @@ void LensProfilePanel::onLCPFileChanged()
{ {
lcpFileChanged = true; lcpFileChanged = true;
const bool valid = LCPStore::getInstance()->isValidLCPFileName(corrLcpFileChooser->get_filename()); const bool valid = LCPStore::getInstance()->isValidLCPFileName(corrLcpFileChooser->get_filename());
updateDisabled(valid); updateLCPDisabled(valid);
if (listener) { if (listener) {
if (valid) { if (valid) {
@ -552,10 +587,20 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged)
lensfunAutoChanged = true; lensfunAutoChanged = true;
lcpFileChanged = true; lcpFileChanged = true;
updateDisabled(true); updateLCPDisabled(true);
mode = M("TP_LENSPROFILE_CORRECTION_LCPFILE"); mode = M("TP_LENSPROFILE_CORRECTION_LCPFILE");
} else if (rbChanged == corrMetadata) {
lcModeChanged = true;
useLensfunChanged = true;
lensfunAutoChanged = true;
lcpFileChanged = true;
updateMetadataDisabled();
mode = M("TP_LENSPROFILE_CORRECTION_METADATA");
} else if (rbChanged == corrUnchangedRB) { } else if (rbChanged == corrUnchangedRB) {
lcModeChanged = false; lcModeChanged = false;
useLensfunChanged = false; useLensfunChanged = false;
@ -680,7 +725,7 @@ void LensProfilePanel::LFDbHelper::fillLensfunLenses()
} }
} }
void LensProfilePanel::updateDisabled(bool enable) void LensProfilePanel::updateLCPDisabled(bool enable)
{ {
if (!batchMode) { if (!batchMode) {
ckbUseDist->set_sensitive(enable); ckbUseDist->set_sensitive(enable);
@ -689,6 +734,21 @@ void LensProfilePanel::updateDisabled(bool enable)
} }
} }
void LensProfilePanel::updateMetadataDisabled()
{
if (!batchMode) {
if (metadataCorrection) {
ckbUseDist->set_sensitive(metadataCorrection->hasDistortionCorrection());
ckbUseVign->set_sensitive(metadataCorrection->hasVignettingCorrection());
ckbUseCA->set_sensitive(metadataCorrection->hasCACorrection());
} else {
ckbUseDist->set_sensitive(false);
ckbUseVign->set_sensitive(false);
ckbUseCA->set_sensitive(false);
}
}
}
bool LensProfilePanel::setLensfunCamera(const Glib::ustring& make, const Glib::ustring& model) bool LensProfilePanel::setLensfunCamera(const Glib::ustring& make, const Glib::ustring& model)
{ {
if (!make.empty() && !model.empty()) { if (!make.empty() && !model.empty()) {

View File

@ -22,6 +22,7 @@
#include "guiutils.h" #include "guiutils.h"
#include "toolpanel.h" #include "toolpanel.h"
#include "../rtengine/lensmetadata.h"
class LensProfilePanel final : class LensProfilePanel final :
public ToolParamBlock, public ToolParamBlock,
@ -89,7 +90,8 @@ private:
void fillLensfunLenses(); void fillLensfunLenses();
}; };
void updateDisabled(bool enable); void updateLCPDisabled(bool enable);
void updateMetadataDisabled();
bool setLensfunCamera(const Glib::ustring& make, const Glib::ustring& model); bool setLensfunCamera(const Glib::ustring& make, const Glib::ustring& model);
bool setLensfunLens(const Glib::ustring& lens); bool setLensfunLens(const Glib::ustring& lens);
@ -113,12 +115,14 @@ private:
bool allowFocusDep; bool allowFocusDep;
bool isRaw; bool isRaw;
const rtengine::FramesMetaData* metadata; const rtengine::FramesMetaData* metadata;
std::unique_ptr<rtengine::MetadataLensCorrection> metadataCorrection;
Gtk::Grid* const modesGrid; Gtk::Grid* const modesGrid;
Gtk::Grid* const distGrid; Gtk::Grid* const distGrid;
Gtk::RadioButton* const corrUnchangedRB; Gtk::RadioButton* const corrUnchangedRB;
Gtk::RadioButton::Group corrGroup; Gtk::RadioButton::Group corrGroup;
Gtk::RadioButton* const corrOffRB; Gtk::RadioButton* const corrOffRB;
Gtk::RadioButton* const corrMetadata;
Gtk::RadioButton* const corrLensfunAutoRB; Gtk::RadioButton* const corrLensfunAutoRB;
Gtk::RadioButton* const corrLensfunManualRB; Gtk::RadioButton* const corrLensfunManualRB;
Gtk::RadioButton* const corrLcpFileRB; Gtk::RadioButton* const corrLcpFileRB;