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

Last change on this file since 822 was 822, checked in by meunier, 8 years ago

In rosenfeld:

  • Updated nrio0, nrio1, nrio2, nrio1f, nrio2f, nrio1x, nrbool1, nrbool2 and nralloc1 in the nrc2 lib in order to use macro-typed functions
  • Updated the simulation script to include performance evaluation with random images, and a script to generate graphs
  • Updated the clock.h to use 64-bit integers, which potentially breaks the printing on the giet
File size: 5.1 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#include "mypredef.h"
22   
23
24// Short names
25
26#define sn_int8_t(p,s)      p##i8##s
27#define sn_int16_t(p,s)     p##i16##s
28#define sn_int32_t(p,s)     p##i32##s
29#define sn_int64_t(p,s)     p##i64##s
30#define sn_uint8_t(p,s)     p##ui8##s
31#define sn_uint16_t(p,s)    p##ui16##s
32#define sn_uint32_t(p,s)    p##ui32##s
33#define sn_uint64_t(p,s)    p##ui64##s
34#define sn_float(p,s)       p##f32##s
35#define sn_double(p,s)      p##f64##s
36#define sn_void_p(p,s)      p##v##s
37#define sn_rgb8(p,s)        p##rgb8##s
38#define sn_rgbx8(p,s)       p##rgbx8##s
39#define sn_rgb32(p,s)       p##rgb32##s
40#define sn_rgbx32(p,s)      p##rgbx32##s
41#define sn_complex32(p,s)   p##c32##s
42#define sn_complex64(p,s)   p##c64##s
43#define sn_si16Point(p,s)   p##si16P##s
44#define sn_ui16Point(p,s)   p##ui16P##s
45#define sn_si32Point(p,s)   p##si32P##s
46#define sn_ui32Point(p,s)   p##ui32P##s
47#define sn_f32Point(p,s)    p##f32P##s
48#define sn_si16Triplet(p,s) p##si16T##s
49#define sn_ui16Triplet(p,s) p##ui16T##s
50#define sn_si32Triplet(p,s) p##si32T##s
51#define sn_ui32Triplet(p,s) p##ui32T##s
52#define sn_f32Triplet(p,s)  p##f32T##s
53
54#define short_name(t,p,s) sn_##t(p,s)
55
56#define NR_END 0
57#define FREE_ARG char*
58
59
60
61
62/* ------------------------------- */
63/* --- 8, 16, 32, 64 bit types --- */
64/* ------------------------------- */
65
66typedef void * void_p;
67typedef char    byte;
68
69typedef int8_t  int8;
70typedef int16_t int16;
71typedef int32_t int32;
72typedef int64_t int64;
73   
74
75// full-typed types
76typedef int8_t   sint8;
77typedef uint8_t  uint8;
78
79typedef int16_t  sint16;
80typedef uint16_t uint16;
81
82typedef int32_t  sint32;
83typedef uint32_t uint32;
84
85typedef int64_t  sint64;
86typedef uint64_t uint64;
87
88typedef float    float32;
89typedef double   float64;
90
91
92/* -------------------- */
93/* --- complex type --- */
94/* -------------------- */
95
96typedef struct { float32 x; float32 y;} complex32;
97typedef struct { float64 x; float64 y;} complex64;
98
99/* --------------------- */
100/* --- RGB, BGR type --- */
101/* --------------------- */
102//typedef struct { byte  r; byte  g; byte  b; } rgb8;
103
104typedef struct { uint8   r; uint8   g; uint8   b; } rgb8;
105typedef struct { sint16  r; sint16  g; sint16  b; } rgb16;
106typedef struct { sint32  r; sint32  g; sint32  b; } rgb32;
107typedef struct { float32 r; float32 g; float32 b; } rgbf32;
108
109typedef struct { uint8   b; uint8   g; uint8   r; } bgr8;
110typedef struct { sint16  b; sint16  g; sint16  r; } bgr16;
111typedef struct { sint32  b; sint32  g; sint32  r; } bgr32;
112typedef struct { float32 b; float32 g; float32 r; } bgrf32;
113
114typedef struct { uint8   r; uint8   g; uint8   b; uint8   x; } rgbx8;
115typedef struct { int16   r; int16   g; int16   b; int16   x; } rgbx16;
116typedef struct { int32   r; int32   g; int32   b; int32   x; } rgbx32;
117typedef struct { float32 r; float32 g; float32 b; float32 x; } rgbxf32;
118
119typedef struct { uint8   x; uint8   b; uint8   g; uint8   r; } bgrx8;
120typedef struct { int16   x; int16   b; int16   g; int16   r; } bgrx16;
121typedef struct { int32   x; int32   b; int32   g; int32   r; } bgrx32;
122typedef struct { float32 x; float32 b; float32 g; float32 r; } bgrxf32;
123
124/* ---------------- */
125/* --- bitfield --- */
126/* ---------------- */
127typedef struct {
128    unsigned int b0  : 1;
129    unsigned int b1  : 1;
130    unsigned int b2  : 1;
131    unsigned int b3  : 1;
132    unsigned int b4  : 1;
133    unsigned int b5  : 1;
134    unsigned int b6  : 1;
135    unsigned int b7  : 1;
136    unsigned int b8  : 1;
137    unsigned int b9  : 1;
138    unsigned int b10 : 1;
139    unsigned int b11 : 1;
140    unsigned int b12 : 1;
141    unsigned int b13 : 1;
142    unsigned int b14 : 1;
143    unsigned int b15 : 1;
144    unsigned int b16 : 1;
145    unsigned int b17 : 1;
146    unsigned int b18 : 1;
147    unsigned int b19 : 1;
148    unsigned int b20 : 1;
149    unsigned int b21 : 1;
150    unsigned int b22 : 1;
151    unsigned int b23 : 1;
152    unsigned int b24 : 1;
153    unsigned int b25 : 1;
154    unsigned int b26 : 1;
155    unsigned int b27 : 1;
156    unsigned int b28 : 1;
157    unsigned int b29 : 1;
158    unsigned int b30 : 1;
159    unsigned int b31 : 1;
160} bitfield32;
161
162typedef struct {
163    unsigned int b0  : 1;
164    unsigned int b1  : 1;
165    unsigned int b2  : 1;
166    unsigned int b3  : 1;
167    unsigned int b4  : 1;
168    unsigned int b5  : 1;
169    unsigned int b6  : 1;
170    unsigned int b7  : 1;
171    unsigned int b8  : 1;
172    unsigned int b9  : 1;
173    unsigned int b10 : 1;
174    unsigned int b11 : 1;
175    unsigned int b12 : 1;
176    unsigned int b13 : 1;
177    unsigned int b14 : 1;
178    unsigned int b15 : 1;
179} bitfield16;
180
181typedef struct {
182    unsigned int b0  : 1;
183    unsigned int b1  : 1;
184    unsigned int b2  : 1;
185    unsigned int b3  : 1;
186    unsigned int b4  : 1;
187    unsigned int b5  : 1;
188    unsigned int b6  : 1;
189    unsigned int b7  : 1;
190} bitfield8;
191
192
193#endif // _NR_TYPE_H_
194
Note: See TracBrowser for help on using the repository browser.