blob: 92ff4f93edf21d2edeb8396f55a2afa8d7342261 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (C) 2022, Raspberry Pi Ltd
*
* denoise.hpp - Denoise (spatial, colour, temporal) control algorithm
*/
#pragma once
#include <map>
#include <string>
#include "algorithm.h"
#include "denoise_algorithm.h"
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 ¶ms);
};
class Denoise : public DenoiseAlgorithm
{
public:
Denoise(Controller *controller);
char const *name() const override;
int read(const libcamera::YamlObject ¶ms) override;
void initialise() override;
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:
std::map<std::string, DenoiseConfig> configs_;
DenoiseConfig *currentConfig_;
DenoiseMode mode_;
/* SDN parameters attenuate over time if TDN is running. */
double currentSdnDeviation_;
double currentSdnStrength_;
double currentSdnDeviation2_;
};
} // namespace RPiController
|