Message ID | 20211119111654.68445-4-jeanmichel.hautbois@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Quoting Jean-Michel Hautbois (2021-11-19 11:16:49) > Before using any algorithm, we want the IPAContext to be ready for > those. Introduce the IPAContext as in IPA::IPU3 but empty. Each I might say "Introduce the IPAContext following the existing design from IPA::IPU3." There's plenty of duplication from the IPU3 here, so maybe Laurent's class template idea might help - but this is going to quickly diverge and have only RKISP specifics added, so I dont' know how easy it will be to have a common base... So given that - a simple start makes sense here - we can always refactor later. > algorithm will then introduce the needed fields. > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > --- > src/ipa/rkisp1/ipa_context.cpp | 58 ++++++++++++++++++++++++++++++++++ > src/ipa/rkisp1/ipa_context.h | 36 +++++++++++++++++++++ > src/ipa/rkisp1/meson.build | 7 +++- > src/ipa/rkisp1/rkisp1.cpp | 7 ++++ > 4 files changed, 107 insertions(+), 1 deletion(-) > create mode 100644 src/ipa/rkisp1/ipa_context.cpp > create mode 100644 src/ipa/rkisp1/ipa_context.h > > diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp > new file mode 100644 > index 00000000..819b2c73 > --- /dev/null > +++ b/src/ipa/rkisp1/ipa_context.cpp > @@ -0,0 +1,58 @@ > +/* SPDX-License-Identifier: LGPL-2.1-or-later */ > +/* > + * Copyright (C) 2021, Ideas On Board > + * > + * ipa_context.cpp - RkISP1 IPA Context > + */ > + > +#include "ipa_context.h" > + > +/** > + * \file ipa_context.h > + * \brief Context and state information shared between the algorithms > + */ > + > +namespace libcamera::ipa::rkisp1 { > + > +/** > + * \struct IPASessionConfiguration > + * \brief Session configuration for the IPA module > + * > + * The session configuration contains all IPA configuration parameters that > + * remain constant during the capture session, from IPA module start to stop. > + * It is typically set during the configure() operation of the IPA module, but > + * may also be updated in the start() operation. > + */ > + > +/** > + * \struct IPAFrameContext > + * \brief Per-frame context for algorithms > + * > + * The frame context stores data specific to a single frame processed by the > + * IPA. Each frame processed by the IPA has a context associated with it, > + * accessible through the IPAContext structure. > + * > + * \todo Detail how to access contexts for a particular frame > + * > + * Each of the fields in the frame context belongs to either a specific > + * algorithm, or to the top-level IPA module. A field may be read by any > + * algorithm, but should only be written by its owner. > + */ > + > +/** > + * \struct IPAContext > + * \brief Global IPA context data shared between all algorithms > + * > + * \var IPAContext::configuration > + * \brief The IPA session configuration, immutable during the session > + * > + * \var IPAContext::frameContext > + * \brief The frame context for the frame being processed > + * > + * \todo While the frame context is supposed to be per-frame, this > + * single frame context stores data related to both the current frame > + * and the previous frames, with fields being updated as the algorithms > + * are run. This needs to be turned into real per-frame data storage. > + */ > + > +} /* namespace libcamera::ipa::rkisp1 */ > diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h > new file mode 100644 > index 00000000..a1dc39fe > --- /dev/null > +++ b/src/ipa/rkisp1/ipa_context.h > @@ -0,0 +1,36 @@ > +/* SPDX-License-Identifier: LGPL-2.1-or-later */ > +/* > + * Copyright (C) 2021, Ideas On Board > + * > + * ipa_context.h - RkISP1 IPA Context > + * > + */ > +#ifndef __LIBCAMERA_RKISP1_IPA_CONTEXT_H__ > +#define __LIBCAMERA_RKISP1_IPA_CONTEXT_H__ > + > +#include <linux/rkisp1-config.h> > + > +#include <libcamera/base/utils.h> > + > +#include <libcamera/geometry.h> Only add these headers in the patch that introduces the need. with those removed: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > + > +namespace libcamera { > + > +namespace ipa::rkisp1 { > + > +struct IPASessionConfiguration { > +}; > + > +struct IPAFrameContext { > +}; > + > +struct IPAContext { > + IPASessionConfiguration configuration; > + IPAFrameContext frameContext; > +}; > + > +} /* namespace ipa::rkisp1 */ > + > +} /* namespace libcamera*/ > + > +#endif /* __LIBCAMERA_RKISP1_IPA_CONTEXT_H__ */ > diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build > index f76b37f5..3683c922 100644 > --- a/src/ipa/rkisp1/meson.build > +++ b/src/ipa/rkisp1/meson.build > @@ -2,8 +2,13 @@ > > ipa_name = 'ipa_rkisp1' > > +rkisp1_ipa_sources = files([ > + 'ipa_context.cpp', > + 'rkisp1.cpp', > +]) > + > mod = shared_module(ipa_name, > - ['rkisp1.cpp', libcamera_generated_ipa_headers], > + [rkisp1_ipa_sources, libcamera_generated_ipa_headers], > name_prefix : '', > include_directories : [ipa_includes, libipa_includes], > dependencies : libcamera_private, > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp > index ff8d8712..e0933e22 100644 > --- a/src/ipa/rkisp1/rkisp1.cpp > +++ b/src/ipa/rkisp1/rkisp1.cpp > @@ -25,6 +25,7 @@ > > #include <libcamera/internal/mapped_framebuffer.h> > > +#include "ipa_context.h" > #include "libipa/camera_sensor_helper.h" > > namespace libcamera { > @@ -78,6 +79,9 @@ private: > > /* Interface to the Camera Helper */ > std::unique_ptr<CameraSensorHelper> camHelper_; > + > + /* Local parameter storage */ > + struct IPAContext context_; > }; > > int IPARkISP1::init([[maybe_unused]] const IPASettings &settings, > @@ -165,6 +169,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, > << "Exposure: " << minExposure_ << "-" << maxExposure_ > << " Gain: " << minGain_ << "-" << maxGain_; > > + /* Clean context at configuration */ > + context_ = {}; > + > return 0; > } > > -- > 2.32.0 >
diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp new file mode 100644 index 00000000..819b2c73 --- /dev/null +++ b/src/ipa/rkisp1/ipa_context.cpp @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Ideas On Board + * + * ipa_context.cpp - RkISP1 IPA Context + */ + +#include "ipa_context.h" + +/** + * \file ipa_context.h + * \brief Context and state information shared between the algorithms + */ + +namespace libcamera::ipa::rkisp1 { + +/** + * \struct IPASessionConfiguration + * \brief Session configuration for the IPA module + * + * The session configuration contains all IPA configuration parameters that + * remain constant during the capture session, from IPA module start to stop. + * It is typically set during the configure() operation of the IPA module, but + * may also be updated in the start() operation. + */ + +/** + * \struct IPAFrameContext + * \brief Per-frame context for algorithms + * + * The frame context stores data specific to a single frame processed by the + * IPA. Each frame processed by the IPA has a context associated with it, + * accessible through the IPAContext structure. + * + * \todo Detail how to access contexts for a particular frame + * + * Each of the fields in the frame context belongs to either a specific + * algorithm, or to the top-level IPA module. A field may be read by any + * algorithm, but should only be written by its owner. + */ + +/** + * \struct IPAContext + * \brief Global IPA context data shared between all algorithms + * + * \var IPAContext::configuration + * \brief The IPA session configuration, immutable during the session + * + * \var IPAContext::frameContext + * \brief The frame context for the frame being processed + * + * \todo While the frame context is supposed to be per-frame, this + * single frame context stores data related to both the current frame + * and the previous frames, with fields being updated as the algorithms + * are run. This needs to be turned into real per-frame data storage. + */ + +} /* namespace libcamera::ipa::rkisp1 */ diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h new file mode 100644 index 00000000..a1dc39fe --- /dev/null +++ b/src/ipa/rkisp1/ipa_context.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Ideas On Board + * + * ipa_context.h - RkISP1 IPA Context + * + */ +#ifndef __LIBCAMERA_RKISP1_IPA_CONTEXT_H__ +#define __LIBCAMERA_RKISP1_IPA_CONTEXT_H__ + +#include <linux/rkisp1-config.h> + +#include <libcamera/base/utils.h> + +#include <libcamera/geometry.h> + +namespace libcamera { + +namespace ipa::rkisp1 { + +struct IPASessionConfiguration { +}; + +struct IPAFrameContext { +}; + +struct IPAContext { + IPASessionConfiguration configuration; + IPAFrameContext frameContext; +}; + +} /* namespace ipa::rkisp1 */ + +} /* namespace libcamera*/ + +#endif /* __LIBCAMERA_RKISP1_IPA_CONTEXT_H__ */ diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build index f76b37f5..3683c922 100644 --- a/src/ipa/rkisp1/meson.build +++ b/src/ipa/rkisp1/meson.build @@ -2,8 +2,13 @@ ipa_name = 'ipa_rkisp1' +rkisp1_ipa_sources = files([ + 'ipa_context.cpp', + 'rkisp1.cpp', +]) + mod = shared_module(ipa_name, - ['rkisp1.cpp', libcamera_generated_ipa_headers], + [rkisp1_ipa_sources, libcamera_generated_ipa_headers], name_prefix : '', include_directories : [ipa_includes, libipa_includes], dependencies : libcamera_private, diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index ff8d8712..e0933e22 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -25,6 +25,7 @@ #include <libcamera/internal/mapped_framebuffer.h> +#include "ipa_context.h" #include "libipa/camera_sensor_helper.h" namespace libcamera { @@ -78,6 +79,9 @@ private: /* Interface to the Camera Helper */ std::unique_ptr<CameraSensorHelper> camHelper_; + + /* Local parameter storage */ + struct IPAContext context_; }; int IPARkISP1::init([[maybe_unused]] const IPASettings &settings, @@ -165,6 +169,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, << "Exposure: " << minExposure_ << "-" << maxExposure_ << " Gain: " << minGain_ << "-" << maxGain_; + /* Clean context at configuration */ + context_ = {}; + return 0; }
Before using any algorithm, we want the IPAContext to be ready for those. Introduce the IPAContext as in IPA::IPU3 but empty. Each algorithm will then introduce the needed fields. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> --- src/ipa/rkisp1/ipa_context.cpp | 58 ++++++++++++++++++++++++++++++++++ src/ipa/rkisp1/ipa_context.h | 36 +++++++++++++++++++++ src/ipa/rkisp1/meson.build | 7 +++- src/ipa/rkisp1/rkisp1.cpp | 7 ++++ 4 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/ipa/rkisp1/ipa_context.cpp create mode 100644 src/ipa/rkisp1/ipa_context.h