Message ID | 20220721121310.1286862-9-kieran.bingham@ideasonboard.com |
---|---|
State | Superseded |
Delegated to: | Kieran Bingham |
Headers | show |
Series |
|
Related | show |
Hi Kieran On Thu, Jul 21, 2022 at 01:13:06PM +0100, Kieran Bingham via libcamera-devel wrote: > 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 > be a nullptr, and must not be dereferenced until the queue is > implemented. > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > - Obtain and use the RKISP1FrameContext Queue entry for IPARkISP1::fillParamsBuffer > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > 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/rkisp1.cpp | 4 +++- > 18 files changed, 58 insertions(+), 14 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..6d1084066ed4 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 Frame Context for this frame Either 'frame' or 'FrameContext' > * \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..9ca3f471cbaf 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 Frame Context for this frame Ditto > * \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 489e51bc6cf7..5663b1f4bb51 100644 > --- a/src/ipa/ipu3/ipu3.cpp > +++ b/src/ipa/ipu3/ipu3.cpp > @@ -539,8 +539,10 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) > */ > params->use = {}; > > + IPU3FrameContext frameContext = context_.frameContexts.get(frame); > + > 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 8549fe3f6269..bc7c130d3e09 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 Frame Context for this frame same here Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > * \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 adbcf69adb4f..ce5c7cc491d8 100644 > --- a/src/ipa/libipa/algorithm.h > +++ b/src/ipa/libipa/algorithm.h > @@ -36,6 +36,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 1a291bdf3636..7844cd2e3b47 100644 > --- a/src/ipa/rkisp1/algorithms/agc.h > +++ b/src/ipa/rkisp1/algorithms/agc.h > @@ -28,7 +28,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 259b85eebdb4..8fd5b706861a 100644 > --- a/src/ipa/rkisp1/algorithms/awb.h > +++ b/src/ipa/rkisp1/algorithms/awb.h > @@ -22,7 +22,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 c2649dd7736e..1b2abfeef800 100644 > --- a/src/ipa/rkisp1/algorithms/blc.h > +++ b/src/ipa/rkisp1/algorithms/blc.h > @@ -24,7 +24,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/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp > index a2b7b25a53e5..f97484ce5030 100644 > --- a/src/ipa/rkisp1/rkisp1.cpp > +++ b/src/ipa/rkisp1/rkisp1.cpp > @@ -275,6 +275,8 @@ void IPARkISP1::queueRequest([[maybe_unused]] const uint32_t frame, > > void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) > { > + RKISP1FrameContext &frameContext = context_.frameContexts.get(frame); > + > rkisp1_params_cfg *params = > reinterpret_cast<rkisp1_params_cfg *>( > mappedBuffers_.at(bufferId).planes()[0].data()); > @@ -283,7 +285,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++; > -- > 2.34.1 >
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..6d1084066ed4 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 Frame Context 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..9ca3f471cbaf 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 Frame Context 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 489e51bc6cf7..5663b1f4bb51 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -539,8 +539,10 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) */ params->use = {}; + IPU3FrameContext frameContext = context_.frameContexts.get(frame); + 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 8549fe3f6269..bc7c130d3e09 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 Frame Context 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 adbcf69adb4f..ce5c7cc491d8 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -36,6 +36,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 1a291bdf3636..7844cd2e3b47 100644 --- a/src/ipa/rkisp1/algorithms/agc.h +++ b/src/ipa/rkisp1/algorithms/agc.h @@ -28,7 +28,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 259b85eebdb4..8fd5b706861a 100644 --- a/src/ipa/rkisp1/algorithms/awb.h +++ b/src/ipa/rkisp1/algorithms/awb.h @@ -22,7 +22,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 c2649dd7736e..1b2abfeef800 100644 --- a/src/ipa/rkisp1/algorithms/blc.h +++ b/src/ipa/rkisp1/algorithms/blc.h @@ -24,7 +24,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/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index a2b7b25a53e5..f97484ce5030 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -275,6 +275,8 @@ void IPARkISP1::queueRequest([[maybe_unused]] const uint32_t frame, void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) { + RKISP1FrameContext &frameContext = context_.frameContexts.get(frame); + rkisp1_params_cfg *params = reinterpret_cast<rkisp1_params_cfg *>( mappedBuffers_.at(bufferId).planes()[0].data()); @@ -283,7 +285,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++;