[Top][All Lists]

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

[Discuss-gnuradio] Proper input size for fir_filter_ccf

From: William Speirs
Subject: [Discuss-gnuradio] Proper input size for fir_filter_ccf
Date: Tue, 5 Feb 2019 09:04:25 -0500

I'm struggling to get the C++ fir_filter_ccf code to work correctly. My C++ code is pretty straightforward, and the same inputs work perfectly in Python:

// matches the taps produced in the Python code
vector<float> taps = firdes::low_pass(1.0, 10000000, 100000, 10000, (gr::filter::firdes::win_type)0, 0);
vector<gr_complex> input = vector<gr_complex>(100, gr_complex(1.0, 1.0));
vector<gr_complex> output = vector<gr_complex>(5);

kernel::fir_filter_ccf *filter = new kernel::fir_filter_ccf(20, taps);
filter->filterNdec(output.data(), input.data(), output.size(), 20);

This results in Valgrind reporting invalid reads:

Invalid read of size 4
   at 0x6A89FFC: volk_32fc_32f_dot_prod_32fc_generic (in /home/wspeirs/src/gnuradio-
   by 0x4E7DA18: gr::filter::kernel::fir_filter_ccf::filter(std::complex<float> const*) (in /home/wspeirs/src/gnuradio-
   by 0x4E7DACE: gr::filter::kernel::fir_filter_ccf::filterNdec(std::complex<float>*, std::complex<float> const*, unsigned long, unsigned int) (in /home/wspeirs/src/gnuradio-
   by 0x40439B: main (low_pass.cc:92)
 Address 0x7c496c0 is 0 bytes after a block of size 800 alloc'd
   at 0x4C2E0EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x406C0F: __gnu_cxx::new_allocator<std::complex<float> >::allocate(unsigned long, void const*) (new_allocator.h:104)
   by 0x406B08: __gnu_cxx::__alloc_traits<std::allocator<std::complex<float> > >::allocate(std::allocator<std::complex<float> >&, unsigned long) (alloc_traits.h:182)
   by 0x40696D: std::_Vector_base<std::complex<float>, std::allocator<std::complex<float> > >::_M_allocate(unsigned long) (stl_vector.h:170)
   by 0x40672A: std::_Vector_base<std::complex<float>, std::allocator<std::complex<float> > >::_M_create_storage(unsigned long) (stl_vector.h:185)
   by 0x40634C: std::_Vector_base<std::complex<float>, std::allocator<std::complex<float> > >::_Vector_base(unsigned long, std::allocator<std::complex<float> > const&) (stl_vector.h:136)
   by 0x405B95: std::vector<std::complex<float>, std::allocator<std::complex<float> > >::vector(unsigned long, std::complex<float> const&, std::allocator<std::complex<float> > const&) (stl_vector.h:305)
   by 0x4042D7: main (low_pass.cc:82)

Any thoughts on why the dot-product computation attempts to read past the end of my input vector? I'm assuming my input vector size is wrong, but I'm not sure what it's supposed to be.



reply via email to

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