Avoid unnecessary copy of variable

This commit is contained in:
Alexander Brock
2023-02-22 13:52:06 +01:00
parent 20f3b33c5f
commit 6ed53affda

View File

@@ -524,17 +524,16 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector<Coord2D> &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;