|
4 | 4 | //
|
5 | 5 | // Copyright (C) 2020 Intel Corporation
|
6 | 6 |
|
| 7 | +#if !defined(GAPI_STANDALONE) |
7 | 8 | #include <opencv2/imgproc.hpp>
|
| 9 | +#endif // !defined(GAPI_STANDALONE) |
| 10 | + |
8 | 11 | #include <opencv2/gapi/util/throw.hpp> // throw_error
|
9 | 12 | #include <opencv2/gapi/streaming/format.hpp> // kernels
|
10 | 13 |
|
@@ -32,7 +35,6 @@ using ConstStreamingGraph = ade::ConstTypedGraph
|
32 | 35 | , StreamingCreateFunction
|
33 | 36 | >;
|
34 | 37 |
|
35 |
| - |
36 | 38 | class GStreamingIntrinExecutable final: public cv::gimpl::GIslandExecutable
|
37 | 39 | {
|
38 | 40 | virtual void run(std::vector<InObj> &&,
|
@@ -135,18 +137,30 @@ cv::gapi::GBackend cv::gapi::streaming::backend()
|
135 | 137 | return this_backend;
|
136 | 138 | }
|
137 | 139 |
|
138 |
| -cv::gapi::GKernelPackage cv::gapi::streaming::kernels() |
| 140 | +struct Copy: public cv::detail::KernelTag |
139 | 141 | {
|
140 |
| - return cv::gapi::kernels<cv::gimpl::BGR>(); |
141 |
| -} |
| 142 | + using API = cv::gimpl::streaming::GCopy; |
142 | 143 |
|
143 |
| -cv::gapi::GKernelPackage cv::gimpl::streaming::kernels() |
144 |
| -{ |
145 |
| - return cv::gapi::kernels<cv::gimpl::Copy>(); |
146 |
| -} |
| 144 | + static cv::gapi::GBackend backend() { return cv::gapi::streaming::backend(); } |
| 145 | + |
| 146 | + class Actor final: public cv::gapi::streaming::IActor |
| 147 | + { |
| 148 | + public: |
| 149 | + explicit Actor(const cv::GCompileArgs&) {} |
| 150 | + virtual void run(cv::gimpl::GIslandExecutable::IInput &in, |
| 151 | + cv::gimpl::GIslandExecutable::IOutput &out) override; |
| 152 | + }; |
147 | 153 |
|
148 |
| -void cv::gimpl::Copy::Actor::run(cv::gimpl::GIslandExecutable::IInput &in, |
149 |
| - cv::gimpl::GIslandExecutable::IOutput &out) |
| 154 | + static cv::gapi::streaming::IActor::Ptr create(const cv::GCompileArgs& args) |
| 155 | + { |
| 156 | + return cv::gapi::streaming::IActor::Ptr(new Actor(args)); |
| 157 | + } |
| 158 | + |
| 159 | + static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; }; |
| 160 | +}; |
| 161 | + |
| 162 | +void Copy::Actor::run(cv::gimpl::GIslandExecutable::IInput &in, |
| 163 | + cv::gimpl::GIslandExecutable::IOutput &out) |
150 | 164 | {
|
151 | 165 | const auto in_msg = in.get();
|
152 | 166 | if (cv::util::holds_alternative<cv::gimpl::EndOfStream>(in_msg))
|
@@ -176,8 +190,34 @@ void cv::gimpl::Copy::Actor::run(cv::gimpl::GIslandExecutable::IInput &in,
|
176 | 190 | out.post(std::move(out_arg));
|
177 | 191 | }
|
178 | 192 |
|
179 |
| -void cv::gimpl::BGR::Actor::run(cv::gimpl::GIslandExecutable::IInput &in, |
180 |
| - cv::gimpl::GIslandExecutable::IOutput &out) |
| 193 | +cv::gapi::GKernelPackage cv::gimpl::streaming::kernels() |
| 194 | +{ |
| 195 | + return cv::gapi::kernels<Copy>(); |
| 196 | +} |
| 197 | + |
| 198 | +#if !defined(GAPI_STANDALONE) |
| 199 | + |
| 200 | +struct GOCVBGR: public cv::detail::KernelTag |
| 201 | +{ |
| 202 | + using API = cv::gapi::streaming::GBGR; |
| 203 | + static cv::gapi::GBackend backend() { return cv::gapi::streaming::backend(); } |
| 204 | + |
| 205 | + class Actor final: public cv::gapi::streaming::IActor { |
| 206 | + public: |
| 207 | + explicit Actor(const cv::GCompileArgs&) {} |
| 208 | + virtual void run(cv::gimpl::GIslandExecutable::IInput &in, |
| 209 | + cv::gimpl::GIslandExecutable::IOutput&out) override; |
| 210 | + }; |
| 211 | + |
| 212 | + static cv::gapi::streaming::IActor::Ptr create(const cv::GCompileArgs& args) |
| 213 | + { |
| 214 | + return cv::gapi::streaming::IActor::Ptr(new Actor(args)); |
| 215 | + } |
| 216 | + static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; }; |
| 217 | +}; |
| 218 | + |
| 219 | +void GOCVBGR::Actor::run(cv::gimpl::GIslandExecutable::IInput &in, |
| 220 | + cv::gimpl::GIslandExecutable::IOutput &out) |
181 | 221 | {
|
182 | 222 | const auto in_msg = in.get();
|
183 | 223 | if (cv::util::holds_alternative<cv::gimpl::EndOfStream>(in_msg))
|
@@ -216,6 +256,21 @@ void cv::gimpl::BGR::Actor::run(cv::gimpl::GIslandExecutable::IInput &in,
|
216 | 256 | out.post(std::move(out_arg));
|
217 | 257 | }
|
218 | 258 |
|
| 259 | +cv::gapi::GKernelPackage cv::gapi::streaming::kernels() |
| 260 | +{ |
| 261 | + return cv::gapi::kernels<GOCVBGR>(); |
| 262 | +} |
| 263 | + |
| 264 | +#else |
| 265 | + |
| 266 | +cv::gapi::GKernelPackage cv::gapi::streaming::kernels() |
| 267 | +{ |
| 268 | + // Still provide this symbol to avoid linking issues |
| 269 | + util::throw_error(std::runtime_error("cv::gapi::streaming::kernels() isn't supported in standalone")); |
| 270 | +} |
| 271 | + |
| 272 | +#endif // !defined(GAPI_STANDALONE) |
| 273 | + |
219 | 274 | cv::GMat cv::gapi::copy(const cv::GMat& in) {
|
220 | 275 | return cv::gimpl::streaming::GCopy::on<cv::GMat>(in);
|
221 | 276 | }
|
|
0 commit comments