[libcamera-devel] [PATCH v3 3/9] ipa: ipu3: Add the functions to the Algorithm class
Jean-Michel Hautbois
jeanmichel.hautbois at ideasonboard.com
Wed Aug 18 17:53:57 CEST 2021
Introduce three functions in the Algorithm class to manage algorithms:
- configure which is called when IPA is configured only
- prepare called on EventFillParams event at each frame
- process called on EventStatReady event at each frame
As AGC already has a process function with different arguments, let's
temporarily disable the warnings from the compiler in this same commit.
It will be removed when AGC will be fully modular.
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
---
meson.build | 4 +++
src/ipa/ipu3/algorithms/algorithm.cpp | 46 +++++++++++++++++++++++++++
src/ipa/ipu3/algorithms/algorithm.h | 9 ++++++
3 files changed, 59 insertions(+)
diff --git a/meson.build b/meson.build
index a49c484f..4a10e2b6 100644
--- a/meson.build
+++ b/meson.build
@@ -108,6 +108,10 @@ if cc.has_argument('-Wno-c99-designator')
]
endif
+# Do not warn when a function declaration hides virtual functions from
+# a base class
+cpp_arguments += '-Wno-overloaded-virtual'
+
c_arguments += common_arguments
cpp_arguments += common_arguments
diff --git a/src/ipa/ipu3/algorithms/algorithm.cpp b/src/ipa/ipu3/algorithms/algorithm.cpp
index 325d34f0..d43a0e90 100644
--- a/src/ipa/ipu3/algorithms/algorithm.cpp
+++ b/src/ipa/ipu3/algorithms/algorithm.cpp
@@ -25,6 +25,52 @@ namespace ipa::ipu3 {
* to manage algorithms regardless of their specific type.
*/
+/**
+ * \param[in] context The IPAContext structure reference
+ * \param[in] configInfo The IPAConfigInfo structure reference
+ * \return 0 if sucess, an error code otherwise
+ *
+ * \brief Sets the IPAconfiguration to the proper values based on the
+ * IPAConfigInfo values.
+ *
+ * It is called one time when IPA is configured. It is meant to prepare everything
+ * needed by the algorithms for their calculations.
+ */
+int Algorithm::configure([[maybe_unused]] IPAContext &context, [[maybe_unused]] const IPAConfigInfo &configInfo)
+{
+ return 0;
+}
+
+/**
+ * \param[in] context The IPAContext structure reference
+ * \param[in] params The parameters structure reference to fill
+ *
+ * \brief Fill the parameter buffer with the updated context values
+ *
+ * While streaming, an EventFillParams event is received from the pipeline handler.
+ * The algorithms should then fill the parameter structure with any updated value
+ * they have calculated before the IPA passes it back to the ISP.
+ */
+void Algorithm::prepare([[maybe_unused]] IPAContext &context, [[maybe_unused]] ipu3_uapi_params ¶ms)
+{
+}
+
+/**
+ * \param[in] context The IPAContext structure reference
+ * \param[in] stats The statistics structure to use
+ *
+ * \brief Fill the context buffer using the received statistics buffer
+ *
+ * While streaming, an EventStatReady event is received from the pipeline handler.
+ * The algorithms can then use the statistics buffer received to update their
+ * internal state. This state can be shared with other algorithms through the
+ * context->frameContext structure.
+ */
+void Algorithm::process([[maybe_unused]] IPAContext &context, [[maybe_unused]] const ipu3_uapi_stats_3a *stats)
+{
+}
+
} /* namespace ipa::ipu3 */
} /* namespace libcamera */
+
diff --git a/src/ipa/ipu3/algorithms/algorithm.h b/src/ipa/ipu3/algorithms/algorithm.h
index 072f01c4..bd1f923d 100644
--- a/src/ipa/ipu3/algorithms/algorithm.h
+++ b/src/ipa/ipu3/algorithms/algorithm.h
@@ -7,6 +7,9 @@
#ifndef __LIBCAMERA_IPA_IPU3_ALGORITHM_H__
#define __LIBCAMERA_IPA_IPU3_ALGORITHM_H__
+#include <libcamera/ipa/ipu3_ipa_interface.h>
+
+#include "ipa_context.h"
namespace libcamera {
namespace ipa::ipu3 {
@@ -15,6 +18,12 @@ class Algorithm
{
public:
virtual ~Algorithm() {}
+
+ virtual int configure(IPAContext &context, const IPAConfigInfo &configInfo);
+
+ virtual void prepare(IPAContext &context, ipu3_uapi_params ¶ms);
+
+ virtual void process(IPAContext &context, const ipu3_uapi_stats_3a *stats);
};
} /* namespace ipa::ipu3 */
--
2.30.2
More information about the libcamera-devel
mailing list