/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2021, Ideas On Board * * algorithm.h - RkISP1 control algorithm interface */ #pragma once #include #include "module.h" namespace libcamera { namespace ipa::rkisp1 { class Algorithm : public libcamera::ipa::Algorithm { public: Algorithm() : disabled_(false), supportsRaw_(false) { } bool disabled_; bool supportsRaw_; }; } /* namespace ipa::rkisp1 */ } /* namespace libcamera */ >
summaryrefslogtreecommitdiff
blob: 22461cc464aa485aca5ccaec9c97c5fcb70f29d5 (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
107
108
109
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (C) 2019, Raspberry Pi (Trading) Limited
 *
 * controller.cpp - ISP controller
 */

#include "algorithm.hpp"
#include "controller.hpp"

#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>

using namespace RPiController;

Controller::Controller()
	: switch_mode_called_(false) {}

Controller::Controller(char const *json_filename)
	: switch_mode_called_(false)
{
	Read(json_filename);
	Initialise();
}

Controller::~Controller() {}

void Controller::Read(char const *filename)
{
	RPI_LOG("Controller starting");
	boost::property_tree::ptree root;
	boost::property_tree::read_json(filename, root);
	for (auto const &key_and_value : root) {
		Algorithm *algo = CreateAlgorithm(key_and_value.first.c_str());
		if (algo) {
			algo->Read(key_and_value.second);
			algorithms_.push_back(AlgorithmPtr(algo));
		} else
			RPI_LOG("WARNING: No algorithm found for \""
				<< key_and_value.first << "\"");
	}
	RPI_LOG("Controller finished");
}