summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi/contrast.hpp
blob: 5a6d530f63fd7f089aa1198abe7c4df7b64868a5 (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
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (C) 2019, Raspberry Pi (Trading) Limited
 *
 * contrast.hpp - contrast (gamma) control algorithm
 */
#pragma once

#include <mutex>

#include "../contrast_algorithm.hpp"
#include "../pwl.hpp"

namespace RPiController {

// Back End algorithm to appaly correct digital gain. Should be placed after
// Back End AWB.

struct ContrastConfig {
	bool ceEnable;
	double loHistogram;
	double loLevel;
	double loMax;
	double hiHistogram;
	double hiLevel;
	double hiMax;
	Pwl gammaCurve;
};

class Contrast : public ContrastAlgorithm
{
public:
	Contrast(Controller *controller = NULL);
	char const *name() const override;
	void read(boost::property_tree::ptree const &params) override;
	void setBrightness(double brightness) override;
	void setContrast(double contrast) override;
	void initialise() override;
	void prepare(Metadata *imageMetadata) override;
	void process(StatisticsPtr &stats, Metadata *imageMetadata) override;

private:
	ContrastConfig config_;
	double brightness_;
	double contrast_;
	ContrastStatus status_;
	std::mutex mutex_;
};

} // namespace RPiController