[Top][All Lists]

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

[Discuss-gnuradio] fft_filter_ccc Output Buffer Size

From: Dave NotTelling
Subject: [Discuss-gnuradio] fft_filter_ccc Output Buffer Size
Date: Fri, 10 Feb 2017 11:19:02 -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!!


#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

    delete filter;

    return 0;


reply via email to

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