GlobalUtil.h
Go to the documentation of this file.
00001 
00002 //      File:           GlobalUtil.h
00003 //      Author:         Changchang Wu
00004 //      Description : 
00005 //              GlobalParam:    Global parameters
00006 //              ClockTimer:             Timer 
00007 //              GlobalUtil:             Global Function wrapper
00008 //
00009 //      Copyright (c) 2007 University of North Carolina at Chapel Hill
00010 //      All Rights Reserved
00011 //
00012 //      Permission to use, copy, modify and distribute this software and its
00013 //      documentation for educational, research and non-profit purposes, without
00014 //      fee, and without a written agreement is hereby granted, provided that the
00015 //      above copyright notice and the following paragraph appear in all copies.
00016 //
00017 //      The University of North Carolina at Chapel Hill make no representations
00018 //      about the suitability of this software for any purpose. It is provided
00019 //      'as is' without express or implied warranty. 
00020 //
00021 //      Please send BUG REPORTS to ccwu@cs.unc.edu
00022 //
00024 
00025 
00026 #ifndef _GLOBAL_UTILITY_H
00027 #define _GLOBAL_UTILITY_H
00028 
00029 
00030 //wrapper for some shader function
00031 //class ProgramGPU;
00032 class LiteWindow;
00033 
00034 class GlobalParam
00035 {
00036 public:
00037         static GLuint   _texTarget;
00038         static GLuint   _iTexFormat;
00039         static int              _texMaxDim;
00040         static int              _texMaxDimGL; 
00041     static int      _texMinDim;
00042         static int              _MemCapGPU;
00043         static int              _FitMemoryCap;
00044         static int              _verbose;
00045         static int              _timingS;
00046         static int              _timingO;
00047         static int              _timingL;
00048         static int              _usePackedTex;
00049         static int              _IsNvidia;
00050         static int              _KeepShaderLoop;
00051         static int              _UseCUDA;
00052     static int      _UseOpenCL;
00053         static int              _UseDynamicIndexing; 
00054         static int              _debug;
00055         static int              _MaxFilterWidth;
00056         static float    _FilterWidthFactor;
00057         static float    _OrientationWindowFactor;
00058         static float    _DescriptorWindowFactor; 
00059         static int              _MaxOrientation;
00060         static int      _OrientationPack2;
00061         static int              _ListGenGPU;
00062         static int              _ListGenSkipGPU;
00063         static int              _SupportNVFloat;
00064         static int              _SupportTextureRG;
00065         static int              _FullSupported;
00066         static float    _MaxFeaturePercent;
00067         static int              _MaxLevelFeatureNum;
00068         static int              _DescriptorPPR; 
00069         static int              _DescriptorPPT; //pixel per texture for one descriptor
00070         static int              _FeatureTexBlock;
00071         static int              _NarrowFeatureTex; //implemented but no performance improvement
00072         static int              _SubpixelLocalization;
00073         static int              _ProcessOBO; //not implemented yet
00074     static int      _TruncateMethod;
00075         static int              _PreciseBorder; //implemented
00076         static int              _UseSiftGPUEX;
00077         static int              _ForceTightPyramid;
00078         static int              _octave_min_default;
00079         static int              _octave_num_default;
00080         static int              _InitPyramidWidth;
00081         static int              _InitPyramidHeight;
00082         static int              _PreProcessOnCPU;
00083         static int              _GoodOpenGL;
00084         static int              _FixedOrientation;
00085         static int              _LoweOrigin;
00086         static int              _ExitAfterSIFT; 
00087         static int              _NormalizedSIFT;
00088         static int              _BinarySIFT;
00089         static int              _KeepExtremumSign;
00090         static int              _FeatureCountThreshold;
00091     static int      _KeyPointListForceLevel0;
00092         static int              _DarknessAdaption;
00093 
00094         //for compatability with old version:
00095         static float    _OrientationExtraFactor;
00096         static float    _OrientationGaussianFactor;
00097         static float    _MulitiOrientationThreshold;
00098 
00100         static int                              _WindowInitX;
00101         static int                              _WindowInitY;
00102         static const char*              _WindowDisplay;
00103     static int              _DeviceIndex; 
00104 };
00105 
00106 
00107 class ClockTimer
00108 {
00109 private:
00110         char _current_event[256];
00111         int  _time_start;
00112         int  _time_stop;
00113 public:
00114         static int        ClockMS();
00115         static double CLOCK();
00116         static void       InitHighResolution();
00117         void StopTimer(int verb = 1);
00118         void StartTimer(const char * event, int verb=0);
00119         float  GetElapsedTime();
00120 };
00121 
00122 class GlobalUtil:public GlobalParam
00123 {
00124     static ClockTimer _globalTimer;                             
00125 public:
00126         inline static double CLOCK()                            {       return ClockTimer::CLOCK();                     }
00127         inline static void StopTimer()                          {       _globalTimer.StopTimer(_timingS);                       }
00128         inline static void StartTimer(const char * event)       {       _globalTimer.StartTimer(event, _timingO);       }
00129         inline static float GetElapsedTime()            {       return _globalTimer.GetElapsedTime();           }
00130 
00131         static void FitViewPort(int width, int height);
00132         static void SetTextureParameter();
00133         static void SetTextureParameterUS();
00134 #ifdef _DEBUG
00135         static void CheckErrorsGL(const char* location = NULL);
00136 #else
00137         static void inline CheckErrorsGL(const char* location = NULL){};
00138 #endif
00139         static bool CheckFramebufferStatus();
00140         //initialize Opengl parameters
00141         static void SelectDisplay();
00142         static void InitGLParam(int NotTargetGL = 0);
00143         static void SetGLParam();
00144         static int  CreateWindowEZ();
00145         static void CleanupOpenGL();
00146     static void SetDeviceParam(int argc, char** argv);
00147     static int  CreateWindowEZ(LiteWindow* window);
00148 };
00149 
00150 
00151 #if defined(_MSC_VER) && _MSC_VER == 1200
00152 #define max(a,b)    (((a) > (b)) ? (a) : (b))
00153 #define min(a,b)    (((a) < (b)) ? (a) : (b))
00154 #endif
00155 
00156 #endif
00157 


siftgpu
Author(s): Changchang Wu
autogenerated on Wed Aug 26 2015 15:24:06