iptransform: apply distortion and CA correction in a single pass

Some lens profile methods provides a way to correct distortion and CA in
a single step.

When available, applying distortion and CA correction when both enabled
in a single pass is more precise (see lensfun
ApplySubpixelGeometryDistortion doc) since it's usually how the profile
is done. Instead applying the CA correction in a step after distortion
correction could lead to a bit different (also if not always visible)
correction.

This is also required for future lens correction methods (like DNG
WarpRectilinear or corrections based on vendor metadata) that provides
only merged distortion and CA correction in a single pass.
This commit is contained in:
Simone Gotti
2024-06-13 20:02:15 +02:00
parent 55fd4b975e
commit dc0e23c82c
5 changed files with 42 additions and 8 deletions

View File

@@ -990,6 +990,12 @@ bool rtengine::LCPMapper::isCACorrectionAvailable() const
return enableCA;
}
void rtengine::LCPMapper::correctDistortionAndCA(double &x, double &y, int cx, int cy, int channel) const
{
correctDistortion(x, y, cx, cy);
correctCA(x, y, cx, cy, channel);
}
void rtengine::LCPMapper::correctDistortion(double &x, double &y, int cx, int cy) const
{
x += cx;