[libcamera-devel] [PATCH v2 08/10] ipa: libipa: algorithm: prepare(): Pass frame and frame Context

Jacopo Mondi jacopo at jmondi.org
Thu Aug 11 10:05:11 CEST 2022


Hi Umang

On Thu, Aug 11, 2022 at 12:30:36PM +0530, Umang Jain wrote:
> Hi Jacopo
>
> Thank you for the patch.
>
> On 8/5/22 19:23, Jacopo Mondi via libcamera-devel wrote:
> > From: Kieran Bingham via libcamera-devel <libcamera-devel at lists.libcamera.org>
> >
> > Pass the current frame number, and the current FrameContext for calls to
> > prepare.
> >
> > Until there is a Frame Context Queue in the RKISP1 the FrameContext will
>
>
> I think there is FCQueue in RkISP1 now, so should this commit message be
> updated accordingly?
>

Ah, ups. Thanks for spotting, I missed it in the review of the first
RFC version!

Thanks
  j

> > be a nullptr, and must not be dereferenced until the queue is
> > implemented.
> >
> > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> >
> >   - Obtain and use the RKISP1FrameContext Queue entry for IPARkISP1::fillParamsBuffer
> >
> > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > ---
> >   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            | 5 ++++-
> >   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               | 2 ++
> >   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/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                | 4 +++-
> >   28 files changed, 85 insertions(+), 20 deletions(-)
> >
> > diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
> > index fcbf8e557b10..1faf92969ee5 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]] unsigned int frame,
> > +		 [[maybe_unused]] IPU3FrameContext &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 7a5aeb1b6bf4..4e2bbd08c3bf 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, unsigned int frame,
> > +		     IPU3FrameContext &frameContext,
> > +		     ipu3_uapi_params *params) override;
> >   	void process(IPAContext &context, IPU3FrameContext &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 45f8e5f29119..b110ad404fd1 100644
> > --- a/src/ipa/ipu3/algorithms/awb.cpp
> > +++ b/src/ipa/ipu3/algorithms/awb.cpp
> > @@ -430,7 +430,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]] unsigned int frame,
> > +		  [[maybe_unused]] IPU3FrameContext &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 28e39620fd59..731e5bae17de 100644
> > --- a/src/ipa/ipu3/algorithms/awb.h
> > +++ b/src/ipa/ipu3/algorithms/awb.h
> > @@ -39,7 +39,10 @@ public:
> >   	~Awb();
> >   	int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
> > -	void prepare(IPAContext &context, ipu3_uapi_params *params) override;
> > +
> > +	void prepare(IPAContext &context, unsigned int frame,
> > +		     IPU3FrameContext &frameContext,
> > +		     ipu3_uapi_params *params) override;
> >   	void process(IPAContext &context, IPU3FrameContext &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 78ab7bff549f..7b0d720a5970 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 context The shared IPA context
> > + * \param[in] frame The frame context sequence number
> > + * \param[in] frameContext The FrameContext for this frame
> >    * \param 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]] unsigned int frame,
> > +				   [[maybe_unused]] IPU3FrameContext &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..36388b267eea 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, unsigned int frame,
> > +		     IPU3FrameContext &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 977741c5a4d4..0951db43f53f 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 context The shared IPA context
> > + * \param[in] frame The frame context sequence number
> > + * \param[in] frameContext The FrameContext for this frame
> >    * \param 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]] unsigned int frame,
> > +			  [[maybe_unused]] IPU3FrameContext &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 8cce38c742a6..cfb3de01b7f3 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, unsigned int frame,
> > +		     IPU3FrameContext &frameContext, ipu3_uapi_params *params) override;
> >   	void process(IPAContext &context, IPU3FrameContext &frameContext,
> >   		     const ipu3_uapi_stats_3a *stats) override;
> > diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> > index 24839fd1edee..ffb9ea8c5971 100644
> > --- a/src/ipa/ipu3/ipu3.cpp
> > +++ b/src/ipa/ipu3/ipu3.cpp
> > @@ -538,8 +538,10 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
> >   	 */
> >   	params->use = {};
> > +	IPU3FrameContext frameContext = context_.frameContexts.get(frame);
>
> Won't this copy IPU3FrameContext ? I think here we need
>
>     IPU3FrameContext &frameContext = context_.frameContexts.get(frame);
>

Ah good catch!

> > +
> >   	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..379207f1657e 100644
> > --- a/src/ipa/libipa/algorithm.h
> > +++ b/src/ipa/libipa/algorithm.h
> > @@ -38,6 +38,8 @@ public:
> >   	}
> >   	virtual void prepare([[maybe_unused]] typename Module::Context &context,
> > +			     [[maybe_unused]] unsigned int frame,
> > +			     [[maybe_unused]] typename Module::FrameContext &frameContext,
> >   			     [[maybe_unused]] typename Module::Params *params)
> >   	{
> >   	}
> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
> > index 40d27963ef68..2d436511caf7 100644
> > --- a/src/ipa/rkisp1/algorithms/agc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp
> > @@ -322,7 +322,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]] unsigned int frame,
> > +		  [[maybe_unused]] RKISP1FrameContext &frameContext,
> > +		  rkisp1_params_cfg *params)
> >   {
> >   	if (context.activeState.frameCount > 0)
> >   		return;
> > diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h
> > index af7fe2740908..97ca0e31558c 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, unsigned int frame,
> > +		     RKISP1FrameContext &frameContext,
> > +		     rkisp1_params_cfg *params) override;
> >   	void process(IPAContext &context, RKISP1FrameContext &frameContext,
> >   		     const rkisp1_stat_buffer *stats) override;
> > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> > index 3beafb73ca33..1af6d98c5252 100644
> > --- a/src/ipa/rkisp1/algorithms/awb.cpp
> > +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> > @@ -70,7 +70,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]] unsigned int frame,
> > +		  [[maybe_unused]] RKISP1FrameContext &frameContext,
> > +		  rkisp1_params_cfg *params)
> >   {
> >   	params->others.awb_gain_config.gain_green_b = 256 * context.activeState.awb.gains.green;
> >   	params->others.awb_gain_config.gain_blue = 256 * context.activeState.awb.gains.blue;
> > diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h
> > index 5954034b8142..82d5ce1b1818 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, unsigned int frame,
> > +		     RKISP1FrameContext &frameContext,
> > +		     rkisp1_params_cfg *params) override;
> >   	void process(IPAContext &context, RKISP1FrameContext &frameCtx,
> >   		     const rkisp1_stat_buffer *stats) override;
> > diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp
> > index 4d55a2d529cb..93c7e3145fa2 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]] unsigned int frame,
> > +				   [[maybe_unused]] RKISP1FrameContext &frameContext,
> >   				   rkisp1_params_cfg *params)
> >   {
> >   	if (context.activeState.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h
> > index 5fc3a80fb638..1afa12f6b46e 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, unsigned int frame,
> > +		     RKISP1FrameContext &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 a3b778d1c908..edaf2d10e850 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]] unsigned int frame,
> > +			      [[maybe_unused]] RKISP1FrameContext &frameContext,
> >   			      rkisp1_params_cfg *params)
> >   {
> >   	auto &cproc = context.activeState.cproc;
> > diff --git a/src/ipa/rkisp1/algorithms/cproc.h b/src/ipa/rkisp1/algorithms/cproc.h
> > index 4b7e4064d7e8..fde83f3c965c 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, unsigned int frame,
> > +		     RKISP1FrameContext &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 93d37b1dae44..9ba03653afdc 100644
> > --- a/src/ipa/rkisp1/algorithms/dpcc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/dpcc.cpp
> > @@ -232,6 +232,8 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
> >    * \copydoc libcamera::ipa::Algorithm::prepare
> >    */
> >   void DefectPixelClusterCorrection::prepare(IPAContext &context,
> > +					   [[maybe_unused]] unsigned int frame,
> > +					   [[maybe_unused]] RKISP1FrameContext &frameContext,
> >   					   rkisp1_params_cfg *params)
> >   {
> >   	if (context.activeState.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/dpcc.h b/src/ipa/rkisp1/algorithms/dpcc.h
> > index a363f7bee0a7..ca9df9fc38dc 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, unsigned int frame,
> > +		     RKISP1FrameContext &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 bc7fc1f32f34..f6577046442a 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]] unsigned int frame,
> > +		     [[maybe_unused]] RKISP1FrameContext &frameContext,
> > +		     rkisp1_params_cfg *params)
> >   {
> >   	auto &filter = context.activeState.filter;
> > diff --git a/src/ipa/rkisp1/algorithms/filter.h b/src/ipa/rkisp1/algorithms/filter.h
> > index 9eb170eb7da1..1fbe785a3cab 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, unsigned int frame,
> > +		     RKISP1FrameContext &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 dd9974627cd2..77d841cfbf82 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]] unsigned int frame,
> > +				       [[maybe_unused]] RKISP1FrameContext &frameContext,
> >   				       rkisp1_params_cfg *params)
> >   {
> >   	if (context.activeState.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/gsl.h b/src/ipa/rkisp1/algorithms/gsl.h
> > index db287dc280dc..fe74ae10e099 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, unsigned int frame,
> > +		     RKISP1FrameContext &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 4ed467086199..cd8fcbe66b9b 100644
> > --- a/src/ipa/rkisp1/algorithms/lsc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp
> > @@ -123,6 +123,8 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,
> >    * \copydoc libcamera::ipa::Algorithm::prepare
> >    */
> >   void LensShadingCorrection::prepare(IPAContext &context,
> > +				    [[maybe_unused]] unsigned int frame,
> > +				    [[maybe_unused]] RKISP1FrameContext &frameContext,
> >   				    rkisp1_params_cfg *params)
> >   {
> >   	if (context.activeState.frameCount > 0)
> > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h
> > index fdb2ec1dd27d..fafb80b329ee 100644
> > --- a/src/ipa/rkisp1/algorithms/lsc.h
> > +++ b/src/ipa/rkisp1/algorithms/lsc.h
> > @@ -20,7 +20,9 @@ public:
> >   	~LensShadingCorrection() = default;
> >   	int init(IPAContext &context, const YamlObject &tuningData) override;
> > -	void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
> > +	void prepare(IPAContext &context, unsigned int frame,
> > +		     RKISP1FrameContext &frameContext,
> > +		     rkisp1_params_cfg *params) override;
> >   private:
> >   	bool initialized_;
> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > index 2c7fdde55f49..f3512647a833 100644
> > --- a/src/ipa/rkisp1/rkisp1.cpp
> > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > @@ -302,6 +302,8 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
> >   void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
> >   {
> > +	RKISP1FrameContext &frameContext = context_.frameContexts.get(frame);
>
>
> This seems correct :-)
>
> With the IPU3FrameContext .get() fixed,
>
> Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
>
> > +
> >   	rkisp1_params_cfg *params =
> >   		reinterpret_cast<rkisp1_params_cfg *>(
> >   			mappedBuffers_.at(bufferId).planes()[0].data());
> > @@ -310,7 +312,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_.activeState.frameCount++;


More information about the libcamera-devel mailing list