Beispiel #1
0
static void dsp_calculate_fft(dsp16_t *fft, dsp16_t *signal)
{
	int i;
	dsp16_t max_value;
	dsp16_t temp[BUFFER_LENGTH];
	dsp16_complex_t temp_res[BUFFER_LENGTH];

	dsp16_vect_dotmul(temp, signal, fft_window, BUFFER_LENGTH);
	dsp16_trans_realcomplexfft(temp_res, temp, BUFFER_LENGTH_LOG);
	dsp16_vect_complex_abs(fft, temp_res, BUFFER_LENGTH);

	for (i = 0; i < FFT_LENGTH; i++)
		fft[i] += fft[BUFFER_LENGTH - i - 1];

	max_value = dsp16_vect_max(fft, FFT_LENGTH);
	dsp16_vect_realdiv(fft, fft, FFT_LENGTH, max_value + 1);
}
int maximum(int *size)
{
  int cycle_count;

  // Conditions
  CHECK_CONDITIONS(VECT1_SIZE > 0)
  CHECK_CONDITIONS(VECT2_SIZE > 0)

  // Action
  dsp16_debug_printf("max(vect2)\n");

  *size = 1;

  cycle_count = Get_sys_count();
  vect1[0] = dsp16_vect_max(vect2, VECT2_SIZE);

  return Get_sys_count() - cycle_count;
}