Patch Detail
Show a patch.
GET /api/1.1/patches/1226/?format=api
{ "id": 1226, "url": "https://patchwork.libcamera.org/api/1.1/patches/1226/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1226/", "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": "<20190517230621.24668-10-laurent.pinchart@ideasonboard.com>", "date": "2019-05-17T23:06:18", "name": "[libcamera-devel,PATCH/RFC,09/12] test: stream: Add test for StreamFormat", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "4a8090ea47e40161e5a9bb210bdc209ac21ed226", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1226/mbox/", "series": [ { "id": 307, "url": "https://patchwork.libcamera.org/api/1.1/series/307/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=307", "date": "2019-05-17T23:06:09", "name": "Rework camera configuration to introduce negotiation of parameters", "version": 1, "mbox": "https://patchwork.libcamera.org/series/307/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1226/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1226/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "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 D3CCD61871\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 May 2019 01:06:45 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 791C72F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 May 2019 01:06:45 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1558134405;\n\tbh=HphyvmR2Cy2YpaC/bCTqAnP7Pvc/m4VmT/fUHHIOzl0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=qk66SYVtHHYfJaFz3G6GIGWPQGBqYly5JlmEop0/YInamgt0SGOrogEkdNXG9KLHE\n\tmmh4+rWSJ/suUOMSJtkB8atg8fOYrpFA6SFHK/pWxPS3v21w9HefZrWtal2UmY6fun\n\t79oj9Yla6Myk8YD6XKGkhE1v1j3mmuLsp5LV6PEU=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 18 May 2019 02:06:18 +0300", "Message-Id": "<20190517230621.24668-10-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190517230621.24668-1-laurent.pinchart@ideasonboard.com>", "References": "<20190517230621.24668-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH/RFC 09/12] test: stream: Add test for\n\tStreamFormat", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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>", "X-List-Received-Date": "Fri, 17 May 2019 23:06:48 -0000" }, "content": "From: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nTest that both discrete and range based stream format descriptions\nresult in good discrete frame sizes. The range based stream formats\nneeds to be fitted with a table of resolutions inside libcamera so if\nthat table is update this test might need to be updated.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n test/meson.build | 1 +\n test/stream/meson.build | 10 +++\n test/stream/stream_formats.cpp | 112 +++++++++++++++++++++++++++++++++\n 3 files changed, 123 insertions(+)\n create mode 100644 test/stream/meson.build\n create mode 100644 test/stream/stream_formats.cpp", "diff": "diff --git a/test/meson.build b/test/meson.build\nindex d501f2beaf96..a25e203bcfed 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -3,6 +3,7 @@ subdir('libtest')\n subdir('camera')\n subdir('media_device')\n subdir('pipeline')\n+subdir('stream')\n subdir('v4l2_device')\n subdir('v4l2_subdevice')\n \ndiff --git a/test/stream/meson.build b/test/stream/meson.build\nnew file mode 100644\nindex 000000000000..1d5a4a97aec4\n--- /dev/null\n+++ b/test/stream/meson.build\n@@ -0,0 +1,10 @@\n+stream_tests = [\n+ [ 'stream_formats', 'stream_formats.cpp' ],\n+]\n+\n+foreach t : stream_tests\n+ exe = executable(t[0], t[1],\n+ link_with : test_libraries,\n+ include_directories : test_includes_internal)\n+ test(t[0], exe, suite: 'stream', is_parallel: false)\n+endforeach\ndiff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp\nnew file mode 100644\nindex 000000000000..2ee02840d4d7\n--- /dev/null\n+++ b/test/stream/stream_formats.cpp\n@@ -0,0 +1,112 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * stream_formats.cpp - StreamFormats test\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/geometry.h>\n+#include <libcamera/stream.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class StreamFormatsTest : public Test\n+{\n+protected:\n+\tint init()\n+\t{\n+\t\treturn 0;\n+\t}\n+\n+\tint testSizes(std::string name, std::vector<Size> test, std::vector<Size> valid)\n+\t{\n+\t\tbool pass = false;\n+\n+\t\tfor (Size &size : test) {\n+\t\t\tpass = false;\n+\n+\t\t\tfor (Size &validSize : valid) {\n+\t\t\t\tif (size == validSize) {\n+\t\t\t\t\tpass = true;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tif (!pass)\n+\t\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (!pass) {\n+\t\t\tcout << \"Failed \" << name << endl;\n+\t\t\tcout << \"Sizes to test:\" << endl;\n+\t\t\tfor (Size &size : test)\n+\t\t\t\tcout << size.toString() << endl;\n+\t\t\tcout << \"Valid sizes:\" << endl;\n+\t\t\tfor (Size &size : valid)\n+\t\t\t\tcout << size.toString() << endl;\n+\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run()\n+\t{\n+\t\t/* Test discrete sizes */\n+\t\tStreamFormats discrete({\n+\t\t\t{ 1, { { Size(100, 100), Size(200, 200) } } },\n+\t\t\t{ 2, { { Size(300, 300), Size(400, 400) } } },\n+\t\t});\n+\n+\t\tif (testSizes(\"discrete 1\", discrete.sizes(1),\n+\t\t\t { Size(100, 100), Size(200, 200) }))\n+\t\t\treturn TestFail;\n+\n+\t\tif (testSizes(\"discrete 2\", discrete.sizes(2),\n+\t\t\t { Size(300, 300), Size(400, 400) }))\n+\t\t\treturn TestFail;\n+\n+\t\t/* Test range sizes */\n+\t\tStreamFormats range({\n+\t\t\t{ 1, { Size(640, 480), Size(640, 480), 1, 1 } },\n+\t\t\t{ 2, { Size(640, 480), Size(800, 600), 8, 8 } },\n+\t\t\t{ 3, { Size(640, 480), Size(800, 600), 16, 16 } },\n+\t\t\t{ 4, { Size(1, 1), Size(4096, 4096), 128, 128 } },\n+\t\t});\n+\n+\t\tif (testSizes(\"range 1\", range.sizes(1), { Size(640, 480) }))\n+\t\t\treturn TestFail;\n+\n+\t\tif (testSizes(\"range 2\", range.sizes(2), {\n+\t\t\t Size(640, 480), Size(720, 480),\n+\t\t\t Size(720, 576), Size(768, 480),\n+\t\t\t Size(800, 600) }))\n+\t\t\treturn TestFail;\n+\n+\n+\t\tif (testSizes(\"range 3\", range.sizes(3), {\n+\t\t\t Size(640, 480), Size(720, 480),\n+\t\t\t Size(720, 576), Size(768, 480) }))\n+\t\t\treturn TestFail;\n+\n+\t\tif (testSizes(\"range 4\", range.sizes(4), {\n+\t\t\t Size(1024, 768), Size(1280, 1024),\n+\t\t\t Size(2048, 1152), Size(2048, 1536),\n+\t\t\t Size(2560, 2048), Size(3200, 2048), }))\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup()\n+\t{\n+\t}\n+};\n+\n+TEST_REGISTER(StreamFormatsTest)\n", "prefixes": [ "libcamera-devel", "PATCH/RFC", "09/12" ] }