CLTexImage.h
Go to the documentation of this file.
00001 
00002 //      File:           CLTexImage.h
00003 //      Author:         Changchang Wu
00004 //      Description :   interface for the CLTexImage class.
00005 //                                      class for storing data in CUDA.
00006 //
00007 //      Copyright (c) 2007 University of North Carolina at Chapel Hill
00008 //      All Rights Reserved
00009 //
00010 //      Permission to use, copy, modify and distribute this software and its
00011 //      documentation for educational, research and non-profit purposes, without
00012 //      fee, and without a written agreement is hereby granted, provided that the
00013 //      above copyright notice and the following paragraph appear in all copies.
00014 //      
00015 //      The University of North Carolina at Chapel Hill make no representations
00016 //      about the suitability of this software for any purpose. It is provided
00017 //      'as is' without express or implied warranty. 
00018 //
00019 //      Please send BUG REPORTS to ccwu@cs.unc.edu
00020 //
00022 #if defined(CL_SIFTGPU_ENABLED)
00023 
00024 #ifndef CL_TEX_IMAGE_H
00025 #define CL_TEX_IMAGE_H
00026 
00027 class GLTexImage;
00028 
00029 class CLTexImage
00030 {       
00031 protected:
00032         cl_context              _context;
00033         cl_command_queue        _queue;
00034         cl_mem                  _clData;
00035         int                             _numChannel;
00036         int                             _imgWidth;
00037         int                             _imgHeight;
00038         int                             _texWidth;
00039         int                             _texHeight;
00040         int                             _bufferLen;
00041     int                 _fromGL;
00042 private:
00043     void ReleaseTexture(); 
00044 public:
00045         void SetImageSize(int width, int height);
00046     void SetPackedSize(int width, int height, int packed);
00047         void InitBufferTex(int width, int height, int nchannel);
00048         void InitTexture(int width, int height, int nchannel);
00049     void InitPackedTex(int width, int height, int packed);
00050     void InitTextureGL(GLuint tex, int width, int height, int nchannel);
00051         void CopyToHost(void* buf);
00052         void CopyFromHost(const void* buf);
00053 public:
00054     int CopyToPBO(GLuint pbo);
00055     int GetImageDataSize();
00056 public:
00057     inline operator cl_mem(){return _clData; }
00058         inline int GetImgWidth(){return _imgWidth;}
00059         inline int GetImgHeight(){return _imgHeight;}
00060         inline int GetTexWidth(){return _texWidth;}
00061     inline int GetTexHeight(){return _texHeight;}
00062         inline int GetDataSize(){return _bufferLen;}
00063     inline bool IsImage2D() {return _bufferLen == 0;}
00064         inline int GetImgPixelCount(){return _imgWidth*_imgHeight;}
00065         inline int GetTexPixelCount(){return _texWidth*_texHeight;}
00066 public:
00067     CLTexImage();
00068         CLTexImage(cl_context context, cl_command_queue queue);
00069     void SetContext(cl_context context, cl_command_queue queue);
00070         virtual ~CLTexImage();
00071         friend class ProgramCL;
00072         friend class PyramidCL;
00073     friend class ProgramBagCL;
00074     friend class ProgramBagCLN;
00075 };
00076 
00078 //transfer OpenGL Texture to PBO, then to CUDA vector
00079 //#endif 
00080 #endif // !defined(CU_TEX_IMAGE_H)
00081 #endif
00082 
00083 


siftgpu
Author(s): Changchang Wu (library), Bence Magyar (ROS wrapper)
autogenerated on Thu Jan 2 2014 11:38:01