summaryrefslogtreecommitdiffstats
path: root/multimedia/libcamera/patches/031-backport-ipa-libipa-lsc-re-sort-lsc-cpp.patch
blob: 2ef614afddae6e2afc35a604b0d5f35cde3061ea (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
From 7fdb57d86828ad4c34487928ae726dc4bc04fa09 Mon Sep 17 00:00:00 2001
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Date: Mon, 20 Jul 2026 13:08:01 +0200
Subject: [PATCH] ipa: libipa: lsc: Re-sort lsc.cpp

The LscAlgorithm and LscAlgorithmBase classes implementations had not
been resorted in the previous patch to keep the diff short.

Re-sort the documentation of the LscAlgorithmBase and LscAlgorithm
classes to match the declaration order.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/libipa/lsc.cpp | 168 ++++++++++++++++++++---------------------
 1 file changed, 84 insertions(+), 84 deletions(-)

--- a/src/ipa/libipa/lsc.cpp
+++ b/src/ipa/libipa/lsc.cpp
@@ -112,6 +112,90 @@ void Interpolator<lsc::Components<uint16
  */
 
 /**
+ * \param[in] tuningData The tuning data
+ * \param[in] controls The IPA list of supported controls
+ * \param[in] descriptor The LSC engine descriptor
+ *
+ * Parse \a tuningData according to the settings specified in \a descriptor to
+ * populate the LSC data and registers LSC controls in \a controls.
+ *
+ * \return 0 on success, a negative error code otherwise
+ */
+int LscAlgorithmBase::init(const ValueNode &tuningData, ControlInfoMap::Map &controls,
+			   const LscDescriptor &descriptor)
+{
+	polynomial_ = false;
+
+	std::string type = tuningData["type"].get<std::string>("table");
+	if (type == "table") {
+		impl_ = std::make_unique<LscTable>();
+		LOG(Lsc, Debug) << "Using table-based Lsc";
+	} else if (type == "polynomial") {
+		impl_ = std::make_unique<LscPolynomial>();
+		polynomial_ = true;
+		LOG(Lsc, Debug) << "Using polynomial Lsc";
+	} else {
+		LOG(Lsc, Error) << "Unsupported Lsc algorithm '"
+				<< type << "'";
+		return -EINVAL;
+	}
+
+	const ValueNode &yamlSets = tuningData["sets"];
+	if (!yamlSets.isList()) {
+		LOG(Lsc, Error) << "'sets' parameter not found in tuning file";
+		return -EINVAL;
+	}
+
+	int ret = impl_->parseLscData(yamlSets, descriptor);
+	if (ret)
+		return ret;
+
+	controls[&controls::LensShadingCorrectionEnable] =
+		ControlInfo(false, true, true);
+
+	return 0;
+}
+
+/**
+ * \brief Queue a request to the lsc algorithm
+ * \param[in] state The lsc active state
+ * \param[in] context The lsc frame context
+ * \param[in] controls The list of controls associated with a Request
+ *
+ * Queue a new list of \a controls to the lsc algorithm.
+ * The only supported control is controls::LensShadingCorrectionEnable.
+ */
+void LscAlgorithmBase::queueRequest(lsc::ActiveState &state,
+				    lsc::FrameContext &context,
+				    const ControlList &controls)
+{
+	const auto &lscEnable = controls.get(controls::LensShadingCorrectionEnable);
+	if (lscEnable && *lscEnable != state.enabled) {
+		state.enabled = *lscEnable;
+
+		LOG(Lsc, Debug)
+			<< (state.enabled ? "Enabling" : "Disabling") << " Lsc";
+
+		context.update = true;
+	}
+
+	context.enabled = state.enabled;
+}
+
+/**
+ * \brief Populate the list of lsc metadata
+ * \param[in] context The lsc frame context
+ * \param[in] metadata The list of metadata
+ *
+ * Populates the list of \a metadata with controls handled by the LscAlgorithm
+ * class. The only supported metadata is controls::LensShadingCorrectionEnable.
+ */
+void LscAlgorithmBase::process(lsc::FrameContext &context, ControlList &metadata)
+{
+	metadata.set(controls::LensShadingCorrectionEnable, context.enabled);
+}
+
+/**
  * \var LscAlgorithmBase::impl_
  * \brief The LSC algorithm implementation
  *
@@ -288,51 +372,6 @@ void Interpolator<lsc::Components<uint16
  */
 
 /**
- * \param[in] tuningData The tuning data
- * \param[in] controls The IPA list of supported controls
- * \param[in] descriptor The LSC engine descriptor
- *
- * Parse \a tuningData according to the settings specified in \a descriptor to
- * populate the LSC data and registers LSC controls in \a controls.
- *
- * \return 0 on success, a negative error code otherwise
- */
-int LscAlgorithmBase::init(const ValueNode &tuningData, ControlInfoMap::Map &controls,
-			   const LscDescriptor &descriptor)
-{
-	polynomial_ = false;
-
-	std::string type = tuningData["type"].get<std::string>("table");
-	if (type == "table") {
-		impl_ = std::make_unique<LscTable>();
-		LOG(Lsc, Debug) << "Using table-based Lsc";
-	} else if (type == "polynomial") {
-		impl_ = std::make_unique<LscPolynomial>();
-		polynomial_ = true;
-		LOG(Lsc, Debug) << "Using polynomial Lsc";
-	} else {
-		LOG(Lsc, Error) << "Unsupported Lsc algorithm '"
-				<< type << "'";
-		return -EINVAL;
-	}
-
-	const ValueNode &yamlSets = tuningData["sets"];
-	if (!yamlSets.isList()) {
-		LOG(Lsc, Error) << "'sets' parameter not found in tuning file";
-		return -EINVAL;
-	}
-
-	int ret = impl_->parseLscData(yamlSets, descriptor);
-	if (ret)
-		return ret;
-
-	controls[&controls::LensShadingCorrectionEnable] =
-		ControlInfo(false, true, true);
-
-	return 0;
-}
-
-/**
  * \fn LscAlgorithm::configure()
  * \brief Re-sample and quantize LSC data
  * \param[in] state The LSC active state
@@ -362,45 +401,6 @@ int LscAlgorithmBase::init(const ValueNo
  */
 
 /**
- * \brief Queue a request to the lsc algorithm
- * \param[in] state The lsc active state
- * \param[in] context The lsc frame context
- * \param[in] controls The list of controls associated with a Request
- *
- * Queue a new list of \a controls to the lsc algorithm.
- * The only supported control is controls::LensShadingCorrectionEnable.
- */
-void LscAlgorithmBase::queueRequest(lsc::ActiveState &state,
-				    lsc::FrameContext &context,
-				    const ControlList &controls)
-{
-	const auto &lscEnable = controls.get(controls::LensShadingCorrectionEnable);
-	if (lscEnable && *lscEnable != state.enabled) {
-		state.enabled = *lscEnable;
-
-		LOG(Lsc, Debug)
-			<< (state.enabled ? "Enabling" : "Disabling") << " Lsc";
-
-		context.update = true;
-	}
-
-	context.enabled = state.enabled;
-}
-
-/**
- * \brief Populate the list of lsc metadata
- * \param[in] context The lsc frame context
- * \param[in] metadata The list of metadata
- *
- * Populates the list of \a metadata with controls handled by the LscAlgorithm
- * class. The only supported metadata is controls::LensShadingCorrectionEnable.
- */
-void LscAlgorithmBase::process(lsc::FrameContext &context, ControlList &metadata)
-{
-	metadata.set(controls::LensShadingCorrectionEnable, context.enabled);
-}
-
-/**
  * \fn LscAlgorithm::interpolateComponents
  * \brief Interpolate the LSC tables for a given colour temperature
  * \param[in] ct The colour temperature