@@ -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;
@@ -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;
@@ -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
@@ -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;
@@ -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
@@ -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 */
@@ -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. */
@@ -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;
@@ -574,8 +574,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);
}
@@ -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
@@ -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)
{
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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)
@@ -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_;
@@ -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;
@@ -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 */
@@ -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)
@@ -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_;
@@ -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;
@@ -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 */
@@ -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)
@@ -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_;
@@ -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)
@@ -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_;
@@ -301,6 +301,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);
+
rkisp1_params_cfg *params =
reinterpret_cast<rkisp1_params_cfg *>(
mappedBuffers_.at(bufferId).planes()[0].data());
@@ -309,7 +311,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++;