summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-06 16:24:43 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-07 19:09:35 +0200
commite7888073718aadd7c35a78f88792a73a4e3a8300 (patch)
treec0cbddf20813f9a511f8321b8ada4a71f94b64ab /src/libcamera/pipeline/raspberrypi
parentf413f944d789911c9ded831ac45a7674c129ceba (diff)
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>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 62db8f26..22c8ee68 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -14,6 +14,7 @@
#include <unordered_set>
#include <libcamera/base/shared_fd.h>
+#include <libcamera/base/utils.h>
#include <libcamera/camera.h>
#include <libcamera/control_ids.h>
@@ -25,8 +26,6 @@
#include <libcamera/property_ids.h>
#include <libcamera/request.h>
-#include <libcamera/base/utils.h>
-
#include <linux/bcm2835-isp.h>
#include <linux/media-bus-format.h>
#include <linux/videodev2.h>
@@ -154,7 +153,7 @@ V4L2SubdeviceFormat findBestFormat(const SensorFormats &formatsMap, const Size &
score += penaltyAr * scoreFormat(reqAr, fmtAr);
/* Add any penalties... this is not an exact science! */
- score += std::abs(static_cast<int>(info.bitsPerPixel - bitDepth)) * penaltyBitDepth;
+ score += utils::abs_diff(info.bitsPerPixel, bitDepth) * penaltyBitDepth;
if (score <= bestScore) {
bestScore = score;