@@ -45,7 +45,7 @@ enum {{ctrl.name}}Enum {
{{enum.name}} = {{enum.value}},
{%- endfor %}
};
-extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.name}}Values;
+extern const std::array<const ControlStorage, {{ctrl.enum_values_count}}> {{ctrl.name}}Values;
extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap;
{% endif -%}
extern const Control<{{ctrl.type}}> {{ctrl.name}};
@@ -132,17 +132,17 @@ struct control_type<T, std::enable_if_t<std::is_enum_v<T> && sizeof(T) == sizeof
} /* namespace details */
-class ControlValue
+class ControlStorage
{
public:
- ControlValue();
+ ControlStorage();
#ifndef __DOXYGEN__
template<typename T, std::enable_if_t<!details::is_span<T>::value &&
details::control_type<T>::value &&
!std::is_same<std::string, std::remove_cv_t<T>>::value,
std::nullptr_t> = nullptr>
- ControlValue(const T &value)
+ ControlStorage(const T &value)
: type_(ControlTypeNone), numElements_(0)
{
set(details::control_type<std::remove_cv_t<T>>::value, false,
@@ -155,19 +155,19 @@ public:
#else
template<typename T>
#endif
- ControlValue(const T &value)
+ ControlStorage(const T &value)
: type_(ControlTypeNone), numElements_(0)
{
set(details::control_type<std::remove_cv_t<T>>::value, true,
value.data(), value.size(), sizeof(typename T::value_type));
}
- explicit ControlValue(const ControlValueView &cvv);
+ explicit ControlStorage(const ControlValueView &cvv);
- ~ControlValue();
+ ~ControlStorage();
- ControlValue(const ControlValue &other);
- ControlValue &operator=(const ControlValue &other);
+ ControlStorage(const ControlStorage &other);
+ ControlStorage &operator=(const ControlStorage &other);
ControlType type() const { return type_; }
bool isNone() const { return type_ == ControlTypeNone; }
@@ -178,8 +178,8 @@ public:
std::string toString() const;
- bool operator==(const ControlValue &other) const;
- bool operator!=(const ControlValue &other) const
+ bool operator==(const ControlStorage &other) const;
+ bool operator!=(const ControlStorage &other) const
{
return !(*this == other);
}
@@ -259,7 +259,7 @@ public:
{
}
- ControlValueView(const ControlValue &cv) noexcept
+ ControlValueView(const ControlStorage &cv) noexcept
: ControlValueView(cv.type(), cv.isArray(), cv.numElements(),
reinterpret_cast<const std::byte *>(cv.data().data()))
{
@@ -397,18 +397,18 @@ private:
class ControlInfo
{
public:
- explicit ControlInfo(const ControlValue &min = {},
- const ControlValue &max = {},
- const ControlValue &def = {});
- explicit ControlInfo(Span<const ControlValue> values,
- const ControlValue &def = {});
+ explicit ControlInfo(const ControlStorage &min = {},
+ const ControlStorage &max = {},
+ const ControlStorage &def = {});
+ explicit ControlInfo(Span<const ControlStorage> values,
+ const ControlStorage &def = {});
explicit ControlInfo(std::set<bool> values, bool def);
explicit ControlInfo(bool value);
- const ControlValue &min() const { return min_; }
- const ControlValue &max() const { return max_; }
- const ControlValue &def() const { return def_; }
- const std::vector<ControlValue> &values() const { return values_; }
+ const ControlStorage &min() const { return min_; }
+ const ControlStorage &max() const { return max_; }
+ const ControlStorage &def() const { return def_; }
+ const std::vector<ControlStorage> &values() const { return values_; }
std::string toString() const;
@@ -423,10 +423,10 @@ public:
}
private:
- ControlValue min_;
- ControlValue max_;
- ControlValue def_;
- std::vector<ControlValue> values_;
+ ControlStorage min_;
+ ControlStorage max_;
+ ControlStorage def_;
+ std::vector<ControlStorage> values_;
};
using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;
@@ -478,7 +478,7 @@ private:
class ControlList
{
private:
- using ControlListMap = std::unordered_map<unsigned int, ControlValue>;
+ using ControlListMap = std::unordered_map<unsigned int, ControlStorage>;
public:
enum class MergePolicy {
@@ -513,14 +513,14 @@ public:
if (entry == controls_.end())
return std::nullopt;
- const ControlValue &val = entry->second;
+ const ControlStorage &val = entry->second;
return val.get<T>();
}
template<typename T, typename V>
void set(const Control<T> &ctrl, const V &value)
{
- ControlValue *val = find(ctrl.id());
+ ControlStorage *val = find(ctrl.id());
if (!val)
return;
@@ -530,22 +530,22 @@ public:
template<typename T, typename V, size_t Size>
void set(const Control<Span<T, Size>> &ctrl, const std::initializer_list<V> &value)
{
- ControlValue *val = find(ctrl.id());
+ ControlStorage *val = find(ctrl.id());
if (!val)
return;
val->set(Span<const typename std::remove_cv_t<V>, Size>{ value.begin(), value.size() });
}
- const ControlValue &get(unsigned int id) const;
- void set(unsigned int id, const ControlValue &value);
+ const ControlStorage &get(unsigned int id) const;
+ void set(unsigned int id, const ControlStorage &value);
const ControlInfoMap *infoMap() const { return infoMap_; }
const ControlIdMap *idMap() const { return idmap_; }
private:
- const ControlValue *find(unsigned int id) const;
- ControlValue *find(unsigned int id);
+ const ControlStorage *find(unsigned int id) const;
+ ControlStorage *find(unsigned int id);
const ControlValidator *validator_;
const ControlIdMap *idmap_;
@@ -41,13 +41,13 @@ public:
bool isCached(const ControlInfoMap &infoMap);
private:
- static size_t binarySize(const ControlValue &value);
+ static size_t binarySize(const ControlStorage &value);
static size_t binarySize(const ControlInfo &info);
- static void store(const ControlValue &value, ByteStreamBuffer &buffer);
+ static void store(const ControlStorage &value, ByteStreamBuffer &buffer);
static void store(const ControlInfo &info, ByteStreamBuffer &buffer);
- ControlValue loadControlValue(ByteStreamBuffer &buffer,
+ ControlStorage loadControlValue(ByteStreamBuffer &buffer,
bool isArray = false, unsigned int count = 1);
ControlInfo loadControlInfo(ByteStreamBuffer &buffer);
@@ -35,7 +35,7 @@ public:
cache_.set(ctrl, value);
}
- void set(unsigned int id, const ControlValue &value);
+ void set(unsigned int id, const ControlStorage &value);
private:
bool enabled_ = false;
@@ -37,7 +37,7 @@ public:
void applyControls(uint32_t sequence);
private:
- class Info : public ControlValue
+ class Info : public ControlStorage
{
public:
Info()
@@ -45,8 +45,8 @@ private:
{
}
- Info(const ControlValue &v, bool updated_ = true)
- : ControlValue(v), updated(updated_)
+ Info(const ControlStorage &v, bool updated_ = true)
+ : ControlStorage(v), updated(updated_)
{
}
@@ -311,7 +311,7 @@ int CaptureScript::parseControl(EventPtr event, ControlList &controls)
const ControlId *controlId = it->second;
- ControlValue val = unpackControl(controlId);
+ ControlStorage val = unpackControl(controlId);
if (val.isNone()) {
std::cerr << "Error unpacking control '" << name << "'"
<< std::endl;
@@ -332,7 +332,7 @@ std::string CaptureScript::parseScalar()
return eventScalarValue(event);
}
-ControlValue CaptureScript::parseRectangles()
+ControlStorage CaptureScript::parseRectangles()
{
std::vector<libcamera::Rectangle> rectangles;
@@ -351,7 +351,7 @@ ControlValue CaptureScript::parseRectangles()
rectangles.push_back(rect);
}
- ControlValue controlValue;
+ ControlStorage controlValue;
if (rectangles.size() == 1)
controlValue.set(rectangles.at(0));
else
@@ -458,10 +458,10 @@ void CaptureScript::unpackFailure(const ControlId *id, const std::string &repr)
<< typeName << " control " << id->name() << std::endl;
}
-ControlValue CaptureScript::parseScalarControl(const ControlId *id,
+ControlStorage CaptureScript::parseScalarControl(const ControlId *id,
const std::string repr)
{
- ControlValue value{};
+ ControlStorage value{};
switch (id->type()) {
case ControlTypeNone:
@@ -513,10 +513,10 @@ ControlValue CaptureScript::parseScalarControl(const ControlId *id,
return value;
}
-ControlValue CaptureScript::parseArrayControl(const ControlId *id,
+ControlStorage CaptureScript::parseArrayControl(const ControlId *id,
const std::vector<std::string> &repr)
{
- ControlValue value{};
+ ControlStorage value{};
switch (id->type()) {
case ControlTypeNone:
@@ -586,7 +586,7 @@ ControlValue CaptureScript::parseArrayControl(const ControlId *id,
return value;
}
-ControlValue CaptureScript::unpackControl(const ControlId *id)
+ControlStorage CaptureScript::unpackControl(const ControlId *id)
{
/* Parse complex types. */
switch (id->type()) {
@@ -56,18 +56,18 @@ private:
int parseFrame(EventPtr event);
int parseControl(EventPtr event, libcamera::ControlList &controls);
- libcamera::ControlValue parseScalarControl(const libcamera::ControlId *id,
+ libcamera::ControlStorage parseScalarControl(const libcamera::ControlId *id,
const std::string repr);
- libcamera::ControlValue parseArrayControl(const libcamera::ControlId *id,
+ libcamera::ControlStorage parseArrayControl(const libcamera::ControlId *id,
const std::vector<std::string> &repr);
std::string parseScalar();
- libcamera::ControlValue parseRectangles();
+ libcamera::ControlStorage parseRectangles();
std::vector<std::vector<std::string>> parseArrays();
std::vector<std::string> parseSingleArray();
void unpackFailure(const libcamera::ControlId *id,
const std::string &repr);
- libcamera::ControlValue unpackControl(const libcamera::ControlId *id);
+ libcamera::ControlStorage unpackControl(const libcamera::ControlId *id);
libcamera::Rectangle unpackRectangle(const std::vector<std::string> &strVec);
};
@@ -159,7 +159,7 @@ bool GstCameraControls::getProperty(guint propId, GValue *value,
controls::controls.at(propId)->name().c_str());
return true;
}
- const ControlValue &cv = controls_acc_.get(propId);
+ const ControlStorage &cv = controls_acc_.get(propId);
switch (propId) {
{%- for vendor, ctrls in controls %}
@@ -296,7 +296,7 @@ void GstCameraControls::setCamera(const std::shared_ptr<libcamera::Camera> &cam)
control != controls_acc_.end();
++control) {
unsigned int id = control->first;
- ControlValue value = control->second;
+ ControlStorage value = control->second;
const ControlId *cid = capabilities_.idmap().at(id);
auto info = capabilities_.find(cid);
@@ -186,7 +186,7 @@ void AgcMeanLuminance::parseConstraint(const YamlObject &modeDict, int32_t id)
int AgcMeanLuminance::parseConstraintModes(const YamlObject &tuningData)
{
- std::vector<ControlValue> availableConstraintModes;
+ std::vector<ControlStorage> availableConstraintModes;
const YamlObject &yamlConstraintModes = tuningData[controls::AeConstraintMode.name()];
if (yamlConstraintModes.isDictionary()) {
@@ -238,7 +238,7 @@ int AgcMeanLuminance::parseConstraintModes(const YamlObject &tuningData)
int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)
{
- std::vector<ControlValue> availableExposureModes;
+ std::vector<ControlStorage> availableExposureModes;
const YamlObject &yamlExposureModes = tuningData[controls::AeExposureMode.name()];
if (yamlExposureModes.isDictionary()) {
@@ -163,9 +163,9 @@ namespace ipa {
* \return Zero on success, negative error code otherwise
*/
int AwbAlgorithm::parseModeConfigs(const YamlObject &tuningData,
- const ControlValue &def)
+ const ControlStorage &def)
{
- std::vector<ControlValue> availableModes;
+ std::vector<ControlStorage> availableModes;
const YamlObject &yamlModes = tuningData[controls::AwbMode.name()];
if (!yamlModes.isDictionary()) {
@@ -51,7 +51,7 @@ public:
protected:
int parseModeConfigs(const YamlObject &tuningData,
- const ControlValue &def = {});
+ const ControlStorage &def = {});
struct ModeConfig {
double ctHi;
@@ -73,11 +73,11 @@ int Agc::parseMeteringModes(IPAContext &context, const YamlObject &tuningData)
meteringModes_[controls::MeteringMatrix] = weights;
}
- std::vector<ControlValue> meteringModes;
+ std::vector<ControlStorage> meteringModes;
std::vector<int> meteringModeKeys = utils::map_keys(meteringModes_);
std::transform(meteringModeKeys.begin(), meteringModeKeys.end(),
std::back_inserter(meteringModes),
- [](int x) { return ControlValue(x); });
+ [](int x) { return ControlStorage(x); });
context.ctrlMap[&controls::AeMeteringMode] = ControlInfo(meteringModes);
return 0;
@@ -148,13 +148,13 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)
return ret;
context.ctrlMap[&controls::ExposureTimeMode] =
- ControlInfo({ { ControlValue(controls::ExposureTimeModeAuto),
- ControlValue(controls::ExposureTimeModeManual) } },
- ControlValue(controls::ExposureTimeModeAuto));
+ ControlInfo({ { ControlStorage(controls::ExposureTimeModeAuto),
+ ControlStorage(controls::ExposureTimeModeManual) } },
+ ControlStorage(controls::ExposureTimeModeAuto));
context.ctrlMap[&controls::AnalogueGainMode] =
- ControlInfo({ { ControlValue(controls::AnalogueGainModeAuto),
- ControlValue(controls::AnalogueGainModeManual) } },
- ControlValue(controls::AnalogueGainModeAuto));
+ ControlInfo({ { ControlStorage(controls::AnalogueGainModeAuto),
+ ControlStorage(controls::AnalogueGainModeManual) } },
+ ControlStorage(controls::AnalogueGainModeAuto));
/* \todo Move this to the Camera class */
context.ctrlMap[&controls::AeEnable] = ControlInfo(false, true, true);
context.ctrlMap[&controls::ExposureValue] = ControlInfo(-8.0f, 8.0f, 0.0f);
@@ -45,9 +45,9 @@ int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData
{
auto &cmap = context.ctrlMap;
cmap[&controls::ColourCorrectionMatrix] = ControlInfo(
- ControlValue(-8.0f),
- ControlValue(7.993f),
- ControlValue(kIdentity3x3.data()));
+ ControlStorage(-8.0f),
+ ControlStorage(7.993f),
+ ControlStorage(kIdentity3x3.data()));
int ret = ccm_.readYaml(tuningData["ccms"], "ct", "ccm");
if (ret < 0) {
@@ -58,24 +58,24 @@ const ControlInfoMap::Map ipaControls{
/* \todo Move this to the Camera class */
{ &controls::AeEnable, ControlInfo(false, true, true) },
{ &controls::ExposureTimeMode,
- ControlInfo({ { ControlValue(controls::ExposureTimeModeAuto),
- ControlValue(controls::ExposureTimeModeManual) } },
- ControlValue(controls::ExposureTimeModeAuto)) },
+ ControlInfo({ { ControlStorage(controls::ExposureTimeModeAuto),
+ ControlStorage(controls::ExposureTimeModeManual) } },
+ ControlStorage(controls::ExposureTimeModeAuto)) },
{ &controls::ExposureTime,
ControlInfo(1, 66666, static_cast<int32_t>(defaultExposureTime.get<std::micro>())) },
{ &controls::AnalogueGainMode,
- ControlInfo({ { ControlValue(controls::AnalogueGainModeAuto),
- ControlValue(controls::AnalogueGainModeManual) } },
- ControlValue(controls::AnalogueGainModeAuto)) },
+ ControlInfo({ { ControlStorage(controls::AnalogueGainModeAuto),
+ ControlStorage(controls::AnalogueGainModeManual) } },
+ ControlStorage(controls::AnalogueGainModeAuto)) },
{ &controls::AnalogueGain, ControlInfo(1.0f, 16.0f, 1.0f) },
{ &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) },
{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },
{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },
{ &controls::ExposureValue, ControlInfo(-8.0f, 8.0f, 0.0f) },
{ &controls::AeFlickerMode,
- ControlInfo({ { ControlValue(controls::FlickerOff),
- ControlValue(controls::FlickerManual) } },
- ControlValue(controls::FlickerOff)) },
+ ControlInfo({ { ControlStorage(controls::FlickerOff),
+ ControlStorage(controls::FlickerManual) } },
+ ControlStorage(controls::FlickerOff)) },
{ &controls::AeFlickerPeriod, ControlInfo(100, 1000000) },
{ &controls::Brightness, ControlInfo(-1.0f, 1.0f, 0.0f) },
{ &controls::Contrast, ControlInfo(0.0f, 32.0f, 1.0f) },
@@ -927,7 +927,7 @@ void IpaPiSP::applyFocusStats(const NoiseStatus *noiseStatus)
void IpaPiSP::applyAF(const struct AfStatus *afStatus, ControlList &lensCtrls)
{
if (afStatus->lensSetting) {
- ControlValue v(afStatus->lensSetting.value());
+ ControlStorage v(afStatus->lensSetting.value());
lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, v);
}
}
@@ -369,7 +369,7 @@ void IpaVc4::applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls)
ccm.enabled = 1;
ccm.ccm.offsets[0] = ccm.ccm.offsets[1] = ccm.ccm.offsets[2] = 0;
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&ccm),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&ccm),
sizeof(ccm) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_CC_MATRIX, c);
}
@@ -383,7 +383,7 @@ void IpaVc4::applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, Co
blackLevel.black_level_g = blackLevelStatus->blackLevelG;
blackLevel.black_level_b = blackLevelStatus->blackLevelB;
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&blackLevel),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&blackLevel),
sizeof(blackLevel) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL, c);
}
@@ -405,7 +405,7 @@ void IpaVc4::applyGamma(const struct ContrastStatus *contrastStatus, ControlList
gamma.y[numGammaPoints - 1] = 65535;
gamma.enabled = 1;
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&gamma),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&gamma),
sizeof(gamma) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_GAMMA, c);
}
@@ -419,7 +419,7 @@ void IpaVc4::applyGEQ(const struct GeqStatus *geqStatus, ControlList &ctrls)
geq.slope.den = 1000;
geq.slope.num = 1000 * geqStatus->slope;
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&geq),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&geq),
sizeof(geq) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_GEQ, c);
}
@@ -453,11 +453,11 @@ void IpaVc4::applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList
cdn.enabled = 0;
}
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&denoise),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&denoise),
sizeof(denoise) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_DENOISE, c);
- c = ControlValue(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&cdn),
+ c = ControlStorage(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&cdn),
sizeof(cdn) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_CDN, c);
}
@@ -474,7 +474,7 @@ void IpaVc4::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList
sharpen.limit.num = 1000 * sharpenStatus->limit;
sharpen.limit.den = 1000;
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&sharpen),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&sharpen),
sizeof(sharpen) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_SHARPEN, c);
}
@@ -486,7 +486,7 @@ void IpaVc4::applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls)
dpc.enabled = 1;
dpc.strength = dpcStatus->strength;
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&dpc),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&dpc),
sizeof(dpc) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_DPC, c);
}
@@ -543,7 +543,7 @@ void IpaVc4::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls)
resampleTable(grid + 3 * w * h, lsStatus->b, w, h);
}
- ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&ls),
+ ControlStorage c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&ls),
sizeof(ls) });
ctrls.set(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING, c);
}
@@ -551,7 +551,7 @@ void IpaVc4::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls)
void IpaVc4::applyAF(const struct AfStatus *afStatus, ControlList &lensCtrls)
{
if (afStatus->lensSetting) {
- ControlValue v(afStatus->lensSetting.value());
+ ControlStorage v(afStatus->lensSetting.value());
lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, v);
}
}
@@ -79,7 +79,7 @@ namespace {{vendor}} {
{%- for ctrl in ctrls %}
{% if ctrl.is_enum -%}
-extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.name}}Values = {
+extern const std::array<const ControlStorage, {{ctrl.enum_values_count}}> {{ctrl.name}}Values = {
{%- for enum in ctrl.enum_values %}
static_cast<{{ctrl.type}}>({{enum.name}}),
{%- endfor %}
@@ -36,7 +36,7 @@ LOG_DEFINE_CATEGORY(Serializer)
* \brief Serializer and deserializer for control-related classes
*
* The control serializer is a helper to serialize and deserialize
- * ControlInfoMap and ControlValue instances for the purpose of communication
+ * ControlInfoMap and ControlStorage instances for the purpose of communication
* with IPA modules.
*
* Neither the ControlInfoMap nor the ControlList are self-contained data
@@ -142,7 +142,7 @@ void ControlSerializer::reset()
controlIdMaps_.clear();
}
-size_t ControlSerializer::binarySize(const ControlValue &value)
+size_t ControlSerializer::binarySize(const ControlStorage &value)
{
return sizeof(ControlType) + value.data().size_bytes();
}
@@ -192,7 +192,7 @@ size_t ControlSerializer::binarySize(const ControlList &list)
return size;
}
-void ControlSerializer::store(const ControlValue &value,
+void ControlSerializer::store(const ControlStorage &value,
ByteStreamBuffer &buffer)
{
const ControlType type = value.type();
@@ -363,7 +363,7 @@ int ControlSerializer::serialize(const ControlList &list,
/* Serialize all entries. */
for (const auto &ctrl : list) {
unsigned int id = ctrl.first;
- const ControlValue &value = ctrl.second;
+ const ControlStorage &value = ctrl.second;
struct ipa_control_value_entry entry;
entry.id = id;
@@ -382,14 +382,14 @@ int ControlSerializer::serialize(const ControlList &list,
return 0;
}
-ControlValue ControlSerializer::loadControlValue(ByteStreamBuffer &buffer,
+ControlStorage ControlSerializer::loadControlValue(ByteStreamBuffer &buffer,
bool isArray,
unsigned int count)
{
ControlType type;
buffer.read(&type);
- ControlValue value;
+ ControlStorage value;
value.reserve(type, isArray, count);
buffer.read(value.data());
@@ -399,9 +399,9 @@ ControlValue ControlSerializer::loadControlValue(ByteStreamBuffer &buffer,
ControlInfo ControlSerializer::loadControlInfo(ByteStreamBuffer &b)
{
- ControlValue min = loadControlValue(b);
- ControlValue max = loadControlValue(b);
- ControlValue def = loadControlValue(b);
+ ControlStorage min = loadControlValue(b);
+ ControlStorage max = loadControlValue(b);
+ ControlStorage def = loadControlValue(b);
return ControlInfo(min, max, def);
}
@@ -91,44 +91,44 @@ static constexpr size_t ControlValueSize[] = {
*/
/**
- * \class ControlValue
+ * \class ControlStorage
* \brief Abstract type representing the value of a control
*/
-/** \todo Revisit the ControlValue layout when stabilizing the ABI */
-static_assert(sizeof(ControlValue) == 16, "Invalid size of ControlValue class");
+/** \todo Revisit the ControlStorage layout when stabilizing the ABI */
+static_assert(sizeof(ControlStorage) == 16, "Invalid size of ControlStorage class");
/**
- * \brief Construct an empty ControlValue.
+ * \brief Construct an empty ControlStorage
*/
-ControlValue::ControlValue()
+ControlStorage::ControlStorage()
: type_(ControlTypeNone), isArray_(false), numElements_(0)
{
}
/**
- * \brief Construct a ControlValue from a ControlValueView
+ * \brief Construct a ControlStorage from a ControlValueView
*/
-ControlValue::ControlValue(const ControlValueView &cvv)
- : ControlValue()
+ControlStorage::ControlStorage(const ControlValueView &cvv)
+ : ControlStorage()
{
set(cvv.type(), cvv.isArray(), cvv.data().data(),
cvv.numElements(), ControlValueSize[cvv.type()]);
}
/**
- * \fn template<typename T> T ControlValue::ControlValue(const T &value)
- * \brief Construct a ControlValue of type T
+ * \fn template<typename T> T ControlStorage::ControlStorage(const T &value)
+ * \brief Construct a ControlStorage of type T
* \param[in] value Initial value
*
- * This function constructs a new instance of ControlValue and stores the \a
+ * This function constructs a new instance of ControlStorage and stores the \a
* value inside it. If the type \a T is equivalent to Span<R>, the instance
* stores an array of values of type \a R. Otherwise the instance stores a
* single value of type \a T. The numElements() and type() are updated to
* reflect the stored value.
*/
-void ControlValue::release()
+void ControlStorage::release()
{
std::size_t size = numElements_ * ControlValueSize[type_];
@@ -138,28 +138,28 @@ void ControlValue::release()
}
}
-ControlValue::~ControlValue()
+ControlStorage::~ControlStorage()
{
release();
}
/**
- * \brief Construct a ControlValue with the content of \a other
- * \param[in] other The ControlValue to copy content from
+ * \brief Construct a ControlStorage with the content of \a other
+ * \param[in] other The ControlStorage to copy content from
*/
-ControlValue::ControlValue(const ControlValue &other)
+ControlStorage::ControlStorage(const ControlStorage &other)
: type_(ControlTypeNone), numElements_(0)
{
*this = other;
}
/**
- * \brief Replace the content of the ControlValue with a copy of the content
+ * \brief Replace the content of the ControlStorage with a copy of the content
* of \a other
- * \param[in] other The ControlValue to copy content from
- * \return The ControlValue with its content replaced with the one of \a other
+ * \param[in] other The ControlStorage to copy content from
+ * \return The ControlStorage with its content replaced with the one of \a other
*/
-ControlValue &ControlValue::operator=(const ControlValue &other)
+ControlStorage &ControlStorage::operator=(const ControlStorage &other)
{
set(other.type_, other.isArray_, other.data().data(),
other.numElements_, ControlValueSize[other.type_]);
@@ -167,39 +167,39 @@ ControlValue &ControlValue::operator=(const ControlValue &other)
}
/**
- * \fn ControlValue::type()
+ * \fn ControlStorage::type()
* \brief Retrieve the data type of the value
* \return The value data type
*/
/**
- * \fn ControlValue::isNone()
+ * \fn ControlStorage::isNone()
* \brief Determine if the value is not initialised
* \return True if the value type is ControlTypeNone, false otherwise
*/
/**
- * \fn ControlValue::isArray()
+ * \fn ControlStorage::isArray()
* \brief Determine if the value stores an array
* \return True if the value stores an array, false otherwise
*/
/**
- * \fn ControlValue::numElements()
- * \brief Retrieve the number of elements stored in the ControlValue
+ * \fn ControlStorage::numElements()
+ * \brief Retrieve the number of elements stored in the ControlStorage
*
* For instances storing an array, this function returns the number of elements
* in the array. For instances storing a string, it returns the length of the
* string, not counting the terminating '\0'. Otherwise, it returns 1.
*
- * \return The number of elements stored in the ControlValue
+ * \return The number of elements stored in the ControlStorage
*/
/**
* \brief Retrieve the raw data of a control value
* \return The raw data of the control value as a span of uint8_t
*/
-Span<const uint8_t> ControlValue::data() const
+Span<const uint8_t> ControlStorage::data() const
{
std::size_t size = numElements_ * ControlValueSize[type_];
const uint8_t *data = size > sizeof(value_)
@@ -209,28 +209,28 @@ Span<const uint8_t> ControlValue::data() const
}
/**
- * \copydoc ControlValue::data() const
+ * \copydoc ControlStorage::data() const
*/
-Span<uint8_t> ControlValue::data()
+Span<uint8_t> ControlStorage::data()
{
- Span<const uint8_t> data = const_cast<const ControlValue *>(this)->data();
+ Span<const uint8_t> data = const_cast<const ControlStorage *>(this)->data();
return { const_cast<uint8_t *>(data.data()), data.size() };
}
/**
* \brief Assemble and return a string describing the value
- * \return A string describing the ControlValue
+ * \return A string describing the ControlStorage
*/
-std::string ControlValue::toString() const
+std::string ControlStorage::toString() const
{
return static_cast<std::ostringstream&&>(std::ostringstream{} << ControlValueView(*this)).str();
}
/**
- * \brief Compare ControlValue instances for equality
+ * \brief Compare ControlStorage instances for equality
* \return True if the values have identical types and values, false otherwise
*/
-bool ControlValue::operator==(const ControlValue &other) const
+bool ControlStorage::operator==(const ControlStorage &other) const
{
if (type_ != other.type_)
return false;
@@ -245,22 +245,22 @@ bool ControlValue::operator==(const ControlValue &other) const
}
/**
- * \fn bool ControlValue::operator!=()
- * \brief Compare ControlValue instances for non equality
+ * \fn bool ControlStorage::operator!=()
+ * \brief Compare ControlStorage instances for non equality
* \return False if the values have identical types and values, true otherwise
*/
/**
- * \fn template<typename T> T ControlValue::get() const
+ * \fn template<typename T> T ControlStorage::get() const
* \brief Get the control value
*
* This function returns the contained value as an instance of \a T. If the
- * ControlValue instance stores a single value, the type \a T shall match the
+ * ControlStorage instance stores a single value, the type \a T shall match the
* stored value type(). If the instance stores an array of values, the type
* \a T should be equal to Span<const R>, and the type \a R shall match the
* stored value type(). The behaviour is undefined otherwise.
*
- * Note that a ControlValue instance that stores a non-array value is not
+ * Note that a ControlStorage instance that stores a non-array value is not
* equivalent to an instance that stores an array value containing a single
* element. The latter shall be accessed through a Span<const R> type, while
* the former shall be accessed through a type \a T corresponding to type().
@@ -269,7 +269,7 @@ bool ControlValue::operator==(const ControlValue &other) const
*/
/**
- * \fn template<typename T> void ControlValue::set(const T &value)
+ * \fn template<typename T> void ControlStorage::set(const T &value)
* \brief Set the control value to \a value
* \param[in] value The control value
*
@@ -283,14 +283,14 @@ bool ControlValue::operator==(const ControlValue &other) const
* operation for Span<> values that refer to large arrays.
*/
-void ControlValue::set(ControlType type, bool isArray, const void *data,
+void ControlStorage::set(ControlType type, bool isArray, const void *data,
std::size_t numElements, std::size_t elementSize)
{
ASSERT(elementSize == ControlValueSize[type]);
reserve(type, isArray, numElements);
- Span<uint8_t> storage = ControlValue::data();
+ Span<uint8_t> storage = ControlStorage::data();
memcpy(storage.data(), data, storage.size());
}
@@ -306,7 +306,7 @@ void ControlValue::set(ControlType type, bool isArray, const void *data,
* Otherwise the instance becomes a simple control, numElements is ignored, and
* storage for the single element is reserved.
*/
-void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElements)
+void ControlStorage::reserve(ControlType type, bool isArray, std::size_t numElements)
{
if (!isArray)
numElements = 1;
@@ -336,17 +336,17 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen
/**
* \fn ControlValueView::ControlValueView()
* \brief Construct an empty view
- * \sa ControlValue::ControlValue()
+ * \sa ControlStorage::ControlStorage()
*/
/**
- * \fn ControlValueView::ControlValueView(const ControlValue &v)
+ * \fn ControlValueView::ControlValueView(const ControlStorage &v)
* \brief Construct a view referring to \a v
*
* The constructed view will refer to the value stored by \a v, and
* thus \a v must not be modified or destroyed before the view.
*
- * \sa ControlValue::ControlValue()
+ * \sa ControlStorage::ControlStorage()
*/
/**
@@ -357,31 +357,31 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen
/**
* \fn ControlType ControlValueView::type() const
- * \copydoc ControlValue::type()
- * \sa ControlValue::type()
+ * \copydoc ControlStorage::type()
+ * \sa ControlStorage::type()
*/
/**
* \fn ControlValueView::isNone() const
- * \copydoc ControlValue::isNone()
- * \sa ControlValue::isNone()
+ * \copydoc ControlStorage::isNone()
+ * \sa ControlStorage::isNone()
*/
/**
* \fn ControlValueView::isArray() const
- * \copydoc ControlValue::isArray()
- * \sa ControlValue::isArray()
+ * \copydoc ControlStorage::isArray()
+ * \sa ControlStorage::isArray()
*/
/**
* \fn ControlValueView::numElements() const
- * \copydoc ControlValue::numElements()
- * \sa ControlValue::numElements()
+ * \copydoc ControlStorage::numElements()
+ * \sa ControlStorage::numElements()
*/
/**
- * \copydoc ControlValue::data()
- * \sa ControlValue::data()
+ * \copydoc ControlStorage::data()
+ * \sa ControlStorage::data()
*/
Span<const std::byte> ControlValueView::data() const
{
@@ -389,8 +389,8 @@ Span<const std::byte> ControlValueView::data() const
}
/**
- * \copydoc ControlValue::operator==()
- * \sa ControlValue::operator==()
+ * \copydoc ControlStorage::operator==()
+ * \sa ControlStorage::operator==()
* \sa ControlValueView::operator!=()
*/
bool ControlValueView::operator==(const ControlValueView &other) const
@@ -411,20 +411,20 @@ bool ControlValueView::operator==(const ControlValueView &other) const
/**
* \fn ControlValueView::operator!=() const
- * \copydoc ControlValue::operator!=()
- * \sa ControlValue::operator!=()
+ * \copydoc ControlStorage::operator!=()
+ * \sa ControlStorage::operator!=()
* \sa ControlValueView::operator==()
*/
/**
* \fn template<typename T> T ControlValueView::get() const
- * \copydoc ControlValue::get()
- * \sa ControlValue::get()
+ * \copydoc ControlStorage::get()
+ * \sa ControlStorage::get()
*/
/**
* \brief Insert a text representation of a value into an output stream
- * \sa ControlValue::toString()
+ * \sa ControlStorage::toString()
*/
std::ostream &operator<<(std::ostream &s, const ControlValueView &v)
{
@@ -713,9 +713,9 @@ ControlId::ControlId(unsigned int id, const std::string &name,
* \param[in] max The control maximum value
* \param[in] def The control default value
*/
-ControlInfo::ControlInfo(const ControlValue &min,
- const ControlValue &max,
- const ControlValue &def)
+ControlInfo::ControlInfo(const ControlStorage &min,
+ const ControlStorage &max,
+ const ControlStorage &def)
: min_(min), max_(max), def_(def)
{
}
@@ -730,15 +730,15 @@ ControlInfo::ControlInfo(const ControlValue &min,
* values list respectively. The default value is set to \a def if provided, or
* to the minimum value otherwise.
*/
-ControlInfo::ControlInfo(Span<const ControlValue> values,
- const ControlValue &def)
+ControlInfo::ControlInfo(Span<const ControlStorage> values,
+ const ControlStorage &def)
{
min_ = values.front();
max_ = values.back();
def_ = !def.isNone() ? def : values.front();
values_.reserve(values.size());
- for (const ControlValue &value : values)
+ for (const ControlStorage &value : values)
values_.push_back(value);
}
@@ -779,7 +779,7 @@ ControlInfo::ControlInfo(bool value)
* the terminating '\0'. For all other control types, this is the minimum value
* of each element.
*
- * \return A ControlValue with the minimum value for the control
+ * \return A ControlStorage with the minimum value for the control
*/
/**
@@ -790,13 +790,13 @@ ControlInfo::ControlInfo(bool value)
* the terminating '\0'. For all other control types, this is the maximum value
* of each element.
*
- * \return A ControlValue with the maximum value for the control
+ * \return A ControlStorage with the maximum value for the control
*/
/**
* \fn ControlInfo::def()
* \brief Retrieve the default value of the control
- * \return A ControlValue with the default value for the control
+ * \return A ControlStorage with the default value for the control
*/
/**
@@ -804,10 +804,10 @@ ControlInfo::ControlInfo(bool value)
* \brief Retrieve the list of valid values
*
* For controls that support a pre-defined number of values, the enumeration of
- * those is reported through a vector of ControlValue instances accessible with
+ * those is reported through a vector of ControlStorage instances accessible with
* this function.
*
- * \return A vector of ControlValue representing the control valid values
+ * \return A vector of ControlStorage representing the control valid values
*/
/**
@@ -1234,11 +1234,11 @@ bool ControlList::contains(unsigned int id) const
*
* \return The control value
*/
-const ControlValue &ControlList::get(unsigned int id) const
+const ControlStorage &ControlList::get(unsigned int id) const
{
- static const ControlValue zero;
+ static const ControlStorage zero;
- const ControlValue *val = find(id);
+ const ControlStorage *val = find(id);
if (!val)
return zero;
@@ -1257,9 +1257,9 @@ const ControlValue &ControlList::get(unsigned int id) const
* The behaviour is undefined if the control \a id is not supported by the
* object that the list refers to.
*/
-void ControlList::set(unsigned int id, const ControlValue &value)
+void ControlList::set(unsigned int id, const ControlStorage &value)
{
- ControlValue *val = find(id);
+ ControlStorage *val = find(id);
if (!val)
return;
@@ -1284,7 +1284,7 @@ void ControlList::set(unsigned int id, const ControlValue &value)
* nullptr is returned in that case.
*/
-const ControlValue *ControlList::find(unsigned int id) const
+const ControlStorage *ControlList::find(unsigned int id) const
{
const auto iter = controls_.find(id);
if (iter == controls_.end()) {
@@ -1297,7 +1297,7 @@ const ControlValue *ControlList::find(unsigned int id) const
return &iter->second;
}
-ControlValue *ControlList::find(unsigned int id)
+ControlStorage *ControlList::find(unsigned int id)
{
if (validator_ && !validator_->validate(id)) {
LOG(Controls, Error)
@@ -138,7 +138,7 @@ void DebugMetadata::moveEntries(ControlList &list)
*/
/**
- * \fn DebugMetadata::set(unsigned int id, const ControlValue &value)
+ * \fn DebugMetadata::set(unsigned int id, const ControlStorage &value)
* \brief Set the value of control \a id to \a value
* \param[in] id The id of the control
* \param[in] value The control value
@@ -148,7 +148,7 @@ void DebugMetadata::moveEntries(ControlList &list)
*
* \sa enable()
*/
-void DebugMetadata::set(unsigned int id, const ControlValue &value)
+void DebugMetadata::set(unsigned int id, const ControlStorage &value)
{
if (parent_) {
parent_->set(id, value);
@@ -191,7 +191,7 @@ static_assert(sizeof(ipa_controls_header) == 32,
/**
* \struct ipa_control_value_entry
- * \brief Description of a serialized ControlValue entry
+ * \brief Description of a serialized ControlStorage entry
* \var ipa_control_value_entry::id
* The numerical ID of the control
* \var ipa_control_value_entry::type
@@ -955,7 +955,7 @@ int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)
const std::vector<controls::draft::TestPatternModeEnum>
&testPatternModes = sensor->testPatternModes();
if (!testPatternModes.empty()) {
- std::vector<ControlValue> values;
+ std::vector<ControlStorage> values;
values.reserve(testPatternModes.size());
for (auto pattern : testPatternModes)
@@ -1209,7 +1209,7 @@ void IPU3CameraData::setSensorControls([[maybe_unused]] unsigned int id,
if (!lensControls.contains(V4L2_CID_FOCUS_ABSOLUTE))
return;
- const ControlValue &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE);
+ const ControlStorage &focusValue = lensControls.get(V4L2_CID_FOCUS_ABSOLUTE);
focusLens->setFocusPosition(focusValue.get<int32_t>());
}
@@ -40,7 +40,7 @@ public:
void applyControls(uint32_t sequence);
private:
- class Info : public ControlValue
+ class Info : public ControlStorage
{
public:
Info()
@@ -48,8 +48,8 @@ private:
{
}
- Info(const ControlValue &v, bool updated_ = true)
- : ControlValue(v), updated(updated_)
+ Info(const ControlStorage &v, bool updated_ = true)
+ : ControlStorage(v), updated(updated_)
{
}
@@ -1250,7 +1250,7 @@ void CameraData::setLensControls(const ControlList &controls)
CameraLens *lens = sensor_->focusLens();
if (lens && controls.contains(V4L2_CID_FOCUS_ABSOLUTE)) {
- ControlValue const &focusValue = controls.get(V4L2_CID_FOCUS_ABSOLUTE);
+ ControlStorage const &focusValue = controls.get(V4L2_CID_FOCUS_ABSOLUTE);
lens->setFocusPosition(focusValue.get<int32_t>());
}
}
@@ -886,8 +886,8 @@ void Vc4CameraData::setIspControls(const ControlList &controls)
ControlList ctrls = controls;
if (ctrls.contains(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)) {
- ControlValue &value =
- const_cast<ControlValue &>(ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING));
+ ControlStorage &value =
+ const_cast<ControlStorage &>(ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING));
Span<uint8_t> s = value.data();
bcm2835_isp_lens_shading *ls =
reinterpret_cast<bcm2835_isp_lens_shading *>(s.data());
@@ -99,7 +99,7 @@ public:
private:
int processControl(const UVCCameraData *data, ControlList *controls,
- unsigned int id, const ControlValue &value);
+ unsigned int id, const ControlStorage &value);
int processControls(UVCCameraData *data, const ControlList &reqControls);
bool acquireDevice(Camera *camera) override;
@@ -322,7 +322,7 @@ void PipelineHandlerUVC::stopDevice(Camera *camera)
}
int PipelineHandlerUVC::processControl(const UVCCameraData *data, ControlList *controls,
- unsigned int id, const ControlValue &value)
+ unsigned int id, const ControlStorage &value)
{
uint32_t cid;
@@ -721,7 +721,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
}
/* Map the control info. */
- const std::vector<ControlValue> &v4l2Values = v4l2Info.values();
+ const std::vector<ControlStorage> &v4l2Values = v4l2Info.values();
int32_t min = v4l2Info.min().get<int32_t>();
int32_t max = v4l2Info.max().get<int32_t>();
int32_t def = v4l2Info.def().get<int32_t>();
@@ -793,7 +793,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
> exposureModes;
std::optional<controls::ExposureTimeModeEnum> lcDef;
- for (const ControlValue &value : v4l2Values) {
+ for (const ControlStorage &value : v4l2Values) {
const auto x = value.get<int32_t>();
if (0 <= x && static_cast<std::size_t>(x) < exposureModes.size()) {
@@ -814,7 +814,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
else if (exposureModes[V4L2_EXPOSURE_MANUAL])
manualExposureMode_ = V4L2_EXPOSURE_MANUAL;
- std::array<ControlValue, 2> values;
+ std::array<ControlStorage, 2> values;
std::size_t count = 0;
if (autoExposureMode_)
@@ -827,7 +827,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
return;
info = ControlInfo{
- Span<const ControlValue>{ values.data(), count },
+ Span<const ControlStorage>{ values.data(), count },
!lcDef ? values.front() : *lcDef,
};
break;
@@ -59,7 +59,7 @@ ConfigParser::parseConfigFile(File &file, PipelineHandler *pipe)
ControlInfo(1000000 / data->config_.resolutions[0].frameRates[1],
1000000 / data->config_.resolutions[0].frameRates[0]);
- std::vector<ControlValue> supportedFaceDetectModes{
+ std::vector<ControlStorage> supportedFaceDetectModes{
static_cast<int32_t>(controls::draft::FaceDetectModeOff),
};
controls[&controls::draft::FaceDetectMode] = ControlInfo(supportedFaceDetectModes);
@@ -538,7 +538,7 @@ void CameraSensorLegacy::initTestPatternModes()
for (const auto &it : testPatternModes)
indexToTestPatternMode[it.second] = it.first;
- for (const ControlValue &value : v4l2TestPattern->second.values()) {
+ for (const ControlStorage &value : v4l2TestPattern->second.values()) {
const int32_t index = value.get<int32_t>();
const auto it = indexToTestPatternMode.find(index);
@@ -720,7 +720,7 @@ void CameraSensorRaw::initTestPatternModes()
for (const auto &it : testPatternModes)
indexToTestPatternMode[it.second] = it.first;
- for (const ControlValue &value : v4l2TestPattern->second.values()) {
+ for (const ControlStorage &value : v4l2TestPattern->second.values()) {
const int32_t index = value.get<int32_t>();
const auto it = indexToTestPatternMode.find(index);
@@ -205,7 +205,7 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)
if (info.flags & V4L2_CTRL_FLAG_HAS_PAYLOAD) {
ControlType type;
- ControlValue &value = ctrl.second;
+ ControlStorage &value = ctrl.second;
Span<uint8_t> data;
switch (info.type) {
@@ -312,7 +312,7 @@ int V4L2Device::setControls(ControlList *ctrls)
v4l2Ctrl.id = id;
/* Set the v4l2_ext_control value for the write operation. */
- ControlValue &value = ctrl->second;
+ ControlStorage &value = ctrl->second;
switch (iter->first->type()) {
case ControlTypeUnsigned16: {
if (value.isArray()) {
@@ -652,7 +652,7 @@ std::optional<ControlInfo> V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl
*/
std::optional<ControlInfo> V4L2Device::v4l2MenuControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
{
- std::vector<ControlValue> indices;
+ std::vector<ControlStorage> indices;
struct v4l2_querymenu menu = {};
menu.id = ctrl.id;
@@ -676,7 +676,7 @@ std::optional<ControlInfo> V4L2Device::v4l2MenuControlInfo(const struct v4l2_que
return std::nullopt;
return ControlInfo(indices,
- ControlValue(static_cast<int32_t>(ctrl.default_value)));
+ ControlStorage(static_cast<int32_t>(ctrl.default_value)));
}
/*
@@ -790,11 +790,11 @@ void V4L2Device::updateControls(ControlList *ctrls,
for (const v4l2_ext_control &v4l2Ctrl : v4l2Ctrls) {
const unsigned int id = v4l2Ctrl.id;
- ControlValue value = ctrls->get(id);
+ ControlStorage value = ctrls->get(id);
if (value.isArray()) {
/*
* No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl
- * accessed the ControlValue storage directly for array
+ * accessed the ControlStorage storage directly for array
* controls.
*/
continue;
@@ -16,7 +16,7 @@ namespace py = pybind11;
using namespace libcamera;
template<typename T>
-static py::object valueOrTuple(const ControlValue &cv)
+static py::object valueOrTuple(const ControlStorage &cv)
{
if (cv.isArray()) {
const T *v = reinterpret_cast<const T *>(cv.data().data());
@@ -31,7 +31,7 @@ static py::object valueOrTuple(const ControlValue &cv)
return py::cast(cv.get<T>());
}
-py::object controlValueToPy(const ControlValue &cv)
+py::object controlValueToPy(const ControlStorage &cv)
{
switch (cv.type()) {
case ControlTypeNone:
@@ -57,28 +57,28 @@ py::object controlValueToPy(const ControlValue &cv)
case ControlTypePoint:
return valueOrTuple<Point>(cv);
default:
- throw std::runtime_error("Unsupported ControlValue type");
+ throw std::runtime_error("Unsupported ControlStorage type");
}
}
template<typename T>
-static ControlValue controlValueMaybeArray(const py::object &ob)
+static ControlStorage controlValueMaybeArray(const py::object &ob)
{
if (py::isinstance<py::list>(ob) || py::isinstance<py::tuple>(ob)) {
std::vector<T> vec = ob.cast<std::vector<T>>();
- return ControlValue(Span<const T>(vec));
+ return ControlStorage(Span<const T>(vec));
}
- return ControlValue(ob.cast<T>());
+ return ControlStorage(ob.cast<T>());
}
-ControlValue pyToControlValue(const py::object &ob, ControlType type)
+ControlStorage pyToControlValue(const py::object &ob, ControlType type)
{
switch (type) {
case ControlTypeNone:
- return ControlValue();
+ return ControlStorage();
case ControlTypeBool:
- return ControlValue(ob.cast<bool>());
+ return ControlStorage(ob.cast<bool>());
case ControlTypeByte:
return controlValueMaybeArray<uint8_t>(ob);
case ControlTypeInteger32:
@@ -88,11 +88,11 @@ ControlValue pyToControlValue(const py::object &ob, ControlType type)
case ControlTypeFloat:
return controlValueMaybeArray<float>(ob);
case ControlTypeString:
- return ControlValue(ob.cast<std::string>());
+ return ControlStorage(ob.cast<std::string>());
case ControlTypeRectangle:
return controlValueMaybeArray<Rectangle>(ob);
case ControlTypeSize:
- return ControlValue(ob.cast<Size>());
+ return ControlStorage(ob.cast<Size>());
case ControlTypePoint:
return controlValueMaybeArray<Point>(ob);
default:
@@ -9,5 +9,5 @@
#include <pybind11/pybind11.h>
-pybind11::object controlValueToPy(const libcamera::ControlValue &cv);
-libcamera::ControlValue pyToControlValue(const pybind11::object &ob, libcamera::ControlType type);
+pybind11::object controlValueToPy(const libcamera::ControlStorage &cv);
+libcamera::ControlStorage pyToControlValue(const pybind11::object &ob, libcamera::ControlType type);
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2019, Google Inc.
*
- * ControlValue tests
+ * ControlStorage tests
*/
#include <algorithm>
@@ -15,7 +15,7 @@
using namespace std;
using namespace libcamera;
-class ControlValueTest : public Test
+class ControlStorageTest : public Test
{
protected:
int run()
@@ -23,7 +23,7 @@ protected:
/*
* None type.
*/
- ControlValue value;
+ ControlStorage value;
if (!value.isNone() || value.isArray()) {
cerr << "Empty value is non-null" << endl;
return TestFail;
@@ -341,4 +341,4 @@ protected:
}
};
-TEST_REGISTER(ControlValueTest)
+TEST_REGISTER(ControlStorageTest)
@@ -56,17 +56,17 @@ bool SerializationTest::equals(const ControlInfoMap &lhs, const ControlInfoMap &
bool SerializationTest::equals(const ControlList &lhs, const ControlList &rhs)
{
- std::map<unsigned int, ControlValue> rlhs;
+ std::map<unsigned int, ControlStorage> rlhs;
std::transform(lhs.begin(), lhs.end(), std::inserter(rlhs, rlhs.end()),
- [](const std::pair<unsigned int, ControlValue> &v)
+ [](const std::pair<unsigned int, ControlStorage> &v)
-> decltype(rlhs)::value_type
{
return { v.first, v.second };
});
- std::map<unsigned int, ControlValue> rrhs;
+ std::map<unsigned int, ControlStorage> rrhs;
std::transform(rhs.begin(), rhs.end(), std::inserter(rrhs, rrhs.end()),
- [](const std::pair<unsigned int, ControlValue> &v)
+ [](const std::pair<unsigned int, ControlStorage> &v)
-> decltype(rrhs)::value_type
{
return { v.first, v.second };
The ControlValue class in libcamera represents the storage location of the values a Control represents. When a ControlValue is constructed, assigned or set() the values received as parameters are mem-copied inside the storage space allocated inside the ControlValue. This implies that creating ControlValue effectively mem-copies a Control creating multiple storages from the same information. To prepare to use wherever possible the newly introduced ControlValueView in the libcamera API, rename the ControlValue to ControlStorage. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- include/libcamera/control_ids.h.in | 2 +- include/libcamera/controls.h | 64 ++++---- include/libcamera/internal/control_serializer.h | 6 +- include/libcamera/internal/debug_controls.h | 2 +- include/libcamera/internal/delayed_controls.h | 6 +- src/apps/cam/capture_script.cpp | 16 +- src/apps/cam/capture_script.h | 8 +- src/gstreamer/gstlibcamera-controls.cpp.in | 4 +- src/ipa/libipa/agc_mean_luminance.cpp | 4 +- src/ipa/libipa/awb.cpp | 4 +- src/ipa/libipa/awb.h | 2 +- src/ipa/rkisp1/algorithms/agc.cpp | 16 +- src/ipa/rkisp1/algorithms/ccm.cpp | 6 +- src/ipa/rpi/common/ipa_base.cpp | 18 +-- src/ipa/rpi/pisp/pisp.cpp | 2 +- src/ipa/rpi/vc4/vc4.cpp | 20 +-- src/libcamera/control_ids.cpp.in | 2 +- src/libcamera/control_serializer.cpp | 18 +-- src/libcamera/controls.cpp | 162 ++++++++++----------- src/libcamera/debug_controls.cpp | 4 +- src/libcamera/ipa_controls.cpp | 2 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 4 +- .../pipeline/rpi/common/delayed_controls.h | 6 +- .../pipeline/rpi/common/pipeline_base.cpp | 2 +- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 4 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 12 +- src/libcamera/pipeline/virtual/config_parser.cpp | 2 +- src/libcamera/sensor/camera_sensor_legacy.cpp | 2 +- src/libcamera/sensor/camera_sensor_raw.cpp | 2 +- src/libcamera/v4l2_device.cpp | 12 +- src/py/libcamera/py_helpers.cpp | 22 +-- src/py/libcamera/py_helpers.h | 4 +- test/controls/control_value.cpp | 8 +- test/serialization/serialization_test.cpp | 8 +- 34 files changed, 228 insertions(+), 228 deletions(-)