1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #18127 from smirnov-alexey:as/gapi_serialization

[G-API]: Add GOpaque and GArray serialization support

* Add GOpaque and GArray serialization support

* Address review comments

* Remove holds() method

* Address review comments

* Remove comments

* Align streaming with kind changes

* Fix kind in kernel

* Address review comments
This commit is contained in:
Alexey Smirnov
2020-09-07 20:10:03 +03:00
committed by GitHub
parent 620629593b
commit a3e8c6e866
26 changed files with 648 additions and 228 deletions
@@ -76,61 +76,6 @@ TYPED_TEST(GArgKind, RValue)
EXPECT_EQ(TestFixture::Kind, arg.kind);
}
// Repeat the same for Spec
template<class T, cv::detail::ArgSpec Exp>
struct ExpectedS
{
using type = T;
static const constexpr cv::detail::ArgSpec spec = Exp;
};
template<typename T>
struct ArgSpec: public ::testing::Test
{
using Type = typename T::type;
const cv::detail::ArgSpec Spec = T::spec;
};
using Arg_Spec_Types = ::testing::Types
<
// G-API types
ExpectedS<cv::GMat, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GMatP, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GFrame, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GScalar, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GArray<int>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GArray<float>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GArray<cv::Point>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GArray<cv::Rect>, cv::detail::ArgSpec::RECT>
, ExpectedS<cv::GArray<cv::GMat>, cv::detail::ArgSpec::GMAT>
, ExpectedS<cv::GOpaque<int>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GOpaque<float>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GOpaque<cv::Point>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::GOpaque<cv::Rect>, cv::detail::ArgSpec::RECT>
// FIXME: causes internal conflicts in GOpaque/descr_of
// , ExpectedS<cv::GOpaque<cv::Mat>, cv::detail::ArgSpec::GMAT>
// Built-in types
, ExpectedS<int, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<float, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<int*, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::Point, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<std::string, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<cv::Mat, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<std::vector<int>, cv::detail::ArgSpec::OPAQUE_SPEC>
, ExpectedS<std::vector<cv::Point>, cv::detail::ArgSpec::OPAQUE_SPEC>
>;
TYPED_TEST_CASE(ArgSpec, Arg_Spec_Types);
TYPED_TEST(ArgSpec, Basic)
{
const auto this_spec = cv::detail::GTypeTraits<typename TestFixture::Type>::spec;
EXPECT_EQ(TestFixture::Spec, this_spec);
}
// }}
////////////////////////////////////////////////////////////////////////////////
TEST(GArg, HasWrap)
@@ -170,6 +115,4 @@ TEST(GArg, GOpaqueU)
cv::GArg arg2 = cv::GArg(cv::GOpaque<cv::Point>());
EXPECT_NO_THROW(arg2.get<cv::detail::GOpaqueU>());
}
} // namespace opencv_test