1 ////////////////////////////////////////////////////////////////////////////
2 //	File:		PyramidCU.h
3 //	Author:		Changchang Wu
4 //	Description : interface for the PyramdCU
5 //
6 //	Copyright (c) 2007 University of North Carolina at Chapel Hill
7 //	All Rights Reserved
8 //
9 //	Permission to use, copy, modify and distribute this software and its
10 //	documentation for educational, research and non-profit purposes, without
11 //	fee, and without a written agreement is hereby granted, provided that the
12 //	above copyright notice and the following paragraph appear in all copies.
13 //
14 //	The University of North Carolina at Chapel Hill make no representations
15 //	about the suitability of this software for any purpose. It is provided
16 //	'as is' without express or implied warranty.
17 //
18 //	Please send BUG REPORTS to ccwu@cs.unc.edu
19 //
20 ////////////////////////////////////////////////////////////////////////////
21 
22 
23 
24 #ifndef _PYRAMID_CU_H
25 #define _PYRAMID_CU_H
26 #if defined(CUDA_SIFTGPU_ENABLED)
27 
28 class GLTexImage;
29 class CuTexImage;
30 class SiftPyramid;
31 class PyramidCU:public SiftPyramid
32 {
33 	CuTexImage* _inputTex;
34 	CuTexImage* _allPyramid;
35 	CuTexImage* _histoPyramidTex;
36 	CuTexImage* _featureTex;
37 	CuTexImage* _descriptorTex;
38 	CuTexImage* _orientationTex;
39 	GLuint		_bufferPBO;
40     GLTexImage* _bufferTEX;
41 public:
42 	virtual void GetFeatureDescriptors();
43 	virtual void GenerateFeatureListTex();
44 	virtual void ReshapeFeatureListCPU();
45 	virtual void GenerateFeatureDisplayVBO();
46 	virtual void DestroySharedData();
47 	virtual void DestroyPerLevelData();
48 	virtual void DestroyPyramidData();
49 	virtual void DownloadKeypoints();
50 	virtual void GenerateFeatureListCPU();
51 	virtual void GenerateFeatureList();
52 	virtual GLTexImage* GetLevelTexture(int octave, int level);
53 	virtual GLTexImage* GetLevelTexture(int octave, int level, int dataName);
54 	virtual void BuildPyramid(GLTexInput * input);
55 	virtual void DetectKeypointsEX();
56 	virtual void ComputeGradient();
57 	virtual void GetFeatureOrientations();
58 	virtual void GetSimplifiedOrientation();
59 	virtual void InitPyramid(int w, int h, int ds = 0);
60 	virtual void ResizePyramid(int w, int h);
IsUsingRectDescription()61     virtual int  IsUsingRectDescription(){return _existing_keypoints & SIFT_RECT_DESCRIPTION; }
62 	//////////
63 	void CopyGradientTex();
64 	void FitPyramid(int w, int h);
65 
66     void InitializeContext();
67 	int ResizeFeatureStorage();
68 	int FitHistogramPyramid(CuTexImage* tex);
69 	void SetLevelFeatureNum(int idx, int fcount);
70 	void ConvertInputToCU(GLTexInput* input);
71 	GLTexImage* ConvertTexCU2GL(CuTexImage* tex, int dataName);
72 	CuTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN);
TruncateWidth(int & w)73     void TruncateWidth(int& w) { w = GLTexInput::TruncateWidthCU(w); }
74     //////////////////////////
75     static int CheckCudaDevice(int device);
76 private:
77 	void GenerateFeatureList(int i, int j, int reduction_count, vector<int>& hbuffer);
78 public:
79 	PyramidCU(SiftParam& sp);
80 	virtual ~PyramidCU();
81 };
82 
83 
84 
85 #endif
86 #endif
87