summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/utils.cpp
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2024-03-27 17:54:49 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2024-05-31 17:12:48 +0900
commit9d152e9c66c1094a482e704d95965078a0fe2cf3 (patch)
treeb2fb40ead282da27a96586ef318a2482225282dc /src/ipa/rkisp1/utils.cpp
parentc79fa47aac9b38865dab5e9f29030903bf460c46 (diff)
ipa: rkisp1: Add a helper to convert floating-point to fixed-point
Add helper functions for converting between floating point and fixed point numbers. Also add tests for them. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rkisp1/utils.cpp')
-rw-r--r--src/ipa/rkisp1/utils.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ipa/rkisp1/utils.cpp b/src/ipa/rkisp1/utils.cpp
new file mode 100644
index 00000000..960ec64e
--- /dev/null
+++ b/src/ipa/rkisp1/utils.cpp
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>
+ *
+ * Miscellaneous utility functions specific to rkisp1
+ */
+
+#include "utils.h"
+
+/**
+ * \file utils.h
+ */
+
+namespace libcamera {
+
+namespace ipa::rkisp1::utils {
+
+/**
+ * \fn R floatingToFixedPoint(T number)
+ * \brief Convert a floating point number to a fixed-point representation
+ * \tparam I Bit width of the integer part of the fixed-point
+ * \tparam F Bit width of the fractional part of the fixed-point
+ * \tparam R Return type of the fixed-point representation
+ * \tparam T Input type of the floating point representation
+ * \param number The floating point number to convert to fixed point
+ * \return The converted value
+ */
+
+/**
+ * \fn R fixedToFloatingPoint(T number)
+ * \brief Convert a fixed-point number to a floating point representation
+ * \tparam I Bit width of the integer part of the fixed-point
+ * \tparam F Bit width of the fractional part of the fixed-point
+ * \tparam R Return type of the floating point representation
+ * \tparam T Input type of the fixed-point representation
+ * \param number The fixed point number to convert to floating point
+ * \return The converted value
+ */
+
+} /* namespace ipa::rkisp1::utils */
+
+} /* namespace libcamera */