1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
5 // Copyright (C) 2018-2019 Intel Corporation
8 #include "opencv2/gapi/cpu/gcpukernel.hpp"
10 #include "api/gbackend_priv.hpp" // directly instantiate GBackend::Priv
15 // FIXME: Currently every Kernel implementation in this test file has
16 // its own backend() method and it is incorrect! API classes should
17 // provide it out of the box.
21 G_TYPED_KERNEL(Foo, <cv::GMat(cv::GMat)>, "test.kernels.foo")
23 static cv::GMatDesc outMeta(const cv::GMatDesc &in) { return in; }
26 G_TYPED_KERNEL(Bar, <cv::GMat(cv::GMat,cv::GMat)>, "test.kernels.bar")
28 static cv::GMatDesc outMeta(const cv::GMatDesc &in, const cv::GMatDesc &) { return in; }
31 G_TYPED_KERNEL(Baz, <cv::GScalar(cv::GMat)>, "test.kernels.baz")
33 static cv::GScalarDesc outMeta(const cv::GMatDesc &) { return cv::empty_scalar_desc(); }
36 G_TYPED_KERNEL(Qux, <cv::GMat(cv::GMat, cv::GScalar)>, "test.kernels.qux")
38 static cv::GMatDesc outMeta(const cv::GMatDesc &in, const cv::GScalarDesc &) { return in; }
41 G_TYPED_KERNEL(Quux, <cv::GMat(cv::GScalar, cv::GMat)>, "test.kernels.quux")
43 static cv::GMatDesc outMeta(const cv::GScalarDesc &, const cv::GMatDesc& in) { return in; }
47 // Kernel implementations for imaginary Jupiter device
52 static cv::gapi::GBackend backend(std::make_shared<cv::gapi::GBackend::Priv>());
55 inline cv::gapi::GBackend backend() { return detail::backend; }
57 GAPI_OCV_KERNEL(Foo, I::Foo)
59 static void run(const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
60 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
62 GAPI_OCV_KERNEL(Bar, I::Bar)
64 static void run(const cv::Mat &, const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
65 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
67 GAPI_OCV_KERNEL(Baz, I::Baz)
69 static void run(const cv::Mat &, cv::Scalar &) { /*Do nothing*/ }
70 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
72 GAPI_OCV_KERNEL(Qux, I::Qux)
74 static void run(const cv::Mat &, const cv::Scalar&, cv::Mat &) { /*Do nothing*/ }
75 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
78 GAPI_OCV_KERNEL(Quux, I::Quux)
80 static void run(const cv::Scalar&, const cv::Mat&, cv::Mat &) { /*Do nothing*/ }
81 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
83 } // namespace Jupiter
85 // Kernel implementations for imaginary Saturn device
90 static cv::gapi::GBackend backend(std::make_shared<cv::gapi::GBackend::Priv>());
93 inline cv::gapi::GBackend backend() { return detail::backend; }
95 GAPI_OCV_KERNEL(Foo, I::Foo)
97 static void run(const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
98 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
100 GAPI_OCV_KERNEL(Bar, I::Bar)
102 static void run(const cv::Mat &, const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
103 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
105 GAPI_OCV_KERNEL(Baz, I::Baz)
107 static void run(const cv::Mat &, cv::Scalar &) { /*Do nothing*/ }
108 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
110 GAPI_OCV_KERNEL(Qux, I::Qux)
112 static void run(const cv::Mat &, const cv::Scalar&, cv::Mat &) { /*Do nothing*/ }
113 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
116 GAPI_OCV_KERNEL(Quux, I::Quux)
118 static void run(const cv::Scalar&, const cv::Mat&, cv::Mat &) { /*Do nothing*/ }
119 static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
121 } // namespace Saturn
122 } // anonymous namespace
123 } // namespace opencv_test