src/qvcore/qvdefines.h

00001 /*
00002  *      Copyright (C) 2007, 2008. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef QVDEFINES_H
00022 #define QVDEFINES_H
00023 
00024 #include <math.h>
00025 
00026 #define POW2(X)                 ((X)*(X))
00027 #define SIGN(X)                 (((X)>=0)?1:-1)
00028 #define ABS(X)                  (((X)>0)?(X):(-(X)))
00029 #define MIN(X,Y)                (((X)<(Y))?(X):(Y))
00030 #define MAX(X,Y)                (((X)>(Y))?(X):(Y))
00031 #define RANDOM(MIN, MAX)        (rand()%((MAX)-(MIN)+1) + (MIN))
00032 
00033 #define PI              (3.14159265358979323846)
00034 #define EPSILON         (10E-6)
00035 
00036 typedef unsigned char   uChar;          // Ipp8u        1 bytes
00037 typedef unsigned short  uShort;         // Ipp16u       2 "
00038 typedef unsigned int    uInt;           // Ipp32u       4 "
00039 typedef signed char     sChar;          // Ipp8s        1 ...
00040 typedef signed short    sShort;         // Ipp16s       2
00041 typedef signed int      sInt;           // Ipp32s       4
00042 //typedef __INT64       sLong;          // Ipp64s       8 (not estandar type)
00043 //typedef __UINT64      uLong;          // Ipp64u       8 (not estandar type)
00044 typedef float           sFloat;         // Ipp32f       4
00045 typedef double          sDouble;        // Ipp64f       8
00046 
00047 #endif