From 271d048b2d30291bb7c002f7064b0691028382bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Wed, 1 Jul 2020 21:28:33 +0200 Subject: libcamera: ipu3: cio2: Make use of utils::map_keys() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a helper instead of local code to retrieve all keys from a map. Signed-off-by: Niklas Söderlund Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/cio2.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index 97a434a7..cb8c80a4 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -94,11 +94,7 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) * utils::set_overlap requires the ranges to be sorted, keep the * cio2Codes vector sorted in ascending order. */ - std::vector cio2Codes; - cio2Codes.reserve(mbusCodesToInfo.size()); - std::transform(mbusCodesToInfo.begin(), mbusCodesToInfo.end(), - std::back_inserter(cio2Codes), - [](auto &pair) { return pair.first; }); + std::vector cio2Codes = utils::map_keys(mbusCodesToInfo); const std::vector &sensorCodes = sensor_->mbusCodes(); if (!utils::set_overlap(sensorCodes.begin(), sensorCodes.end(), cio2Codes.begin(), cio2Codes.end())) { @@ -138,12 +134,7 @@ int CIO2Device::configure(const Size &size, V4L2DeviceFormat *outputFormat) * Apply the selected format to the sensor, the CSI-2 receiver and * the CIO2 output device. */ - std::vector mbusCodes; - mbusCodes.reserve(mbusCodesToInfo.size()); - std::transform(mbusCodesToInfo.begin(), mbusCodesToInfo.end(), - std::back_inserter(mbusCodes), - [](auto &pair) { return pair.first; }); - + std::vector mbusCodes = utils::map_keys(mbusCodesToInfo); sensorFormat = sensor_->getFormat(mbusCodes, size); ret = sensor_->setFormat(&sensorFormat); if (ret) @@ -182,11 +173,7 @@ CIO2Device::generateConfiguration(Size size) const size = sensor_->resolution(); /* Query the sensor static information for closest match. */ - std::vector mbusCodes; - std::transform(mbusCodesToInfo.begin(), mbusCodesToInfo.end(), - std::back_inserter(mbusCodes), - [](auto &pair) { return pair.first; }); - + std::vector mbusCodes = utils::map_keys(mbusCodesToInfo); V4L2SubdeviceFormat sensorFormat = sensor_->getFormat(mbusCodes, size); if (!sensorFormat.mbus_code) { LOG(IPU3, Error) << "Sensor does not support mbus code"; -- cgit v1.2.1