From patchwork Tue Feb 27 14:09:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19556 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id F3484C3264 for ; Tue, 27 Feb 2024 14:10:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AF5AC6291F; Tue, 27 Feb 2024 15:10:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fkmYSqM9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B6DC6285F for ; Tue, 27 Feb 2024 15:09:58 +0100 (CET) Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E71759CE for ; Tue, 27 Feb 2024 15:09:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1709042986; bh=bZVF+rwfoH51KLCKAHoK7amt2U7foeTYCTW3XevjWkw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fkmYSqM9MjGMJ3PGL+pPBeVBUfRiCLcQOsZn06Q8UYyohps8N5WuKmZPY1CkBIk6i Z8FYFuLsx4rkyT9slo1zuf/+f1M5e5aqu5WePn60eUo6mjOvUusvbJwkwxk0EMx+lw MAU3dszPKBsKS3vdmS4XWsnD57U3Wwu0XTWID+Kk= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 5/9] libcamera: v4l2_subdevice: Drop V4L2SubdeviceFormat::bitsPerPixel() Date: Tue, 27 Feb 2024 16:09:49 +0200 Message-ID: <20240227140953.26093-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240227140953.26093-1-laurent.pinchart@ideasonboard.com> References: <20240227140953.26093-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The V4L2SubdeviceFormat::bitsPerPixel() function is just a wrapper around a MediaBusFormatInfo lookup. It made sense when the MediaBusFormatInfo class was not exposed outside of the compilation unit, but is now redundant. Drop it and use MediaBusFormatInfo in the only caller. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- include/libcamera/internal/v4l2_subdevice.h | 1 - src/libcamera/camera_sensor.cpp | 3 ++- src/libcamera/v4l2_subdevice.cpp | 10 ---------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h index c9aa90e00ec8..a87981341d75 100644 --- a/include/libcamera/internal/v4l2_subdevice.h +++ b/include/libcamera/internal/v4l2_subdevice.h @@ -66,7 +66,6 @@ struct V4L2SubdeviceFormat { std::optional colorSpace; const std::string toString() const; - uint8_t bitsPerPixel() const; }; std::ostream &operator<<(std::ostream &out, const V4L2SubdeviceFormat &f); diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 0ef78d9c8b0a..55c9c74b10c2 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -1060,7 +1060,8 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const ret = subdev_->getFormat(pad_, &format); if (ret) return ret; - info->bitsPerPixel = format.bitsPerPixel(); + + info->bitsPerPixel = MediaBusFormatInfo::info(format.mbus_code).bitsPerPixel; info->outputSize = format.size; std::optional cfa = properties_.get(properties::draft::ColorFilterArrangement); diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index a535bf63c332..d48d12f26042 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -765,16 +765,6 @@ const std::string V4L2SubdeviceFormat::toString() const return ss.str(); } -/** - * \brief Retrieve the number of bits per pixel for the V4L2 subdevice format - * \return The number of bits per pixel for the format, or 0 if the format is - * not supported - */ -uint8_t V4L2SubdeviceFormat::bitsPerPixel() const -{ - return MediaBusFormatInfo::info(mbus_code).bitsPerPixel; -} - /** * \brief Insert a text representation of a V4L2SubdeviceFormat into an output * stream