{"id":16920,"url":"https://patchwork.libcamera.org/api/patches/16920/?format=json","web_url":"https://patchwork.libcamera.org/patch/16920/","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-4-umang.jain@ideasonboard.com>","date":"2022-08-02T18:57:18","name":"[libcamera-devel,RFC,3/4] tests: stream: Add a colorspace adjustment test","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"128274fb48ad2f387556322528071edf3ca50cdf","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/16920/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/16920/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16920/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 F15CBC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Aug 2022 18:57:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BF74363316;\n\tTue,  2 Aug 2022 20:57:36 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B47CD603E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 20:57:34 +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 4FE4825B;\n\tTue,  2 Aug 2022 20:57:33 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659466656;\n\tbh=p4UcN+mdL4/pKtc5ZnC3kX4FFsnQ9RXd+SNOwB3OrL4=;\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=mZUV56fY7AT8kqYq+yP81m8GW325kEeeECtT9buhH+nzD4JjN154gtm14l4etoRqZ\n\tjARFxNuED1drGN+IFelOIKXdnkdIX+BTN2AmOHtIy+68PUgNZrjU+6AZUQsYw5H4r1\n\tRxPL9bgS6pY4rq8+/KzvHYx++x7CbKmbWIIE+nGOsI4j6bsKuTPzrxSvUpbTJ+S6lr\n\tPEhqLRpCRzr1fC8VuKCLeGs2/hlQBMPndY0OzjtzZbl6KKr1CUh35yGvJeOFkAUzN7\n\tVZbBYFYPVrISRBTqBeI7zyGiqmBRryTHRqGhRBAu24VSQ690mFRkD0SxRIR/cSFLzS\n\tf3HWaRr6Ah+DA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659466654;\n\tbh=p4UcN+mdL4/pKtc5ZnC3kX4FFsnQ9RXd+SNOwB3OrL4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pelhQINkFhAtnEsXgEqiDWKD2LgWnAFZqX37rA72IiandH8Lz2eVj7B0SFmvfvmCX\n\tWXMPalyjq89Wrb8FqCg4yXmsgjLEMEGTDh0Z82yQVPTYVpl91Hz2vldzcbt5HK9MSf\n\tgQHB4oFEEzHwU5+iH5PPHtNoGZNIik0p4AQWjTyU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"pelhQINk\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Aug 2022 00:27:18 +0530","Message-Id":"<20220802185719.380855-4-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 3/4] tests: stream: Add a colorspace\n\tadjustment test","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":"ColorSpace can be adjusted based on the stream's pixelFormat being\nrequested. Add a test to check the adjustment logic.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n test/stream/meson.build           |  1 +\n test/stream/stream_colorspace.cpp | 57 +++++++++++++++++++++++++++++++\n 2 files changed, 58 insertions(+)\n create mode 100644 test/stream/stream_colorspace.cpp","diff":"diff --git a/test/stream/meson.build b/test/stream/meson.build\nindex 73608ffd..bf78ddfe 100644\n--- a/test/stream/meson.build\n+++ b/test/stream/meson.build\n@@ -2,6 +2,7 @@\n \n stream_tests = [\n     ['stream_formats',  'stream_formats.cpp'],\n+    ['stream_colorspace', 'stream_colorspace.cpp'],\n ]\n \n foreach t : stream_tests\ndiff --git a/test/stream/stream_colorspace.cpp b/test/stream/stream_colorspace.cpp\nnew file mode 100644\nindex 00000000..e8ac17d3\n--- /dev/null\n+++ b/test/stream/stream_colorspace.cpp\n@@ -0,0 +1,57 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Ideas on Board Oy.\n+ *\n+ * stream_colorspace.cpp - Stream colorspace tests\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/formats.h>\n+#include <libcamera/stream.h>\n+\n+#include \"test.h\"\n+\n+using namespace libcamera;\n+\n+class StreamColorSpaceTest : public Test\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tStreamConfiguration cfg;\n+\t\tcfg.size = { 640, 320 };\n+\t\tcfg.pixelFormat = formats::YUV422;\n+\t\tcfg.colorSpace = ColorSpace::Srgb;\n+\n+\t\t/* YUV stream with sRGB colorspace should have y'cbcr encoding adjusted */\n+\t\tColorSpace adjColorSpace = cfg.colorSpace->adjust(cfg);\n+\t\tif (adjColorSpace.ycbcrEncoding == ColorSpace::YcbcrEncoding::None)\n+\t\t\treturn TestFail;\n+\n+\t\t/* For RGB pixelFormat, sRGB colorspace shouldn't get adjusted */\n+\t\tcfg.pixelFormat = formats::RGB888;\n+\t\tadjColorSpace = cfg.colorSpace->adjust(cfg);\n+\t\tif (adjColorSpace == ColorSpace::Srgb)\n+\t\t\t;\n+\t\telse\n+\t\t\treturn TestFail;\n+\n+\t\t/*\n+\t\t * For YUV pixelFormat, encoding should picked up according to\n+\t\t * primaries.\n+\t\t */\n+\t\tcfg.pixelFormat = formats::YUV422;\n+\t\tcfg.colorSpace = ColorSpace(ColorSpace::Primaries::Rec2020,\n+\t\t\t\t\t    ColorSpace::TransferFunction::Rec709,\n+\t\t\t\t\t    ColorSpace::YcbcrEncoding::None,\n+\t\t\t\t\t    ColorSpace::Range::Limited);\n+\t\tadjColorSpace = cfg.colorSpace->adjust(cfg);\n+\t\tif (adjColorSpace.ycbcrEncoding != ColorSpace::YcbcrEncoding::Rec2020)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(StreamColorSpaceTest)\n","prefixes":["libcamera-devel","RFC","3/4"]}