WIP: Use Horner's method in `Horner` function 1/2

Closed Luc Hermitte requested to merge lhermitte/otb:Improve-SARCalibration-1 into develop


First MR of a series about simplifying and improving SARCalibration design and performances.

This MR is about using Horner's method on Y axis in SarParametricMapFunction::Horner() function.


Horner's method is much faster than using std::pow() multiple times, and it offers a better numerical precision.

Implementation Details

The MR will be done through 2/3 commits.

First commit: the baseline enforces numerical errors

Before fully using Horner's method, let improve the precision.

Here, point can be an array of floats, we divide its components with 2 doubles. And we do computations with other doubles. Mixing floats and doubles in computations will trigger conversions and prevent the compiler from correctly vectorizing the operations.

Hence, it's better to cache point[0|1] / W|H in two doubles but now raTvSarParametricMapFunctionToImageFilter fails...

My understanding is that the new computation should be more precise than the initial one, and I strongly suspect that the baseline enforces a small numerical error.

Can anybody else confirm my analysis? Also, can some one check whether some SARcalibration cases are improved?

Final commit: Implement Horner's method on Y's as well

Once we agree about the first part regarding the precision improvement, I'll fully implement Horner's method (commented as of now)


The copyright owner is CS Group FRANCE and has signed the ORFEO ToolBox Contributor License Agreement.

Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i on latest changes and commit
Edited by Luc Hermitte

Merge request reports