Patch Detail
Show a patch.
GET /api/patches/16588/?format=api
{ "id": 16588, "url": "https://patchwork.libcamera.org/api/patches/16588/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16588/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20220711153711.36679-2-rishikeshdonadkar@gmail.com>", "date": "2022-07-11T15:37:07", "name": "[libcamera-devel,v3,1/5] gstreamer: convert from libcamera colorspace to GStreamer colorimetry.", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d7d5b532c590feced4d31325456a0f89ec24b56e", "submitter": { "id": 118, "url": "https://patchwork.libcamera.org/api/people/118/?format=api", "name": "Rishikesh Donadkar", "email": "rishikeshdonadkar@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16588/mbox/", "series": [ { "id": 3270, "url": "https://patchwork.libcamera.org/api/series/3270/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3270", "date": "2022-07-11T15:37:06", "name": "Add colorimetry support to libcamera gstreamer element.", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3270/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16588/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16588/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 71811BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 Jul 2022 15:38:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 33CD563314;\n\tMon, 11 Jul 2022 17:38:15 +0200 (CEST)", "from mail-pl1-x630.google.com (mail-pl1-x630.google.com\n\t[IPv6:2607:f8b0:4864:20::630])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D232E62752\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jul 2022 17:38:13 +0200 (CEST)", "by mail-pl1-x630.google.com with SMTP id r1so4732806plo.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jul 2022 08:38:13 -0700 (PDT)", "from localhost.localdomain ([103.124.170.70])\n\tby smtp.googlemail.com with ESMTPSA id\n\tu18-20020a17090a891200b001ef87123615sm4891268pjn.37.2022.07.11.08.38.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 11 Jul 2022 08:38:12 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657553895;\n\tbh=Zl+9vM7+8kBDEy6q+NzqQN+ttnRwn2yb/D3tfz014G8=;\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=avc8lhXV6jZRSLuAOgjuw5BiFefIii1434x49lZyb96NO7tp9kGLX0S5dpMrmw7UL\n\tWs5RQ/qxkmX2gglKjGY3NRUEqa2rZiGOwinT83K2maY3/3+z6BIGdbF8UdgfQdswfl\n\tyJ754XMgVnVyhSjl2vQK6+JEfFJzX1+yPlbrNWd0rua61LKsimOjHeyA244Z1dy/JD\n\to+ZDNShowE+tDO8tEPrUmjrXfGCFRWB9K2NfkVc1zFi+YNQZCIZxItis68tjwVAEJF\n\t48CrvzkQmKgZawCIxNSpTA3rWPb/txw9gNKJURL2WCDuML/z1E4rH9HoTeKPA+4hhd\n\tKaae+kBMmblhg==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=NS5pu0DCGUGMfH4dnx5Vf+qPgIETX9SXZ9Vco7I7X2A=;\n\tb=KcH7gjsfr7uM6VTzACZ7CdjFTk3i+yOAPn8NLwi/loddjV1k/UH1WHJuIgeBxO0pYu\n\tA/NHdxRClFbZiJj/BUZOqn4Ohpwv6XiKncNPMvOofaQ7W2fzWMyg4t07wNaU0HEJZtL5\n\tnxLKWptu69TLWNusue4A0WAc99ZGBiDk/x7TXqZ/tSx5b9j9pCAqxDKNiIEB4aMRb3n1\n\tzqpf9F3bca/L3WuKmalAM7xPfYwKIiQI/AstC4OclcXzngM5EJ9BUrPVGrtbZ84Zonym\n\tUQUuwoLAu1zU6O4tAXjX4OvF97Uc4v+52MvgGocItmxGDRHcCmfOAtARjhll14qMwAlt\n\tWJ5A==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"KcH7gjsf\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=NS5pu0DCGUGMfH4dnx5Vf+qPgIETX9SXZ9Vco7I7X2A=;\n\tb=VtJvOUjh+Oc1s9dQSD16x/NORHyvll1Uo5j99ABOqbvInDtP2CtcPEksDnrlWIE+F8\n\tmSORXUWk1/8oLM+OfSFG8N8q9DY+7lN0fgGQ9ON4EuDJF55X8wlzHDgoLIfbLMSHQ+3e\n\tBuhkO3cH0LDq4cuV4jPOuUjVICZdvoe1jauy4pcITYyHIZmyZOMz3xCrJkJC1wTJsgsR\n\twhjA9n7OWfVtlSYXfQhQmGFLJ/uQPzSOqBnKh4ltfqEgmQ0gvreNcY4zoJ7/qunTWiKZ\n\tM3Jpsxw1EMS9dUoGZdcDYDNjGnmgN0yCseC26+F6XHjyfOwL0aR9jLgGxPFpAZCQ1hWR\n\tiygA==", "X-Gm-Message-State": "AJIora//42358+/hRgO900OIMIEpjrpomA6JRGsy0+4ebRNmOAJMsraJ\n\tQ4GtdbKSDDEaFl+fwoRi/LZKP5KIrqw=", "X-Google-Smtp-Source": "AGRyM1tQZSUGmO5mRu/V3HSZGc1ogfTSkE09uOhMRqxfYI1SCRIpLuiCaDxeACuX8QPl+FWcIIG/AQ==", "X-Received": "by 2002:a17:902:c952:b0:16c:1cdd:9077 with SMTP id\n\ti18-20020a170902c95200b0016c1cdd9077mr19492012pla.168.1657553892227; \n\tMon, 11 Jul 2022 08:38:12 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 11 Jul 2022 21:07:07 +0530", "Message-Id": "<20220711153711.36679-2-rishikeshdonadkar@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220711153711.36679-1-rishikeshdonadkar@gmail.com>", "References": "<20220711153711.36679-1-rishikeshdonadkar@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 1/5] gstreamer: convert from libcamera\n\tcolorspace to GStreamer colorimetry.", "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": "Rishikesh Donadkar via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Rishikesh Donadkar <rishikeshdonadkar@gmail.com>", "Cc": "Rishikesh Donadkar <rishikeshdonadkar@gmail.com>,\n\tnicolas.dufresne@collabora.com, vedantparanjape160201@gmail.com", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Libcamera StreamConfiguration class has colorSpace attribute, which\nholds the colorspace that is being applied to the camera after the\nvalidation of the camera configuration.\n\nAdd a std::map that will map libcamera colorspace to GStreamer colorimetry and\nfind the colorimetry corresponding to the colorspace that is being applied to\nthe camera.If the colorimetry is found, the helper function\nlibcamera_colorimetry_to_gst_string() will take in a std::string representation\nof colorimetry and convert it into G_TYPE_STRING so that it can be pushed into the\ncaps. No need to check if the colorimetry if found is valid as we are working with\nknown predefined colorimetry.\n\nSigned-off-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>\n---\n src/gstreamer/gstlibcamera-utils.cpp | 30 ++++++++++++++++++++++++++++\n 1 file changed, 30 insertions(+)", "diff": "diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex c97c0d43..43837602 100644\n--- a/src/gstreamer/gstlibcamera-utils.cpp\n+++ b/src/gstreamer/gstlibcamera-utils.cpp\n@@ -45,6 +45,12 @@ static struct {\n \t/* \\todo NV42 is used in libcamera but is not mapped in GStreamer yet. */\n };\n \n+static const std::vector<std::pair<ColorSpace, std::string>> ColorSpaceToColorimetry = {\n+\t{ ColorSpace::Srgb, GST_VIDEO_COLORIMETRY_SRGB },\n+\t{ ColorSpace::Rec709, GST_VIDEO_COLORIMETRY_BT709 },\n+\t{ ColorSpace::Rec2020, GST_VIDEO_COLORIMETRY_BT2020 },\n+};\n+\n static GstVideoFormat\n pixel_format_to_gst_format(const PixelFormat &format)\n {\n@@ -87,6 +93,30 @@ bare_structure_from_format(const PixelFormat &format)\n \t}\n }\n \n+static gchar *\n+libcamera_colorimetry_to_gst_string(const std::string &colorimetry_str)\n+{\n+\tgchar *colorimetry_gst_string = (gchar *)colorimetry_str.c_str();\n+\treturn colorimetry_gst_string;\n+}\n+\n+static gchar *\n+colorimetry_from_colorspace(ColorSpace colorSpace)\n+{\n+\tgchar *colorimetry_gst_string = nullptr;\n+\n+\tauto iterColorimetry = std::find_if(ColorSpaceToColorimetry.begin(), ColorSpaceToColorimetry.end(),\n+\t\t\t\t\t [&colorSpace](const auto &item) {\n+\t\t\t\t\t\t return colorSpace == item.first;\n+\t\t\t\t\t });\n+\tif (iterColorimetry != ColorSpaceToColorimetry.end()) {\n+\t\tconst std::string &colrorimetry_string = iterColorimetry->second;\n+\t\tcolorimetry_gst_string = libcamera_colorimetry_to_gst_string(colrorimetry_string);\n+\t}\n+\t\t\n+\treturn colorimetry_gst_string;\n+}\n+\n GstCaps *\n gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n {\n", "prefixes": [ "libcamera-devel", "v3", "1/5" ] }