OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
gpuRenderer.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_GPU_RENDERER_HPP
2 #define OPENPOSE_CORE_GPU_RENDERER_HPP
3 
4 #include <atomic>
5 #include <tuple>
8 
9 namespace op
10 {
11  class OP_API GpuRenderer : public Renderer
12  {
13  public:
14  explicit GpuRenderer(
15  const float renderThreshold, const float alphaKeypoint, const float alphaHeatMap,
16  const bool blendOriginalFrame = true, const unsigned int elementToRender = 0u,
17  const unsigned int numberElementsToRender = 0u);
18 
19  virtual ~GpuRenderer();
20 
21  std::tuple<std::shared_ptr<float*>, std::shared_ptr<bool>, std::shared_ptr<std::atomic<unsigned int>>,
22  std::shared_ptr<unsigned long long>, std::shared_ptr<const unsigned int>>
24 
26  const std::tuple<std::shared_ptr<float*>, std::shared_ptr<bool>, std::shared_ptr<std::atomic<unsigned int>>,
27  std::shared_ptr<unsigned long long>, std::shared_ptr<const unsigned int>>& tuple,
28  const bool isLast);
29 
31  const std::tuple<std::shared_ptr<float*>, std::shared_ptr<bool>,
32  std::shared_ptr<unsigned long long>>& tuple);
33 
34  protected:
35  std::shared_ptr<float*> spGpuMemory;
36 
37  void cpuToGpuMemoryIfNotCopiedYet(const float* const cpuMemory, const unsigned long long memoryVolume);
38 
39  void gpuToCpuMemoryIfLastRenderer(float* cpuMemory, const unsigned long long memoryVolume);
40 
41  private:
42  std::shared_ptr<unsigned long long> spVolume;
43  bool mIsFirstRenderer;
44  bool mIsLastRenderer;
45  std::shared_ptr<bool> spGpuMemoryAllocated;
46 
48  };
49 }
50 
51 #endif // OPENPOSE_CORE_GPU_RENDERER_HPP
virtual ~GpuRenderer()
std::shared_ptr< float * > spGpuMemory
Definition: gpuRenderer.hpp:35
void gpuToCpuMemoryIfLastRenderer(float *cpuMemory, const unsigned long long memoryVolume)
std::tuple< std::shared_ptr< float * >, std::shared_ptr< bool >, std::shared_ptr< std::atomic< unsigned int > >, std::shared_ptr< unsigned long long >, std::shared_ptr< const unsigned int > > getSharedParameters()
GpuRenderer(const float renderThreshold, const float alphaKeypoint, const float alphaHeatMap, const bool blendOriginalFrame=true, const unsigned int elementToRender=0u, const unsigned int numberElementsToRender=0u)
void cpuToGpuMemoryIfNotCopiedYet(const float *const cpuMemory, const unsigned long long memoryVolume)
void setSharedParameters(const std::tuple< std::shared_ptr< float * >, std::shared_ptr< bool >, std::shared_ptr< unsigned long long >> &tuple)
void setSharedParametersAndIfLast(const std::tuple< std::shared_ptr< float * >, std::shared_ptr< bool >, std::shared_ptr< std::atomic< unsigned int >>, std::shared_ptr< unsigned long long >, std::shared_ptr< const unsigned int >> &tuple, const bool isLast)
#define OP_API
Definition: macros.hpp:18
#define DELETE_COPY(className)
Definition: macros.hpp:32