Blame view

3rdparty/opencv-4.5.4/modules/gapi/src/compiler/gcompiled_priv.hpp 1.83 KB
f4334277   Hu Chunming   提交3rdparty
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
  // 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) 2018-2020 Intel Corporation
  
  
  #ifndef OPENCV_GAPI_GCOMPILED_PRIV_HPP
  #define OPENCV_GAPI_GCOMPILED_PRIV_HPP
  
  #include <memory> // unique_ptr
  
  #include "opencv2/gapi/util/optional.hpp"
  #include "compiler/gmodel.hpp"
  #include "executor/gexecutor.hpp"
  
  // NB: BTW, GCompiled is the only "public API" class which
  // private part (implementation) is hosted in the "compiler/" module.
  //
  // This file is here just to keep ADE hidden from the top-level APIs.
  //
  // As the thing becomes more complex, appropriate API and implementation
  // part will be placed to api/ and compiler/ modules respectively.
  
  namespace cv {
  
  namespace gimpl
  {
      struct GRuntimeArgs;
  };
  
  // FIXME: GAPI_EXPORTS is here only due to tests and Windows linker issues
  class GAPI_EXPORTS GCompiled::Priv
  {
      // NB: For now, a GCompiled keeps the original ade::Graph alive.
      // If we want to go autonomous, we might to do something with this.
      GMetaArgs  m_metas;    // passed by user
      GMetaArgs  m_outMetas; // inferred by compiler
      std::unique_ptr<cv::gimpl::GExecutor> m_exec;
  
      void checkArgs(const cv::gimpl::GRuntimeArgs &args) const;
  
  public:
      void setup(const GMetaArgs &metaArgs,
                 const GMetaArgs &outMetas,
                 std::unique_ptr<cv::gimpl::GExecutor> &&pE);
      bool isEmpty() const;
  
      bool canReshape() const;
      void reshape(const GMetaArgs& inMetas, const GCompileArgs &args);
      void prepareForNewStream();
  
      void run(cv::gimpl::GRuntimeArgs &&args);
      const GMetaArgs& metas() const;
      const GMetaArgs& outMetas() const;
  
      const cv::gimpl::GModel::Graph& model() const;
  };
  
  }
  
  #endif // OPENCV_GAPI_GCOMPILED_PRIV_HPP