File: GlobalUtil.h

package info (click to toggle)
colmap 3.5-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 20,564 kB
  • sloc: ansic: 170,595; cpp: 95,339; python: 2,335; makefile: 183; sh: 51
file content (157 lines) | stat: -rwxr-xr-x 4,802 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
////////////////////////////////////////////////////////////////////////////
//	File:		GlobalUtil.h
//	Author:		Changchang Wu
//	Description : 
//		GlobalParam:	Global parameters
//		ClockTimer:		Timer 
//		GlobalUtil:		Global Function wrapper
//
//	Copyright (c) 2007 University of North Carolina at Chapel Hill
//	All Rights Reserved
//
//	Permission to use, copy, modify and distribute this software and its
//	documentation for educational, research and non-profit purposes, without
//	fee, and without a written agreement is hereby granted, provided that the
//	above copyright notice and the following paragraph appear in all copies.
//
//	The University of North Carolina at Chapel Hill make no representations
//	about the suitability of this software for any purpose. It is provided
//	'as is' without express or implied warranty. 
//
//	Please send BUG REPORTS to ccwu@cs.unc.edu
//
////////////////////////////////////////////////////////////////////////////


#ifndef _GLOBAL_UTILITY_H
#define _GLOBAL_UTILITY_H


//wrapper for some shader function
//class ProgramGPU;
class LiteWindow;

class GlobalParam
{
public:
	static GLuint	_texTarget;
	static GLuint   _iTexFormat;
	static int		_texMaxDim;
	static int		_texMaxDimGL; 
    static int      _texMinDim;
	static int		_MemCapGPU;
	static int		_FitMemoryCap;
	static int		_verbose;
	static int		_timingS;
	static int		_timingO;
	static int		_timingL;
	static int		_usePackedTex;
	static int		_IsNvidia;
	static int		_KeepShaderLoop;
	static int		_UseCUDA;
    static int      _UseOpenCL;
	static int		_UseDynamicIndexing; 
	static int		_debug;
	static int		_MaxFilterWidth;
	static float	_FilterWidthFactor;
	static float    _OrientationWindowFactor;
	static float	_DescriptorWindowFactor; 
	static int		_MaxOrientation;
	static int      _OrientationPack2;
	static int		_ListGenGPU;
	static int		_ListGenSkipGPU;
	static int		_SupportNVFloat;
	static int		_SupportTextureRG;
	static int		_FullSupported;
	static float	_MaxFeaturePercent;
	static int		_MaxLevelFeatureNum;
	static int		_DescriptorPPR; 
	static int		_DescriptorPPT; //pixel per texture for one descriptor
	static int		_FeatureTexBlock;
	static int		_NarrowFeatureTex; //implemented but no performance improvement
	static int		_SubpixelLocalization;
	static int		_ProcessOBO; //not implemented yet
    static int      _TruncateMethod;
	static int		_PreciseBorder; //implemented
	static int		_UseSiftGPUEX;
	static int		_ForceTightPyramid;
	static int		_octave_min_default;
	static int		_octave_num_default;
	static int		_InitPyramidWidth;
	static int		_InitPyramidHeight;
	static int		_PreProcessOnCPU;
	static int		_GoodOpenGL;
	static int		_FixedOrientation;
	static int		_LoweOrigin;
	static int		_ExitAfterSIFT; 
	static int		_NormalizedSIFT;
	static int		_BinarySIFT;
	static int		_KeepExtremumSign;
	static int		_FeatureCountThreshold;
    static int      _KeyPointListForceLevel0;
	static int		_DarknessAdaption;

	//for compatability with old version:
	static float	_OrientationExtraFactor;
	static float	_OrientationGaussianFactor;
	static float    _MulitiOrientationThreshold;

	////////////////////////////////////////
	static int				_WindowInitX;
	static int				_WindowInitY;
	static const char*		_WindowDisplay;
    static int              _DeviceIndex; 
};


class ClockTimer
{
private:
	char _current_event[256];
	int  _time_start;
	int  _time_stop;
public:
	static int	  ClockMS();
	static double CLOCK();
	static void	  InitHighResolution();
	void StopTimer(int verb = 1);
	void StartTimer(const char * event, int verb=0);
	float  GetElapsedTime();
};

class GlobalUtil:public GlobalParam
{
    static ClockTimer _globalTimer;                             
public:
	inline static double CLOCK()				{	return ClockTimer::CLOCK();			}
	inline static void StopTimer()				{	_globalTimer.StopTimer(_timingS);			}
	inline static void StartTimer(const char * event)	{	_globalTimer.StartTimer(event, _timingO);	}
	inline static float GetElapsedTime()		{	return _globalTimer.GetElapsedTime();		}

	static void FitViewPort(int width, int height);
	static void SetTextureParameter();
	static void SetTextureParameterUS();
#ifdef _DEBUG
	static void CheckErrorsGL(const char* location = NULL);
#else
	static void inline CheckErrorsGL(const char* location = NULL){};
#endif
	static bool CheckFramebufferStatus();
	//initialize Opengl parameters
	static void SelectDisplay();
	static void InitGLParam(int NotTargetGL = 0);
	static void SetGLParam();
	static int  CreateWindowEZ();
	static void CleanupOpenGL();
    static void SetDeviceParam(int argc, char** argv);
    static int  CreateWindowEZ(LiteWindow* window);
};


#if defined(_MSC_VER) && _MSC_VER == 1200
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#endif

#endif