libcamera: Use utils::abs_diff()

Use the new utils::abs_diff() function where appropriate to replace
manual implementations.

While at it fix a header ordering issue in
src/libcamera/pipeline/raspberrypi/raspberrypi.cpp.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-12-06 16:24:43 +02:00
parent f413f944d7
commit e788807371
5 changed files with 10 additions and 9 deletions

View file

@ -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 << ")";