Sanghoon Lee | c7b82f1 | 2018-07-06 13:27:27 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 33 | namespace arm_compute |
| 34 | { |
| 35 | namespace test |
| 36 | { |
| 37 | namespace benchmark |
| 38 | { |
| 39 | namespace |
| 40 | { |
| 41 | const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 }); |
| 42 | const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 }); |
| 43 | |
| 44 | const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }), |
| 45 | framework::dataset::make("FormatType", { Format::RGB888 })); |
| 46 | |
| 47 | const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }), |
| 48 | framework::dataset::make("FormatType", { Format::RGBA8888 })); |
| 49 | |
Manuel Bottini | 4284bfa | 2018-09-26 15:33:15 +0100 | [diff] [blame] | 50 | const auto ColorConvert_RGB_to_U8 = combine(framework::dataset::make("FormatType", { Format::RGB888 }), |
| 51 | framework::dataset::make("FormatType", { Format::U8 })); |
| 52 | |
Sanghoon Lee | c7b82f1 | 2018-07-06 13:27:27 +0100 | [diff] [blame] | 53 | const auto ColorConvert_YUYVDataset_to_RGBDataset = combine(YUYVDataset, |
| 54 | RGBDataset); |
| 55 | |
| 56 | const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }), |
| 57 | RGBDataset); |
| 58 | |
| 59 | const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset, |
| 60 | framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 })); |
| 61 | |
| 62 | const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset, |
| 63 | framework::dataset::make("FormatType", { Format::NV12, Format::IYUV })); |
| 64 | |
| 65 | const 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 | |
| 69 | TEST_SUITE(NEON) |
| 70 | TEST_SUITE(ColorConvert) |
| 71 | |
| 72 | using NEColorConvertFixture = ColorConvertFixture<MultiImage, Tensor, Accessor, NEColorConvert>; |
| 73 | |
| 74 | TEST_SUITE(RGBA) |
| 75 | // *INDENT-OFF* |
| 76 | // clang-format off |
| 77 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB)); |
| 78 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB)); |
| 79 | TEST_SUITE_END() |
| 80 | |
| 81 | TEST_SUITE(RGB) |
| 82 | // *INDENT-OFF* |
| 83 | // clang-format off |
| 84 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA)); |
| 85 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA)); |
| 86 | TEST_SUITE_END() |
| 87 | |
Manuel Bottini | 4284bfa | 2018-09-26 15:33:15 +0100 | [diff] [blame] | 88 | TEST_SUITE(RGBtoU8) |
| 89 | // *INDENT-OFF* |
| 90 | // clang-format off |
| 91 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_U8)); |
| 92 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_U8)); |
| 93 | TEST_SUITE_END() |
| 94 | |
Sanghoon Lee | c7b82f1 | 2018-07-06 13:27:27 +0100 | [diff] [blame] | 95 | TEST_SUITE(YUYV) |
| 96 | // *INDENT-OFF* |
| 97 | // clang-format off |
| 98 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset)); |
| 99 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset)); |
| 100 | TEST_SUITE_END() |
| 101 | |
| 102 | TEST_SUITE(YUVPlanar) |
| 103 | // *INDENT-OFF* |
| 104 | // clang-format off |
| 105 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset)); |
| 106 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset)); |
| 107 | TEST_SUITE_END() |
| 108 | |
| 109 | TEST_SUITE(NV) |
| 110 | // *INDENT-OFF* |
| 111 | // clang-format off |
| 112 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset)); |
| 113 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset)); |
| 114 | TEST_SUITE_END() |
| 115 | |
| 116 | TEST_SUITE(YUYVtoNV) |
| 117 | // *INDENT-OFF* |
| 118 | // clang-format off |
| 119 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset)); |
| 120 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset)); |
| 121 | TEST_SUITE_END() |
| 122 | |
| 123 | TEST_SUITE(NVtoYUV) |
| 124 | // *INDENT-OFF* |
| 125 | // clang-format off |
| 126 | REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset)); |
| 127 | REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset)); |
| 128 | TEST_SUITE_END() |
| 129 | |
| 130 | TEST_SUITE_END() // ColorConvert |
| 131 | TEST_SUITE_END() // CL |
| 132 | } // namespace benchmark |
| 133 | } // namespace test |
| 134 | } // namespace arm_compute |