Project Ne10
An open, optimized software library for the ARM architecture.
NE10_types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-16 ARM Limited and Contributors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of ARM Limited nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY ARM LIMITED AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED AND CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 /*
29  * NE10 Library : inc/NE10_types.h
30  */
31 
36 #ifndef NE10_TYPES_H
37 #define NE10_TYPES_H
38 
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <stdint.h>
42 #include <math.h>
43 #include <string.h>
44 #include <assert.h>
45 
52 #if !defined(NE10_UNROLL_LEVEL)
53 #if defined(__arm__)
54 #define NE10_UNROLL_LEVEL 0
55 #elif defined(__aarch64__)
56 #define NE10_UNROLL_LEVEL 1
57 #else
58 #define NE10_UNROLL_LEVEL 0
59 #endif
60 #endif
61 
63 // constant values that are used across the library
65 #define NE10_OK 0
66 #define NE10_ERR -1
67 
69 // some external definitions to be exposed to the users
71 
72 typedef int8_t ne10_int8_t;
73 typedef uint8_t ne10_uint8_t;
74 typedef int16_t ne10_int16_t;
75 typedef uint16_t ne10_uint16_t;
76 typedef int32_t ne10_int32_t;
77 typedef uint32_t ne10_uint32_t;
78 typedef int64_t ne10_int64_t;
79 typedef uint64_t ne10_uint64_t;
80 typedef float ne10_float32_t;
81 typedef double ne10_float64_t;
82 typedef int ne10_result_t; // resulting [error-]code
83 
87 typedef struct
88 {
91 } ne10_vec2f_t;
92 
96 typedef struct
97 {
101 } ne10_vec3f_t;
102 
106 typedef struct
107 {
112 } ne10_vec4f_t;
113 
115 // definitions for matrix
117 
118 typedef struct
119 {
122 } __attribute__ ( (packed)) ne10_mat_row2f;
123 
124 typedef struct
125 {
126  ne10_mat_row2f c1;
127  ne10_mat_row2f c2;
128 
129 } __attribute__ ( (packed)) ne10_mat2x2f_t; // a 2x2 matrix
130 
131 static inline void createColumnMajorMatrix2x2 (ne10_mat2x2f_t * outMat, ne10_float32_t m11, ne10_float32_t m21, ne10_float32_t m12, ne10_float32_t m22)
132 {
133  assert (NULL != outMat);
134 
135  outMat->c1.r1 = m11;
136  outMat->c1.r2 = m21;
137  outMat->c2.r1 = m12;
138  outMat->c2.r2 = m22;
139 }
140 
141 
142 typedef struct
143 {
147 } __attribute__ ( (packed)) ne10_mat_row3f;
148 
149 typedef struct
150 {
151  ne10_mat_row3f c1;
152  ne10_mat_row3f c2;
153  ne10_mat_row3f c3;
154 
155 } __attribute__ ( (packed)) ne10_mat3x3f_t; // a 3x3 matrix
156 
157 static inline void createColumnMajorMatrix3x3 (ne10_mat3x3f_t * outMat, ne10_float32_t m11, ne10_float32_t m21, ne10_float32_t m31,
160 {
161  assert (NULL != outMat);
162 
163  outMat->c1.r1 = m11;
164  outMat->c1.r2 = m21;
165  outMat->c1.r3 = m31;
166 
167  outMat->c2.r1 = m12;
168  outMat->c2.r2 = m22;
169  outMat->c2.r3 = m32;
170 
171  outMat->c3.r1 = m13;
172  outMat->c3.r2 = m23;
173  outMat->c3.r3 = m33;
174 }
175 
176 
177 typedef struct
178 {
183 } __attribute__ ( (packed)) ne10_mat_row4f;
184 
185 typedef struct
186 {
187  ne10_mat_row4f c1;
188  ne10_mat_row4f c2;
189  ne10_mat_row4f c3;
190  ne10_mat_row4f c4;
191 
192 } __attribute__ ( (packed)) ne10_mat4x4f_t; // a 4x4 matrix
193 
194 static inline void createColumnMajorMatrix4x4 (ne10_mat4x4f_t * outMat, ne10_float32_t m11, ne10_float32_t m21, ne10_float32_t m31, ne10_float32_t m41,
198 {
199  assert (NULL != outMat);
200 
201  outMat->c1.r1 = m11;
202  outMat->c1.r2 = m21;
203  outMat->c1.r3 = m31;
204  outMat->c1.r4 = m41;
205 
206  outMat->c2.r1 = m12;
207  outMat->c2.r2 = m22;
208  outMat->c2.r3 = m32;
209  outMat->c2.r4 = m42;
210 
211  outMat->c3.r1 = m13;
212  outMat->c3.r2 = m23;
213  outMat->c3.r3 = m33;
214  outMat->c3.r4 = m43;
215 
216  outMat->c4.r1 = m14;
217  outMat->c4.r2 = m24;
218  outMat->c4.r3 = m34;
219  outMat->c4.r4 = m44;
220 }
221 
223 // definitions for fft
225 
229 #define NE10_MAXFACTORS 32
230 typedef struct
231 {
235 
239 typedef struct
240 {
263 
268 
269 typedef struct
270 {
272 #if (NE10_UNROLL_LEVEL == 0)
277 #elif (NE10_UNROLL_LEVEL > 0)
278  ne10_int32_t nfft;
279  ne10_fft_cpx_float32_t *r_twiddles;
280  ne10_int32_t *r_factors;
281  ne10_fft_cpx_float32_t *r_twiddles_backward;
282  ne10_fft_cpx_float32_t *r_twiddles_neon;
283  ne10_fft_cpx_float32_t *r_twiddles_neon_backward;
284  ne10_int32_t *r_factors_neon;
285  ne10_fft_cpx_float32_t *r_super_twiddles_neon;
286 #endif
288 
290 
294 typedef struct
295 {
299 
300 typedef struct
301 {
307 
309 
310 typedef struct
311 {
319 
321 
325 typedef struct
326 {
330 
331 typedef struct
332 {
339 
341 
342 typedef struct
343 {
351 
353 
355 // definitions for fir
357 
361 typedef struct
362 {
367 
371 typedef struct
372 {
377 
381 typedef struct
382 {
388 
392 typedef struct
393 {
399 
403 typedef struct
404 {
412 
416 typedef struct
417 {
423 
425 // definitions for imgproc module
427 
431 typedef struct
432 {
435 } ne10_point_t;
436 
437 typedef struct
438 {
441 } ne10_size_t;
442 
443 typedef enum
444 {
449 
450 #endif
Structure for the 16-bit fixed point FFT function.
Definition: NE10_types.h:294
ne10_int32_t is_backward_scaled
Flag to control scaling behaviour in backward floating point complex FFT.
Definition: NE10_types.h:261
ne10_fft_cpx_int16_t * twiddles
Definition: NE10_types.h:315
ne10_float32_t r2
Definition: NE10_types.h:145
ne10_float32_t * pCoeffs
Points to the coefficient array.
Definition: NE10_types.h:385
Instance structure for the floating-point FIR Sparse filter.
Definition: NE10_types.h:403
ne10_int16_t r
Definition: NE10_types.h:296
ne10_float32_t x
Definition: NE10_types.h:108
ne10_mat_row4f c1
Definition: NE10_types.h:187
ne10_fft_cpx_int32_t * twiddles
Definition: NE10_types.h:335
ne10_float32_t y
Definition: NE10_types.h:109
ne10_int32_t * factors
Definition: NE10_types.h:314
uint8_t ne10_uint8_t
Definition: NE10_types.h:73
ne10_fft_cpx_int16_t * twiddles
Definition: NE10_types.h:304
ne10_uint32_t y
Definition: NE10_types.h:440
int32_t ne10_int32_t
Definition: NE10_types.h:76
ne10_int32_t * factors
Definition: NE10_types.h:346
ne10_uint16_t numTaps
Length of the filter.
Definition: NE10_types.h:384
A 2-tuple of ne10_float32_t values.
Definition: NE10_types.h:87
ne10_float32_t * pCoeffs
Points to the coefficient array.
Definition: NE10_types.h:375
ne10_uint16_t phaseLength
Length of each polyphase filter component.
Definition: NE10_types.h:395
float ne10_float32_t
Definition: NE10_types.h:80
ne10_mat_row3f c3
Definition: NE10_types.h:153
Structure for the floating point FFT state.
Definition: NE10_types.h:239
ne10_uint16_t numStages
numStages of the of lattice filter.
Definition: NE10_types.h:418
ne10_float32_t * pState
Points to the state variable array.
Definition: NE10_types.h:407
ne10_float32_t * pkCoeffs
Points to the reflection coefficient array.
Definition: NE10_types.h:420
ne10_float32_t r1
Definition: NE10_types.h:144
int64_t ne10_int64_t
Definition: NE10_types.h:78
ne10_fft_cpx_int16_t * super_twiddles
Definition: NE10_types.h:316
ne10_mat_row4f c4
Definition: NE10_types.h:190
ne10_uint32_t x
Definition: NE10_types.h:439
uint16_t ne10_uint16_t
Definition: NE10_types.h:75
ne10_int32_t * factors
Definition: NE10_types.h:242
ne10_uint16_t numTaps
Length of the filter.
Definition: NE10_types.h:363
ne10_fft_state_float32_t * ne10_fft_cfg_float32_t
Configuration structure for floating point FFT.
Definition: NE10_types.h:267
uint32_t ne10_uint32_t
Definition: NE10_types.h:77
ne10_int16_t i
Definition: NE10_types.h:297
Instance structure for the floating point IIR Lattice filter.
Definition: NE10_types.h:416
ne10_fft_cpx_float32_t * twiddles
Definition: NE10_types.h:275
ne10_fft_cpx_float32_t * twiddles
Definition: NE10_types.h:243
Instance structure for the floating-point FIR Interpolation.
Definition: NE10_types.h:392
ne10_float32_t * pState
Points to the state variable array.
Definition: NE10_types.h:374
ne10_float32_t z
Definition: NE10_types.h:110
ne10_fft_r2c_state_int32_t * ne10_fft_r2c_cfg_int32_t
Definition: NE10_types.h:352
Instance structure for the floating-point FIR filter.
Definition: NE10_types.h:361
ne10_float32_t * pvCoeffs
Points to the ladder coefficient array.
Definition: NE10_types.h:421
ne10_uint8_t L
Interpolation Factor.
Definition: NE10_types.h:394
ne10_float32_t x
Definition: NE10_types.h:98
ne10_float32_t * pState
Points to the state variable array.
Definition: NE10_types.h:386
ne10_float32_t r3
Definition: NE10_types.h:181
ne10_fft_cpx_float32_t * last_twiddles
Definition: NE10_types.h:245
ne10_float32_t * pCoeffs
Points to the coefficient array.
Definition: NE10_types.h:396
ne10_int32_t * factors
Definition: NE10_types.h:303
Structure for the 32-bit fixed point FFT function.
Definition: NE10_types.h:325
ne10_int32_t i
Definition: NE10_types.h:328
ne10_int32_t * factors
Definition: NE10_types.h:334
ne10_float32_t * pCoeffs
Points to the coefficient array.
Definition: NE10_types.h:365
ne10_fft_cpx_float32_t * super_twiddles
Definition: NE10_types.h:276
ne10_float32_t x
Definition: NE10_types.h:89
ne10_mat_row2f c2
Definition: NE10_types.h:127
ne10_mat_row4f c2
Definition: NE10_types.h:188
A 3-tuple of ne10_float32_t values.
Definition: NE10_types.h:96
ne10_uint32_t y
Definition: NE10_types.h:434
ne10_float32_t * pState
Points to the state variable array.
Definition: NE10_types.h:364
ne10_float32_t r3
Definition: NE10_types.h:146
Instance structure for the floating point FIR Lattice filter.
Definition: NE10_types.h:371
ne10_float32_t z
Definition: NE10_types.h:100
ne10_float32_t * pCoeffs
Points to the coefficient array.
Definition: NE10_types.h:408
Instance structure for the floating-point FIR Decimation.
Definition: NE10_types.h:381
ne10_float32_t r2
Definition: NE10_types.h:180
int8_t ne10_int8_t
Definition: NE10_types.h:72
ne10_uint16_t numTaps
Length of the filter.
Definition: NE10_types.h:405
ne10_fft_cpx_int16_t * buffer
Definition: NE10_types.h:305
ne10_mat_row4f c3
Definition: NE10_types.h:189
ne10_fft_cpx_int32_t * twiddles
Definition: NE10_types.h:347
ne10_fft_cpx_int32_t * buffer
Definition: NE10_types.h:336
Structure for point in image.
Definition: NE10_types.h:431
ne10_float32_t * pState
Points to the state variable array.
Definition: NE10_types.h:419
ne10_float32_t y
Definition: NE10_types.h:90
ne10_uint16_t numStages
numStages of the of lattice filter.
Definition: NE10_types.h:373
ne10_float32_t r2
Definition: NE10_types.h:121
ne10_fft_cpx_int32_t * buffer
Definition: NE10_types.h:349
ne10_uint16_t maxDelay
the largest number of delay line values .
Definition: NE10_types.h:409
ne10_fft_r2c_state_int16_t * ne10_fft_r2c_cfg_int16_t
Definition: NE10_types.h:320
ne10_int32_t r
Definition: NE10_types.h:327
double ne10_float64_t
Definition: NE10_types.h:81
ne10_float32_t y
Definition: NE10_types.h:99
ne10_float32_t i
Definition: NE10_types.h:233
ne10_float32_t * pState
Points to the state variable array.
Definition: NE10_types.h:397
ne10_fft_cpx_float32_t * buffer
Definition: NE10_types.h:271
ne10_int32_t * pTapDelay
Pointer to the array containing positions of the non-zero tap values.
Definition: NE10_types.h:410
ne10_fft_cpx_float32_t * buffer
Definition: NE10_types.h:244
ne10_uint8_t M
Decimation Factor.
Definition: NE10_types.h:383
ne10_uint16_t stateIndex
Index pointer for the state buffer .
Definition: NE10_types.h:406
ne10_fft_cpx_int32_t * super_twiddles
Definition: NE10_types.h:348
ne10_float32_t r1
Definition: NE10_types.h:120
uint64_t ne10_uint64_t
Definition: NE10_types.h:79
ne10_mat_row3f c1
Definition: NE10_types.h:151
int16_t ne10_int16_t
Definition: NE10_types.h:74
ne10_mat_row2f c1
Definition: NE10_types.h:126
ne10_int32_t is_forward_scaled
Flag to control scaling behaviour in forward floating point complex FFT.
Definition: NE10_types.h:253
ne10_fft_state_int16_t * ne10_fft_cfg_int16_t
Definition: NE10_types.h:308
ne10_fft_cpx_int16_t * buffer
Definition: NE10_types.h:317
ne10_float32_t r4
Definition: NE10_types.h:182
ne10_uint32_t x
Definition: NE10_types.h:433
ne10_fft_cpx_int32_t * last_twiddles
Definition: NE10_types.h:337
ne10_print_target_t
Definition: NE10_types.h:443
ne10_float32_t r
Definition: NE10_types.h:232
int ne10_result_t
Definition: NE10_types.h:82
A 4-tuple of ne10_float32_t values.
Definition: NE10_types.h:106
ne10_float32_t r1
Definition: NE10_types.h:179
ne10_float32_t w
Definition: NE10_types.h:111
ne10_fft_r2c_state_float32_t * ne10_fft_r2c_cfg_float32_t
Definition: NE10_types.h:289
ne10_mat_row3f c2
Definition: NE10_types.h:152
ne10_fft_state_int32_t * ne10_fft_cfg_int32_t
Definition: NE10_types.h:340