1

현재 사용자의 손가락이 빨갛게 나오는 것과 관련하여 데이터가 상당히 잡음이 많으므로 FFT를 실행하여 잡음을 줄이고 싶습니다. this image의 왼쪽에있는 데이터는 현재 내 데이터와 비슷합니다. vDSP에 관한 Apple 설명서를 숙지했지만 Apple vDSP 및 Accelerate 프레임 워크를 사용하여 Fast Fourier Transform을 구현하는 방법에 대한 명확하고 간결한 안내서가없는 것 같습니다. 어떻게해야합니까?vDSP를 사용하여 FFT 구현

나는 비슷한 주제의 this question을 이미 언급했지만 vDSP와 관련이없고 상당히 오래된 버전입니다.

답변

3

FDS 계산에 vDSP를 사용하는 것은 매우 쉽습니다. 나는 당신이 입력에 대한 실제 가치가 있다고 가정하고 있습니다. VDSP에서 사용하는 FFT 알고리즘이 내부적으로 사용하는 팩형 복합 배열로 실제 가치가있는 배열을 변환해야한다는 것을 명심해야합니다.

당신은 설명서에 좋은 개요를 볼 수 있습니다

const int n = 1024; 
const int log2n = 10; // 2^10 = 1024 

DSPSplitComplex a; 
a.realp = new float[n/2]; 
a.imagp = new float[n/2]; 

// prepare the fft algo (you want to reuse the setup across fft calculations) 
FFTSetup setup = vDSP_create_fftsetup(log2n, kFFTRadix2); 

// copy the input to the packed complex array that the fft algo uses 
vDSP_ctoz((DSPComplex *) input, 2, &a, 1, n/2); 

// calculate the fft 
vDSP_fft_zrip(setup, &a, 1, log2n, FFT_FORWARD); 

// do something with the complex spectrum 
for (size_t i = 0; i < n/2; ++i) { 
    a.realp[i]; 
    a.imagp[i]; 
} 

한 트릭 a.realp[0]은 DC 오프셋 점이다 :

여기 https://developer.apple.com/library/content/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html

실제 가치 FFT를 계산하는 작은 예입니다 a.imagp[0]은 나이 퀴 스트 주파수에서 실수 값입니다.