{"id":24960,"url":"https://patchwork.libcamera.org/api/1.1/patches/24960/?format=json","web_url":"https://patchwork.libcamera.org/patch/24960/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20251103221315.73350-2-uajain@igalia.com>","date":"2025-11-03T22:13:14","name":"[v5,1/2] pipeline: virtual: Provide and validate colorspace","commit_ref":"5d2d005306ad1b64c7ad857c48a2edf8e56629f5","pull_url":null,"state":"accepted","archived":false,"hash":"b9cb521761b227b7614f7b0502743799f84095b9","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/1.1/people/232/?format=json","name":"Umang Jain","email":"uajain@igalia.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24960/mbox/","series":[{"id":5560,"url":"https://patchwork.libcamera.org/api/1.1/series/5560/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5560","date":"2025-11-03T22:13:13","name":"lc-compliance: Ensure stream's colorspace is set after validate()","version":5,"mbox":"https://patchwork.libcamera.org/series/5560/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24960/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24960/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 7C5BEC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Nov 2025 22:12:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC6C0606A0;\n\tMon,  3 Nov 2025 23:12:46 +0100 (CET)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 190E4609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Nov 2025 23:12:44 +0100 (CET)","from [81.140.124.245] (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 1vG2n4-0014tl-W7; Mon, 03 Nov 2025 23:12:43 +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=\"if3HJsXO\"; 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=Ct9HLZzOySYQhpCkPdVzjY6l4gc7S3homy94gzVMy2U=;\n\tb=if3HJsXODcm8gz4/ANGcMOLvjd\n\tp62NsdPsBGVlWS+nomvWRK6aME+9Aba/docrUHA7fazCfNpoQCqLotnv4n9VdIqvYa7k2VKav3Zb3\n\t6opasGRqFzHzyJv3ZjXjQ/qRyIuGk3S6whOMUJtBr245x7AvXmFiU9xXXEGAsaY8As5uB9GpSlwu2\n\t9SzCddVnRaQ6LJHp3RBLFY+PDGhyUIc38SiXGJXXEy4ykNvu1p/oJY/VeATU2A+aGgTZfV00DYnwI\n\tbbhFLkRfOGhv/mSRgyoqcN5XSATKbVMSl+NhQy4QWaL9nfTJdfTOYqIPbWERPh2/bhogH1ZFsUbX2\n\tcFeUJ7rw==;","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 v5 1/2] pipeline: virtual: Provide and validate colorspace","Date":"Mon,  3 Nov 2025 22:13:14 +0000","Message-ID":"<20251103221315.73350-2-uajain@igalia.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20251103221315.73350-1-uajain@igalia.com>","References":"<20251103221315.73350-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 | 12 ++++++++++++\n 1 file changed, 12 insertions(+)","diff":"diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp\nindex 23eae852..34def19b 100644\n--- a/src/libcamera/pipeline/virtual/virtual.cpp\n+++ b/src/libcamera/pipeline/virtual/virtual.cpp\n@@ -214,6 +214,17 @@ CameraConfiguration::Status VirtualCameraConfiguration::validate()\n \t\t\tadjusted = true;\n \t\t}\n \n+\t\tif (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 +289,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":["v5","1/2"]}