/

=10be87fa7c3bfb097b21ca3d469c67e40c333f7e'>diff
path: root/src/ipa/raspberrypi/controller/rpi/alsc.hpp
blob: d1dbe0d1d22dd6636f880c83854c711921f772c7 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (C) 2019, Raspberry Pi (Trading) Limited
 *
 * alsc.hpp - ALSC (auto lens shading correction) control algorithm
 */
#pragma once

#include <mutex>
#include <condition_variable>
#include <thread>

#include "../algorithm.hpp"
#include "../alsc_status.h"

namespace RPiController {

// Algorithm to generate automagic LSC (Lens Shading Correction) tables.

struct AlscCalibration {
	double ct;
	double table[ALSC_CELLS_X * ALSC_CELLS_Y];
};

struct AlscConfig {
	// Only repeat the ALSC calculation every "this many" frames
	uint16_t frame_period;
	// number of initial frames for which speed taken as 1.0 (maximum)
	uint16_t startup_frames;
	// IIR filter speed applied to algorithm results
	double speed;
	double sigma_Cr;
	double sigma_Cb;
	double min_count;
	uint16_t min_G;
	double omega;
	uint32_t n_iter;
	double luminance_lut[ALSC_CELLS_X * ALSC_CELLS_Y];
	double luminance_strength;
	std::vector<AlscCalibration> calibrations_Cr;
	std::vector<AlscCalibration> calibrations_Cb;
	double default_ct; // colour temperature if no metadata found
	double threshold; // iteration termination threshold
	double lambda_bound; // upper/lower bound for lambda from a value of 1
};