00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00083 #include "arm_math.h"
00084 #include "math_helper.h"
00085
00086
00087
00088
00089 #define MAX_BLOCKSIZE 128
00090 #define DELTA (0.000001f)
00091 #define SNR_THRESHOLD 90
00092
00093
00094
00095
00096 float32_t Ak[MAX_BLOCKSIZE];
00097 float32_t Bk[MAX_BLOCKSIZE];
00098 float32_t AxB[MAX_BLOCKSIZE * 2];
00099
00100
00101
00102
00103
00104 float32_t testInputA_f32[64] =
00105 {
00106 -0.808920, 1.357369, 1.180861, -0.504544, 1.762637, -0.703285,
00107 1.696966, 0.620571, -0.151093, -0.100235, -0.872382, -0.403579,
00108 -0.860749, -0.382648, -1.052338, 0.128113, -0.646269, 1.093377,
00109 -2.209198, 0.471706, 0.408901, 1.266242, 0.598252, 1.176827,
00110 -0.203421, 0.213596, -0.851964, -0.466958, 0.021841, -0.698938,
00111 -0.604107, 0.461778, -0.318219, 0.942520, 0.577585, 0.417619,
00112 0.614665, 0.563679, -1.295073, -0.764437, 0.952194, -0.859222,
00113 -0.618554, -2.268542, -1.210592, 1.655853, -2.627219, -0.994249,
00114 -1.374704, 0.343799, 0.025619, 1.227481, -0.708031, 0.069355,
00115 -1.845228, -1.570886, 1.010668, -1.802084, 1.630088, 1.286090,
00116 -0.161050, -0.940794, 0.367961, 0.291907
00117
00118 };
00119
00120 float32_t testInputB_f32[64] =
00121 {
00122 0.933724, 0.046881, 1.316470, 0.438345, 0.332682, 2.094885,
00123 0.512081, 0.035546, 0.050894, -2.320371, 0.168711, -1.830493,
00124 -0.444834, -1.003242, -0.531494, -1.365600, -0.155420, -0.757692,
00125 -0.431880, -0.380021, 0.096243, -0.695835, 0.558850, -1.648962,
00126 0.020369, -0.363630, 0.887146, 0.845503, -0.252864, -0.330397,
00127 1.269131, -1.109295, -1.027876, 0.135940, 0.116721, -0.293399,
00128 -1.349799, 0.166078, -0.802201, 0.369367, -0.964568, -2.266011,
00129 0.465178, 0.651222, -0.325426, 0.320245, -0.784178, -0.579456,
00130 0.093374, 0.604778, -0.048225, 0.376297, -0.394412, 0.578182,
00131 -1.218141, -1.387326, 0.692462, -0.631297, 0.153137, -0.638952,
00132 0.635474, -0.970468, 1.334057, -0.111370
00133 };
00134
00135 const float testRefOutput_f32[126] =
00136 {
00137 -0.818943, 1.229484, -0.533664, 1.016604, 0.341875, -1.963656,
00138 5.171476, 3.478033, 7.616361, 6.648384, 0.479069, 1.792012,
00139 -1.295591, -7.447818, 0.315830, -10.657445, -2.483469, -6.524236,
00140 -7.380591, -3.739005, -8.388957, 0.184147, -1.554888, 3.786508,
00141 -1.684421, 5.400610, -1.578126, 7.403361, 8.315999, 2.080267,
00142 11.077776, 2.749673, 7.138962, 2.748762, 0.660363, 0.981552,
00143 1.442275, 0.552721, -2.576892, 4.703989, 0.989156, 8.759344,
00144 -0.564825, -3.994680, 0.954710, -5.014144, 6.592329, 1.599488,
00145 -13.979146, -0.391891, -4.453369, -2.311242, -2.948764, 1.761415,
00146 -0.138322, 10.433007, -2.309103, 4.297153, 8.535523, 3.209462,
00147 8.695819, 5.569919, 2.514304, 5.582029, 2.060199, 0.642280,
00148 7.024616, 1.686615, -6.481756, 1.343084, -3.526451, 1.099073,
00149 -2.965764, -0.173723, -4.111484, 6.528384, -6.965658, 1.726291,
00150 1.535172, 11.023435, 2.338401, -4.690188, 1.298210, 3.943885,
00151 8.407885, 5.168365, 0.684131, 1.559181, 1.859998, 2.852417,
00152 8.574070, -6.369078, 6.023458, 11.837963, -6.027632, 4.469678,
00153 -6.799093, -2.674048, 6.250367, -6.809971, -3.459360, 9.112410,
00154 -2.711621, -1.336678, 1.564249, -1.564297, -1.296760, 8.904013,
00155 -3.230109, 6.878013, -7.819823, 3.369909, -1.657410, -2.007358,
00156 -4.112825, 1.370685, -3.420525, -6.276605, 3.244873, -3.352638,
00157 1.545372, 0.902211, 0.197489, -1.408732, 0.523390, 0.348440
00158 };
00159
00160
00161
00162
00163
00164 uint32_t srcALen = 64;
00165 uint32_t srcBLen = 64;
00166 uint32_t outLen;
00167 float32_t snr;
00168
00169 int32_t main(void)
00170 {
00171 arm_status status;
00172 arm_cfft_radix4_instance_f32 cfft_instance;
00173
00174
00175 arm_cfft_radix4_instance_f32 *cfft_instance_ptr =
00176 (arm_cfft_radix4_instance_f32*) &cfft_instance;
00177
00178
00179 outLen = srcALen + srcBLen - 1;
00180
00181
00182 arm_fill_f32(0.0, Ak, MAX_BLOCKSIZE);
00183 arm_fill_f32(0.0, Bk, MAX_BLOCKSIZE);
00184
00185
00186 arm_copy_f32(testInputA_f32, Ak, MAX_BLOCKSIZE/2);
00187 arm_copy_f32(testInputB_f32, Bk, MAX_BLOCKSIZE/2);
00188
00189
00190 status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 64, 0, 1);
00191
00192
00193 arm_cfft_radix4_f32(cfft_instance_ptr, Ak);
00194
00195 arm_cfft_radix4_f32(cfft_instance_ptr, Bk);
00196
00197
00198 arm_cmplx_mult_cmplx_f32(Ak, Bk, AxB, MAX_BLOCKSIZE/2);
00199
00200
00201 status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 64, 1, 1);
00202
00203
00204
00205 arm_cfft_radix4_f32(cfft_instance_ptr, AxB);
00206
00207
00208 snr = arm_snr_f32((float32_t *)testRefOutput_f32, AxB, srcALen + srcBLen - 1);
00209
00210
00211
00212 if( snr > SNR_THRESHOLD)
00213 {
00214 status = ARM_MATH_SUCCESS;
00215 }
00216
00217 if( status != ARM_MATH_SUCCESS)
00218 {
00219 while(1);
00220 }
00221 }
00222