summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/algorithms/agc.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-10-22 01:21:05 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-11-09 23:43:56 +0200
commit02bc2a8a24baaff82d1c5f8cb5d9ab7d1afab426 (patch)
tree5ce8ec5c7a16bfc606912319162dc1a4ec7db6ff /src/ipa/rkisp1/algorithms/agc.cpp
parentbc0d9a6f5d51f5a60fe108778fe1eb1a7a39531f (diff)
ipa: Sort algorithm operations based on calling order
Reorder functions in the base ipa::Algorithm and its derived classes to match the calling order: queueRequest(), prepare() and process(). This makes the code flow easier to read. No functional change intended. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/ipa/rkisp1/algorithms/agc.cpp')
-rw-r--r--src/ipa/rkisp1/algorithms/agc.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
index b4fc7aed..11613d1c 100644
--- a/src/ipa/rkisp1/algorithms/agc.cpp
+++ b/src/ipa/rkisp1/algorithms/agc.cpp
@@ -108,6 +108,46 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
}
/**
+ * \copydoc libcamera::ipa::Algorithm::prepare
+ */
+void Agc::prepare(IPAContext &context, const uint32_t frame,
+ IPAFrameContext &frameContext, rkisp1_params_cfg *params)
+{
+ frameContext.agc.exposure = context.activeState.agc.exposure;
+ frameContext.agc.gain = context.activeState.agc.gain;
+
+ if (frame > 0)
+ return;
+
+ /* Configure the measurement window. */
+ params->meas.aec_config.meas_window = context.configuration.agc.measureWindow;
+ /* Use a continuous method for measure. */
+ params->meas.aec_config.autostop = RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0;
+ /* Estimate Y as (R + G + B) x (85/256). */
+ params->meas.aec_config.mode = RKISP1_CIF_ISP_EXP_MEASURING_MODE_1;
+
+ params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AEC;
+ params->module_ens |= RKISP1_CIF_ISP_MODULE_AEC;
+ params->module_en_update |= RKISP1_CIF_ISP_MODULE_AEC;
+
+ /* Configure histogram. */
+ params->meas.hst_config.meas_window = context.configuration.agc.measureWindow;
+ /* Produce the luminance histogram. */
+ params->meas.hst_config.mode = RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM;
+ /* Set an average weighted histogram. */
+ for (unsigned int histBin = 0; histBin < numHistBins_; histBin++)
+ params->meas.hst_config.hist_weight[histBin] = 1;
+ /* Step size can't be less than 3. */
+ params->meas.hst_config.histogram_predivider = 4;
+
+ /* Update the configuration for histogram. */
+ params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_HST;
+ /* Enable the histogram measure unit. */
+ params->module_ens |= RKISP1_CIF_ISP_MODULE_HST;
+ params->module_en_update |= RKISP1_CIF_ISP_MODULE_HST;
+}
+
+/**
* \brief Apply a filter on the exposure value to limit the speed of changes
* \param[in] exposureValue The target exposure from the AGC algorithm
*
@@ -348,46 +388,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
metadata.set(controls::FrameDuration, frameDuration.get<std::micro>());
}
-/**
- * \copydoc libcamera::ipa::Algorithm::prepare
- */
-void Agc::prepare(IPAContext &context, const uint32_t frame,
- IPAFrameContext &frameContext, rkisp1_params_cfg *params)
-{
- frameContext.agc.exposure = context.activeState.agc.exposure;
- frameContext.agc.gain = context.activeState.agc.gain;
-
- if (frame > 0)
- return;
-
- /* Configure the measurement window. */
- params->meas.aec_config.meas_window = context.configuration.agc.measureWindow;
- /* Use a continuous method for measure. */
- params->meas.aec_config.autostop = RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0;
- /* Estimate Y as (R + G + B) x (85/256). */
- params->meas.aec_config.mode = RKISP1_CIF_ISP_EXP_MEASURING_MODE_1;
-
- params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AEC;
- params->module_ens |= RKISP1_CIF_ISP_MODULE_AEC;
- params->module_en_update |= RKISP1_CIF_ISP_MODULE_AEC;
-
- /* Configure histogram. */
- params->meas.hst_config.meas_window = context.configuration.agc.measureWindow;
- /* Produce the luminance histogram. */
- params->meas.hst_config.mode = RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM;
- /* Set an average weighted histogram. */
- for (unsigned int histBin = 0; histBin < numHistBins_; histBin++)
- params->meas.hst_config.hist_weight[histBin] = 1;
- /* Step size can't be less than 3. */
- params->meas.hst_config.histogram_predivider = 4;
-
- /* Update the configuration for histogram. */
- params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_HST;
- /* Enable the histogram measure unit. */
- params->module_ens |= RKISP1_CIF_ISP_MODULE_HST;
- params->module_en_update |= RKISP1_CIF_ISP_MODULE_HST;
-}
-
REGISTER_IPA_ALGORITHM(Agc, "Agc")
} /* namespace ipa::rkisp1::algorithms */