summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/vc4/vc4.cpp
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-10-16 15:36:29 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-10-24 14:11:28 +0100
commit4e7c26b19724ffc1174bb131de2b56d85e83127f (patch)
tree5766867736b2f7d802d34ba49f13d1a405a37a2a /src/ipa/rpi/vc4/vc4.cpp
parentedb48a1337114e0b92caa54598397ce69c63a528 (diff)
ipa: rpi: vc4: Move denoise control handling into the VC4 derived IPA
Since noise control handling differs between the VC4 and PiSP IPAs, move the current denoise control handler from ipa base into the vc4 IPA derived class. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/vc4/vc4.cpp')
-rw-r--r--src/ipa/rpi/vc4/vc4.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp
index 4a4d720c..c4baf04f 100644
--- a/src/ipa/rpi/vc4/vc4.cpp
+++ b/src/ipa/rpi/vc4/vc4.cpp
@@ -11,6 +11,7 @@
#include <linux/bcm2835-isp.h>
#include <libcamera/base/log.h>
+#include <libcamera/control_ids.h>
#include <libcamera/ipa/ipa_module_info.h>
#include "common/ipa_base.h"
@@ -247,9 +248,39 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)
return statistics;
}
-void IpaVc4::handleControls([[maybe_unused]] const ControlList &controls)
+void IpaVc4::handleControls(const ControlList &controls)
{
- /* No controls require any special updates to the hardware configuration. */
+ static const std::map<int32_t, RPiController::DenoiseMode> DenoiseModeTable = {
+ { controls::draft::NoiseReductionModeOff, RPiController::DenoiseMode::Off },
+ { controls::draft::NoiseReductionModeFast, RPiController::DenoiseMode::ColourFast },
+ { controls::draft::NoiseReductionModeHighQuality, RPiController::DenoiseMode::ColourHighQuality },
+ { controls::draft::NoiseReductionModeMinimal, RPiController::DenoiseMode::ColourOff },
+ { controls::draft::NoiseReductionModeZSL, RPiController::DenoiseMode::ColourHighQuality },
+ };
+
+ for (auto const &ctrl : controls) {
+ switch (ctrl.first) {
+ case controls::NOISE_REDUCTION_MODE: {
+ RPiController::DenoiseAlgorithm *sdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(
+ controller_.getAlgorithm("SDN"));
+ /* Some platforms may have a combined "denoise" algorithm instead. */
+ if (!sdn)
+ sdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(
+ controller_.getAlgorithm("denoise"));
+ if (!sdn) {
+ LOG(IPARPI, Warning)
+ << "Could not set NOISE_REDUCTION_MODE - no SDN algorithm";
+ return;
+ }
+
+ int32_t idx = ctrl.second.get<int32_t>();
+ auto mode = DenoiseModeTable.find(idx);
+ if (mode != DenoiseModeTable.end())
+ sdn->setMode(mode->second);
+ break;
+ }
+ }
+ }
}
bool IpaVc4::validateIspControls()