{"id":24821,"url":"https://patchwork.libcamera.org/api/patches/24821/?format=json","web_url":"https://patchwork.libcamera.org/patch/24821/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251026125650.117468-2-uajain@igalia.com>","date":"2025-10-26T12:56:49","name":"[v4,1/2] pipeline: virtual: Provide and validate colorspace","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ade17dd170819dc2035e72eca58d704829195968","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/?format=json","name":"Umang Jain","email":"uajain@igalia.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24821/mbox/","series":[{"id":5531,"url":"https://patchwork.libcamera.org/api/series/5531/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5531","date":"2025-10-26T12:56:50","name":"lc-compliance: Ensure stream's colorspace is set after validate()","version":4,"mbox":"https://patchwork.libcamera.org/series/5531/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24821/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24821/checks/","tags":{},"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 063D0C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 26 Oct 2025 12:56:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D13E4606E6;\n\tSun, 26 Oct 2025 13:56:25 +0100 (CET)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 166C1606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 26 Oct 2025 13:56:22 +0100 (CET)","from amazon1-vf-gw.lnd.cw.net ([195.89.103.118] helo=uajain)\n\tby fanzine2.igalia.com with esmtpsa \n\t(Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1vD0IH-00FPma-5w; Sun, 26 Oct 2025 13:56:21 +0100"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"XJCMKxfu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=4HjnlcL5zT6+wwtNnR/T5Q+NobO/hgOzKTGqtjwNPSg=;\n\tb=XJCMKxfuQOpBGfIpnu6lspUESl\n\tT/TPWai7VdCbju+58aaM9mweExaXnANkiXcPC8CT5znJEp/e95IjJ86kt08qZodiTi0URkLUbtXRt\n\tREqCwj4UhmJRx1oKR4sZws9SX0qvbmQ9JcUoWpT4vO/eReTffcXdGMO3RocS3iRS/xxAIhxO+tVOo\n\tVhJqhYDY3VsNgXc+9DkpqbtuyAXIH0GC7C5m1CyAC3kwQlmXxP2o6fpC8JjkXbAAe5PYPQcSFXOQ5\n\tzOzbzogmlicrbl6blL9e02CEgYzuz08Q6XNH7wxPdHIb6kA6ia0xUpFAz3dIBR13eW1BI37d9mAUI\n\togEjvNLQ==;","From":"Umang Jain <uajain@igalia.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Umang Jain <uajain@igalia.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>","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","Content-Transfer-Encoding":"8bit","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>"},"content":"Virtual pipeline handler should provide colorSpace in\ngenerateConfiguration() and validate the colorspace in validate().\nIt is mandatory for a pipeline handler to set the colorspace if it\nis unset in the stream configuration, during validate().\n\nFor choosing the colorspace for the generated NV12 frames, following\npoints have been taken into account:\n- The transfer function should be Rec.709 for NV12\n- The YCbCr encoding has been chosen Rec.709 as it is the most common\n  than Rec.601/Rec.2020\n- Range should be 'Limited' as with the NV12 pixel format.\n\nHence, the closest colorspace match is ColorSpace::Rec709 which is\nset for the virtual pipeline handler.\n\nSigned-off-by: Umang Jain <uajain@igalia.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nTested-by: Robert Mader <robert.mader@collabora.com>\n---\n src/libcamera/pipeline/virtual/virtual.cpp | 13 +++++++++++++\n 1 file changed, 13 insertions(+)","diff":"diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp\nindex 23eae852..c0247b4d 100644\n--- a/src/libcamera/pipeline/virtual/virtual.cpp\n+++ b/src/libcamera/pipeline/virtual/virtual.cpp\n@@ -214,6 +214,18 @@ CameraConfiguration::Status VirtualCameraConfiguration::validate()\n \t\t\tadjusted = true;\n \t\t}\n \n+\t\tif (!cfg.colorSpace ||\n+\t\t    cfg.colorSpace != ColorSpace::Rec709) {\n+\t\t\tcfg.colorSpace = ColorSpace::Rec709;\n+\t\t\tstatus = Adjusted;\n+\t\t\tadjusted = true;\n+\t\t}\n+\n+\t\tif (validateColorSpaces() == Adjusted) {\n+\t\t\tstatus = Adjusted;\n+\t\t\tadjusted = true;\n+\t\t}\n+\n \t\tif (adjusted)\n \t\t\tLOG(Virtual, Info)\n \t\t\t\t<< \"Stream configuration adjusted to \" << cfg.toString();\n@@ -278,6 +290,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera,\n \t\tcfg.pixelFormat = pixelFormat;\n \t\tcfg.size = data->config_.maxResolutionSize;\n \t\tcfg.bufferCount = VirtualCameraConfiguration::kBufferCount;\n+\t\tcfg.colorSpace = ColorSpace::Rec709;\n \n \t\tconfig->addConfiguration(cfg);\n \t}\n","prefixes":["v4","1/2"]}