[libcamera-devel] [PATCH 01/15] libcamera: ipu3: Rename mbusCodesToInfo

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Jul 1 16:29:34 CEST 2020


Hi Jacopo,

Thanks for your patch.

On 2020-07-01 14:30:22 +0200, Jacopo Mondi wrote:
> The mbusCodesToInfo map actually maps media bus codes to PixelFormat
> instances. Rename the map according to its actual function.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  src/libcamera/pipeline/ipu3/cio2.cpp | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
> index aa1459fb3599..2ec8fcb42d92 100644
> --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> @@ -23,7 +23,7 @@ LOG_DECLARE_CATEGORY(IPU3)
>  
>  namespace {
>  
> -static const std::map<uint32_t, PixelFormat> mbusCodesToInfo = {
> +static 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 },
> @@ -96,8 +96,8 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)
>  	 * cio2Codes vector sorted in ascending order.
>  	 */
>  	std::vector<unsigned int> cio2Codes;
> -	cio2Codes.reserve(mbusCodesToInfo.size());
> -	std::transform(mbusCodesToInfo.begin(), mbusCodesToInfo.end(),
> +	cio2Codes.reserve(mbusCodesToPixelFormat.size());
> +	std::transform(mbusCodesToPixelFormat.begin(), mbusCodesToPixelFormat.end(),
>  		       std::back_inserter(cio2Codes),
>  		       [](auto &pair) { return pair.first; });
>  	const std::vector<unsigned int> &sensorCodes = sensor_->mbusCodes();
> @@ -146,8 +146,8 @@ int CIO2Device::configure(const Size &size, V4L2DeviceFormat *outputFormat)
>  	 * the CIO2 output device.
>  	 */
>  	std::vector<unsigned int> mbusCodes;
> -	mbusCodes.reserve(mbusCodesToInfo.size());
> -	std::transform(mbusCodesToInfo.begin(), mbusCodesToInfo.end(),
> +	mbusCodes.reserve(mbusCodesToPixelFormat.size());
> +	std::transform(mbusCodesToPixelFormat.begin(), mbusCodesToPixelFormat.end(),
>  		       std::back_inserter(mbusCodes),
>  		       [](auto &pair) { return pair.first; });
>  
> @@ -160,8 +160,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);
> @@ -190,7 +190,7 @@ CIO2Device::generateConfiguration(Size size) const
>  
>  	/* Query the sensor static information for closest match. */
>  	std::vector<unsigned int> mbusCodes;
> -	std::transform(mbusCodesToInfo.begin(), mbusCodesToInfo.end(),
> +	std::transform(mbusCodesToPixelFormat.begin(), mbusCodesToPixelFormat.end(),
>  		       std::back_inserter(mbusCodes),
>  		       [](auto &pair) { return pair.first; });
>  
> @@ -201,7 +201,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;
> -- 
> 2.27.0
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list