diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-06-20 02:30:32 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-06-29 17:21:03 +0300 |
commit | d1934c6490e335c273838a960657652bfe6d7546 (patch) | |
tree | ebfdb61d43cfe5debace3048a4bb1c118f2a42f2 /src/ipa/libipa/algorithm.cpp | |
parent | 5f94b262da99428fa18d7b33a4230536c86f2ec8 (diff) |
ipa: libipa: algorithm: Add an algorithm registration mechanism
In order to allow dynamic instantiation of algorithms based on tuning
data files, add a mechanism to register algorithms with the IPA module.
The implementation relies on an AlgorithmFactory class and a
registration macro, similar to the pipeline handler registration
mechanism. The main difference is that the algorithm registration and
instantiation are implemented in the Module class instead of the
AlgorithmFactory class, making the factory an internal implementation
detail.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa/algorithm.cpp')
-rw-r--r-- | src/ipa/libipa/algorithm.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp index 2df91e5d..1d099808 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -33,6 +33,11 @@ namespace ipa { */ /** + * \typedef Algorithm::Module + * \brief The IPA module type for this class of algorithms + */ + +/** * \fn Algorithm::configure() * \brief Configure the Algorithm given an IPAConfigInfo * \param[in] context The shared IPA context @@ -94,6 +99,49 @@ namespace ipa { * such that the algorithms use up to date state as required. */ +/** + * \class AlgorithmFactory + * \brief Registration of Algorithm classes and creation of instances + * \tparam _Algorithm The algorithm class type for this factory + * + * To facilitate instantiation of Algorithm classes, the AlgorithmFactory class + * implements auto-registration of algorithms with the IPA Module class. Each + * Algorithm subclass shall register itself using the REGISTER_IPA_ALGORITHM() + * macro, which will create a corresponding instance of an AlgorithmFactory and + * register it with the IPA Module. + */ + +/** + * \fn AlgorithmFactory::AlgorithmFactory() + * \brief Construct an algorithm factory + * \param[in] name Name of the algorithm class + * + * Creating an instance of the factory automatically registers is with the IPA + * Module class, enabling creation of algorithm instances through + * Module::createAlgorithm(). + * + * The factory \a name identifies the algorithm and shall be unique. + */ + +/** + * \fn AlgorithmFactory::create() + * \brief Create an instance of the Algorithm corresponding to the factory + * \return A pointer to a newly constructed instance of the Algorithm subclass + * corresponding to the factory + */ + +/** + * \def REGISTER_IPA_ALGORITHM + * \brief Register an algorithm with the IPA module + * \param[in] algorithm Class name of Algorithm derived class to register + * \param[in] name Name of the algorithm + * + * Register an Algorithm subclass with the IPA module to make it available for + * instantiation through Module::createAlgorithm(). The \a name identifies the + * algorithm and must be unique across all algorithms registered for the IPA + * module. + */ + } /* namespace ipa */ } /* namespace libcamera */ |