blob: 822355163542562ad94e4c7152bbbf955f2debf5 [file] [log] [blame]
Sanghoon Leec7b82f12018-07-06 13:27:27 +01001/*
2 * Copyright (c) 2018 ARM Limited.
3 *
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#include "arm_compute/runtime/MultiImage.h"
25#include "arm_compute/runtime/NEON/functions/NEColorConvert.h"
26#include "arm_compute/runtime/Tensor.h"
27#include "tests/NEON/Accessor.h"
28#include "tests/benchmark/fixtures/ColorConvertFixture.h"
29#include "tests/datasets/ShapeDatasets.h"
30#include "tests/framework/Macros.h"
31#include "utils/TypePrinter.h"
32
33namespace arm_compute
34{
35namespace test
36{
37namespace benchmark
38{
39namespace
40{
41const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 });
42const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 });
43
44const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }),
45 framework::dataset::make("FormatType", { Format::RGB888 }));
46
47const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }),
48 framework::dataset::make("FormatType", { Format::RGBA8888 }));
49
Manuel Bottini4284bfa2018-09-26 15:33:15 +010050const auto ColorConvert_RGB_to_U8 = combine(framework::dataset::make("FormatType", { Format::RGB888 }),
51 framework::dataset::make("FormatType", { Format::U8 }));
52
Sanghoon Leec7b82f12018-07-06 13:27:27 +010053const auto ColorConvert_YUYVDataset_to_RGBDataset = combine(YUYVDataset,
54 RGBDataset);
55
56const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }),
57 RGBDataset);
58
59const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset,
60 framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 }));
61
62const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset,
63 framework::dataset::make("FormatType", { Format::NV12, Format::IYUV }));
64
65const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }),
66 framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 }));
67} // namespace
68
69TEST_SUITE(NEON)
70TEST_SUITE(ColorConvert)
71
72using NEColorConvertFixture = ColorConvertFixture<MultiImage, Tensor, Accessor, NEColorConvert>;
73
74TEST_SUITE(RGBA)
75// *INDENT-OFF*
76// clang-format off
77REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB));
78REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB));
79TEST_SUITE_END()
80
81TEST_SUITE(RGB)
82// *INDENT-OFF*
83// clang-format off
84REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA));
85REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA));
86TEST_SUITE_END()
87
Manuel Bottini4284bfa2018-09-26 15:33:15 +010088TEST_SUITE(RGBtoU8)
89// *INDENT-OFF*
90// clang-format off
91REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_U8));
92REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_U8));
93TEST_SUITE_END()
94
Sanghoon Leec7b82f12018-07-06 13:27:27 +010095TEST_SUITE(YUYV)
96// *INDENT-OFF*
97// clang-format off
98REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset));
99REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset));
100TEST_SUITE_END()
101
102TEST_SUITE(YUVPlanar)
103// *INDENT-OFF*
104// clang-format off
105REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
106REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
107TEST_SUITE_END()
108
109TEST_SUITE(NV)
110// *INDENT-OFF*
111// clang-format off
112REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
113REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
114TEST_SUITE_END()
115
116TEST_SUITE(YUYVtoNV)
117// *INDENT-OFF*
118// clang-format off
119REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
120REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
121TEST_SUITE_END()
122
123TEST_SUITE(NVtoYUV)
124// *INDENT-OFF*
125// clang-format off
126REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
127REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
128TEST_SUITE_END()
129
130TEST_SUITE_END() // ColorConvert
131TEST_SUITE_END() // CL
132} // namespace benchmark
133} // namespace test
134} // namespace arm_compute