2 /* autogenerated from adrian-aec-orc.orc */
11 #ifndef _ORC_INTEGER_TYPEDEFS_
12 #define _ORC_INTEGER_TYPEDEFS_
13 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
15 typedef int8_t orc_int8;
16 typedef int16_t orc_int16;
17 typedef int32_t orc_int32;
18 typedef int64_t orc_int64;
19 typedef uint8_t orc_uint8;
20 typedef uint16_t orc_uint16;
21 typedef uint32_t orc_uint32;
22 typedef uint64_t orc_uint64;
23 #elif defined(_MSC_VER)
24 typedef signed __int8 orc_int8;
25 typedef signed __int16 orc_int16;
26 typedef signed __int32 orc_int32;
27 typedef signed __int64 orc_int64;
28 typedef unsigned __int8 orc_uint8;
29 typedef unsigned __int16 orc_uint16;
30 typedef unsigned __int32 orc_uint32;
31 typedef unsigned __int64 orc_uint64;
34 typedef signed char orc_int8;
35 typedef short orc_int16;
36 typedef int orc_int32;
37 typedef unsigned char orc_uint8;
38 typedef unsigned short orc_uint16;
39 typedef unsigned int orc_uint32;
40 #if INT_MAX == LONG_MAX
41 typedef long long orc_int64;
42 typedef unsigned long long orc_uint64;
44 typedef long orc_int64;
45 typedef unsigned long orc_uint64;
48 typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
49 typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
50 typedef union { orc_int64 i; double f; orc_int32 x2[2]; orc_int16 x4[4]; } orc_union64;
53 void update_tap_weights (float * d1, const float * s1, float p1, int n);
56 /* begin Orc C target preamble */
57 #define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
58 #define ORC_ABS(a) ((a)<0 ? -(a) : (a))
59 #define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))
60 #define ORC_MAX(a,b) ((a)>(b) ? (a) : (b))
61 #define ORC_SB_MAX 127
62 #define ORC_SB_MIN (-1-ORC_SB_MAX)
63 #define ORC_UB_MAX 255
65 #define ORC_SW_MAX 32767
66 #define ORC_SW_MIN (-1-ORC_SW_MAX)
67 #define ORC_UW_MAX 65535
69 #define ORC_SL_MAX 2147483647
70 #define ORC_SL_MIN (-1-ORC_SL_MAX)
71 #define ORC_UL_MAX 4294967295U
73 #define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX)
74 #define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX)
75 #define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX)
76 #define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)
77 #define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)
78 #define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)
79 #define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
80 #define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
81 #define ORC_SWAP_Q(x) ((((x)&0xffULL)<<56) | (((x)&0xff00ULL)<<40) | (((x)&0xff0000ULL)<<24) | (((x)&0xff000000ULL)<<8) | (((x)&0xff00000000ULL)>>8) | (((x)&0xff0000000000ULL)>>24) | (((x)&0xff000000000000ULL)>>40) | (((x)&0xff00000000000000ULL)>>56))
82 #define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
83 #define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
84 #define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0))
85 #define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&0x7ff0000000000000ULL) == 0) ? 0xfff0000000000000ULL : 0xffffffffffffffffULL))
86 #define ORC_ISNAN_DOUBLE(x) ((((x)&0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) && (((x)&0x000fffffffffffffULL) != 0))
87 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
88 #define ORC_RESTRICT restrict
89 #elif defined(__GNUC__) && __GNUC__ >= 4
90 #define ORC_RESTRICT __restrict__
94 /* end Orc C target preamble */
98 /* update_tap_weights */
101 update_tap_weights (float * d1, const float * s1, float p1, int n){
103 orc_union32 * ORC_RESTRICT ptr0;
104 const orc_union32 * ORC_RESTRICT ptr4;
111 ptr0 = (orc_union32 *)d1;
112 ptr4 = (orc_union32 *)s1;
117 for (i = 0; i < n; i++) {
125 _src1.i = ORC_DENORMAL(var33.i);
126 _src2.i = ORC_DENORMAL(var34.i);
127 _dest1.f = _src1.f * _src2.f;
128 var37.i = ORC_DENORMAL(_dest1.i);
137 _src1.i = ORC_DENORMAL(var35.i);
138 _src2.i = ORC_DENORMAL(var37.i);
139 _dest1.f = _src1.f + _src2.f;
140 var36.i = ORC_DENORMAL(_dest1.i);
150 _backup_update_tap_weights (OrcExecutor * ORC_RESTRICT ex)
154 orc_union32 * ORC_RESTRICT ptr0;
155 const orc_union32 * ORC_RESTRICT ptr4;
162 ptr0 = (orc_union32 *)ex->arrays[0];
163 ptr4 = (orc_union32 *)ex->arrays[4];
166 var33.i = ex->params[24];
168 for (i = 0; i < n; i++) {
176 _src1.i = ORC_DENORMAL(var33.i);
177 _src2.i = ORC_DENORMAL(var34.i);
178 _dest1.f = _src1.f * _src2.f;
179 var37.i = ORC_DENORMAL(_dest1.i);
188 _src1.i = ORC_DENORMAL(var35.i);
189 _src2.i = ORC_DENORMAL(var37.i);
190 _dest1.f = _src1.f + _src2.f;
191 var36.i = ORC_DENORMAL(_dest1.i);
200 update_tap_weights (float * d1, const float * s1, float p1, int n)
202 OrcExecutor _ex, *ex = &_ex;
203 static int p_inited = 0;
204 static OrcProgram *p = 0;
205 void (*func) (OrcExecutor *);
208 orc_once_mutex_lock ();
210 OrcCompileResult result;
212 p = orc_program_new ();
213 orc_program_set_name (p, "update_tap_weights");
214 orc_program_set_backup_function (p, _backup_update_tap_weights);
215 orc_program_add_destination (p, 4, "d1");
216 orc_program_add_source (p, 4, "s1");
217 orc_program_add_constant (p, 0, 0x00000000, "c1");
218 orc_program_add_constant (p, 0, 0x00000000, "c2");
219 orc_program_add_constant (p, 0, 0x00000000, "c3");
220 orc_program_add_constant (p, 0, 0x00000000, "c4");
221 orc_program_add_constant (p, 0, 0x00000000, "c5");
222 orc_program_add_constant (p, 0, 0x00000000, "c6");
223 orc_program_add_constant (p, 0, 0x00000000, "c7");
224 orc_program_add_constant (p, 0, 0x00000000, "c8");
225 orc_program_add_parameter_float (p, 4, "p1");
226 orc_program_add_temporary (p, 4, "t1");
228 orc_program_append_2 (p, "mulf", 0, ORC_VAR_T1, ORC_VAR_P1, ORC_VAR_S1, ORC_VAR_D1);
229 orc_program_append_2 (p, "addf", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1);
231 result = orc_program_compile (p);
234 orc_once_mutex_unlock ();
239 ex->arrays[ORC_VAR_D1] = d1;
240 ex->arrays[ORC_VAR_S1] = (void *)s1;
244 ex->params[ORC_VAR_P1] = tmp.i;