Patch Detail
Show a patch.
GET /api/1.1/patches/17253/?format=api
{ "id": 17253, "url": "https://patchwork.libcamera.org/api/1.1/patches/17253/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17253/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220830074725.1059643-5-umang.jain@ideasonboard.com>", "date": "2022-08-30T07:47:22", "name": "[libcamera-devel,v4,4/7] libcamera: colorspace: Rectify the ColorSpace::Srgb preset", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c2bb4e6e2bb296ca75e2ba48cd2e50cdbb7fab2a", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/17253/mbox/", "series": [ { "id": 3452, "url": "https://patchwork.libcamera.org/api/1.1/series/3452/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3452", "date": "2022-08-30T07:47:18", "name": "Colospace adjustment and gstreamer mapping", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3452/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17253/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17253/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 1F2DAC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Aug 2022 07:47:47 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D2A9161FCD;\n\tTue, 30 Aug 2022 09:47:46 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F5C761FB9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Aug 2022 09:47:46 +0200 (CEST)", "from umang.jainideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3f:1548:78ac:4a3:edc3:c28a])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 99D5D481;\n\tTue, 30 Aug 2022 09:47:44 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661845666;\n\tbh=BJE/sijghjgSBi4m+tWWT8qpCRnDSH7pzLiDtsHQR6Y=;\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=dArSC1cf4UuQ+icETa04fQjsPRxDeIyVzJam1BW0fWBnJLQbvP5Usq49EhBw6lEpE\n\tymGplKrfsxlqcA45JxSs++7fLtADHSzHllW4x+4RKUDs7hjrcU1MP1RdVeRTYN9ZQD\n\tjEIG+geIsODLiFzuDW3vWD5yWI8HO0eKem9n7YfRynVku/oQAmd1d9d2U7eAx3E06d\n\tJauEVezuinnum7lrZ8xD9429vdcs6wn7yh5o7lXspQ3hLkXuACXsx2Nn2Nb533hKAp\n\t4TV2zGeUyp458gPXvmDin0I1i0fGduLZOuJjUQkXeJI444EptA9FvnmPf5jjoL+3GF\n\txYMRHIGQzfbyQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661845665;\n\tbh=BJE/sijghjgSBi4m+tWWT8qpCRnDSH7pzLiDtsHQR6Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pwZVOdAgUymiDZzX/cwsq647IKrnpxH+ruYNw2GYCnnsS6iNUuLJYfFdv25bvGE8f\n\tPiawHbfOYYq7tWKN1pVpMtVIbwuu94GaCKmjVvhw/ThNeETFsJTAJss2g8Ln+CrCsL\n\tNVTSJz0eQwd+K0bHPTLIwQkfGpIDwzUZ9ItBaRfw=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"pwZVOdAg\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 30 Aug 2022 13:17:22 +0530", "Message-Id": "<20220830074725.1059643-5-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.37.2", "In-Reply-To": "<20220830074725.1059643-1-umang.jain@ideasonboard.com>", "References": "<20220830074725.1059643-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 4/7] libcamera: colorspace: Rectify the\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 and full range.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/color_space.cpp | 18 ++++++++++--------\n src/libcamera/v4l2_device.cpp | 7 +++++--\n 2 files changed, 15 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/libcamera/color_space.cpp b/src/libcamera/color_space.cpp\nindex 944d0e98..ec34620a 100644\n--- a/src/libcamera/color_space.cpp\n+++ b/src/libcamera/color_space.cpp\n@@ -49,8 +49,13 @@ namespace libcamera {\n * - <a href=\"https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/colorspaces-details.html#col-bt2020\">Rec.2020</a>\n *\n * Note that there is no guarantee of a 1:1 mapping between color space names\n- * and definitions in libcamera and V4L2. A notable difference is that the sYCC\n- * libcamera color space is called JPEG in V4L2 due to historical reasons.\n+ * and definitions in libcamera and V4L2. Two notable differences are\n+ *\n+ * - The sRGB libcamera color space is defined for RGB formats only with no\n+ * Y'CbCr encoding and a full quantization range, while the V4L2 SRGB color\n+ * space has a Y'CbCr encoding and a limited quantization range.\n+ * - The sYCC libcamera color space is called JPEG in V4L2 due to historical\n+ * reasons.\n *\n * \\todo Define the color space fully in the libcamera API to avoid referencing\n * V4L2\n@@ -138,16 +143,13 @@ const ColorSpace ColorSpace::Raw = {\n };\n \n /**\n- * \\brief A constant representing the sRGB color space\n- *\n- * This is identical to the sYCC color space except that the Y'CbCr\n- * range is limited rather than full.\n+ * \\brief A constant representing the sRGB color space (RGB formats only)\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 301620f8..1d899657 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -746,7 +746,11 @@ void V4L2Device::eventAvailable()\n \n static const std::map<uint32_t, ColorSpace> v4l2ToColorSpace = {\n \t{ V4L2_COLORSPACE_RAW, ColorSpace::Raw },\n-\t{ V4L2_COLORSPACE_SRGB, ColorSpace::Srgb },\n+\t{ V4L2_COLORSPACE_SRGB, {\n+\t\tColorSpace::Primaries::Rec709,\n+\t\tColorSpace::TransferFunction::Srgb,\n+\t\tColorSpace::YcbcrEncoding::Rec601,\n+\t\tColorSpace::Range::Limited } },\n \t{ V4L2_COLORSPACE_JPEG, ColorSpace::Sycc },\n \t{ V4L2_COLORSPACE_SMPTE170M, ColorSpace::Smpte170m },\n \t{ V4L2_COLORSPACE_REC709, ColorSpace::Rec709 },\n@@ -772,7 +776,6 @@ static const std::map<uint32_t, ColorSpace::Range> v4l2ToRange = {\n \n static const std::vector<std::pair<ColorSpace, v4l2_colorspace>> colorSpaceToV4l2 = {\n \t{ ColorSpace::Raw, V4L2_COLORSPACE_RAW },\n-\t{ ColorSpace::Srgb, V4L2_COLORSPACE_SRGB },\n \t{ ColorSpace::Sycc, V4L2_COLORSPACE_JPEG },\n \t{ ColorSpace::Smpte170m, V4L2_COLORSPACE_SMPTE170M },\n \t{ ColorSpace::Rec709, V4L2_COLORSPACE_REC709 },\n", "prefixes": [ "libcamera-devel", "v4", "4/7" ] }