Commit 613d0041 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Apply patch #76256 from Roman I Khimov to use crop factor from camera, not from lens data.

Lens crop factor in DB only tells us which crop factor was used for lens
calibration data, but it has nothing to do with shots made on random user's
camera. So the default behaviour should be to use camera's crop factor and only
fallback to lens data if there in no data present for camera. As "this should
not happen" it's appropriate to spit out some debug message in this case.

Ref: http://lensfun.berlios.de/manual/el_lens.html
Ref: http://lensfun.berlios.de/manual/el_camera.html

BUGS: 312766
FIXED-IN: 3.0.0
CCBUGS: 312764
CCBUGS: 253941
CCBUGS: 266204
CCBUGS: 267613
CCBUGS: 281783
CCBUGS: 284708
CCMAIL: roman@khimov.ru
parent c616f7dd
......@@ -636,7 +636,7 @@ void LensFunCameraSelector::populateLensCombo()
return;
}
kDebug() << "dev: " << dev->Maker << " :: " << dev->Model;
kDebug() << "dev: " << dev->Maker << " :: " << dev->Model << " :: " << dev->CropFactor;
d->lens->blockSignals(true);
const lfLens** lenses = d->iface->lensFunDataBase()->FindLenses(dev, 0, 0);
......@@ -685,6 +685,7 @@ void LensFunCameraSelector::slotLensSelected()
if (d->iface->usedLens() &&
settings.cropFactor <= 0.0) // this should not happen
{
kDebug() << "No crop factor is set for camera, using lens calibration data: " << d->iface->usedLens()->CropFactor;
settings.cropFactor = d->iface->usedLens()->CropFactor;
}
......
......@@ -90,6 +90,7 @@ void LensFunIface::setUsedCamera(DevicePtr cam)
d->usedCamera = cam;
d->settings.cameraMake = d->usedCamera ? d->usedCamera->Maker : QString();
d->settings.cameraModel = d->usedCamera ? d->usedCamera->Model : QString();
d->settings.cropFactor = d->usedCamera ? d->usedCamera->CropFactor : -1.0;
}
LensFunIface::LensPtr LensFunIface::usedLens() const
......@@ -101,7 +102,6 @@ void LensFunIface::setUsedLens(LensPtr lens)
{
d->usedLens = lens;
d->settings.lensModel = d->usedLens ? d->usedLens->Model : QString();
d->settings.cropFactor = d->usedLens ? d->usedLens->CropFactor : -1.0;
}
lfDatabase* LensFunIface::lensFunDataBase() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment