From patchwork Sun Oct 26 12:56:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 24821 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 063D0C3259 for ; Sun, 26 Oct 2025 12:56:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D13E4606E6; Sun, 26 Oct 2025 13:56:25 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="XJCMKxfu"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 166C1606A0 for ; Sun, 26 Oct 2025 13:56:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4HjnlcL5zT6+wwtNnR/T5Q+NobO/hgOzKTGqtjwNPSg=; b=XJCMKxfuQOpBGfIpnu6lspUESl T/TPWai7VdCbju+58aaM9mweExaXnANkiXcPC8CT5znJEp/e95IjJ86kt08qZodiTi0URkLUbtXRt REqCwj4UhmJRx1oKR4sZws9SX0qvbmQ9JcUoWpT4vO/eReTffcXdGMO3RocS3iRS/xxAIhxO+tVOo VhJqhYDY3VsNgXc+9DkpqbtuyAXIH0GC7C5m1CyAC3kwQlmXxP2o6fpC8JjkXbAAe5PYPQcSFXOQ5 zOzbzogmlicrbl6blL9e02CEgYzuz08Q6XNH7wxPdHIb6kA6ia0xUpFAz3dIBR13eW1BI37d9mAUI ogEjvNLQ==; Received: from amazon1-vf-gw.lnd.cw.net ([195.89.103.118] helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vD0IH-00FPma-5w; Sun, 26 Oct 2025 13:56:21 +0100 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Umang Jain , Kieran Bingham , Robert Mader Subject: [PATCH v4 1/2] pipeline: virtual: Provide and validate colorspace Date: Sun, 26 Oct 2025 12:56:49 +0000 Message-ID: <20251026125650.117468-2-uajain@igalia.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251026125650.117468-1-uajain@igalia.com> References: <20251026125650.117468-1-uajain@igalia.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" Virtual pipeline handler should provide colorSpace in generateConfiguration() and validate the colorspace in validate(). It is mandatory for a pipeline handler to set the colorspace if it is unset in the stream configuration, during validate(). For choosing the colorspace for the generated NV12 frames, following points have been taken into account: - The transfer function should be Rec.709 for NV12 - The YCbCr encoding has been chosen Rec.709 as it is the most common than Rec.601/Rec.2020 - Range should be 'Limited' as with the NV12 pixel format. Hence, the closest colorspace match is ColorSpace::Rec709 which is set for the virtual pipeline handler. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Tested-by: Robert Mader --- src/libcamera/pipeline/virtual/virtual.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index 23eae852..c0247b4d 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -214,6 +214,18 @@ CameraConfiguration::Status VirtualCameraConfiguration::validate() adjusted = true; } + if (!cfg.colorSpace || + cfg.colorSpace != ColorSpace::Rec709) { + cfg.colorSpace = ColorSpace::Rec709; + status = Adjusted; + adjusted = true; + } + + if (validateColorSpaces() == Adjusted) { + status = Adjusted; + adjusted = true; + } + if (adjusted) LOG(Virtual, Info) << "Stream configuration adjusted to " << cfg.toString(); @@ -278,6 +290,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera, cfg.pixelFormat = pixelFormat; cfg.size = data->config_.maxResolutionSize; cfg.bufferCount = VirtualCameraConfiguration::kBufferCount; + cfg.colorSpace = ColorSpace::Rec709; config->addConfiguration(cfg); } From patchwork Sun Oct 26 12:56:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 24820 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 74C02C3259 for ; Sun, 26 Oct 2025 12:56:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 896B3606FA; Sun, 26 Oct 2025 13:56:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="QyV1rAuR"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 40758606DB for ; Sun, 26 Oct 2025 13:56:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TBfewWrmSezXtX+gLZd/PzvEIbXBvFZcoTZptg7F9Uk=; b=QyV1rAuRwiLiP8SNVd58ArV/UW V4mi4G+WrVhbhyAAgjv+JTNDAfFjiYC213k6FKLFS+CPB/gie8ALPKYBJWqFjgcv9NBohk4hxTK2L OCvxxFUVMuLUhzJ91AyT2XOgcCQD4naW4A7gyc+MEHWfEnoaC9pSij4ehhDIJ+NY41rsiodONL2vB n7s9t7kEs0ONEe1+cMa5ZVeTOPmFGvOAdWifqy2HQvidmUQjCrGbpyQwt8qsWWUYmCqVQ69hD1GML Z7nwkqdz3wpSGSqNuHQW/jbRoXlypZp0Mi27krgrObsEI2ORrbj9eK05CeIj/3QY7S5YCtvTDzuzL TK5Ss0eA==; Received: from amazon1-vf-gw.lnd.cw.net ([195.89.103.118] helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vD0IH-00FPma-Hr; Sun, 26 Oct 2025 13:56:21 +0100 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Umang Jain , Kieran Bingham , Robert Mader , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v4 2/2] lc-compliance: Ensure stream's colorspace is set after validate() Date: Sun, 26 Oct 2025 12:56:50 +0000 Message-ID: <20251026125650.117468-3-uajain@igalia.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251026125650.117468-1-uajain@igalia.com> References: <20251026125650.117468-1-uajain@igalia.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" StreamConfiguration::colorspace is a std::optional<> and if unset by the user, it should be populated by the pipeline handler after the CameraConfiguration::validate(). Add a EXPECT_TRUE() check to ensure that each stream in the CameraConfiguration has a colorspace set. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Tested-by: Robert Mader Reviewed-by: Barnabás Pőcze --- src/apps/lc-compliance/helpers/capture.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp index 2a3fa3b6..dbccc3ff 100644 --- a/src/apps/lc-compliance/helpers/capture.cpp +++ b/src/apps/lc-compliance/helpers/capture.cpp @@ -52,6 +52,9 @@ void Capture::configure(libcamera::Span roles) FAIL() << "Configuration not valid"; } + for (const auto &cfg : *config_) + EXPECT_TRUE(cfg.colorSpace) << "Colorspace not set for " << cfg; + if (camera_->configure(config_.get())) { config_.reset(); FAIL() << "Failed to configure camera";