diff options
Diffstat (limited to 'src/ipa/raspberrypi/controller/rpi/sdn.cpp')
-rw-r--r-- | src/ipa/raspberrypi/controller/rpi/sdn.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/ipa/raspberrypi/controller/rpi/sdn.cpp b/src/ipa/raspberrypi/controller/rpi/sdn.cpp index aa82830b..93845509 100644 --- a/src/ipa/raspberrypi/controller/rpi/sdn.cpp +++ b/src/ipa/raspberrypi/controller/rpi/sdn.cpp @@ -1,16 +1,21 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* - * Copyright (C) 2019, Raspberry Pi (Trading) Limited + * Copyright (C) 2019-2021, Raspberry Pi (Trading) Limited * * sdn.cpp - SDN (spatial denoise) control algorithm */ +#include <libcamera/base/log.h> + +#include "../denoise_status.h" #include "../noise_status.h" -#include "../sdn_status.h" #include "sdn.hpp" using namespace RPiController; +using namespace libcamera; + +LOG_DEFINE_CATEGORY(RPiSdn) // Calculate settings for the spatial denoise block using the noise profile in // the image metadata. @@ -18,7 +23,7 @@ using namespace RPiController; #define NAME "rpi.sdn" Sdn::Sdn(Controller *controller) - : Algorithm(controller) + : DenoiseAlgorithm(controller), mode_(DenoiseMode::ColourOff) { } @@ -40,19 +45,26 @@ void Sdn::Prepare(Metadata *image_metadata) struct NoiseStatus noise_status = {}; noise_status.noise_slope = 3.0; // in case no metadata if (image_metadata->Get("noise.status", noise_status) != 0) - RPI_WARN("Sdn: no noise profile found"); - RPI_LOG("Noise profile: constant " << noise_status.noise_constant - << " slope " - << noise_status.noise_slope); - struct SdnStatus status; + LOG(RPiSdn, Warning) << "no noise profile found"; + LOG(RPiSdn, Debug) + << "Noise profile: constant " << noise_status.noise_constant + << " slope " << noise_status.noise_slope; + struct DenoiseStatus status; status.noise_constant = noise_status.noise_constant * deviation_; status.noise_slope = noise_status.noise_slope * deviation_; status.strength = strength_; - image_metadata->Set("sdn.status", status); - RPI_LOG("Sdn: programmed constant " << status.noise_constant - << " slope " << status.noise_slope - << " strength " - << status.strength); + status.mode = static_cast<std::underlying_type_t<DenoiseMode>>(mode_); + image_metadata->Set("denoise.status", status); + LOG(RPiSdn, Debug) + << "programmed constant " << status.noise_constant + << " slope " << status.noise_slope + << " strength " << status.strength; +} + +void Sdn::SetMode(DenoiseMode mode) +{ + // We only distinguish between off and all other modes. + mode_ = mode; } // Register algorithm with the system. |