treewide: Do not use *NameValueMap
for known values
When the value is known, do not look it up via the control's `NameValueMap`, instead, just refer to the value directly. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
aca8b701ac
commit
eecb270085
3 changed files with 15 additions and 13 deletions
|
@ -218,8 +218,7 @@ int AgcMeanLuminance::parseConstraintModes(const YamlObject &tuningData)
|
|||
constraintModes_[controls::ConstraintNormal].insert(
|
||||
constraintModes_[controls::ConstraintNormal].begin(),
|
||||
constraint);
|
||||
availableConstraintModes.push_back(
|
||||
AeConstraintModeNameValueMap.at("ConstraintNormal"));
|
||||
availableConstraintModes.push_back(controls::ConstraintNormal);
|
||||
}
|
||||
|
||||
controls_[&controls::AeConstraintMode] = ControlInfo(availableConstraintModes);
|
||||
|
@ -287,7 +286,7 @@ int AgcMeanLuminance::parseExposureModes(const YamlObject &tuningData)
|
|||
* possible before touching gain.
|
||||
*/
|
||||
if (availableExposureModes.empty()) {
|
||||
int32_t exposureModeId = AeExposureModeNameValueMap.at("ExposureNormal");
|
||||
int32_t exposureModeId = controls::ExposureNormal;
|
||||
std::vector<std::pair<utils::Duration, double>> stages = { };
|
||||
|
||||
std::shared_ptr<ExposureModeHelper> helper =
|
||||
|
|
|
@ -68,10 +68,9 @@ int Agc::parseMeteringModes(IPAContext &context, const YamlObject &tuningData)
|
|||
if (meteringModes_.empty()) {
|
||||
LOG(RkISP1Agc, Warning)
|
||||
<< "No metering modes read from tuning file; defaulting to matrix";
|
||||
int32_t meteringModeId = controls::AeMeteringModeNameValueMap.at("MeteringMatrix");
|
||||
std::vector<uint8_t> weights(context.hw->numHistogramWeights, 1);
|
||||
|
||||
meteringModes_[meteringModeId] = weights;
|
||||
meteringModes_[controls::MeteringMatrix] = weights;
|
||||
}
|
||||
|
||||
std::vector<ControlValue> meteringModes;
|
||||
|
|
|
@ -233,17 +233,21 @@ int ConfigParser::parseFrameGenerator(const YamlObject &cameraConfigData, Virtua
|
|||
|
||||
int ConfigParser::parseLocation(const YamlObject &cameraConfigData, VirtualCameraData *data)
|
||||
{
|
||||
std::string location = cameraConfigData["location"].get<std::string>("CameraLocationFront");
|
||||
|
||||
/* Default value is properties::CameraLocationFront */
|
||||
auto it = properties::LocationNameValueMap.find(location);
|
||||
if (it == properties::LocationNameValueMap.end()) {
|
||||
LOG(Virtual, Error)
|
||||
<< "location: " << location << " is not supported";
|
||||
return -EINVAL;
|
||||
int32_t location = properties::CameraLocationFront;
|
||||
|
||||
if (auto l = cameraConfigData["location"].get<std::string>()) {
|
||||
auto it = properties::LocationNameValueMap.find(*l);
|
||||
if (it == properties::LocationNameValueMap.end()) {
|
||||
LOG(Virtual, Error)
|
||||
<< "location: " << *l << " is not supported";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
location = it->second;
|
||||
}
|
||||
|
||||
data->properties_.set(properties::Location, it->second);
|
||||
data->properties_.set(properties::Location, location);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue