Show a patch.

GET /api/1.1/patches/17233/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 17233,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17233/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17233/",
    "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": "<20220829163742.1006102-7-umang.jain@ideasonboard.com>",
    "date": "2022-08-29T16:37:41",
    "name": "[libcamera-devel,v3,6/7] tests: stream: Add a colorspace adjustment test",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c81950d38bb2c4dcab859254c8370386e6036deb",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17233/mbox/",
    "series": [
        {
            "id": 3447,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3447/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3447",
            "date": "2022-08-29T16:37:35",
            "name": "Colorspace adjustments and gstreamer mappings",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3447/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17233/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17233/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 BDB05C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Aug 2022 16:38:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 820FC61FC9;\n\tMon, 29 Aug 2022 18:38:16 +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 F182F61FD0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Aug 2022 18:38:12 +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 E3DE4505;\n\tMon, 29 Aug 2022 18:38:11 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661791096;\n\tbh=WUe0whjXp/ttI/abCisnscXe/TV7eSKa/0M0PXQ8bXA=;\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:\n\tFrom;\n\tb=wxpyim4Rm7oi9ZbQSIhiRcxdxOX9gtWzl3Pli3RocmgoILP4B6PuMsZbZld0CcbHo\n\tbH9j/WHol5XbUkiu4zErCWLoe4CCLzOzXTHJcN3yU2YBkwL4gYWKnI15pd9GMDHgNn\n\tqrV9imG0PxrezmwehoF4tIG+EYRXNexdfPQiHOkrAbFYhTJPT2LDX/TN3FRlcpSo5A\n\tc999Pexar+sCbq7ZVoDnhD2efEIG/8c5wQtxprUSXtkdKOeaxM2ppozDsPyrthU+KF\n\tpCYBDXxWJa1H8sZoxNGf84NQAf3aNH9kZbvjIJZM90vYXD0CjeIPJy+rYrFzn9HKA8\n\tIFNt0arjmSJ2Q==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661791092;\n\tbh=WUe0whjXp/ttI/abCisnscXe/TV7eSKa/0M0PXQ8bXA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=EHlKk9eWkHntxjsmbkBgvgwUtNFF1uhTDVqV8tbf0FtQxeMpC2jwPzEwCjH1aDbTQ\n\t1yy1hsO7zv1zIr85EV80U1lbB0OHKhmR+Eo8OFhifHxekDOOa36eD6ekIbAT2uz6Zq\n\tzkZTKRS+hr6/Sakh+weVJGl007K3Q3r4vXkiRVgc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EHlKk9eW\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 29 Aug 2022 22:07:41 +0530",
        "Message-Id": "<20220829163742.1006102-7-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.37.2",
        "In-Reply-To": "<20220829163742.1006102-1-umang.jain@ideasonboard.com>",
        "References": "<20220829163742.1006102-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 6/7] 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>",
        "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 defined in\nColorSpace::adjust().\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n test/stream/meson.build           |  1 +\n test/stream/stream_colorspace.cpp | 87 +++++++++++++++++++++++++++++++\n 2 files changed, 88 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..89f51c18 100644\n--- a/test/stream/meson.build\n+++ b/test/stream/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n stream_tests = [\n+    ['stream_colorspace', 'stream_colorspace.cpp'],\n     ['stream_formats',  'stream_formats.cpp'],\n ]\n \ndiff --git a/test/stream/stream_colorspace.cpp b/test/stream/stream_colorspace.cpp\nnew file mode 100644\nindex 00000000..7b7e84e0\n--- /dev/null\n+++ b/test/stream/stream_colorspace.cpp\n@@ -0,0 +1,87 @@\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/camera.h>\n+#include <libcamera/formats.h>\n+#include <libcamera/stream.h>\n+\n+#include \"test.h\"\n+\n+using namespace libcamera;\n+using namespace std;\n+\n+class TestCameraConfiguration : public CameraConfiguration\n+{\n+public:\n+\tTestCameraConfiguration()\n+\t\t: CameraConfiguration()\n+\t{\n+\t}\n+\n+\tStatus validate() override\n+\t{\n+\t\treturn validateColorSpaces();\n+\t}\n+};\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+\t\tconfig_.addConfiguration(cfg);\n+\n+\t\tStreamConfiguration &streamCfg = config_.at(0);\n+\n+\t\t/*\n+\t\t * YUV pixelformat with sRGB colorspace should have Y'CbCr encoding\n+\t\t * adjusted.\n+\t\t */\n+\t\tconfig_.validate();\n+\t\tif (streamCfg.colorSpace->ycbcrEncoding == ColorSpace::YcbcrEncoding::None)\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 and transfer function, if 'None' is specified.\n+\t\t */\n+\t\tstreamCfg.pixelFormat = formats::YUV422;\n+\t\tstreamCfg.colorSpace = ColorSpace(ColorSpace::Primaries::Rec2020,\n+\t\t\t\t\t\t  ColorSpace::TransferFunction::Rec709,\n+\t\t\t\t\t\t  ColorSpace::YcbcrEncoding::None,\n+\t\t\t\t\t\t  ColorSpace::Range::Limited);\n+\t\tconfig_.validate();\n+\t\tif (streamCfg.colorSpace->ycbcrEncoding != ColorSpace::YcbcrEncoding::Rec2020)\n+\t\t\treturn TestFail;\n+\n+\t\t/* For RGB pixelFormat, sRGB colorspace shouldn't get adjusted */\n+\t\tstreamCfg.pixelFormat = formats::RGB888;\n+\t\tstreamCfg.colorSpace = ColorSpace::Srgb;\n+\t\tconfig_.validate();\n+\t\tif (streamCfg.colorSpace != ColorSpace::Srgb)\n+\t\t\treturn TestFail;\n+\n+\t\t/* Raw formats should always set colorspace to ColorSpace::Raw */\n+\t\tstreamCfg.pixelFormat = formats::SBGGR8;\n+\t\tstreamCfg.colorSpace = ColorSpace::Rec709;\n+\t\tconfig_.validate();\n+\t\tif (streamCfg.colorSpace != ColorSpace::Raw)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tTestCameraConfiguration config_;\n+};\n+\n+TEST_REGISTER(StreamColorSpaceTest)\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "6/7"
    ]
}