source: soft/giet_vm/applications/rosenfeld/nrc2/include/nrtype.h @ 821

Last change on this file since 821 was 821, checked in by meunier, 8 years ago
  • Added several versions of rosenfeld: { SLOW, FAST } x { FEATURES, NO_FEATURES }
  • Added native linux compilation support
  • Added a script to check results natively
  • Started to refactor nrc code
File size: 5.2 KB
Line 
1/* ---------------- */
2/* --- nrtype.h --- */
3/* ---------------- */
4
5/*
6 * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved
7 * Univ Paris Sud XI, CNRS
8 *
9 * Modif : 15/01/2001 : rgb16, rgb32 are now signed (int16, int32)
10 * modif : 22/02/2001 : new types : float32 & float64
11 * modif : 15/02/2004 : clean-up previous definition for mac-OSX port
12 * modif:  1/06/2010 : split of def.h into nrtype.h nrdefine.h ...
13 */
14
15#ifndef _NRTYPE_H_
16#define _NRTYPE_H_
17
18#include <stdint.h>
19
20// ---------------------------------- //
21// -- don not write under the line -- //
22// ---------------------------------- //
23
24
25#include "mypredef.h"
26   
27
28// Short names
29
30#define sn_int8_t(p,s)      p##i8##s
31#define sn_int16_t(p,s)     p##i16##s
32#define sn_int32_t(p,s)     p##i32##s
33#define sn_int64_t(p,s)     p##i64##s
34#define sn_uint8_t(p,s)     p##ui8##s
35#define sn_uint16_t(p,s)    p##ui16##s
36#define sn_uint32_t(p,s)    p##ui32##s
37#define sn_uint64_t(p,s)    p##ui64##s
38#define sn_float(p,s)       p##f32##s
39#define sn_double(p,s)      p##f64##s
40#define sn_void_p(p,s)      p##v##s
41#define sn_rgb8(p,s)        p##rgb8##s
42#define sn_rgbx8(p,s)       p##rgbx8##s
43#define sn_rgb32(p,s)       p##rgb32##s
44#define sn_rgbx32(p,s)      p##rgbx32##s
45#define sn_complex32(p,s)   p##c32##s
46#define sn_complex64(p,s)   p##c64##s
47#define sn_si16Point(p,s)   p##si16P##s
48#define sn_ui16Point(p,s)   p##ui16P##s
49#define sn_si32Point(p,s)   p##si32P##s
50#define sn_ui32Point(p,s)   p##ui32P##s
51#define sn_f32Point(p,s)    p##f32P##s
52#define sn_si16Triplet(p,s) p##si16T##s
53#define sn_ui16Triplet(p,s) p##ui16T##s
54#define sn_si32Triplet(p,s) p##si32T##s
55#define sn_ui32Triplet(p,s) p##ui32T##s
56#define sn_f32Triplet(p,s)  p##f32T##s
57
58#define short_name(t,p,s) sn_##t(p,s)
59
60#define NR_END 0
61#define FREE_ARG char*
62
63
64
65
66/* ------------------------------- */
67/* --- 8, 16, 32, 64 bit types --- */
68/* ------------------------------- */
69
70typedef void * void_p;
71typedef char    byte;
72
73typedef int8_t  int8;
74typedef int16_t int16;
75typedef int32_t int32;
76typedef int64_t int64;
77   
78
79// full-typed types
80typedef int8_t   sint8;
81typedef uint8_t  uint8;
82
83typedef int16_t  sint16;
84typedef uint16_t uint16;
85
86typedef int32_t  sint32;
87typedef uint32_t uint32;
88
89typedef int64_t  sint64;
90typedef uint64_t uint64;
91
92typedef float    float32;
93typedef double   float64;
94
95
96/* -------------------- */
97/* --- complex type --- */
98/* -------------------- */
99
100typedef struct { float32 x; float32 y;} complex32;
101typedef struct { float64 x; float64 y;} complex64;
102
103/* --------------------- */
104/* --- RGB, BGR type --- */
105/* --------------------- */
106//typedef struct { byte  r; byte  g; byte  b; } rgb8;
107
108typedef struct { uint8   r; uint8   g; uint8   b; } rgb8;
109typedef struct { sint16  r; sint16  g; sint16  b; } rgb16;
110typedef struct { sint32  r; sint32  g; sint32  b; } rgb32;
111typedef struct { float32 r; float32 g; float32 b; } rgbf32;
112
113typedef struct { uint8   b; uint8   g; uint8   r; } bgr8;
114typedef struct { sint16  b; sint16  g; sint16  r; } bgr16;
115typedef struct { sint32  b; sint32  g; sint32  r; } bgr32;
116typedef struct { float32 b; float32 g; float32 r; } bgrf32;
117
118typedef struct { uint8   r; uint8   g; uint8   b; uint8   x; } rgbx8;
119typedef struct { int16   r; int16   g; int16   b; int16   x; } rgbx16;
120typedef struct { int32   r; int32   g; int32   b; int32   x; } rgbx32;
121typedef struct { float32 r; float32 g; float32 b; float32 x; } rgbxf32;
122
123typedef struct { uint8   x; uint8   b; uint8   g; uint8   r; } bgrx8;
124typedef struct { int16   x; int16   b; int16   g; int16   r; } bgrx16;
125typedef struct { int32   x; int32   b; int32   g; int32   r; } bgrx32;
126typedef struct { float32 x; float32 b; float32 g; float32 r; } bgrxf32;
127
128/* ---------------- */
129/* --- bitfield --- */
130/* ---------------- */
131typedef struct {
132    unsigned int b0  : 1;
133    unsigned int b1  : 1;
134    unsigned int b2  : 1;
135    unsigned int b3  : 1;
136    unsigned int b4  : 1;
137    unsigned int b5  : 1;
138    unsigned int b6  : 1;
139    unsigned int b7  : 1;
140    unsigned int b8  : 1;
141    unsigned int b9  : 1;
142    unsigned int b10 : 1;
143    unsigned int b11 : 1;
144    unsigned int b12 : 1;
145    unsigned int b13 : 1;
146    unsigned int b14 : 1;
147    unsigned int b15 : 1;
148    unsigned int b16 : 1;
149    unsigned int b17 : 1;
150    unsigned int b18 : 1;
151    unsigned int b19 : 1;
152    unsigned int b20 : 1;
153    unsigned int b21 : 1;
154    unsigned int b22 : 1;
155    unsigned int b23 : 1;
156    unsigned int b24 : 1;
157    unsigned int b25 : 1;
158    unsigned int b26 : 1;
159    unsigned int b27 : 1;
160    unsigned int b28 : 1;
161    unsigned int b29 : 1;
162    unsigned int b30 : 1;
163    unsigned int b31 : 1;
164} bitfield32;
165
166typedef struct {
167    unsigned int b0  : 1;
168    unsigned int b1  : 1;
169    unsigned int b2  : 1;
170    unsigned int b3  : 1;
171    unsigned int b4  : 1;
172    unsigned int b5  : 1;
173    unsigned int b6  : 1;
174    unsigned int b7  : 1;
175    unsigned int b8  : 1;
176    unsigned int b9  : 1;
177    unsigned int b10 : 1;
178    unsigned int b11 : 1;
179    unsigned int b12 : 1;
180    unsigned int b13 : 1;
181    unsigned int b14 : 1;
182    unsigned int b15 : 1;
183} bitfield16;
184
185typedef struct {
186    unsigned int b0  : 1;
187    unsigned int b1  : 1;
188    unsigned int b2  : 1;
189    unsigned int b3  : 1;
190    unsigned int b4  : 1;
191    unsigned int b5  : 1;
192    unsigned int b6  : 1;
193    unsigned int b7  : 1;
194} bitfield8;
195
196
197#endif // _NR_TYPE_H_
198
Note: See TracBrowser for help on using the repository browser.