{"id":16567,"url":"https://patchwork.libcamera.org/api/1.1/patches/16567/?format=json","web_url":"https://patchwork.libcamera.org/patch/16567/","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":"<20220707094402.28730-2-rishikeshdonadkar@gmail.com>","date":"2022-07-07T09:43:59","name":"[libcamera-devel,v2,1/4] gstreamer: convert from libcamera colorspace toGStreamer colorimetry.","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a425da818971b17092ba8688523e7942e93fc4e0","submitter":{"id":118,"url":"https://patchwork.libcamera.org/api/1.1/people/118/?format=json","name":"Rishikesh Donadkar","email":"rishikeshdonadkar@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16567/mbox/","series":[{"id":3263,"url":"https://patchwork.libcamera.org/api/1.1/series/3263/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3263","date":"2022-07-07T09:43:58","name":"Add colorimetry support to libcamera gstreamer element.","version":2,"mbox":"https://patchwork.libcamera.org/series/3263/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16567/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16567/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 0E01CBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 Jul 2022 09:45:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BCE176048D;\n\tThu,  7 Jul 2022 11:45:09 +0200 (CEST)","from mail-pf1-x435.google.com (mail-pf1-x435.google.com\n\t[IPv6:2607:f8b0:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 97DBA60401\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 Jul 2022 11:45:07 +0200 (CEST)","by mail-pf1-x435.google.com with SMTP id x184so4905141pfx.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 07 Jul 2022 02:45:07 -0700 (PDT)","from localhost.localdomain\n\t([2402:8100:30ae:d446:13ee:d079:112a:ac10])\n\tby smtp.googlemail.com with ESMTPSA id\n\tp2-20020a1709027ec200b00168f08d0d12sm24530712plb.89.2022.07.07.02.45.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 07 Jul 2022 02:45:05 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657187109;\n\tbh=vrmX0jagPaiuqOHcRlTN4eBQIdjthx/IP+2DusFR41M=;\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=j4X5G1MML/CIVPJ4IeRUy9qkpeNjxQucVDaI/QEgpk0aiBRw4o9SrmbPbxmGL5/c+\n\ttLOEMHcHHI2O2NNnqtO69FyM1OnSbRl3RiwJaHT4L9NstzHRd9/fQlyGfN/+jc0bdo\n\tZthnQQk5AIr0F3RHeasC4X/vAxshAlikaELlTHYZU37syYurBazOQlfQOkuLtHwT2l\n\tNVKj8GEvJIlCmUdsZS7RY+RfgKC5NqoNBO/JOVe4+a/+1hTLSLOoQnFias3zrp4Xa9\n\tcImH9Y4W5VxdWGaln0EyY/8lUjalJI+McxpZ9rYKtVul/xfZBP2r/6ZsN+6LCtSkwA\n\t0RYcA7iorYp7A==","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=tyDMdzAvFdoqw+pj00jWOccwYIWcruJQCOAJ7uJJFD0=;\n\tb=NxUSjJMt3qRBrfu2tu/11f7mmOdh4FjDQ7IU2m5nuf82d16L23+umPdOln0KJIgWDN\n\tLcpS/HXWP2RGp5ymxVqoR2ePebtvUNiYHjMjScgn0kucEGcrwcMzTR7nCTq0X+s1Er5x\n\t7X6pl+YP8KT6RpmNZxdZ5CsEBcIEx6Pc4npe6gGabuZyksBNzlsdMWSYo3bZWqm1Rr4v\n\tfvMSAWnSLjcxHe4phlVGKdKynLonhWhmKfTN3shGL13YY2CHe9EEECvJ0pBy9dKeYFYu\n\tdkWfT2sT8VA0uO3ltjoHX/d/N4vIwZwa70Q+9FaKlCCI8bGive+yizNZFTKiTalDNUZv\n\tV3TA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"NxUSjJMt\"; 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=tyDMdzAvFdoqw+pj00jWOccwYIWcruJQCOAJ7uJJFD0=;\n\tb=ajbtkaC9oQdwvXsnj9crSl/kPdc2UKdt++bs67Rc9LReJ0osmJrshYrHfC3NRNXMv6\n\t98mxk44fURhrOIV/CaYQq5JecXTj8ypTzYVyeCV9rIz2lqYPgN/dfLaL094U452rbU3y\n\tHUpgPoUbixHYw+CTktO1TW35d3XWRutl/a4NqrMItOXg5/+CxLT3bn6Fu1YIcGQjanRs\n\txhFh0nfiFXd2Pbou9NZn89yzGhvDuM3j5EFzI2np30AXAijxXJAr1Id0ei2opRFW69HL\n\tPyOIK3L1lLr8GZumtL+f5AtKjvpYFC5d/ymb6KuALc6bXrnQb44h6PtAeOdMcZUT0d8H\n\tgmdg==","X-Gm-Message-State":"AJIora+OukIZtiHsdjZ1/3+YBps/WAHf7J3YaC2a7rRdahoLTQv6OZMr\n\tNOiXaJAAxot+OFudrfRaBzeGY7qQvH0=","X-Google-Smtp-Source":"AGRyM1tIv/f1M0IzdzN4p8SLR5jgPUcpvkhByHoCAo3TfI6aIVyZI70wawZyLSQWsfA3h3+mg9nj2Q==","X-Received":"by 2002:a63:2bd0:0:b0:412:2f70:f0ac with SMTP id\n\tr199-20020a632bd0000000b004122f70f0acmr19319758pgr.465.1657187105816; \n\tThu, 07 Jul 2022 02:45:05 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  7 Jul 2022 15:13:59 +0530","Message-Id":"<20220707094402.28730-2-rishikeshdonadkar@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220707094402.28730-1-rishikeshdonadkar@gmail.com>","References":"<20220707094402.28730-1-rishikeshdonadkar@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 1/4] gstreamer: convert from libcamera\n\tcolorspace toGStreamer 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\nMap the libcamera colorspace to GStreamer colorimetry and find\nthe colorimetry corresponding to the colorspace that is being applied to\nthe camera. This colorimetry if found will be pushed in the caps.\n\nSigned-off-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>\n---\n src/gstreamer/gstlibcamera-utils.cpp | 32 ++++++++++++++++++++++++++++\n 1 file changed, 32 insertions(+)","diff":"diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex c97c0d43..60ac8c8e 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,32 @@ bare_structure_from_format(const PixelFormat &format)\n \t}\n }\n \n+static gchar *\n+colorimerty_from_colorspace(std::optional<ColorSpace> colorSpace)\n+{\n+\tgchar *colorimetry_str = nullptr;\n+\tgchar *colorimetry_found = nullptr;\n+\tGstVideoColorimetry colorimetry;\n+\tgboolean isColorimetryValid;\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\tcolorimetry_found = (gchar *)iterColorimetry->second.c_str();\n+\t\tisColorimetryValid = gst_video_colorimetry_from_string(&colorimetry, colorimetry_found);\n+\t}\n+\tif (isColorimetryValid) {\n+\t\tcolorimetry_str = gst_video_colorimetry_to_string(&colorimetry);\n+\t\treturn colorimetry_str;\n+\t} else {\n+\t\tg_free(colorimetry_found);\n+\t\tg_free(colorimetry_str);\n+\t\treturn nullptr;\n+\t}\n+}\n+\n GstCaps *\n gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n {\n","prefixes":["libcamera-devel","v2","1/4"]}