|
From: | Dave NotTelling |
Subject: | Re: [Discuss-gnuradio] fft_filter_ccc Output Buffer Size |
Date: | Fri, 10 Feb 2017 11:36:41 -0500 |
I am trying to use the FFT filter in some c++ code and I'm having issues with seg faulting. The code below will work, but only because the output buffer is twice as large as the input buffer. It doesn't have to be twice as large, but it does have to be some number larger than the input buffer. Why is that? Also, how do I know what the output buffer size should be?Thank you!![code]#include <iostream>#include <gnuradio/filter/fft_filter.h>#include <complex>#include <vector>int main(){// Generate a set of zeroed out tapsstd::vector<std::complex<float> > taps(512, std::complex<float>(0.0f, 0.0f)); // Number of random samples to generateconst int sampleSize = 30000;// Create a vector of 32fc samples. Don't initialize it to anything, just let it have// random data.gr_complex * input = (gr_complex *)malloc(sizeof(gr_complex) * sampleSize);// Place to store the output samples from the FFTgr_complex * output = (gr_complex *)malloc(sizeof(gr_complex) * sampleSize);// Create a filter to run the input samples throughgr::filter::kernel::fft_filter_ccc * filter = new gr::filter::kernel::fft_ filter_ccc(1, taps, 1); // Filter the input samplesfilter->filter(sampleSize, input, output);// Free up the malloc'd input and output storagefree(input);free(output);delete filter;return 0;}[/code]
[Prev in Thread] | Current Thread | [Next in Thread] |