⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globalutil.h

📁 SiftGPU is an implementation of SIFT [1] for GPU. SiftGPU processes pixels parallely to build Gaussi
💻 H
字号:
////////////////////////////////////////////////////////////////////////////
//	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 GlobalParam
{
public:
	static GLuint	_texTarget;
	static GLuint   _iTexFormat;
	static int		_texMaxDim;
	static int		_texMaxDimGL; 
	static int		_MaxDrawBuffers;
	static int		_verbose;
	static int		_timingS;
	static int		_timingO;
	static int		_timingL;
	static int		_usePackedTex;
	static int		_BetaFilter;
	static int		_IsNvidia;
	static int		_UseGLSL;
	static int		_UseCUDA;
	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		_SupportFP40; //previously named _SupportAdvanced
	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 (could save 30% of memory)
	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		_GradientLevelOffset;
	static int		_ExitAfterSIFT; 
	static int		_NormalizedSIFT;
	static int		_BinarySIFT;
	static int		_KeepExtremumSign;
	static int		_UseFastMath;
	//static int		_UseInternalGLUT;
	//for compatable with old version:
	static float	_OrientationExtraFactor;
	static float	_OrientationGaussianFactor;
	static float    _MulitiOrientationThreshold;
};


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 InitGLParam();
	static int  CreateWindowGLUT();
	static void CleanupOpenGL();

};


#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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -