@@ -227,6 +227,26 @@ void AwbAlgorithm::queueRequest(awb::ActiveState &state,
frameContext.temperatureK = state.manual.temperatureK;
}
+/**
+ * \brief Prepare the AWB frame context ready for usage
+ * \param[in] state The AWB specific active state shared across frames
+ * \param[in] frame The frame number to apply the control values
+ * \param[in] frameContext The current frame's AWB specific context
+ */
+void AwbAlgorithm::prepare(awb::ActiveState &state,
+ [[maybe_unused]] const uint32_t frame,
+ awb::FrameContext &frameContext)
+{
+ /*
+ * When AutoAWB is enabled, this is the latest opportunity to take
+ * the most recent and up to date desired AWB gains.
+ */
+ if (frameContext.autoEnabled) {
+ frameContext.gains = state.automatic.gains;
+ frameContext.temperatureK = state.automatic.temperatureK;
+ }
+}
+
/**
* \fn AwbAlgorithm::calculateAwb()
* \brief Calculate AWB data from the given statistics
@@ -73,6 +73,10 @@ public:
awb::FrameContext &frameContext,
const ControlList &controls);
+ void prepare(awb::ActiveState &state,
+ [[maybe_unused]] const uint32_t frame,
+ awb::FrameContext &frameContext);
+
virtual AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) = 0;
virtual std::optional<RGB<double>> gainsFromColourTemperature(double colourTemperature) = 0;
@@ -160,15 +160,8 @@ void Awb::queueRequest(IPAContext &context,
void Awb::prepare(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext, RkISP1Params *params)
{
- /*
- * This is the latest time we can read the active state. This is the
- * most up-to-date automatic values we can read.
- */
- if (frameContext.awb.autoEnabled) {
- const auto &awb = context.activeState.awb;
- frameContext.awb.gains = awb.automatic.gains;
- frameContext.awb.temperatureK = awb.automatic.temperatureK;
- }
+ awbAlgo_->prepare(context.activeState.awb,
+ frame, frameContext.awb);
auto gainConfig = params->block<BlockType::AwbGain>();
gainConfig.setEnabled(true);
@@ -124,18 +124,12 @@ void Awb::queueRequest(IPAContext &context,
}
void Awb::prepare(IPAContext &context,
- [[maybe_unused]] const uint32_t frame,
+ const uint32_t frame,
IPAFrameContext &frameContext,
DebayerParams *params)
{
- /*
- * When AutoAWB is enabled, this is the latest opportunity to take
- * the most recent and up to date desired AWB gains.
- */
- if (frameContext.awb.autoEnabled) {
- frameContext.awb.gains = context.activeState.awb.automatic.gains;
- frameContext.awb.temperatureK = context.activeState.awb.automatic.temperatureK;
- }
+ awbAlgo_->prepare(context.activeState.awb,
+ frame, frameContext.awb);
params->gains = frameContext.awb.gains;
}
Move the common duplicated code from both the simple and rkisp1 IPA modules and add these to the prepare function of libipa awb module. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- src/ipa/libipa/awb.cpp | 20 ++++++++++++++++++++ src/ipa/libipa/awb.h | 4 ++++ src/ipa/rkisp1/algorithms/awb.cpp | 11 ++--------- src/ipa/simple/algorithms/awb.cpp | 12 +++--------- 4 files changed, 29 insertions(+), 18 deletions(-)