Пример #1
0
int32_t splot_buff_2(void)
{
	arm_status status;                           /* Status of the example */
	arm_cfft_radix4_instance_f32 cfft_instance;  /* CFFT Structure instance */
	/* CFFT Structure instance pointer */
	arm_cfft_radix4_instance_f32 *cfft_instance_ptr =
		      (arm_cfft_radix4_instance_f32*) &cfft_instance;
    /* Initialise the fft input buffers with all zeros */
	arm_fill_f32(0.0,  buff_wej_dodatkowy_1, ile_probek);
	arm_fill_f32(0.0,  buff_wej_dodatkowy_2, ile_probek);
	/* Copy the input values to the fft input buffers */
	arm_copy_f32(ADC3ConvertedValue1,  buff_wej_dodatkowy_1, ile_probek);
	arm_copy_f32(buff_odp_imp_filtr,  buff_wej_dodatkowy_2, ile_probek);
	/* Initialize the CFFT function to compute 64 point fft */
	status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 64, 0, 1);
	/* Transform input a[n] from time domain to frequency domain A[k] */
	arm_cfft_radix4_f32(cfft_instance_ptr, buff_wej_dodatkowy_1);
	/* Transform input b[n] from time domain to frequency domain B[k] */
	arm_cfft_radix4_f32(cfft_instance_ptr, buff_wej_dodatkowy_2);
	/* Complex Multiplication of the two input buffers in frequency domain */
	arm_cmplx_mult_cmplx_f32(buff_wej_dodatkowy_1, buff_wej_dodatkowy_2, buff_wyj1, ile_probek);
	/* Initialize the CIFFT function to compute 64 point ifft */
	status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 64, 1, 1);
	/* Transform the multiplication output from frequency domain to time domain,
		     that gives the convolved output  */
	arm_cfft_radix4_f32(cfft_instance_ptr, buff_wyj1);

	status = ARM_MATH_SUCCESS;
}
int32_t main(void)
{
  arm_status status;                           /* Status of the example */
  arm_cfft_radix4_instance_f32 cfft_instance;  /* CFFT Structure instance */

  /* CFFT Structure instance pointer */
  arm_cfft_radix4_instance_f32 *cfft_instance_ptr =
      (arm_cfft_radix4_instance_f32*) &cfft_instance;

  /* output length of convolution */
  outLen = srcALen + srcBLen - 1;

  /* Initialise the fft input buffers with all zeros */
  arm_fill_f32(0.0,  Ak, MAX_BLOCKSIZE);
  arm_fill_f32(0.0,  Bk, MAX_BLOCKSIZE);

  /* Copy the input values to the fft input buffers */
  arm_copy_f32(testInputA_f32,  Ak, MAX_BLOCKSIZE/2);
  arm_copy_f32(testInputB_f32,  Bk, MAX_BLOCKSIZE/2);

  /* Initialize the CFFT function to compute 64 point fft */
  status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 64, 0, 1);

  /* Transform input a[n] from time domain to frequency domain A[k] */
  arm_cfft_radix4_f32(cfft_instance_ptr, Ak);
  /* Transform input b[n] from time domain to frequency domain B[k] */
  arm_cfft_radix4_f32(cfft_instance_ptr, Bk);

  /* Complex Multiplication of the two input buffers in frequency domain */
  arm_cmplx_mult_cmplx_f32(Ak, Bk, AxB, MAX_BLOCKSIZE/2);

  /* Initialize the CIFFT function to compute 64 point ifft */
  status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 64, 1, 1);

  /* Transform the multiplication output from frequency domain to time domain,
     that gives the convolved output  */
  arm_cfft_radix4_f32(cfft_instance_ptr, AxB);

  /* SNR Calculation */
  snr = arm_snr_f32((float32_t *)testRefOutput_f32, AxB, srcALen + srcBLen - 1);

  /* Compare the SNR with threshold to test whether the
     computed output is matched with the reference output values. */
  if( snr > SNR_THRESHOLD)
  {
    status = ARM_MATH_SUCCESS;
  }

  if( status != ARM_MATH_SUCCESS)
  {
    while(1);
  }

  while(1);                             /* main function does not return */
}
Пример #3
0
void ComplexFloatArray::complexByComplexMultiplication(ComplexFloatArray& operand2, ComplexFloatArray& result){
  int minSize=min(size,operand2.getSize()); //TODO: shall we take this out and allow it to segfault?
#ifdef ARM_CORTEX
  arm_cmplx_mult_cmplx_f32 ( (float*)data, (float*)operand2, (float*)result, minSize );  
#else
  float *pSrcA=(float*)data;
  float *pSrcB=(float*)operand2;
  float *pDst=(float*)result;
  for(int n=0; n<minSize; n++) {        
    pDst[(2*n)+0] = pSrcA[(2*n)+0] * pSrcB[(2*n)+0] - pSrcA[(2*n)+1] * pSrcB[(2*n)+1];        
    pDst[(2*n)+1] = pSrcA[(2*n)+0] * pSrcB[(2*n)+1] + pSrcA[(2*n)+1] * pSrcB[(2*n)+0];        
  }        
#endif  
}