rusefi/firmware/controllers/sensors/impl/fft/fft.h

34 lines
962 B
C
Raw Normal View History

2024-05-04 03:27:32 -07:00
#pragma once
2024-10-20 19:11:57 -07:00
#include "pch.h"
2024-05-04 03:27:32 -07:00
#include <cstddef>
#include <math.h>
#include <vector>
#include <complex>
#include "biquad.h"
2024-05-04 03:27:32 -07:00
2024-10-20 19:35:55 -07:00
#if EFI_UNIT_TEST
typedef uint16_t adcsample_t;
#endif
2024-05-04 03:27:32 -07:00
namespace fft {
typedef float real_type;
typedef std::complex<real_type> complex_type;
bool fft_adc_sample(float * w, float ratio, float sensitivity, const adcsample_t* data_in, complex_type* data_out, const size_t size);
bool fft_adc_sample_filtered(Biquad& knockFilter, float * w, float ratio, float sensitivity, const adcsample_t* data_in, complex_type* data_out, const size_t size);
2024-05-04 03:27:32 -07:00
bool fft(const real_type* data_in, complex_type* data_out, const size_t size);
void rectwin(float * w, unsigned n);
void hann(float * w, unsigned n, bool sflag);
void hamming(float * w, unsigned n, bool sflag);
void blackman(float * w, unsigned n, bool sflag);
void blackmanharris(float * w, unsigned n, bool sflag);
float fast_sqrt(float x);
float amplitude(const complex_type& fft);
2024-05-04 03:27:32 -07:00
2024-10-20 19:35:55 -07:00
}
2024-05-04 03:27:32 -07:00