discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] fft_filter_ccc Output Buffer Size


From: Dave NotTelling
Subject: Re: [Discuss-gnuradio] fft_filter_ccc Output Buffer Size
Date: Fri, 10 Feb 2017 11:36:41 -0500

After some more research it seems that this is an issue of not having an even multiple of input samples to taps.  For others, here is where I found the answer: http://www.dspguide.com/ch18/2.htm

On Fri, Feb 10, 2017 at 11:19 AM, Dave NotTelling <address@hidden> wrote:
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 taps
    std::vector<std::complex<float> > taps(512, std::complex<float>(0.0f, 0.0f));

    // Number of random samples to generate
    const 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 FFT
    gr_complex * output = (gr_complex *)malloc(sizeof(gr_complex) * sampleSize);

    // Create a filter to run the input samples through
    gr::filter::kernel::fft_filter_ccc * filter = new gr::filter::kernel::fft_filter_ccc(1, taps, 1);

    // Filter the input samples
    filter->filter(sampleSize, input, output);

    // Free up the malloc'd input and output storage
    free(input);
    free(output);

    delete filter;

    return 0;
}

[/code]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]