c++real-timekissfft

how can i convert std::vector<short>& samples2 into kiss_fft_scalar* samples?


Currently i m kissFFT on the input data..

I had the input data in the std::vector& samples2 i want convert into the format required by the KissFFT..

I am using the following code to convert this,,

but at the end i am getting diff value please help..

here is my code

 ShortBuffer *pBuffer1 = pData->AsShortBufferN();

    std::vector<short> input(pBuffer1->GetPointer(),
            pBuffer1->GetPointer() + BUFFER_SIZE);

    kiss_fft_scalar* samples = (kiss_fft_scalar*) &input[0]; // Here my input data  is change 

please help


Solution

  • type of kiss_fft_scalar may be float, short, int32 or __m128. It is depend on same preprocessor definitions for FIXED_POINT and USE_SIMD. Check that type of kiss_fft_scalar is short.

    Your compiler can help you - do not use C cast:

     kiss_fft_scalar* samples = &input[0];  // type of &input[0] must be kiss_fft_scalar* !!!