blob: dc7975ffff09e25cbb6c95c2d29fd496df9717d9 [file] [log] [blame]
Alex Gilday345ab182018-01-09 11:40:19 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2018-2019 Arm Limited.
Alex Gilday345ab182018-01-09 11:40:19 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef ARM_COMPUTE_TEST_IMAGE_FILE_DATASET
25#define ARM_COMPUTE_TEST_IMAGE_FILE_DATASET
26
27#include "tests/framework/datasets/Datasets.h"
28
29#include <type_traits>
30
31namespace arm_compute
32{
33namespace test
34{
35namespace datasets
36{
37class ImageFileDataset
38{
39public:
40 struct iterator
41 {
42 iterator(std::vector<std::string>::const_iterator name_it)
43 : _name_it{ std::move(name_it) }
44 {
45 }
46
47 std::string description() const
48 {
49 std::stringstream description;
50 description << "ImageFile=" << *_name_it;
51 return description.str();
52 }
53
54 std::tuple<std::string> operator*() const
55 {
56 return std::make_tuple(*_name_it);
57 }
58
59 iterator &operator++()
60 {
61 ++_name_it;
62
63 return *this;
64 }
65
66 private:
67 std::vector<std::string>::const_iterator _name_it;
68 };
69
70 iterator begin() const
71 {
72 return iterator(_names.begin());
73 }
74
75 int size() const
76 {
77 return _names.size();
78 }
79
80 void add_image_file(std::string name)
81 {
82 _names.emplace_back(std::move(name));
83 }
84
85protected:
86 ImageFileDataset() = default;
87 ImageFileDataset(ImageFileDataset &&) = default;
88
89private:
90 std::vector<std::string> _names{};
91};
92
93/** Data set containing names of small image files. */
94class SmallImageFiles final : public ImageFileDataset
95{
96public:
97 SmallImageFiles()
98 {
99 add_image_file("640x480.ppm");
100 add_image_file("800x600.ppm");
Alex Gilday345ab182018-01-09 11:40:19 +0000101 }
102};
103
Georgios Pinitasdc310b52019-01-30 12:25:13 +0000104/** Data set containing names of large image files. */
Alex Gilday345ab182018-01-09 11:40:19 +0000105class LargeImageFiles final : public ImageFileDataset
106{
107public:
108 LargeImageFiles()
109 {
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000110 add_image_file("1280x720.ppm");
Alex Gilday345ab182018-01-09 11:40:19 +0000111 add_image_file("1920x1080.ppm");
Alex Gilday345ab182018-01-09 11:40:19 +0000112 }
113};
114
115} // namespace datasets
116} // namespace test
117} // namespace arm_compute
118#endif /* ARM_COMPUTE_TEST_IMAGE_FILE_DATASET */