[libcamera-devel] [libcamera-devel 2/5] ipa: libipa: Add init() function to the Algorithm class

Florian Sylvestre fsylvestre at baylibre.com
Mon May 23 11:24:32 CEST 2022


Add the init() function that will be called during algorithm initialization
to provide each algorithm the list of algorithms tuning data.
Each algorithm will be responsible to grab their corresponding parameters.

Signed-off-by: Florian Sylvestre <fsylvestre at baylibre.com>
---
 src/ipa/libipa/algorithm.cpp | 15 +++++++++++++++
 src/ipa/libipa/algorithm.h   | 10 +++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp
index 398d5372..269a4beb 100644
--- a/src/ipa/libipa/algorithm.cpp
+++ b/src/ipa/libipa/algorithm.cpp
@@ -29,6 +29,21 @@ namespace ipa {
  * to manage algorithms regardless of their specific type.
  */
 
+/**
+ * \fn Algorithm::init()
+ * \brief Configure the Algorithm with default parameters
+ * \param[in] context The shared IPA context
+ * \param[in] params The initial parameters used to tune algorithms
+ *
+ * This function is called once before the camera is running to get default
+ * algorithm parameters.
+ *
+ * Algorithms are responsible to read the parameters given and extract their
+ * parameter configuration.
+ *
+ * \return 0 if successful, an error code otherwise
+ */
+
 /**
  * \fn Algorithm::configure()
  * \brief Configure the Algorithm given an IPAConfigInfo
diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h
index 766aee5d..f5be1caf 100644
--- a/src/ipa/libipa/algorithm.h
+++ b/src/ipa/libipa/algorithm.h
@@ -10,12 +10,20 @@ namespace libcamera {
 
 namespace ipa {
 
-template<typename Context, typename Config, typename Params, typename Stats>
+template<typename Context, typename TuningData,
+	 typename Config, typename Params, typename Stats>
+
 class Algorithm
 {
 public:
 	virtual ~Algorithm() {}
 
+	virtual int init([[maybe_unused]] Context &context,
+			 [[maybe_unused]] const TuningData *params)
+	{
+		return 0;
+	}
+
 	virtual int configure([[maybe_unused]] Context &context,
 			      [[maybe_unused]] const Config &configInfo)
 	{
-- 
2.34.1



More information about the libcamera-devel mailing list