summaryrefslogtreecommitdiff
path: root/src/ipa/rpi/controller/rpi/denoise.h
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2023-10-13 08:48:39 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-10-18 11:01:23 +0100
commitac232470fb3182b8b6299a7d317681d540561d5d (patch)
treee341e1034bf38b840638788524b141e93d607cfd /src/ipa/rpi/controller/rpi/denoise.h
parent0ff20bf8c1d21ffbb3694b67756abc59151132cf (diff)
ipa: rpi: denoise: Support different denoise configurations
Some use cases may require stronger, or different, denosie settings to others. For example, the way frames are accumulated during single exposure HDR means that we may want stronger denoise. This commit adds such support for different configurations that can be defined in the tuning file. Older tuning files, or files where there is only a single configuration, load only the "normal" denoise configuration. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/rpi/controller/rpi/denoise.h')
-rw-r--r--src/ipa/rpi/controller/rpi/denoise.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/ipa/rpi/controller/rpi/denoise.h b/src/ipa/rpi/controller/rpi/denoise.h
index 88b37663..92ff4f93 100644
--- a/src/ipa/rpi/controller/rpi/denoise.h
+++ b/src/ipa/rpi/controller/rpi/denoise.h
@@ -6,6 +6,9 @@
*/
#pragma once
+#include <map>
+#include <string>
+
#include "algorithm.h"
#include "denoise_algorithm.h"
@@ -13,6 +16,23 @@ namespace RPiController {
// Algorithm to calculate correct denoise settings.
+struct DenoiseConfig {
+ double sdnDeviation;
+ double sdnStrength;
+ double sdnDeviation2;
+ double sdnDeviationNoTdn;
+ double sdnStrengthNoTdn;
+ double sdnTdnBackoff;
+ double cdnDeviation;
+ double cdnStrength;
+ double tdnDeviation;
+ double tdnThreshold;
+ bool tdnEnable;
+ bool sdnEnable;
+ bool cdnEnable;
+ int read(const libcamera::YamlObject &params);
+};
+
class Denoise : public DenoiseAlgorithm
{
public:
@@ -23,22 +43,12 @@ public:
void switchMode(CameraMode const &cameraMode, Metadata *metadata) override;
void prepare(Metadata *imageMetadata) override;
void setMode(DenoiseMode mode) override;
+ void setConfig(std::string const &name) override;
private:
- double sdnDeviation_;
- double sdnStrength_;
- double sdnDeviation2_;
- double sdnDeviationNoTdn_;
- double sdnStrengthNoTdn_;
- double sdnTdnBackoff_;
- double cdnDeviation_;
- double cdnStrength_;
- double tdnDeviation_;
- double tdnThreshold_;
+ std::map<std::string, DenoiseConfig> configs_;
+ DenoiseConfig *currentConfig_;
DenoiseMode mode_;
- bool tdnEnable_;
- bool sdnEnable_;
- bool cdnEnable_;
/* SDN parameters attenuate over time if TDN is running. */
double currentSdnDeviation_;