Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/gapi/src/backends/cpu/gcpubackend.hpp
16344 views
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.
4
//
5
// Copyright (C) 2018 Intel Corporation
6
7
8
#ifndef OPENCV_GAPI_GCPUBACKEND_HPP
9
#define OPENCV_GAPI_GCPUBACKEND_HPP
10
11
#include <map> // map
12
#include <unordered_map> // unordered_map
13
#include <tuple> // tuple
14
#include <ade/util/algorithm.hpp> // type_list_index
15
16
#include "opencv2/gapi/garg.hpp"
17
#include "opencv2/gapi/gproto.hpp"
18
#include "opencv2/gapi/cpu/gcpukernel.hpp"
19
20
21
#include "api/gapi_priv.hpp"
22
#include "backends/common/gbackend.hpp"
23
#include "compiler/gislandmodel.hpp"
24
25
namespace cv { namespace gimpl {
26
27
struct Unit
28
{
29
static const char *name() { return "HostKernel"; }
30
GCPUKernel k;
31
};
32
33
class GCPUExecutable final: public GIslandExecutable
34
{
35
const ade::Graph &m_g;
36
GModel::ConstGraph m_gm;
37
38
struct OperationInfo
39
{
40
ade::NodeHandle nh;
41
GMetaArgs expected_out_metas;
42
};
43
44
// Execution script, currently absolutely naive
45
std::vector<OperationInfo> m_script;
46
// List of all resources in graph (both internal and external)
47
std::vector<ade::NodeHandle> m_dataNodes;
48
49
// Actual data of all resources in graph (both internal and external)
50
Mag m_res;
51
GArg packArg(const GArg &arg);
52
53
public:
54
GCPUExecutable(const ade::Graph &graph,
55
const std::vector<ade::NodeHandle> &nodes);
56
57
virtual void run(std::vector<InObj> &&input_objs,
58
std::vector<OutObj> &&output_objs) override;
59
};
60
61
}}
62
63
#endif // OPENCV_GAPI_GBACKEND_HPP
64
65