Fix Lensfun camera mismatch
Work around a Lensfun bug that finds the wrong camera when given an exact name of certain cameras.
This commit is contained in:
parent
a618efe782
commit
1efa06e887
@ -435,11 +435,21 @@ std::vector<LFLens> LFDatabase::getLenses() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LFCamera LFDatabase::findCamera(const Glib::ustring &make, const Glib::ustring &model) const
|
LFCamera LFDatabase::findCamera(const Glib::ustring &make, const Glib::ustring &model, bool autoMatch) const
|
||||||
{
|
{
|
||||||
LFCamera ret;
|
LFCamera ret;
|
||||||
if (data_ && !make.empty()) {
|
if (data_ && !make.empty()) {
|
||||||
MyMutex::MyLock lock(lfDBMutex);
|
MyMutex::MyLock lock(lfDBMutex);
|
||||||
|
if (!autoMatch) {
|
||||||
|
// Try to find exact match by name.
|
||||||
|
for (auto camera_list = data_->GetCameras(); camera_list[0]; camera_list++) {
|
||||||
|
const auto camera = camera_list[0];
|
||||||
|
if (make == camera->Maker && model == camera->Model) {
|
||||||
|
ret.data_ = camera;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
auto found = data_->FindCamerasExt(make.c_str(), model.c_str());
|
auto found = data_->FindCamerasExt(make.c_str(), model.c_str());
|
||||||
if (found) {
|
if (found) {
|
||||||
ret.data_ = found[0];
|
ret.data_ = found[0];
|
||||||
@ -551,7 +561,7 @@ std::unique_ptr<LFModifier> LFDatabase::findModifier(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LFCamera c = findCamera(make, model);
|
const LFCamera c = findCamera(make, model, lensProf.lfAutoMatch());
|
||||||
const LFLens l = findLens(
|
const LFLens l = findLens(
|
||||||
lensProf.lfAutoMatch()
|
lensProf.lfAutoMatch()
|
||||||
? c
|
? c
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
std::vector<LFCamera> getCameras() const;
|
std::vector<LFCamera> getCameras() const;
|
||||||
std::vector<LFLens> getLenses() const;
|
std::vector<LFLens> getLenses() const;
|
||||||
LFCamera findCamera(const Glib::ustring &make, const Glib::ustring &model) const;
|
LFCamera findCamera(const Glib::ustring &make, const Glib::ustring &model, bool autoMatch) const;
|
||||||
LFLens findLens(const LFCamera &camera, const Glib::ustring &name) const;
|
LFLens findLens(const LFCamera &camera, const Glib::ustring &name) const;
|
||||||
|
|
||||||
std::unique_ptr<LFModifier> findModifier(
|
std::unique_ptr<LFModifier> findModifier(
|
||||||
|
@ -242,7 +242,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
|||||||
|
|
||||||
if (pp->lensProf.lfAutoMatch()) {
|
if (pp->lensProf.lfAutoMatch()) {
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
c = db->findCamera(metadata->getMake(), metadata->getModel());
|
c = db->findCamera(metadata->getMake(), metadata->getModel(), true);
|
||||||
setLensfunCamera(c.getMake(), c.getModel());
|
setLensfunCamera(c.getMake(), c.getModel());
|
||||||
}
|
}
|
||||||
} else if (pp->lensProf.lfManual()) {
|
} else if (pp->lensProf.lfManual()) {
|
||||||
@ -521,7 +521,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged)
|
|||||||
setLensfunLens("");
|
setLensfunLens("");
|
||||||
} else if (metadata) {
|
} else if (metadata) {
|
||||||
const LFDatabase* const db = LFDatabase::getInstance();
|
const LFDatabase* const db = LFDatabase::getInstance();
|
||||||
const LFCamera c = db->findCamera(metadata->getMake(), metadata->getModel());
|
const LFCamera c = db->findCamera(metadata->getMake(), metadata->getModel(), true);
|
||||||
const LFLens l = db->findLens(c, metadata->getLens());
|
const LFLens l = db->findLens(c, metadata->getLens());
|
||||||
setLensfunCamera(c.getMake(), c.getModel());
|
setLensfunCamera(c.getMake(), c.getModel());
|
||||||
setLensfunLens(l.getLens());
|
setLensfunLens(l.getLens());
|
||||||
@ -801,7 +801,7 @@ void LensProfilePanel::updateLensfunWarning()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LFCamera c = db->findCamera((*itc)[lf->lensfunModelCam.make], (*itc)[lf->lensfunModelCam.model]);
|
const LFCamera c = db->findCamera((*itc)[lf->lensfunModelCam.make], (*itc)[lf->lensfunModelCam.model], false);
|
||||||
const auto itl = lensfunLenses->get_active();
|
const auto itl = lensfunLenses->get_active();
|
||||||
|
|
||||||
if (!itl) {
|
if (!itl) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user