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