Skip to content

Commit

Permalink
ConvertColorI420
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-cv committed Oct 10, 2023
1 parent e3836cb commit d18353d
Showing 1 changed file with 46 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,76 @@

#include <vector>

#include "single_layer_tests/convert_color_i420.hpp"
#include "single_op_tests/convert_color_i420.hpp"
#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;

namespace {
using ov::test::ConvertColorI420LayerTest;

const std::vector<ov::Shape> inShapes_nhwc = {
{1, 10, 10, 1}
};

const std::vector<ov::element::Type> inTypes = {
ov::element::u8, ov::element::f32
ov::element::u8,
ov::element::f32
};

auto generate_input_static_shapes = [] (const std::vector<ov::Shape>& original_shapes, bool single_plane) {
std::vector<std::vector<ov::Shape>> result_shapes;
for (const auto& original_shape : original_shapes) {
std::vector<ov::Shape> one_result_shapes;
if (single_plane) {
auto shape = original_shape;
shape[1] = shape[1] * 3 / 2;
one_result_shapes.push_back(shape);
} else {
auto shape = original_shape;
one_result_shapes.push_back(shape);
auto uvShape = ov::Shape{shape[0], shape[1] / 2, shape[2] / 2, 1};
one_result_shapes.push_back(uvShape);
one_result_shapes.push_back(uvShape);
}
result_shapes.push_back(one_result_shapes);
}
return result_shapes;
};

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420,
auto in_shapes_single_plain_static = generate_input_static_shapes(inShapes_nhwc, true);
auto in_shapes_not_single_plain_static = generate_input_static_shapes(inShapes_nhwc, false);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420SinglePlain,
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(inShapes_nhwc),
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_single_plain_static)),
::testing::ValuesIn(inTypes),
::testing::Bool(),
::testing::Values(true),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420NotSinglePlain,
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(in_shapes_not_single_plain_static)),
::testing::ValuesIn(inTypes),
::testing::Bool(),
::testing::Values(false),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_TestsConvertColorI420_acc,
ConvertColorI420AccuracyTest,
::testing::Combine(::testing::Values(ov::Shape{1, 16 * 6, 16, 1}),
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(
generate_input_static_shapes({{1, 16 * 6, 16, 1}}, true))),
::testing::Values(ov::element::u8),
::testing::Bool(),
::testing::Bool(),
::testing::Values(false),
::testing::Values(true),
::testing::Values(ov::test::utils::DEVICE_GPU)),
ConvertColorI420LayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(nightly_TestsConvertColorI420_acc,
ConvertColorI420AccuracyTest,
::testing::Combine(::testing::Values(ov::Shape{1, 256 * 256, 256, 1}),
ConvertColorI420LayerTest,
::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation(
generate_input_static_shapes({{1, 256 * 256, 256, 1}}, true))),
::testing::Values(ov::element::u8),
::testing::Values(false),
::testing::Values(true),
Expand Down

0 comments on commit d18353d

Please sign in to comment.