summaryrefslogtreecommitdiff
path: root/src/libcamera
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-22 17:23:37 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-25 02:03:16 +0300
commitf2734ff3ab09d3ab78321daf61d18cb628da2b98 (patch)
tree5604776f1d76221a964319e60500eb8106657333 /src/libcamera
parentb869d4463ef38934da35ffaf287870541e0dee47 (diff)
libcamera: Replace utils::clamp() with std::clamp()
Now that libcamera uses C++17, the C++ standard library provides std::clamp(). Drop our custom utils::clamp() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera')
-rw-r--r--src/libcamera/pipeline/ipu3/imgu.cpp3
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp12
-rw-r--r--src/libcamera/pipeline/vimc/vimc.cpp2
-rw-r--r--src/libcamera/utils.cpp8
4 files changed, 9 insertions, 16 deletions
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp
index eb829e09..a4d74a62 100644
--- a/src/libcamera/pipeline/ipu3/imgu.cpp
+++ b/src/libcamera/pipeline/ipu3/imgu.cpp
@@ -7,6 +7,7 @@
#include "imgu.h"
+#include <algorithm>
#include <cmath>
#include <limits>
@@ -129,7 +130,7 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc
if (!isSameRatio(pipe->input, gdc)) {
float estIFHeight = (iif.width * gdc.height) /
static_cast<float>(gdc.width);
- estIFHeight = utils::clamp<float>(estIFHeight, minIFHeight, iif.height);
+ estIFHeight = std::clamp<float>(estIFHeight, minIFHeight, iif.height);
bool found = false;
ifHeight = utils::alignUp(estIFHeight, IF_ALIGN_H);
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 019e50b8..2d881fe2 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -240,15 +240,15 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
unsigned int limit;
limit = utils::alignDown(cio2Configuration_.size.width - 1,
IMGU_OUTPUT_WIDTH_MARGIN);
- cfg->size.width = utils::clamp(cfg->size.width,
- IMGU_OUTPUT_MIN_SIZE.width,
- limit);
+ cfg->size.width = std::clamp(cfg->size.width,
+ IMGU_OUTPUT_MIN_SIZE.width,
+ limit);
limit = utils::alignDown(cio2Configuration_.size.height - 1,
IMGU_OUTPUT_HEIGHT_MARGIN);
- cfg->size.height = utils::clamp(cfg->size.height,
- IMGU_OUTPUT_MIN_SIZE.height,
- limit);
+ cfg->size.height = std::clamp(cfg->size.height,
+ IMGU_OUTPUT_MIN_SIZE.height,
+ limit);
cfg->size.alignDownTo(IMGU_OUTPUT_WIDTH_ALIGN,
IMGU_OUTPUT_HEIGHT_ALIGN);
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index cf244f11..7e237650 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -360,7 +360,7 @@ int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
}
int32_t value = lroundf(it.second.get<float>() * 128 + offset);
- controls.set(cid, utils::clamp(value, 0, 255));
+ controls.set(cid, std::clamp(value, 0, 255));
}
for (const auto &ctrl : controls)
diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp
index 615df46a..a5232902 100644
--- a/src/libcamera/utils.cpp
+++ b/src/libcamera/utils.cpp
@@ -147,14 +147,6 @@ std::string dirname(const std::string &path)
*/
/**
- * \fn libcamera::utils::clamp(const T& v, const T& lo, const T& hi)
- * \param[in] v The value to clamp
- * \param[in] lo The lower boundary to clamp v to
- * \param[in] hi The higher boundary to clamp v to
- * \return lo if v is less than lo, hi if v is greater than hi, otherwise v
- */
-
-/**
* \typedef clock
* \brief The libcamera clock (monotonic)
*/