summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa')
-rw-r--r--src/ipa/ipu3/algorithms/agc.cpp3
-rw-r--r--src/ipa/ipu3/ipu3.cpp4
-rw-r--r--src/ipa/rkisp1/algorithms/agc.cpp3
3 files changed, 6 insertions, 4 deletions
diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index 582f0ae1..8d6f18f6 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -12,6 +12,7 @@
#include <cmath>
#include <libcamera/base/log.h>
+#include <libcamera/base/utils.h>
#include <libcamera/ipa/core_ipa_interface.h>
@@ -188,7 +189,7 @@ void Agc::computeExposure(IPAFrameContext &frameContext, double yGain,
double evGain = std::max(yGain, iqMeanGain);
/* Consider within 1% of the target as correctly exposed */
- if (std::abs(evGain - 1.0) < 0.01)
+ if (utils::abs_diff(evGain, 1.0) < 0.01)
LOG(IPU3Agc, Debug) << "We are well exposed (evGain = "
<< evGain << ")";
diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 76182587..3d307708 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -354,7 +354,7 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)
kMaxGridWidth);
width = width << shift;
- uint32_t error = std::abs(static_cast<int>(width - bdsOutputSize.width));
+ uint32_t error = utils::abs_diff(width, bdsOutputSize.width);
if (error >= minError)
continue;
@@ -370,7 +370,7 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)
kMaxGridHeight);
height = height << shift;
- uint32_t error = std::abs(static_cast<int>(height - bdsOutputSize.height));
+ uint32_t error = utils::abs_diff(height, bdsOutputSize.height);
if (error >= minError)
continue;
diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index d6abdc31..dd97afc0 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -12,6 +12,7 @@
#include <cmath>
#include <libcamera/base/log.h>
+#include <libcamera/base/utils.h>
#include <libcamera/ipa/core_ipa_interface.h>
@@ -145,7 +146,7 @@ void Agc::computeExposure(IPAContext &context, double yGain)
kMaxAnalogueGain);
/* Consider within 1% of the target as correctly exposed. */
- if (std::abs(yGain - 1.0) < 0.01)
+ if (utils::abs_diff(yGain, 1.0) < 0.01)
return;
/* extracted from Rpi::Agc::computeTargetExposure. */