libcamera: controls: Avoid double lookups
Now that the ControlList::get() function returns an instance of std::optional<>, we can replace the ControlList::contains() calls with a nullopt check on the return value of get(). This avoids double lookups of controls through the code base. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
@@ -1049,8 +1049,8 @@ int CameraCapabilities::initializeStaticMetadata()
|
||||
pixelArraySize);
|
||||
}
|
||||
|
||||
if (properties.contains(properties::UnitCellSize)) {
|
||||
const auto &cellSize = properties.get<Size>(properties::UnitCellSize);
|
||||
const auto &cellSize = properties.get<Size>(properties::UnitCellSize);
|
||||
if (cellSize) {
|
||||
std::array<float, 2> physicalSize{
|
||||
cellSize->width * pixelArraySize[0] / 1e6f,
|
||||
cellSize->height * pixelArraySize[1] / 1e6f
|
||||
@@ -1079,11 +1079,10 @@ int CameraCapabilities::initializeStaticMetadata()
|
||||
sensitivityRange);
|
||||
|
||||
/* Report the color filter arrangement if the camera reports it. */
|
||||
if (properties.contains(properties::draft::ColorFilterArrangement)) {
|
||||
uint8_t filterArr = *properties.get(properties::draft::ColorFilterArrangement);
|
||||
const auto &filterArr = properties.get(properties::draft::ColorFilterArrangement);
|
||||
if (filterArr)
|
||||
staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
|
||||
filterArr);
|
||||
}
|
||||
*filterArr);
|
||||
|
||||
const auto &exposureInfo = controlsInfo.find(&controls::ExposureTime);
|
||||
if (exposureInfo != controlsInfo.end()) {
|
||||
|
||||
Reference in New Issue
Block a user