From patchwork Mon Sep 30 15:20:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 21434 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 53626C3257 for ; Mon, 30 Sep 2024 15:20:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EBCD96351B; Mon, 30 Sep 2024 17:20:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="srCWnVAk"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 007A363518 for ; Mon, 30 Sep 2024 17:20:46 +0200 (CEST) Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C3E4932A; Mon, 30 Sep 2024 17:19:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727709555; bh=qktxQKMBuvhmkuSEABOIVjB0z+lsOLERssYxH3hA6nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srCWnVAkLL+iFIuqpvBVSBvwdh++UGstIvtnNv2+rA80JwrAbgONA8C6C8eWz+tQ5 bzUBFfV1tscsdDhJwDel90EGsaraz3PQxfMVvxly2VEGVTpQQP/Ama2TTzKXSO6Wq3 yT2O+Cxx6q8swY9D6+roAabSSVG0TPbTXIhLCLa0= From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Laurent Pinchart , Jacopo Mondi , Kieran Bingham , Daniel Scally , Umang Jain Subject: [PATCH 1/2] libcamera: pixel_format: Add isRaw() helper Date: Mon, 30 Sep 2024 20:50:38 +0530 Message-ID: <20240930152039.72459-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240930152039.72459-1-umang.jain@ideasonboard.com> References: <20240930152039.72459-1-umang.jain@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" Add a isRaw() helper to the PixelFormat class, to know whether the pixel format has RAW encoding. This will used by validation and configuration code paths in pipeline handlers, to know whether a pixel format is a raw format or not. Signed-off-by: Umang Jain Reviewed-by: Jacopo Mondi --- include/libcamera/pixel_format.h | 1 + src/libcamera/pixel_format.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h index 1b4d8c7c..aed53ea6 100644 --- a/include/libcamera/pixel_format.h +++ b/include/libcamera/pixel_format.h @@ -37,6 +37,7 @@ public: constexpr uint64_t modifier() const { return modifier_; } std::string toString() const; + bool isRaw() const; static PixelFormat fromString(const std::string &name); diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp index 314179a8..436ef5fb 100644 --- a/src/libcamera/pixel_format.cpp +++ b/src/libcamera/pixel_format.cpp @@ -100,6 +100,17 @@ bool PixelFormat::operator<(const PixelFormat &other) const * \return DRM modifier */ +/** + * \brief Checks if \a this is a RAW pixel format + * \return True if \a this is a RAW pixel format, false otherwise + */ +bool PixelFormat::isRaw() const +{ + const PixelFormatInfo &info = PixelFormatInfo::info(*this); + + return info.colourEncoding == PixelFormatInfo::ColourEncodingRAW; +} + /** * \brief Assemble and return a string describing the pixel format * \return A string describing the pixel format