/* * Scale FFT data by 1/|length|. |length| must be a power of two */ static inline ScaleRFFTData(OMX_F32* fftData, unsigned length) { float32_t* data = (float32_t*)fftData; float32_t scale = 2.0f / length; if (length >= 4) { /* * Do 4 float elements at a time because |length| is always a * multiple of 4 when |length| >= 4. * * TODO(rtoy): Figure out how to process 8 elements at a time * using intrinsics or replace this with inline assembly. */ do { float32x4_t x = vld1q_f32(data); length -= 4; x = vmulq_n_f32(x, scale); vst1q_f32(data, x); data += 4; } while (length > 0); } else if (length == 2) { float32x2_t x = vld1_f32(data); x = vmul_n_f32(x, scale); vst1_f32(data, x); } else { fftData[0] *= scale; } }
void test_vmul_nf32 (void) { float32x2_t out_float32x2_t; float32x2_t arg0_float32x2_t; float32_t arg1_float32_t; out_float32x2_t = vmul_n_f32 (arg0_float32x2_t, arg1_float32_t); }