blob: a6337919edbaa05ff09bb3b18327451398fa4b89 [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/CL/CLMultiImage.h"
25#include "arm_compute/runtime/CL/CLTensor.h"
26#include "arm_compute/runtime/CL/functions/CLColorConvert.h"
27#include "tests/CL/CLAccessor.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
50const auto ColorConvert_YUYV_to_RGBDataset = combine(YUYVDataset,
51 RGBDataset);
52
53const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }),
54 RGBDataset);
55
56const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset,
57 framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 }));
58
59const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset,
60 framework::dataset::make("FormatType", { Format::NV12, Format::IYUV }));
61
62const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }),
63 framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 }));
64} // namespace
65
66TEST_SUITE(CL)
67TEST_SUITE(ColorConvert)
68
69using CLColorConvertFixture = ColorConvertFixture<CLMultiImage, CLTensor, CLAccessor, CLColorConvert>;
70
71TEST_SUITE(RGBA)
72// *INDENT-OFF*
73// clang-format off
74REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB));
75REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB));
76TEST_SUITE_END()
77
78TEST_SUITE(RGB)
79// *INDENT-OFF*
80// clang-format off
81REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA));
82REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA));
83TEST_SUITE_END()
84
85TEST_SUITE(YUV)
86// *INDENT-OFF*
87// clang-format off
88REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYV_to_RGBDataset));
89REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYV_to_RGBDataset));
90TEST_SUITE_END()
91
92TEST_SUITE(YUVPlanar)
93// *INDENT-OFF*
94// clang-format off
95REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
96REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
97TEST_SUITE_END()
98
99TEST_SUITE(NV)
100// *INDENT-OFF*
101// clang-format off
102REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
103REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
104TEST_SUITE_END()
105
106TEST_SUITE(YUYVtoNV)
107// *INDENT-OFF*
108// clang-format off
109REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
110REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
111TEST_SUITE_END()
112
113TEST_SUITE(NVtoYUV)
114// *INDENT-OFF*
115// clang-format off
116REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
117REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
118TEST_SUITE_END()
119
120TEST_SUITE_END() // ColorConvert
121TEST_SUITE_END() // CL
122} // namespace benchmark
123} // namespace test
124} // namespace arm_compute