diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 8aa471c0b..6cda1bba2 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -524,17 +524,16 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector &src, x_d /= params->perspective.camera_scale; y_d /= params->perspective.camera_scale; if (params->perspective.camera_defish) { - const double focal_source = + const double focal = params->perspective.camera_focal_length * maxRadius * focal_length_in_px_factor * params->perspective.camera_crop_factor; - double focal_dst = focal_source; - x_d /= focal_dst; - y_d /= focal_dst; + x_d /= focal; + y_d /= focal; const double r = std::sqrt(x_d * x_d + y_d * y_d); - const double factor = focal_source * std::atan(r) / r; + const double factor = focal * std::atan(r) / r; x_d *= factor; y_d *= factor; @@ -1268,17 +1267,16 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I x_d /= params->perspective.camera_scale; y_d /= params->perspective.camera_scale; if (params->perspective.camera_defish) { - const double focal_source = + const double focal = params->perspective.camera_focal_length * maxRadius * focal_length_in_px_factor * params->perspective.camera_crop_factor; - double focal_dst = focal_source; - x_d /= focal_dst; - y_d /= focal_dst; + x_d /= focal; + y_d /= focal; const double r = std::sqrt(x_d * x_d + y_d * y_d); - const double factor = focal_source * std::atan(r)/r; + const double factor = focal * std::atan(r)/r; x_d *= factor; y_d *= factor;