25 #ifndef CLFIMAGE2D_HH_
26 #define CLFIMAGE2D_HH_
28 #include <bias_config.h>
29 #include <Base/Common/BIASpragmaStart.hh>
30 #include <Base/Image/MetaData.hh>
31 #include <OpenCLFramework/clfOpenCL.hh>
32 #include <OpenCLFramework/clfMemory.hh>
33 #include <OpenGLFramework/Base/glfTexture2D.hh>
56 unsigned int width,
unsigned int height,
unsigned int stride=0,
57 bool readonly=
false,
bool writeonly=
false,
const void *hostptr = NULL,
bool copy =
false);
62 void AllocateFromBiasImage(
const BIAS::ImageBase &image,
bool readonly=
false,
bool writeonly=
false,
bool copy =
false);
64 void AllocateFromBiasTemplate(
const BIAS::ImageBase &image,
bool readonly=
false,
bool writeonly=
false);
66 void AllocateFromTemplate(
const clfImage2D &src,
bool readonly=
false,
bool writeonly=
false);
71 void AllocateFromTexture2D(
BIAS::glfTexture2D &tex,
bool readonly=
false,
bool writeonly=
false);
73 inline unsigned int Width()
const {
return width_; }
74 inline unsigned int Height()
const {
return height_; }
75 inline unsigned int Stride()
const {
return stride_; }
80 void WriteToImage(
const void *data,
81 unsigned int originX=0,
unsigned int originY=0,
82 unsigned int regionX=0,
unsigned int regionY=0,
83 bool blocking =
true);
86 void ReadFromImage(
void *data,
87 unsigned int originX=0,
unsigned int originY=0,
88 unsigned int regionX=0,
unsigned int regionY=0);
91 unsigned int srcoriginX=0,
unsigned int srcoriginY=0,
92 unsigned int dstoriginX=0,
unsigned int dstoriginY=0,
93 unsigned int regionX=0,
unsigned int regionY=0,
94 bool blocking =
true);
96 void* MapImage(
bool write =
false,
97 unsigned int originX=0,
unsigned int originY=0,
98 unsigned int regionX=0,
unsigned int regionY=0
102 unsigned int originX=0,
unsigned int originY=0,
103 unsigned int regionX=0,
unsigned int regionY=0);
107 std::vector<std::string> GetSupportedImageFormats(
bool readonly=
false,
108 bool writeonly=
false);
110 void GetImageDim(
unsigned int &width,
unsigned int &height)
const {
131 bitdepth_ = bitdepth;
146 void SetIsSpare(
bool spare);
155 clfImage2D(cl::Context *context, cl::CommandQueue *queue);
156 cl::Image2D& image()
const;
164 bool GetFormatSupported_(cl::ImageFormat test,
bool readonly,
bool writeonly);
165 void MakeDim_(cl::size_t<3> &dest,
int x,
int y,
int z);
167 unsigned int width_, height_, stride_;
171 unsigned int bitdepth_;
177 bool isSpare_, isInUse_;
179 static std::vector<cl::ImageFormat> imageFormatsReadable_;
180 static std::vector<cl::ImageFormat> imageFormatsWritable_;
181 static std::vector<cl::ImageFormat> imageFormatsReadWrite_;
185 #include <Base/Common/BIASpragmaEnd.hh>
EColorModel
These are the most often used color models.
BIAS::ImageBase::EStorageType GetStorageType() const
void GetImageDim(unsigned int &width, unsigned int &height) const
unsigned int GetBitDepth() const
void SetMetaData(const BIAS::MetaData &m)
BIAS::ImageBase::EColorModel ColorModel() const
BIAS::ImageBase::EStorageType StorageType() const
BIAS::ImageBase::EColorModel GetColorModel() const
BIAS::glfTexture2D * GetTexture()
unsigned int Width() const
void SetBitDepth(unsigned int bitdepth)
BIAS::MetaData * GetMetaData()
This is the base class for images in BIAS.
unsigned int Stride() const
unsigned int Height() const