[{"id":28779,"web_url":"https://patchwork.libcamera.org/comment/28779/","msgid":"<7hmcmo5fgrtg6dglr7yqbyo6x72bkzaljas7rufojaq26cvghj@6zohbrdlrrsg>","date":"2024-02-28T08:35:41","subject":"Re: [PATCH 5/9] libcamera: v4l2_subdevice: Drop\n\tV4L2SubdeviceFormat::bitsPerPixel()","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Tue, Feb 27, 2024 at 04:09:49PM +0200, Laurent Pinchart wrote:\n> The V4L2SubdeviceFormat::bitsPerPixel() function is just a wrapper\n> around a MediaBusFormatInfo lookup. It made sense when the\n> MediaBusFormatInfo class was not exposed outside of the compilation\n> unit, but is now redundant. Drop it and use MediaBusFormatInfo in the\n> only caller.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n   j\n\n> ---\n>  include/libcamera/internal/v4l2_subdevice.h |  1 -\n>  src/libcamera/camera_sensor.cpp             |  3 ++-\n>  src/libcamera/v4l2_subdevice.cpp            | 10 ----------\n>  3 files changed, 2 insertions(+), 12 deletions(-)\n>\n> diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> index c9aa90e00ec8..a87981341d75 100644\n> --- a/include/libcamera/internal/v4l2_subdevice.h\n> +++ b/include/libcamera/internal/v4l2_subdevice.h\n> @@ -66,7 +66,6 @@ struct V4L2SubdeviceFormat {\n>  \tstd::optional<ColorSpace> colorSpace;\n>\n>  \tconst std::string toString() const;\n> -\tuint8_t bitsPerPixel() const;\n>  };\n>\n>  std::ostream &operator<<(std::ostream &out, const V4L2SubdeviceFormat &f);\n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 0ef78d9c8b0a..55c9c74b10c2 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -1060,7 +1060,8 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const\n>  \tret = subdev_->getFormat(pad_, &format);\n>  \tif (ret)\n>  \t\treturn ret;\n> -\tinfo->bitsPerPixel = format.bitsPerPixel();\n> +\n> +\tinfo->bitsPerPixel = MediaBusFormatInfo::info(format.mbus_code).bitsPerPixel;\n>  \tinfo->outputSize = format.size;\n>\n>  \tstd::optional<int32_t> cfa = properties_.get(properties::draft::ColorFilterArrangement);\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index a535bf63c332..d48d12f26042 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -765,16 +765,6 @@ const std::string V4L2SubdeviceFormat::toString() const\n>  \treturn ss.str();\n>  }\n>\n> -/**\n> - * \\brief Retrieve the number of bits per pixel for the V4L2 subdevice format\n> - * \\return The number of bits per pixel for the format, or 0 if the format is\n> - * not supported\n> - */\n> -uint8_t V4L2SubdeviceFormat::bitsPerPixel() const\n> -{\n> -\treturn MediaBusFormatInfo::info(mbus_code).bitsPerPixel;\n> -}\n> -\n>  /**\n>   * \\brief Insert a text representation of a V4L2SubdeviceFormat into an output\n>   * stream\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B5F9CBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Feb 2024 08:35:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7125162871;\n\tWed, 28 Feb 2024 09:35:46 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE46A62865\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Feb 2024 09:35:44 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 45697672;\n\tWed, 28 Feb 2024 09:35:32 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"G5uZu7UM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1709109332;\n\tbh=HJQkLoM5Xbs8kblXps4tT3QlU8mlH2J+Ra6SMGQ40bk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=G5uZu7UMaE0ONeBtzRVmKz1jvVvHQFyv+4j+oX4wJAWJLKDb+y9i3jJ0sKHo6KHWV\n\tIj4RiJdHfcG9vn7o/MFmpbQVnBOfXoyCvm/tDmL6IRp1rNjs0hMXXojPoW+julumO2\n\tX8Q/CMi1IQti9Lfdr2D4g12+Kq0W8bCzG9BKT25Q=","Date":"Wed, 28 Feb 2024 09:35:41 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH 5/9] libcamera: v4l2_subdevice: Drop\n\tV4L2SubdeviceFormat::bitsPerPixel()","Message-ID":"<7hmcmo5fgrtg6dglr7yqbyo6x72bkzaljas7rufojaq26cvghj@6zohbrdlrrsg>","References":"<20240227140953.26093-1-laurent.pinchart@ideasonboard.com>\n\t<20240227140953.26093-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240227140953.26093-6-laurent.pinchart@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]