[libcamera-devel,02/20] libcamera: ipu3: Rename mbusCodesToInfo

Message ID 20200714104212.48683-3-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: ipu3: Rework pipe configuration
Related show

Commit Message

Jacopo Mondi July 14, 2020, 10:41 a.m. UTC
The mbusCodesToInfo map actually maps media bus codes to PixelFormat
instances. Rename the map according to its actual function and while at
it drop the 'static' keyword as the map is already defined in an
anonymous namespace.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/ipu3/cio2.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch

diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
index cb8c80a4a9ca..77f54da47e28 100644
--- a/src/libcamera/pipeline/ipu3/cio2.cpp
+++ b/src/libcamera/pipeline/ipu3/cio2.cpp
@@ -22,7 +22,7 @@  LOG_DECLARE_CATEGORY(IPU3)
 
 namespace {
 
-static const std::map<uint32_t, PixelFormat> mbusCodesToInfo = {
+const std::map<uint32_t, PixelFormat> mbusCodesToPixelFormat = {
 	{ MEDIA_BUS_FMT_SBGGR10_1X10, formats::SBGGR10_IPU3 },
 	{ MEDIA_BUS_FMT_SGBRG10_1X10, formats::SGBRG10_IPU3 },
 	{ MEDIA_BUS_FMT_SGRBG10_1X10, formats::SGRBG10_IPU3 },
@@ -94,7 +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<unsigned int> cio2Codes = utils::map_keys(mbusCodesToInfo);
+	std::vector<unsigned int> cio2Codes = utils::map_keys(mbusCodesToPixelFormat);
 	const std::vector<unsigned int> &sensorCodes = sensor_->mbusCodes();
 	if (!utils::set_overlap(sensorCodes.begin(), sensorCodes.end(),
 				cio2Codes.begin(), cio2Codes.end())) {
@@ -134,7 +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<unsigned int> mbusCodes = utils::map_keys(mbusCodesToInfo);
+	std::vector<unsigned int> mbusCodes = utils::map_keys(mbusCodesToPixelFormat);
 	sensorFormat = sensor_->getFormat(mbusCodes, size);
 	ret = sensor_->setFormat(&sensorFormat);
 	if (ret)
@@ -144,8 +144,8 @@  int CIO2Device::configure(const Size &size, V4L2DeviceFormat *outputFormat)
 	if (ret)
 		return ret;
 
-	const auto &itInfo = mbusCodesToInfo.find(sensorFormat.mbus_code);
-	if (itInfo == mbusCodesToInfo.end())
+	const auto &itInfo = mbusCodesToPixelFormat.find(sensorFormat.mbus_code);
+	if (itInfo == mbusCodesToPixelFormat.end())
 		return -EINVAL;
 
 	const PixelFormatInfo &info = PixelFormatInfo::info(itInfo->second);
@@ -173,7 +173,7 @@  CIO2Device::generateConfiguration(Size size) const
 		size = sensor_->resolution();
 
 	/* Query the sensor static information for closest match. */
-	std::vector<unsigned int> mbusCodes = utils::map_keys(mbusCodesToInfo);
+	std::vector<unsigned int> mbusCodes = utils::map_keys(mbusCodesToPixelFormat);
 	V4L2SubdeviceFormat sensorFormat = sensor_->getFormat(mbusCodes, size);
 	if (!sensorFormat.mbus_code) {
 		LOG(IPU3, Error) << "Sensor does not support mbus code";
@@ -181,7 +181,7 @@  CIO2Device::generateConfiguration(Size size) const
 	}
 
 	cfg.size = sensorFormat.size;
-	cfg.pixelFormat = mbusCodesToInfo.at(sensorFormat.mbus_code);
+	cfg.pixelFormat = mbusCodesToPixelFormat.at(sensorFormat.mbus_code);
 	cfg.bufferCount = CIO2_BUFFER_COUNT;
 
 	return cfg;