45 #define TEST_LENGTH_SAMPLES 480 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 83 0.068186, 0.064344, -0.162450, 0.057015, 0.029743, 0.010066, 0.047792, 0.021273,
84 -0.096447, -0.211652, -0.086613, 0.057501, -0.187605, -0.167199, -0.026983, -0.025464,
85 -0.061495, 0.110914, -0.081973, -0.055231, -0.074430, -0.196536, 0.016845, -0.096493,
86 0.039625, -0.110273, -0.042966, -0.043804, 0.087350, -0.085191, 0.009420, 0.086440
95 0.039625, -0.110273, -0.042966, -0.043804, 0.087350, -0.085191, 0.009420, 0.086440
109 0.010066, 0.047792, 0.021273, -0.096447, -0.211652, -0.086613, 0.057501, -0.187605,
110 -0.167199, -0.026983, -0.025464, -0.061495, 0.110914, -0.081973, -0.055231, -0.074430,
111 -0.196536, 0.016845, -0.096493, 0.039625, -0.110273, -0.042966, -0.043804, 0.087350,
112 -0.085191, 0.009420, 0.086440
117 -0.042966, -0.043804, 0.087350, -0.085191, 0.009420, 0.086440
127 -0.432565, -1.665584, 0.125332, 0.287676, -1.146471, 1.190915, 1.189164, -0.037633,
128 0.327292, 0.174639, -0.186709, 0.725791, -0.588317, 2.183186, -0.136396, 0.113931,
129 1.066768, 0.059281, -0.095648, -0.832349, 0.294411, -1.336182, 0.714325, 1.623562,
130 -0.691776, 0.857997, 1.254001, -1.593730, -1.440964, 0.571148, -0.399886, 0.689997,
131 0.815622, 0.711908, 1.290250, 0.668601, 1.190838, -1.202457, -0.019790, -0.156717,
132 -1.604086, 0.257304, -1.056473, 1.415141, -0.805090, 0.528743, 0.219321, -0.921902,
133 -2.170674, -0.059188, -1.010634, 0.614463, 0.507741, 1.692430, 0.591283, -0.643595,
134 0.380337, -1.009116, -0.019511, -0.048221, 0.000043, -0.317859, 1.095004, -1.873990,
135 0.428183, 0.895638, 0.730957, 0.577857, 0.040314, 0.677089, 0.568900, -0.255645,
136 -0.377469, -0.295887, -1.475135, -0.234004, 0.118445, 0.314809, 1.443508, -0.350975
153 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 154 static test_config CONFIG[] = {{0, 1, 1, 10, &testCoeffs6_f32[0], &testInput_f32[0]},
155 {8, 6, 6, 10, &testCoeffs6_f32[0], &testInput_f32[0]},
156 {8, 8, 2, 10, &testCoeffs8_f32[0], &testInput_f32[0]},
157 {8, 27, 4, 10, &testCoeffs27_f32[0], &testInput_f32[0]},
158 {8, 32, 4, 10, &testCoeffs32_f32[0], &testInput_f32[0]},
159 {80, 6, 6, 1, &testCoeffs6_f32[0], &testInput_f32[0]},
160 {80, 8, 2, 1, &testCoeffs8_f32[0], &testInput_f32[0]},
161 {80, 27, 4, 1, &testCoeffs27_f32[0], &testInput_f32[0]},
162 {80, 32, 4, 1, &testCoeffs32_f32[0], &testInput_f32[0]}
164 #define NUM_TESTS (sizeof(CONFIG) / sizeof(CONFIG[0]) ) 166 #ifdef PERFORMANCE_TEST 167 static test_config CONFIG_PERF[] =
169 {8, 27, 3, 10, &testCoeffs27_f32[0], &testInput_f32[0]},
170 {8, 32, 4, 10, &testCoeffs32_f32[0], &testInput_f32[0]},
171 {80, 27, 3, 1, &testCoeffs27_f32[0], &testInput_f32[0]},
172 {80, 32, 4, 1, &testCoeffs32_f32[0], &testInput_f32[0]}
174 #define NUM_PERF_TESTS (sizeof(CONFIG_PERF) / sizeof(CONFIG_PERF[0]) ) 178 void test_fir_interpolate_case0()
191 fprintf (stdout,
"----------%30s start\n", __FUNCTION__);
205 #ifdef ENABLE_NE10_FIR_INTERPOLATE_FLOAT_NEON 206 #if defined (SMOKE_TEST)||(REGRESSION_TEST) 208 for (loop = 0; loop < NUM_TESTS; loop++)
210 config = &CONFIG[loop];
211 length = config->numFrames * config->blockSize * config->D;
219 if (config->numTaps == 27)
221 fprintf (stdout,
"length of input data is wrong!\n");
226 fprintf (stdout,
"initialization error\n");
230 for (i = 0; i < 80; i++)
232 in_c[i] = testInput_f32[i];
233 in_neon[i] = testInput_f32[i];
239 for (block = 0; block < config->numFrames; block++)
241 ne10_fir_interpolate_float_c (&SC, in_c + (block * config->blockSize), out_c + (block * config->blockSize * config->D), config->blockSize);
243 for (block = 0; block < config->numFrames; block++)
252 snr = CAL_SNR_FLOAT32 (out_c, out_neon, length);
253 assert_false ( (snr < SNR_THRESHOLD));
256 #if defined (DEBUG_TRACE) 257 printf (
"--------------------config %d\n", loop);
258 printf (
"snr %f\n", snr);
260 for (pos = 0; pos < length; pos++)
262 #if defined (DEBUG_TRACE) 263 printf (
"pos %d \n", pos);
264 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]);
266 assert_float_vec_equal (&out_c[pos], &out_neon[pos], ERROR_MARGIN_SMALL, 1);
271 #endif // ENABLE_NE10_FIR_INTERPOLATE_FLOAT_NEON 273 #ifdef PERFORMANCE_TEST 275 fprintf (stdout,
"%25s%20s%20s%20s%20s\n",
"FIR Length&Taps",
"C Time (micro-s)",
"NEON Time (micro-s)",
"Time Savings",
"Performance Ratio");
276 for (loop = 0; loop < NUM_PERF_TESTS; loop++)
278 config = &CONFIG_PERF[loop];
279 length = config->numFrames * config->blockSize * config->D;
287 if (config->numTaps == 27)
289 fprintf (stdout,
"length of input data is wrong!\n");
294 fprintf (stdout,
"initialization error\n");
299 for (i = 0; i < 80; i++)
301 in_c[i] = testInput_f32[i];
302 in_neon[i] = testInput_f32[i];
311 for (block = 0; block < config->numFrames; block++)
313 ne10_fir_interpolate_float_c (&SC, in_c + (block * config->blockSize), out_c + (block * config->blockSize * config->D), config->blockSize);
318 #ifdef ENABLE_NE10_FIR_INTERPOLATE_FLOAT_NEON 325 for (block = 0; block < config->numFrames; block++)
332 #endif // ENABLE_NE10_FIR_INTERPOLATE_FLOAT_NEON 335 time_savings = ( ( (
ne10_float32_t) (time_c - time_neon)) / time_c) * 100;
336 ne10_log (__FUNCTION__,
"%20d,%4d%20lld%20lld%19.2f%%%18.2f:1\n", config->numTaps, time_c, time_neon, time_savings, time_speedup);
341 free (guarded_in_neon);
342 free (guarded_out_c);
343 free (guarded_out_neon);
344 free (guarded_fir_state_c);
345 free (guarded_fir_state_neon);
346 fprintf (stdout,
"----------%30s end\n", __FUNCTION__);
349 void test_fir_interpolate()
351 test_fir_interpolate_case0();
356 ne10_log_buffer_ptr = ne10_log_buffer;
359 void test_fixture_fir_interpolate (
void)
361 test_fixture_start();
365 run_test (test_fir_interpolate);
#define TEST_LENGTH_SAMPLES
ne10_result_t ne10_fir_interpolate_init_float(ne10_fir_interpolate_instance_f32_t *S, ne10_uint8_t L, ne10_uint16_t numTaps, ne10_float32_t *pCoeffs, ne10_float32_t *pState, ne10_uint32_t blockSize)
Initialization function for the floating-point FIR interpolator.
void ne10_fir_interpolate_float_neon(const ne10_fir_interpolate_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize) asm("ne10_fir_interpolate_float_neon")
Specific implementation of ne10_fir_interpolate_float using NEON SIMD capabilities.
Instance structure for the floating-point FIR Interpolation.
void ne10_fir_interpolate_float_c(const ne10_fir_interpolate_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize)
Specific implementation of ne10_fir_interpolate_float using plain C.