1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2019 Intel Corporation
#include "precomp.hpp"
#if !defined(GAPI_STANDALONE)
#include <ade/graph.hpp>
#include <opencv2/gapi/gproto.hpp> // can_describe
#include <opencv2/gapi/gcompiled.hpp>
#include "compiler/gstreaming_priv.hpp"
#include "backends/common/gbackend.hpp"
// GStreamingCompiled private implementation ///////////////////////////////////
void cv::GStreamingCompiled::Priv::setup(const GMetaArgs &_metaArgs,
const GMetaArgs &_outMetas,
std::unique_ptr<cv::gimpl::GStreamingExecutor> &&_pE)
{
m_metas = _metaArgs;
m_outMetas = _outMetas;
m_exec = std::move(_pE);
}
void cv::GStreamingCompiled::Priv::setup(std::unique_ptr<cv::gimpl::GStreamingExecutor> &&_pE)
{
m_exec = std::move(_pE);
}
bool cv::GStreamingCompiled::Priv::isEmpty() const
{
return !m_exec;
}
const cv::GMetaArgs& cv::GStreamingCompiled::Priv::metas() const
{
return m_metas;
}
const cv::GMetaArgs& cv::GStreamingCompiled::Priv::outMetas() const
{
return m_outMetas;
}
// FIXME: What is the reason in having Priv here if Priv actually dispatches
// everything to the underlying executable?? May be this executable may become
// the G*Compiled's priv?
void cv::GStreamingCompiled::Priv::setSource(cv::GRunArgs &&args)
{
if (!m_metas.empty() && !can_describe(m_metas, args))
{
util::throw_error(std::logic_error("This object was compiled "
"for different metadata!"));
}
GAPI_Assert(m_exec != nullptr);
m_exec->setSource(std::move(args));
}
void cv::GStreamingCompiled::Priv::start()
{
m_exec->start();
}
bool cv::GStreamingCompiled::Priv::pull(cv::GRunArgsP &&outs)
{
return m_exec->pull(std::move(outs));
}
bool cv::GStreamingCompiled::Priv::try_pull(cv::GRunArgsP &&outs)
{
return m_exec->try_pull(std::move(outs));
}
void cv::GStreamingCompiled::Priv::stop()
{
m_exec->stop();
}
bool cv::GStreamingCompiled::Priv::running() const
{
return m_exec->running();
}
// GStreamingCompiled public implementation ////////////////////////////////////
cv::GStreamingCompiled::GStreamingCompiled()
: m_priv(new Priv())
{
}
void cv::GStreamingCompiled::setSource(GRunArgs &&ins)
{
// FIXME: verify these input parameters according to the graph input meta
m_priv->setSource(std::move(ins));
}
void cv::GStreamingCompiled::setSource(const cv::gapi::wip::IStreamSource::Ptr &s)
{
setSource(cv::gin(s));
}
void cv::GStreamingCompiled::start()
{
m_priv->start();
}
bool cv::GStreamingCompiled::pull(cv::GRunArgsP &&outs)
{
return m_priv->pull(std::move(outs));
}
bool cv::GStreamingCompiled::try_pull(cv::GRunArgsP &&outs)
{
return m_priv->try_pull(std::move(outs));
}
void cv::GStreamingCompiled::stop()
{
m_priv->stop();
}
bool cv::GStreamingCompiled::running() const
{
return m_priv->running();
}
cv::GStreamingCompiled::operator bool() const
{
return !m_priv->isEmpty();
}
const cv::GMetaArgs& cv::GStreamingCompiled::metas() const
{
return m_priv->metas();
}
const cv::GMetaArgs& cv::GStreamingCompiled::outMetas() const
{
return m_priv->outMetas();
}
cv::GStreamingCompiled::Priv& cv::GStreamingCompiled::priv()
{
return *m_priv;
}
#endif // GAPI_STANDALONE