new file mode 100644
@@ -0,0 +1,77 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (C) 2022, Theobroma Systems
+ *
+ * af_algorithm.cpp - autofocus 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 */
new file mode 100644
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (C) 2022, Theobroma Systems
+ *
+ * af_algorithm.h - autofocus 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 */
new file mode 100644
@@ -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',
+])
@@ -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],
Define common interface with basic functions that should be supported by Auto Focus algorithms. Signed-off-by: Daniel Semkowicz <dse@thaumatec.com> --- src/ipa/libipa/algorithms/af_algorithm.cpp | 77 ++++++++++++++++++++++ src/ipa/libipa/algorithms/af_algorithm.h | 39 +++++++++++ src/ipa/libipa/algorithms/meson.build | 9 +++ src/ipa/libipa/meson.build | 6 ++ 4 files changed, 131 insertions(+) create mode 100644 src/ipa/libipa/algorithms/af_algorithm.cpp create mode 100644 src/ipa/libipa/algorithms/af_algorithm.h create mode 100644 src/ipa/libipa/algorithms/meson.build