[{"id":28972,"web_url":"https://patchwork.libcamera.org/comment/28972/","msgid":"<171046475551.1913896.10118349079681020983@ping.linuxembedded.co.uk>","date":"2024-03-15T01:05:55","subject":"Re: [PATCH v2 05/14] libcamera: v4l2_subdevice: Drop\n\tV4L2SubdeviceFormat::bitsPerPixel()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2024-03-15 00:16:04)\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> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\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>         std::optional<ColorSpace> colorSpace;\n>  \n>         const std::string toString() const;\n> -       uint8_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>         ret = subdev_->getFormat(pad_, &format);\n>         if (ret)\n>                 return ret;\n> -       info->bitsPerPixel = format.bitsPerPixel();\n> +\n> +       info->bitsPerPixel = MediaBusFormatInfo::info(format.mbus_code).bitsPerPixel;\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>         info->outputSize = format.size;\n>  \n>         std::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 a508cef4dcbb..84ec93154951 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -793,16 +793,6 @@ const std::string V4L2SubdeviceFormat::toString() const\n>         return 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> -       return 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 D1139BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Mar 2024 01:06:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0BCD062C8F;\n\tFri, 15 Mar 2024 02:06:00 +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 48A0462C87\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Mar 2024 02:05:58 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 97438899;\n\tFri, 15 Mar 2024 02:05:34 +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=\"ZoNayr2P\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710464734;\n\tbh=i0HGM3puEhHh3AKE8j+ZyHQvoi/DyQ1m6CNiTmQH7AA=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=ZoNayr2PomBAm+bPkGwbxfkuPCvsPDfIaqfTv8Qxl+yhyvjsVVGmjIOhSljWFzpuf\n\t+dL8h1itW5u/1qgG0ZHWpiAr00tXsjAq9793zKBE3gwVmh+glzroSMz9WEhoNC4DnD\n\t8GN43cOfHqPE2LA1aeK2yqxdkU5J7QQwBBmseLt0=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240315001613.2033-6-laurent.pinchart@ideasonboard.com>","References":"<20240315001613.2033-1-laurent.pinchart@ideasonboard.com>\n\t<20240315001613.2033-6-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v2 05/14] libcamera: v4l2_subdevice: Drop\n\tV4L2SubdeviceFormat::bitsPerPixel()","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 15 Mar 2024 01:05:55 +0000","Message-ID":"<171046475551.1913896.10118349079681020983@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]