1 ////////////////////////////////////////////////////////////////////////////
2 //	File:		SiftMatchCU.h
3 //	Author:		Changchang Wu
4 //	Description :	interface for the SiftMatchCU
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 CU_SIFT_MATCH_H
25 #define CU_SIFT_MATCH_H
26 #if defined(CUDA_SIFTGPU_ENABLED)
27 
28 class CuTexImage;
29 class SiftMatchCU:public SiftMatchGPU
30 {
31 private:
32 	//tex storage
33 	CuTexImage _texLoc[2];
34 	CuTexImage _texDes[2];
35 	CuTexImage _texDot;
36 	CuTexImage _texMatch[2];
37 	CuTexImage _texCRT;
38 
39 	//programs
40 	//
41 	int _num_sift[2];
42 	int _id_sift[2];
43 	int _have_loc[2];
44 
45 	//gpu parameter
46 	int _initialized;
47 	vector<int> sift_buffer;
48 private:
49 	int  GetBestMatch(int max_match, uint32_t match_buffer[][2], float distmax, float ratiomax, int mbm);
50 public:
51 	SiftMatchCU(int max_sift);
~SiftMatchCU()52 	virtual ~SiftMatchCU(){};
53 	void InitSiftMatch();
54   bool Allocate(int max_sift, int mbm) override;
55 	void SetMaxSift(int max_sift) override;
56 	void SetDescriptors(int index, int num, const unsigned char * descriptor, int id = -1);
57 	void SetDescriptors(int index, int num, const float * descriptor, int id = -1);
58 	void SetFeautreLocation(int index, const float* locatoins, int gap);
59 	int  GetSiftMatch(int max_match, uint32_t match_buffer[][2], float distmax, float ratiomax, int mbm);
60 	int  GetGuidedSiftMatch(int max_match, uint32_t match_buffer[][2], float* H, float* F,
61 									 float distmax, float ratiomax, float hdistmax, float fdistmax, int mbm);
62     //////////////////////////////
63     static int  CheckCudaDevice(int device);
64 };
65 
66 #endif
67 #endif
68 
69