Patch Detail
Show a patch.
GET /api/1.1/patches/1462/?format=api
{ "id": 1462, "url": "https://patchwork.libcamera.org/api/1.1/patches/1462/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1462/", "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": "<20190619025129.21164-13-niklas.soderlund@ragnatech.se>", "date": "2019-06-19T02:51:25", "name": "[libcamera-devel,v4,12/16] test: stream: Add test for StreamFormat", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "050876ed8f47bb6dd2c3bdcff6c42dea8aa79846", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1462/mbox/", "series": [ { "id": 361, "url": "https://patchwork.libcamera.org/api/1.1/series/361/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=361", "date": "2019-06-19T02:51:13", "name": "libcamera: Add support for format information and validation", "version": 4, "mbox": "https://patchwork.libcamera.org/series/361/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1462/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1462/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 66F9861A2C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 04:52:31 +0200 (CEST)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 3fd4f63b-923d-11e9-8ab4-005056917a89;\n\tWed, 19 Jun 2019 04:52:17 +0200 (CEST)" ], "X-Halon-ID": "3fd4f63b-923d-11e9-8ab4-005056917a89", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 19 Jun 2019 04:51:25 +0200", "Message-Id": "<20190619025129.21164-13-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190619025129.21164-1-niklas.soderlund@ragnatech.se>", "References": "<20190619025129.21164-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 12/16] 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": "Wed, 19 Jun 2019 02:52:31 -0000" }, "content": "Test 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 updated this test might need to be updated.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/meson.build | 1 +\n test/stream/meson.build | 11 ++++\n test/stream/stream_formats.cpp | 101 +++++++++++++++++++++++++++++++++\n 3 files changed, 113 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 25f181c20308583f..654e00890e03efec 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -4,6 +4,7 @@ subdir('camera')\n subdir('ipa')\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 0000000000000000..2f2493de38ae0954\n--- /dev/null\n+++ b/test/stream/meson.build\n@@ -0,0 +1,11 @@\n+stream_tests = [\n+ [ 'stream_formats', 'stream_formats.cpp' ],\n+]\n+\n+foreach t : stream_tests\n+ exe = executable(t[0], t[1],\n+ dependencies : libcamera_dep,\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 0000000000000000..a391f5cd087d3872\n--- /dev/null\n+++ b/test/stream/stream_formats.cpp\n@@ -0,0 +1,101 @@\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 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, { SizeRange(100, 100), SizeRange(200, 200) } },\n+\t\t\t{ 2, { SizeRange(300, 300), SizeRange(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+\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, { SizeRange(640, 480, 640, 480) } },\n+\t\t\t{ 2, { SizeRange(640, 480, 800, 600, 8, 8) } },\n+\t\t\t{ 3, { SizeRange(640, 480, 800, 600, 16, 16) } },\n+\t\t\t{ 4, { SizeRange(128, 128, 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+\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+\n+TEST_REGISTER(StreamFormatsTest)\n", "prefixes": [ "libcamera-devel", "v4", "12/16" ] }