summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa')
-rw-r--r--src/ipa/libipa/algorithms/af_algorithm.cpp78
-rw-r--r--src/ipa/libipa/algorithms/af_algorithm.h41
-rw-r--r--src/ipa/libipa/algorithms/meson.build9
-rw-r--r--src/ipa/libipa/meson.build6
4 files changed, 134 insertions, 0 deletions
diff --git a/src/ipa/libipa/algorithms/af_algorithm.cpp b/src/ipa/libipa/algorithms/af_algorithm.cpp
new file mode 100644
index 00000000..47e54d5a
--- /dev/null
+++ b/src/ipa/libipa/algorithms/af_algorithm.cpp
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (C) 2022, Raspberry Pi (Trading) Limited
+ * Copyright (C) 2022, Theobroma Systems
+ *
+ * af_algorithm.cpp - Autofocus control algorithm interface
+ */
+
+#include "af_algorithm.h"
+
+/**
+ * \file af_algorithm.h
+ * \brief AF algorithm common interface
+ */
+
+namespace libcamera::ipa::common::algorithms {
+
+/**
+ * \class AfAlgorithm
+ * \brief Common interface for auto-focus algorithms
+ * \tparam Module The IPA module type for this class of algorithms
+ *
+ * The AfAlgorithm class defines a standard interface for IPA auto focus
+ * algorithms.
+ */
+
+/**
+ * \fn AfAlgorithm::setMode()
+ * \brief Set auto focus mode
+ * \param[in] mode AF mode
+ */
+
+/**
+ * \fn AfAlgorithm::setRange()
+ * \brief set the range of focus distances that is scanned
+ * \param[in] range AF range
+ */
+
+/**
+ * \fn AfAlgorithm::setSpeed()
+ * \brief Set how fast algorithm should move the lens
+ * \param[in] speed Lens move speed
+ */
+
+/**
+ * \fn AfAlgorithm::setMetering()
+ * \brief Set AF metering mode
+ * \param[in] metering AF metering mode
+ */
+
+/**
+ * \fn AfAlgorithm::setWindows()
+ * \brief Set AF windows
+ * \param[in] windows AF windows
+ *
+ * Sets the focus windows used by the AF algorithm when AfMetering is set
+ * to AfMeteringWindows.
+ */
+
+/**
+ * \fn AfAlgorithm::setTrigger()
+ * \brief Starts or cancels the autofocus scan
+ * \param[in] trigger Trigger mode
+ */
+
+/**
+ * \fn AfAlgorithm::setPause()
+ * \brief Pause the autofocus while in AfModeContinuous mode.
+ * \param[in] pause Pause mode
+ */
+
+/**
+ * \fn AfAlgorithm::setLensPosition()
+ * \brief Set the lens position while in AfModeManual
+ * \param[in] lensPosition Lens position
+ */
+
+} /* namespace libcamera::ipa::common::algorithms */
diff --git a/src/ipa/libipa/algorithms/af_algorithm.h b/src/ipa/libipa/algorithms/af_algorithm.h
new file mode 100644
index 00000000..2862042b
--- /dev/null
+++ b/src/ipa/libipa/algorithms/af_algorithm.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (C) 2022, Raspberry Pi (Trading) Limited
+ * Copyright (C) 2022, Theobroma Systems
+ *
+ * af_algorithm.h - Autofocus control algorithm interface
+ */
+#pragma once
+
+#include <libcamera/control_ids.h>
+
+#include "../algorithm.h"
+
+namespace libcamera::ipa::common::algorithms {
+
+template<typename Module>
+class AfAlgorithm : public Algorithm<Module>
+{
+public:
+ AfAlgorithm() = default;
+
+ virtual ~AfAlgorithm() {}
+
+ virtual void setMode(controls::AfModeEnum mode) = 0;
+
+ virtual void setRange(controls::AfRangeEnum range) = 0;
+
+ virtual void setSpeed(controls::AfSpeedEnum speed) = 0;
+
+ virtual void setMetering(controls::AfMeteringEnum metering) = 0;
+
+ virtual void setWindows(Span<const Rectangle> windows) = 0;
+
+ virtual void setTrigger(controls::AfTriggerEnum trigger) = 0;
+
+ virtual void setPause(controls::AfPauseEnum pause) = 0;
+
+ virtual void setLensPosition(float lensPosition) = 0;
+};
+
+} /* namespace libcamera::ipa::common::algorithms */
diff --git a/src/ipa/libipa/algorithms/meson.build b/src/ipa/libipa/algorithms/meson.build
new file mode 100644
index 00000000..ab8da13a
--- /dev/null
+++ b/src/ipa/libipa/algorithms/meson.build
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: CC0-1.0
+
+common_ipa_algorithms_headers = files([
+ 'af_algorithm.h',
+])
+
+common_ipa_algorithms_sources = files([
+ 'af_algorithm.cpp',
+])
diff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build
index fb894bc6..1fc3fd56 100644
--- a/src/ipa/libipa/meson.build
+++ b/src/ipa/libipa/meson.build
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: CC0-1.0
+subdir('algorithms')
+
libipa_headers = files([
'algorithm.h',
'camera_sensor_helper.h',
@@ -7,6 +9,8 @@ libipa_headers = files([
'module.h',
])
+libipa_headers += common_ipa_algorithms_headers
+
libipa_sources = files([
'algorithm.cpp',
'camera_sensor_helper.cpp',
@@ -14,6 +18,8 @@ libipa_sources = files([
'module.cpp',
])
+libipa_sources += common_ipa_algorithms_sources
+
libipa_includes = include_directories('..')
libipa = static_library('ipa', [libipa_sources, libipa_headers],