[libcamera-devel,v3,1/3] libcamera: rpi: pipeline_base: Remove populateSensorFormats()
diff mbox series

Message ID 20230724095925.20877-2-jacopo.mondi@ideasonboard.com
State Superseded
Commit 81fa10d87f6a0d639976e67247e0415601e00eaa
Headers show
Series
  • [libcamera-devel,v3,1/3] libcamera: rpi: pipeline_base: Remove populateSensorFormats()
Related show

Commit Message

Jacopo Mondi July 24, 2023, 9:59 a.m. UTC
populateSensorFormats() is a static helper that is called from a single
place and performs a simple loop over the sensor camera formats.

Remove it and in-line it in the caller to remove one static helper from
the pipeline_base.cpp file.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 .../pipeline/rpi/common/pipeline_base.cpp         | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index 179a5b81a516..fb3756a47590 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -66,16 +66,6 @@  PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,
 	return pix;
 }
 
-SensorFormats populateSensorFormats(std::unique_ptr<CameraSensor> &sensor)
-{
-	SensorFormats formats;
-
-	for (auto const mbusCode : sensor->mbusCodes())
-		formats.emplace(mbusCode, sensor->sizes(mbusCode));
-
-	return formats;
-}
-
 bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)
 {
 	unsigned int mbusCode = sensor->mbusCodes()[0];
@@ -804,7 +794,10 @@  int PipelineHandlerBase::registerCamera(std::unique_ptr<RPi::CameraData> &camera
 	if (data->sensor_->init())
 		return -EINVAL;
 
-	data->sensorFormats_ = populateSensorFormats(data->sensor_);
+	/* Populate the map of sensor supported formats and sizes. */
+	for (auto const mbusCode : data->sensor_->mbusCodes())
+		data->sensorFormats_.emplace(mbusCode,
+					     data->sensor_->sizes(mbusCode));
 
 	/*
 	 * Enumerate all the Video Mux/Bridge devices across the sensor -> Fr