{"id":16918,"url":"https://patchwork.libcamera.org/api/patches/16918/?format=json","web_url":"https://patchwork.libcamera.org/patch/16918/","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":"<20220802185719.380855-2-umang.jain@ideasonboard.com>","date":"2022-08-02T18:57:16","name":"[libcamera-devel,RFC,1/4] libcamera: colorspace: Rectify ColorSpace::Srgb preset","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"540aef37f788fc8cae70670d89e80ef898345fa7","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16918/mbox/","series":[{"id":3360,"url":"https://patchwork.libcamera.org/api/series/3360/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3360","date":"2022-08-02T18:57:15","name":"Colorspace adjustments and gstreamer mapping","version":1,"mbox":"https://patchwork.libcamera.org/series/3360/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16918/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16918/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 17AEBC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Aug 2022 18:57:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AEA2E63317;\n\tTue,  2 Aug 2022 20:57:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 44FD1603E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 20:57:30 +0200 (CEST)","from perceval.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3f:85c2:5ee8:5bb8:aca7:5517])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C886025B;\n\tTue,  2 Aug 2022 20:57:28 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659466652;\n\tbh=mFbQuwMkfn3ZjgGgGsMXPZqDOEOCiI4vwkTD+aI3SYs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=teO4VnZTJABLtHgL8BkrcTGn8vtEF0tHkTMAuN8RL7Xv+KtpREJBx0GolLCLhmcqT\n\t2dV7otYGOedx/k/rvuNrOBfitPdBfNaNC82fD776PmVQJ6QitnFfX4ATD8ASXnO3nx\n\tVsH6MMoPwGBTeHCiyXfwQgMGH+CE7Bv07tvlz66pv7QHk0y0vGfkEqrOa8QUI6BqZT\n\t4L4UInVCU5QlxgORZB3KjqqxSrXrv2FhQVY2gEXsRlY482Tmg/dDTfatywvH/S2Y8D\n\tSoHE6bVvSZfkQIHkh/2akclHBq42HkjAS7w1NYh7LTYUhO0rj3MKcE4FtdGRZ/L0S8\n\tGn2j/w+s4Q8nw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659466650;\n\tbh=mFbQuwMkfn3ZjgGgGsMXPZqDOEOCiI4vwkTD+aI3SYs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ds1bVcF/uzH1/1wGyk6adEYhLhcSS7oqK48JyM2pP5dFS4WmUkQH/wsf20/tiDdfv\n\th7HQs4Ef15TRFrInto8XPXCohwvJ9pMyzwWBY2hDoX3lcc0gpZNIEOM5zUcQyntMy3\n\tq7W8RSVs1dSkAoHFDp+Izq0R8/sSA5Gquc6m8XYk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ds1bVcF/\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Aug 2022 00:27:16 +0530","Message-Id":"<20220802185719.380855-2-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220802185719.380855-1-umang.jain@ideasonboard.com>","References":"<20220802185719.380855-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH 1/4] libcamera: colorspace: Rectify\n\tColorSpace::Srgb preset","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"rishikeshdonadkar@gmail.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Rectify the ColorSpace::Srgb to denote that it does not use\nany Y'Cbcr encoding and uses full range.\n\nThe kernel on the other hand, recommends to use Rec601 as the encoding\nfor V4L2_COLORSPACE_SRGB. It is not very explicit but it can be\ninferred that the kernel assumes V4L2_COLORSPACE_SRGB is a YUV-encoded\none. However, when the data is in RGB, no encoding is required (and\nthis is denoted by YcbcrEncoding::None in libcamera).\n\nHence, to be clear on the libcamera colorspace API, rectify the\nColorSpace::Srgb preset to use YcbcrEncoding::None.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/libcamera/color_space.cpp | 9 +++------\n src/libcamera/v4l2_device.cpp | 2 --\n 2 files changed, 3 insertions(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/color_space.cpp b/src/libcamera/color_space.cpp\nindex caf39760..73148228 100644\n--- a/src/libcamera/color_space.cpp\n+++ b/src/libcamera/color_space.cpp\n@@ -254,16 +254,13 @@ const ColorSpace ColorSpace::Jpeg = {\n };\n \n /**\n- * \\brief A constant representing the sRGB color space\n- *\n- * This is identical to the JPEG color space except that the Y'CbCr\n- * range is limited rather than full.\n+ * \\brief A constant representing the sRGB color space (non-YUV format)\n  */\n const ColorSpace ColorSpace::Srgb = {\n \tPrimaries::Rec709,\n \tTransferFunction::Srgb,\n-\tYcbcrEncoding::Rec601,\n-\tRange::Limited\n+\tYcbcrEncoding::None,\n+\tRange::Full\n };\n \n /**\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 3fc8438f..a4446fbf 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -746,7 +746,6 @@ void V4L2Device::eventAvailable()\n static const std::map<uint32_t, ColorSpace> v4l2ToColorSpace = {\n \t{ V4L2_COLORSPACE_RAW, ColorSpace::Raw },\n \t{ V4L2_COLORSPACE_JPEG, ColorSpace::Jpeg },\n-\t{ V4L2_COLORSPACE_SRGB, ColorSpace::Srgb },\n \t{ V4L2_COLORSPACE_SMPTE170M, ColorSpace::Smpte170m },\n \t{ V4L2_COLORSPACE_REC709, ColorSpace::Rec709 },\n \t{ V4L2_COLORSPACE_BT2020, ColorSpace::Rec2020 },\n@@ -772,7 +771,6 @@ static const std::map<uint32_t, ColorSpace::Range> v4l2ToRange = {\n static const std::vector<std::pair<ColorSpace, v4l2_colorspace>> colorSpaceToV4l2 = {\n \t{ ColorSpace::Raw, V4L2_COLORSPACE_RAW },\n \t{ ColorSpace::Jpeg, V4L2_COLORSPACE_JPEG },\n-\t{ ColorSpace::Srgb, V4L2_COLORSPACE_SRGB },\n \t{ ColorSpace::Smpte170m, V4L2_COLORSPACE_SMPTE170M },\n \t{ ColorSpace::Rec709, V4L2_COLORSPACE_REC709 },\n \t{ ColorSpace::Rec2020, V4L2_COLORSPACE_BT2020 },\n","prefixes":["libcamera-devel","RFC","1/4"]}