45 #define TEST_LENGTH_SAMPLES 320 46 #define MAX_BLOCKSIZE 320 47 #define MAX_NUMTAPS 100 49 #define TEST_COUNT 5000 67 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 70 #ifdef PERFORMANCE_TEST 82 -0.954402, -0.250769, 0.265646, 0.605696, 1.809474, -1.971027, -0.923924, -4.488990,
91 -0.065427, 0.109759, 0.235029, 0.246238, 0.164377, 0.061674, 0.017830
99 -0.741096, -0.137409, -0.328637, -0.562875, -0.325412, -0.576636, -0.131379, -0.274755,
100 -0.558034, -1.856812, 1.793911, 0.782613, -0.577362, 2.154587, 1.501139, -0.361869,
101 1.423258, 0.737657, -0.757648, -2.062143, 1.221977, 6.311065, -1.170156, 0.328045,
102 0.580640, 0.835362, -0.864583, -6.735667, 0.471679, -1.376339, 1.530487
110 4.146424, -1.367689, -1.247910, 1.186711, 2.587415, -0.442874, -0.400162, -1.183718,
111 -2.242936, 2.275107, 1.522946, -1.355056, 1.683295, 1.283139
121 -0.432565, -1.665584, 0.125332, 0.287676, -1.146471, 1.190915, 1.189164, -0.037633,
122 0.327292, 0.174639, -0.186709, 0.725791, -0.588317, 2.183186, -0.136396, 0.113931,
123 1.066768, 0.059281, -0.095648, -0.832349, 0.294411, -1.336182, 0.714325, 1.623562,
124 -0.691776, 0.857997, 1.254001, -1.593730, -1.440964, 0.571148, -0.399886, 0.689997,
125 0.815622, 0.711908, 1.290250, 0.668601, 1.190838, -1.202457, -0.019790, -0.156717,
126 -1.604086, 0.257304, -1.056473, 1.415141, -0.805090, 0.528743, 0.219321, -0.921902,
127 -2.170674, -0.059188, -1.010634, 0.614463, 0.507741, 1.692430, 0.591283, -0.643595,
128 0.380337, -1.009116, -0.019511, -0.048221, 0.000043, -0.317859, 1.095004, -1.873990,
129 0.428183, 0.895638, 0.730957, 0.577857, 0.040314, 0.677089, 0.568900, -0.255645,
130 -0.377469, -0.295887, -1.475135, -0.234004, 0.118445, 0.314809, 1.443508, -0.350975,
131 0.623234, 0.799049, 0.940890, -0.992092, 0.212035, 0.237882, -1.007763, -0.742045,
132 1.082295, -0.131500, 0.389880, 0.087987, -0.635465, -0.559573, 0.443653, -0.949904,
133 0.781182, 0.568961, -0.821714, -0.265607, -1.187777, -2.202321, 0.986337, -0.518635,
134 0.327368, 0.234057, 0.021466, -1.003944, -0.947146, -0.374429, -1.185886, -1.055903,
135 1.472480, 0.055744, -1.217317, -0.041227, -1.128344, -1.349278, -0.261102, 0.953465,
136 0.128644, 0.656468, -1.167819, -0.460605, -0.262440, -1.213152, -1.319437, 0.931218,
137 0.011245, -0.645146, 0.805729, 0.231626, -0.989760, 1.339586, 0.289502, 1.478917,
138 1.138028, -0.684139, -1.291936, -0.072926, -0.330599, -0.843628, 0.497770, 1.488490,
139 -0.546476, -0.846758, -0.246337, 0.663024, -0.854197, -1.201315, -0.119869, -0.065294,
140 0.485296, -0.595491, -0.149668, -0.434752, -0.079330, 1.535152, -0.606483, -1.347363,
141 0.469383, -0.903567, 0.035880, -0.627531, 0.535398, 0.552884, -0.203690, -2.054325,
142 0.132561, 1.592941, 1.018412, -1.580402, -0.078662, -0.681657, -1.024553, -1.234353,
143 0.288807, -0.429303, 0.055801, -0.367874, -0.464973, 0.370961, 0.728283, 2.112160,
144 -1.357298, -1.022610, 1.037834, -0.389800, -1.381266, 0.315543, 1.553243, 0.707894,
145 1.957385, 0.504542, 1.864529, -0.339812, -1.139779, -0.211123, 1.190245, -1.116209,
146 0.635274, -0.601412, 0.551185, -1.099840, 0.085991, -2.004563, -0.493088, 0.462048,
147 -0.321005, 1.236556, -0.631280, -2.325211, -1.231637, 1.055648, -0.113224, 0.379224,
148 0.944200, -2.120427, -0.644679, -0.704302, -1.018137, -0.182082, 1.521013, -0.038439,
149 1.227448, -0.696205, 0.007524, -0.782893, 0.586939, -0.251207, 0.480136, 0.668155,
150 -0.078321, 0.889173, 2.309287, 0.524639, -0.011787, 0.913141, 0.055941, -1.107070,
151 0.485498, -0.005005, -0.276218, 1.276452, 1.863401, -0.522559, 0.103424, -0.807649,
152 0.680439, -2.364590, 0.990115, 0.218899, 0.261662, 1.213444, -0.274667, -0.133134,
153 -1.270500, -1.663606, -0.703554, 0.280880, -0.541209, -1.333531, 1.072686, -0.712085,
154 -0.011286, -0.000817, -0.249436, 0.396575, -0.264013, -1.664011, -1.028975, 0.243095,
155 -1.256590, -0.347183, -0.941372, -1.174560, -1.021142, -0.401667, 0.173666, -0.116118,
156 1.064119, -0.245386, -1.517539, 0.009734, 0.071373, 0.316536, 0.499826, 1.278084,
157 -0.547816, 0.260808, -0.013177, -0.580264, 2.136308, -0.257617, -1.409528, 1.770101,
158 0.325546, -1.119040, 0.620350, 1.269782, -0.896043, 0.135175, -0.139040, -1.163395,
159 1.183720, -0.015430, 0.536219, -0.716429, -0.655559, 0.314363, 0.106814, 1.848216,
160 -0.275106, 2.212554, 1.508526, -1.945079, -1.680543, -0.573534, -0.185817, 0.008934
177 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 178 static test_config CONFIG[] =
180 {2, 31, 160, &testCoeffs31_f32[0], &testInput_f32[0]},
181 {32, 9, 10, &testCoeffs9_f32[0], &testInput_f32[0]},
182 {5, 31, 64, &testCoeffs31_f32[0], &testInput_f32[0]},
183 {32, 9, 10, &testCoeffs9_f32[0], &testInput_f32[0]},
184 {5, 31, 64, &testCoeffs31_f32[0], &testInput_f32[0]},
185 {32, 14, 10, &testCoeffs14_f32[0], &testInput_f32[0]},
186 {32, 31, 10, &testCoeffs31_f32[0], &testInput_f32[0]},
187 {2, 1, 160, &testCoeffs31_f32[0], &testInput_f32[0]},
188 {32, 1, 10, &testCoeffs31_f32[0], &testInput_f32[0]},
189 {32, 7, 10, &testCoeffs7_f32[0], &testInput_f32[0]},
190 {64, 7, 5, &testCoeffs7_f32[0], &testInput_f32[0]},
191 {64, 9, 5, &testCoeffs9_f32[0], &testInput_f32[0]},
192 {64, 3, 5, &testCoeffs31_f32[0], &testInput_f32[0]},
193 {64, 1, 5, &testCoeffs31_f32[0], &testInput_f32[0]},
195 #define NUM_TESTS (sizeof(CONFIG) / sizeof(CONFIG[0]) ) 197 #ifdef PERFORMANCE_TEST 198 static test_config CONFIG_PERF[] =
200 {32, 3, 10, &testCoeffs31_f32[0], &testInput_f32[0]},
201 {32, 1, 10, &testCoeffs31_f32[0], &testInput_f32[0]},
202 {64, 3, 5, &testCoeffs31_f32[0], &testInput_f32[0]},
203 {64, 1, 5, &testCoeffs31_f32[0], &testInput_f32[0]},
205 #define NUM_PERF_TESTS (sizeof(CONFIG_PERF) / sizeof(CONFIG_PERF[0]) ) 209 void test_fir_lattice_case0()
221 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
235 #ifdef ENABLE_NE10_FIR_LATTICE_FLOAT_NEON 236 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 238 for (loop = 0; loop < NUM_TESTS; loop++)
240 config = &CONFIG[loop];
248 fprintf (stdout,
"initialization error\n");
253 in_c[i] = testInput_f32[i];
254 in_neon[i] = testInput_f32[i];
257 GUARD_ARRAY (out_c, TEST_LENGTH_SAMPLES);
258 GUARD_ARRAY (out_neon, TEST_LENGTH_SAMPLES);
260 for (block = 0; block < config->numFrames; block++)
262 ne10_fir_lattice_float_c (&SC, in_c + (block * config->blockSize), out_c + (block * config->blockSize), config->blockSize);
264 for (block = 0; block < config->numFrames; block++)
266 ne10_fir_lattice_float_neon (&SN, in_neon + (block * config->blockSize), out_neon + (block * config->blockSize), config->blockSize);
269 assert_true (CHECK_ARRAY_GUARD (out_c, TEST_LENGTH_SAMPLES));
270 assert_true (CHECK_ARRAY_GUARD (out_neon, TEST_LENGTH_SAMPLES));
273 snr = CAL_SNR_FLOAT32 (out_c, out_neon, TEST_LENGTH_SAMPLES);
274 assert_false ( (snr < SNR_THRESHOLD));
277 #if defined (DEBUG_TRACE) 278 printf (
"--------------------config %d\n", loop);
279 printf (
"snr %f\n", snr);
283 #if defined (DEBUG_TRACE) 284 printf (
"pos %d \n", pos);
285 printf (
"c %f (0x%04X) neon %f (0x%04X)\n", out_c[pos], * (
ne10_uint32_t*) &out_c[pos], out_neon[pos], * (
ne10_uint32_t*) &out_neon[pos]);
287 assert_float_vec_equal (&out_c[pos], &out_neon[pos], ERROR_MARGIN_SMALL, 1);
292 #endif // ENABLE_NE10_FIR_LATTICE_FLOAT_NEON 294 #ifdef PERFORMANCE_TEST 296 fprintf (stdout,
"%25s%20s%20s%20s%20s\n",
"FIR Length&Taps",
"C Time (micro-s)",
"NEON Time (micro-s)",
"Time Savings",
"Performance Ratio");
297 for (loop = 0; loop < NUM_PERF_TESTS; loop++)
299 config = &CONFIG_PERF[loop];
307 fprintf (stdout,
"initialization error\n");
313 in_c[i] = testInput_f32[i];
314 in_neon[i] = testInput_f32[i];
323 for (block = 0; block < config->numFrames; block++)
325 ne10_fir_lattice_float_c (&SC, in_c + (block * config->blockSize), out_c + (block * config->blockSize), config->blockSize);
331 #ifdef ENABLE_NE10_FIR_LATTICE_FLOAT_NEON 338 for (block = 0; block < config->numFrames; block++)
340 ne10_fir_lattice_float_neon (&SN, in_neon + (block * config->blockSize), out_neon + (block * config->blockSize), config->blockSize);
345 #endif // ENABLE_NE10_FIR_LATTICE_FLOAT_NEON 348 time_savings = ( ( (
ne10_float32_t) (time_c - time_neon)) / time_c) * 100;
349 ne10_log (__FUNCTION__,
"%20d,%4d%20lld%20lld%19.2f%%%18.2f:1\n", config->numTaps, time_c, time_neon, time_savings, time_speedup);
354 free (guarded_in_neon);
355 free (guarded_out_c);
356 free (guarded_out_neon);
357 free (guarded_fir_state_c);
358 free (guarded_fir_state_neon);
359 fprintf (stdout,
"----------%30s end\n", __FUNCTION__);
362 void test_fir_lattice()
364 test_fir_lattice_case0();
369 ne10_log_buffer_ptr = ne10_log_buffer;
372 void test_fixture_fir_lattice (
void)
374 test_fixture_start();
378 run_test (test_fir_lattice);
ne10_result_t ne10_fir_lattice_init_float(ne10_fir_lattice_instance_f32_t *S, ne10_uint16_t numStages, ne10_float32_t *pCoeffs, ne10_float32_t *pState)
Initialization function for the floating-point FIR lattice filter.
void ne10_fir_lattice_float_neon(const ne10_fir_lattice_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize) asm("ne10_fir_lattice_float_neon")
Specific implementation of ne10_fir_lattice_float using NEON SIMD capabilities.
#define TEST_LENGTH_SAMPLES
Instance structure for the floating point FIR Lattice filter.
void ne10_fir_lattice_float_c(const ne10_fir_lattice_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize)
Specific implementation of ne10_fir_lattice_float using plain C.