IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
GpuImage.h
1 // GpuImage.h:
3 // --------------
4 //
14 /*
15 #ifndef __IPSDKIMAGE_GPUIMAGE_H__
16 #define __IPSDKIMAGE_GPUIMAGE_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::image::GpuImage::_pGeometry' : class 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'ipsdk::image::GpuImage'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKImage/Image/BaseCompleteImage.h>
24 #include <IPSDKImage/Storage/GpuPlanStorage.h>
25 #include <boost/compute.hpp>
26 
27 namespace ipsdk {
28 namespace image {
29 
32 
33 class IPSDKIMAGE_API GpuImage : public BaseCompleteImage
34 {
35  // declare serial class
36  IPSDK_DECLARE_SERIAL_WITHOUT_COPY(IPSDKImage, GpuImage);
37 
38  // friend class for protected members access
39  friend boost::shared_ptr<GpuImage> boost::make_shared<GpuImage>();
40 
41 // predefined public types
42 public:
44  static const eImageType::domain g_imageType = eImageType::eIT_Gpu;
45 
46 protected:
48  GpuImage();
49 
50 public:
52  ~GpuImage();
53 
54 // methods
55 public:
57  eImageType getImageType() const;
58 
60  ipBool isGpuImage() const;
61 
64  BoolResult init(const BaseImageGeometry& geometry);
65 
68  eImageAccessMode getAccessMode() const;
69 
74  BoolResult resize(const BaseImageGeometry& geometry);
75 
80  const void* getDataPtr(const PlanIndex& planIndex) const;
81  void* getDataPtr(const PlanIndex& planIndex);
83 
87  const void* getDataPtr(const ipUInt64 zPlanIdx,
88  const ipUInt64 cPlanIdx,
89  const ipUInt64 tPlanIdx) const;
90  void* getDataPtr(const ipUInt64 zPlanIdx,
91  const ipUInt64 cPlanIdx,
92  const ipUInt64 tPlanIdx);
94 
96  void fromCPU(const BaseImage& inImage);
97 
99  void toCPU(ipsdk::image::ImagePtr pOutImage);
100 
102  ipsdk::image::ImagePtr toCPU();
103 
109  const ipsdk::image::GpuPlanStorage::GpuBuffer&
110  getBuffer(const ipUInt64 deviceIdx) const;
111 
112  ipsdk::image::GpuPlanStorage::GpuBuffer&
113  getBuffer(const ipUInt64 deviceIdx);
115 
117  boost::compute::command_queue&
118  getQueue(const ipUInt64 deviceIdx);
119 
121  ipUInt64 getNbDevices() const;
122 
123 protected:
126  BoolResult createImagePlans(const BaseImageGeometry& geometry,
127  PlanStorageColl3d& imagePlans);
128 
130  ipUInt64 getDeviceIdx(const ipUInt64 z, const ipUInt64 c, const ipUInt64 t) const;
131 
132 // attributes
133 protected:
134 
135 };
136 
139 
140 inline eImageType
141 GpuImage::getImageType() const
142 {
143  return g_imageType;
144 }
145 
146 inline ipBool
147 GpuImage::isGpuImage() const
148 {
149  return true;
150 }
151 
154 
155 } // end of namespace image
156 } // end of namespace ipsdk
157 
158 #pragma warning (pop)
159 
160 #endif // __IPSDKIMAGE_GPUIMAGE_H__
161 */