[libcamera-devel] [PATCH v4 06/32] ipa: libipa: algorithm: prepare(): Pass frame and frame Context
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Sep 22 21:40:32 CEST 2022
Hi Jacopo,
On Wed, Sep 21, 2022 at 08:00:58PM +0200, Jacopo Mondi wrote:
> On Thu, Sep 08, 2022 at 04:41:34AM +0300, Laurent Pinchart via libcamera-devel wrote:
> > From: Kieran Bingham <kieran.bingham at ideasonboard.com>
> >
> > Pass the current frame number, and the current FrameContext for calls to
> > prepare.
> >
> > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
> > ---
> > Changes since v3:
> >
> > - Use a const uint32_t instead of an unsigned int for the frame number
>
> The parameter is passed by copy, what does cost bring here?
>
> It doesn't hurt as an hint to developers not to change it though.
That's the idea, yes. It brings no additional benefit.
> > ---
> > src/ipa/ipu3/algorithms/af.cpp | 5 ++++-
> > src/ipa/ipu3/algorithms/af.h | 4 +++-
> > src/ipa/ipu3/algorithms/awb.cpp | 5 ++++-
> > src/ipa/ipu3/algorithms/awb.h | 4 +++-
> > src/ipa/ipu3/algorithms/blc.cpp | 6 +++++-
> > src/ipa/ipu3/algorithms/blc.h | 4 +++-
> > src/ipa/ipu3/algorithms/tone_mapping.cpp | 4 ++++
> > src/ipa/ipu3/algorithms/tone_mapping.h | 3 ++-
> > src/ipa/ipu3/ipu3.cpp | 4 +++-
> > src/ipa/libipa/algorithm.cpp | 2 ++
> > src/ipa/libipa/algorithm.h | 3 +++
> > src/ipa/rkisp1/algorithms/agc.cpp | 5 ++++-
> > src/ipa/rkisp1/algorithms/agc.h | 4 +++-
> > src/ipa/rkisp1/algorithms/awb.cpp | 5 ++++-
> > src/ipa/rkisp1/algorithms/awb.h | 4 +++-
> > src/ipa/rkisp1/algorithms/blc.cpp | 2 ++
> > src/ipa/rkisp1/algorithms/blc.h | 4 +++-
> > src/ipa/rkisp1/algorithms/cproc.cpp | 2 ++
> > src/ipa/rkisp1/algorithms/cproc.h | 4 +++-
> > src/ipa/rkisp1/algorithms/dpcc.cpp | 2 ++
> > src/ipa/rkisp1/algorithms/dpcc.h | 4 +++-
> > src/ipa/rkisp1/algorithms/dpf.cpp | 4 +++-
> > src/ipa/rkisp1/algorithms/dpf.h | 4 +++-
> > src/ipa/rkisp1/algorithms/filter.cpp | 5 ++++-
> > src/ipa/rkisp1/algorithms/filter.h | 4 +++-
> > src/ipa/rkisp1/algorithms/gsl.cpp | 2 ++
> > src/ipa/rkisp1/algorithms/gsl.h | 4 +++-
> > src/ipa/rkisp1/algorithms/lsc.cpp | 2 ++
> > src/ipa/rkisp1/algorithms/lsc.h | 4 +++-
> > src/ipa/rkisp1/rkisp1.cpp | 5 ++++-
> > 30 files changed, 92 insertions(+), 22 deletions(-)
> >
> > diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
> > index 5ab64bf88313..bc01b232ec59 100644
> > --- a/src/ipa/ipu3/algorithms/af.cpp
> > +++ b/src/ipa/ipu3/algorithms/af.cpp
> > @@ -116,7 +116,10 @@ Af::Af()
> > /**
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > -void Af::prepare(IPAContext &context, ipu3_uapi_params *params)
> > +void Af::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + ipu3_uapi_params *params)
> > {
> > const struct ipu3_uapi_grid_config &grid = context.configuration.af.afGrid;
> > params->acc_param.af.grid_cfg = grid;
> > diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
> > index 29117e8bdd0d..fbfd171b6465 100644
> > --- a/src/ipa/ipu3/algorithms/af.h
> > +++ b/src/ipa/ipu3/algorithms/af.h
> > @@ -30,8 +30,10 @@ public:
> > Af();
> > ~Af() = default;
> >
> > - void prepare(IPAContext &context, ipu3_uapi_params *params) override;
> > int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + ipu3_uapi_params *params) override;
> > void process(IPAContext &context, IPAFrameContext &frameContext,
> > const ipu3_uapi_stats_3a *stats) override;
> >
> > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
> > index 128f5d9d5351..e6e2951b8abb 100644
> > --- a/src/ipa/ipu3/algorithms/awb.cpp
> > +++ b/src/ipa/ipu3/algorithms/awb.cpp
> > @@ -429,7 +429,10 @@ constexpr uint16_t Awb::gainValue(double gain)
> > /**
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > -void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)
> > +void Awb::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + ipu3_uapi_params *params)
> > {
> > /*
> > * Green saturation thresholds are reduced because we are using the
> > diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h
> > index ebbb2d58be7e..e9e816928fb4 100644
> > --- a/src/ipa/ipu3/algorithms/awb.h
> > +++ b/src/ipa/ipu3/algorithms/awb.h
> > @@ -39,7 +39,9 @@ public:
> > ~Awb();
> >
> > int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
> > - void prepare(IPAContext &context, ipu3_uapi_params *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + ipu3_uapi_params *params) override;
> > void process(IPAContext &context, IPAFrameContext &frameContext,
> > const ipu3_uapi_stats_3a *stats) override;
> >
> > diff --git a/src/ipa/ipu3/algorithms/blc.cpp b/src/ipa/ipu3/algorithms/blc.cpp
> > index c32427c99549..e838072a344c 100644
> > --- a/src/ipa/ipu3/algorithms/blc.cpp
> > +++ b/src/ipa/ipu3/algorithms/blc.cpp
> > @@ -39,13 +39,17 @@ BlackLevelCorrection::BlackLevelCorrection()
> > /**
> > * \brief Fill in the parameter structure, and enable black level correction
> > * \param[in] context The shared IPA context
> > + * \param[in] frame The frame context sequence number
> > + * \param[in] frameContext The FrameContext for this frame
> > * \param[out] params The IPU3 parameters
> > *
> > * Populate the IPU3 parameter structure with the correction values for each
> > * channel and enable the corresponding ImgU block processing.
> > */
> > void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,
> > - ipu3_uapi_params *params)
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + ipu3_uapi_params *params)
> > {
> > /*
> > * The Optical Black Level correction values
> > diff --git a/src/ipa/ipu3/algorithms/blc.h b/src/ipa/ipu3/algorithms/blc.h
> > index d8da1748baba..292bf67b02ff 100644
> > --- a/src/ipa/ipu3/algorithms/blc.h
> > +++ b/src/ipa/ipu3/algorithms/blc.h
> > @@ -18,7 +18,9 @@ class BlackLevelCorrection : public Algorithm
> > public:
> > BlackLevelCorrection();
> >
> > - void prepare(IPAContext &context, ipu3_uapi_params *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + ipu3_uapi_params *params) override;
> > };
> >
> > } /* namespace ipa::ipu3::algorithms */
> > diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp
> > index 24faba9be2b2..10a2fb1935dc 100644
> > --- a/src/ipa/ipu3/algorithms/tone_mapping.cpp
> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp
> > @@ -50,12 +50,16 @@ int ToneMapping::configure(IPAContext &context,
> > /**
> > * \brief Fill in the parameter structure, and enable gamma control
> > * \param[in] context The shared IPA context
> > + * \param[in] frame The frame context sequence number
> > + * \param[in] frameContext The FrameContext for this frame
> > * \param[out] params The IPU3 parameters
> > *
> > * Populate the IPU3 parameter structure with our tone mapping look up table and
> > * enable the gamma control module in the processing blocks.
> > */
> > void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > ipu3_uapi_params *params)
> > {
> > /* Copy the calculated LUT into the parameters buffer. */
> > diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h
> > index 5be62f6ee9bd..c24a7e485aaf 100644
> > --- a/src/ipa/ipu3/algorithms/tone_mapping.h
> > +++ b/src/ipa/ipu3/algorithms/tone_mapping.h
> > @@ -19,7 +19,8 @@ public:
> > ToneMapping();
> >
> > int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
> > - void prepare(IPAContext &context, ipu3_uapi_params *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext, ipu3_uapi_params *params) override;
> > void process(IPAContext &context, IPAFrameContext &frameContext,
> > const ipu3_uapi_stats_3a *stats) override;
> >
> > diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> > index f0c92507533c..ac6f66afecb5 100644
> > --- a/src/ipa/ipu3/ipu3.cpp
> > +++ b/src/ipa/ipu3/ipu3.cpp
> > @@ -572,8 +572,10 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
> > */
> > params->use = {};
> >
> > + IPAFrameContext &frameContext = context_.frameContexts[frame % kMaxFrameContexts];
> > +
> > for (auto const &algo : algorithms())
> > - algo->prepare(context_, params);
> > + algo->prepare(context_, frame, frameContext, params);
> >
> > paramsBufferReady.emit(frame);
> > }
> > diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp
> > index 38200e57b780..0992e5de8dd5 100644
> > --- a/src/ipa/libipa/algorithm.cpp
> > +++ b/src/ipa/libipa/algorithm.cpp
> > @@ -70,6 +70,8 @@ namespace ipa {
> > * \fn Algorithm::prepare()
> > * \brief Fill the \a params buffer with ISP processing parameters for a frame
> > * \param[in] context The shared IPA context
> > + * \param[in] frame The frame context sequence number
> > + * \param[in] frameContext The FrameContext for this frame
> > * \param[out] params The ISP specific parameters.
> > *
> > * This function is called for every frame when the camera is running before it
> > diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h
> > index 0fe3d772963a..cde2e6399e8e 100644
> > --- a/src/ipa/libipa/algorithm.h
> > +++ b/src/ipa/libipa/algorithm.h
> > @@ -7,6 +7,7 @@
> > #pragma once
> >
> > #include <memory>
> > +#include <stdint.h>
> > #include <string>
> >
> > #include <libcamera/controls.h>
> > @@ -38,6 +39,8 @@ public:
> > }
> >
> > virtual void prepare([[maybe_unused]] typename Module::Context &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] typename Module::FrameContext &frameContext,
> > [[maybe_unused]] typename Module::Params *params)
>
> Do we need [[maybe_unused]] in headers ? Anyway, was there already...
For inline functions, yes. If it was just a function declaration, no.
> > {
> > }
> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
> > index 7642796d69a3..0d22d9dc98fb 100644
> > --- a/src/ipa/rkisp1/algorithms/agc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp
> > @@ -323,7 +323,10 @@ void Agc::process(IPAContext &context,
> > /**
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > -void Agc::prepare(IPAContext &context, rkisp1_params_cfg *params)
> > +void Agc::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params)
> > {
> > if (context.frameContext.frameCount > 0)
> > return;
> > diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h
> > index 6a5723ecbcf8..8724cb602158 100644
> > --- a/src/ipa/rkisp1/algorithms/agc.h
> > +++ b/src/ipa/rkisp1/algorithms/agc.h
> > @@ -26,7 +26,9 @@ public:
> > ~Agc() = default;
> >
> > int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> > void process(IPAContext &context, IPAFrameContext &frameContext,
> > const rkisp1_stat_buffer *stats) override;
> >
> > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> > index 2bc5d3aa16ab..da22a0970a4f 100644
> > --- a/src/ipa/rkisp1/algorithms/awb.cpp
> > +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> > @@ -74,7 +74,10 @@ uint32_t Awb::estimateCCT(double red, double green, double blue)
> > /**
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > -void Awb::prepare(IPAContext &context, rkisp1_params_cfg *params)
> > +void Awb::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params)
> > {
> > params->others.awb_gain_config.gain_green_b = 256 * context.frameContext.awb.gains.green;
> > params->others.awb_gain_config.gain_blue = 256 * context.frameContext.awb.gains.blue;
> > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h
> > index fc221acea617..7ae6c7a9bb10 100644
> > --- a/src/ipa/rkisp1/algorithms/awb.h
> > +++ b/src/ipa/rkisp1/algorithms/awb.h
> > @@ -20,7 +20,9 @@ public:
> > ~Awb() = default;
> >
> > int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> > void queueRequest(IPAContext &context, const uint32_t frame,
> > const ControlList &controls) override;
> > void process(IPAContext &context, IPAFrameContext &frameCtx,
> > diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp
> > index a58569fa2dc2..c45a317ada08 100644
> > --- a/src/ipa/rkisp1/algorithms/blc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/blc.cpp
> > @@ -66,6 +66,8 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > void BlackLevelCorrection::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > rkisp1_params_cfg *params)
> > {
> > if (context.frameContext.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h
> > index 5fc3a80fb638..0b1a2d436869 100644
> > --- a/src/ipa/rkisp1/algorithms/blc.h
> > +++ b/src/ipa/rkisp1/algorithms/blc.h
> > @@ -20,7 +20,9 @@ public:
> > ~BlackLevelCorrection() = default;
> >
> > int init(IPAContext &context, const YamlObject &tuningData) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> >
> > private:
> > bool tuningParameters_;
> > diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp
> > index bca5ab6907d6..c0505c68765b 100644
> > --- a/src/ipa/rkisp1/algorithms/cproc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/cproc.cpp
> > @@ -71,6 +71,8 @@ void ColorProcessing::queueRequest(IPAContext &context,
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > void ColorProcessing::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > rkisp1_params_cfg *params)
> > {
> > auto &cproc = context.frameContext.cproc;
> > diff --git a/src/ipa/rkisp1/algorithms/cproc.h b/src/ipa/rkisp1/algorithms/cproc.h
> > index 4b7e4064d7e8..02c3d9c95488 100644
> > --- a/src/ipa/rkisp1/algorithms/cproc.h
> > +++ b/src/ipa/rkisp1/algorithms/cproc.h
> > @@ -23,7 +23,9 @@ public:
> >
> > void queueRequest(IPAContext &context, const uint32_t frame,
> > const ControlList &controls) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> > };
> >
> > } /* namespace ipa::rkisp1::algorithms */
> > diff --git a/src/ipa/rkisp1/algorithms/dpcc.cpp b/src/ipa/rkisp1/algorithms/dpcc.cpp
> > index fb2f01cdaa3c..5030526769c7 100644
> > --- a/src/ipa/rkisp1/algorithms/dpcc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/dpcc.cpp
> > @@ -259,6 +259,8 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > void DefectPixelClusterCorrection::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > rkisp1_params_cfg *params)
> > {
> > if (context.frameContext.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/dpcc.h b/src/ipa/rkisp1/algorithms/dpcc.h
> > index a363f7bee0a7..894c0249f35d 100644
> > --- a/src/ipa/rkisp1/algorithms/dpcc.h
> > +++ b/src/ipa/rkisp1/algorithms/dpcc.h
> > @@ -20,7 +20,9 @@ public:
> > ~DefectPixelClusterCorrection() = default;
> >
> > int init(IPAContext &context, const YamlObject &tuningData) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> >
> > private:
> > bool initialized_;
> > diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp
> > index c93c8361b5da..8286f83facc1 100644
> > --- a/src/ipa/rkisp1/algorithms/dpf.cpp
> > +++ b/src/ipa/rkisp1/algorithms/dpf.cpp
> > @@ -206,7 +206,9 @@ void Dpf::queueRequest(IPAContext &context,
> > /**
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > -void Dpf::prepare(IPAContext &context, rkisp1_params_cfg *params)
> > +void Dpf::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params)
> > {
> > if (!initialized_)
> > return;
> > diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h
> > index 128ebd5e02e3..656d78dee67c 100644
> > --- a/src/ipa/rkisp1/algorithms/dpf.h
> > +++ b/src/ipa/rkisp1/algorithms/dpf.h
> > @@ -24,7 +24,9 @@ public:
> > int init(IPAContext &context, const YamlObject &tuningData) override;
> > void queueRequest(IPAContext &context, const uint32_t frame,
> > const ControlList &controls) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> >
> > private:
> > bool initialized_;
> > diff --git a/src/ipa/rkisp1/algorithms/filter.cpp b/src/ipa/rkisp1/algorithms/filter.cpp
> > index 8ca10fd1ee9d..02562339d008 100644
> > --- a/src/ipa/rkisp1/algorithms/filter.cpp
> > +++ b/src/ipa/rkisp1/algorithms/filter.cpp
> > @@ -85,7 +85,10 @@ void Filter::queueRequest(IPAContext &context,
> > /**
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > -void Filter::prepare(IPAContext &context, rkisp1_params_cfg *params)
> > +void Filter::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params)
> > {
> > auto &filter = context.frameContext.filter;
> >
> > diff --git a/src/ipa/rkisp1/algorithms/filter.h b/src/ipa/rkisp1/algorithms/filter.h
> > index 9eb170eb7da1..ac69657e2f0f 100644
> > --- a/src/ipa/rkisp1/algorithms/filter.h
> > +++ b/src/ipa/rkisp1/algorithms/filter.h
> > @@ -23,7 +23,9 @@ public:
> >
> > void queueRequest(IPAContext &context, const uint32_t frame,
> > const ControlList &controls) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> > };
> >
> > } /* namespace ipa::rkisp1::algorithms */
> > diff --git a/src/ipa/rkisp1/algorithms/gsl.cpp b/src/ipa/rkisp1/algorithms/gsl.cpp
> > index 2fd1a23d3a9b..dfc76b3d8ffd 100644
> > --- a/src/ipa/rkisp1/algorithms/gsl.cpp
> > +++ b/src/ipa/rkisp1/algorithms/gsl.cpp
> > @@ -119,6 +119,8 @@ int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context,
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > void GammaSensorLinearization::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > rkisp1_params_cfg *params)
> > {
> > if (context.frameContext.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/gsl.h b/src/ipa/rkisp1/algorithms/gsl.h
> > index db287dc280dc..5024b6835949 100644
> > --- a/src/ipa/rkisp1/algorithms/gsl.h
> > +++ b/src/ipa/rkisp1/algorithms/gsl.h
> > @@ -20,7 +20,9 @@ public:
> > ~GammaSensorLinearization() = default;
> >
> > int init(IPAContext &context, const YamlObject &tuningData) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> >
> > private:
> > bool initialized_;
> > diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp
> > index b9efc063ab2e..e4b04136dbaf 100644
> > --- a/src/ipa/rkisp1/algorithms/lsc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp
> > @@ -133,6 +133,8 @@ int LensShadingCorrection::configure(IPAContext &context,
> > * \copydoc libcamera::ipa::Algorithm::prepare
> > */
> > void LensShadingCorrection::prepare(IPAContext &context,
> > + [[maybe_unused]] const uint32_t frame,
> > + [[maybe_unused]] IPAFrameContext &frameContext,
> > rkisp1_params_cfg *params)
> > {
> > if (context.frameContext.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h
> > index f68602c005c4..da957d3e3103 100644
> > --- a/src/ipa/rkisp1/algorithms/lsc.h
> > +++ b/src/ipa/rkisp1/algorithms/lsc.h
> > @@ -21,7 +21,9 @@ public:
> >
> > int init(IPAContext &context, const YamlObject &tuningData) override;
> > int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
> > - void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > + void prepare(IPAContext &context, const uint32_t frame,
> > + IPAFrameContext &frameContext,
> > + rkisp1_params_cfg *params) override;
> >
> > private:
> > bool initialized_;
> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > index 3bc6d4dd2784..0932c73b14e4 100644
> > --- a/src/ipa/rkisp1/rkisp1.cpp
> > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > @@ -298,6 +298,9 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
> >
> > void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
> > {
> > + /* \todo Obtain the frame context to pass to process from the FCQueue */
> > + IPAFrameContext frameContext;
> > +
> > rkisp1_params_cfg *params =
> > reinterpret_cast<rkisp1_params_cfg *>(
> > mappedBuffers_.at(bufferId).planes()[0].data());
> > @@ -306,7 +309,7 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
> > memset(params, 0, sizeof(*params));
> >
> > for (auto const &algo : algorithms())
> > - algo->prepare(context_, params);
> > + algo->prepare(context_, frame, frameContext, params);
> >
> > paramsBufferReady.emit(frame);
> > context_.frameContext.frameCount++;
>
> Looks good
> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list