Exemplo n.º 1
0
void FFTLib::Compute(FFTFrame &frame) {
    kiss_fftr(m_cfg, m_input, m_output);
    auto input = m_output;
    auto output = frame.data();
    for (size_t i = 0; i <= m_frame_size / 2; ++i, ++input, ++output) {
        *output = input->r * input->r + input->i * input->i;
    }
}
Exemplo n.º 2
0
void FFTLib::Compute(FFTFrame &frame) {
	fftw_execute(m_plan);
	auto output = frame.data();
	auto in_ptr = m_output;
	auto rev_in_ptr = m_output + m_frame_size - 1;
	output[0] = in_ptr[0] * in_ptr[0];
	output[m_frame_size / 2] = in_ptr[m_frame_size / 2] * in_ptr[m_frame_size / 2];
	in_ptr += 1;
	output += 1;
	for (size_t i = 1; i < m_frame_size / 2; i++) {
		*output++ = in_ptr[0] * in_ptr[0] + rev_in_ptr[0] * rev_in_ptr[0];
		in_ptr++;
		rev_in_ptr--;
	}
}