Linear Methods for Image Interpolation
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
basic.h
Go to the documentation of this file.
1
51
#ifndef _BASIC_H_
52
#define _BASIC_H_
53
54
#include <math.h>
55
#include <stdio.h>
56
#include <stdlib.h>
57
58
59
/* Memory management */
61
#define Malloc(s) MallocWithErrorMessage(s)
62
void
*
MallocWithErrorMessage
(
size_t
Size);
64
#define Realloc(p, s) ReallocWithErrorMessage(p, s)
65
void
*
ReallocWithErrorMessage
(
void
*Ptr,
size_t
Size);
67
#define Free(p) free(p)
68
69
70
/* Portable integer types */
71
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
72
73
/* Windows system: Use __intN types to define uint8_t, etc. */
74
typedef
unsigned
__int8 uint8_t;
75
typedef
unsigned
__int16 uint16_t;
76
typedef
unsigned
__int32 uint32_t;
77
typedef
__int8 int8_t;
78
typedef
__int16 int16_t;
79
typedef
__int32 int32_t;
80
81
#else
82
83
/* UNIX system: Use stdint to define uint8_t, etc. */
84
#include <stdint.h>
85
86
#endif
87
88
89
/* Math constants (Hart & Cheney) */
90
#ifndef M_2PI
91
92
#define M_2PI 6.28318530717958647692528676655900576
93
#endif
94
#ifndef M_PI
95
96
#define M_PI 3.14159265358979323846264338327950288
97
#endif
98
#ifndef M_PI_2
99
100
#define M_PI_2 1.57079632679489661923132169163975144
101
#endif
102
#ifndef M_PI_4
103
104
#define M_PI_4 0.78539816339744830961566084581987572
105
#endif
106
#ifndef M_PI_8
107
108
#define M_PI_8 0.39269908169872415480783042290993786
109
#endif
110
#ifndef M_SQRT2
111
112
#define M_SQRT2 1.41421356237309504880168872420969808
113
#endif
114
#ifndef M_1_SQRT2
115
116
#define M_1_SQRT2 0.70710678118654752440084436210484904
117
#endif
118
#ifndef M_E
119
120
#define M_E 2.71828182845904523536028747135266250
121
#endif
122
#ifndef M_LOG2E
123
124
#define M_LOG2E 1.44269504088896340735992468100189213
125
#endif
126
#ifndef M_LOG10E
127
128
#define M_LOG10E 0.43429448190325182765112891891660508
129
#endif
130
#ifndef M_LN2
131
132
#define M_LN2 0.69314718055994530941723212145817657
133
#endif
134
#ifndef M_LN10
135
136
#define M_LN10 2.30258509299404568401799145468436421
137
#endif
138
#ifndef M_EULER
139
140
#define M_EULER 0.57721566490153286060651209008240243
141
#endif
142
143
#ifndef M_SQRT2PI
144
148
#define M_SQRT2PI 2.50662827463100050241576528481104525
149
#endif
150
152
#define ROUND(X) (floor((X) + 0.5))
153
155
#define ROUNDF(X) (floor((X) + 0.5f))
156
157
158
#ifdef __GNUC__
159
#ifndef ATTRIBUTE_UNUSED
160
161
#define ATTRIBUTE_UNUSED __attribute__((unused))
162
#endif
163
#ifndef ATTRIBUTE_ALWAYSINLINE
164
165
#define ATTRIBUTE_ALWAYSINLINE __attribute__((always_inline))
166
#endif
167
#else
168
#define ATTRIBUTE_UNUSED
169
#define ATTRIBUTE_ALWAYSINLINE
170
#endif
171
172
173
/* Error messaging */
174
void
ErrorMessage
(
const
char
*Format, ...);
175
176
/* Timer function */
177
unsigned
long
Clock
();
178
179
#endif
/* _BASIC_H_ */
Generated on Fri Jul 5 2013 18:57:40 for Linear Methods for Image Interpolation by
1.8.3.1