summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipa/ipu3/algorithms/af.cpp4
-rw-r--r--src/ipa/ipu3/algorithms/af.h3
-rw-r--r--src/ipa/ipu3/algorithms/agc.cpp4
-rw-r--r--src/ipa/ipu3/algorithms/agc.h3
-rw-r--r--src/ipa/ipu3/algorithms/awb.cpp3
-rw-r--r--src/ipa/ipu3/algorithms/awb.h3
-rw-r--r--src/ipa/ipu3/algorithms/tone_mapping.cpp4
-rw-r--r--src/ipa/ipu3/algorithms/tone_mapping.h3
-rw-r--r--src/ipa/ipu3/ipu3.cpp14
-rw-r--r--src/ipa/libipa/algorithm.cpp5
-rw-r--r--src/ipa/libipa/algorithm.h3
-rw-r--r--src/ipa/rkisp1/algorithms/agc.cpp4
-rw-r--r--src/ipa/rkisp1/algorithms/agc.h3
-rw-r--r--src/ipa/rkisp1/algorithms/awb.cpp3
-rw-r--r--src/ipa/rkisp1/algorithms/awb.h5
-rw-r--r--src/ipa/rkisp1/rkisp1.cpp17
16 files changed, 44 insertions, 37 deletions
diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp
index 75632aa3..5a0452a5 100644
--- a/src/ipa/ipu3/algorithms/af.cpp
+++ b/src/ipa/ipu3/algorithms/af.cpp
@@ -409,6 +409,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)
* \param[in] frame The frame context sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The statistics buffer of IPU3
+ * \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* Ideally, a clear image also has a relatively higher contrast. So, every
* image for each focus step should be tested to find an optimal focus step.
@@ -423,7 +424,8 @@ bool Af::afIsOutOfFocus(IPAContext &context)
*/
void Af::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats)
+ const ipu3_uapi_stats_3a *stats,
+ [[maybe_unused]] ControlList &metadata)
{
/* Evaluate the AF buffer length */
uint32_t afRawBufferLen = context.configuration.af.afGrid.width *
diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h
index 89d37ac1..c6168e30 100644
--- a/src/ipa/ipu3/algorithms/af.h
+++ b/src/ipa/ipu3/algorithms/af.h
@@ -36,7 +36,8 @@ public:
ipu3_uapi_params *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats) override;
+ const ipu3_uapi_stats_3a *stats,
+ ControlList &metadata) override;
private:
void afCoarseScan(IPAContext &context);
diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp
index a1a3c38f..f4e559bf 100644
--- a/src/ipa/ipu3/algorithms/agc.cpp
+++ b/src/ipa/ipu3/algorithms/agc.cpp
@@ -320,13 +320,15 @@ double Agc::estimateLuminance(IPAActiveState &activeState,
* \param[in] frame The current frame sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The IPU3 statistics and ISP results
+ * \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* Identify the current image brightness, and use that to estimate the optimal
* new exposure and gain for the scene.
*/
void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats)
+ const ipu3_uapi_stats_3a *stats,
+ [[maybe_unused]] ControlList &metadata)
{
/*
* Estimate the gain needed to have the proportion of pixels in a given
diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h
index 59b4b984..9d6e3ff1 100644
--- a/src/ipa/ipu3/algorithms/agc.h
+++ b/src/ipa/ipu3/algorithms/agc.h
@@ -30,7 +30,8 @@ public:
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats) override;
+ const ipu3_uapi_stats_3a *stats,
+ ControlList &metadata) override;
private:
double measureBrightness(const ipu3_uapi_stats_3a *stats,
diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index 0dbd7d4c..6452b6a1 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -389,7 +389,8 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)
*/
void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats)
+ const ipu3_uapi_stats_3a *stats,
+ [[maybe_unused]] ControlList &metadata)
{
calculateWBGains(stats);
diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h
index 28e2d38a..7a70854e 100644
--- a/src/ipa/ipu3/algorithms/awb.h
+++ b/src/ipa/ipu3/algorithms/awb.h
@@ -44,7 +44,8 @@ public:
ipu3_uapi_params *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats) override;
+ const ipu3_uapi_stats_3a *stats,
+ ControlList &metadata) override;
private:
/* \todo Make these structs available to all the ISPs ? */
diff --git a/src/ipa/ipu3/algorithms/tone_mapping.cpp b/src/ipa/ipu3/algorithms/tone_mapping.cpp
index eac3d406..a169894c 100644
--- a/src/ipa/ipu3/algorithms/tone_mapping.cpp
+++ b/src/ipa/ipu3/algorithms/tone_mapping.cpp
@@ -79,13 +79,15 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
* \param[in] frame The current frame sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The IPU3 statistics and ISP results
+ * \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* The tone mapping look up table is generated as an inverse power curve from
* our gamma setting.
*/
void ToneMapping::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
- [[maybe_unused]] const ipu3_uapi_stats_3a *stats)
+ [[maybe_unused]] const ipu3_uapi_stats_3a *stats,
+ [[maybe_unused]] ControlList &metadata)
{
/*
* Hardcode gamma to 1.1 as a default for now.
diff --git a/src/ipa/ipu3/algorithms/tone_mapping.h b/src/ipa/ipu3/algorithms/tone_mapping.h
index 822e5168..5ae35da5 100644
--- a/src/ipa/ipu3/algorithms/tone_mapping.h
+++ b/src/ipa/ipu3/algorithms/tone_mapping.h
@@ -23,7 +23,8 @@ public:
IPAFrameContext &frameContext, ipu3_uapi_params *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
- const ipu3_uapi_stats_3a *stats) override;
+ const ipu3_uapi_stats_3a *stats,
+ ControlList &metadata) override;
private:
double gamma_;
diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 891643e0..bc0f6007 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -630,22 +630,22 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,
double lineDuration = context_.configuration.sensor.lineDuration.get<std::micro>();
int32_t vBlank = context_.configuration.sensor.defVBlank;
- ControlList ctrls(controls::controls);
+ ControlList metadata(controls::controls);
for (auto const &algo : algorithms())
- algo->process(context_, frame, frameContext, stats);
+ algo->process(context_, frame, frameContext, stats, metadata);
setControls(frame);
/* \todo Use VBlank value calculated from each frame exposure. */
int64_t frameDuration = (vBlank + sensorInfo_.outputSize.height) * lineDuration;
- ctrls.set(controls::FrameDuration, frameDuration);
+ metadata.set(controls::FrameDuration, frameDuration);
- ctrls.set(controls::AnalogueGain, frameContext.sensor.gain);
+ metadata.set(controls::AnalogueGain, frameContext.sensor.gain);
- ctrls.set(controls::ColourTemperature, context_.activeState.awb.temperatureK);
+ metadata.set(controls::ColourTemperature, context_.activeState.awb.temperatureK);
- ctrls.set(controls::ExposureTime, frameContext.sensor.exposure * lineDuration);
+ metadata.set(controls::ExposureTime, frameContext.sensor.exposure * lineDuration);
/*
* \todo The Metadata provides a path to getting extended data
@@ -655,7 +655,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,
* likely want to avoid putting platform specific metadata in.
*/
- metadataReady.emit(frame, ctrls);
+ metadataReady.emit(frame, metadata);
}
/**
diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp
index 55abddab..71f58384 100644
--- a/src/ipa/libipa/algorithm.cpp
+++ b/src/ipa/libipa/algorithm.cpp
@@ -107,11 +107,12 @@ namespace ipa {
* \param[in] frame The frame context sequence number
* \param[in] frameContext The current frame's context
* \param[in] stats The IPA statistics and ISP results
+ * \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* This function is called while camera is running for every frame processed by
* the ISP, to process statistics generated from that frame by the ISP.
- * Algorithms shall use this data to run calculations and update their state
- * accordingly.
+ * Algorithms shall use this data to run calculations, update their state
+ * accordingly, and fill the frame metadata.
*
* Processing shall not take an undue amount of time, and any extended or
* computationally expensive calculations or operations must be handled
diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h
index d8601f9c..38b3231c 100644
--- a/src/ipa/libipa/algorithm.h
+++ b/src/ipa/libipa/algorithm.h
@@ -55,7 +55,8 @@ public:
virtual void process([[maybe_unused]] typename Module::Context &context,
[[maybe_unused]] const uint32_t frame,
[[maybe_unused]] typename Module::FrameContext &frameContext,
- [[maybe_unused]] const typename Module::Stats *stats)
+ [[maybe_unused]] const typename Module::Stats *stats,
+ [[maybe_unused]] ControlList &metadata)
{
}
};
diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index 04062a36..37cd10f9 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -283,12 +283,14 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const
* \param[in] frame The frame context sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The RKISP1 statistics and ISP results
+ * \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* Identify the current image brightness, and use that to estimate the optimal
* new exposure and gain for the scene.
*/
void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
- IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats)
+ IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats,
+ [[maybe_unused]] ControlList &metadata)
{
/*
* \todo Verify that the exposure and gain applied by the sensor for
diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h
index 9ad5c32f..da4d2d4e 100644
--- a/src/ipa/rkisp1/algorithms/agc.h
+++ b/src/ipa/rkisp1/algorithms/agc.h
@@ -31,7 +31,8 @@ public:
rkisp1_params_cfg *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
- const rkisp1_stat_buffer *stats) override;
+ const rkisp1_stat_buffer *stats,
+ ControlList &metadata) override;
private:
void computeExposure(IPAContext &Context, IPAFrameContext &frameContext,
diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index 3349948a..f597ded8 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -208,7 +208,8 @@ void Awb::queueRequest(IPAContext &context,
void Awb::process(IPAContext &context,
[[maybe_unused]] const uint32_t frame,
IPAFrameContext &frameContext,
- const rkisp1_stat_buffer *stats)
+ const rkisp1_stat_buffer *stats,
+ [[maybe_unused]] ControlList &metadata)
{
const rkisp1_cif_isp_stat *params = &stats->params;
const rkisp1_cif_isp_awb_stat *awb = &params->awb;
diff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h
index d76b5382..f5633b11 100644
--- a/src/ipa/rkisp1/algorithms/awb.h
+++ b/src/ipa/rkisp1/algorithms/awb.h
@@ -27,8 +27,9 @@ public:
IPAFrameContext &frameContext,
const ControlList &controls) override;
void process(IPAContext &context, const uint32_t frame,
- IPAFrameContext &frameCtx,
- const rkisp1_stat_buffer *stats) override;
+ IPAFrameContext &frameContext,
+ const rkisp1_stat_buffer *stats,
+ ControlList &metadata) override;
private:
uint32_t estimateCCT(double red, double green, double blue);
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index ba3c547e..494d8c89 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -69,7 +69,6 @@ protected:
private:
void setControls(unsigned int frame);
- void prepareMetadata(unsigned int frame, unsigned int aeState);
std::map<unsigned int, FrameBuffer> buffers_;
std::map<unsigned int, MappedFrameBuffer> mappedBuffers_;
@@ -338,14 +337,14 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
frameContext.sensor.gain =
camHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());
- unsigned int aeState = 0;
+ ControlList metadata(controls::controls);
for (auto const &algo : algorithms())
- algo->process(context_, frame, frameContext, stats);
+ algo->process(context_, frame, frameContext, stats, metadata);
setControls(frame);
- prepareMetadata(frame, aeState);
+ metadataReady.emit(frame, metadata);
}
void IPARkISP1::setControls(unsigned int frame)
@@ -366,16 +365,6 @@ void IPARkISP1::setControls(unsigned int frame)
setSensorControls.emit(frame, ctrls);
}
-void IPARkISP1::prepareMetadata(unsigned int frame, unsigned int aeState)
-{
- ControlList ctrls(controls::controls);
-
- if (aeState)
- ctrls.set(controls::AeLocked, aeState == 2);
-
- metadataReady.emit(frame, ctrls);
-}
-
} /* namespace ipa::rkisp1 */
/*