From patchwork Tue Sep 7 15:45:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13726 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 D6C4FBE175 for ; Tue, 7 Sep 2021 15:45:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A576F60251; Tue, 7 Sep 2021 17:45:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QmCTIL2/"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 33EB860251 for ; Tue, 7 Sep 2021 17:45:39 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D26E124F for ; Tue, 7 Sep 2021 17:45:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631029539; bh=Lsfo+IBj6wF6c+BtwxgXBPUqK82cqzQqBH9sGc8LXnM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QmCTIL2/mNWuLMAjft2dlxETuhRfI1u6+TyNPLe4PXbUeYNPL8SVNpxYRfmjPXfFu 9j1YnKJLnV1dDnDZbMAKtQgIyVi8RNRH1htRcekeP4kEM8lCiVT0DydeZ8/HAONAPm yQbGBqOsASB+2a+Laa3JzeY03bLRsLkx1UQB+y/8= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Sep 2021 18:45:17 +0300 Message-Id: <20210907154517.11140-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210906225636.14683-5-laurent.pinchart@ideasonboard.com> References: <20210906225636.14683-5-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3.1 05/30] libcamera: formats: Move plane info structure to PixelFormatInfo 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" Move the PixelFormatPlaneInfo structure within the PixelFormatInfo class definition and rename it to Plane, to align the naming scheme with other parts of libcamera, such as FrameBuffer::Plane or FrameMetadata::Plane. Signed-off-by: Laurent Pinchart Reviewed-by: Jean-Michel Hautbois Reviewed-by: Hirokazu Honda Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- Changes since v3: - Use \struct instead of \class - Move the comment block to the right place --- include/libcamera/internal/formats.h | 13 +++++----- src/libcamera/formats.cpp | 38 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index 51a8a6b8b0ae..a07de6bc6020 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -19,12 +19,6 @@ namespace libcamera { -struct PixelFormatPlaneInfo -{ - unsigned int bytesPerGroup; - unsigned int verticalSubSampling; -}; - class PixelFormatInfo { public: @@ -34,6 +28,11 @@ public: ColourEncodingRAW, }; + struct Plane { + unsigned int bytesPerGroup; + unsigned int verticalSubSampling; + }; + bool isValid() const { return format.isValid(); } static const PixelFormatInfo &info(const PixelFormat &format); @@ -58,7 +57,7 @@ public: unsigned int pixelsPerGroup; - std::array planes; + std::array planes; }; } /* namespace libcamera */ diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 603d88619fe0..1e5c8a0c36dc 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -23,22 +23,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Formats) -/** - * \class PixelFormatPlaneInfo - * \brief Information about a single plane of a pixel format - * - * \var PixelFormatPlaneInfo::bytesPerGroup - * \brief The number of bytes that a pixel group consumes - * - * \sa PixelFormatInfo::pixelsPerGroup - * - * \var PixelFormatPlaneInfo::verticalSubSampling - * \brief Vertical subsampling multiplier - * - * This value is the ratio between the number of rows of pixels in the frame - * to the number of rows of pixels in the plane. - */ - /** * \class PixelFormatInfo * \brief Information about pixel formats @@ -87,7 +71,7 @@ LOG_DEFINE_CATEGORY(Formats) * * A pixel group is defined as the minimum number of pixels (including padding) * necessary in a row when the image has only one column of effective pixels. - * pixelsPerGroup refers to this value. PixelFormatPlaneInfo::bytesPerGroup, + * pixelsPerGroup refers to this value. PixelFormatInfo::Plane::bytesPerGroup, * then, refers to the number of bytes that a pixel group consumes. This * definition of a pixel group allows simple calculation of stride, as * ceil(width / pixelsPerGroup) * bytesPerGroup. These values are determined @@ -122,7 +106,7 @@ LOG_DEFINE_CATEGORY(Formats) * \var PixelFormatInfo::planes * \brief Information about pixels for each plane * - * \sa PixelFormatPlaneInfo + * \sa PixelFormatInfo::Plane */ /** @@ -139,6 +123,22 @@ LOG_DEFINE_CATEGORY(Formats) * \brief RAW colour encoding */ +/** + * \struct PixelFormatInfo::Plane + * \brief Information about a single plane of a pixel format + * + * \var PixelFormatInfo::Plane::bytesPerGroup + * \brief The number of bytes that a pixel group consumes + * + * \sa PixelFormatInfo::pixelsPerGroup + * + * \var PixelFormatInfo::Plane::verticalSubSampling + * \brief Vertical subsampling multiplier + * + * This value is the ratio between the number of rows of pixels in the frame + * to the number of rows of pixels in the plane. + */ + namespace { const PixelFormatInfo pixelFormatInfoInvalid{}; @@ -869,7 +869,7 @@ unsigned int PixelFormatInfo::numPlanes() const { unsigned int count = 0; - for (const PixelFormatPlaneInfo &p : planes) { + for (const Plane &p : planes) { if (p.bytesPerGroup == 0) break;