Skip to content

Commit 4e9be7d

Browse files
Rahi374kbingham
authored andcommitted
ipa: ipu3, mali-c55, rkisp1, rpi: Fix reporting non-scalar controls
The ControlInfos of non-scalar controls that are reported in controls() must have non-scalar default values for controls that have a defined size. This is because applications should be able to directly set the default value from a ControlInfo to the control. Currently this is relevant to the following controls: - ColourGains - ColourCorrectionMatrix - FrameDurationLimits - AfWindows Fix the scalarness of these controls where relevant. Signed-off-by: Paul Elder <[email protected]> Tested-by: Barnabás Pőcze <[email protected]> # rkisp1 Reviewed-by: Naushir Patuck <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Kieran Bingham <[email protected]>
1 parent cfdc281 commit 4e9be7d

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

src/ipa/ipu3/ipu3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include <libcamera/base/file.h>
2222
#include <libcamera/base/log.h>
23+
#include <libcamera/base/span.h>
2324
#include <libcamera/base/utils.h>
2425

2526
#include <libcamera/control_ids.h>
@@ -280,10 +281,9 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,
280281
uint64_t frameSize = lineLength * frameHeights[i];
281282
frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);
282283
}
283-
284284
controls[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],
285285
frameDurations[1],
286-
frameDurations[2]);
286+
Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } });
287287

288288
controls.merge(context_.ctrlMap);
289289
*ipaControls = ControlInfoMap(std::move(controls), controls::controls);

src/ipa/mali-c55/mali-c55.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Mali-C55 ISP image processing algorithms
66
*/
77

8+
#include <array>
89
#include <map>
910
#include <string.h>
1011
#include <vector>
@@ -14,6 +15,7 @@
1415

1516
#include <libcamera/base/file.h>
1617
#include <libcamera/base/log.h>
18+
#include <libcamera/base/span.h>
1719

1820
#include <libcamera/control_ids.h>
1921
#include <libcamera/ipa/ipa_interface.h>
@@ -236,7 +238,7 @@ void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo,
236238

237239
ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],
238240
frameDurations[1],
239-
frameDurations[2]);
241+
Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } });
240242

241243
/*
242244
* Compute exposure time limits from the V4L2_CID_EXPOSURE control

src/ipa/rkisp1/algorithms/awb.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ int Awb::init(IPAContext &context, const YamlObject &tuningData)
9191
kMaxColourTemperature,
9292
kDefaultColourTemperature);
9393
cmap[&controls::AwbEnable] = ControlInfo(false, true);
94-
cmap[&controls::ColourGains] = ControlInfo(0.0f, 3.996f, 1.0f);
94+
95+
cmap[&controls::ColourGains] = ControlInfo(0.0f, 3.996f,
96+
Span<const float, 2>{ { 1.0f, 1.0f } });
9597

9698
if (!tuningData.contains("algorithm"))
9799
LOG(RkISP1Awb, Info) << "No AWB algorithm specified."

src/ipa/rkisp1/rkisp1.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,
439439

440440
/* \todo Move this (and other agc-related controls) to agc */
441441
context_.ctrlMap[&controls::FrameDurationLimits] =
442-
ControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]);
442+
ControlInfo(frameDurations[0], frameDurations[1],
443+
ControlValue(Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } }));
443444

444445
ctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());
445446
*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);

src/ipa/rpi/common/ipa_base.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "ipa_base.h"
99

10+
#include <array>
1011
#include <cmath>
1112

1213
#include <libcamera/base/log.h>
@@ -105,7 +106,8 @@ const ControlInfoMap::Map ipaAfControls{
105106
{ &controls::AfRange, ControlInfo(controls::AfRangeValues) },
106107
{ &controls::AfSpeed, ControlInfo(controls::AfSpeedValues) },
107108
{ &controls::AfMetering, ControlInfo(controls::AfMeteringValues) },
108-
{ &controls::AfWindows, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
109+
{ &controls::AfWindows, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535),
110+
Span<const Rectangle, 1>{ { Rectangle{} } }) },
109111
{ &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },
110112
{ &controls::AfPause, ControlInfo(controls::AfPauseValues) },
111113
{ &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }
@@ -246,7 +248,8 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
246248
ctrlMap[&controls::FrameDurationLimits] =
247249
ControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),
248250
static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()),
249-
static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()));
251+
Span<const int64_t, 2>{ { static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()),
252+
static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()) } });
250253

251254
ctrlMap[&controls::AnalogueGain] =
252255
ControlInfo(static_cast<float>(mode_.minAnalogueGain),

0 commit comments

Comments
 (0)