@@ -134,6 +134,18 @@ Agc::Agc()
supportsRaw_ = true;
}
+const std::set<ipa::AlgorithmDependency> &Agc::dependencies() const
+{
+ static const std::set<AlgorithmDependency> dependencies = {
+ {
+ .target = "Compress",
+ .step = AlgorithmStep::Configure,
+ .type = AlgorithmDependency::Before,
+ }
+ };
+ return dependencies;
+}
+
/**
* \brief Initialise the AGC algorithm from tuning files
* \param[in] context The shared IPA context
@@ -173,22 +185,19 @@ int Agc::init(IPAContext &context, const ValueNode &tuningData)
*/
int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)
{
- int ret = agc_.configure(context.configuration.agc, context.activeState.agc, {
- .sensorInfo = context.sensorInfo,
- .sensorControls = context.sensorControls,
- .ctrlMap = context.ctrlMap,
- .autoAllowed = !context.configuration.raw,
- /*
- * \todo The Compress algo must come after Agc in the tuning
- * file to pick up the digital gain in prepare(). But as it is
- * after Agc we can't query
- * context.configuration.compress.supported here as the Compress
- * algo is not configured yet. Therefore enable digital gain
- * unconditionally for now. It won't effectively be enabled if
- * the tuning file doesn't contain a maxDigitalGain > 1.
- */
- .maxDigitalGain = kAgcMaxDigitalGain
- });
+ int ret = agc_.configure(
+ context.configuration.agc,
+ context.activeState.agc,
+ {
+ .sensorInfo = context.sensorInfo,
+ .sensorControls = context.sensorControls,
+ .ctrlMap = context.ctrlMap,
+ .autoAllowed = !context.configuration.raw,
+ .maxDigitalGain = context.configuration.compress.supported
+ ? kAgcMaxDigitalGain
+ : 1.0,
+ });
+
if (ret)
return ret;
@@ -41,6 +41,8 @@ public:
const rkisp1_stat_buffer *stats,
ControlList &metadata) override;
+ virtual const std::set<AlgorithmDependency> &dependencies() const override;
+
private:
int parseMeteringModes(IPAContext &context, const ValueNode &tuningData);
uint8_t computeHistogramPredivider(const Size &size,
@@ -44,6 +44,23 @@ LOG_DEFINE_CATEGORY(RkISP1Compress)
constexpr static int kRkISP1CompressInBits = 20;
constexpr static int kRkISP1CompressOutBits = 12;
+const std::set<ipa::AlgorithmDependency> &Compress::dependencies() const
+{
+ static const std::set<AlgorithmDependency> dependencies = {
+ {
+ .target = "Agc",
+ .step = AlgorithmStep::Prepare,
+ .type = AlgorithmDependency::Before,
+ },
+ {
+ .target = "Agc",
+ .step = AlgorithmStep::Process,
+ .type = AlgorithmDependency::Before,
+ }
+ };
+ return dependencies;
+}
+
/**
* \copydoc libcamera::ipa::Algorithm::configure
*/
@@ -24,6 +24,8 @@ public:
void prepare(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
RkISP1Params *params) override;
+
+ const std::set<ipa::AlgorithmDependency> &dependencies() const override;
};
} /* namespace ipa::rkisp1::algorithms */
Compress::configure() must run before Agc::configure(), so that Agc can check if compress (and therefore digital gain) is available. Agc::prepare() must run before Compress::prepare(), so that Agc can store the correct digital gain for compress in the frame comntext. Model these dependency and remove the hardcoded enablement of digital gain. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- src/ipa/rkisp1/algorithms/agc.cpp | 41 +++++++++++++++++++++------------- src/ipa/rkisp1/algorithms/agc.h | 2 ++ src/ipa/rkisp1/algorithms/compress.cpp | 17 ++++++++++++++ src/ipa/rkisp1/algorithms/compress.h | 2 ++ 4 files changed, 46 insertions(+), 16 deletions(-)