[{"id":37111,"web_url":"https://patchwork.libcamera.org/comment/37111/","msgid":"<20251201020501.GF4301@pendragon.ideasonboard.com>","date":"2025-12-01T02:05:01","subject":"Re: [PATCH v5 1/2] pipeline: virtual: Provide and validate\n\tcolorspace","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Nov 03, 2025 at 10:13:14PM +0000, Umang Jain wrote:\n> Virtual pipeline handler should provide colorSpace in\n> generateConfiguration() and validate the colorspace in validate().\n> It is mandatory for a pipeline handler to set the colorspace if it\n> is unset in the stream configuration, during validate().\n> \n> For choosing the colorspace for the generated NV12 frames, following\n> points 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\nThis doesn't look right. Have you looked at home frames are generated ?\nColor spaces are not values we set randomly to please compliance checks.\nThey need to reflect the contents of the image.\n\nThe virtual pipeline handler can read images from files, or generate\ntest patterns. In both cases they're converted to NV12 with libyuv.\nPlease check what colorspace is generated in both cases, and set the\ncolorspace accordingly. As this patch has been merged, we need a fix on\ntop.\n\n> Hence, the closest colorspace match is ColorSpace::Rec709 which is\n> set for the virtual pipeline handler.\n> \n> Signed-off-by: Umang Jain <uajain@igalia.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Tested-by: Robert Mader <robert.mader@collabora.com>\n> ---\n>  src/libcamera/pipeline/virtual/virtual.cpp | 12 ++++++++++++\n>  1 file changed, 12 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp\n> index 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}","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 BFB18C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Dec 2025 02:05:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F368360AA7;\n\tMon,  1 Dec 2025 03:05:28 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81C7360805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Dec 2025 03:05:24 +0100 (CET)","from pendragon.ideasonboard.com (fp76f193f3.tkyc206.ap.nuro.jp\n\t[118.241.147.243])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 9963E1648; \n\tMon,  1 Dec 2025 03:03:09 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kF2HaRHQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764554590;\n\tbh=ccEm6XXyG9bTk7tK5jrtmus4meFyTi/k6v+IixPTdRI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kF2HaRHQkEWHz7TQA/9mSSCpa7rtXxfgn1kWBh+9E+9TlOiWCx6ATTkHFNXYlPxu9\n\tiu2VSwA9mgMLIs/+Y5o1+w98+QF9VC2jPjp4i32Z0CgrXt6FlofRnOmFQl3ZytSf/E\n\tPwCjvYFnRpTTssak19TRxvoCfIH5NdJTnBpx0sHc=","Date":"Mon, 1 Dec 2025 11:05:01 +0900","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <uajain@igalia.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tRobert Mader <robert.mader@collabora.com>","Subject":"Re: [PATCH v5 1/2] pipeline: virtual: Provide and validate\n\tcolorspace","Message-ID":"<20251201020501.GF4301@pendragon.ideasonboard.com>","References":"<20251103221315.73350-1-uajain@igalia.com>\n\t<20251103221315.73350-2-uajain@igalia.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251103221315.73350-2-uajain@igalia.com>","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>"}}]