[libcamera-devel] [PATCH v2 01/20] libcamera: ipu3: Rename mbusCodesToInfo
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Jul 10 09:19:50 CEST 2020
Hi Jacopo,
Thank you for the patch.
On Thu, Jul 09, 2020 at 10:41:09AM +0200, Jacopo Mondi wrote:
> The mbusCodesToInfo map actually maps media bus codes to PixelFormat
> instances. Rename the map according to its actual function.
>
> Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
> 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 97a434a73b28..f5a01dd3ec1f 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 = {
> +static const std::map<uint32_t, PixelFormat> mbusCodesToPixelFormat = {
While at it you could drop the static keyword here.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> { MEDIA_BUS_FMT_SBGGR10_1X10, formats::SBGGR10_IPU3 },
> { MEDIA_BUS_FMT_SGBRG10_1X10, formats::SGBRG10_IPU3 },
> { MEDIA_BUS_FMT_SGRBG10_1X10, formats::SGRBG10_IPU3 },
> @@ -95,8 +95,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();
> @@ -139,8 +139,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; });
>
> @@ -153,8 +153,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);
> @@ -183,7 +183,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; });
>
> @@ -194,7 +194,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;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list