diff options
author | Johnathan Corgan <jcorgan@corganenterprises.com> | 2012-06-23 19:41:40 -0700 |
---|---|---|
committer | Johnathan Corgan <jcorgan@corganenterprises.com> | 2012-06-23 19:49:50 -0700 |
commit | dc172e5dc3f42143a5de6c43bf4f9118c273986b (patch) | |
tree | 4fd6cf8e5248f0ce723173a28d9ea5a38000d6b0 /gnuradio-core | |
parent | 9965c0a8d09dc905f7eca2ed05ffdc4a4c7dcc64 (diff) |
core: wip, first pass to remove filter/hier blocks after migration to gr-filter
* This commit removes all the blocks from src/lib/filter and src/lib/hier,
but leaves a couple stray files in src/lib/filter that won't be removed
until gr-analog is done
* The relevant QA code has been removed and the gnuradio-core directory
passes QA
* The effect on Python files in src/python/* has not been fully accounted
for
* Several top-level components outside gnuradio-core use header files,
blocks, or utility functions that have moved to gr-digital. These have
not been updated yet.
* Similarly, impact on python example files in other components as not
yet been accounted for.
Diffstat (limited to 'gnuradio-core')
298 files changed, 3 insertions, 33130 deletions
diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt index c2b847c919..fc06c23476 100644 --- a/gnuradio-core/src/examples/CMakeLists.txt +++ b/gnuradio-core/src/examples/CMakeLists.txt @@ -19,6 +19,5 @@ add_subdirectory(mp-sched) add_subdirectory(network) -add_subdirectory(pfb) add_subdirectory(tags) add_subdirectory(volk_benchmark)
\ No newline at end of file diff --git a/gnuradio-core/src/examples/pfb/CMakeLists.txt b/gnuradio-core/src/examples/pfb/CMakeLists.txt deleted file mode 100644 index 6bb25568c8..0000000000 --- a/gnuradio-core/src/examples/pfb/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -include(GrPython) - -GR_PYTHON_INSTALL(PROGRAMS - channelize.py - chirp_channelize.py - decimate.py - fmtest.py - interpolate.py - resampler_demo.grc - resampler.py - synth_filter.py - synth_to_chan.py - reconstruction.py - DESTINATION ${GR_PKG_DATA_DIR}/examples/pfb - COMPONENT "core_python" -) - diff --git a/gnuradio-core/src/examples/pfb/channelize.py b/gnuradio-core/src/examples/pfb/channelize.py deleted file mode 100755 index 442f263f47..0000000000 --- a/gnuradio-core/src/examples/pfb/channelize.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 2000000 # number of samples to use - self._fs = 9000 # initial sampling rate - self._M = 9 # Number of channels to channelize - - # Create a set of taps for the PFB channelizer - self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50, - attenuation_dB=100, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._M)) - print "Number of taps: ", len(self._taps) - print "Number of channels: ", self._M - print "Taps per channel: ", tpc - - # Create a set of signals at different frequencies - # freqs lists the frequencies of the signals that get stored - # in the list "signals", which then get summed together - self.signals = list() - self.add = gr.add_cc() - freqs = [-4070, -3050, -2030, -1010, 10, 1020, 2040, 3060, 4080] - for i in xrange(len(freqs)): - self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1)) - self.connect(self.signals[i], (self.add,i)) - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct the channelizer filter - self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps, 1) - - # Construct a vector sink for the input signal to the channelizer - self.snk_i = gr.vector_sink_c() - - # Connect the blocks - self.connect(self.add, self.head, self.pfb) - self.connect(self.add, self.snk_i) - - # Use this to play with the channel mapping - #self.pfb.set_channel_map([5,6,7,8,0,1,2,3,4]) - - # Create a vector sink for each of M output channels of the filter and connect it - self.snks = list() - for i in xrange(self._M): - self.snks.append(gr.vector_sink_c()) - self.connect((self.pfb, i), self.snks[i]) - - -def main(): - tstart = time.time() - - tb = pfb_top_block() - tb.run() - - tend = time.time() - print "Run time: %f" % (tend - tstart) - - if 1: - fig_in = pylab.figure(1, figsize=(16,9), facecolor="w") - fig1 = pylab.figure(2, figsize=(16,9), facecolor="w") - fig2 = pylab.figure(3, figsize=(16,9), facecolor="w") - - Ns = 1000 - Ne = 10000 - - fftlen = 8192 - winfunc = scipy.blackman - fs = tb._fs - - # Plot the input signal on its own figure - d = tb.snk_i.data()[Ns:Ne] - spin_f = fig_in.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(X)) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - pin_f = spin_f.plot(f_in, X_in, "b") - spin_f.set_xlim([min(f_in), max(f_in)+1]) - spin_f.set_ylim([-200.0, 50.0]) - - spin_f.set_title("Input Signal", weight="bold") - spin_f.set_xlabel("Frequency (Hz)") - spin_f.set_ylabel("Power (dBW)") - - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - spin_t = fig_in.add_subplot(2, 1, 2) - pin_t = spin_t.plot(t_in, x_in.real, "b") - pin_t = spin_t.plot(t_in, x_in.imag, "r") - - spin_t.set_xlabel("Time (s)") - spin_t.set_ylabel("Amplitude") - - Ncols = int(scipy.floor(scipy.sqrt(tb._M))) - Nrows = int(scipy.floor(tb._M / Ncols)) - if(tb._M % Ncols != 0): - Nrows += 1 - - # Plot each of the channels outputs. Frequencies on Figure 2 and - # time signals on Figure 3 - fs_o = tb._fs / tb._M - Ts_o = 1.0/fs_o - Tmax_o = len(d)*Ts_o - for i in xrange(len(tb.snks)): - # remove issues with the transients at the beginning - # also remove some corruption at the end of the stream - # this is a bug, probably due to the corner cases - d = tb.snks[i].data()[Ns:Ne] - - sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i) - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(X)) - f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) - p2_f = sp1_f.plot(f_o, X_o, "b") - sp1_f.set_xlim([min(f_o), max(f_o)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - sp1_f.set_title(("Channel %d" % i), weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - x_o = scipy.array(d) - t_o = scipy.arange(0, Tmax_o, Ts_o) - sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i) - p2_o = sp2_o.plot(t_o, x_o.real, "b") - p2_o = sp2_o.plot(t_o, x_o.imag, "r") - sp2_o.set_xlim([min(t_o), max(t_o)+1]) - sp2_o.set_ylim([-2, 2]) - - sp2_o.set_title(("Channel %d" % i), weight="bold") - sp2_o.set_xlabel("Time (s)") - sp2_o.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/chirp_channelize.py b/gnuradio-core/src/examples/pfb/chirp_channelize.py deleted file mode 100755 index 1c485ea9dd..0000000000 --- a/gnuradio-core/src/examples/pfb/chirp_channelize.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 200000 # number of samples to use - self._fs = 9000 # initial sampling rate - self._M = 9 # Number of channels to channelize - - # Create a set of taps for the PFB channelizer - self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20, - attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._M)) - print "Number of taps: ", len(self._taps) - print "Number of channels: ", self._M - print "Taps per channel: ", tpc - - repeated = True - if(repeated): - self.vco_input = gr.sig_source_f(self._fs, gr.GR_SIN_WAVE, 0.25, 110) - else: - amp = 100 - data = scipy.arange(0, amp, amp/float(self._N)) - self.vco_input = gr.vector_source_f(data, False) - - # Build a VCO controlled by either the sinusoid or single chirp tone - # Then convert this to a complex signal - self.vco = gr.vco_f(self._fs, 225, 1) - self.f2c = gr.float_to_complex() - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct the channelizer filter - self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps) - - # Construct a vector sink for the input signal to the channelizer - self.snk_i = gr.vector_sink_c() - - # Connect the blocks - self.connect(self.vco_input, self.vco, self.f2c) - self.connect(self.f2c, self.head, self.pfb) - self.connect(self.f2c, self.snk_i) - - # Create a vector sink for each of M output channels of the filter and connect it - self.snks = list() - for i in xrange(self._M): - self.snks.append(gr.vector_sink_c()) - self.connect((self.pfb, i), self.snks[i]) - - -def main(): - tstart = time.time() - - tb = pfb_top_block() - tb.run() - - tend = time.time() - print "Run time: %f" % (tend - tstart) - - if 1: - fig_in = pylab.figure(1, figsize=(16,9), facecolor="w") - fig1 = pylab.figure(2, figsize=(16,9), facecolor="w") - fig2 = pylab.figure(3, figsize=(16,9), facecolor="w") - fig3 = pylab.figure(4, figsize=(16,9), facecolor="w") - - Ns = 650 - Ne = 20000 - - fftlen = 8192 - winfunc = scipy.blackman - fs = tb._fs - - # Plot the input signal on its own figure - d = tb.snk_i.data()[Ns:Ne] - spin_f = fig_in.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - pin_f = spin_f.plot(f_in, X_in, "b") - spin_f.set_xlim([min(f_in), max(f_in)+1]) - spin_f.set_ylim([-200.0, 50.0]) - - spin_f.set_title("Input Signal", weight="bold") - spin_f.set_xlabel("Frequency (Hz)") - spin_f.set_ylabel("Power (dBW)") - - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - spin_t = fig_in.add_subplot(2, 1, 2) - pin_t = spin_t.plot(t_in, x_in.real, "b") - pin_t = spin_t.plot(t_in, x_in.imag, "r") - - spin_t.set_xlabel("Time (s)") - spin_t.set_ylabel("Amplitude") - - Ncols = int(scipy.floor(scipy.sqrt(tb._M))) - Nrows = int(scipy.floor(tb._M / Ncols)) - if(tb._M % Ncols != 0): - Nrows += 1 - - # Plot each of the channels outputs. Frequencies on Figure 2 and - # time signals on Figure 3 - fs_o = tb._fs / tb._M - Ts_o = 1.0/fs_o - Tmax_o = len(d)*Ts_o - for i in xrange(len(tb.snks)): - # remove issues with the transients at the beginning - # also remove some corruption at the end of the stream - # this is a bug, probably due to the corner cases - d = tb.snks[i].data()[Ns:Ne] - - sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i) - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(X)) - f_o = freq - p2_f = sp1_f.plot(f_o, X_o, "b") - sp1_f.set_xlim([min(f_o), max(f_o)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - sp1_f.set_title(("Channel %d" % i), weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - x_o = scipy.array(d) - t_o = scipy.arange(0, Tmax_o, Ts_o) - sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i) - p2_o = sp2_o.plot(t_o, x_o.real, "b") - p2_o = sp2_o.plot(t_o, x_o.imag, "r") - sp2_o.set_xlim([min(t_o), max(t_o)+1]) - sp2_o.set_ylim([-2, 2]) - - sp2_o.set_title(("Channel %d" % i), weight="bold") - sp2_o.set_xlabel("Time (s)") - sp2_o.set_ylabel("Amplitude") - - - sp3 = fig3.add_subplot(1,1,1) - p3 = sp3.plot(t_o, x_o.real) - sp3.set_xlim([min(t_o), max(t_o)+1]) - sp3.set_ylim([-2, 2]) - - sp3.set_title("All Channels") - sp3.set_xlabel("Time (s)") - sp3.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/decimate.py b/gnuradio-core/src/examples/pfb/decimate.py deleted file mode 100755 index 5322d746db..0000000000 --- a/gnuradio-core/src/examples/pfb/decimate.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 10000000 # number of samples to use - self._fs = 10000 # initial sampling rate - self._decim = 20 # Decimation rate - - # Generate the prototype filter taps for the decimators with a 200 Hz bandwidth - self._taps = gr.firdes.low_pass_2(1, self._fs, 200, 150, - attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._decim)) - print "Number of taps: ", len(self._taps) - print "Number of filters: ", self._decim - print "Taps per channel: ", tpc - - # Build the input signal source - # We create a list of freqs, and a sine wave is generated and added to the source - # for each one of these frequencies. - self.signals = list() - self.add = gr.add_cc() - freqs = [10, 20, 2040] - for i in xrange(len(freqs)): - self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1)) - self.connect(self.signals[i], (self.add,i)) - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct a PFB decimator filter - self.pfb = blks2.pfb_decimator_ccf(self._decim, self._taps, 0) - - # Construct a standard FIR decimating filter - self.dec = gr.fir_filter_ccf(self._decim, self._taps) - - self.snk_i = gr.vector_sink_c() - - # Connect the blocks - self.connect(self.add, self.head, self.pfb) - self.connect(self.add, self.snk_i) - - # Create the sink for the decimated siganl - self.snk = gr.vector_sink_c() - self.connect(self.pfb, self.snk) - - -def main(): - tb = pfb_top_block() - - tstart = time.time() - tb.run() - tend = time.time() - print "Run time: %f" % (tend - tstart) - - if 1: - fig1 = pylab.figure(1, figsize=(16,9)) - fig2 = pylab.figure(2, figsize=(16,9)) - - Ns = 10000 - Ne = 10000 - - fftlen = 8192 - winfunc = scipy.blackman - fs = tb._fs - - # Plot the input to the decimator - - d = tb.snk_i.data()[Ns:Ns+Ne] - sp1_f = fig1.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - sp1_f.set_title("Input Signal", weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - sp1_t = fig1.add_subplot(2, 1, 2) - p1_t = sp1_t.plot(t_in, x_in.real, "b") - p1_t = sp1_t.plot(t_in, x_in.imag, "r") - sp1_t.set_ylim([-tb._decim*1.1, tb._decim*1.1]) - - sp1_t.set_xlabel("Time (s)") - sp1_t.set_ylabel("Amplitude") - - - # Plot the output of the decimator - fs_o = tb._fs / tb._decim - - sp2_f = fig2.add_subplot(2, 1, 1) - d = tb.snk.data()[Ns:Ns+Ne] - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) - p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+1]) - sp2_f.set_ylim([-200.0, 50.0]) - - sp2_f.set_title("PFB Decimated Signal", weight="bold") - sp2_f.set_xlabel("Frequency (Hz)") - sp2_f.set_ylabel("Power (dBW)") - - - Ts_o = 1.0/fs_o - Tmax_o = len(d)*Ts_o - - x_o = scipy.array(d) - t_o = scipy.arange(0, Tmax_o, Ts_o) - sp2_t = fig2.add_subplot(2, 1, 2) - p2_t = sp2_t.plot(t_o, x_o.real, "b-o") - p2_t = sp2_t.plot(t_o, x_o.imag, "r-o") - sp2_t.set_ylim([-2.5, 2.5]) - - sp2_t.set_xlabel("Time (s)") - sp2_t.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/fmtest.py b/gnuradio-core/src/examples/pfb/fmtest.py deleted file mode 100755 index b9dd9b3823..0000000000 --- a/gnuradio-core/src/examples/pfb/fmtest.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys, math, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - - -class fmtx(gr.hier_block2): - def __init__(self, lo_freq, audio_rate, if_rate): - - gr.hier_block2.__init__(self, "build_fm", - gr.io_signature(1, 1, gr.sizeof_float), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6) - - # Local oscillator - lo = gr.sig_source_c (if_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - lo_freq, #frequency - 1.0, # amplitude - 0) # DC Offset - mixer = gr.multiply_cc () - - self.connect (self, fmtx, (mixer, 0)) - self.connect (lo, (mixer, 1)) - self.connect (mixer, self) - -class fmtest(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._nsamples = 1000000 - self._audio_rate = 8000 - - # Set up N channels with their own baseband and IF frequencies - self._N = 5 - chspacing = 16000 - freq = [10, 20, 30, 40, 50] - f_lo = [0, 1*chspacing, -1*chspacing, 2*chspacing, -2*chspacing] - - self._if_rate = 4*self._N*self._audio_rate - - # Create a signal source and frequency modulate it - self.sum = gr.add_cc () - for n in xrange(self._N): - sig = gr.sig_source_f(self._audio_rate, gr.GR_SIN_WAVE, freq[n], 0.5) - fm = fmtx(f_lo[n], self._audio_rate, self._if_rate) - self.connect(sig, fm) - self.connect(fm, (self.sum, n)) - - self.head = gr.head(gr.sizeof_gr_complex, self._nsamples) - self.snk_tx = gr.vector_sink_c() - self.channel = blks2.channel_model(0.1) - - self.connect(self.sum, self.head, self.channel, self.snk_tx) - - - # Design the channlizer - self._M = 10 - bw = chspacing/2.0 - t_bw = chspacing/10.0 - self._chan_rate = self._if_rate / self._M - self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw, - attenuation_dB=100, - window=gr.firdes.WIN_BLACKMAN_hARRIS) - tpc = math.ceil(float(len(self._taps)) / float(self._M)) - - print "Number of taps: ", len(self._taps) - print "Number of channels: ", self._M - print "Taps per channel: ", tpc - - self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps) - - self.connect(self.channel, self.pfb) - - # Create a file sink for each of M output channels of the filter and connect it - self.fmdet = list() - self.squelch = list() - self.snks = list() - for i in xrange(self._M): - self.fmdet.append(blks2.nbfm_rx(self._audio_rate, self._chan_rate)) - self.squelch.append(blks2.standard_squelch(self._audio_rate*10)) - self.snks.append(gr.vector_sink_f()) - self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i]) - - def num_tx_channels(self): - return self._N - - def num_rx_channels(self): - return self._M - -def main(): - - fm = fmtest() - - tstart = time.time() - fm.run() - tend = time.time() - - if 1: - fig1 = pylab.figure(1, figsize=(12,10), facecolor="w") - fig2 = pylab.figure(2, figsize=(12,10), facecolor="w") - fig3 = pylab.figure(3, figsize=(12,10), facecolor="w") - - Ns = 10000 - Ne = 100000 - - fftlen = 8192 - winfunc = scipy.blackman - - # Plot transmitted signal - fs = fm._if_rate - - d = fm.snk_tx.data()[Ns:Ns+Ne] - sp1_f = fig1.add_subplot(2, 1, 1) - - X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - visible=False) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-120.0, 20.0]) - - sp1_f.set_title("Input Signal", weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - sp1_t = fig1.add_subplot(2, 1, 2) - p1_t = sp1_t.plot(t_in, x_in.real, "b-o") - #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o") - sp1_t.set_ylim([-5, 5]) - - # Set up the number of rows and columns for plotting the subfigures - Ncols = int(scipy.floor(scipy.sqrt(fm.num_rx_channels()))) - Nrows = int(scipy.floor(fm.num_rx_channels() / Ncols)) - if(fm.num_rx_channels() % Ncols != 0): - Nrows += 1 - - # Plot each of the channels outputs. Frequencies on Figure 2 and - # time signals on Figure 3 - fs_o = fm._audio_rate - for i in xrange(len(fm.snks)): - # remove issues with the transients at the beginning - # also remove some corruption at the end of the stream - # this is a bug, probably due to the corner cases - d = fm.snks[i].data()[Ns:Ne] - - sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i) - X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o, - window = lambda d: d*winfunc(fftlen), - visible=False) - #X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - X_o = 10.0*scipy.log10(abs(X)) - #f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) - f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size)) - p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+0.1]) - sp2_f.set_ylim([-120.0, 20.0]) - sp2_f.grid(True) - - sp2_f.set_title(("Channel %d" % i), weight="bold") - sp2_f.set_xlabel("Frequency (kHz)") - sp2_f.set_ylabel("Power (dBW)") - - - Ts = 1.0/fs_o - Tmax = len(d)*Ts - t_o = scipy.arange(0, Tmax, Ts) - - x_t = scipy.array(d) - sp2_t = fig3.add_subplot(Nrows, Ncols, 1+i) - p2_t = sp2_t.plot(t_o, x_t.real, "b") - p2_t = sp2_t.plot(t_o, x_t.imag, "r") - sp2_t.set_xlim([min(t_o), max(t_o)+1]) - sp2_t.set_ylim([-1, 1]) - - sp2_t.set_xlabel("Time (s)") - sp2_t.set_ylabel("Amplitude") - - - pylab.show() - - -if __name__ == "__main__": - main() diff --git a/gnuradio-core/src/examples/pfb/interpolate.py b/gnuradio-core/src/examples/pfb/interpolate.py deleted file mode 100755 index 98068f220b..0000000000 --- a/gnuradio-core/src/examples/pfb/interpolate.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys, time - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab - from pylab import mlab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class pfb_top_block(gr.top_block): - def __init__(self): - gr.top_block.__init__(self) - - self._N = 100000 # number of samples to use - self._fs = 2000 # initial sampling rate - self._interp = 5 # Interpolation rate for PFB interpolator - self._ainterp = 5.5 # Resampling rate for the PFB arbitrary resampler - - # Frequencies of the signals we construct - freq1 = 100 - freq2 = 200 - - # Create a set of taps for the PFB interpolator - # This is based on the post-interpolation sample rate - self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50, - attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Create a set of taps for the PFB arbitrary resampler - # The filter size is the number of filters in the filterbank; 32 will give very low side-lobes, - # and larger numbers will reduce these even farther - # The taps in this filter are based on a sampling rate of the filter size since it acts - # internally as an interpolator. - flt_size = 32 - self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150, - attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) - - # Calculate the number of taps per channel for our own information - tpc = scipy.ceil(float(len(self._taps)) / float(self._interp)) - print "Number of taps: ", len(self._taps) - print "Number of filters: ", self._interp - print "Taps per channel: ", tpc - - # Create a couple of signals at different frequencies - self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5) - self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5) - self.signal = gr.add_cc() - - self.head = gr.head(gr.sizeof_gr_complex, self._N) - - # Construct the PFB interpolator filter - self.pfb = blks2.pfb_interpolator_ccf(self._interp, self._taps) - - # Construct the PFB arbitrary resampler filter - self.pfb_ar = blks2.pfb_arb_resampler_ccf(self._ainterp, self._taps2, flt_size) - self.snk_i = gr.vector_sink_c() - - #self.pfb_ar.pfb.print_taps() - #self.pfb.pfb.print_taps() - - # Connect the blocks - self.connect(self.signal1, self.head, (self.signal,0)) - self.connect(self.signal2, (self.signal,1)) - self.connect(self.signal, self.pfb) - self.connect(self.signal, self.pfb_ar) - self.connect(self.signal, self.snk_i) - - # Create the sink for the interpolated signals - self.snk1 = gr.vector_sink_c() - self.snk2 = gr.vector_sink_c() - self.connect(self.pfb, self.snk1) - self.connect(self.pfb_ar, self.snk2) - - -def main(): - tb = pfb_top_block() - - tstart = time.time() - tb.run() - tend = time.time() - print "Run time: %f" % (tend - tstart) - - - if 1: - fig1 = pylab.figure(1, figsize=(12,10), facecolor="w") - fig2 = pylab.figure(2, figsize=(12,10), facecolor="w") - fig3 = pylab.figure(3, figsize=(12,10), facecolor="w") - - Ns = 10000 - Ne = 10000 - - fftlen = 8192 - winfunc = scipy.blackman - - # Plot input signal - fs = tb._fs - - d = tb.snk_i.data()[Ns:Ns+Ne] - sp1_f = fig1.add_subplot(2, 1, 1) - - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) - p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-200.0, 50.0]) - - - sp1_f.set_title("Input Signal", weight="bold") - sp1_f.set_xlabel("Frequency (Hz)") - sp1_f.set_ylabel("Power (dBW)") - - Ts = 1.0/fs - Tmax = len(d)*Ts - - t_in = scipy.arange(0, Tmax, Ts) - x_in = scipy.array(d) - sp1_t = fig1.add_subplot(2, 1, 2) - p1_t = sp1_t.plot(t_in, x_in.real, "b-o") - #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o") - sp1_t.set_ylim([-2.5, 2.5]) - - sp1_t.set_title("Input Signal", weight="bold") - sp1_t.set_xlabel("Time (s)") - sp1_t.set_ylabel("Amplitude") - - - # Plot output of PFB interpolator - fs_int = tb._fs*tb._interp - - sp2_f = fig2.add_subplot(2, 1, 1) - d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)] - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size)) - p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+1]) - sp2_f.set_ylim([-200.0, 50.0]) - - sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold") - sp2_f.set_xlabel("Frequency (Hz)") - sp2_f.set_ylabel("Power (dBW)") - - Ts_int = 1.0/fs_int - Tmax = len(d)*Ts_int - - t_o = scipy.arange(0, Tmax, Ts_int) - x_o1 = scipy.array(d) - sp2_t = fig2.add_subplot(2, 1, 2) - p2_t = sp2_t.plot(t_o, x_o1.real, "b-o") - #p2_t = sp2_t.plot(t_o, x_o.imag, "r-o") - sp2_t.set_ylim([-2.5, 2.5]) - - sp2_t.set_title("Output Signal from PFB Interpolator", weight="bold") - sp2_t.set_xlabel("Time (s)") - sp2_t.set_ylabel("Amplitude") - - - # Plot output of PFB arbitrary resampler - fs_aint = tb._fs * tb._ainterp - - sp3_f = fig3.add_subplot(2, 1, 1) - d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)] - X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs, - window = lambda d: d*winfunc(fftlen), - scale_by_freq=True) - X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) - f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size)) - p3_f = sp3_f.plot(f_o, X_o, "b") - sp3_f.set_xlim([min(f_o), max(f_o)+1]) - sp3_f.set_ylim([-200.0, 50.0]) - - sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold") - sp3_f.set_xlabel("Frequency (Hz)") - sp3_f.set_ylabel("Power (dBW)") - - Ts_aint = 1.0/fs_aint - Tmax = len(d)*Ts_aint - - t_o = scipy.arange(0, Tmax, Ts_aint) - x_o2 = scipy.array(d) - sp3_f = fig3.add_subplot(2, 1, 2) - p3_f = sp3_f.plot(t_o, x_o2.real, "b-o") - p3_f = sp3_f.plot(t_o, x_o1.real, "m-o") - #p3_f = sp3_f.plot(t_o, x_o2.imag, "r-o") - sp3_f.set_ylim([-2.5, 2.5]) - - sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold") - sp3_f.set_xlabel("Time (s)") - sp3_f.set_ylabel("Amplitude") - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/reconstruction.py b/gnuradio-core/src/examples/pfb/reconstruction.py deleted file mode 100755 index 59910e4d6d..0000000000 --- a/gnuradio-core/src/examples/pfb/reconstruction.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python - -import scipy, math, pylab -from scipy import fftpack -from gnuradio import gr, digital, blks2 - -fftlen = 8192 - -def main(): - N = 10000 - fs = 2000.0 - Ts = 1.0/fs - t = scipy.arange(0, N*Ts, Ts) - - # When playing with the number of channels, be careful about the filter - # specs and the channel map of the synthesizer set below. - nchans = 10 - - # Build the filter(s) - bw = 1000 - tb = 400 - proto_taps = gr.firdes.low_pass_2(1, nchans*fs, bw, tb, 80, - gr.firdes.WIN_BLACKMAN_hARRIS) - print "Filter length: ", len(proto_taps) - - - # Create a modulated signal - npwr = 0.01 - data = scipy.random.randint(0, 256, N) - rrc_taps = gr.firdes.root_raised_cosine(1, 2, 1, 0.35, 41) - - src = gr.vector_source_b(data.astype(scipy.uint8).tolist(), False) - mod = digital.bpsk_mod(samples_per_symbol=2) - chan = gr.channel_model(npwr) - rrc = gr.fft_filter_ccc(1, rrc_taps) - - # Split it up into pieces - channelizer = blks2.pfb_channelizer_ccf(nchans, proto_taps, 2) - - # Put the pieces back together again - syn_taps = [nchans*t for t in proto_taps] - synthesizer = gr.pfb_synthesizer_ccf(nchans, syn_taps, True) - src_snk = gr.vector_sink_c() - snk = gr.vector_sink_c() - - # Remap the location of the channels - # Can be done in synth or channelizer (watch out for rotattions in - # the channelizer) - synthesizer.set_channel_map([ 0, 1, 2, 3, 4, - 15, 16, 17, 18, 19]) - - tb = gr.top_block() - tb.connect(src, mod, chan, rrc, channelizer) - tb.connect(rrc, src_snk) - - vsnk = [] - for i in xrange(nchans): - tb.connect((channelizer,i), (synthesizer, i)) - - vsnk.append(gr.vector_sink_c()) - tb.connect((channelizer,i), vsnk[i]) - - tb.connect(synthesizer, snk) - tb.run() - - sin = scipy.array(src_snk.data()[1000:]) - sout = scipy.array(snk.data()[1000:]) - - - # Plot original signal - fs_in = nchans*fs - f1 = pylab.figure(1, figsize=(16,12), facecolor='w') - s11 = f1.add_subplot(2,2,1) - s11.psd(sin, NFFT=fftlen, Fs=fs_in) - s11.set_title("PSD of Original Signal") - s11.set_ylim([-200, -20]) - - s12 = f1.add_subplot(2,2,2) - s12.plot(sin.real[1000:1500], "o-b") - s12.plot(sin.imag[1000:1500], "o-r") - s12.set_title("Original Signal in Time") - - start = 1 - skip = 4 - s13 = f1.add_subplot(2,2,3) - s13.plot(sin.real[start::skip], sin.imag[start::skip], "o") - s13.set_title("Constellation") - s13.set_xlim([-2, 2]) - s13.set_ylim([-2, 2]) - - # Plot channels - nrows = int(scipy.sqrt(nchans)) - ncols = int(scipy.ceil(float(nchans)/float(nrows))) - - f2 = pylab.figure(2, figsize=(16,12), facecolor='w') - for n in xrange(nchans): - s = f2.add_subplot(nrows, ncols, n+1) - s.psd(vsnk[n].data(), NFFT=fftlen, Fs=fs_in) - s.set_title("Channel {0}".format(n)) - s.set_ylim([-200, -20]) - - # Plot reconstructed signal - fs_out = 2*nchans*fs - f3 = pylab.figure(3, figsize=(16,12), facecolor='w') - s31 = f3.add_subplot(2,2,1) - s31.psd(sout, NFFT=fftlen, Fs=fs_out) - s31.set_title("PSD of Reconstructed Signal") - s31.set_ylim([-200, -20]) - - s32 = f3.add_subplot(2,2,2) - s32.plot(sout.real[1000:1500], "o-b") - s32.plot(sout.imag[1000:1500], "o-r") - s32.set_title("Reconstructed Signal in Time") - - start = 2 - skip = 4 - s33 = f3.add_subplot(2,2,3) - s33.plot(sout.real[start::skip], sout.imag[start::skip], "o") - s33.set_title("Constellation") - s33.set_xlim([-2, 2]) - s33.set_ylim([-2, 2]) - - pylab.show() - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gnuradio-core/src/examples/pfb/resampler.py b/gnuradio-core/src/examples/pfb/resampler.py deleted file mode 100755 index 555938d281..0000000000 --- a/gnuradio-core/src/examples/pfb/resampler.py +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys - -try: - import scipy -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -class mytb(gr.top_block): - def __init__(self, fs_in, fs_out, fc, N=10000): - gr.top_block.__init__(self) - - rerate = float(fs_out) / float(fs_in) - print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate) - - # Creating our own taps - taps = gr.firdes.low_pass_2(32, 32, 0.25, 0.1, 80) - - self.src = gr.sig_source_c(fs_in, gr.GR_SIN_WAVE, fc, 1) - #self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1) - self.head = gr.head(gr.sizeof_gr_complex, N) - - # A resampler with our taps - self.resamp_0 = blks2.pfb_arb_resampler_ccf(rerate, taps, - flt_size=32) - - # A resampler that just needs a resampling rate. - # Filter is created for us and designed to cover - # entire bandwidth of the input signal. - # An optional atten=XX rate can be used here to - # specify the out-of-band rejection (default=80). - self.resamp_1 = blks2.pfb_arb_resampler_ccf(rerate) - - self.snk_in = gr.vector_sink_c() - self.snk_0 = gr.vector_sink_c() - self.snk_1 = gr.vector_sink_c() - - self.connect(self.src, self.head, self.snk_in) - self.connect(self.head, self.resamp_0, self.snk_0) - self.connect(self.head, self.resamp_1, self.snk_1) - -def main(): - fs_in = 8000 - fs_out = 20000 - fc = 1000 - N = 10000 - - tb = mytb(fs_in, fs_out, fc, N) - tb.run() - - - # Plot PSD of signals - nfftsize = 2048 - fig1 = pylab.figure(1, figsize=(10,10), facecolor="w") - sp1 = fig1.add_subplot(2,1,1) - sp1.psd(tb.snk_in.data(), NFFT=nfftsize, - noverlap=nfftsize/4, Fs = fs_in) - sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0))) - sp1.set_xlim([-fs_in/2, fs_in/2]) - - sp2 = fig1.add_subplot(2,1,2) - sp2.psd(tb.snk_0.data(), NFFT=nfftsize, - noverlap=nfftsize/4, Fs = fs_out, - label="With our filter") - sp2.psd(tb.snk_1.data(), NFFT=nfftsize, - noverlap=nfftsize/4, Fs = fs_out, - label="With auto-generated filter") - sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0))) - sp2.set_xlim([-fs_out/2, fs_out/2]) - sp2.legend() - - # Plot signals in time - Ts_in = 1.0/fs_in - Ts_out = 1.0/fs_out - t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in) - t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out) - - fig2 = pylab.figure(2, figsize=(10,10), facecolor="w") - sp21 = fig2.add_subplot(2,1,1) - sp21.plot(t_in, tb.snk_in.data()) - sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0))) - sp21.set_xlim([t_in[100], t_in[200]]) - - sp22 = fig2.add_subplot(2,1,2) - sp22.plot(t_out, tb.snk_0.data(), - label="With our filter") - sp22.plot(t_out, tb.snk_1.data(), - label="With auto-generated filter") - sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0))) - r = float(fs_out)/float(fs_in) - sp22.set_xlim([t_out[r * 100], t_out[r * 200]]) - sp22.legend() - - pylab.show() - -if __name__ == "__main__": - main() - diff --git a/gnuradio-core/src/examples/pfb/resampler_demo.grc b/gnuradio-core/src/examples/pfb/resampler_demo.grc deleted file mode 100644 index 468636a5cf..0000000000 --- a/gnuradio-core/src/examples/pfb/resampler_demo.grc +++ /dev/null @@ -1,598 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun Aug 23 11:39:47 2009</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>resampler_demo</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 59)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rs_taps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value> - </param> - <param> - <key>_coordinate</key> - <value>(273, 154)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_const_vxx</key> - <param> - <key>id</key> - <value>adder</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>-1.0</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(227, 303)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(227, 493)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>orig_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Original Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>30</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 3</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(409, 289)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>resamp_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Resampled Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>new_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>30</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>True</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>grid_pos</key> - <value>2, 0, 1, 3</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(640, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>tri_source</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_TRI_WAVE</value> - </param> - <param> - <key>freq</key> - <value>0.05</value> - </param> - <param> - <key>amp</key> - <value>2.0</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(21, 271)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_frequency_modulator_fc</key> - <param> - <key>id</key> - <value>fm_mod</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>sensitivity</key> - <value>math.pi</value> - </param> - <param> - <key>_coordinate</key> - <value>(411, 493)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>resampler</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>rate</key> - <value>float(new_rate)/samp_rate</value> - </param> - <param> - <key>taps</key> - <value>rs_taps</value> - </param> - <param> - <key>size</key> - <value>nphases</value> - </param> - <param> - <key>_coordinate</key> - <value>(641, 477)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>nphases</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(185, 153)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Sample Rate</value> - </param> - <param> - <key>value</key> - <value>44100</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(179, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>new_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Resampled Rate</value> - </param> - <param> - <key>value</key> - <value>48000</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value>0, 1, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(328, 15)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>frac_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Fractional Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0.45</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>formatter</key> - <value>lambda x: "%0.2f"%x</value> - </param> - <param> - <key>grid_pos</key> - <value>0,2,1,1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(473, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>tri_source</source_block_id> - <sink_block_id>adder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>adder</source_block_id> - <sink_block_id>throttle</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>resampler</source_block_id> - <sink_block_id>resamp_fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>fm_mod</source_block_id> - <sink_block_id>resampler</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>fm_mod</source_block_id> - <sink_block_id>orig_fft</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>throttle</source_block_id> - <sink_block_id>fm_mod</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gnuradio-core/src/examples/pfb/synth_filter.py b/gnuradio-core/src/examples/pfb/synth_filter.py deleted file mode 100755 index c0f7376ec0..0000000000 --- a/gnuradio-core/src/examples/pfb/synth_filter.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys - -try: - import scipy -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -def main(): - N = 1000000 - fs = 8000 - - freqs = [100, 200, 300, 400, 500] - nchans = 7 - - sigs = list() - for fi in freqs: - s = gr.sig_source_c(fs, gr.GR_SIN_WAVE, fi, 1) - sigs.append(s) - - taps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Num. Taps = %d (taps per filter = %d)" % (len(taps), - len(taps)/nchans) - filtbank = gr.pfb_synthesizer_ccf(nchans, taps) - - head = gr.head(gr.sizeof_gr_complex, N) - snk = gr.vector_sink_c() - - tb = gr.top_block() - tb.connect(filtbank, head, snk) - - for i,si in enumerate(sigs): - tb.connect(si, (filtbank, i)) - - tb.run() - - if 1: - f1 = pylab.figure(1) - s1 = f1.add_subplot(1,1,1) - s1.plot(snk.data()[1000:]) - - fftlen = 2048 - f2 = pylab.figure(2) - s2 = f2.add_subplot(1,1,1) - winfunc = scipy.blackman - s2.psd(snk.data()[10000:], NFFT=fftlen, - Fs = nchans*fs, - noverlap=fftlen/4, - window = lambda d: d*winfunc(fftlen)) - - pylab.show() - -if __name__ == "__main__": - main() diff --git a/gnuradio-core/src/examples/pfb/synth_to_chan.py b/gnuradio-core/src/examples/pfb/synth_to_chan.py deleted file mode 100755 index 18b2e7b53f..0000000000 --- a/gnuradio-core/src/examples/pfb/synth_to_chan.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blks2 -import sys - -try: - import scipy -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -def main(): - N = 1000000 - fs = 8000 - - freqs = [100, 200, 300, 400, 500] - nchans = 7 - - sigs = list() - fmtx = list() - for fi in freqs: - s = gr.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1) - fm = blks2.nbfm_tx (fs, 4*fs, max_dev=10000, tau=75e-6) - sigs.append(s) - fmtx.append(fm) - - syntaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps), - len(syntaps)/nchans) - chtaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps), - len(chtaps)/nchans) - filtbank = gr.pfb_synthesizer_ccf(nchans, syntaps) - channelizer = blks2.pfb_channelizer_ccf(nchans, chtaps) - - noise_level = 0.01 - head = gr.head(gr.sizeof_gr_complex, N) - noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level) - addnoise = gr.add_cc() - snk_synth = gr.vector_sink_c() - - tb = gr.top_block() - - tb.connect(noise, (addnoise,0)) - tb.connect(filtbank, head, (addnoise, 1)) - tb.connect(addnoise, channelizer) - tb.connect(addnoise, snk_synth) - - snk = list() - for i,si in enumerate(sigs): - tb.connect(si, fmtx[i], (filtbank, i)) - - for i in xrange(nchans): - snk.append(gr.vector_sink_c()) - tb.connect((channelizer, i), snk[i]) - - tb.run() - - if 1: - channel = 1 - data = snk[channel].data()[1000:] - - f1 = pylab.figure(1) - s1 = f1.add_subplot(1,1,1) - s1.plot(data[10000:10200] ) - s1.set_title(("Output Signal from Channel %d" % channel)) - - fftlen = 2048 - winfunc = scipy.blackman - #winfunc = scipy.hamming - - f2 = pylab.figure(2) - s2 = f2.add_subplot(1,1,1) - s2.psd(data, NFFT=fftlen, - Fs = nchans*fs, - noverlap=fftlen/4, - window = lambda d: d*winfunc(fftlen)) - s2.set_title(("Output PSD from Channel %d" % channel)) - - f3 = pylab.figure(3) - s3 = f3.add_subplot(1,1,1) - s3.psd(snk_synth.data()[1000:], NFFT=fftlen, - Fs = nchans*fs, - noverlap=fftlen/4, - window = lambda d: d*winfunc(fftlen)) - s3.set_title("Output of Synthesis Filter") - - pylab.show() - -if __name__ == "__main__": - main() diff --git a/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete b/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete deleted file mode 100644 index cd0edaf5c4..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/Makefile.am.obsolete +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -EXTRA_DIST += \ - praxis.txt \ - simpson.h \ - objective_fct.c \ - gen_interpolator_taps.c \ - simpson.c \ - praxis.f - -# if ENABLE_FORTRAN -# noinst_PROGRAMS = gen_interpolator_taps -# noinst_HEADERS = simpson.h -# -# gen_interpolator_taps_SOURCES = gen_interpolator_taps.c objective_fct.c simpson.c praxis.f -# gen_interpolator_taps_LDADD = $(FLIBS) -lm -# -# endif diff --git a/gnuradio-core/src/gen_interpolator_taps/README b/gnuradio-core/src/gen_interpolator_taps/README deleted file mode 100644 index 8fe3e2ba32..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/README +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -This file contains the source for gen_interpolator_taps, a program -which generates optimal interpolator taps for a fractional -interpolator. - -The ideal interpolator requires an infinite tap FIR filter to -realize. We design a separate 8 tap filter for each value of mu, -the fractional delay, that we are interested in. The taps are -selected such that the mean squared error between the ideal frequency -response and the approximation is mininimized over all frequencies of -interest. In this implementation we define ``frequencies of -interest'' as those from -B to +B, where B = 1/(4*Ts), where Ts is the -sampling period. - -For a detailed look at what this is all about, please see Chapter 9 of -"Digital Communication Receivers: Synchronization, Channel Estimation -and Signal Processing" by Meyr, Moeneclaey and Fechtel, ISBN 0-471-50275-8 - -NOTE, if you're running gen_interpolator_taps and it seg faults in -RANDOM, you're probably using g77-2.96. The fix is to use g77 3.0 or later - - cd <top_of_build_tree> - rm config.cache - export F77=g77-3.0.4 - ./configure - make diff --git a/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c b/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c deleted file mode 100644 index 2f359102cf..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/gen_interpolator_taps.c +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> - -#define NSTEPS 10 // how many steps of mu are in the generated table -#define MAX_NSTEPS 256 -#define NTAPS 8 // # of taps in the interpolator -#define MAX_NTAPS 128 - -extern void initpt (double x[], int ntaps); -extern double objective (double x[], int *ntaps); -extern double global_mu; -extern double global_B; - -// fortran -extern double prax2_ (double (fct)(double x[], int *ntaps), - double initv[], int *ntaps, double result[]); - -static void -usage (char *name) -{ - fprintf (stderr, "usage: %s [-v] [-n <nsteps>] [-t <ntaps>] [-B <bw>]\n", name); - exit (1); -} - -static void -printline (double x[], int ntaps, int imu, int nsteps) -{ - int i; - - printf (" { "); - for (i = 0; i < ntaps; i++){ - printf ("%12.5e", x[i]); - if (i != ntaps - 1) - printf (", "); - else - printf (" }, // %3d/%d\n", imu, nsteps); - } -} - -int -main (int argc, char **argv) -{ - double xx[MAX_NSTEPS+1][MAX_NTAPS]; - int ntaps = NTAPS; - int nsteps = NSTEPS; - int i, j; - double result; - double step_size; - int c; - int verbose = 0; - - global_B = 0.25; - - while ((c = getopt (argc, argv, "n:t:B:v")) != EOF){ - switch (c){ - case 'n': - nsteps = strtol (optarg, 0, 0); - break; - - case 't': - ntaps = strtol (optarg, 0, 0); - break; - - case 'B': - global_B = strtod (optarg, 0); - break; - - case 'v': - verbose = 1; - break; - - default: - usage (argv[0]); - break; - } - } - - if ((nsteps & 1) != 0){ - fprintf (stderr, "%s: nsteps must be even\n", argv[0]); - exit (1); - } - - if (nsteps > MAX_NSTEPS){ - fprintf (stderr, "%s: nsteps must be < %d\n", argv[0], MAX_NSTEPS); - exit (1); - } - - if ((ntaps & 1) != 0){ - fprintf (stderr, "%s: ntaps must be even\n", argv[0]); - exit (1); - } - - if (nsteps > MAX_NTAPS){ - fprintf (stderr, "%s: ntaps must be < %d\n", argv[0], MAX_NTAPS); - exit (1); - } - - if (global_B < 0 || global_B > 0.5){ - fprintf (stderr, "%s: bandwidth must be in the range (0, 0.5)\n", argv[0]); - exit (1); - } - - step_size = 1.0/nsteps; - - // the optimizer chokes on the two easy cases (0/N and N/N). We do them by hand... - - for (i = 0; i < ntaps; i++) - xx[0][i] = 0.0; - xx[0][ntaps/2] = 1.0; - - - // compute optimal values for mu <= 0.5 - - for (j = 1; j <= nsteps/2; j++){ - - global_mu = j * step_size; // this determines the MU for which we're computing the taps - - // initialize X to a reasonable starting value - - initpt (&xx[j][0], ntaps); - - // find the value of X that minimizes the value of OBJECTIVE - - result = prax2_ (objective, &xx[j][0], &ntaps, &xx[j][0]); - - if (verbose){ - fprintf (stderr, "Mu: %10.8f\t", global_mu); - fprintf (stderr, "Objective: %g\n", result); - } - } - - // now compute remaining values via symmetry - - for (j = 0; j < nsteps/2; j++){ - for (i = 0; i < ntaps; i++){ - xx[nsteps - j][i] = xx[j][ntaps-i-1]; - } - } - - // now print out the table - - printf ("\ -/*\n\ - * This file was machine generated by gen_interpolator_taps.\n\ - * DO NOT EDIT BY HAND.\n\ - */\n\n"); - - - printf ("static const int NTAPS = %4d;\n", ntaps); - printf ("static const int NSTEPS = %4d;\n", nsteps); - printf ("static const double BANDWIDTH = %g;\n\n", global_B); - - printf ("static const float taps[NSTEPS+1][NTAPS] = {\n"); - printf (" // -4 -3 -2 -1 0 1 2 3 mu\n"); - - - for (i = 0; i <= nsteps; i++) - printline (xx[i], ntaps, i, nsteps); - - printf ("};\n\n"); - - return 0; -} diff --git a/gnuradio-core/src/gen_interpolator_taps/objective_fct.c b/gnuradio-core/src/gen_interpolator_taps/objective_fct.c deleted file mode 100644 index 129486d634..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/objective_fct.c +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * generate MMSE FIR interpolation table values - */ - -#include <math.h> -#include <assert.h> -#include "simpson.h" - -#define MU 0.5 /* the MU for which we're computing coeffs */ - -#define Ts (1.0) /* sampling period */ -#define B (1.0/(4*Ts)) /* one-sided signal bandwidth */ -//#define B (1.0/(8./3*Ts)) /* one-sided signal bandwidth */ - -static unsigned global_n; -static double *global_h; -double global_mu = MU; -double global_B = B; - -/* - * This function computes the difference squared between the ideal - * interpolator frequency response at frequency OMEGA and the - * approximation defined by the FIR coefficients in global_h[] - * - * See eqn (9-7), "Digital Communication Receivers", Meyr, Moeneclaey - * and Fechtel, Wiley, 1998. - */ - -static double -integrand (double omega) -{ - double real_ideal; - double real_approx; - double real_diff; - double imag_ideal; - double imag_approx; - double imag_diff; - - int i, n; - int I1; - double *h; - - real_ideal = cos (omega * Ts * global_mu); - imag_ideal = sin (omega * Ts * global_mu); - - n = global_n; - h = global_h; - I1 = -(n / 2); - - real_approx = 0; - imag_approx = 0; - - for (i = 0; i < n; i++){ - real_approx += h[i] * cos (-omega * Ts * (i + I1)); - imag_approx += h[i] * sin (-omega * Ts * (i + I1)); - } - - real_diff = real_ideal - real_approx; - imag_diff = imag_ideal - imag_approx; - - return real_diff * real_diff + imag_diff * imag_diff; -} - -/* - * Integrate the difference squared over all frequencies of interest. - */ -double -c_fcn (double *x, int n) -{ - assert ((n & 1) == 0); /* assert n is even */ - global_n = n; - global_h = x; - return qsimp (integrand, -2 * M_PI * global_B, 2 * M_PI * global_B); -} - -/* this is the interface expected by the calling fortran code */ - -double -objective (double x[], int *ndim) -{ - return c_fcn (x, *ndim); -} - -static double -si (double x) -{ - if (fabs (x) < 1e-9) - return 1.0; - - return sin(x) / x; -} - -/* - * starting guess for optimization - */ -void initpt (double x[], int ndim) -{ - int i; - for (i = 0; i < ndim; i++){ - x[i] = si (M_PI * ((double) (i - ndim/2) + global_mu)); - } -} diff --git a/gnuradio-core/src/gen_interpolator_taps/praxis.f b/gnuradio-core/src/gen_interpolator_taps/praxis.f deleted file mode 100644 index 9f3e03c977..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/praxis.f +++ /dev/null @@ -1,1705 +0,0 @@ -C -C Copyright 2002 Free Software Foundation, Inc. -C -C This file is part of GNU Radio -C -C GNU Radio is free software; you can redistribute it and/or modify -C it under the terms of the GNU General Public License as published by -C the Free Software Foundation; either version 3, or (at your option) -C any later version. -C -C GNU Radio is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with GNU Radio; see the file COPYING. If not, write to -C the Free Software Foundation, Inc., 51 Franklin Street, -C Boston, MA 02110-1301, USA. -C - DOUBLE PRECISION FUNCTION PRAX2(F,INITV,NDIM,OUT) - DOUBLE PRECISION INITV(128),OUT(128), F - INTEGER NDIM - EXTERNAL F -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - -C - N=NDIM - do 10 I=1,N - 10 X(I) = INITV(I) - -C - call praset - -C -1 produces no diagnostic output - jprint = -1 - nfmax = 3000 -C tighter tolerance - T=1.0D-6 -C - call praxis(f) -C - do 30 I=1,N - 30 OUT(I) = X(I) -C - prax2 = fx - return - end - - - SUBROUTINE PRASET -C -C PRASET 1.0 JUNE 1995 -C -C SET INITIAL VALUES FOR SOME QUANTITIES USED IN SUBROUTINE PRAXIS. -C THE USER CAN RESET THESE, IF DESIRED, -C AFTER CALLING PRASET AND BEFORE CALLING PRAXIS. -C -C J. P. CHANDLER, COMPUTER SCIENCE DEPARTMENT, -C OKLAHOMA STATE UNIVERSITY -C -C ON MANY MACHINES, SUBROUTINE PRAXIS WILL CAUSE UNDERFLOW AND/OR -C DIVIDE CHECK WHEN COMPUTING EPSMCH**4 AND EPSMCH**(-4). -C IN THAT CASE, SET EPSMCH=1.0D-9 (OR POSSIBLY EPSMCH=1.0D-8) -C AFTER CALLING SUBROUTINE PRASET. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER J -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION A,B,XMID,XPLUS,RZERO,UNITR,RTWO -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - RZERO=0.0D0 - UNITR=1.0D0 - RTWO=2.0D0 -C -C NMAX IS THE DIMENSION OF THE ARRAYS V(*,*), X(*), D(*), -C Q0(*), AND Q1(*). -C - NMAX=128 -C -C NFMAX IS THE MAXIMUM NUMBER OF FUNCTION EVALUATIONS PERMITTED. -C - NFMAX=100000 -C -C LP IS THE LOGICAL UNIT NUMBER FOR PRINTED OUTPUT. -C - LP=6 -C -C T IS A CONVERGENCE TOLERANCE USED IN SUBROUTINE PRAXIS. -C - T=1.0D-5 -C -C JPRINT CONTROLS PRINTED OUTPUT IN PRAXIS. -C - JPRINT=4 -C -C H IS AN ESTIMATE OF THE DISTANCE FROM THE INITIAL POINT -C TO THE SOLUTION. -C - H=1.0D0 -C -C USE BISECTION TO COMPUTE THE VALUE OF EPSMCH, "MACHINE EPSILON". -C EPSMCH IS THE SMALLEST FLOATING POINT (REAL OR DOUBLE PRECISION) -C NUMBER WHICH, WHEN ADDED TO ONE, GIVES A RESULT GREATER THAN ONE. -C - A=RZERO - B=UNITR - 10 XMID=A+(B-A)/RTWO - IF(XMID.LE.A .OR. XMID.GE.B) GO TO 20 - XPLUS=UNITR+XMID - IF(XPLUS.GT.UNITR) THEN - B=XMID - ELSE - A=XMID - ENDIF - GO TO 10 -C - 20 EPSMCH=B -C - DO 30 J=1,NMAX - X(J)=RZERO - 30 CONTINUE -C -C JRANCH = 1 TO USE BRENT'S RANDOM, -C JRANCH = 2 TO USE FUNCTION DRANDM. -C - JRANCH=1 -C - CALL RANINI(4.0D0) -C -C DSEED IS AN INITIAL SEED FOR DRANDM, -C A SUBROUTINE THAT GENERATES PSEUDORANDOM NUMBERS -C UNIFORMLY DISTRIBUTED ON (0,1). -C - DSEED=1234567.0D0 -C -C SCBD IS AN UPPER BOUND ON THE SCALE FACTORS IN PRAXIS. -C IF THE AXES MAY BE BADLY SCALED (WHICH IS TO BE AVOIDED IF -C POSSIBLE) THEN SET SCBD = 10, OTHERWISE 1. -C - SCBD=1.0D0 -C -C ILLCIN IS THE INITIAL VALUE OF ILLC, -C THE FLAG THAT SIGNALS AN ILL-CONDITIONED PROBLEM. -C IF THE PROBLEM IS KNOWN TO BE ILL-CONDITIONED SET ILLCIN=1, -C OTHERWISE 0. -C - ILLCIN=0 -C -C KTM IS A CONVERGENCE SWITCH USED IN PRAXIS. -C KTM+1 IS THE NUMBER OF ITERATIONS WITHOUT IMPROVEMENT -C BEFORE THE ALGORITHM TERMINATES. -C KTM=4 IS VERY CAUTIOUS. -C USUALLY KTM=1 IS SATISFACTORY. -C - KTM=1 -C - RETURN -C -C END PRASET -C - END - SUBROUTINE PRAXIS(F) -C -C PRAXIS 2.0 JUNE 1995 -C -C THE PRAXIS PACKAGE MINIMIZES THE FUNCTION F(X,N) OF N -C VARIABLES X(1),...,X(N), USING THE PRINCIPAL AXIS METHOD. -C F MUST BE A SMOOTH (CONTINUOUSLY DIFFERENTIABLE) FUNCTION. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973 (ISBN 0-13-022335-2), -C PAGES 156-167 -C -C TRANSLATED FROM ALGOL W TO A.N.S.I. 1966 STANDARD BASIC FORTRAN -C BY ROSALEE TAYLOR AND SUE PINSKI, COMPUTER SCIENCE DEPARTMENT, -C OKLAHOMA STATE UNIVERSITY (DECEMBER 1973). -C -C UPDATED TO A.N.S.I. STANDARD FORTRAN 77 BY J. P. CHANDLER -C COMPUTER SCIENCE DEPARTMENT, OKLAHOMA STATE UNIVERSITY -C -C -C SUBROUTINE PRAXIS CALLS SUBPROGRAMS -C F, MINX, RANDOM (OR DRANDM), QUAD, MINFIT, SORT. -C -C SUBROUTINE QUAD CALLS MINX. -C -C SUBROUTINE MINX CALLS FLIN. -C -C SUBROUTINE FLIN CALLS F. -C -C -C INPUT QUANTITIES (SET IN THE CALLING PROGRAM)... -C -C F FUNCTION F(X,N) TO BE MINIMIZED -C -C X(*) INITIAL GUESS OF MINIMUM -C -C N DIMENSION OF X (NOTE... N MUST BE .GE. 2) -C -C H MAXIMUM STEP SIZE -C -C T TOLERANCE -C -C EPSMCH MACHINE PRECISION -C -C JPRINT PRINT SWITCH -C -C -C OUTPUT QUANTITIES... -C -C X(*) ESTIMATED POINT OF MINIMUM -C -C FX VALUE OF F AT X -C -C NL NUMBER OF LINEAR SEARCHES -C -C NF NUMBER OF FUNCTION EVALUATIONS -C -C V(*,*) EIGENVECTORS OF A -C NEW DIRECTIONS -C -C D(*) EIGENVALUES OF A -C NEW D -C -C Z(*) SCALE FACTORS -C -C -C ON ENTRY X(*) HOLDS A GUESS. ON RETURN IT HOLDS THE ESTIMATED -C POINT OF MINIMUM, WITH (HOPEFULLY) -C ABS(ERROR) LESS THAN SQRT(EPSMCH)*ABS(X) + T, WHERE -C EPSMCH IS THE MACHINE PRECISION, THE SMALLEST NUMBER SUCH THAT -C (1 + EPSMCH) IS GREATER THAN 1. -C -C T IS A TOLERANCE. -C -C H IS THE MAXIMUM STEP SIZE, SET TO ABOUT THE MAXIMUM EXPECTED -C DISTANCE FROM THE GUESS TO THE MINIMUM. IF H IS SET TOO -C SMALL OR TOO LARGE THEN THE INITIAL RATE OF CONVERGENCE WILL -C BE SLOW. -C -C THE USER SHOULD OBSERVE THE COMMENT ON HEURISTIC NUMBERS -C AT THE BEGINNING OF THE SUBROUTINE. -C -C JPRINT CONTROLS THE PRINTING OF INTERMEDIATE RESULTS. -C IT USES SUBROUTINES FLIN, MINX, QUAD, SORT, AND MINFIT. -C IF JPRINT = 1, F IS PRINTED AFTER EVERY N+1 OR N+2 LINEAR -C MINIMIZATIONS, AND FINAL X IS PRINTED, BUT INTERMEDIATE -C X ONLY IF N IS LESS THAN OR EQUAL TO 4. -C IF JPRINT = 2, EIGENVALUES OF A AND SCALE FACTORS ARE ALSO PRINTED. -C IF JPRINT = 3, F AND X ARE PRINTED AFTER EVERY FEW LINEAR -C MINIMIZATIONS. -C IF JPRINT = 4, EIGENVECTORS ARE ALSO PRINTED. -C IF JPRINT = 5, ADDITIONAL DEBUGGING INFORMATION IS ALSO PRINTED. -C -C RANDOM RETURNS A RANDOM NUMBER UNIFORMLY DISTRIBUTED IN (0, 1). -C -C THIS SUBROUTINE IS MACHINE-INDEPENDENT, APART FROM THE -C SPECIFICATION OF EPSMCH. WE ASSUME THAT EPSMCH**(-4) DOES NOT -C OVERFLOW (IF IT DOES THEN EPSMCH MUST BE INCREASED), AND THAT ON -C FLOATING-POINT UNDERFLOW THE RESULT IS SET TO ZERO. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER ILLC,I,IK,IM,IMU,J,K,KL,KM1,KT,K2 -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION F, Y,Z,E, DABS,DSQRT,ZABS,ZSQRT,DRANDM, - * HUNDRD,HUNDTH,ONE,PT9,RHALF,TEN,TENTH,TWO,ZERO, - * DF,DLDFAC,DN,F1,XF,XL,T2,RANVAL,ARG, - * VLARGE,VSMALL,XLARGE,XLDS,FXVALU,F1VALU,S,SF,SL -C - EXTERNAL F -C - DIMENSION Y(128),Z(128),E(128) -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - ZABS(ARG)=DABS(ARG) - ZSQRT(ARG)=DSQRT(ARG) -C -C INITIALIZATION... -C - RHALF=0.5D0 - ONE=1.0D0 - TENTH=0.1D0 - HUNDTH=0.01D0 - HUNDRD=100.0D0 - ZERO=0.0D0 - PT9=0.9D0 - TEN=10.0D0 - TWO=2.0D0 -C -C MACHINE DEPENDENT NUMBERS... -C -C ON MANY COMPUTERS, VSMALL WILL UNDERFLOW, -C AND COMPUTING XLARGE MAY CAUSE A DIVISION BY ZERO. -C IN THAT CASE, EPSMCH SHOULD BE SET EQUAL TO 1.0D-9 -C (OR POSSIBLY 1.0D-8) BEFORE CALLING PRAXIS. -C - SMALL=EPSMCH*EPSMCH - VSMALL=SMALL*SMALL - XLARGE=ONE/SMALL - VLARGE=ONE/VSMALL - XM2=ZSQRT(EPSMCH) - XM4=ZSQRT(XM2) -C -C HEURISTIC NUMBERS... -C -C IF THE AXES MAY BE BADLY SCALED (WHICH IS TO BE AVOIDED IF -C POSSIBLE) THEN SET SCBD = 10, OTHERWISE 1. -C -C IF THE PROBLEM IS KNOWN TO BE ILL-CONDITIONED SET ILLC = 1, -C OTHERWISE 0. -C -C KTM+1 IS THE NUMBER OF ITERATIONS WITHOUT IMPROVEMENT -C BEFORE THE ALGORITHM TERMINATES. -C KTM=4 IS VERY CAUTIOUS. -C USUALLY KTM=1 IS SATISFACTORY. -C -C BRENT RECOMMENDED THE FOLLOWING VALUES FOR MOST PROBLEMS... -C -C SCBD=1.0 -C ILLC=0 -C KTM=1 -C -C SCBD, ILLCIN, AND KTM ARE NOW IN COMMON. -C THEY ARE INITIALIZED IN SUBROUTINE PRASET, -C AND CAN BE RESET BY THE USER AFTER CALLING PRASET. -C - ILLC=ILLCIN -C - IF(ILLC.EQ.1) THEN - DLDFAC=TENTH - ELSE - DLDFAC=HUNDTH - ENDIF -C - KT=0 - NL=0 - NF=1 - FX=F(X,N) - QF1=FX - T=SMALL+ZABS(T) - T2=T - DMIN=SMALL - IF(H.LT.HUNDRD*T) H=HUNDRD*T - XLDT=H -C - DO 20 I=1,N - DO 10 J=1,N - V(I,J)=ZERO - 10 CONTINUE - V(I,I)=ONE - 20 CONTINUE -C - QD0=ZERO - D(1)=ZERO -C -C Q0(*) AND Q1(*) ARE PREVIOUS X(*) POINTS, -C INITIALIZED IN PRAXIS, USED IN FLIN, -C AND CHANGED IN QUAD. -C - DO 30 I=1,N - Q1(I)=X(I) -C -C Q0(*) WAS NOT INITIALIZED IN BRENT'S ALGOL PROCEDURE. -C - Q0(I)=X(I) - 30 CONTINUE -C - IF(JPRINT.GT.0) THEN - WRITE(LP,40)NL,NF,FX - 40 FORMAT(/' NL =',I10,5X,'NF =',I10/5X,'FX =',1PG15.7) -C - IF(N.LE.4 .OR. JPRINT.GT.2) THEN - WRITE(LP,50)(X(I),I=1,N) - 50 FORMAT(/8X,'X'/(1X,1PG15.7,4G15.7)) - ENDIF - ENDIF -C -C MAIN LOOP... -C LABEL L0... -C - 60 SF=D(1) - S=ZERO - D(1)=ZERO -C -C MINIMIZE ALONG THE FIRST DIRECTION. -C - IF(JPRINT.GE.5) WRITE(LP,70)D(1),S,FX - 70 FORMAT(/' CALL NO. 1 TO MINX.'/ - * 5X,'D(1) =',1PG15.7,5X,'S =',G15.7,5X,'FX =',G15.7) -C - FXVALU=FX - CALL MINX(1,2,D(1),S,FXVALU,0,F) -C - IF(S.LE.ZERO) THEN - DO 80 I=1,N - V(I,1)=-V(I,1) - 80 CONTINUE - ENDIF -C - IF(SF.LE.PT9*D(1) .OR. PT9*SF.GE.D(1)) THEN -C - IF(N.GE.2) THEN - DO 90 I=2,N - D(I)=ZERO - 90 CONTINUE - ENDIF -C - ENDIF -C - IF(N.LT.2) GO TO 320 - DO 310 K=2,N -C - DO 100 I=1,N - Y(I)=X(I) - 100 CONTINUE -C - SF=FX - IF(KT.GT.0) ILLC=1 -C -C LABEL L1... -C - 110 KL=K - DF=ZERO -C - IF(ILLC.EQ.1) THEN -C -C TAKE A RANDOM STEP TO GET OUT OF A RESOLUTION VALLEY. -C -C PRAXIS ASSUMES THAT RANDOM (OR DRANDM) RETURNS -C A PSEUDORANDOM NUMBER UNIFORMLY DISTRIBUTED IN (0,1), -C AND THAT ANY INITIALIZATION OF THE RANDOM NUMBER GENERATOR -C HAS ALREADY BEEN DONE. -C - DO 130 I=1,N -C - IF(JRANCH.EQ.1) THEN - CALL RANDOM(RANVAL) - ELSE - RANVAL=DRANDM(DSEED) - ENDIF -C - S=(TENTH*XLDT+T2*TEN**KT)*(RANVAL-RHALF) - Z(I)=S -C - DO 120 J=1,N - X(J)=X(J)+S*V(J,I) - 120 CONTINUE - 130 CONTINUE -C - FX=F(X,N) - NF=NF+1 -C - IF(JPRINT.GE.1) WRITE(LP,140)NF,SF,FX - 140 FORMAT(/' ***** RANDOM STEP IN PRAXIS. NF =',I11/ - * 5X,'SF =',1PG15.7,5X,'FX =',G15.7) - ENDIF -C - IF(K.GT.N) GO TO 170 - DO 160 K2=K,N - SL=FX - S=ZERO -C -C MINIMIZE ALONG NON-CONJUGATE DIRECTIONS. -C - IF(JPRINT.GE.5) WRITE(LP,150)K2,D(K2),S,FX - 150 FORMAT(/' CALL NO. 2 TO MINX.'/ - * 5X,'K2 =',I4,5X,'D(K2) =',1PG15.7,5X, - * 'S =',G15.7/5X,'FX =',G15.7) -C - FXVALU=FX - CALL MINX(K2,2,D(K2),S,FXVALU,0,F) -C - IF(ILLC.EQ.1) THEN - S=D(K2)*(S+Z(K2))**2 - ELSE - S=SL-FX - ENDIF -C - IF(DF.LT.S) THEN - DF=S - KL=K2 - ENDIF - 160 CONTINUE -C - 170 IF(ILLC.EQ.0 .AND. DF.LT.ZABS(HUNDRD*EPSMCH*FX)) THEN -C -C NO SUCCESS WITH ILLC=0, SO TRY ONCE WITH ILLC=1 . -C - ILLC=1 -C -C GO TO L1. -C - GO TO 110 - ENDIF -C - IF(K.EQ.2 .AND. JPRINT.GT.1) THEN - WRITE(LP,180)(D(I),I=1,N) - 180 FORMAT(/' NEW D'/(1X,1PG15.7,4G15.7)) - ENDIF -C - KM1=K-1 - IF(KM1.LT.1) GO TO 210 - DO 200 K2=1,KM1 -C -C MINIMIZE ALONG CONJUGATE DIRECTIONS. -C - IF(JPRINT.GE.5) WRITE(LP,190)K2,D(K2),S,FX - 190 FORMAT(/' CALL NO. 3 TO MINX.'/ - * 5X,'K2 =',I4,5X,'D(K2) =',1PG15.7,5X, - * 'S =',G15.7/5X,'FX =',G15.7) -C - S=ZERO - FXVALU=FX - CALL MINX(K2,2,D(K2),S,FXVALU,0,F) - 200 CONTINUE -C - 210 F1=FX - FX=SF -C - XLDS=ZERO - DO 220 I=1,N - SL=X(I) - X(I)=Y(I) - SL=SL-Y(I) - Y(I)=SL - XLDS=XLDS+SL*SL - 220 CONTINUE -C - XLDS=ZSQRT(XLDS) - IF(XLDS.GT.SMALL) THEN -C -C THROW AWAY THE DIRECTION KL AND MINIMIZE ALONG -C THE NEW CONJUGATE DIRECTION. -C - IK=KL-1 - IF(K.GT.IK) GO TO 250 - DO 240 IM=K,IK - I=IK-IM+K -C - DO 230 J=1,N - V(J,I+1)=V(J,I) - 230 CONTINUE -C - D(I+1)=D(I) - 240 CONTINUE -C - 250 D(K)=ZERO -C - DO 260 I=1,N - V(I,K)=Y(I)/XLDS - 260 CONTINUE -C - IF(JPRINT.GE.5) WRITE(LP,270)K,D(K),XLDS,F1 - 270 FORMAT(/' CALL NO. 4 TO MINX.'/ - * 5X,'K =',I4,5X,'D(K) =',1PG15.7,5X, - * 'XLDS =',G15.7/5X,'F1 =',G15.7) -C - F1VALU=F1 - CALL MINX(K,4,D(K),XLDS,F1VALU,1,F) -C - IF(XLDS.LE.ZERO) THEN - XLDS=-XLDS -C - DO 280 I=1,N - V(I,K)=-V(I,K) - 280 CONTINUE - ENDIF - ENDIF -C - XLDT=DLDFAC*XLDT - IF(XLDT.LT.XLDS) XLDT=XLDS -C - IF(JPRINT.GT.0) THEN - WRITE(LP,40)NL,NF,FX - IF(N.LE.4 .OR. JPRINT.GT.2) THEN - WRITE(LP,50)(X(I),I=1,N) - ENDIF - ENDIF -C - T2=ZERO - DO 290 I=1,N - T2=T2+X(I)**2 - 290 CONTINUE - T2=XM2*ZSQRT(T2)+T -C -C SEE IF THE STEP LENGTH EXCEEDS HALF THE TOLERANCE. -C - IF(XLDT.GT.RHALF*T2) THEN - KT=0 - ELSE - KT=KT+1 - ENDIF -C -C IF(...) GO TO L2 -C - IF(KT.GT.KTM) GO TO 550 -C - IF(NF.GE.NFMAX) THEN - WRITE(LP,300)NFMAX - 300 FORMAT(/' IN PRAXIS, NF REACHED THE LIMIT NFMAX =',I11/ - * 5X,'THIS IS AN ABNORMAL TERMINATION.'/ - * 5X,'THE FUNCTION HAS NOT BEEN MINIMIZED AND', - * ' THE RESULTING X(*) VECTOR SHOULD NOT BE USED.') - GO TO 550 - ENDIF -C - 310 CONTINUE -C -C TRY QUADRATIC EXTRAPOLATION IN CASE WE ARE STUCK IN A CURVED VALLEY. -C - 320 CALL QUAD(F) -C - DN=ZERO - DO 330 I=1,N - D(I)=ONE/ZSQRT(D(I)) - IF(DN.LT.D(I)) DN=D(I) - 330 CONTINUE -C - IF(JPRINT.GT.3) THEN -C - WRITE(LP,340) - 340 FORMAT(/' NEW DIRECTIONS') -C - DO 360 I=1,N - WRITE(LP,350)I,(V(I,J),J=1,N) - 350 FORMAT(1X,I5,4X,1PG15.7,4G15.7/(10X,5G15.7)) - 360 CONTINUE - ENDIF -C - DO 380 J=1,N -C - S=D(J)/DN - DO 370 I=1,N - V(I,J)=S*V(I,J) - 370 CONTINUE - 380 CONTINUE -C - IF(SCBD.GT.ONE) THEN -C -C SCALE THE AXES TO TRY TO REDUCE THE CONDITION NUMBER. -C - S=VLARGE - DO 400 I=1,N -C - SL=ZERO - DO 390 J=1,N - SL=SL+V(I,J)**2 - 390 CONTINUE -C - Z(I)=ZSQRT(SL) - IF(Z(I).LT.XM4) Z(I)=XM4 - IF(S.GT.Z(I)) S=Z(I) - 400 CONTINUE -C - DO 410 I=1,N - SL=S/Z(I) - Z(I)=ONE/SL -C - IF(Z(I).GT.SCBD) THEN - SL=ONE/SCBD - Z(I)=SCBD - ENDIF -C -C IT APPEARS THAT THERE ARE TWO MISSING END; STATEMENTS -C AT THIS POINT IN BRENT'S LISTING. -C - 410 CONTINUE - ENDIF -C -C TRANSPOSE V FOR MINFIT. -C - IF(N.LT.2) GO TO 440 - DO 430 I=2,N -C - IMU=I-1 - DO 420 J=1,IMU - S=V(I,J) - V(I,J)=V(J,I) - V(J,I)=S - 420 CONTINUE - 430 CONTINUE -C -C FIND THE SINGULAR VALUE DECOMPOSITION OF V. -C THIS GIVES THE EIGENVALUES AND PRINCIPAL AXES -C OF THE APPROXIMATING QUADRATIC FORM -C WITHOUT SQUARING THE CONDITION NUMBER. -C - 440 CALL MINFIT(N,EPSMCH,VSMALL,V,D,E,NMAX,LP) -C - IF(SCBD.GT.ONE) THEN -C -C UNSCALING... -C - DO 460 I=1,N -C - S=Z(I) - DO 450 J=1,N - V(I,J)=S*V(I,J) - 450 CONTINUE - 460 CONTINUE -C - DO 490 I=1,N -C - S=ZERO - DO 470 J=1,N - S=S+V(J,I)**2 - 470 CONTINUE - S=ZSQRT(S) -C - D(I)=S*D(I) -C - S=ONE/S - DO 480 J=1,N - V(J,I)=S*V(J,I) - 480 CONTINUE - 490 CONTINUE - ENDIF -C - DO 500 I=1,N -C - IF(DN*D(I).GT.XLARGE) THEN - D(I)=VSMALL - ELSE IF(DN*D(I).LT.SMALL) THEN - D(I)=VLARGE - ELSE - D(I)=ONE/(DN*D(I))**2 - ENDIF - 500 CONTINUE -C -C SORT THE NEW EIGENVALUES AND EIGENVECTORS. -C - CALL SORT -C - DMIN=D(N) - IF(DMIN.LT.SMALL) DMIN=SMALL -C - IF(XM2*D(1).GT.DMIN) THEN - ILLC=1 - ELSE - ILLC=0 - ENDIF -C - IF(JPRINT.GT.1 .AND. SCBD.GT.ONE) THEN - WRITE(LP,510)(Z(I),I=1,N) - 510 FORMAT(/' SCALE FACTORS'/(1X,1PG15.7,4G15.7)) - ENDIF -C - IF(JPRINT.GT.1) THEN - WRITE(LP,520)(D(I),I=1,N) - 520 FORMAT(/' EIGENVALUES OF A'/(1X,1PG15.7,4G15.7)) - ENDIF -C - IF(JPRINT.GT.3) THEN -C - WRITE(LP,530) - 530 FORMAT(/' EIGENVECTORS OF A') -C - DO 540 I=1,N - WRITE(LP,350)I,(V(I,J),J=1,N) - 540 CONTINUE - ENDIF -C -C GO BACK TO THE MAIN LOOP. -C GO TO L0 -C -C HANDLE THE CASE N .EQ. 1 IN AN AD HOC WAY. -C (BRENT DID NOT PROVIDE FOR THIS CASE.) -C - IF(N.GE.2) GO TO 60 -C -C LABEL L2... -C - 550 IF(JPRINT.GT.0) THEN - WRITE(LP,560)(X(I),I=1,N) - 560 FORMAT(//7X,'X'/(1X,1PG15.7,4G15.7)) - ENDIF -C - FX=F(X,N) -C - IF(JPRINT.GE.0) WRITE(LP,570)FX,NL,NF - 570 FORMAT(/' EXIT PRAXIS. FX =',1PG25.17,5X,'NL =',I8, - * 5X,'NF =',I9) -C - RETURN -C -C END PRAXIS -C - END - SUBROUTINE QUAD(F) -C -C THIS SUBROUTINE LOOKS FOR THE MINIMUM ALONG -C A CURVE DEFINED BY Q0, Q1, AND X. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGE 161 -C -C SUBROUTINE QUAD IS CALLED BY SUBROUTINE PRAXIS. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER I -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION F, DSQRT,ZSQRT,ARG, - * ONE,QA,QB,QC,S,TWO,XL,ZERO,QF1VAL -C - EXTERNAL F -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - ZSQRT(ARG)=DSQRT(ARG) -C - ZERO=0.0D0 - ONE=1.0D0 -C - S=FX - FX=QF1 - QF1=S - QD1=ZERO -C - DO 10 I=1,N - S=X(I) - XL=Q1(I) - X(I)=XL - Q1(I)=S - QD1=QD1+(S-XL)**2 - 10 CONTINUE -C - QD1=ZSQRT(QD1) - XL=QD1 - S=ZERO -C - IF(QD0.GT.ZERO .AND. QD1.GT.ZERO .AND. NL.GE.3*N*N) THEN -C - IF(JPRINT.GE.1) WRITE(LP,20)NF,QD0,QD1,FX,QF1 - 20 FORMAT(/' ***** CALL MINX FROM QUAD. NF =',I11/ - * 5X,'QD0 =',1PG15.7,5X,'QD1 =',G15.7/ - * 5X,'FX =',G15.7,5X,'QF1 =',G15.7) -C - QF1VAL=QF1 - CALL MINX(0,2,S,XL,QF1VAL,1,F) - QA=XL*(XL-QD1)/(QD0*(QD0+QD1)) - QB=(XL+QD0)*(QD1-XL)/(QD0*QD1) - QC=XL*(XL+QD0)/(QD1*(QD0+QD1)) - ELSE - FX=QF1 - QA=ZERO - QB=ZERO - QC=ONE - ENDIF -C - QD0=QD1 -C - DO 30 I=1,N - S=Q0(I) - Q0(I)=X(I) - X(I)=QA*S+QB*X(I)+QC*Q1(I) - 30 CONTINUE -C - RETURN -C -C END QUAD -C - END - SUBROUTINE MINX(J,NITS,D2,X1,F1,IFK,F) -C -C SUBROUTINE MINX MINIMIZES F FROM X IN THE DIRECTION V(*,J) -C UNLESS J IS LESS THAN 1, WHEN A QUADRATIC SEARCH IS DONE IN -C THE PLANE DEFINED BY Q0, Q1, AND X. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 159-160 -C -C SUBROUTINE MINX IS CALLED BY SUBROUTINES PRAXIS AND QUAD. -C -C D2 AND X1 RETURN RESULTS. -C J, NITS, F1 AND IFK ARE VALUE PARAMETERS THAT RETURN NOTHING. -C DO NOT SEND A COMMON VARIABLE TO MINX FOR PARAMETER F1. -C -C -C D2 IS AN APPROXIMATION TO HALF OF -C THE SECOND DERIVATIVE OF F (OR ZERO). -C -C X1 IS AN ESTIMATE OF DISTANCE TO MINIMUM, -C RETURNED AS THE DISTANCE FOUND. -C -C IF IFK = 1 THEN F1 IS FLIN(X1), OTHERWISE X1 AND F1 ARE -C IGNORED ON ENTRY UNLESS FINAL FX IS GREATER THAN F1. -C -C NITS CONTROLS THE NUMBER OF TIMES AN ATTEMPT IS MADE TO -C HALVE THE INTERVAL. -C - EXTERNAL F -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER IFK,J,NITS, I,IDZ,K -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION D2,X1, - * DABS,DSQRT,ZABS,ZSQRT,ARG, - * HUNDTH,RHALF,TWO,ZERO, - * DENOM,D1,FM,F0,F1,F2,S,SF1,SX1,T2,XM,X2 -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - ZSQRT(ARG)=DSQRT(ARG) - ZABS(ARG)=DABS(ARG) -C - HUNDTH=0.01D0 - ZERO=0.0D0 - TWO=2.0D0 - RHALF=0.5D0 -C - SF1=F1 - SX1=X1 - K=0 - XM=ZERO - FM=FX - F0=FX -C - IF(D2.LT.EPSMCH) THEN - IDZ=1 - ELSE - IDZ=0 - ENDIF -C -C FIND THE STEP SIZE. -C - S=ZERO - DO 10 I=1,N - S=S+X(I)**2 - 10 CONTINUE - S=ZSQRT(S) -C - IF(IDZ.EQ.1) THEN - DENOM=DMIN - ELSE - DENOM=D2 - ENDIF -C - T2=XM4*ZSQRT(ZABS(FX)/DENOM+S*XLDT)+XM2*XLDT - S=XM4*S+T - IF(IDZ.EQ.1 .AND. T2.GT.S) T2=S - IF(T2.LT.SMALL) T2=SMALL - IF(T2.GT.HUNDTH*H) T2=HUNDTH*H -C - IF(IFK.EQ.1 .AND. F1.LE.FM) THEN - XM=X1 - FM=F1 - ENDIF -C - IF(IFK.EQ.0 .OR. ZABS(X1).LT.T2) THEN -C - IF(X1.GE.ZERO) THEN - X1=T2 - ELSE - X1=-T2 - ENDIF -C - CALL FLIN(X1,J,F,F1) - ENDIF -C - IF(F1.LT.FM) THEN - XM=X1 - FM=F1 - ENDIF -C -C LABEL L0... -C - 20 IF(IDZ.EQ.1) THEN -C -C EVALUATE FLIN AT ANOTHER POINT, -C AND ESTIMATE THE SECOND DERIVATIVE. -C - IF(F0.LT.F1) THEN - X2=-X1 - ELSE - X2=TWO*X1 - ENDIF -C - CALL FLIN(X2,J,F,F2) -C - IF(F2.LE.FM) THEN - XM=X2 - FM=F2 - ENDIF -C - D2=(X2*(F1-F0)-X1*(F2-F0))/(X1*X2*(X1-X2)) -C - IF(JPRINT.GE.5) WRITE(LP,30)X1,X2,F0,F1,F2,D2 - 30 FORMAT(/' COMPUTE D2 IN SUBROUTINE MINX.'/ - * 5X,'X1 =',1PG15.7,5X,'X2 =',G15.7/ - * 5X,'F0 =',G15.7,5X,'F1 =',G15.7,5X,'F2 =',G15.7/ - * 5X,'D2 =',G15.7) - ENDIF -C -C ESTIMATE THE FIRST DERIVATIVE AT 0. -C - D1=(F1-F0)/X1-X1*D2 - IDZ=1 -C -C PREDICT THE MINIMUM. -C - IF(D2.LE.SMALL) THEN -C - IF(D1.LT.ZERO) THEN - X2=H - ELSE - X2=-H - ENDIF -C - ELSE - X2=-RHALF*D1/D2 - ENDIF -C - IF(ZABS(X2).GT.H) THEN -C - IF(X2.GT.ZERO) THEN - X2=H - ELSE - X2=-H - ENDIF - ENDIF -C -C EVALUATE F AT THE PREDICTED MINIMUM. -C LABEL L1... -C - 40 CALL FLIN(X2,J,F,F2) -C - IF(K.LT.NITS .AND. F2.GT.F0) THEN -C -C NO SUCCESS, SO TRY AGAIN. -C - K=K+1 -C -C IF(...) GO TO L0 -C - IF(F0.LT.F1 .AND. X1*X2.GT.ZERO) GO TO 20 - X2=X2/TWO -C -C GO TO L1 -C - GO TO 40 -C - ENDIF -C -C INCREMENT THE ONE-DIMENSIONAL SEARCH COUNTER. -C - NL=NL+1 -C - IF(F2.GT.FM) THEN - X2=XM - ELSE - FM=F2 - ENDIF -C -C GET A NEW ESTIMATE OF THE SECOND DERIVATIVE. -C - IF(ZABS(X2*(X2-X1)).GT.SMALL) THEN - D2=(X2*(F1-F0)-X1*(FM-F0))/(X1*X2*(X1-X2)) -C - IF(JPRINT.GE.5) WRITE(LP,50)X1,X2,F0,FM,F1,D2 - 50 FORMAT(/' RECOMPUTE D2 IN SUBROUTINE MINX.'/ - * 5X,'X1 =',1PG15.7,5X,'X2 =',G15.7/ - * 5X,'F0 =',G15.7,5X,'FM =',G15.7,5X,'F1 =',G15.7/ - * 5X,'D2 =',G15.7) -C - ELSE IF(K.GT.0) THEN - D2=ZERO -C - IF(JPRINT.GE.5) WRITE(LP,60) - 60 FORMAT(/' SET D2=0 IN SUBROUTINE MINX.') - ELSE - D2=D2 - ENDIF -C - IF(D2.LE.SMALL) THEN - D2=SMALL -C - IF(JPRINT.GE.5) WRITE(LP,70)D2 - 70 FORMAT(/' SET D2=SMALL=',1PG15.7,' IN SUBROUTINE MINX.') - ENDIF -C - IF(JPRINT.GE.5) WRITE(LP,80)X1,X2,FX,FM,SF1 - 80 FORMAT(/' SUBROUTINE MINX. X1 =',1PG15.7,5X,'X2 =',G15.7/ - * 5X,'FX =',G15.7,5X,'FM =',G15.7,5X,'SF1 =',G15.7) -C - X1=X2 - FX=FM - IF(SF1.LT.FX) THEN - FX=SF1 - X1=SX1 - ENDIF -C -C UPDATE X FOR A LINEAR SEARCH BUT NOT FOR A PARABOLIC SEARCH. -C - IF(J.GT.0) THEN -C - DO 90 I=1,N - X(I)=X(I)+X1*V(I,J) - 90 CONTINUE - ENDIF -C - IF(JPRINT.GE.5) WRITE(LP,100)D2,X1,F1,FX - 100 FORMAT(/' LEAVE SUBROUTINE MINX.'/ - * 5X,'D2 =',1PG15.7,5X,'X1 =',G15.7,5X,'F1 =',G15.7/ - * 5X,'FX =',G15.7) -C - RETURN -C -C END MINX -C - END - SUBROUTINE FLIN(XL,J,F,FLN) -C -C FLIN IS A FUNCTION OF ONE VARIABLE XL WHICH IS MINIMIZED BY -C SUBROUTINE MINX. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 159-160 -C -C SUBROUTINE FLIN IS CALLED BY SUBROUTINE MINX. -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER J, I -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION XL,F,FLN, TT, QA,QB,QC -C - DIMENSION TT(128) -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - IF(J.GT.0) THEN -C -C LINEAR SEARCH... -C - DO 10 I=1,N - TT(I)=X(I)+XL*V(I,J) - 10 CONTINUE -C - ELSE -C -C SEARCH ALONG A PARABOLIC SPACE CURVE. -C - QA=XL*(XL-QD1)/(QD0*(QD0+QD1)) - QB=(XL+QD0)*(QD1-XL)/(QD0*QD1) - QC=XL*(XL+QD0)/(QD1*(QD0+QD1)) -C - DO 20 I=1,N - TT(I)=QA*Q0(I)+QB*X(I)+QC*Q1(I) - 20 CONTINUE - ENDIF -C -C INCREMENT FUNCTION EVALUATION COUNTER. -C - NF=NF+1 - FLN=F(TT,N) -C - RETURN -C -C END FLIN -C - END - SUBROUTINE MINFIT(N,EPS,TOL,AB,Q,E,NMAX,LP) -C -C AN IMPROVED VERSION OF MINFIT, RESTRICTED TO M=N, P=0. -C SEE GOLUB AND REINSCH (1970). -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 156-158 -C -C G. H. GOLUB AND C. REINSCH, -C "SINGULAR VALUE DECOMPOSITION AND LEAST SQUARES SOLUTIONS', -C NUMERISCHE MATHEMATIK 14 (1970) PAGES 403-420 -C -C THE SINGULAR VALUES OF THE ARRAY AB ARE RETURNED IN Q, -C AND AB IS OVERWRITTEN WITH THE ORTHOGONAL MATRIX V SUCH THAT -C U.DIAG(Q)=AB.V, WHERE U IS ANOTHER ORTHOGONAL MATRIX. -C -C SUBROUTINE MINFIT IS CALLED BY SUBROUTINE PRAXIS. -C - INTEGER N,NMAX,LP, - * I,II,J,JTHIRT,K,KK,KT,L,LL2,LPI,L2 -C - DOUBLE PRECISION EPS,TOL,AB,Q,E, - * DABS,DSQRT,ZABS,ZSQRT,ARG, - * C,DENOM,F,G,H,ONE,X,Y,Z,ZERO,S,TWO -C - DIMENSION AB(NMAX,N),Q(N),E(N) -C - ZABS(ARG)=DABS(ARG) - ZSQRT(ARG)=DSQRT(ARG) -C - JTHIRT=30 -C - ZERO=0.0D0 - ONE=1.0D0 - TWO=2.0D0 -C -C HOUSEHOLDER'S REDUCTION TO BIDIAGONAL FORM... -C - X=ZERO - G=ZERO -C - DO 140 I=1,N - E(I)=G - S=ZERO - L=I+1 -C - DO 10 J=I,N - S=S+AB(J,I)**2 - 10 CONTINUE -C - IF(S.LT.TOL) THEN - G=ZERO - ELSE - F=AB(I,I) -C - IF(F.LT.ZERO) THEN - G=ZSQRT(S) - ELSE - G=-ZSQRT(S) - ENDIF -C - H=F*G-S - AB(I,I)=F-G -C - IF(L.GT.N) GO TO 60 - DO 50 J=L,N -C - F=ZERO - IF(I.GT.N) GO TO 30 - DO 20 K=I,N - F=F+AB(K,I)*AB(K,J) - 20 CONTINUE - 30 F=F/H -C - IF(I.GT.N) GO TO 50 - DO 40 K=I,N - AB(K,J)=AB(K,J)+F*AB(K,I) - 40 CONTINUE - 50 CONTINUE - ENDIF -C - 60 Q(I)=G - S=ZERO -C - IF(I.LE.N) THEN -C - IF(L.GT.N) GO TO 80 - DO 70 J=L,N - S=S+AB(I,J)**2 - 70 CONTINUE - ENDIF -C - 80 IF(S.LT.TOL) THEN - G=ZERO - ELSE - F=AB(I,I+1) -C - IF(F.LT.ZERO) THEN - G=ZSQRT(S) - ELSE - G=-ZSQRT(S) - ENDIF -C - H=F*G-S - AB(I,I+1)=F-G - IF(L.GT.N) GO TO 130 - DO 90 J=L,N - E(J)=AB(I,J)/H - 90 CONTINUE -C - DO 120 J=L,N -C - S=ZERO - DO 100 K=L,N - S=S+AB(J,K)*AB(I,K) - 100 CONTINUE -C - DO 110 K=L,N - AB(J,K)=AB(J,K)+S*E(K) - 110 CONTINUE - 120 CONTINUE - ENDIF -C - 130 Y=ZABS(Q(I))+ZABS(E(I)) -C - IF(Y.GT.X) X=Y - 140 CONTINUE -C -C ACCUMULATION OF RIGHT-HAND TRANSFORMATIONS... -C - DO 210 II=1,N - I=N-II+1 -C - IF(G.NE.ZERO) THEN - H=AB(I,I+1)*G -C - IF(L.GT.N) GO TO 200 - DO 150 J=L,N - AB(J,I)=AB(I,J)/H - 150 CONTINUE -C - DO 180 J=L,N -C - S=ZERO - DO 160 K=L,N - S=S+AB(I,K)*AB(K,J) - 160 CONTINUE -C - DO 170 K=L,N - AB(K,J)=AB(K,J)+S*AB(K,I) - 170 CONTINUE - 180 CONTINUE - ENDIF -C - IF(L.GT.N) GO TO 200 - DO 190 J=L,N - AB(J,I)=ZERO - AB(I,J)=ZERO - 190 CONTINUE -C - 200 AB(I,I)=ONE - G=E(I) - L=I - 210 CONTINUE -C -C DIAGONALIZATION OF THE BIDIAGONAL FORM... -C - EPS=EPS*X - DO 330 KK=1,N - K=N-KK+1 - KT=0 -C -C LABEL TESTFSPLITTING... -C - 220 KT=KT+1 -C - IF(KT.GT.JTHIRT) THEN - E(K)=ZERO - WRITE(LP,230) - 230 FORMAT(' QR FAILED.') - ENDIF -C - DO 240 LL2=1,K - L2=K-LL2+1 - L=L2 -C -C IF(...) GO TO TESTFCONVERGENCE -C - IF(ZABS(E(L)).LE.EPS) GO TO 270 -C -C IF(...) GO TO CANCELLATION -C - IF(ZABS(Q(L-1)).LE.EPS) GO TO 250 - 240 CONTINUE -C -C CANCELLATION OF E(L) IF L IS GREATER THAN 1... -C LABEL CANCELLATION... -C - 250 C=ZERO - S=ONE - IF(L.GT.K) GO TO 270 - DO 260 I=L,K - F=S*E(I) - E(I)=C*E(I) -C -C IF(...) GO TO TESTFCONVERGENCE -C - IF(ZABS(F).LE.EPS) GO TO 270 - G=Q(I) -C - IF(ZABS(F).LT.ZABS(G)) THEN - H=ZABS(G)*ZSQRT(ONE+(F/G)**2) - ELSE IF(F.NE.ZERO) THEN - H=ZABS(F)*ZSQRT(ONE+(G/F)**2) - ELSE - H=ZERO - ENDIF -C - Q(I)=H -C - IF(H.EQ.ZERO) THEN - H=ONE - G=ONE - ENDIF -C -C THE ABOVE REPLACES Q(I) AND H BY SQUARE ROOT OF (G*G+F*F) -C WHICH MAY GIVE INCORRECT RESULTS IF THE SQUARES UNDERFLOW OR IF -C F = G = 0 . -C - C=G/H - S=-F/H - 260 CONTINUE -C -C LABEL TESTFCONVERGENCE... -C - 270 Z=Q(K) -C -C IF(...) GO TO CONVERGENCE -C - IF(L.EQ.K) GO TO 310 -C -C SHIFT FROM BOTTOM 2*2 MINOR. -C - X=Q(L) - Y=Q(K-1) - G=E(K-1) - H=E(K) - F=((Y-Z)*(Y+Z)+(G-H)*(G+H))/(TWO*H*Y) - G=ZSQRT(F*F+ONE) -C - IF(F.LT.ZERO) THEN - DENOM=F-G - ELSE - DENOM=F+G - ENDIF -C - F=((X-Z)*(X+Z)+H*(Y/DENOM-H))/X -C -C NEXT QR TRANSFORMATION... -C - S=ONE - C=ONE - LPI=L+1 - IF(LPI.GT.K) GO TO 300 - DO 290 I=LPI,K - G=E(I) - Y=Q(I) - H=S*G - G=G*C -C - IF(ZABS(F).LT.ZABS(H)) THEN - Z=ZABS(H)*ZSQRT(ONE+(F/H)**2) - ELSE IF(F.NE.ZERO) THEN - Z=ZABS(F)*ZSQRT(ONE+(H/F)**2) - ELSE - Z=ZERO - ENDIF -C - E(I-1)=Z -C - IF(Z.EQ.ZERO) THEN - F=ONE - Z=ONE - ENDIF -C - C=F/Z - S=H/Z - F=X*C+G*S - G=-X*S+G*C - H=Y*S - Y=Y*C -C - DO 280 J=1,N - X=AB(J,I-1) - Z=AB(J,I) - AB(J,I-1)=X*C+Z*S - AB(J,I)=-X*S+Z*C - 280 CONTINUE -C - IF(ZABS(F).LT.ZABS(H)) THEN - Z=ZABS(H)*ZSQRT(ONE+(F/H)**2) - ELSE IF(F.NE.ZERO) THEN - Z=ZABS(F)*ZSQRT(ONE+(H/F)**2) - ELSE - Z=ZERO - ENDIF -C - Q(I-1)=Z -C - IF(Z.EQ.ZERO) THEN - F=ONE - Z=ONE - ENDIF -C - C=F/Z - S=H/Z - F=C*G+S*Y - X=-S*G+C*Y - 290 CONTINUE -C - 300 E(L)=ZERO - E(K)=F - Q(K)=X -C -C GO TO TESTFSPLITTING -C - GO TO 220 -C -C LABEL CONVERGENCE... -C - 310 IF(Z.LT.ZERO) THEN -C -C Q(K) IS MADE NON-NEGATIVE. -C - Q(K)=-Z - DO 320 J=1,N - AB(J,K)=-AB(J,K) - 320 CONTINUE - ENDIF - 330 CONTINUE -C - RETURN -C -C END MINFIT -C - END - SUBROUTINE SORT -C -C THIS SUBROUTINE SORTS THE ELEMENTS OF D -C AND THE CORRESPONDING COLUMNS OF V INTO DESCENDING ORDER. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 158-159 -C - INTEGER N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH - INTEGER I,IPI,J,K,NMI -C - DOUBLE PRECISION V,X,D,Q0,Q1,DMIN,EPSMCH,FX,H,QD0,QD1,QF1, - * SMALL,T,XLDT,XM2,XM4,DSEED,SCBD - DOUBLE PRECISION S -C - COMMON /CPRAX/ V(128,128),X(128),D(128),Q0(128),Q1(128), - * DMIN,EPSMCH,FX,H,QD0,QD1,QF1,SMALL,T,XLDT,XM2,XM4,DSEED,SCBD, - * N,NL,NF,LP,JPRINT,NMAX,ILLCIN,KTM,NFMAX,JRANCH -C - NMI=N-1 - IF(NMI.LT.1) GO TO 50 - DO 40 I=1,NMI - K=I - S=D(I) - IPI=I+1 - IF(IPI.GT.N) GO TO 20 -C - DO 10 J=IPI,N -C - IF(D(J).GT.S) THEN - K=J - S=D(J) - ENDIF - 10 CONTINUE -C - 20 IF(K.GT.I) THEN - D(K)=D(I) - D(I)=S -C - DO 30 J=1,N - S=V(J,I) - V(J,I)=V(J,K) - V(J,K)=S - 30 CONTINUE - ENDIF - 40 CONTINUE -C - 50 RETURN -C -C END SORT -C - END - SUBROUTINE RANINI(RVALUE) -C -C SUBROUTINE RANINI PERFORMS INITIALIZATION FOR SUBROUTINE RANDOM. -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 163-164 -C - INTEGER JRAN2,I -C - DOUBLE PRECISION RVALUE,R,RAN3,DMOD,DABS,RAN1 -C - COMMON /COMRAN/ RAN3(127),RAN1,JRAN2 -C - R=DMOD(DABS(RVALUE),8190.0D0)+1 - JRAN2=127 -C - 10 IF(JRAN2.GT.0) THEN - JRAN2=JRAN2-1 - RAN1=-2.0D0**55 -C - DO 20 I=1,7 - R=DMOD(1756.0D0*R,8191.0D0) - RAN1=(RAN1+(R-DMOD(R,32.0D0))/32.0D0)/256.0D0 - 20 CONTINUE -C - RAN3(JRAN2+1)=RAN1 - GO TO 10 - ENDIF -C - RETURN -C -C END RANINI -C - END - SUBROUTINE RANDOM(RANVAL) -C -C SUBROUTINE RANDOM RETURNS A DOUBLE PRECISION PSEUDORANDOM NUMBER -C UNIFORMLY DISTRIBUTED IN (0,1) (INCLUDING 0 BUT NOT 1). -C -C "ALGORITHMS FOR MINIMIZATION WITHOUT DERIVATIVES", -C RICHARD P. BRENT, PRENTICE-HALL 1973, PAGES 163-164 -C -C BEFORE THE FIRST CALL TO RANDOM, THE USER MUST -C CALL RANINI(R) ONCE (ONLY) WITH R A DOUBLE PRECISION NUMBER -C EQUAL TO ANY INTEGER VALUE. -C BRENT (PAGE 166) USED THE EQUIVALENT OF -C CALL RANINI(4.0D0) . -C -C THE ALGORITHM USED IN SUBROUTINE RANDOM RETURNS X(N)/2**56, -C WHERE X(N) = X(N-1) + X(N-127) (MOD 2**56) . -C SINCE (1 + X + X**127) IS PRIMITIVE (MOD 2), -C THE PERIOD IS AT LEAST (2**127 - 1), WHICH EXCEEDS 10**38. -C -C SEE "SEMINUMERICAL ALGORITHMS", VOLUME 2 OF -C "THE ART OF COMPUTER PROGRAMMING" BY DONALD E. KNUTH, -C ADDISON-WESLEY 1969, PAGES 26, 34, AND 464. -C -C X(N) IS STORED IN DOUBLE PRECISION AS RAN3 = X(N)/2**56 - 1/2, -C AND ALL DOUBLE PRECISION ARITHMETIC IS EXACT. -C - INTEGER JRAN2 -C - DOUBLE PRECISION RANVAL,RAN3,RAN1 -C - COMMON /COMRAN/ RAN3(127),RAN1,JRAN2 -C - IF(JRAN2.EQ.0) THEN - JRAN2=126 - ELSE - JRAN2=JRAN2-1 - ENDIF -C - RAN1=RAN1+RAN3(JRAN2+1) - IF(RAN1.LT.0.0D0) THEN - RAN1=RAN1+0.5D0 - ELSE - RAN1=RAN1-0.5D0 - ENDIF -C - RAN3(JRAN2+1)=RAN1 - RANVAL=RAN1+0.5D0 -C - RETURN -C -C END RANDOM -C - END - DOUBLE PRECISION FUNCTION DRANDM(DL) -C -C SIMPLE PORTABLE PSEUDORANDOM NUMBER GENERATOR. -C -C DRANDM RETURNS FUNCTION VALUES THAT ARE PSEUDORANDOM -C NUMBERS UNIFORMLY DISTRIBUTED ON THE INTERVAL (0,1). -C -C 'NUMERICAL MATHEMATICS AND COMPUTING' BY WARD CHENEY AND -C DAVID KINCAID, BROOKS/COLE PUBLISHING COMPANY -C (FIRST EDITION, 1980), PAGE 203 -C -C AT THE BEGINNING OF EXECUTION, OR WHENEVER A NEW SEQUENCE IS -C TO BE INITIATED, SET DL EQUAL TO AN INTEGER VALUE BETWEEN -C 1.0D0 AND 2147483646.0D0, INCLUSIVE. DO THIS ONLY ONCE. -C THEREAFTER, DO NOT SET OR ALTER DL IN ANY WAY. -C FUNCTION DRANDM WILL MODIFY DL FOR ITS OWN PURPOSES. -C -C DRANDM USES A MULTIPLICATIVE CONGRUENTIAL METHOD. -C THE NUMBERS GENERATED BY DRANDM SUFFER FROM THE PARALLEL -C PLANES DEFECT DISCOVERED BY G. MARSAGLIA, AND SHOULD NOT BE -C USED WHEN HIGH-QUALITY RANDOMNESS IS REQUIRED. IN THAT -C CASE, USE A "SHUFFLING" METHOD. -C - DOUBLE PRECISION DL,DMOD -C - 10 DL=DMOD(16807.0D0*DL,2147483647.0D0) - DRANDM=DL/2147483647.0D0 - IF(DRANDM.LE.0.0D0 .OR. DRANDM.GE.1.0D0) GO TO 10 - RETURN - END diff --git a/gnuradio-core/src/gen_interpolator_taps/praxis.txt b/gnuradio-core/src/gen_interpolator_taps/praxis.txt deleted file mode 100644 index 9d06065660..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/praxis.txt +++ /dev/null @@ -1,176 +0,0 @@ -Brent's PRAXIS minimizer is available in FORTRAN 77. July 1995 - -"Algorithms for Minimization Without Derivatives" -by Richard P. Brent, Prentice-Hall, 1973 -ISBN: 0-13-022335-2 - -This book by Brent was a groundbreaking effort. -(I believe that it was his Ph.D. thesis at Stanford.) -His algorithms for finding roots and minima in -one dimension have good performance for typical problems -and guaranteed performance in the worst case. -(A later rootfinder by J. Bus and Dekker gave -a much lower bound for the worst case, -but no better performance in typical problems.) -These algorithms were implemented in both ALGOL W -and FORTRAN by Brent, and have been used fairly widely. - -Brent also gave a multi-dimensional minimization algorithm, -PRAXIS, but only shows an implementation in ALGOL W. -This routine has not been widely used, at least in the U.S. -The PRAXIS package has been translated into FORTRAN -by Rosalee Taylor, Sue Pinski, and me, and -I am making it available via anonymous ftp for use as -freeware (please do not remove our names). - - ftp a.cs.okstate.edu - anonymous - [enter your userid as password] - cd /pub/jpc - get praxis.f - quit - - -Brent's method and its performance - -Newton's method for minimization can find the minimum of a -quadratic function in one iteration, but is sometimes not -convenient to use. In the 1960s, several researchers found -iterative methods that solve quadratic problems exactly in a -finite number of steps. C. S. Smith (1962) and -M. J. D. Powell (1964) devised methods -that had this property and did not require derivatives. -G. W. Stewart modified the Davidon-Fletcher-Powell quasi-Newton -method to use finite difference approximations to approximate -the gradient. Powell's method, or later versions by Zangwill, -were the most successful of the early direct search methods -having the property of finite convergence on quadratic functions. - -Powell's method was programmed at Harwell as subroutine VA04A, -and is available as file va04a.f in the same directory as praxis.f. -VA04A is not extremely robust, and can give underflow, overflow, -or division by zero. va04a.f has several documented patches in it -where I tried to get around various abnormal terminations. -I do not recommend VA04A very strongly. - -Brent's PRAXIS added orthogonalization and several other features -to Powell's method. Brent also dealt carefully with roundoff. - -William H. Press et al. in their book "Numerical Recipes" -comment that -"Brent has a number of other cute tricks up his sleeve, -and his modification of Powell's method is probably -the best presently known." - -Roger Fletcher was less enthusiastic in his review of Brent's book -in The Computer Journal 16 (1973) 314: -"... I am not convinced that the modifications to Powell's -method are the best. Use of eigenvector directions -is not independent of scale changes to the variables, -and the use of searches in random directions is hardly -appealing. Nonetheless all the algorithms are demonstrated -to be competitive by numerical examples." - -The methods of Powell, Brent, et al. require that the function -for which a local minimum is sought must be smooth; -that is, the function and all of its first partial derivatives -must be continuous. - -Brent compared his method to the methods of Powell, of Stewart, -and of Davies, Swann, and Campey. Indirectly, he compared it -also to the Davidon-Fletcher-Powell quasi-Newton method. -He found that his method was about as efficient as the best -of these in most cases, and that it was more robust than others -in some cases. (Pages 139-155 in Brent's book give fair -comparisons to other methods. The results in Table 7.1 on -page 138 are correct, but do not include progress all the way -to convergence, and are therefore not too useful.) - -On least squares problems, all of these general minimization -methods are likely to be inefficient compared to least squares -methods such as the Gauss-Newton or Marquardt methods. - -In addition to the scale dependence that Fletcher deplored, -PRAXIS also had the disadvantage that it required N, the number -of parameters, to be greater than or equal to two. -The failure to handle N=1 is an unnecessary and pointless limitation. - - -The FORTRAN version - -We have followed Brent's PRAXIS rather closely. -I have added a patch to try to handle the case N=1, -and an option to use a simpler pseudorandom number generator, -DRANDM. The handling of N=1 is not guaranteed. - -The user writes a main program and a function subprogram -to compute the function to be minimized. -All communication between the user's main program and PRAXIS -is done via COMMON, except for an EXTERNAL parameter giving -the name of the function subprogram. -The disadvantages of using COMMON are at least two-fold: - - 1) Arrays cannot have adjustable dimensions. - - 2) Because some actual parameters are COMMON variables, - the FORTRAN version of PRAXIS probably will not pass - the Bell Labs PFORT package as being 100% standard FORTRAN. - Nevertheless, this usage will not cause any conflict in - any commercial FORTRAN compiler ever written. - (If it does, I will apologize and rewrite PRAXIS.) - -The advantage of using COMMON is that it is not necessary to pass -about fifteen more parameters every time the user calls PRAXIS. -At present all arrays are dimensioned (20) or (20,20), -and this can easily be increased using two simple global editing -commands. (In this case, increase the value of NMAX.) - -There are no DATA statements in PRAXIS, and it was not necessary -to use any SAVE statements. - -We have used DOUBLE PRECISION for all floating point computations, -as Brent did. We recommend using DOUBLE PRECISION on all computers -except possibly Cray computers, in which REAL is reasonably precise. -The value of "machine epsilon" is computed in subroutine PRASET -using bisection, and is called EPSMCH. -Brent computes EPSMCH**4 and 1/EPSMCH**4 in PRAXIS, -and uses these quantities later. -Because EPSMCH in DOUBLE PRECISION is less than 1E-16, -these fourth powers of EPSMCH and 1/EPSMCH will underflow -and overflow on such machines as VAXs and PCs, -which have a range of only about 1E38, grossly insufficient -for scientific computation. For such machines, Brent recommends -increasing the value of EPSMCH. -EPSMCH=1E-9 or possibly even 1E-8 might be necessary. -A better solution would be to eliminate the explicit use of -these fourth powers, accomplishing the same result implicitly. - -A "bug bounty" of $10 U.S. will be paid by me for the first -notification of any error in PRAXIS. -The same bounty also applies to any substantive poor design -choice (having no redeeming advantages whatever) in the FORTRAN -package. (The patch for N=1 is not included, although any -suggested improvements in that will be considered carefully.) - -praxis.f includes test software to run any of the test problems -that Brent ran, and is set to run at least one case of each problem. -I have run these on an IBM 3090, essentially the same -architecture that Brent used, and obtained essentially the same -results that Brent shows on pages 140-155. The Hilbert problem with -N=12, for which Brent shows no termination results and for which -the results in Table 7.1 are correct but not relevant, -runs a long time; I cut it off at 3000 function evaluations. -I don't particularly like Brent's convergence criterion, -which allows this sort of extremely slow creeping progress, -but have not modified it. - -Please notify me of any problems with this software, -or of any suggested modifications. - -John Chandler -Computer Science Department -Oklahoma State University -Stillwater, Oklahoma 74078, U.S.A. -(405) 744-5676 -jpc@a.cs.okstate.edu - diff --git a/gnuradio-core/src/gen_interpolator_taps/simpson.c b/gnuradio-core/src/gen_interpolator_taps/simpson.c deleted file mode 100644 index 31aaae4aef..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/simpson.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c -*- */ -#include <math.h> -#include <stdio.h> - -#define EPS (1.0e-5) -#define JMAX 16 - -/* - * Compute the Nth stage of refinement of an extended trapezoidal - * rule. FUNC is input as a pointer to a function to be integrated - * between limits A and B. When called with N = 1, the routine - * returns the crudest estimate of the integral from A to B of f(x) - * dx. Subsequent calls with N=2,3,... (in that sequential order) - * will improve the accuracy by adding 2**(N-2) additional interior - * points. - * - * N.B., this function contains static state and IS NEITHER RENTRANT - * NOR THREAD SAFE! - */ - -double -trapzd (double (*func)(double), - double a, double b, - int n) -{ - long double x, tnm, sum, del; - static long double s; - static int it; - int j; - - if (n == 1){ - it = 1; /* # of points to add on the next call */ - s = 0.5 * (b - a) * (func(a) + func(b)); - return s; - } - else { - tnm = it; - del = (b-a)/tnm; /* this is the spacing of the points to be added */ - x = a + 0.5*del; - for (sum = 0.0, j = 1; j <= it; j++, x += del) - sum += func(x); - it *= 2; - s = 0.5 * (s + (b-a) * sum/tnm); /* replace s by it's refined value */ - return s; - } -} - -/* - * Returns the integral of the function FUNC from A to B. The - * parameters EPS can be set to the desired fractional accuracy and - * JMAX so that 2**(JMAX-1) is the maximum allowed number of steps. - * Integration is performed by Simpson's rule. - */ - -double -qsimp (double (*func)(double), - double a, /* lower limit */ - double b) /* upper limit */ -{ - int j; - long double s, st, ost, os; - - ost = os = -1.0e30; - for (j = 1; j <= JMAX; j++){ - st = trapzd (func, a, b, j); - s = (4.0 * st - ost)/3.0; - if (fabs (s - os) < EPS * fabs(os)) - return s; - os = s; - ost = st; - } - fprintf (stderr, "Too many steps in routine QSIMP\n"); - // exit (1); - return s; -} - diff --git a/gnuradio-core/src/gen_interpolator_taps/simpson.h b/gnuradio-core/src/gen_interpolator_taps/simpson.h deleted file mode 100644 index 68774f9a2e..0000000000 --- a/gnuradio-core/src/gen_interpolator_taps/simpson.h +++ /dev/null @@ -1,3 +0,0 @@ -double qsimp (double (*func)(double), - double a, double b); - diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt index 9c980157db..9dfa47fd23 100644 --- a/gnuradio-core/src/lib/CMakeLists.txt +++ b/gnuradio-core/src/lib/CMakeLists.txt @@ -33,7 +33,6 @@ GR_INCLUDE_SUBDIRECTORY(general) GR_INCLUDE_SUBDIRECTORY(gengen) GR_INCLUDE_SUBDIRECTORY(reed-solomon) GR_INCLUDE_SUBDIRECTORY(io) -GR_INCLUDE_SUBDIRECTORY(hier) list(APPEND gnuradio_core_sources bug_work_around_6.cc) list(APPEND test_gnuradio_core_sources bug_work_around_6.cc) diff --git a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S deleted file mode 100644 index 0cd6867365..0000000000 --- a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_really_simple.S +++ /dev/null @@ -1,99 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# sse_float_dotprod (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - - - .file "3dnow_float_dotprod_really_simple.s" - .version "01.01" -.text - .p2align 4 -.globl sse_float_dotprod - .type sse_float_dotprod,@function -sse_float_dotprod: - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - - # The plan is to get it computing the correct answer, and - # then to unroll and schedule the inner loop. - - pxor %mm4, %mm4 # mm4 = 0 0 - shll $1, %ecx # count * 2 - - .p2align 4 -.Loop1: - movq (%eax), %mm0 - pfmul (%edx), %mm0 - pfadd %mm0, %mm4 - addl $8, %edx - addl $8, %eax - decl %ecx - jne .Loop1 - - # at this point mm4 contains partial sums - - pfacc %mm4, %mm4 - movd %mm4, 16(%ebp) - femms - flds 16(%ebp) - - popl %ebp - ret -.Lfe1: - .size sse_float_dotprod,.Lfe1-sse_float_dotprod - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S b/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S deleted file mode 100644 index 5af3fc5c93..0000000000 --- a/gnuradio-core/src/lib/filter/3dnow_float_dotprod_simple.S +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# sse_float_dotprod (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - - - .file "3dnow_float_dotprod_simple.s" - .version "01.01" -.text - .p2align 4 -.globl sse_float_dotprod - .type sse_float_dotprod,@function -sse_float_dotprod: - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - - # The plan is to get it computing the correct answer, and - # then to unroll and schedule the inner loop. - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - - .p2align 4 -.Loop1: - movq 0(%eax), %mm0 - movq 8(%eax), %mm1 - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - - addl $16, %edx - addl $16, %eax - decl %ecx - jne .Loop1 - - # at this point mm4 and mm5 contain partial sums - - pfadd %mm5, %mm4 - pfacc %mm4, %mm4 - movd %mm4, 16(%ebp) - femms - flds 16(%ebp) - - popl %ebp - ret -.Lfe1: - .size sse_float_dotprod,.Lfe1-sse_float_dotprod - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/CMakeLists.txt b/gnuradio-core/src/lib/filter/CMakeLists.txt index facaff764d..dfff42a84a 100644 --- a/gnuradio-core/src/lib/filter/CMakeLists.txt +++ b/gnuradio-core/src/lib/filter/CMakeLists.txt @@ -21,334 +21,22 @@ # This file included, use CMake directory variables ######################################################################## -#set the C language property on the assembly files so the compiler will pick them up -file(GLOB gr_core_filter_asms ${CMAKE_CURRENT_SOURCE_DIR}/*.S) -foreach(gr_core_filter_asm ${gr_core_filter_asms}) - set_property(SOURCE ${gr_core_filter_asm} PROPERTY LANGUAGE C) -endforeach(gr_core_filter_asm) - -#detect 32 or 64 bit compiler -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x86_64|amd64)$") - include(CheckTypeSize) - check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY) - if (${SIZEOF_VOID_P} EQUAL 8) - set(CMAKE_SYSTEM_PROCESSOR_x86 64) - else() - set(CMAKE_SYSTEM_PROCESSOR_x86 32) - endif() -endif() - -######################################################################## -# Generate the makefile.gen, then extract its sources: -# This is a round-about way to extract the sources, -# but it requires minimum changed to the python utils. -# -# The recommended way to do this: -# - Make a generation macro that registers the sources command. -# - List the generation macro with each templated source file. -# - Create a python script (very generic) to perform generation. -# - This way the targets would depend only on their sources. -######################################################################## -execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c " -import os, sys -sys.path.append('${GR_CORE_PYTHONPATH}') -sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}') -os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}' -os.environ['gendir'] = '${CMAKE_CURRENT_BINARY_DIR}' -os.environ['do_makefile'] = '1' -os.environ['do_sources'] = '0' -from generate_all import generate_all -generate_all() - " WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) - -macro(FILTER_GEN_EXTRACT outvar ext) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; print ';'.join( - map(lambda x: os.path.join('${CMAKE_CURRENT_BINARY_DIR}', x.replace('\\\\', '').strip()), - filter(lambda f: '${ext}' in f, open('${CMAKE_CURRENT_BINARY_DIR}/Makefile.gen').readlines() - )))" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ${outvar}) - file(TO_CMAKE_PATH "${${outvar}}" ${outvar}) -endmacro(FILTER_GEN_EXTRACT) - -FILTER_GEN_EXTRACT(generated_filter_sources ".cc") -FILTER_GEN_EXTRACT(generated_filter_includes ".h") -FILTER_GEN_EXTRACT(generated_filter_swigs ".i") - -#TODO simplify this list with a triple-threat for loop -set(generated_filter_deps - ${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_filter_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_interp_fir_filter_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_rational_resampler_base_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_sysconfig_generic.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_fir_util.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gr_freq_xlating_fir_filter_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_gri_fir_filter_with_buffer_XXX.py - ${CMAKE_CURRENT_SOURCE_DIR}/generate_utils.py - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_XXX_generic.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_filter_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_interp_fir_filter_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_rational_resampler_base_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.h.t - ${CMAKE_CURRENT_SOURCE_DIR}/gr_freq_xlating_fir_filter_XXX.i.t - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.cc.t - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fir_filter_with_buffer_XXX.h.t -) - -add_custom_command( - OUTPUT - ${generated_filter_sources} - ${generated_filter_includes} - ${generated_filter_swigs} - DEPENDS ${generated_filter_deps} - COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c - "import os, sys;sys.path.append('${GR_CORE_PYTHONPATH}');sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}');os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}';from generate_all import generate_all;generate_all()" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "generating filter files" - VERBATIM -) - -add_custom_target(filter_generated DEPENDS - ${generated_filter_sources} - ${generated_filter_includes} - ${generated_filter_swigs} -) - -######################################################################## -# Add target specific files -# May VOLK put a rest to all the insanity below. -######################################################################## -if(MSVC) - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc - ) -else(MSVC) -if(CMAKE_SYSTEM_PROCESSOR_x86) - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccc_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fsf_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_scc_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fcc_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_simd.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.c - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_float_dotprod_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_complex_dotprod_x86.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_ccomplex_dotprod_x86.cc - ) -endif() - -if(CMAKE_SYSTEM_PROCESSOR_x86 AND "${CMAKE_SYSTEM_PROCESSOR_x86}" STREQUAL "64") - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext64.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext64.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow64.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse64.S - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx64.S - ) -elseif(CMAKE_SYSTEM_PROCESSOR_x86 AND "${CMAKE_SYSTEM_PROCESSOR_x86}" STREQUAL "32") - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnowext.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnowext.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_3dnow.S - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_sse.S - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_mmx.S - ) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - if(CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-maltivec) - endif() - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_powerpc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_powerpc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_altivec.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.c - ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_altivec.c - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_powerpc.cc - ) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_fff_armv7_a.cc - ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_fff_armv7_a.c - ${CMAKE_CURRENT_SOURCE_DIR}/dotprod_ccf_armv7_a.c - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_ccf_armv7_a.cc - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_armv7_a.cc - ) -else() - list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/sysconfig_generic.cc - ) - list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_dotprod_generic.cc - ) -endif() -endif(MSVC) - ######################################################################## # Append gnuradio-core library sources ######################################################################## list(APPEND gnuradio_core_sources - ${generated_filter_sources} - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.c ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.cc - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.c - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.c -) - -######################################################################## -# Append gnuradio-core test sources -######################################################################## -list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fcc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_fff.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_ccc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fir_scc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_rotator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_mmse_fir_interpolator_cc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_ccc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fcc.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fff.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_fsf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_fir_filter_with_buffer_scc.cc ) ######################################################################## # Install runtime headers ######################################################################## install(FILES - ${generated_filter_includes} - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/complex_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/fcomplex_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/ccomplex_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/float_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_altivec.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_cpu.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_fff_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_fft_filter_ccc_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_fir_sysconfig_powerpc.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_rotator.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_sincos.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_single_pole_iir.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_vec_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_goertzel.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_iir.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_mmse_fir_interpolator_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/qa_filter.h - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_generic.h - ${CMAKE_CURRENT_SOURCE_DIR}/short_dotprod_x86.h - ${CMAKE_CURRENT_SOURCE_DIR}/sse_debug.h + ${CMAKE_CURRENT_SOURCE_DIR}/gri_single_pole_iir.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" ) - -######################################################################## -# Install swig headers -######################################################################## -if(ENABLE_PYTHON) -install(FILES - ${generated_filter_swigs} - ${CMAKE_CURRENT_SOURCE_DIR}/filter.i - ${CMAKE_CURRENT_BINARY_DIR}/filter_generated.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "core_swig" -) -endif(ENABLE_PYTHON) - -######################################################################## -# Handle triple-threat files that have cc, h, and i -######################################################################## -set(gr_core_filter_triple_threats - gr_adaptive_fir_ccc - gr_adaptive_fir_ccf - gr_dc_blocker_cc - gr_dc_blocker_ff - gr_fft_filter_ccc - gr_fft_filter_fff - gr_filter_delay_fc - gr_fractional_interpolator_ff - gr_fractional_interpolator_cc - gr_goertzel_fc - gr_hilbert_fc - gr_iir_filter_ffd - gr_single_pole_iir_filter_ff - gr_single_pole_iir_filter_cc - gr_pfb_channelizer_ccf - gr_pfb_synthesizer_ccf - gr_pfb_decimator_ccf - gr_pfb_interpolator_ccf - gr_pfb_arb_resampler_ccf - gr_pfb_arb_resampler_fff - gr_pfb_clock_sync_ccf - gr_pfb_clock_sync_fff -) - -foreach(file_tt ${gr_core_filter_triple_threats}) - list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") - if(ENABLE_PYTHON) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") - endif(ENABLE_PYTHON) -endforeach(file_tt ${gr_core_filter_triple_threats}) diff --git a/gnuradio-core/src/lib/filter/Makefile.gen b/gnuradio-core/src/lib/filter/Makefile.gen deleted file mode 100644 index 909899c054..0000000000 --- a/gnuradio-core/src/lib/filter/Makefile.gen +++ /dev/null @@ -1,124 +0,0 @@ -# -# This file is machine generated. All edits will be overwritten -# -GENERATED_H = \ - gr_fir_ccc.h \ - gr_fir_ccc_generic.h \ - gr_fir_ccf.h \ - gr_fir_ccf_generic.h \ - gr_fir_fcc.h \ - gr_fir_fcc_generic.h \ - gr_fir_fff.h \ - gr_fir_fff_generic.h \ - gr_fir_filter_ccc.h \ - gr_fir_filter_ccf.h \ - gr_fir_filter_fcc.h \ - gr_fir_filter_fff.h \ - gr_fir_filter_fsf.h \ - gr_fir_filter_scc.h \ - gr_fir_fsf.h \ - gr_fir_fsf_generic.h \ - gr_fir_scc.h \ - gr_fir_scc_generic.h \ - gr_fir_sysconfig.h \ - gr_fir_sysconfig_generic.h \ - gr_fir_util.h \ - gr_freq_xlating_fir_filter_ccc.h \ - gr_freq_xlating_fir_filter_ccf.h \ - gr_freq_xlating_fir_filter_fcc.h \ - gr_freq_xlating_fir_filter_fcf.h \ - gr_freq_xlating_fir_filter_scc.h \ - gr_freq_xlating_fir_filter_scf.h \ - gr_interp_fir_filter_ccc.h \ - gr_interp_fir_filter_ccf.h \ - gr_interp_fir_filter_fcc.h \ - gr_interp_fir_filter_fff.h \ - gr_interp_fir_filter_fsf.h \ - gr_interp_fir_filter_scc.h \ - gr_rational_resampler_base_ccc.h \ - gr_rational_resampler_base_ccf.h \ - gr_rational_resampler_base_fcc.h \ - gr_rational_resampler_base_fff.h \ - gr_rational_resampler_base_fsf.h \ - gr_rational_resampler_base_scc.h \ - gri_fir_filter_with_buffer_ccc.h \ - gri_fir_filter_with_buffer_ccf.h \ - gri_fir_filter_with_buffer_fcc.h \ - gri_fir_filter_with_buffer_fff.h \ - gri_fir_filter_with_buffer_fsf.h \ - gri_fir_filter_with_buffer_scc.h - - -GENERATED_I = \ - gr_fir_filter_ccc.i \ - gr_fir_filter_ccf.i \ - gr_fir_filter_fcc.i \ - gr_fir_filter_fff.i \ - gr_fir_filter_fsf.i \ - gr_fir_filter_scc.i \ - gr_freq_xlating_fir_filter_ccc.i \ - gr_freq_xlating_fir_filter_ccf.i \ - gr_freq_xlating_fir_filter_fcc.i \ - gr_freq_xlating_fir_filter_fcf.i \ - gr_freq_xlating_fir_filter_scc.i \ - gr_freq_xlating_fir_filter_scf.i \ - gr_interp_fir_filter_ccc.i \ - gr_interp_fir_filter_ccf.i \ - gr_interp_fir_filter_fcc.i \ - gr_interp_fir_filter_fff.i \ - gr_interp_fir_filter_fsf.i \ - gr_interp_fir_filter_scc.i \ - gr_rational_resampler_base_ccc.i \ - gr_rational_resampler_base_ccf.i \ - gr_rational_resampler_base_fcc.i \ - gr_rational_resampler_base_fff.i \ - gr_rational_resampler_base_fsf.i \ - gr_rational_resampler_base_scc.i - -GENERATED_CC = \ - gr_fir_ccc.cc \ - gr_fir_ccc_generic.cc \ - gr_fir_ccf.cc \ - gr_fir_ccf_generic.cc \ - gr_fir_fcc.cc \ - gr_fir_fcc_generic.cc \ - gr_fir_fff.cc \ - gr_fir_fff_generic.cc \ - gr_fir_filter_ccc.cc \ - gr_fir_filter_ccf.cc \ - gr_fir_filter_fcc.cc \ - gr_fir_filter_fff.cc \ - gr_fir_filter_fsf.cc \ - gr_fir_filter_scc.cc \ - gr_fir_fsf.cc \ - gr_fir_fsf_generic.cc \ - gr_fir_scc.cc \ - gr_fir_scc_generic.cc \ - gr_fir_sysconfig.cc \ - gr_fir_sysconfig_generic.cc \ - gr_fir_util.cc \ - gr_freq_xlating_fir_filter_ccc.cc \ - gr_freq_xlating_fir_filter_ccf.cc \ - gr_freq_xlating_fir_filter_fcc.cc \ - gr_freq_xlating_fir_filter_fcf.cc \ - gr_freq_xlating_fir_filter_scc.cc \ - gr_freq_xlating_fir_filter_scf.cc \ - gr_interp_fir_filter_ccc.cc \ - gr_interp_fir_filter_ccf.cc \ - gr_interp_fir_filter_fcc.cc \ - gr_interp_fir_filter_fff.cc \ - gr_interp_fir_filter_fsf.cc \ - gr_interp_fir_filter_scc.cc \ - gr_rational_resampler_base_ccc.cc \ - gr_rational_resampler_base_ccf.cc \ - gr_rational_resampler_base_fcc.cc \ - gr_rational_resampler_base_fff.cc \ - gr_rational_resampler_base_fsf.cc \ - gr_rational_resampler_base_scc.cc \ - gri_fir_filter_with_buffer_ccc.cc \ - gri_fir_filter_with_buffer_ccf.cc \ - gri_fir_filter_with_buffer_fcc.cc \ - gri_fir_filter_with_buffer_fff.cc \ - gri_fir_filter_with_buffer_fsf.cc \ - gri_fir_filter_with_buffer_scc.cc - diff --git a/gnuradio-core/src/lib/filter/README b/gnuradio-core/src/lib/filter/README deleted file mode 100644 index 90c1584fcb..0000000000 --- a/gnuradio-core/src/lib/filter/README +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -This directory holds filtering code, some of which is machine -generated. Which variations are generated is controlled by two -variables. For most everything, the global "signatures" -in generate_utils.py controls. - -For GrFreqXlatingFIRfilter<foo>, the global "fx_signatures" in -generate_GrFreqXlatingFIRfilterXXX.py controls. diff --git a/gnuradio-core/src/lib/filter/assembly.h b/gnuradio-core/src/lib/filter/assembly.h deleted file mode 100644 index 32477dfd7b..0000000000 --- a/gnuradio-core/src/lib/filter/assembly.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _ASSEMBLY_H_ -#define _ASSEMBLY_H_ - -#if defined (__APPLE__) && defined (__APPLE_CC__) - -// XCode ignores the .scl and .type functions in XCode 2.2.1 and 2.3, -// but creates an error in XCode 2.4. Just ignore them. - -#define GLOB_SYMB(f) _ ## f - -#define DEF_FUNC_HEAD(f) /* none */ - -#define FUNC_TAIL(f) /* none*/ - -#elif !defined (__ELF__) - -/* - * Too bad, the following define does not work as expected --SF - * #define GLOB_SYMB(f) __USER_LABEL_PREFIX__ ## f - */ -#define GLOB_SYMB(f) _ ## f - -#define DEF_FUNC_HEAD(f) \ - .def GLOB_SYMB(f); .scl 2; .type 32; .endef - -#define FUNC_TAIL(f) /* none */ - - -#else /* !__ELF__ */ - - -#define GLOB_SYMB(f) f - -#define DEF_FUNC_HEAD(f) \ - .type GLOB_SYMB(f),@function \ - -#define FUNC_TAIL(f) \ - .Lfe1: \ - .size GLOB_SYMB(f),.Lfe1-GLOB_SYMB(f) - - -#endif /* !__ELF__ */ - - -#endif /* _ASSEMBLY_H_ */ diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S deleted file mode 100644 index 8844e51085..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow.S +++ /dev/null @@ -1,220 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_3dnow.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnow) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnow) -GLOB_SYMB(ccomplex_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - - movq 0(%eax), %mm0 - - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%edx), %mm2 - - movq 8(%eax), %mm1 - - shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2 - - movq 8(%edx), %mm3 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z, mmPN=$80000000 -# -# movq (%eax), %mmA -# movq (%edx), %mmB -# -# # 3DNow! replacement for: pswapd %mmA, %mmZ -# # TODO: optimize the punpckhdq -# movq %mmA, %mmZ -# punpckhdq %mmZ, %mmZ -# punpckldq %mmA, %mmZ -# -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# -# # 3DNow! replacement for: pfpnacc %mmB, %mmA -# pxor %mmPN, %mmA -# pfacc %mmB, %mmA -# -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 16(%edx), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 16(%eax), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 24(%edx), %mm1 - - movq %mm0, %mm4 - movq %mm1, %mm5 - - pfadd %mm3, %mm7 - movq 24(%eax), %mm3 - -# unroll - - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 32(%edx), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 32(%eax), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 40(%edx), %mm1 - - addl $32, %eax - addl $32, %edx - - pfadd %mm3, %mm7 - movq 8(%eax), %mm3 - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - andl $1, %ecx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - pfmul %mm5, %mm3 - pfadd %mm1, %mm6 - pfadd %mm3, %mm7 - -.Leven: - # mmNP: negative inversor - - pcmpeqd %mm0, %mm0 # set all bits to 1 - psllq $63, %mm0 # keep only hsb - - pxor %mm0, %mm6 - pfacc %mm7, %mm6 - - movl 20(%ebp), %eax # result - movq %mm6, (%eax) - - femms - - popl %ebp - ret - -FUNC_TAIL(ccomplex_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S deleted file mode 100644 index d92fe17a32..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnow64.S +++ /dev/null @@ -1,217 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "ccomplex_dotprod_3dnow64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnow) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnow) -GLOB_SYMB(ccomplex_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - - movq 0(%rdi), %mm0 - - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%rsi), %mm2 - - movq 8(%rdi), %mm1 - - shr $1, %rax # rax = n_2_ccomplex_blocks / 2 - - movq 8(%rsi), %mm3 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z, mmPN=$80000000 -# -# movq (%rdx), %mmA -# movq (%rsi), %mmB -# -# # 3DNow! replacement for: pswapd %mmA, %mmZ -# # TODO: optimize the punpckhdq -# movq %mmA, %mmZ -# punpckhdq %mmZ, %mmZ -# punpckldq %mmA, %mmZ -# -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# -# # 3DNow! replacement for: pfpnacc %mmB, %mmA -# pxor %mmPN, %mmA -# pfacc %mmB, %mmA -# -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 16(%rsi), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 16(%rdi), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 24(%rsi), %mm1 - - movq %mm0, %mm4 - movq %mm1, %mm5 - - pfadd %mm3, %mm7 - movq 24(%rdi), %mm3 - -# unroll - - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - movq 32(%rsi), %mm0 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - movq 32(%rdi), %mm2 - pfadd %mm1, %mm6 - pfmul %mm5, %mm3 - movq 40(%rsi), %mm1 - - add $32, %rdi - add $32, %rsi - - pfadd %mm3, %mm7 - movq 8(%rdi), %mm3 - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - and $1, %rdx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - - movq %mm0, %mm4 - movq %mm1, %mm5 - punpckhdq %mm4, %mm4 - punpckhdq %mm5, %mm5 - punpckldq %mm0, %mm4 - pfmul %mm2, %mm0 - punpckldq %mm1, %mm5 - pfmul %mm4, %mm2 - pfadd %mm0, %mm6 - pfmul %mm3, %mm1 - pfadd %mm2, %mm7 - pfmul %mm5, %mm3 - pfadd %mm1, %mm6 - pfadd %mm3, %mm7 - -.Leven: - # mmNP: negative inversor - - pcmpeqd %mm0, %mm0 # set all bits to 1 - psllq $63, %mm0 # keep only hsb - - pxor %mm0, %mm6 - pfacc %mm7, %mm6 - - movq %mm6, (%rcx) - - femms - - retq - -FUNC_TAIL(ccomplex_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S deleted file mode 100644 index c4a02d7fb6..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext.S +++ /dev/null @@ -1,195 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_3dnowext.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnowext) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnowext) -GLOB_SYMB(ccomplex_dotprod_3dnowext): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%eax), %mm0 - movq 0(%edx), %mm2 - - shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2 - - movq 8(%eax), %mm1 - movq 8(%edx), %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z -# -# movq 0(%eax), %mmA -# movq 0(%edx), %mmB -# pswapd %mmA, %mmZ -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# pfpnacc %mmB, %mmA -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 16(%edx), %mm2 - pfpnacc %mm3, %mm1 - movq 24(%edx), %mm3 - - pfadd %mm0, %mm6 - movq 16(%eax), %mm0 - pfadd %mm1, %mm7 - movq 24(%eax), %mm1 - -# unroll - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 32(%edx), %mm2 - pfpnacc %mm3, %mm1 - movq 40(%edx), %mm3 - - pfadd %mm0, %mm6 - movq 32(%eax), %mm0 - pfadd %mm1, %mm7 - movq 40(%eax), %mm1 - - addl $32, %edx - addl $32, %eax - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - andl $1, %ecx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - pfpnacc %mm3, %mm1 - - pfadd %mm0, %mm6 - pfadd %mm1, %mm7 - -.Leven: - # at this point mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - - movl 20(%ebp), %eax # result - movq %mm6, (%eax) - - femms - - popl %ebp - ret - -FUNC_TAIL(ccomplex_dotprod_3dnowext) - .ident "Hand coded x86 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S deleted file mode 100644 index c4f9e19700..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_3dnowext64.S +++ /dev/null @@ -1,192 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_3dnowext64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_3dnowext) - DEF_FUNC_HEAD(ccomplex_dotprod_3dnowext) -GLOB_SYMB(ccomplex_dotprod_3dnowext): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - - # zero accumulators - - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - movq 0(%rdi), %mm0 - movq 0(%rsi), %mm2 - - shr $1, %rax # rax = n_2_ccomplex_blocks / 2 - - movq 8(%rdi), %mm1 - movq 8(%rsi), %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z -# -# movq 0(%rdi), %mmA -# movq 0(%rsi), %mmB -# pswapd %mmA, %mmZ -# pfmul %mmB, %mmA -# pfmul %mmZ, %mmB -# pfpnacc %mmB, %mmA -# pfadd %mmA, %mmC - - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 16(%rsi), %mm2 - pfpnacc %mm3, %mm1 - movq 24(%rsi), %mm3 - - pfadd %mm0, %mm6 - movq 16(%rdi), %mm0 - pfadd %mm1, %mm7 - movq 24(%rdi), %mm1 - -# unroll - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - movq 32(%rsi), %mm2 - pfpnacc %mm3, %mm1 - movq 40(%rsi), %mm3 - - pfadd %mm0, %mm6 - movq 32(%rdi), %mm0 - pfadd %mm1, %mm7 - movq 40(%rdi), %mm1 - - add $32, %rsi - add $32, %rdi - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's see if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - and $1, %rdx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 & mm1/mm3 preloaded - # from the main loop. - -# A=mm0, B=mm2, Z=mm4 -# A'=mm1, B'=mm3, Z'=mm5 - - pswapd %mm0, %mm4 - pfmul %mm2, %mm0 - pswapd %mm1, %mm5 - pfmul %mm4, %mm2 - pfmul %mm3, %mm1 - pfpnacc %mm2, %mm0 - pfmul %mm5, %mm3 - pfpnacc %mm3, %mm1 - - pfadd %mm0, %mm6 - pfadd %mm1, %mm7 - -.Leven: - # at this point mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - - movq %mm6, (%rcx) # result - - femms - - retq - -FUNC_TAIL(ccomplex_dotprod_3dnowext) - .ident "Hand coded x86_64 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc deleted file mode 100644 index a6f3922117..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_complex.h> -#include "ccomplex_dotprod_generic.h" - -#include <iostream> - -void -ccomplex_dotprod_generic (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, - float *result) -{ - gr_complex sum0(0,0); - gr_complex sum1(0,0); - - std::cerr << "Blah!!!\n"; - do { - const gr_complex tap0(taps[0], taps[1]); - const gr_complex tap1(taps[2], taps[3]); - const gr_complex input0(input[0], input[1]); - const gr_complex input1(input[2], input[3]); - - sum0 += input0 * tap0; - sum1 += input1 * tap1; - - input += 8; - taps += 8; - - } while (--n_2_ccomplex_blocks != 0); - - - sum0 += sum1; - result[0] = sum0.real(); - result[1] = sum0.imag(); -} diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h deleted file mode 100644 index c7d761c079..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_generic.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _CCOMPLEX_DOTPROD_GENERIC_H_ -#define _CCOMPLEX_DOTPROD_GENERIC_H_ - -#include <gr_core_api.h> - -GR_CORE_API void -ccomplex_dotprod_generic (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, - float *result); - - -#endif /* _CCOMPLEX_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S deleted file mode 100644 index b50a3690d0..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse.S +++ /dev/null @@ -1,198 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - .file "ccomplex_dotprod_sse.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_sse) - DEF_FUNC_HEAD(ccomplex_dotprod_sse) -GLOB_SYMB(ccomplex_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - - xorps %xmm6, %xmm6 # zero accumulators - - movaps 0(%eax), %xmm0 - - xorps %xmm7, %xmm7 # zero accumulators - - movaps 0(%edx), %xmm2 - - shrl $1, %ecx # ecx = n_2_ccomplex_blocks / 2 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000 -# -# movaps (%eax), %xmmA -# movaps (%edx), %xmmB -# -# movaps %xmmA, %xmmZ -# shufps $0xb1, %xmmZ, %xmmZ # swap internals -# -# mulps %xmmB, %xmmA -# mulps %xmmZ, %xmmB -# -# # SSE replacement for: pfpnacc %xmmB, %xmmA -# xorps %xmmPN, %xmmA -# movaps %xmmA, %xmmZ -# unpcklps %xmmB, %xmmA -# unpckhps %xmmB, %xmmZ -# movaps %xmmZ, %xmmY -# shufps $0x44, %xmmA, %xmmZ # b01000100 -# shufps $0xee, %xmmY, %xmmA # b11101110 -# addps %xmmZ, %xmmA -# -# addps %xmmA, %xmmC - -# A=xmm0, B=xmm2, Z=xmm4 -# A'=xmm1, B'=xmm3, Z'=xmm5 - - movaps 16(%eax), %xmm1 - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - - shufps $0xb1, %xmm4, %xmm4 # swap internals - movaps 16(%edx), %xmm3 - movaps %xmm1, %xmm5 - addps %xmm0, %xmm6 - mulps %xmm3, %xmm1 - shufps $0xb1, %xmm5, %xmm5 # swap internals - addps %xmm1, %xmm6 - mulps %xmm4, %xmm2 - movaps 32(%eax), %xmm0 - addps %xmm2, %xmm7 - mulps %xmm5, %xmm3 - - addl $32, %eax - - movaps 32(%edx), %xmm2 - addps %xmm3, %xmm7 - - addl $32, %edx - - - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's sse if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - movl 16(%ebp), %ecx # n_2_ccomplex_blocks - andl $1, %ecx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 preloaded - # from the main loop. - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - shufps $0xb1, %xmm4, %xmm4 # swap internals - addps %xmm0, %xmm6 - mulps %xmm4, %xmm2 - addps %xmm2, %xmm7 - - -.Leven: - # neg inversor - xorps %xmm1, %xmm1 - movl $0x80000000, 16(%ebp) - movss 16(%ebp), %xmm1 - shufps $0x11, %xmm1, %xmm1 # b00010001 # 0 -0 0 -0 - - # pfpnacc - xorps %xmm1, %xmm6 - - movaps %xmm6, %xmm2 - unpcklps %xmm7, %xmm6 - unpckhps %xmm7, %xmm2 - movaps %xmm2, %xmm3 - shufps $0x44, %xmm6, %xmm2 # b01000100 - shufps $0xee, %xmm3, %xmm6 # b11101110 - addps %xmm2, %xmm6 - - # xmm6 = r1 i2 r3 i4 - movl 20(%ebp), %eax # @result - movhlps %xmm6, %xmm4 # xmm4 = r3 i4 ?? ?? - addps %xmm4, %xmm6 # xmm6 = r1+r3 i2+i4 ?? ?? - movlps %xmm6, (%eax) # store low 2x32 bits (complex) to memory - - popl %ebp - ret - -FUNC_TAIL(ccomplex_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S deleted file mode 100644 index ef89ae6380..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_sse64.S +++ /dev/null @@ -1,195 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_ccomplex_blocks is != 0 -# -# -# ccomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_ccomplex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0] - input[1] * taps[1]; -# sum1 += input[0] * taps[1] + input[1] * taps[0]; -# sum2 += input[2] * taps[2] - input[3] * taps[3]; -# sum3 += input[2] * taps[3] + input[3] * taps[2]; -# -# input += 4; -# taps += 4; -# -# } while (--n_2_ccomplex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "ccomplex_dotprod_sse64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(ccomplex_dotprod_sse) - DEF_FUNC_HEAD(ccomplex_dotprod_sse) -GLOB_SYMB(ccomplex_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - xorps %xmm6, %xmm6 # zero accumulators - - movaps 0(%rdi), %xmm0 - - xorps %xmm7, %xmm7 # zero accumulators - - movaps 0(%rsi), %xmm2 - - shr $1, %rax # rax = n_2_ccomplex_blocks / 2 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - -# complex prod: C += A * B, w/ temp Z & Y (or B), xmmPN=$0x8000000080000000 -# -# movaps (%rdi), %xmmA -# movaps (%rsi), %xmmB -# -# movaps %xmmA, %xmmZ -# shufps $0xb1, %xmmZ, %xmmZ # swap internals -# -# mulps %xmmB, %xmmA -# mulps %xmmZ, %xmmB -# -# # SSE replacement for: pfpnacc %xmmB, %xmmA -# xorps %xmmPN, %xmmA -# movaps %xmmA, %xmmZ -# unpcklps %xmmB, %xmmA -# unpckhps %xmmB, %xmmZ -# movaps %xmmZ, %xmmY -# shufps $0x44, %xmmA, %xmmZ # b01000100 -# shufps $0xee, %xmmY, %xmmA # b11101110 -# addps %xmmZ, %xmmA -# -# addps %xmmA, %xmmC - -# A=xmm0, B=xmm2, Z=xmm4 -# A'=xmm1, B'=xmm3, Z'=xmm5 - - movaps 16(%rdi), %xmm1 - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - - shufps $0xb1, %xmm4, %xmm4 # swap internals - movaps 16(%rsi), %xmm3 - movaps %xmm1, %xmm5 - addps %xmm0, %xmm6 - mulps %xmm3, %xmm1 - shufps $0xb1, %xmm5, %xmm5 # swap internals - addps %xmm1, %xmm6 - mulps %xmm4, %xmm2 - movaps 32(%rdi), %xmm0 - addps %xmm2, %xmm7 - mulps %xmm5, %xmm3 - - add $32, %rdi - - movaps 32(%rsi), %xmm2 - addps %xmm3, %xmm7 - - add $32, %rsi - - - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Let's sse if original n_2_ccomplex_blocks was odd. - # If so, we've got 2 more taps to do. - - and $1, %rdx - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0/mm2 preloaded - # from the main loop. - - movaps %xmm0, %xmm4 - mulps %xmm2, %xmm0 - shufps $0xb1, %xmm4, %xmm4 # swap internals - addps %xmm0, %xmm6 - mulps %xmm4, %xmm2 - addps %xmm2, %xmm7 - - -.Leven: - # neg inversor - xorps %xmm1, %xmm1 - movl $0x80000000, -8(%rsp) - movss -8(%rsp), %xmm1 - shufps $0x11, %xmm1, %xmm1 # b00010001 # 0 -0 0 -0 - - # pfpnacc - xorps %xmm1, %xmm6 - - movaps %xmm6, %xmm2 - unpcklps %xmm7, %xmm6 - unpckhps %xmm7, %xmm2 - movaps %xmm2, %xmm3 - shufps $0x44, %xmm6, %xmm2 # b01000100 - shufps $0xee, %xmm3, %xmm6 # b11101110 - addps %xmm2, %xmm6 - - # xmm6 = r1 i2 r3 i4 - movhlps %xmm6, %xmm4 # xmm4 = r3 i4 ?? ?? - addps %xmm4, %xmm6 # xmm6 = r1+r3 i2+i4 ?? ?? - movlps %xmm6, (%rcx) # store low 2x32 bits (complex) to memory - - retq - -FUNC_TAIL(ccomplex_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h deleted file mode 100644 index ebb63c2587..0000000000 --- a/gnuradio-core/src/lib/filter/ccomplex_dotprod_x86.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _CCOMPLEX_DOTPROD_X86_H_ -#define _CCOMPLEX_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void -ccomplex_dotprod_3dnow (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, float *result); - -void -ccomplex_dotprod_3dnowext (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, float *result); - -void -ccomplex_dotprod_sse (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, float *result); - -#ifdef __cplusplus -} -#endif - -#endif /* _CCOMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S deleted file mode 100644 index df7761c407..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow.S +++ /dev/null @@ -1,192 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - .file "complex_dotprod_3dnow.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnow) - DEF_FUNC_HEAD(complex_dotprod_3dnow) -GLOB_SYMB(complex_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shrl $1, %ecx # ecx = n_2_complex_blocks / 2 - - # pshufw & pi2fw - pxor %mm0, %mm0 - punpcklwd 0(%eax), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - pi2fd %mm0, %mm0 - - pxor %mm1, %mm1 - punpcklwd 0(%eax), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - pi2fd %mm1, %mm1 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - - pxor %mm2, %mm2 - punpcklwd 4(%eax), %mm2 - psrad $16, %mm2 - punpckldq %mm2, %mm2 - - pfmul 8(%edx), %mm1 - pfadd %mm3, %mm7 - pi2fd %mm2, %mm2 - - pxor %mm3, %mm3 - punpcklwd 4(%eax), %mm3 - psrad $16, %mm3 - punpckhdq %mm3, %mm3 - - pfmul 16(%edx), %mm2 - pfadd %mm0, %mm4 - pi2fd %mm3, %mm3 - - pxor %mm0, %mm0 - punpcklwd 8(%eax), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - - pfmul 24(%edx), %mm3 - pfadd %mm1, %mm5 - - pxor %mm1, %mm1 - punpcklwd 8(%eax), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - - pi2fd %mm0, %mm0 - pi2fd %mm1, %mm1 - -#TODO: add prefetch - - addl $32, %edx - addl $8, %eax - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - movl 20(%ebp), %eax # result - - pfadd %mm6, %mm4 - - movq %mm4, (%eax) - femms - - popl %ebp - ret - -FUNC_TAIL(complex_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S deleted file mode 100644 index ac5a7d1be8..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnow64.S +++ /dev/null @@ -1,187 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "complex_dotprod_3dnow64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnow) - DEF_FUNC_HEAD(complex_dotprod_3dnow) -GLOB_SYMB(complex_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shr $1, %rax # rax = n_2_complex_blocks / 2 - - # pshufw & pi2fw - pxor %mm0, %mm0 - punpcklwd 0(%rdi), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - pi2fd %mm0, %mm0 - - pxor %mm1, %mm1 - punpcklwd 0(%rdi), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - pi2fd %mm1, %mm1 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rsi), %mm0 - pfadd %mm2, %mm6 - - pxor %mm2, %mm2 - punpcklwd 4(%rdi), %mm2 - psrad $16, %mm2 - punpckldq %mm2, %mm2 - - pfmul 8(%rsi), %mm1 - pfadd %mm3, %mm7 - pi2fd %mm2, %mm2 - - pxor %mm3, %mm3 - punpcklwd 4(%rdi), %mm3 - psrad $16, %mm3 - punpckhdq %mm3, %mm3 - - pfmul 16(%rsi), %mm2 - pfadd %mm0, %mm4 - pi2fd %mm3, %mm3 - - pxor %mm0, %mm0 - punpcklwd 8(%rdi), %mm0 - psrad $16, %mm0 - punpckldq %mm0, %mm0 - - pfmul 24(%rsi), %mm3 - pfadd %mm1, %mm5 - - pxor %mm1, %mm1 - punpcklwd 8(%rdi), %mm1 - psrad $16, %mm1 - punpckhdq %mm1, %mm1 - - pi2fd %mm0, %mm0 - pi2fd %mm1, %mm1 - -#TODO: add prefetch - - add $32, %rsi - add $8, %rdi - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rsi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rsi), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - - movq %mm4, (%rcx) - femms - - retq - -FUNC_TAIL(complex_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S deleted file mode 100644 index 1d4be32c3b..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext.S +++ /dev/null @@ -1,171 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - .file "complex_dotprod_3dnowext.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnowext) - DEF_FUNC_HEAD(complex_dotprod_3dnowext) -GLOB_SYMB(complex_dotprod_3dnowext): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shrl $1, %ecx # ecx = n_2_complex_blocks / 2 - - movd 0(%eax), %mm0 - pshufw $0x55, %mm0, %mm1 # b01010101 - pshufw $0, %mm0, %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - pi2fw %mm1, %mm1 - pi2fw %mm0, %mm0 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - - pshufw $0, 4(%eax), %mm2 - - pfmul 8(%edx), %mm1 - pfadd %mm3, %mm7 - pi2fw %mm2, %mm2 - - pshufw $0x55, 4(%eax), %mm3 # b01010101 - - pfmul 16(%edx), %mm2 - pi2fw %mm3, %mm3 - pfadd %mm0, %mm4 - - pshufw $0, 8(%eax), %mm0 - - pfmul 24(%edx), %mm3 - pfadd %mm1, %mm5 - - pshufw $0x55, 8(%eax), %mm1 # b01010101 - pi2fw %mm0, %mm0 - -#TODO: add prefetch - - addl $32, %edx - addl $8, %eax - pi2fw %mm1, %mm1 - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - movl 20(%ebp), %eax # result - pfadd %mm6, %mm4 - movq %mm4, (%eax) - - femms - - popl %ebp - ret - -FUNC_TAIL(complex_dotprod_3dnowext) - .ident "Hand coded x86 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S b/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S deleted file mode 100644 index 018fefe28a..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_3dnowext64.S +++ /dev/null @@ -1,168 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "complex_dotprod_3dnowext64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_3dnowext) - DEF_FUNC_HEAD(complex_dotprod_3dnowext) -GLOB_SYMB(complex_dotprod_3dnowext): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - - shr $1, %rax # rax = n_2_complex_blocks / 2 - - movd 0(%rdi), %mm0 - pshufw $0x55, %mm0, %mm1 # b01010101 - pshufw $0, %mm0, %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - pi2fw %mm1, %mm1 - pi2fw %mm0, %mm0 - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rsi), %mm0 - pfadd %mm2, %mm6 - - pshufw $0, 4(%rdi), %mm2 - - pfmul 8(%rsi), %mm1 - pfadd %mm3, %mm7 - pi2fw %mm2, %mm2 - - pshufw $0x55, 4(%rdi), %mm3 # b01010101 - - pfmul 16(%rsi), %mm2 - pi2fw %mm3, %mm3 - pfadd %mm0, %mm4 - - pshufw $0, 8(%rdi), %mm0 - - pfmul 24(%rsi), %mm3 - pfadd %mm1, %mm5 - - pshufw $0x55, 8(%rdi), %mm1 # b01010101 - pi2fw %mm0, %mm0 - -#TODO: add prefetch - - add $32, %rsi - add $8, %rdi - pi2fw %mm1, %mm1 - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rsi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rsi), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - pfadd %mm6, %mm4 - movq %mm4, (%rcx) - - femms - - retq - -FUNC_TAIL(complex_dotprod_3dnowext) - .ident "Hand coded x86_64 3DNow!Ext assembly" - - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc b/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc deleted file mode 100644 index 229cbe9785..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_complex.h> -#include "complex_dotprod_generic.h" - - -void -complex_dotprod_generic (const short *input, - const float *taps, unsigned n_2_complex_blocks, - float *result) -{ - gr_complex sum0(0,0); - gr_complex sum1(0,0); - - do { - const gr_complex tap0(taps[0], taps[1]); - const gr_complex tap1(taps[2], taps[3]); - - sum0 += (float)input[0] * tap0; - sum1 += (float)input[1] * tap1; - - input += 4; - taps += 8; - - } while (--n_2_complex_blocks != 0); - - - sum0 += sum1; - result[0] = sum0.real(); - result[1] = sum0.imag(); -} diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h b/gnuradio-core/src/lib/filter/complex_dotprod_generic.h deleted file mode 100644 index 152f6e4592..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_generic.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _COMPLEX_DOTPROD_GENERIC_H_ -#define _COMPLEX_DOTPROD_GENERIC_H_ - -#include <gr_core_api.h> - -GR_CORE_API void -complex_dotprod_generic (const short *input, - const float *taps, unsigned n_2_complex_blocks, - float *result); - - -#endif /* _COMPLEX_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_sse.S b/gnuradio-core/src/lib/filter/complex_dotprod_sse.S deleted file mode 100644 index fff1057ddb..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_sse.S +++ /dev/null @@ -1,206 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "complex_dotprod_sse.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_sse) - DEF_FUNC_HEAD(complex_dotprod_sse) -GLOB_SYMB(complex_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - andl $0x3, %ecx - jmp .L1_test - - .p2align 4 -.Loop1: - - pxor %mm0, %mm0 - punpcklwd 0(%eax), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps (%edx), %xmm0 - addl $0x10, %edx - addl $4, %eax - addps %xmm0, %xmm4 -.L1_test: - decl %ecx - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movl 16(%ebp), %ecx - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shrl $2, %ecx # n_2_complex_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - pxor %mm0, %mm0 - punpcklwd 0(%eax), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - movaps %xmm5, %xmm2 - - pxor %mm1, %mm1 - punpcklwd 4(%eax), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - movaps %xmm5, %xmm3 - - # we know ecx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%edx), %xmm0 - addps %xmm2, %xmm6 - - pxor %mm2, %mm2 - punpcklwd 8(%eax), %mm2 - psrad $16, %mm2 - cvtpi2ps %mm2, %xmm2 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%edx), %xmm1 - addps %xmm3, %xmm7 - - pxor %mm3, %mm3 - punpcklwd 12(%eax), %mm3 - psrad $16, %mm3 - cvtpi2ps %mm3, %xmm3 - shufps $0x50, %xmm3, %xmm3 - - mulps 0x20(%edx), %xmm2 - addps %xmm0, %xmm4 - - pxor %mm0, %mm0 - punpcklwd 16(%eax), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%edx), %xmm3 - addps %xmm1, %xmm5 - - pxor %mm1, %mm1 - punpcklwd 20(%eax), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - addl $0x40, %edx - addl $0x10, %eax - decl %ecx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movl 20(%ebp), %eax # @result - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%eax) # store low 2x32 bits (complex) to memory - - emms - popl %ebp - ret - -FUNC_TAIL(complex_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S deleted file mode 100644 index 77f0c31782..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_sse64.S +++ /dev/null @@ -1,202 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# complex_dotprod_generic (const short *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "complex_dotprod_sse64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(complex_dotprod_sse) - DEF_FUNC_HEAD(complex_dotprod_sse) -GLOB_SYMB(complex_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - and $0x3, %rax - jmp .L1_test - - .p2align 4 -.Loop1: - - pxor %mm0, %mm0 - punpcklwd 0(%rdi), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps (%rsi), %xmm0 - add $0x10, %rsi - add $4, %rdi - addps %xmm0, %xmm4 -.L1_test: - dec %rax - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movaps %xmm5, %xmm6 # zero remaining accumulators - shr $2, %rdx # n_2_complex_blocks / 4 - movaps %xmm5, %xmm7 - - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - pxor %mm0, %mm0 - punpcklwd 0(%rdi), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - movaps %xmm5, %xmm2 - - pxor %mm1, %mm1 - punpcklwd 4(%rdi), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - movaps %xmm5, %xmm3 - - # we know rax is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%rsi), %xmm0 - addps %xmm2, %xmm6 - - pxor %mm2, %mm2 - punpcklwd 8(%rdi), %mm2 - psrad $16, %mm2 - cvtpi2ps %mm2, %xmm2 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%rsi), %xmm1 - addps %xmm3, %xmm7 - - pxor %mm3, %mm3 - punpcklwd 12(%rdi), %mm3 - psrad $16, %mm3 - cvtpi2ps %mm3, %xmm3 - shufps $0x50, %xmm3, %xmm3 - - mulps 0x20(%rsi), %xmm2 - addps %xmm0, %xmm4 - - pxor %mm0, %mm0 - punpcklwd 16(%rdi), %mm0 - psrad $16, %mm0 - cvtpi2ps %mm0, %xmm0 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%rsi), %xmm3 - addps %xmm1, %xmm5 - - pxor %mm1, %mm1 - punpcklwd 20(%rdi), %mm1 - psrad $16, %mm1 - cvtpi2ps %mm1, %xmm1 - shufps $0x50, %xmm1, %xmm1 - - add $0x40, %rsi - add $0x10, %rdi - dec %rdx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%rcx) # store low 2x32 bits (complex) to memory - - emms - retq - -FUNC_TAIL(complex_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/complex_dotprod_x86.h b/gnuradio-core/src/lib/filter/complex_dotprod_x86.h deleted file mode 100644 index aad9fb5e9d..0000000000 --- a/gnuradio-core/src/lib/filter/complex_dotprod_x86.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _COMPLEX_DOTPROD_X86_H_ -#define _COMPLEX_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void -complex_dotprod_3dnow (const short *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -void -complex_dotprod_3dnowext (const short *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -void -complex_dotprod_sse (const short *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -#ifdef __cplusplus -} -#endif - -#endif /* _COMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c deleted file mode 100644 index e7c6b266e3..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <dotprod_ccf_armv7_a.h> - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - - -#if 0 - -void -dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) -{ - size_t i; - res[0] = 0; - res[1] = 0; - - for (i = 0; i < n; i++){ - res[0] += a[2*i] * b[i]; - res[1] += a[2*i+1] * b[i]; - } -} - -#else - -/* - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - */ -void -dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) -{ - - asm volatile( - "vmov.f32 q14, #0.0 \n\t" - "vmov.f32 q15, #0.0 \n\t" - "1: \n\t" - "subs %2, %2, #4 \n\t" - "vld2.f32 {q0-q1}, [%0]! \n\t" - "vld1.f32 {q2}, [%1]! \n\t" - "vmla.f32 q14, q0, q2 \n\t" - "vmla.f32 q15, q1, q2 \n\t" - "bgt 1b \n\t" - "vpadd.f32 d0, d28, d29 \n\t" - "vpadd.f32 d1, d30, d31 \n\t" - "vpadd.f32 d0, d0, d1 \n\t" - "vst1.f32 {d0}, [%3] \n\t" - - : "+&r"(a), "+&r"(b), "+&r"(n) - : "r"(res) - : "memory", "d0", "d1", "d2", "d3", "d4", "d5", - "d28", "d29", "d30", "d31" ); -} - - -#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h deleted file mode 100644 index e42d6d10be..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DOTPROD_CCF_ARMV7_A_H -#define INCLUDED_DOTPROD_CCF_ARMV7_A_H - -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * <pre> - * - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - * - * </pre> - */ -void dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n); - -#ifdef __cplusplus -} -#endif - -#endif /* INCLUDED_DOTPROD_CCF_ARMV7_A_H */ diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c deleted file mode 100644 index 53d6df714f..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <dotprod_fff_altivec.h> -#include <gr_altivec.h> - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - - -#if 0 - -float -dotprod_fff_altivec(const float *a, const float *b, size_t n) -{ - float sum = 0; - for (size_t i = 0; i < n; i++){ - sum += a[i] * b[i]; - } - return sum; -} - -#else - -/* - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - */ -float -dotprod_fff_altivec(const float *_a, const float *_b, size_t n) -{ - const vec_float4 *a = (const vec_float4 *) _a; - const vec_float4 *b = (const vec_float4 *) _b; - - static const size_t UNROLL_CNT = 4; - - n = gr_p2_round_down(n, 4); - size_t loop_cnt = n / (UNROLL_CNT * FLOATS_PER_VEC); - size_t nleft = n % (UNROLL_CNT * FLOATS_PER_VEC); - - // printf("n = %zd, loop_cnt = %zd, nleft = %zd\n", n, loop_cnt, nleft); - - // Used with vperm to build a* from p* - vec_uchar16 lvsl_a = vec_lvsl(0, _a); - - vec_float4 p0, p1, p2, p3; - vec_float4 a0, a1, a2, a3; - vec_float4 b0, b1, b2, b3; - vec_float4 acc0 = {0, 0, 0, 0}; - vec_float4 acc1 = {0, 0, 0, 0}; - vec_float4 acc2 = {0, 0, 0, 0}; - vec_float4 acc3 = {0, 0, 0, 0}; - - // wind in - - p0 = vec_ld(0*VS, a); - p1 = vec_ld(1*VS, a); - p2 = vec_ld(2*VS, a); - p3 = vec_ld(3*VS, a); - a += UNROLL_CNT; - - a0 = vec_perm(p0, p1, lvsl_a); - b0 = vec_ld(0*VS, b); - p0 = vec_ld(0*VS, a); - - size_t i; - for (i = 0; i < loop_cnt; i++){ - - a1 = vec_perm(p1, p2, lvsl_a); - b1 = vec_ld(1*VS, b); - p1 = vec_ld(1*VS, a); - acc0 = vec_madd(a0, b0, acc0); - - a2 = vec_perm(p2, p3, lvsl_a); - b2 = vec_ld(2*VS, b); - p2 = vec_ld(2*VS, a); - acc1 = vec_madd(a1, b1, acc1); - - a3 = vec_perm(p3, p0, lvsl_a); - b3 = vec_ld(3*VS, b); - p3 = vec_ld(3*VS, a); - acc2 = vec_madd(a2, b2, acc2); - - a += UNROLL_CNT; - b += UNROLL_CNT; - - a0 = vec_perm(p0, p1, lvsl_a); - b0 = vec_ld(0*VS, b); - p0 = vec_ld(0*VS, a); - acc3 = vec_madd(a3, b3, acc3); - } - - /* - * The compiler ought to be able to figure out that 0, 4, 8 and 12 - * are the only possible values for nleft. - */ - switch (nleft){ - case 0: - break; - - case 4: - acc0 = vec_madd(a0, b0, acc0); - break; - - case 8: - a1 = vec_perm(p1, p2, lvsl_a); - b1 = vec_ld(1*VS, b); - acc0 = vec_madd(a0, b0, acc0); - acc1 = vec_madd(a1, b1, acc1); - break; - - case 12: - a1 = vec_perm(p1, p2, lvsl_a); - b1 = vec_ld(1*VS, b); - acc0 = vec_madd(a0, b0, acc0); - a2 = vec_perm(p2, p3, lvsl_a); - b2 = vec_ld(2*VS, b); - acc1 = vec_madd(a1, b1, acc1); - acc2 = vec_madd(a2, b2, acc2); - break; - } - - acc0 = acc0 + acc1; - acc2 = acc2 + acc3; - acc0 = acc0 + acc2; - - return horizontal_add_f(acc0); -} - -#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h b/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h deleted file mode 100644 index a52370d56f..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_altivec.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DOTPROD_FFF_ALTIVEC_H -#define INCLUDED_DOTPROD_FFF_ALTIVEC_H - -#include <gr_core_api.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * <pre> - * - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - * - * </pre> - */ -float -dotprod_fff_altivec(const float *a, const float *b, size_t n); - -#ifdef __cplusplus -} -#endif - - -#endif /* INCLUDED_DOTPROD_FFF_ALTIVEC_H */ diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c deleted file mode 100644 index 68c448b356..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <dotprod_fff_armv7_a.h> - -/*! - * \param x any value - * \param pow2 must be a power of 2 - * \returns \p x rounded down to a multiple of \p pow2. - */ -static inline size_t -gr_p2_round_down(size_t x, size_t pow2) -{ - return x & -pow2; -} - - -#if 0 - -float -dotprod_fff_armv7_a(const float *a, const float *b, size_t n) -{ - float sum = 0; - size_t i; - for (i = 0; i < n; i++){ - sum += a[i] * b[i]; - } - return sum; -} - -#else - -/* - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - */ -float -dotprod_fff_armv7_a(const float *a, const float *b, size_t n) -{ - float s = 0; - - asm ("vmov.f32 q8, #0.0 \n\t" - "vmov.f32 q9, #0.0 \n\t" - "1: \n\t" - "subs %3, %3, #8 \n\t" - "vld1.32 {d0,d1,d2,d3}, [%1]! \n\t" - "vld1.32 {d4,d5,d6,d7}, [%2]! \n\t" - "vmla.f32 q8, q0, q2 \n\t" - "vmla.f32 q9, q1, q3 \n\t" - "bgt 1b \n\t" - "vadd.f32 q8, q8, q9 \n\t" - "vpadd.f32 d0, d16, d17 \n\t" - "vadd.f32 %0, s0, s1 \n\t" - : "=w"(s), "+r"(a), "+r"(b), "+r"(n) - :: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", - "d16", "d17", "d18", "d19"); - - return s; - -} - -#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h deleted file mode 100644 index 6cea45cea3..0000000000 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DOTPROD_FFF_ARMV7_A_H -#define INCLUDED_DOTPROD_FFF_ARMV7_A_H - -#include <gr_core_api.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * <pre> - * - * preconditions: - * - * n > 0 and a multiple of 4 - * a 4-byte aligned - * b 16-byte aligned - * - * </pre> - */ -float -dotprod_fff_armv7_a(const float *a, const float *b, size_t n); - -#ifdef __cplusplus -} -#endif - - -#endif /* INCLUDED_DOTPROD_FFF_ARMV7_A_H */ diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S deleted file mode 100644 index a4e69461e5..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow.S +++ /dev/null @@ -1,176 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "fcomplex_dotprod_3dnow.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_3dnow) - DEF_FUNC_HEAD(fcomplex_dotprod_3dnow) -GLOB_SYMB(fcomplex_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shrl $1, %ecx # ecx = n_2_complex_blocks / 2 - - movq 0(%eax), %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - punpckhdq %mm1, %mm1 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - - movq 8(%eax), %mm2 - - pfadd %mm3, %mm7 - - pfmul 8(%edx), %mm1 - - movq %mm2, %mm3 - punpckldq %mm2, %mm2 - punpckhdq %mm3, %mm3 - - - pfmul 16(%edx), %mm2 - pfadd %mm0, %mm4 - - movq 16(%eax), %mm0 - - pfadd %mm1, %mm5 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - - pfmul 24(%edx), %mm3 - - punpckhdq %mm1, %mm1 - - -#TODO: add prefetch? - - addl $32, %edx - addl $16, %eax - -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - - movl 20(%ebp), %eax # result - - pfadd %mm6, %mm4 - - movq %mm4, (%eax) - femms - - popl %ebp - ret - -FUNC_TAIL(fcomplex_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S deleted file mode 100644 index 9bbf56301f..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_3dnow64.S +++ /dev/null @@ -1,170 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -#include "assembly.h" - - - .file "fcomplex_dotprod_3dnow64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_3dnow) - DEF_FUNC_HEAD(fcomplex_dotprod_3dnow) -GLOB_SYMB(fcomplex_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shr $1, %rax # rax = n_2_complex_blocks / 2 - - movq 0(%rdi), %mm0 - - pxor %mm2, %mm2 - pxor %mm3, %mm3 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - punpckhdq %mm1, %mm1 - - - jmp .L1_test - - # - # 4 taps / loop - # something like ?? cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rsi), %mm0 - pfadd %mm2, %mm6 - - movq 8(%rdi), %mm2 - - pfadd %mm3, %mm7 - - pfmul 8(%rsi), %mm1 - - movq %mm2, %mm3 - punpckldq %mm2, %mm2 - punpckhdq %mm3, %mm3 - - - pfmul 16(%rsi), %mm2 - pfadd %mm0, %mm4 - - movq 16(%rdi), %mm0 - - pfadd %mm1, %mm5 - - movq %mm0, %mm1 - punpckldq %mm0, %mm0 - - pfmul 24(%rsi), %mm3 - - punpckhdq %mm1, %mm1 - - -#TODO: add prefetch? - - add $32, %rsi - add $16, %rdi - -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_2_complex_blocks was odd. If so, we've got 2 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 2 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rsi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rsi), %mm1 - pfadd %mm1, %mm5 - - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - - movq %mm4, (%rcx) # result - femms - - retq - -FUNC_TAIL(fcomplex_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S deleted file mode 100644 index e516f0a611..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse.S +++ /dev/null @@ -1,188 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "fcomplex_dotprod_sse.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_sse) - DEF_FUNC_HEAD(fcomplex_dotprod_sse) -GLOB_SYMB(fcomplex_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %eax # input - movl 12(%ebp), %edx # taps - movl 16(%ebp), %ecx - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - andl $0x3, %ecx - jmp .L1_test - - .p2align 4 -.Loop1: - - movlps 0(%eax), %xmm0 - shufps $0x50, %xmm0, %xmm0 # b01010000 - - mulps (%edx), %xmm0 - addl $0x10, %edx - addl $8, %eax - addps %xmm0, %xmm4 -.L1_test: - decl %ecx - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movl 16(%ebp), %ecx - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shrl $2, %ecx # n_2_complex_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movlps 0(%eax), %xmm0 - - movaps %xmm5, %xmm2 - movaps %xmm5, %xmm3 - - movlps 8(%eax), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - shufps $0x50, %xmm1, %xmm1 - - # we know ecx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - addps %xmm2, %xmm6 - movlps 0x10(%eax), %xmm2 - - addps %xmm3, %xmm7 - - mulps (%edx), %xmm0 - - movlps 0x18(%eax), %xmm3 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%edx), %xmm1 - - shufps $0x50, %xmm3, %xmm3 - - addps %xmm0, %xmm4 - movlps 0x20(%eax), %xmm0 - - addps %xmm1, %xmm5 - - mulps 0x20(%edx), %xmm2 - - movlps 0x28(%eax), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%edx), %xmm3 - - shufps $0x50, %xmm1, %xmm1 - - addl $0x40, %edx - addl $0x20, %eax - decl %ecx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movl 20(%ebp), %eax # @result - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%eax) # store low 2x32 bits (complex) to memory - - popl %ebp - ret - -FUNC_TAIL(fcomplex_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S b/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S deleted file mode 100644 index 605d87130f..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_sse64.S +++ /dev/null @@ -1,183 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_2_complex_blocks is != 0 -# -# -# fcomplex_dotprod_generic (const float *input, -# const float *taps, unsigned n_2_complex_blocks, float *result) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[0] * taps[1]; -# sum2 += input[1] * taps[2]; -# sum3 += input[1] * taps[3]; -# -# input += 2; -# taps += 4; -# -# } while (--n_2_complex_blocks != 0); -# -# -# result[0] = sum0 + sum2; -# result[1] = sum1 + sum3; -# } -# - -# TODO: prefetch and better scheduling - -#include "assembly.h" - - - .file "fcomplex_dotprod_sse64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(fcomplex_dotprod_sse) - DEF_FUNC_HEAD(fcomplex_dotprod_sse) -GLOB_SYMB(fcomplex_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx, result: rcx - - mov %rdx, %rax - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_2_complex_blocks % 4) - - and $0x3, %rax - jmp .L1_test - - .p2align 4 -.Loop1: - - movlps 0(%rdi), %xmm0 - shufps $0x50, %xmm0, %xmm0 # b01010000 - - mulps (%rsi), %xmm0 - add $0x10, %rsi - add $8, %rdi - addps %xmm0, %xmm4 -.L1_test: - dec %rax - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shr $2, %rdx # n_2_complex_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movlps 0(%rdi), %xmm0 - - movaps %xmm5, %xmm2 - movaps %xmm5, %xmm3 - - movlps 8(%rdi), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - shufps $0x50, %xmm1, %xmm1 - - # we know rdx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - addps %xmm2, %xmm6 - movlps 0x10(%rdi), %xmm2 - - addps %xmm3, %xmm7 - - mulps (%rsi), %xmm0 - - movlps 0x18(%rdi), %xmm3 - shufps $0x50, %xmm2, %xmm2 - - mulps 0x10(%rsi), %xmm1 - - shufps $0x50, %xmm3, %xmm3 - - addps %xmm0, %xmm4 - movlps 0x20(%rdi), %xmm0 - - addps %xmm1, %xmm5 - - mulps 0x20(%rsi), %xmm2 - - movlps 0x28(%rdi), %xmm1 - shufps $0x50, %xmm0, %xmm0 - - mulps 0x30(%rsi), %xmm3 - - shufps $0x50, %xmm1, %xmm1 - - add $0x40, %rsi - add $0x20, %rdi - dec %rdx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 2x2 partial sums. We need - # to compute a "horizontal complex add" across xmm4. - -.Lcleanup: # xmm4 = r1 i2 r3 i4 - movhlps %xmm4, %xmm0 # xmm0 = ?? ?? r1 r2 - addps %xmm4, %xmm0 # xmm0 = ?? ?? r1+r3 i2+i4 - movlps %xmm0, (%rcx) # store low 2x32 bits (complex) to memory - - retq - -FUNC_TAIL(fcomplex_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h deleted file mode 100644 index b7eddf936b..0000000000 --- a/gnuradio-core/src/lib/filter/fcomplex_dotprod_x86.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _FCOMPLEX_DOTPROD_X86_H_ -#define _FCOMPLEX_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -void -fcomplex_dotprod_3dnow (const float *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -void -fcomplex_dotprod_sse (const float *input, - const float *taps, unsigned n_2_complex_blocks, float *result); - -#ifdef __cplusplus -} -#endif - -#endif /* _FCOMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i deleted file mode 100644 index 12580aa101..0000000000 --- a/gnuradio-core/src/lib/filter/filter.i +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,2006,2007,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%{ -#include <gr_iir_filter_ffd.h> -#include <gr_single_pole_iir_filter_ff.h> -#include <gr_single_pole_iir_filter_cc.h> -#include <gr_hilbert_fc.h> -#include <gr_filter_delay_fc.h> -#include <gr_fft_filter_ccc.h> -#include <gr_fft_filter_fff.h> -#include <gr_fractional_interpolator_ff.h> -#include <gr_fractional_interpolator_cc.h> -#include <gr_goertzel_fc.h> -#include <gr_pfb_channelizer_ccf.h> -#include <gr_pfb_synthesizer_ccf.h> -#include <gr_pfb_decimator_ccf.h> -#include <gr_pfb_interpolator_ccf.h> -#include <gr_pfb_arb_resampler_ccf.h> -#include <gr_pfb_arb_resampler_fff.h> -#include <gr_pfb_clock_sync_ccf.h> -#include <gr_pfb_clock_sync_fff.h> -#include <gr_dc_blocker_cc.h> -#include <gr_dc_blocker_ff.h> -%} - -%include "gr_iir_filter_ffd.i" -%include "gr_single_pole_iir_filter_ff.i" -%include "gr_single_pole_iir_filter_cc.i" -%include "gr_hilbert_fc.i" -%include "gr_filter_delay_fc.i" -%include "gr_fft_filter_ccc.i" -%include "gr_fft_filter_fff.i" -%include "gr_fractional_interpolator_ff.i" -%include "gr_fractional_interpolator_cc.i" -%include "gr_goertzel_fc.i" -%include "gr_pfb_channelizer_ccf.i" -%include "gr_pfb_synthesizer_ccf.i" -%include "gr_pfb_decimator_ccf.i" -%include "gr_pfb_interpolator_ccf.i" -%include "gr_pfb_arb_resampler_ccf.i" -%include "gr_pfb_arb_resampler_fff.i" -%include "gr_pfb_decimator_ccf.i" -%include "gr_pfb_interpolator_ccf.i" -%include "gr_pfb_arb_resampler_ccf.i" -%include "gr_pfb_clock_sync_ccf.i" -%include "gr_pfb_clock_sync_fff.i" -%include "gr_dc_blocker_cc.i" -%include "gr_dc_blocker_ff.i" - -%include "filter_generated.i" diff --git a/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S b/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S deleted file mode 100644 index 914b652af5..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_3dnow.S +++ /dev/null @@ -1,152 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_3dnow.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_3dnow) - DEF_FUNC_HEAD(float_dotprod_3dnow) -GLOB_SYMB(float_dotprod_3dnow): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shrl $1, %ecx # ecx = n_4_float_blocks / 2 - movq 0(%eax), %mm0 - movq 8(%eax), %mm1 - pxor %mm2, %mm2 - pxor %mm3, %mm3 - jmp .L1_test - - # - # 8 taps / loop - # something like 6 cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%edx), %mm0 - pfadd %mm2, %mm6 - movq 16(%eax), %mm2 - - pfmul 8(%edx), %mm1 - pfadd %mm3, %mm7 - movq 24(%eax), %mm3 - - pfmul 16(%edx), %mm2 - pfadd %mm0, %mm4 - movq 32(%eax), %mm0 - - pfmul 24(%edx), %mm3 - pfadd %mm1, %mm5 - movq 40(%eax), %mm1 - - addl $32, %edx - addl $32, %eax -.L1_test: - decl %ecx - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_4_float_blocks was odd. If so, we've got 4 more - # taps to do. - - movl 16(%ebp), %ecx - pfadd %mm2, %mm6 - andl $1, %ecx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 4 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%edx), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%edx), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - pfacc %mm4, %mm4 - - movd %mm4, 16(%ebp) - femms - flds 16(%ebp) - - popl %ebp - ret - -FUNC_TAIL(float_dotprod_3dnow) - .ident "Hand coded x86 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S b/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S deleted file mode 100644 index 6670553a36..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_3dnow64.S +++ /dev/null @@ -1,149 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_3dnow64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_3dnow) - DEF_FUNC_HEAD(float_dotprod_3dnow) -GLOB_SYMB(float_dotprod_3dnow): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx - - mov %rdx, %rax - - # zero accumulators - - pxor %mm4, %mm4 # mm4 = 0 0 - pxor %mm5, %mm5 # mm5 = 0 0 - pxor %mm6, %mm6 # mm6 = 0 0 - pxor %mm7, %mm7 # mm7 = 0 0 - - shr $1, %rax # rax = n_4_float_blocks / 2 - movq 0(%rsi), %mm0 - movq 8(%rsi), %mm1 - pxor %mm2, %mm2 - pxor %mm3, %mm3 - jmp .L1_test - - # - # 8 taps / loop - # something like 6 cycles / loop - # - - .p2align 4 -.Loop1: - pfmul 0(%rdi), %mm0 - pfadd %mm2, %mm6 - movq 16(%rsi), %mm2 - - pfmul 8(%rdi), %mm1 - pfadd %mm3, %mm7 - movq 24(%rsi), %mm3 - - pfmul 16(%rdi), %mm2 - pfadd %mm0, %mm4 - movq 32(%rsi), %mm0 - - pfmul 24(%rdi), %mm3 - pfadd %mm1, %mm5 - movq 40(%rsi), %mm1 - - add $32, %rdi - add $32, %rsi -.L1_test: - dec %rax - jge .Loop1 - - # We've handled the bulk of multiplies up to here. - # Now accumulate the final two additions and see if original - # n_4_float_blocks was odd. If so, we've got 4 more - # taps to do. - - pfadd %mm2, %mm6 - and $1, %rdx - pfadd %mm3, %mm7 - je .Leven - - # The count was odd, do 4 more taps. - # Note that we've already got mm0 and mm1 preloaded - # from the main loop. - - pfmul 0(%rdi), %mm0 - pfadd %mm0, %mm4 - pfmul 8(%rdi), %mm1 - pfadd %mm1, %mm5 - -.Leven: - # at this point mm4, mm5, mm6 and mm7 contain partial sums - - pfadd %mm7, %mm6 - pfadd %mm5, %mm4 - pfadd %mm6, %mm4 - pfacc %mm4, %mm4 - - movd %mm4, -8(%rsp) - movss -8(%rsp), %xmm0 - femms - - retq - -FUNC_TAIL(float_dotprod_3dnow) - .ident "Hand coded x86_64 3DNow! assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_generic.c b/gnuradio-core/src/lib/filter/float_dotprod_generic.c deleted file mode 100644 index fb91390362..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_generic.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "float_dotprod_generic.h" - - -float -float_dotprod_generic (const float *input, - const float *taps, unsigned n_4_float_blocks) -{ - float sum0 = 0; - float sum1 = 0; - float sum2 = 0; - float sum3 = 0; - - do { - - sum0 += input[0] * taps[0]; - sum1 += input[1] * taps[1]; - sum2 += input[2] * taps[2]; - sum3 += input[3] * taps[3]; - - input += 4; - taps += 4; - - } while (--n_4_float_blocks != 0); - - - return sum0 + sum1 + sum2 + sum3; -} diff --git a/gnuradio-core/src/lib/filter/float_dotprod_generic.h b/gnuradio-core/src/lib/filter/float_dotprod_generic.h deleted file mode 100644 index dee967642a..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_generic.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _FLOAT_DOTPROD_GENERIC_H_ -#define _FLOAT_DOTPROD_GENERIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -float -float_dotprod_generic (const float *input, - const float *taps, unsigned n_4_float_blocks); - - -#ifdef __cplusplus -} -#endif - - - -#endif /* _FLOAT_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/float_dotprod_sse.S b/gnuradio-core/src/lib/filter/float_dotprod_sse.S deleted file mode 100644 index beddc75b08..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_sse.S +++ /dev/null @@ -1,171 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_sse.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_sse) - DEF_FUNC_HEAD(float_dotprod_sse) -GLOB_SYMB(float_dotprod_sse): - pushl %ebp - movl %esp, %ebp - movl 8(%ebp), %edx - movl 12(%ebp), %eax - movl 16(%ebp), %ecx - - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_4_float_blocks % 4) - - andl $0x3, %ecx - jmp .L1_test - - .p2align 4 -.Loop1: - movaps (%eax), %xmm0 - mulps (%edx), %xmm0 - addl $0x10, %edx - addl $0x10, %eax - addps %xmm0, %xmm4 -.L1_test: - decl %ecx - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movl 16(%ebp), %ecx - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shrl $2, %ecx # n_4_float_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movaps 0x00(%eax), %xmm0 - movaps %xmm5, %xmm2 - movaps 0x10(%eax), %xmm1 - movaps %xmm5, %xmm3 - - # we know ecx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%edx), %xmm0 - addps %xmm2, %xmm6 - movaps 0x20(%eax), %xmm2 - - mulps 0x10(%edx), %xmm1 - addps %xmm3, %xmm7 - movaps 0x30(%eax), %xmm3 - - mulps 0x20(%edx), %xmm2 - addps %xmm0, %xmm4 - movaps 0x40(%eax), %xmm0 - - mulps 0x30(%edx), %xmm3 - addps %xmm1, %xmm5 - movaps 0x50(%eax), %xmm1 - - addl $0x40, %edx - addl $0x40, %eax - decl %ecx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 4 partial sums. We need - # to compute a "horizontal add" across xmm4. - # This is a fairly nasty operation... - -.Lcleanup: # xmm4 = d1 d2 d3 d4 - xorps %xmm0, %xmm0 # xmm0 = 0 0 0 0 (may be unnecessary) - movhlps %xmm4, %xmm0 # xmm0 = 0 0 d1 d2 - addps %xmm4, %xmm0 # xmm0 = d1 d2 d1+d3 d2+d4 - movaps %xmm0, %xmm1 # xmm1 = d1 d2 d1+d3 d2+d4 - shufps $0xE1, %xmm4, %xmm1 # xmm1 = d1 d2 d2+d4 d1+d3 - addss %xmm1, %xmm0 # xmm1 = d1 d2 d1+d3 d1+d2+d3+d4 - movss %xmm0, 16(%ebp) # store low 32 bits (sum) to memory - flds 16(%ebp) # and load onto FPU stack for return - - popl %ebp - ret - -FUNC_TAIL(float_dotprod_sse) - .ident "Hand coded x86 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_sse64.S b/gnuradio-core/src/lib/filter/float_dotprod_sse64.S deleted file mode 100644 index 3d425b26bf..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_sse64.S +++ /dev/null @@ -1,165 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# input and taps are guarenteed to be 16 byte aligned. -# n_4_float_blocks is != 0 -# -# -# float -# float_dotprod_generic (const float *input, -# const float *taps, unsigned n_4_float_blocks) -# { -# float sum0 = 0; -# float sum1 = 0; -# float sum2 = 0; -# float sum3 = 0; -# -# do { -# -# sum0 += input[0] * taps[0]; -# sum1 += input[1] * taps[1]; -# sum2 += input[2] * taps[2]; -# sum3 += input[3] * taps[3]; -# -# input += 4; -# taps += 4; -# -# } while (--n_4_float_blocks != 0); -# -# -# return sum0 + sum1 + sum2 + sum3; -# } -# - -#include "assembly.h" - - - .file "float_dotprod_sse64.S" - .version "01.01" -.text - .p2align 4 -.globl GLOB_SYMB(float_dotprod_sse) - DEF_FUNC_HEAD(float_dotprod_sse) -GLOB_SYMB(float_dotprod_sse): - - # intput: rdi, taps: rsi, n_2_ccomplex_blocks: rdx - - mov %rdx, %rax - - # xmm0 xmm1 xmm2 xmm3 are used to hold taps and the result of mults - # xmm4 xmm5 xmm6 xmm7 are used to hold the accumulated results - - xorps %xmm4, %xmm4 # zero two accumulators - xorps %xmm5, %xmm5 # xmm5 holds zero for use below - - # first handle any non-zero remainder of (n_4_float_blocks % 4) - - and $0x3, %rax - jmp .L1_test - - .p2align 4 -.Loop1: - movaps (%rsi), %xmm0 - mulps (%rdi), %xmm0 - add $0x10, %rdi - add $0x10, %rsi - addps %xmm0, %xmm4 -.L1_test: - dec %rax - jge .Loop1 - - - # set up for primary loop which is unrolled 4 times - - movaps %xmm5, %xmm6 # zero remaining accumulators - movaps %xmm5, %xmm7 - - shr $2, %rdx # n_4_float_blocks / 4 - je .Lcleanup # if zero, take short path - - # finish setup and loop priming - - movaps 0x00(%rsi), %xmm0 - movaps %xmm5, %xmm2 - movaps 0x10(%rsi), %xmm1 - movaps %xmm5, %xmm3 - - # we know rdx is not zero, we checked above, - # hence enter loop at top - - .p2align 4 -.Loop2: - mulps (%rdi), %xmm0 - addps %xmm2, %xmm6 - movaps 0x20(%rsi), %xmm2 - - mulps 0x10(%rdi), %xmm1 - addps %xmm3, %xmm7 - movaps 0x30(%rsi), %xmm3 - - mulps 0x20(%rdi), %xmm2 - addps %xmm0, %xmm4 - movaps 0x40(%rsi), %xmm0 - - mulps 0x30(%rdi), %xmm3 - addps %xmm1, %xmm5 - movaps 0x50(%rsi), %xmm1 - - add $0x40, %rdi - add $0x40, %rsi - dec %rdx - jne .Loop2 - - # OK, now we've done with all the multiplies, but - # we still need to handle the unaccumulated - # products in xmm2 and xmm3 - - addps %xmm2, %xmm6 - addps %xmm3, %xmm7 - - # now we want to add all accumulators into xmm4 - - addps %xmm5, %xmm4 - addps %xmm6, %xmm7 - addps %xmm7, %xmm4 - - - # At this point, xmm4 contains 4 partial sums. We need - # to compute a "horizontal add" across xmm4. - # This is a fairly nasty operation... - -.Lcleanup: # xmm4 = d1 d2 d3 d4 - xorps %xmm0, %xmm0 # xmm0 = 0 0 0 0 (may be unnecessary) - movhlps %xmm4, %xmm0 # xmm0 = 0 0 d1 d2 - addps %xmm4, %xmm0 # xmm0 = d1 d2 d1+d3 d2+d4 - movaps %xmm0, %xmm1 # xmm1 = d1 d2 d1+d3 d2+d4 - shufps $0xE1, %xmm4, %xmm1 # xmm1 = d1 d2 d2+d4 d1+d3 - addss %xmm1, %xmm0 # xmm1 = d1 d2 d1+d3 d1+d2+d3+d4 - - retq - -FUNC_TAIL(float_dotprod_sse) - .ident "Hand coded x86_64 SSE assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/float_dotprod_x86.h b/gnuradio-core/src/lib/filter/float_dotprod_x86.h deleted file mode 100644 index fd1a2cc937..0000000000 --- a/gnuradio-core/src/lib/filter/float_dotprod_x86.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _FLOAT_DOTPROD_X86_H_ -#define _FLOAT_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -float -float_dotprod_3dnow (const float *input, - const float *taps, unsigned n_4_float_blocks); - -float -float_dotprod_sse (const float *input, - const float *taps, unsigned n_4_float_blocks); - -#ifdef __cplusplus -} -#endif - - - -#endif /* _FLOAT_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h b/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h deleted file mode 100644 index 98eeb33a31..0000000000 --- a/gnuradio-core/src/lib/filter/gcc_x86_cpuid.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. - * - * This file is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 3, or (at your option) any - * later version. - * - * This file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * Under Section 7 of GPL version 3, you are granted additional - * permissions described in the GCC Runtime Library Exception, version - * 3.1, as published by the Free Software Foundation. - * - * You should have received a copy of the GNU General Public License and - * a copy of the GCC Runtime Library Exception along with this program; - * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - * <http://www.gnu.org/licenses/>. - */ - -/* %ecx */ -#define bit_SSE3 (1 << 0) -#define bit_PCLMUL (1 << 1) -#define bit_SSSE3 (1 << 9) -#define bit_FMA (1 << 12) -#define bit_CMPXCHG16B (1 << 13) -#define bit_SSE4_1 (1 << 19) -#define bit_SSE4_2 (1 << 20) -#define bit_MOVBE (1 << 22) -#define bit_POPCNT (1 << 23) -#define bit_AES (1 << 25) -#define bit_XSAVE (1 << 26) -#define bit_OSXSAVE (1 << 27) -#define bit_AVX (1 << 28) - -/* %edx */ -#define bit_CMPXCHG8B (1 << 8) -#define bit_CMOV (1 << 15) -#define bit_MMX (1 << 23) -#define bit_FXSAVE (1 << 24) -#define bit_SSE (1 << 25) -#define bit_SSE2 (1 << 26) - -/* Extended Features */ -/* %ecx */ -#define bit_LAHF_LM (1 << 0) -#define bit_SSE4a (1 << 6) -#define bit_SSE5 (1 << 11) - -/* %edx */ -#define bit_LM (1 << 29) -#define bit_3DNOWP (1 << 30) -#define bit_3DNOW (1 << 31) - - -#if defined(__i386__) && defined(__PIC__) -/* %ebx may be the PIC register. */ -#if __GNUC__ >= 3 -#define __cpuid(level, a, b, c, d) \ - __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchg{l}\t{%%}ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - -#define __cpuid_count(level, count, a, b, c, d) \ - __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchg{l}\t{%%}ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level), "2" (count)) -#else -/* Host GCCs older than 3.0 weren't supporting Intel asm syntax - nor alternatives in i386 code. */ -#define __cpuid(level, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - -#define __cpuid_count(level, count, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level), "2" (count)) -#endif -#else -#define __cpuid(level, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - -#define __cpuid_count(level, count, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level), "2" (count)) -#endif - -/* Return highest supported input value for cpuid instruction. ext can - be either 0x0 or 0x8000000 to return highest supported value for - basic or extended cpuid information. Function returns 0 if cpuid - is not supported or whatever cpuid returns in eax register. If sig - pointer is non-null, then first four bytes of the signature - (as found in ebx register) are returned in location pointed by sig. */ - -static __inline unsigned int -__get_cpuid_max (unsigned int __ext, unsigned int *__sig) -{ - unsigned int __eax, __ebx, __ecx, __edx; - -#ifndef __x86_64__ -#if __GNUC__ >= 3 - /* See if we can use cpuid. On AMD64 we always can. */ - __asm__ ("pushf{l|d}\n\t" - "pushf{l|d}\n\t" - "pop{l}\t%0\n\t" - "mov{l}\t{%0, %1|%1, %0}\n\t" - "xor{l}\t{%2, %0|%0, %2}\n\t" - "push{l}\t%0\n\t" - "popf{l|d}\n\t" - "pushf{l|d}\n\t" - "pop{l}\t%0\n\t" - "popf{l|d}\n\t" - : "=&r" (__eax), "=&r" (__ebx) - : "i" (0x00200000)); -#else -/* Host GCCs older than 3.0 weren't supporting Intel asm syntax - nor alternatives in i386 code. */ - __asm__ ("pushfl\n\t" - "pushfl\n\t" - "popl\t%0\n\t" - "movl\t%0, %1\n\t" - "xorl\t%2, %0\n\t" - "pushl\t%0\n\t" - "popfl\n\t" - "pushfl\n\t" - "popl\t%0\n\t" - "popfl\n\t" - : "=&r" (__eax), "=&r" (__ebx) - : "i" (0x00200000)); -#endif - - if (!((__eax ^ __ebx) & 0x00200000)) - return 0; -#endif - - /* Host supports cpuid. Return highest supported cpuid input value. */ - __cpuid (__ext, __eax, __ebx, __ecx, __edx); - - if (__sig) - *__sig = __ebx; - - return __eax; -} - -/* Return cpuid data for requested cpuid level, as found in returned - eax, ebx, ecx and edx registers. The function checks if cpuid is - supported and returns 1 for valid cpuid information or 0 for - unsupported cpuid level. All pointers are required to be non-null. */ - -static __inline int -__get_cpuid (unsigned int __level, - unsigned int *__eax, unsigned int *__ebx, - unsigned int *__ecx, unsigned int *__edx) -{ - unsigned int __ext = __level & 0x80000000; - - if (__get_cpuid_max (__ext, 0) < __level) - return 0; - - __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx); - return 1; -} diff --git a/gnuradio-core/src/lib/filter/generate_all.py b/gnuradio-core/src/lib/filter/generate_all.py deleted file mode 100755 index 1da9f7209a..0000000000 --- a/gnuradio-core/src/lib/filter/generate_all.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from build_utils import output_glue - -import generate_gr_fir_filter_XXX -import generate_gr_interp_fir_filter_XXX -import generate_gr_rational_resampler_base_XXX -import generate_gr_freq_xlating_fir_filter_XXX -import generate_gr_fir_sysconfig_generic -import generate_gr_fir_sysconfig -import generate_gr_fir_util -import generate_gr_fir_XXX -import generate_gri_fir_filter_with_buffer_XXX - -def generate_all(): - generate_gr_fir_XXX.generate() - generate_gr_fir_filter_XXX.generate() - generate_gr_interp_fir_filter_XXX.generate() - generate_gr_rational_resampler_base_XXX.generate() - generate_gr_freq_xlating_fir_filter_XXX.generate() - generate_gr_fir_sysconfig_generic.generate() - generate_gr_fir_sysconfig.generate() - generate_gr_fir_util.generate() - generate_gri_fir_filter_with_buffer_XXX.generate() - output_glue('filter') - -if __name__ == '__main__': - generate_all() diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py deleted file mode 100755 index cf37fbb24d..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_XXX.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import re -from generate_utils import * - -roots = ['gr_fir_XXX', 'gr_fir_XXX_generic'] - - -# figure out accumulator type. Use biggest of input, output and tap type - -def code3_to_acc_code (code3): - if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c': - return 'c' - if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f': - return 'f' - if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i': - return 'i' - return 'i' # even short short short needs int accumulator - - -def code3_to_input_cast (code3): - if i_code (code3) == 's' and o_code (code3) == 'c': - return '(float)' - return '' - -def expand_h_cc (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - d['INPUT_CAST'] = code3_to_input_cast (code3) - acc_code = code3_to_acc_code (code3) - d['ACC_TYPE'] = char_to_type[acc_code] - if acc_code == 'c': - d['N_UNROLL'] = '2' - d['VRCOMPLEX_INCLUDE'] = '#include <gr_types.h>' - else: - d['N_UNROLL'] = '4' - d['VRCOMPLEX_INCLUDE'] = '' - return d - - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc (r, s) - - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py deleted file mode 100755 index 50cc586e59..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_filter_XXX.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import re -from generate_utils import * - -roots = ['gr_fir_filter_XXX'] - - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - return d - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py deleted file mode 100755 index 50d819fd18..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from generate_utils import * - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_h (): - out = open_and_log_name ('gr_fir_sysconfig.h', 'w') - if not out: - return - - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by generate_gr_fir_sysconfig.py - * Any changes made to this file will be overwritten. - */ - -#ifndef INCLUDED_GR_FIR_SYSCONFIG_H -#define INCLUDED_GR_FIR_SYSCONFIG_H - -#include <gr_types.h> - -''') - - # for sig in fir_signatures: - # out.write ('class gr_fir_' + sig + ';\n') - - out.write ('#include <gr_fir_util.h>\n') - - out.write ( -''' -/*! - * \\brief abstract base class for configuring the automatic selection of the - * fastest gr_fir for your platform. - * - * This is used internally by gr_fir_util. - */ - -class gr_fir_sysconfig { -public: - virtual ~gr_fir_sysconfig (); - -''') - - for sig in fir_signatures: - out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps) = 0;\n' % - (sig, sig, tap_type (sig)))) - - out.write ('\n') - - for sig in fir_signatures: - out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) = 0;\n' % - (sig, sig))) - - out.write ( -''' -}; - -/* - * This returns the single instance of the appropriate derived class. - * This function must be defined only once in the system, and should be defined - * in the platform specific code. - */ - -gr_fir_sysconfig *gr_fir_sysconfig_singleton (); - - -#endif /* INCLUDED_GR_FIR_SYSCONFIG_H */ -''') - out.close () - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_cc (): - out = open_and_log_name ('gr_fir_sysconfig.cc', 'w') - if not out: - return - - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by generate_gr_fir_sysconfig.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig.h> - -gr_fir_sysconfig::~gr_fir_sysconfig () -{ -} -''') - out.close () - - -# ---------------------------------------------------------------- - -def generate (): - make_gr_fir_sysconfig_h () - make_gr_fir_sysconfig_cc () - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py deleted file mode 100755 index dcbadd30f7..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from generate_utils import * - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_generic_h (): - out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w') - if not out: - return - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by - * generate_gr_fir_sysconfig_generic.py. - * - * Any changes made to this file will be overwritten. - */ - -#ifndef _GR_FIR_SYSCONFIG_GENERIC_H_ -#define _GR_FIR_SYSCONFIG_GENERIC_H_ - -#include <gr_fir_sysconfig.h> - -''') - - out.write ( -''' -class gr_fir_sysconfig_generic : public gr_fir_sysconfig { -public: -''') - - for sig in fir_signatures: - out.write ((' virtual gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps);\n' % - (sig, sig, tap_type (sig)))) - - out.write ('\n') - - for sig in fir_signatures: - out.write ((' virtual void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info);\n' % - (sig, sig))) - - out.write ( -''' -}; - - -#endif /* _GR_FIR_SYSCONFIG_GENERIC_H_ */ -''') - out.close () - - -# ---------------------------------------------------------------- - -def make_constructor (sig, out): - out.write (''' -static gr_fir_%s * -make_gr_fir_%s (const std::vector<%s> &taps) -{ - return new gr_fir_%s_generic (taps); -} -''' % (sig, sig, tap_type (sig), sig)) - - -def make_creator (sig, out): - out.write (''' -gr_fir_%s * -gr_fir_sysconfig_generic::create_gr_fir_%s (const std::vector<%s> &taps) -{ - return make_gr_fir_%s (taps); -} -''' % (sig, sig, tap_type (sig), sig)) - - -def make_info (sig, out): - out.write (''' -void -gr_fir_sysconfig_generic::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) -{ - info->resize (1); - (*info)[0].name = "generic"; - (*info)[0].create = make_gr_fir_%s; -} -''' % (sig, sig, sig)) - - -# ---------------------------------------------------------------- - -def make_gr_fir_sysconfig_generic_cc (): - out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w') - if not out: - return - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by - * generate_gr_fir_sysconfig_generic.py. - * - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_generic.h> - -''') - - for sig in fir_signatures: - out.write ('#include <gr_fir_%s_generic.h>\n' % (sig)) - - out.write ( -''' -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors returned by info - * ---------------------------------------------------------------- - */ -''') - - for sig in fir_signatures: - make_constructor (sig, out) - - out.write ( -''' -/* - * ---------------------------------------------------------------- - * return instances of the generic C++ versions of these classes. - * ---------------------------------------------------------------- - */ -''') - - for sig in fir_signatures: - make_creator (sig, out) - - out.write ( -''' -/* - * Return info about available implementations. - * - * This is the bottom of the concrete hierarchy, so we set the - * size of the vector to 1, and install our info. Classes derived - * from us invoke us first, then append their own info. - */ -''') - - for sig in fir_signatures: - make_info (sig, out) - - - out.close () - -# ---------------------------------------------------------------- - -def generate (): - make_gr_fir_sysconfig_generic_h () - make_gr_fir_sysconfig_generic_cc () - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py deleted file mode 100755 index 79fa51c278..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/env python -# -# Copyright 2003,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from generate_utils import * - -def make_info_struct (out, sig): - out.write ( -''' -struct GR_CORE_API gr_fir_%s_info { - const char *name; // implementation name, e.g., "generic", "SSE", "3DNow!" - gr_fir_%s *(*create)(const std::vector<%s> &taps); -}; -''' % (sig, sig, tap_type(sig))) - -def make_create (out, sig): - out.write (''' static gr_fir_%s *create_gr_fir_%s (const std::vector<%s> &taps); -''' % (sig, sig, tap_type (sig))) - -def make_info (out, sig): - out.write (''' static void get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info); -''' % (sig, sig)) - - -# ---------------------------------------------------------------- - -def make_gr_fir_util_h (): - out = open_and_log_name ('gr_fir_util.h', 'w') - if not out: - return - out.write (copyright) - - out.write ( -''' -/* - * WARNING: This file is automatically generated by - * generate_gr_fir_util.py. - * - * Any changes made to this file will be overwritten. - */ - -#ifndef INCLUDED_GR_FIR_UTIL_H -#define INCLUDED_GR_FIR_UTIL_H - -/*! - * \\brief routines to create gr_fir_XXX's - * - * This class handles selecting the fastest version of the finite - * implulse response filter available for your platform. This - * interface should be used by the rest of the system for creating - * gr_fir_XXX's. - * - * The trailing suffix has the form _IOT where I codes the input type, - * O codes the output type, and T codes the tap type. - * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), - * 'i' (short) - */ - -#include <gr_core_api.h> -#include <gr_types.h> - -''') - - for sig in fir_signatures: - out.write ('class gr_fir_%s;\n' % sig); - - out.write ('\n// structures returned by get_gr_fir_XXX_info methods\n\n') - - for sig in fir_signatures: - make_info_struct (out, sig) - - out.write (''' -struct GR_CORE_API gr_fir_util { - - // create a fast version of gr_fir_XXX. - -''') - - for sig in fir_signatures: - make_create (out, sig) - - out.write (''' - // Get information about all gr_fir_XXX implementations. - // This is useful for benchmarking, testing, etc without having to - // know a priori what's linked into this image - // - // The caller must pass in a valid pointer to a vector. - // The vector will be filled with structs describing the - // available implementations. - -''') - - for sig in fir_signatures: - make_info (out, sig) - - out.write (''' -}; - -#endif /* INCLUDED_GR_FIR_UTIL_H */ -''') - out.close () - - -# ---------------------------------------------------------------- - -def make_constructor_cc (out, sig): - out.write ( -''' -gr_fir_%s * -gr_fir_util::create_gr_fir_%s (const std::vector<%s> &taps) -{ - return gr_fir_sysconfig_singleton()->create_gr_fir_%s (taps); -} -''' % (sig, sig, tap_type (sig), sig)) - - -def make_info_cc (out, sig): - out.write ( -''' -void -gr_fir_util::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info) -{ - gr_fir_sysconfig_singleton()->get_gr_fir_%s_info (info); -} -''' % (sig, sig, sig)) - - -def make_gr_fir_util_cc (): - out = open_and_log_name ('gr_fir_util.cc', 'w') - if not out: - return - out.write (copyright) - out.write (''' - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_util.h> -#include <gr_fir_sysconfig.h> - -// -// There's no problem that can't be solved by the addition of -// another layer of indirection... -// - -// --- constructors --- - -''') - - for sig in fir_signatures: - make_constructor_cc (out, sig) - - out.write (''' -// --- info gatherers --- - -''') - - for sig in fir_signatures: - make_info_cc (out, sig) - - out.close () - - -# ---------------------------------------------------------------- - -def generate (): - make_gr_fir_util_h () - make_gr_fir_util_cc () - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py deleted file mode 100755 index 41c0b2b70c..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_freq_xlating_fir_filter_XXX.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import re -from generate_utils import * - -# files to generate - -fx_signatures = [ 'scf', 'scc', 'fcf', 'fcc', 'ccf', 'ccc' ] - -roots = ['gr_freq_xlating_fir_filter_XXX'] - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + i_code (code3) + 'cc' - return d - - -def generate (): - for r in roots: - for s in fx_signatures: - expand_h_cc_i (r, s) - - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py deleted file mode 100644 index 1dcfdadede..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_interp_fir_filter_XXX.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import re -from generate_utils import * - -roots = ['gr_interp_fir_filter_XXX'] - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - return d - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py b/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py deleted file mode 100644 index 1dafec3fbe..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gr_rational_resampler_base_XXX.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/env python -# -*- python -*- -# -# Copyright 2003,2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import re -from generate_utils import * - -roots = ['gr_rational_resampler_base_XXX'] - -def expand_h_cc_i (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - expand_template (d, root + '.i.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['FIR_TYPE'] = 'gr_fir_' + code3 - return d - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc_i (r, s) - -if __name__ == '__main__': - generate () - diff --git a/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py b/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py deleted file mode 100755 index 6442fb3dc2..0000000000 --- a/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- python -*- -# -# Copyright 2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import re -from generate_utils import * - -roots = ['gri_fir_filter_with_buffer_XXX',] - -def code3_to_acc_code (code3): - if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c': - return 'c' - if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f': - return 'f' - if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i': - return 'i' - return 'i' # even short short short needs int accumulator - -def code3_to_input_cast (code3): - if i_code (code3) == 's' and o_code (code3) == 'c': - return '(float)' - return '' - -def expand_h_cc (root, code3): - d = init_dict (root, code3) - expand_template (d, root + '.h.t') - expand_template (d, root + '.cc.t') - -def init_dict (root, code3): - name = re.sub ('X+', code3, root) - d = standard_dict (name, code3) - d['INPUT_CAST'] = code3_to_input_cast (code3) - acc_code = code3_to_acc_code (code3) - d['ACC_TYPE'] = char_to_type[acc_code] - return d - - -def generate (): - for r in roots: - for s in fir_signatures: - expand_h_cc (r, s) - - -if __name__ == '__main__': - generate () diff --git a/gnuradio-core/src/lib/filter/generate_utils.py b/gnuradio-core/src/lib/filter/generate_utils.py deleted file mode 100644 index 212ea95f9c..0000000000 --- a/gnuradio-core/src/lib/filter/generate_utils.py +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2003,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -## ----------------------------------------------------------------------- -## signatures defines which variations to generate (input, output, taps) - -fir_signatures = [ 'ccf', 'fcc', 'ccc', 'fff', 'scc', 'fsf' ] - - -## ----------------------------------------------------------------------- - -from build_utils import expand_template, copyright, open_and_log_name, standard_dict -from build_utils_codes import * diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc deleted file mode 100644 index da407caa0c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_adaptive_fir_ccc.h> -#include <gr_io_signature.h> - -gr_adaptive_fir_ccc::gr_adaptive_fir_ccc(const char *name, int decimation, - const std::vector<gr_complex> &taps) - : gr_sync_decimator (name, - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - decimation), - d_updated(false), d_taps(taps) -{ - set_history(d_taps.size()); -} - -void -gr_adaptive_fir_ccc::set_taps(const std::vector<gr_complex> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -gr_complex -gr_adaptive_fir_ccc::filter(gr_complex *x) -{ - // Generic dot product of d_taps[] and in[] - gr_complex acc(0.0, 0.0); - int l = d_taps.size(); - for (int k = 0; k < l; k++) - acc += d_taps[l-k-1] * x[k]; - return acc; -} - -int -gr_adaptive_fir_ccc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *)input_items[0]; - gr_complex *out = (gr_complex *)output_items[0]; - - if (d_updated) { - d_taps = d_new_taps; - set_history(d_taps.size()); - d_updated = false; - return 0; // history requirements may have changed. - } - - int j = 0, k, l = d_taps.size(); - for (int i = 0; i < noutput_items; i++) { - out[i] = filter(&in[j]); - - // Adjust taps - d_error = error(out[i]); - for (k = 0; k < l; k++) { - update_tap(d_taps[l-k-1], in[j+k]); - } - - j += decimation(); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h deleted file mode 100644 index d144c3eb46..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_ADAPTIVE_FIR_CCC_H -#define INCLUDED_GR_ADAPTIVE_FIR_CCC_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -/*! - * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_adaptive_fir_ccc : public gr_sync_decimator -{ -private: - std::vector<gr_complex> d_new_taps; - bool d_updated; - -protected: - gr_complex d_error; - std::vector<gr_complex> d_taps; - - // Override to calculate error signal per output - virtual gr_complex error(const gr_complex &out) = 0; - - // Override to calculate new weight from old, corresponding input - virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0; - - gr_complex filter(gr_complex *x); - - gr_adaptive_fir_ccc(const char *name, int decimation, - const std::vector<gr_complex> &taps); - -public: - void set_taps(const std::vector<gr_complex> &taps); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i deleted file mode 100644 index a3c875a3dc..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -class gr_adaptive_fir_ccc : public gr_sync_decimator -{ -protected: - gr_adaptive_fir_ccc(char *name, int decimation, - const std::vector<gr_complex> &taps); - -public: - void set_taps(const std::vector<gr_complex> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc deleted file mode 100644 index 045d9faf92..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_adaptive_fir_ccf.h> -#include <gr_io_signature.h> - -gr_adaptive_fir_ccf::gr_adaptive_fir_ccf(const char *name, int decimation, const std::vector<float> &taps) - : gr_sync_decimator (name, - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - decimation), - d_updated(false) -{ - d_taps = taps; - set_history(d_taps.size()); -} - -void gr_adaptive_fir_ccf::set_taps(const std::vector<float> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -int gr_adaptive_fir_ccf::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *)input_items[0]; - gr_complex *out = (gr_complex *)output_items[0]; - - if (d_updated) { - d_taps = d_new_taps; - set_history(d_taps.size()); - d_updated = false; - return 0; // history requirements may have changed. - } - - int j = 0, k, l = d_taps.size(); - for (int i = 0; i < noutput_items; i++) { - // Generic dot product of d_taps[] and in[] - gr_complex sum(0.0, 0.0); - for (k = 0; k < l; k++) - sum += d_taps[l-k-1]*in[j+k]; - out[i] = sum; - - // Adjust taps - d_error = error(sum); - for (k = 0; k < l; k++) { - //printf("%f ", d_taps[k]); - update_tap(d_taps[l-k-1], in[j+k]); - } - //printf("\n"); - - j += decimation(); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h deleted file mode 100644 index 7ec78099f8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_ADAPTIVE_FIR_CCF_H -#define INCLUDED_GR_ADAPTIVE_FIR_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -/*! - * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_adaptive_fir_ccf : public gr_sync_decimator -{ -private: - std::vector<float> d_new_taps; - bool d_updated; - -protected: - float d_error; - std::vector<float> d_taps; - - // Override to calculate error signal per output - virtual float error(const gr_complex &out) = 0; - - // Override to calculate new weight from old, corresponding input - virtual void update_tap(float &tap, const gr_complex &in) = 0; - - gr_adaptive_fir_ccf(const char *name, int decimation, const std::vector<float> &taps); - -public: - void set_taps(const std::vector<float> &taps); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i b/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i deleted file mode 100644 index 346defd4d1..0000000000 --- a/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -class gr_adaptive_fir_ccf : public gr_sync_decimator -{ -protected: - gr_adaptive_fir_ccf(char *name, int decimation, const std::vector<float> &taps); - -public: - void set_taps(const std::vector<float> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_altivec.c b/gnuradio-core/src/lib/filter/gr_altivec.c deleted file mode 100644 index 22a67291d4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_altivec.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <gr_altivec.h> - -void -gr_print_vector_float(FILE *fp, vec_float4 v) -{ - union v_float_u u; - u.v = v; - fprintf(fp, "{ %f, %f, %f, %f }", u.f[0], u.f[1], u.f[2], u.f[3]); -} - -void -gr_pvf(FILE *fp, const char *label, vec_float4 v) -{ - fprintf(fp, "%s = ", label); - gr_print_vector_float(fp, v); - putc('\n', fp); -} diff --git a/gnuradio-core/src/lib/filter/gr_altivec.h b/gnuradio-core/src/lib/filter/gr_altivec.h deleted file mode 100644 index ed11490f58..0000000000 --- a/gnuradio-core/src/lib/filter/gr_altivec.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_ALTIVEC_H -#define INCLUDED_GR_ALTIVEC_H - -/* - * N.B., always use "vec_float4" et al. instead of "vector float" to - * ensure portability across the various powerpc compilers. Some of - * them treat "vector" as a context specific keyword, some don't. - * Avoid the problem by always using the defines in vec_types.h - * (included below) - */ - -#include <gr_core_api.h> -#include <altivec.h> -#undef bool // repair namespace pollution -#undef vector // repair namespace pollution - -#ifdef HAVE_VEC_TYPES_H -#include <vec_types.h> // use system version if we've got it -#else -#include <gr_vec_types.h> // fall back to our local copy -#endif -#undef qword // repair namespace pollution - -#include <stddef.h> -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define VS sizeof(vec_float4) -#define FLOATS_PER_VEC (sizeof(vec_float4)/sizeof(float)) - -union v_float_u { - vec_float4 v; - float f[FLOATS_PER_VEC]; -}; - -GR_CORE_API void gr_print_vector_float(FILE *fp, vec_float4 v); -GR_CORE_API void gr_pvf(FILE *fp, const char *label, vec_float4 v); - -static inline float -horizontal_add_f(vec_float4 v) -{ - union v_float_u u; - vec_float4 t0 = vec_add(v, vec_sld(v, v, 8)); - vec_float4 t1 = vec_add(t0, vec_sld(t0, t0, 4)); - u.v = t1; - return u.f[0]; -} - -#ifdef __cplusplus -} -#endif - -#endif /* INCLUDED_GR_ALTIVEC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_cpu.h b/gnuradio-core/src/lib/filter/gr_cpu.h deleted file mode 100644 index 35824ac1ee..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _GR_CPU_H_ -#define _GR_CPU_H_ - -#include <gr_core_api.h> - -struct GR_CORE_API gr_cpu { - static bool has_mmx (); - static bool has_sse (); - static bool has_sse2 (); - static bool has_sse3 (); - static bool has_ssse3 (); - static bool has_sse4_1 (); - static bool has_sse4_2 (); - static bool has_3dnow (); - static bool has_3dnowext (); - static bool has_altivec (); - static bool has_armv7_a (); -}; - -#endif /* _GR_CPU_H_ */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc deleted file mode 100644 index 2450492066..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu_armv7_a.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_cpu.h> - -bool -gr_cpu::has_mmx () -{ - return false; -} - -bool -gr_cpu::has_sse () -{ - return false; -} - -bool -gr_cpu::has_sse2 () -{ - return false; -} - -bool -gr_cpu::has_3dnow () -{ - return false; -} - -bool -gr_cpu::has_3dnowext () -{ - return false; -} - -bool -gr_cpu::has_altivec () -{ - return false; -} - -bool -gr_cpu::has_armv7_a () -{ - return true; -} diff --git a/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc b/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc deleted file mode 100644 index d613f0ae45..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu_powerpc.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_cpu.h> - -bool -gr_cpu::has_mmx () -{ - return false; -} - -bool -gr_cpu::has_sse () -{ - return false; -} - -bool -gr_cpu::has_sse2 () -{ - return false; -} - -bool -gr_cpu::has_3dnow () -{ - return false; -} - -bool -gr_cpu::has_3dnowext () -{ - return false; -} - -bool -gr_cpu::has_altivec () -{ - return true; // FIXME assume we've always got it -} - -bool -gr_cpu::has_armv7_a () -{ - return false; -} diff --git a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc b/gnuradio-core/src/lib/filter/gr_cpu_x86.cc deleted file mode 100644 index 3acd694d55..0000000000 --- a/gnuradio-core/src/lib/filter/gr_cpu_x86.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_cpu.h> -#include "gcc_x86_cpuid.h" - -/* - * execute CPUID instruction, return EAX, EBX, ECX and EDX values in result - */ -#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3) - -/* - * CPUID functions returning a single datum - */ - -static inline unsigned int cpuid_eax(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[0]; -} - -static inline unsigned int cpuid_ebx(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[1]; -} - -static inline unsigned int cpuid_ecx(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[2]; -} - -static inline unsigned int cpuid_edx(unsigned int op) -{ - unsigned int regs[4] = {0,0,0,0}; - cpuid_x86 (op, regs); - return regs[3]; -} - -// ---------------------------------------------------------------- - -bool -gr_cpu::has_mmx () -{ - unsigned int edx = cpuid_edx (1); // standard features - return (edx & (1 << 23)) != 0; -} - -bool -gr_cpu::has_sse () -{ - unsigned int edx = cpuid_edx (1); // standard features - return (edx & (1 << 25)) != 0; -} - -bool -gr_cpu::has_sse2 () -{ - unsigned int edx = cpuid_edx (1); // standard features - return (edx & (1 << 26)) != 0; -} - -bool -gr_cpu::has_3dnow () -{ - unsigned int extended_fct_count = cpuid_eax (0x80000000); - if (extended_fct_count < 0x80000001) - return false; - - unsigned int extended_features = cpuid_edx (0x80000001); - return (extended_features & (1 << 31)) != 0; -} - -bool -gr_cpu::has_3dnowext () -{ - unsigned int extended_fct_count = cpuid_eax (0x80000000); - if (extended_fct_count < 0x80000001) - return false; - - unsigned int extended_features = cpuid_edx (0x80000001); - return (extended_features & (1 << 30)) != 0; -} - -bool -gr_cpu::has_altivec () -{ - return false; -} - -bool -gr_cpu::has_armv7_a () -{ - return false; -} - diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc deleted file mode 100644 index 0438a193fa..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_dc_blocker_cc.h> -#include <gr_io_signature.h> -#include <cstdio> - -moving_averager_c::moving_averager_c(int D) - : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) -{ - d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0)); -} - -moving_averager_c::~moving_averager_c() -{ -} - -gr_complex -moving_averager_c::filter(gr_complex x) -{ - d_out_d1 = d_out; - d_delay_line.push_back(x); - d_out = d_delay_line[0]; - d_delay_line.pop_front(); - - gr_complex y = x - d_out_d1 + d_out_d2; - d_out_d2 = y; - - return (y / (float)(d_length)); -} - - - -gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form) -{ - return gnuradio::get_initial_sptr(new gr_dc_blocker_cc(D, long_form)); -} - - -gr_dc_blocker_cc::gr_dc_blocker_cc (int D, bool long_form) - : gr_sync_block ("dc_blocker_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), - d_length(D), d_long_form(long_form) -{ - if(d_long_form) { - d_ma_0 = new moving_averager_c(D); - d_ma_1 = new moving_averager_c(D); - d_ma_2 = new moving_averager_c(D); - d_ma_3 = new moving_averager_c(D); - d_delay_line = std::deque<gr_complex>(d_length-1, gr_complex(0,0)); - } - else { - d_ma_0 = new moving_averager_c(D); - d_ma_1 = new moving_averager_c(D); - } -} - -gr_dc_blocker_cc::~gr_dc_blocker_cc() -{ - if(d_long_form) { - delete d_ma_0; - delete d_ma_1; - delete d_ma_2; - delete d_ma_3; - } - else { - delete d_ma_0; - delete d_ma_1; - } -} - -int -gr_dc_blocker_cc::get_group_delay() -{ - if(d_long_form) - return (2*d_length-2); - else - return d_length - 1; -} - -int -gr_dc_blocker_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex*)input_items[0]; - gr_complex *out = (gr_complex*)output_items[0]; - - if(d_long_form) { - gr_complex y1, y2, y3, y4, d; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - y3 = d_ma_2->filter(y2); - y4 = d_ma_3->filter(y3); - - d_delay_line.push_back(d_ma_0->delayed_sig()); - d = d_delay_line[0]; - d_delay_line.pop_front(); - - out[i] = d - y4; - } - } - else { - gr_complex y1, y2; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - out[i] = d_ma_0->delayed_sig() - y2; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h deleted file mode 100644 index e4d89a775c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_DC_BLOCKER_CC_H -#define INCLUDED_GR_DC_BLOCKER_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <deque> - -class GR_CORE_API moving_averager_c -{ -public: - moving_averager_c(int D); - ~moving_averager_c(); - - gr_complex filter(gr_complex x); - gr_complex delayed_sig() { return d_out; } - -private: - int d_length; - gr_complex d_out, d_out_d1, d_out_d2; - std::deque<gr_complex> d_delay_line; -}; - -class gr_dc_blocker_cc; -typedef boost::shared_ptr<gr_dc_blocker_cc> gr_dc_blocker_cc_sptr; -GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); - -/*! - * \class gr_dc_blocker_cc - * \brief a computationally efficient controllable DC blocker - * - * \ingroup filter_blk - * - * This block implements a computationally efficient DC blocker that produces - * a tighter notch filter around DC for a smaller group delay than an - * equivalent FIR filter or using a single pole IIR filter (though the IIR - * filter is computationally cheaper). - * - * The block defaults to using a delay line of length 32 and the long form - * of the filter. Optionally, the delay line length can be changed to alter - * the width of the DC notch (longer lines will decrease the width). - * - * The long form of the filter produces a nearly flat response outside of - * the notch but at the cost of a group delay of 2D-2. - * - * The short form of the filter does not have as flat a response in the - * passband but has a group delay of only D-1 and is cheaper to compute. - * - * The theory behind this block can be found in the paper: - * - * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, - * Mar. 2008, pp 132-134.</EM></B> - */ -class GR_CORE_API gr_dc_blocker_cc : public gr_sync_block -{ - private: - /*! - * Build the DC blocker. - * \param D (int) the length of the delay line - * \param long_form (bool) whether to use long (true, default) or short form - */ - friend GR_CORE_API gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D, bool long_form); - - int d_length; - bool d_long_form; - moving_averager_c *d_ma_0; - moving_averager_c *d_ma_1; - moving_averager_c *d_ma_2; - moving_averager_c *d_ma_3; - std::deque<gr_complex> d_delay_line; - - gr_dc_blocker_cc (int D, bool long_form); - -public: - ~gr_dc_blocker_cc (); - - /*! - * Get the blocker's group delay that is based on length of delay lines - */ - int get_group_delay(); - - //int set_length(int D); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i deleted file mode 100644 index 83d05044b8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_cc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_cc); - -gr_dc_blocker_cc_sptr gr_make_dc_blocker_cc (int D=32, bool long_form=true); - -class gr_dc_blocker_cc : public gr_sync_block -{ - private: - gr_dc_blocker_cc (int D, bool long_form); - - public: - ~gr_dc_blocker_cc (); -}; diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc deleted file mode 100644 index 04ee648797..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_dc_blocker_ff.h> -#include <gr_io_signature.h> -#include <cstdio> - -moving_averager_f::moving_averager_f(int D) - : d_length(D), d_out(0), d_out_d1(0), d_out_d2(0) -{ - d_delay_line = std::deque<float>(d_length-1, 0); -} - -moving_averager_f::~moving_averager_f() -{ -} - -float -moving_averager_f::filter(float x) -{ - d_out_d1 = d_out; - d_delay_line.push_back(x); - d_out = d_delay_line[0]; - d_delay_line.pop_front(); - - float y = x - d_out_d1 + d_out_d2; - d_out_d2 = y; - - return (y / (float)(d_length)); -} - - - -gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form) -{ - return gnuradio::get_initial_sptr(new gr_dc_blocker_ff(D, long_form)); -} - - -gr_dc_blocker_ff::gr_dc_blocker_ff (int D, bool long_form) - : gr_sync_block ("dc_blocker_ff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(float))), - d_length(D), d_long_form(long_form) -{ - if(d_long_form) { - d_ma_0 = new moving_averager_f(D); - d_ma_1 = new moving_averager_f(D); - d_ma_2 = new moving_averager_f(D); - d_ma_3 = new moving_averager_f(D); - d_delay_line = std::deque<float>(d_length-1, 0); - } - else { - d_ma_0 = new moving_averager_f(D); - d_ma_1 = new moving_averager_f(D); - } -} - -gr_dc_blocker_ff::~gr_dc_blocker_ff() -{ - if(d_long_form) { - delete d_ma_0; - delete d_ma_1; - delete d_ma_2; - delete d_ma_3; - } - else { - delete d_ma_0; - delete d_ma_1; - } -} - -int -gr_dc_blocker_ff::get_group_delay() -{ - if(d_long_form) - return (2*d_length-2); - else - return d_length - 1; -} - -int -gr_dc_blocker_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float*)input_items[0]; - float *out = (float*)output_items[0]; - - if(d_long_form) { - float y1, y2, y3, y4, d; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - y3 = d_ma_2->filter(y2); - y4 = d_ma_3->filter(y3); - - d_delay_line.push_back(d_ma_0->delayed_sig()); - d = d_delay_line[0]; - d_delay_line.pop_front(); - - out[i] = d - y4; - } - } - else { - float y1, y2; - for(int i = 0; i < noutput_items; i++) { - y1 = d_ma_0->filter(in[i]); - y2 = d_ma_1->filter(y1); - out[i] = d_ma_0->delayed_sig() - y2; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h deleted file mode 100644 index d69f24835b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_DC_BLOCKER_FF_H -#define INCLUDED_GR_DC_BLOCKER_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <deque> - -class GR_CORE_API moving_averager_f -{ -public: - moving_averager_f(int D); - ~moving_averager_f(); - - float filter(float x); - float delayed_sig() { return d_out; } - -private: - int d_length; - float d_out, d_out_d1, d_out_d2; - std::deque<float> d_delay_line; -}; - - -class gr_dc_blocker_ff; -typedef boost::shared_ptr<gr_dc_blocker_ff> gr_dc_blocker_ff_sptr; -GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); - -/*! - * \class gr_dc_blocker_ff - * \brief a computationally efficient controllable DC blocker - * - * \ingroup filter_blk - * - * This block implements a computationally efficient DC blocker that produces - * a tighter notch filter around DC for a smaller group delay than an - * equivalent FIR filter or using a single pole IIR filter (though the IIR - * filter is computationally cheaper). - * - * The block defaults to using a delay line of length 32 and the long form - * of the filter. Optionally, the delay line length can be changed to alter - * the width of the DC notch (longer lines will decrease the width). - * - * The long form of the filter produces a nearly flat response outside of - * the notch but at the cost of a group delay of 2D-2. - * - * The short form of the filter does not have as flat a response in the - * passband but has a group delay of only D-1 and is cheaper to compute. - * - * The theory behind this block can be found in the paper: - * - * <B><EM>R. Yates, "DC Blocker Algorithms," IEEE Signal Processing Magazine, - * Mar. 2008, pp 132-134.</EM></B> - */ -class GR_CORE_API gr_dc_blocker_ff : public gr_sync_block -{ - private: - /*! - * Build the DC blocker. - * \param D (int) the length of the delay line - * \param long_form (bool) whether to use long (true, default) or short form - */ - friend GR_CORE_API gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D, bool long_form); - - int d_length; - bool d_long_form; - moving_averager_f *d_ma_0; - moving_averager_f *d_ma_1; - moving_averager_f *d_ma_2; - moving_averager_f *d_ma_3; - std::deque<float> d_delay_line; - - gr_dc_blocker_ff (int D, bool long_form); - -public: - ~gr_dc_blocker_ff (); - - /*! - * Get the blocker's group delay that is based on length of delay lines - */ - int get_group_delay(); - - //int set_length(int D); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i b/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i deleted file mode 100644 index 065eb441d6..0000000000 --- a/gnuradio-core/src/lib/filter/gr_dc_blocker_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,dc_blocker_ff); - -gr_dc_blocker_ff_sptr gr_make_dc_blocker_ff (int D=32, bool long_form=true); - -class gr_dc_blocker_ff : public gr_sync_block -{ - private: - gr_dc_blocker_ff (int D, bool long_form); - - public: - ~gr_dc_blocker_ff (); -}; diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc deleted file mode 100644 index 08e231a442..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fft_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fft_filter_ccc.h> -#include <gri_fft_filter_ccc_generic.h> -#include <gr_io_signature.h> -#include <gri_fft.h> -#include <math.h> -#include <assert.h> -#include <stdexcept> -#include <gr_firdes.h> - -#include <cstdio> -#include <iostream> -#include <string.h> - -gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, - const std::vector<gr_complex> &taps, - int nthreads) -{ - return gnuradio::get_initial_sptr(new gr_fft_filter_ccc (decimation, taps, nthreads)); -} - - -gr_fft_filter_ccc::gr_fft_filter_ccc (int decimation, - const std::vector<gr_complex> &taps, - int nthreads) - : gr_sync_decimator ("fft_filter_ccc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex)), - decimation), - d_updated(false) -{ - set_history(1); - -#if 1 // don't enable the sse version until handling it is worked out - d_filter = new gri_fft_filter_ccc_generic(decimation, taps, nthreads); -#else - d_filter = new gri_fft_filter_ccc_sse(decimation, taps); -#endif - - d_new_taps = taps; - d_nsamples = d_filter->set_taps(taps); - set_output_multiple(d_nsamples); -} - -gr_fft_filter_ccc::~gr_fft_filter_ccc () -{ - delete d_filter; -} - -void -gr_fft_filter_ccc::set_taps (const std::vector<gr_complex> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -std::vector<gr_complex> -gr_fft_filter_ccc::taps () const -{ - return d_new_taps; -} - -void -gr_fft_filter_ccc::set_nthreads(int n) -{ - if(d_filter) - d_filter->set_nthreads(n); -} - -int -gr_fft_filter_ccc::nthreads() const -{ - if(d_filter) - return d_filter->nthreads(); - else - return 0; -} - - -int -gr_fft_filter_ccc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated){ - d_nsamples = d_filter->set_taps(d_new_taps); - d_updated = false; - set_output_multiple(d_nsamples); - return 0; // output multiple may have changed - } - - assert(noutput_items % d_nsamples == 0); - - d_filter->filter(noutput_items, in, out); - - //assert((out - (gr_complex *) output_items[0]) == noutput_items); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h deleted file mode 100644 index 4b478b65f7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FFT_FILTER_CCC_H -#define INCLUDED_GR_FFT_FILTER_CCC_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_fft_filter_ccc; -typedef boost::shared_ptr<gr_fft_filter_ccc> gr_fft_filter_ccc_sptr; -GR_CORE_API gr_fft_filter_ccc_sptr -gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - -//class gri_fft_filter_ccc_sse; -class gri_fft_filter_ccc_generic; - -/*! - * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_fft_filter_ccc : public gr_sync_decimator -{ - private: - friend GR_CORE_API gr_fft_filter_ccc_sptr - gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads); - - int d_nsamples; - bool d_updated; -#if 1 // don't enable the sse version until handling it is worked out - gri_fft_filter_ccc_generic *d_filter; -#else - gri_fft_filter_ccc_sse *d_filter; -#endif - std::vector<gr_complex> d_new_taps; - - /*! - * Construct a FFT filter with the given taps - * - * \param decimation >= 1 - * \param taps complex filter taps - * \param nthreads number of threads for the FFT to use - */ - gr_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_ccc (); - - void set_taps (const std::vector<gr_complex> &taps); - std::vector<gr_complex> taps () const; - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - - -#endif /* INCLUDED_GR_FFT_FILTER_CCC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i deleted file mode 100644 index 76837b582b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.i +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fft_filter_ccc) - -gr_fft_filter_ccc_sptr -gr_make_fft_filter_ccc (int decimation, - const std::vector<gr_complex> &taps, - int nthreads=1 - ) throw (std::invalid_argument); - -class gr_fft_filter_ccc : public gr_sync_decimator -{ - private: - gr_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_ccc (); - - void set_taps (const std::vector<gr_complex> &taps); - std::vector<gr_complex> taps () const; - - void set_nthreads(int n); - int nthreads() const; - -}; diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc deleted file mode 100644 index a09feb7f1f..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fft_filter_fff.h> -#include <gri_fft_filter_fff_generic.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> - -#include <cstdio> -#include <iostream> -#include <string.h> - -gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, - const std::vector<float> &taps, - int nthreads) -{ - return gnuradio::get_initial_sptr(new gr_fft_filter_fff (decimation, taps, nthreads)); -} - - -gr_fft_filter_fff::gr_fft_filter_fff (int decimation, - const std::vector<float> &taps, - int nthreads) - : gr_sync_decimator ("fft_filter_fff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float)), - decimation), - d_updated(false) -{ - set_history(1); - -#if 1 // don't enable the sse version until handling it is worked out - d_filter = new gri_fft_filter_fff_generic(decimation, taps, nthreads); -#else - d_filter = new gri_fft_filter_fff_sse(decimation, taps); -#endif - - d_new_taps = taps; - d_nsamples = d_filter->set_taps(taps); - set_output_multiple(d_nsamples); -} - -gr_fft_filter_fff::~gr_fft_filter_fff () -{ - delete d_filter; -} - -void -gr_fft_filter_fff::set_taps (const std::vector<float> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -std::vector<float> -gr_fft_filter_fff::taps () const -{ - return d_new_taps; -} - -void -gr_fft_filter_fff::set_nthreads(int n) -{ - if(d_filter) - d_filter->set_nthreads(n); -} - -int -gr_fft_filter_fff::nthreads() const -{ - if(d_filter) - return d_filter->nthreads(); - else - return 0; -} - -int -gr_fft_filter_fff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - if (d_updated){ - d_nsamples = d_filter->set_taps(d_new_taps); - d_updated = false; - set_output_multiple(d_nsamples); - return 0; // output multiple may have changed - } - - assert(noutput_items % d_nsamples == 0); - - d_filter->filter(noutput_items, in, out); - - //assert((out - (float *) output_items[0]) == noutput_items); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h deleted file mode 100644 index 309a551352..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FFT_FILTER_FFF_H -#define INCLUDED_GR_FFT_FILTER_FFF_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class gr_fft_filter_fff; -typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr; -GR_CORE_API gr_fft_filter_fff_sptr -gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads=1); - -class gri_fft_filter_fff_generic; -//class gri_fft_filter_fff_sse; - -/*! - * \brief Fast FFT filter with float input, float output and float taps - * \ingroup filter_blk - */ -class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator -{ - private: - friend GR_CORE_API gr_fft_filter_fff_sptr - gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads); - - int d_nsamples; - bool d_updated; -#if 1 // don't enable the sse version until handling it is worked out - gri_fft_filter_fff_generic *d_filter; -#else - gri_fft_filter_fff_sse *d_filter; -#endif - std::vector<float> d_new_taps; - - /*! - * Construct a FFT filter with the given taps - * - * \param decimation >= 1 - * \param taps float filter taps - * \param nthreads number of threads for the FFT to use - */ - gr_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_fff (); - - void set_taps (const std::vector<float> &taps); - std::vector<float> taps () const; - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FFT_FILTER_FFF_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i deleted file mode 100644 index 86c554893e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fft_filter_fff) - -gr_fft_filter_fff_sptr -gr_make_fft_filter_fff (int decimation, - const std::vector<float> &taps, - int nthreads=1 - ) throw (std::invalid_argument); - -class gr_fft_filter_fff : public gr_sync_decimator -{ - private: - gr_fft_filter_fff (int decimation, const std::vector<float> &taps, - int nthreads=1); - - public: - ~gr_fft_filter_fff (); - - void set_taps (const std::vector<float> &taps); - std::vector<float> taps () const; - void set_nthreads(int n); - int nthreads() const; - -}; diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc deleted file mode 100644 index af8a8e9e7d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_filter_delay_fc.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> - -// public constructor -gr_filter_delay_fc_sptr -gr_make_filter_delay_fc (const std::vector<float> &taps) -{ - return gnuradio::get_initial_sptr(new gr_filter_delay_fc (taps)); -} - -gr_filter_delay_fc::gr_filter_delay_fc (const std::vector<float> &taps) - : gr_sync_block ("filter_delay_fc", - gr_make_io_signature (1, 2, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex))) -{ - d_fir = gr_fir_util::create_gr_fir_fff (taps); - d_delay = d_fir->ntaps () / 2; - set_history (d_fir->ntaps ()); -} - -gr_filter_delay_fc::~gr_filter_delay_fc () -{ - delete d_fir; -} - -int -gr_filter_delay_fc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in0 = (float *) input_items[0]; - float *in1 = (float *) input_items[1]; - gr_complex *out = (gr_complex *) output_items[0]; - - switch (input_items.size ()){ - case 1: - for (int i = 0; i < noutput_items; i++) - out[i] = gr_complex (in0[i + d_delay], - d_fir->filter (&in0[i])); - break; - - case 2: - for (int j = 0; j < noutput_items; j++) - out[j] = gr_complex (in0[j + d_delay], - d_fir->filter (&in1[j])); - break; - - default: - assert (0); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h deleted file mode 100644 index fee11243a5..0000000000 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FILTER_DELAY_FC_H -#define INCLUDED_GR_FILTER_DELAY_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_io_signature.h> -#include <gr_types.h> - -class gr_filter_delay_fc; -typedef boost::shared_ptr<gr_filter_delay_fc> gr_filter_delay_fc_sptr; - -// public constructor -GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); - -class gr_fir_fff; - -/*! - * \brief Filter-Delay Combination Block. - * \ingroup filter_blk - * - * The block takes one or two float stream and outputs a complex - * stream. If only one float stream is input, the real output is - * a delayed version of this input and the imaginary output is the - * filtered output. If two floats are connected to the input, then - * the real output is the delayed version of the first input, and - * the imaginary output is the filtered output. The delay in the - * real path accounts for the group delay introduced by the filter - * in the imaginary path. The filter taps needs to be calculated - * before initializing this block. - * - */ -class GR_CORE_API gr_filter_delay_fc : public gr_sync_block -{ - public: - ~gr_filter_delay_fc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - protected: - gr_filter_delay_fc (const std::vector<float> &taps); - - private: - unsigned int d_delay; - gr_fir_fff *d_fir; - - friend GR_CORE_API gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); -}; - -#endif /* INCLUDED_GR_FILTER_DELAY_FC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i b/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i deleted file mode 100644 index 54b721cee7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_filter_delay_fc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,filter_delay_fc); - -gr_filter_delay_fc_sptr gr_make_filter_delay_fc (const std::vector<float> &taps); - -class gr_filter_delay_fc : public gr_sync_block -{ -private: - gr_filter_delay_fc (); -}; - -// ---------------------------------------------------------------- - diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t deleted file mode 100644 index 2396f0fe66..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX.cc.t +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@FIR_TYPE@.h> - -@FIR_TYPE@::~@FIR_TYPE@ () -{ -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t deleted file mode 100644 index 197bb3cd2c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX.h.t +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fir_XXX.py - * Any changes made to this file will be overwritten. - */ - - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <vector> -@VRCOMPLEX_INCLUDE@ -#include <gr_reverse.h> - -/*! - * \brief Abstract class for FIR with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_primitive - * - * This is the abstract class for a Finite Impulse Response filter. - * - * The trailing suffix has the form _IOT where I codes the input type, - * O codes the output type, and T codes the tap type. - * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) - */ - -class GR_CORE_API @FIR_TYPE@ { - -protected: - std::vector<@TAP_TYPE@> d_taps; // reversed taps - -public: - - // CONSTRUCTORS - - /*! - * \brief construct new FIR with given taps. - * - * Note that taps must be in forward order, e.g., coefficient 0 is - * stored in new_taps[0], coefficient 1 is stored in - * new_taps[1], etc. - */ - @FIR_TYPE@ () {} - @FIR_TYPE@ (const std::vector<@TAP_TYPE@> &taps) : d_taps (gr_reverse(taps)) {} - - virtual ~@FIR_TYPE@ (); - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input must have ntaps() valid entries. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * - * \returns the filtered input value. - */ - virtual @O_TYPE@ filter (const @I_TYPE@ input[]) = 0; - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - virtual void filterN (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n) = 0; - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - virtual void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n, unsigned decimate) = 0; - - /*! - * \brief install \p new_taps as the current taps. - */ - virtual void set_taps (const std::vector<@TAP_TYPE@> &taps) - { - d_taps = gr_reverse(taps); - } - - // ACCESSORS - - /*! - * \return number of taps in filter. - */ - unsigned ntaps () const { return d_taps.size (); } - - /*! - * \return current taps - */ - virtual const std::vector<@TAP_TYPE@> get_taps () const - { - return gr_reverse(d_taps); - } -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t deleted file mode 100644 index 11b4fd50fb..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.cc.t +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@FIR_TYPE@_generic.h> - -#if (@N_UNROLL@ == 4) - -@O_TYPE@ -@FIR_TYPE@_generic::filter (const @I_TYPE@ input[]) -{ - static const int N_UNROLL = 4; - - @ACC_TYPE@ acc0 = 0; - @ACC_TYPE@ acc1 = 0; - @ACC_TYPE@ acc2 = 0; - @ACC_TYPE@ acc3 = 0; - - - unsigned i = 0; - unsigned n = (ntaps () / N_UNROLL) * N_UNROLL; - - for (i = 0; i < n; i += N_UNROLL){ - acc0 += d_taps[i + 0] * @INPUT_CAST@ input[i + 0]; - acc1 += d_taps[i + 1] * @INPUT_CAST@ input[i + 1]; - acc2 += d_taps[i + 2] * @INPUT_CAST@ input[i + 2]; - acc3 += d_taps[i + 3] * @INPUT_CAST@ input[i + 3]; - } - - for (; i < ntaps (); i++) - acc0 += d_taps[i] * @INPUT_CAST@ input[i]; - - return (@O_TYPE@) (acc0 + acc1 + acc2 + acc3); -} - -#else - -@O_TYPE@ -@FIR_TYPE@_generic::filter (const @I_TYPE@ input[]) -{ - static const int N_UNROLL = 2; - - @ACC_TYPE@ acc0 = 0; - @ACC_TYPE@ acc1 = 0; - - unsigned i = 0; - unsigned n = (ntaps () / N_UNROLL) * N_UNROLL; - - for (i = 0; i < n; i += N_UNROLL){ - acc0 += d_taps[i + 0] * @INPUT_CAST@ input[i + 0]; - acc1 += d_taps[i + 1] * @INPUT_CAST@ input[i + 1]; - } - - for (; i < ntaps (); i++) - acc0 += d_taps[i] * @INPUT_CAST@ input[i]; - - return (@O_TYPE@) (acc0 + acc1); -} - -#endif // N_UNROLL - -void -@FIR_TYPE@_generic::filterN (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n) -{ - for (unsigned i = 0; i < n; i++) - output[i] = filter (&input[i]); -} - -void -@FIR_TYPE@_generic::filterNdec (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n, - unsigned decimate) -{ - unsigned j = 0; - for (unsigned i = 0; i < n; i++){ - output[i] = filter (&input[j]); - j += decimate; - } -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t b/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t deleted file mode 100644 index f7382d7393..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_XXX_generic.h.t +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <@FIR_TYPE@.h> - -/*! - * \brief Concrete class for generic implementation of FIR with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * - * The trailing suffix has the form _IOT where I codes the input type, - * O codes the output type, and T codes the tap type. - * I,O,T are elements of the set 's' (short), 'f' (float), 'c' (gr_complex), 'i' (int) - */ - -class GR_CORE_API @FIR_TYPE@_generic : public @FIR_TYPE@ { - -public: - - // CREATORS - - @FIR_TYPE@_generic () {} - @FIR_TYPE@_generic (const std::vector<@TAP_TYPE@> &taps) : @FIR_TYPE@ (taps) {} - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input must have ntaps() valid entries. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * - * \returns the filtered input value. - */ - virtual @O_TYPE@ filter (const @I_TYPE@ input[]); - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - virtual void filterN (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n); - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - virtual void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n, unsigned decimate); - -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc deleted file mode 100644 index d88b696c9a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccc_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> -#include <stdexcept> - -using std::cerr; -using std::endl; - -gr_fir_ccc_simd::gr_fir_ccc_simd () - : gr_fir_ccc_generic () -{ - // cerr << "@@@ gr_fir_ccc_simd\n"; - - d_ccomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_ccc_simd::gr_fir_ccc_simd (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_generic (new_taps) -{ - // cerr << "@@@ gr_fir_ccc_simd\n"; - - d_ccomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_ccc_simd::~gr_fir_ccc_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_ccc_simd::set_taps (const std::vector<gr_complex> &inew_taps) -{ - gr_fir_ccc::set_taps (inew_taps); // call superclass - - const std::vector<gr_complex> new_taps = gr_reverse(inew_taps); - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2, - 2 * 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_ccc_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) { - d_aligned_taps[i][2*(j+i)] = new_taps[j].real(); - d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag(); - } - } -} - -gr_complex -gr_fir_ccc_simd::filter (const gr_complex input[]) -{ - if (ntaps () == 0) - return 0.0; - - if (((intptr_t) input & 0x7) != 0) - throw std::invalid_argument("gr_complex must be 8-byte aligned"); - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - d_ccomplex_dotprod ((float*)ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h deleted file mode 100644 index ed7249c91d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_simd.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_CCC_SIMD_H -#define INCLUDED_GR_FIR_CCC_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_ccc_generic.h> - -/*! - * \brief common base class for SIMD versions of gr_fir_ccc - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_ccc_simd : public gr_fir_ccc_generic -{ -protected: - typedef void (*ccomplex_dotprod_t)(const float *input, - const float *taps, - unsigned n_2_ccomplex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 floats to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - ccomplex_dotprod_t d_ccomplex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_ccc_simd (); - gr_fir_ccc_simd (const std::vector<gr_complex> &taps); - ~gr_fir_ccc_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<gr_complex> &taps); - virtual gr_complex filter (const gr_complex input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc deleted file mode 100644 index 28bc008e8a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccc_x86.h> -#include <ccomplex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_ccc_3dnow::gr_fir_ccc_3dnow () - : gr_fir_ccc_simd () -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnow; -} - -gr_fir_ccc_3dnow::gr_fir_ccc_3dnow (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_simd (new_taps) -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnow; -} - - -/* - * --- 3DNow!Ext version --- - */ - -gr_fir_ccc_3dnowext::gr_fir_ccc_3dnowext () - : gr_fir_ccc_simd () -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnowext; -} - -gr_fir_ccc_3dnowext::gr_fir_ccc_3dnowext (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_simd (new_taps) -{ - d_ccomplex_dotprod = ccomplex_dotprod_3dnowext; -} - - -/* - * --- SSE version --- - */ - -gr_fir_ccc_sse::gr_fir_ccc_sse () - : gr_fir_ccc_simd () -{ - d_ccomplex_dotprod = ccomplex_dotprod_sse; -} - -gr_fir_ccc_sse::gr_fir_ccc_sse (const std::vector<gr_complex> &new_taps) - : gr_fir_ccc_simd (new_taps) -{ - d_ccomplex_dotprod = ccomplex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h deleted file mode 100644 index 0a9d2c83c3..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccc_x86.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FIR_CCC_X86_H -#define INCLUDED_GR_FIR_CCC_X86_H - -#include <gr_core_api.h> -#include <gr_fir_ccc_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_ccc - */ -class GR_CORE_API gr_fir_ccc_3dnow : public gr_fir_ccc_simd -{ -public: - gr_fir_ccc_3dnow (); - gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps); -}; - -class GR_CORE_API gr_fir_ccc_3dnowext : public gr_fir_ccc_simd -{ -public: - gr_fir_ccc_3dnowext (); - gr_fir_ccc_3dnowext (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief SSE version of gr_fir_ccc - */ -class GR_CORE_API gr_fir_ccc_sse : public gr_fir_ccc_simd -{ -public: - gr_fir_ccc_sse (); - gr_fir_ccc_sse (const std::vector<gr_complex> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc deleted file mode 100644 index d849c3dd57..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_fir_ccf_armv7_a.h> -#include <stdlib.h> -#include <string.h> -#include <stdexcept> -#include <assert.h> -#include <gr_math.h> -#include <dotprod_ccf_armv7_a.h> - -#define FLOATS_PER_VEC 4 - -gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a() - : gr_fir_ccf_generic(), - d_naligned_taps(0), d_aligned_taps(0) -{ -} - -gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a (const std::vector<float> &new_taps) - : gr_fir_ccf_generic(new_taps), - d_naligned_taps(0), d_aligned_taps(0) -{ - set_taps(new_taps); -} - -gr_fir_ccf_armv7_a::~gr_fir_ccf_armv7_a() -{ - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } -} - -void -gr_fir_ccf_armv7_a::set_taps(const std::vector<float> &inew_taps) -{ - gr_fir_ccf_generic::set_taps(inew_taps); // call superclass - d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); - - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } - void *p; - int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0])); - if (r != 0){ - throw std::bad_alloc(); - } - d_aligned_taps = (float *) p; - memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); - for (size_t i = ntaps(); i < d_naligned_taps; i++) - d_aligned_taps[i] = 0.0; -} - - -gr_complex -gr_fir_ccf_armv7_a::filter (const gr_complex input[]) -{ - if (d_naligned_taps == 0) - return 0.0; - - gr_complex result; - float *presult = reinterpret_cast<float *>(&result); - const float *pinput = reinterpret_cast<const float *>(input); - - dotprod_ccf_armv7_a(pinput, d_aligned_taps, presult, d_naligned_taps); - return result; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h deleted file mode 100644 index e4844bae1a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_FIR_CCF_ARMV7_A_H -#define INCLUDED_GR_FIR_CCF_ARMV7_A_H - -#include <gr_fir_ccf_generic.h> - -/*! - * \brief armv7_a using NEON coprocessor version of gr_fir_ccf - */ -class gr_fir_ccf_armv7_a : public gr_fir_ccf_generic -{ -protected: - - size_t d_naligned_taps; // number of taps (multiple of 4) - float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 - -public: - gr_fir_ccf_armv7_a(); - gr_fir_ccf_armv7_a(const std::vector<float> &taps); - ~gr_fir_ccf_armv7_a(); - - virtual void set_taps (const std::vector<float> &taps); - virtual gr_complex filter (const gr_complex input[]); -}; - -#endif /* INCLUDED_GR_FIR_CCF_ARMV7_A*_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc deleted file mode 100644 index 872415e8eb..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.cc +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccf_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> -#include <stdexcept> - -using std::cerr; -using std::endl; - -gr_fir_ccf_simd::gr_fir_ccf_simd () - : gr_fir_ccf_generic () -{ - // cerr << "@@@ gr_fir_ccf_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_ccf_simd::gr_fir_ccf_simd (const std::vector<float> &new_taps) - : gr_fir_ccf_generic (new_taps) -{ - // cerr << "@@@ gr_fir_ccf_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_ccf_simd::~gr_fir_ccf_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_ccf_simd::set_taps (const std::vector<float> &inew_taps) -{ - gr_fir_ccf::set_taps (inew_taps); // call superclass - const std::vector<float> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4, - 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_ccf_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) - d_aligned_taps[i][j+i] = new_taps[j]; - } -} - -gr_complex -gr_fir_ccf_simd::filter (const gr_complex input[]) -{ - if (ntaps () == 0) - return 0.0; - - if (((intptr_t) input & 0x7) != 0) - throw std::invalid_argument("gr_complex must be 8-byte aligned"); - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const gr_complex *ar = (gr_complex *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - // the trick here is to invert input and taps, and reuse FCC speedup - d_fcomplex_dotprod (d_aligned_taps[al], (float*)ar, (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h deleted file mode 100644 index 3c3e7e4f5b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_simd.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_CCF_SIMD_H -#define INCLUDED_GR_FIR_CCF_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_ccf_generic.h> - - -/*! - * \brief common base class for SIMD versions of gr_fir_ccf - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_ccf_simd : public gr_fir_ccf_generic -{ -protected: - typedef void (*fcomplex_dotprod_t)(const float *taps, - const float *input, - unsigned n_2_complex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - fcomplex_dotprod_t d_fcomplex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_ccf_simd (); - gr_fir_ccf_simd (const std::vector<float> &taps); - ~gr_fir_ccf_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<float> &taps); - virtual gr_complex filter (const gr_complex input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc deleted file mode 100644 index f26d4ecc2c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_ccf_x86.h> -#include <fcomplex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_ccf_3dnow::gr_fir_ccf_3dnow () - : gr_fir_ccf_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - -gr_fir_ccf_3dnow::gr_fir_ccf_3dnow (const std::vector<float> &new_taps) - : gr_fir_ccf_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_ccf_sse::gr_fir_ccf_sse () - : gr_fir_ccf_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} - -gr_fir_ccf_sse::gr_fir_ccf_sse (const std::vector<float> &new_taps) - : gr_fir_ccf_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h deleted file mode 100644 index 6b260c3dbb..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_ccf_x86.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FIR_CCF_X86_H -#define INCLUDED_GR_FIR_CCF_X86_H - -#include <gr_core_api.h> -#include <gr_fir_ccf_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_ccf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_ccf_3dnow : public gr_fir_ccf_simd -{ -public: - gr_fir_ccf_3dnow (); - gr_fir_ccf_3dnow (const std::vector<float> &taps); -}; - -/*! - * \brief SSE version of gr_fir_ccf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_ccf_sse : public gr_fir_ccf_simd -{ -public: - gr_fir_ccf_sse (); - gr_fir_ccf_sse (const std::vector<float> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc deleted file mode 100644 index 5b75a43fd2..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fcc_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; -using std::endl; - -gr_fir_fcc_simd::gr_fir_fcc_simd () - : gr_fir_fcc_generic () -{ - // cerr << "@@@ gr_fir_fcc_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_fcc_simd::gr_fir_fcc_simd (const std::vector<gr_complex> &new_taps) - : gr_fir_fcc_generic (new_taps) -{ - // cerr << "@@@ gr_fir_fcc_simd\n"; - - d_fcomplex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_fcc_simd::~gr_fir_fcc_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_fcc_simd::set_taps (const std::vector<gr_complex> &inew_taps) -{ - gr_fir_fcc::set_taps (inew_taps); // call superclass - const std::vector<gr_complex> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2, - 2 * 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_fcc_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) { - d_aligned_taps[i][2*(j+i)] = new_taps[j].real(); - d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag(); - } - } -} - -gr_complex -gr_fir_fcc_simd::filter (const float input[]) -{ - if (ntaps () == 0) - return 0.0; - - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const float *ar = (float *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - d_fcomplex_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h deleted file mode 100644 index b7463070bc..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_simd.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_FCC_SIMD_H -#define INCLUDED_GR_FIR_FCC_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_fcc_generic.h> - - -/*! - * \brief common base class for SIMD versions of gr_fir_fcc - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_fcc_simd : public gr_fir_fcc_generic -{ -protected: - typedef void (*fcomplex_dotprod_t)(const float *input, - const float *taps, - unsigned n_2_complex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - fcomplex_dotprod_t d_fcomplex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_fcc_simd (); - gr_fir_fcc_simd (const std::vector<gr_complex> &taps); - ~gr_fir_fcc_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<gr_complex> &taps); - virtual gr_complex filter (const float input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc deleted file mode 100644 index d9904133c4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fcc_x86.h> -#include <fcomplex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_fcc_3dnow::gr_fir_fcc_3dnow () - : gr_fir_fcc_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - -gr_fir_fcc_3dnow::gr_fir_fcc_3dnow (const std::vector<gr_complex> &new_taps) - : gr_fir_fcc_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_fcc_sse::gr_fir_fcc_sse () - : gr_fir_fcc_simd () -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} - -gr_fir_fcc_sse::gr_fir_fcc_sse (const std::vector<gr_complex> &new_taps) - : gr_fir_fcc_simd (new_taps) -{ - d_fcomplex_dotprod = fcomplex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h deleted file mode 100644 index 3fc6c4855b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fcc_x86.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FIR_FCC_X86_H -#define INCLUDED_GR_FIR_FCC_X86_H - -#include <gr_core_api.h> -#include <gr_fir_fcc_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_fcc - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_fcc_3dnow : public gr_fir_fcc_simd -{ -public: - gr_fir_fcc_3dnow (); - gr_fir_fcc_3dnow (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief SSE version of gr_fir_fcc - * \ingroup filter_blk - */ -class GR_CORE_API gr_fir_fcc_sse : public gr_fir_fcc_simd -{ -public: - gr_fir_fcc_sse (); - gr_fir_fcc_sse (const std::vector<gr_complex> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc deleted file mode 100644 index b81283ce56..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fff_altivec.h> -#include <stdexcept> -#include <assert.h> -#include <gr_math.h> -#include <gr_altivec.h> -#include <dotprod_fff_altivec.h> -#include <string.h> -#include "posix_memalign.h" - -gr_fir_fff_altivec::gr_fir_fff_altivec() - : gr_fir_fff_generic(), - d_naligned_taps(0), d_aligned_taps(0) -{ -} - -gr_fir_fff_altivec::gr_fir_fff_altivec (const std::vector<float> &new_taps) - : gr_fir_fff_generic(new_taps), - d_naligned_taps(0), d_aligned_taps(0) -{ - set_taps(new_taps); -} - -gr_fir_fff_altivec::~gr_fir_fff_altivec() -{ - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } -} - -void -gr_fir_fff_altivec::set_taps(const std::vector<float> &inew_taps) -{ - gr_fir_fff_generic::set_taps(inew_taps); // call superclass - d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); - - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } - void *p; - int r = posix_memalign(&p, sizeof(vec_float4), d_naligned_taps * sizeof(d_aligned_taps[0])); - if (r != 0){ - throw std::bad_alloc(); - } - d_aligned_taps = (float *) p; - memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); - for (size_t i = ntaps(); i < d_naligned_taps; i++) - d_aligned_taps[i] = 0.0; -} - - -float -gr_fir_fff_altivec::filter (const float input[]) -{ - if (d_naligned_taps == 0) - return 0.0; - - return dotprod_fff_altivec(input, d_aligned_taps, d_naligned_taps); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h b/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h deleted file mode 100644 index a3d4a2aae9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_FIR_FFF_ALTIVEC_H -#define INCLUDED_GR_FIR_FFF_ALTIVEC_H - -#include <gr_core_api.h> -#include <gr_fir_fff_generic.h> - -/*! - * \brief altivec version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_altivec : public gr_fir_fff_generic -{ -protected: - - size_t d_naligned_taps; // number of taps (multiple of 4) - float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 - -public: - gr_fir_fff_altivec(); - gr_fir_fff_altivec(const std::vector<float> &taps); - ~gr_fir_fff_altivec(); - - virtual void set_taps (const std::vector<float> &taps); - virtual float filter (const float input[]); -}; - -#endif /* INCLUDED_GR_FIR_FFF_ALTIVEC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc deleted file mode 100644 index b437254202..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_fir_fff_armv7_a.h> -#include <stdlib.h> -#include <string.h> -#include <stdexcept> -#include <assert.h> -#include <gr_math.h> -#include <dotprod_fff_armv7_a.h> - -#define FLOATS_PER_VEC 8 - -gr_fir_fff_armv7_a::gr_fir_fff_armv7_a() - : gr_fir_fff_generic(), - d_naligned_taps(0), d_aligned_taps(0) -{ -} - -gr_fir_fff_armv7_a::gr_fir_fff_armv7_a (const std::vector<float> &new_taps) - : gr_fir_fff_generic(new_taps), - d_naligned_taps(0), d_aligned_taps(0) -{ - set_taps(new_taps); -} - -gr_fir_fff_armv7_a::~gr_fir_fff_armv7_a() -{ - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } -} - -void -gr_fir_fff_armv7_a::set_taps(const std::vector<float> &inew_taps) -{ - gr_fir_fff_generic::set_taps(inew_taps); // call superclass - d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); - - if (d_aligned_taps){ - free(d_aligned_taps); - d_aligned_taps = 0; - } - void *p; - int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0])); - if (r != 0){ - throw std::bad_alloc(); - } - d_aligned_taps = (float *) p; - memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); - for (size_t i = ntaps(); i < d_naligned_taps; i++) - d_aligned_taps[i] = 0.0; -} - - -float -gr_fir_fff_armv7_a::filter (const float input[]) -{ - if (d_naligned_taps == 0) - return 0.0; - - return dotprod_fff_armv7_a(input, d_aligned_taps, d_naligned_taps); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h deleted file mode 100644 index 78863d2866..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_armv7_a.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GR_FIR_FFF_ARMV7_A_H -#define INCLUDED_GR_FIR_FFF_ARMV7_A_H - -#include <gr_core_api.h> -#include <gr_fir_fff_generic.h> - -/*! - * \brief armv7_a using NEON coprocessor version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_armv7_a : public gr_fir_fff_generic -{ -protected: - - size_t d_naligned_taps; // number of taps (multiple of 4) - float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 - -public: - gr_fir_fff_armv7_a(); - gr_fir_fff_armv7_a(const std::vector<float> &taps); - ~gr_fir_fff_armv7_a(); - - virtual void set_taps (const std::vector<float> &taps); - virtual float filter (const float input[]); -}; - -#endif /* INCLUDED_GR_FIR_FFF_ARMV7_A*_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc deleted file mode 100644 index d6c28ed45b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fff_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; - -gr_fir_fff_simd::gr_fir_fff_simd () - : gr_fir_fff_generic () -{ - // cerr << "@@@ gr_fir_fff_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_fff_simd::gr_fir_fff_simd (const std::vector<float> &new_taps) - : gr_fir_fff_generic (new_taps) -{ - // cerr << "@@@ gr_fir_fff_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_fff_simd::~gr_fir_fff_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_fff_simd::set_taps (const std::vector<float> &inew_taps) -{ - gr_fir_fff::set_taps (inew_taps); // call superclass - const std::vector<float> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4, - 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_fff_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) - d_aligned_taps[i][j+i] = new_taps[j]; - } -} - -float -gr_fir_fff_simd::filter (const float input[]) -{ - if (ntaps () == 0) - return 0.0; - - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const float *ar = (float *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/4 + 1: " << (ntaps() + al -1) / 4 + 1 << endl; - - float r = d_float_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 4 + 1); - - // cerr << "result = " << r << endl; - - return r; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h deleted file mode 100644 index 9d61062664..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_simd.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_FFF_SIMD_H -#define INCLUDED_GR_FIR_FFF_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_fff_generic.h> - -/*! - * \brief common base class for SIMD versions of gr_fir_fff - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_fff_simd : public gr_fir_fff_generic -{ -protected: - typedef float (*float_dotprod_t)(const float *input, - const float *taps, - unsigned n_4_float_blocks); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 floats to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - float_dotprod_t d_float_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_fff_simd (); - gr_fir_fff_simd (const std::vector<float> &taps); - ~gr_fir_fff_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<float> &taps); - virtual float filter (const float input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc deleted file mode 100644 index 40ac266be6..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fff_x86.h> -#include <float_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_fff_3dnow::gr_fir_fff_3dnow () - : gr_fir_fff_simd () -{ - d_float_dotprod = float_dotprod_3dnow; -} - -gr_fir_fff_3dnow::gr_fir_fff_3dnow (const std::vector<float> &new_taps) - : gr_fir_fff_simd (new_taps) -{ - d_float_dotprod = float_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_fff_sse::gr_fir_fff_sse () - : gr_fir_fff_simd () -{ - d_float_dotprod = float_dotprod_sse; -} - -gr_fir_fff_sse::gr_fir_fff_sse (const std::vector<float> &new_taps) - : gr_fir_fff_simd (new_taps) -{ - d_float_dotprod = float_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h deleted file mode 100644 index 8d451f0c95..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fff_x86.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FIR_FFF_X86_H -#define INCLUDED_GR_FIR_FFF_X86_H - -#include <gr_core_api.h> -#include <gr_fir_fff_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_3dnow : public gr_fir_fff_simd -{ -public: - gr_fir_fff_3dnow (); - gr_fir_fff_3dnow (const std::vector<float> &taps); -}; - -/*! - * \brief SSE version of gr_fir_fff - */ -class GR_CORE_API gr_fir_fff_sse : public gr_fir_fff_simd -{ -public: - gr_fir_fff_sse (); - gr_fir_fff_sse (const std::vector<float> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t deleted file mode 100644 index 39bc756301..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.cc.t +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps) -{ - return gnuradio::get_initial_sptr (new @NAME@ (decimation, taps)); -} - - -@NAME@::@NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps) - : gr_sync_decimator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - decimation), - d_updated (false) -{ - d_fir = gr_fir_util::create_@FIR_TYPE@ (taps); - set_history (d_fir->ntaps ()); -} - -@NAME@::~@NAME@ () -{ - delete d_fir; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_new_taps = taps; - d_updated = true; -} - -std::vector<@TAP_TYPE@> -@NAME@::taps () const -{ - return d_new_taps; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *in = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - if (d_updated) { - d_fir->set_taps (d_new_taps); - set_history (d_fir->ntaps ()); - d_updated = false; - return 0; // history requirements may have changed. - } - - if (decimation() == 1) - d_fir->filterN (out, in, noutput_items); - - else - d_fir->filterNdec (out, in, noutput_items, decimation()); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t deleted file mode 100644 index b32e04bd35..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.h.t +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - -class @FIR_TYPE@; - -/*! - * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_decimator -{ - private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - - @FIR_TYPE@ *d_fir; - std::vector<@TAP_TYPE@> d_new_taps; - bool d_updated; - - /*! - * Construct a FIR filter with the given taps - */ - @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - std::vector<@TAP_TYPE@> taps () const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t deleted file mode 100644 index d9dc86180e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_filter_XXX.i.t +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_GrFIRfilterXXX.py - * Any changes made to this file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - -class @NAME@ : public gr_sync_decimator -{ - private: - @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - std::vector<@TAP_TYPE@> taps () const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc deleted file mode 100644 index a49503e6ab..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.cc +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fsf_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; - -gr_fir_fsf_simd::gr_fir_fsf_simd () - : gr_fir_fsf_generic () -{ - // cerr << "@@@ gr_fir_fsf_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_fsf_simd::gr_fir_fsf_simd (const std::vector<float> &new_taps) - : gr_fir_fsf_generic (new_taps) -{ - // cerr << "@@@ gr_fir_fsf_simd\n"; - - d_float_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_fsf_simd::~gr_fir_fsf_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_fsf_simd::set_taps (const std::vector<float> &inew_taps) -{ - gr_fir_fsf::set_taps (inew_taps); // call superclass - const std::vector<float> new_taps = gr_reverse(inew_taps); - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 4, - 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_fsf_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) - d_aligned_taps[i][j+i] = new_taps[j]; - } -} - -short -gr_fir_fsf_simd::filter (const float input[]) -{ - if (ntaps () == 0) - return 0; - - - // Round input data address down to 16 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const float *ar = (float *)((unsigned long) input & ~15); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 4-float blocks. - - // assert (((unsigned long) ar & 15) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/4 + 1: " << (ntaps() + al -1) / 4 + 1 << endl; - - float r = d_float_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 4 + 1); - - // cerr << "result = " << r << endl; - - return (short) r; // FIXME? may want to saturate here -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h deleted file mode 100644 index d63e9dd17d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_simd.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _GR_FIR_FSF_SIMD_H_ -#define _GR_FIR_FSF_SIMD_H_ - -#include <gr_core_api.h> -#include <gr_fir_fsf_generic.h> - -/*! - * \brief common base class for SIMD versions of gr_fir_fsf - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ - -class GR_CORE_API gr_fir_fsf_simd : public gr_fir_fsf_generic -{ -protected: - typedef float (*float_dotprod_t)(const float *input, - const float *taps, - unsigned n_4_float_blocks); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 floats to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - float_dotprod_t d_float_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_fsf_simd (); - gr_fir_fsf_simd (const std::vector<float> &taps); - ~gr_fir_fsf_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<float> &taps); - virtual short filter (const float input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc deleted file mode 100644 index 40ba17d3a7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_fsf_x86.h> -#include <float_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_fsf_3dnow::gr_fir_fsf_3dnow () - : gr_fir_fsf_simd () -{ - d_float_dotprod = float_dotprod_3dnow; -} - -gr_fir_fsf_3dnow::gr_fir_fsf_3dnow (const std::vector<float> &new_taps) - : gr_fir_fsf_simd (new_taps) -{ - d_float_dotprod = float_dotprod_3dnow; -} - - -/* - * --- SSE version --- - */ - -gr_fir_fsf_sse::gr_fir_fsf_sse () - : gr_fir_fsf_simd () -{ - d_float_dotprod = float_dotprod_sse; -} - -gr_fir_fsf_sse::gr_fir_fsf_sse (const std::vector<float> &new_taps) - : gr_fir_fsf_simd (new_taps) -{ - d_float_dotprod = float_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h b/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h deleted file mode 100644 index df664d5e27..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_fsf_x86.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FIR_FSF_X86_H -#define INCLUDED_GR_FIR_FSF_X86_H - -#include <gr_core_api.h> -#include <gr_fir_fsf_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_fsf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_fsf_3dnow : public gr_fir_fsf_simd -{ -public: - gr_fir_fsf_3dnow (); - gr_fir_fsf_3dnow (const std::vector<float> &taps); -}; - -/*! - * \brief SSE version of gr_fir_fsf - * \ingroup filter_primitive - */ -class GR_CORE_API gr_fir_fsf_sse : public gr_fir_fsf_simd -{ -public: - gr_fir_fsf_sse (); - gr_fir_fsf_sse (const std::vector<float> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc deleted file mode 100644 index 0b2dd7e613..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_scc_simd.h> - -#include <assert.h> -#include <malloc16.h> -#include <iostream> - -using std::cerr; -using std::endl; - -gr_fir_scc_simd::gr_fir_scc_simd () - : gr_fir_scc_generic () -{ - // cerr << "@@@ gr_fir_scc_simd\n"; - - d_complex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; -} - -gr_fir_scc_simd::gr_fir_scc_simd (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_generic (new_taps) -{ - // cerr << "@@@ gr_fir_scc_simd\n"; - - d_complex_dotprod = 0; - - d_aligned_taps[0] = 0; - d_aligned_taps[1] = 0; - d_aligned_taps[2] = 0; - d_aligned_taps[3] = 0; - set_taps (new_taps); -} - -gr_fir_scc_simd::~gr_fir_scc_simd () -{ - free16Align (d_aligned_taps[0]); - free16Align (d_aligned_taps[1]); - free16Align (d_aligned_taps[2]); - free16Align (d_aligned_taps[3]); -} - -void -gr_fir_scc_simd::set_taps (const std::vector<gr_complex> &inew_taps) -{ - gr_fir_scc::set_taps (inew_taps); // call superclass - - const std::vector<gr_complex> new_taps = gr_reverse(inew_taps); - - unsigned len = new_taps.size (); - - // Make 4 copies of the coefficients, one for each data alignment - // Note use of special 16-byte-aligned version of calloc() - - for (unsigned i = 0; i < 4; i++){ - free16Align (d_aligned_taps[i]); // free old value - - // this works because the bit representation of a IEEE floating point - // +zero is all zeros. If you're using a different representation, - // you'll need to explictly set the result to the appropriate 0.0 value. - - d_aligned_taps[i] = (float *) calloc16Align (1 + (len + i - 1) / 2, - 2 * 4 * sizeof (float)); - if (d_aligned_taps[i] == 0){ - // throw something... - cerr << "@@@ gr_fir_scc_simd d_aligned_taps[" << i << "] == 0\n"; - } - - for (unsigned j = 0; j < len; j++) { - d_aligned_taps[i][2*(j+i)] = new_taps[j].real(); - d_aligned_taps[i][2*(j+i)+1] = new_taps[j].imag(); - } - } -} - -gr_complex -gr_fir_scc_simd::filter (const short input[]) -{ - if (ntaps () == 0) - return 0.0; - - - // Round input data address down to 8 byte boundary - // NB: depending on the alignment of input[], memory - // before input[] will be accessed. The contents don't matter since - // they'll be multiplied by zero coefficients. I can't conceive of any - // situation where this could cause a segfault since memory protection - // in the x86 machines is done on much larger boundaries. - - const short *ar = (short *)((unsigned long) input & ~7); - - // Choose one of 4 sets of pre-shifted coefficients. al is both the - // index into d_aligned_taps[] and the number of 0 words padded onto - // that coefficients array for alignment purposes. - - unsigned al = input - ar; - - // call assembler routine to do the work, passing number of 2x4-float blocks. - - // assert (((unsigned long) ar & 7) == 0); - // assert (((unsigned long) d_aligned_taps[al] & 15) == 0); - - // cerr << "ar: " << ar << " d_aligned_taps[ar]: " << d_aligned_taps[al] - // << " (ntaps() + al - 1)/2 + 1: " << (ntaps() + al -1) / 2 + 1 << endl; - - float result[2]; - - d_complex_dotprod (ar, d_aligned_taps[al], (ntaps() + al - 1) / 2 + 1, result); - - // cerr << "result = " << result[0] << " " << result[1] << endl; - - return gr_complex(result[0], result[1]); -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h b/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h deleted file mode 100644 index 72c15f93b3..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_simd.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_SCC_SIMD_H -#define INCLUDED_GR_FIR_SCC_SIMD_H - -#include <gr_core_api.h> -#include <gr_fir_scc_generic.h> - - -/*! - * \brief common base class for SIMD versions of gr_fir_scc - * \ingroup filter_primitive - * - * This base class handles alignment issues common to SSE and 3DNOW - * subclasses. - */ -class GR_CORE_API gr_fir_scc_simd : public gr_fir_scc_generic -{ -protected: - typedef void (*complex_dotprod_t)(const short *input, - const float *taps, - unsigned n_2_complex_blocks, - float *result); - - /*! - * \p aligned_taps holds 4 copies of the coefficients preshifted - * by 0, 1, 2, or 3 float pairs to meet all possible input data alignments. - * This allows us to always fetch data and taps that are 128-bit aligned. - */ - float *d_aligned_taps[4]; - - complex_dotprod_t d_complex_dotprod; // fast dot product primitive - -public: - - // CREATORS - gr_fir_scc_simd (); - gr_fir_scc_simd (const std::vector<gr_complex> &taps); - ~gr_fir_scc_simd (); - - // MANIPULATORS - virtual void set_taps (const std::vector<gr_complex> &taps); - virtual gr_complex filter (const short input[]); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc deleted file mode 100644 index ab0668c63a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_scc_x86.h> -#include <complex_dotprod_x86.h> - -/* - * --- 3DNow! version --- - */ - -gr_fir_scc_3dnow::gr_fir_scc_3dnow () - : gr_fir_scc_simd () -{ - d_complex_dotprod = complex_dotprod_3dnow; -} - -gr_fir_scc_3dnow::gr_fir_scc_3dnow (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_simd (new_taps) -{ - d_complex_dotprod = complex_dotprod_3dnow; -} - - -/* - * --- 3DNow! Ext version --- - */ - -gr_fir_scc_3dnowext::gr_fir_scc_3dnowext () - : gr_fir_scc_simd () -{ - d_complex_dotprod = complex_dotprod_3dnowext; -} - -gr_fir_scc_3dnowext::gr_fir_scc_3dnowext (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_simd (new_taps) -{ - d_complex_dotprod = complex_dotprod_3dnowext; -} - - -/* - * --- SSE version --- - */ - -gr_fir_scc_sse::gr_fir_scc_sse () - : gr_fir_scc_simd () -{ - d_complex_dotprod = complex_dotprod_sse; -} - -gr_fir_scc_sse::gr_fir_scc_sse (const std::vector<gr_complex> &new_taps) - : gr_fir_scc_simd (new_taps) -{ - d_complex_dotprod = complex_dotprod_sse; -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h b/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h deleted file mode 100644 index 85a63251b2..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_scc_x86.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FIR_SCC_X86_H -#define INCLUDED_GR_FIR_SCC_X86_H - -#include <gr_core_api.h> -#include <gr_fir_scc_simd.h> - -/*! - * \brief 3DNow! version of gr_fir_scc - */ -class GR_CORE_API gr_fir_scc_3dnow : public gr_fir_scc_simd -{ -public: - gr_fir_scc_3dnow (); - gr_fir_scc_3dnow (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief 3DNow! Ext version of gr_fir_scc - */ -class GR_CORE_API gr_fir_scc_3dnowext : public gr_fir_scc_simd -{ -public: - gr_fir_scc_3dnowext (); - gr_fir_scc_3dnowext (const std::vector<gr_complex> &taps); -}; - -/*! - * \brief SSE version of gr_fir_scc - */ -class GR_CORE_API gr_fir_scc_sse : public gr_fir_scc_simd -{ -public: - gr_fir_scc_sse (); - gr_fir_scc_sse (const std::vector<gr_complex> &taps); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc deleted file mode 100644 index 70adbc0920..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc +++ /dev/null @@ -1,337 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008,2009,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_fir_sysconfig_armv7_a.h> -#include <gr_cpu.h> - -#include <gr_fir_ccf.h> -#include <gr_fir_ccf_generic.h> -#include <gr_fir_ccf_armv7_a.h> -#include <gr_fir_fcc.h> -#include <gr_fir_fcc_generic.h> -#include <gr_fir_fff.h> -#include <gr_fir_fff_generic.h> -#include <gr_fir_fff_armv7_a.h> -#include <gr_fir_fsf.h> -#include <gr_fir_fsf_generic.h> -#include <gr_fir_ccc.h> -#include <gr_fir_ccc_generic.h> -#include <gr_fir_scc.h> -#include <gr_fir_scc_generic.h> - -#include <iostream> -using std::cerr; - -///\todo Remove commented out code for altivec and replace with NEON versions. - -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors... - * ---------------------------------------------------------------- - */ - -static gr_fir_ccf * -make_gr_fir_ccf_armv7_a (const std::vector<float> &taps) -{ - return new gr_fir_ccf_armv7_a(taps); -} - -#if 0 -static gr_fir_fcc * -make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_altivec(taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_altivec (taps); -} -#endif - -static gr_fir_fff * -make_gr_fir_fff_armv7_a (const std::vector<float> &taps) -{ - return new gr_fir_fff_armv7_a (taps); -} - -#if 0 -static gr_fir_fsf * -make_gr_fir_fsf_altivec (const std::vector<float> &taps) -{ - return new gr_fir_fsf_altivec (taps); -} - -static gr_fir_scc * -make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_altivec(taps); -} -#endif - -/* - * ---------------------------------------------------------------- - * Return instances of the fastest arm versions of these classes. - * - * check CPUID, if has armv7-a, return armv7-a version, - * else return generic version. This will break - * when someone makes an armv7-a without a NEON - * coprocessor. - * ---------------------------------------------------------------- - */ - -gr_fir_ccf * -gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_armv7_a ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using armv7_a\n"; - first = false; - } - return make_gr_fir_ccf_armv7_a (taps); - } - - if (0 && first){ - cerr << ">>> gr_fir_ccf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); -} - -gr_fir_fcc * -gr_fir_sysconfig_armv7_a::create_gr_fir_fcc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using altivec\n"; - first = false; - } - return make_gr_fir_fcc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fcc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps); -} - -gr_fir_ccc * -gr_fir_sysconfig_armv7_a::create_gr_fir_ccc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_ccc: using altivec\n"; - first = false; - } - return make_gr_fir_ccc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_ccc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps); -} - -gr_fir_fff * -gr_fir_sysconfig_armv7_a::create_gr_fir_fff (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_armv7_a ()){ - if (first){ - cerr << ">>> gr_fir_fff: using armv7_a\n"; - first = false; - } - return make_gr_fir_fff_armv7_a (taps); - } - - if (0 && first){ - cerr << ">>> gr_fir_fff: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fff (taps); -} - -gr_fir_fsf * -gr_fir_sysconfig_armv7_a::create_gr_fir_fsf (const std::vector<float> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fsf: using altivec\n"; - first = false; - } - return make_gr_fir_fsf_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fsf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps); -} - - -gr_fir_scc * -gr_fir_sysconfig_armv7_a::create_gr_fir_scc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_scc: using altivec\n"; - first = false; - } - return make_gr_fir_scc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_scc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_scc (taps); -} - -/* - * ---------------------------------------------------------------- - * Return info about available implementations - * ---------------------------------------------------------------- - */ - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); - - // add our stuff... - gr_fir_ccf_info t; - if (gr_cpu::has_armv7_a ()){ - t.name = "armv7_a"; - t.create = make_gr_fir_ccf_armv7_a; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); - -#if 0 - // add our stuff... - gr_fir_fcc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fcc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); - -#if 0 - // add our stuff... - gr_fir_ccc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); - - // add our stuff... - gr_fir_fff_info t; - if (gr_cpu::has_armv7_a ()){ - t.name = "armv7_a"; - t.create = make_gr_fir_fff_armv7_a; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); - -#if 0 - // add our stuff... - gr_fir_fsf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fsf_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_armv7_a::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); - -#if 0 - // add our stuff... - gr_fir_scc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_scc_altivec; - (*info).push_back (t); - } -#endif -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h deleted file mode 100644 index 7295475f64..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H -#define INCLUDED_GR_FIR_SYSCONFIG_ARMV7_A_H - -#include <gr_core_api.h> -#include <gr_fir_sysconfig_generic.h> - -class GR_CORE_API gr_fir_sysconfig_armv7_a : public gr_fir_sysconfig_generic { -public: - virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); - virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); - virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps); - virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps); - virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps); - virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps); -//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps); - - virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info); - virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info); - virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info); - virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info); - virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info); - virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info); -//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc deleted file mode 100644 index f706bd5bf2..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.cc +++ /dev/null @@ -1,340 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_powerpc.h> -#include <gr_cpu.h> - -#include <gr_fir_ccf.h> -#include <gr_fir_ccf_generic.h> -//#include <gr_fir_ccf_altivec.h> -#include <gr_fir_fcc.h> -#include <gr_fir_fcc_generic.h> -//#include <gr_fir_fcc_altivec.h> -#include <gr_fir_fff.h> -#include <gr_fir_fff_generic.h> -#include <gr_fir_fff_altivec.h> -#include <gr_fir_fsf.h> -#include <gr_fir_fsf_generic.h> -//#include <gr_fir_fsf_powerpc.h> -#include <gr_fir_ccc.h> -#include <gr_fir_ccc_generic.h> -//#include <gr_fir_ccc_altivec.h> -#include <gr_fir_scc.h> -#include <gr_fir_scc_generic.h> -//#include <gr_fir_scc_altivec.h> - -#include <iostream> -using std::cerr; - -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors... - * ---------------------------------------------------------------- - */ - -#if 0 -static gr_fir_ccf * -make_gr_fir_ccf_altivec(const std::vector<float> &taps) -{ - return new gr_fir_ccf_altivec(taps); -} - -static gr_fir_fcc * -make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_altivec(taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_altivec (taps); -} -#endif - -static gr_fir_fff * -make_gr_fir_fff_altivec (const std::vector<float> &taps) -{ - return new gr_fir_fff_altivec (taps); -} - -#if 0 -static gr_fir_fsf * -make_gr_fir_fsf_altivec (const std::vector<float> &taps) -{ - return new gr_fir_fsf_altivec (taps); -} - -static gr_fir_scc * -make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_altivec(taps); -} -#endif - -/* - * ---------------------------------------------------------------- - * Return instances of the fastest powerpc versions of these classes. - * - * check CPUID, if has altivec, return altivec version, - * else return generic version. - * ---------------------------------------------------------------- - */ - -gr_fir_ccf * -gr_fir_sysconfig_powerpc::create_gr_fir_ccf (const std::vector<float> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using altivec\n"; - first = false; - } - return make_gr_fir_ccf_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_ccf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); -} - -gr_fir_fcc * -gr_fir_sysconfig_powerpc::create_gr_fir_fcc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using altivec\n"; - first = false; - } - return make_gr_fir_fcc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fcc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps); -} - -gr_fir_ccc * -gr_fir_sysconfig_powerpc::create_gr_fir_ccc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_ccc: using altivec\n"; - first = false; - } - return make_gr_fir_ccc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_ccc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps); -} - -gr_fir_fff * -gr_fir_sysconfig_powerpc::create_gr_fir_fff (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fff: using altivec\n"; - first = false; - } - return make_gr_fir_fff_altivec (taps); - } - - if (0 && first){ - cerr << ">>> gr_fir_fff: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fff (taps); -} - -gr_fir_fsf * -gr_fir_sysconfig_powerpc::create_gr_fir_fsf (const std::vector<float> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_fsf: using altivec\n"; - first = false; - } - return make_gr_fir_fsf_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_fsf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps); -} - - -gr_fir_scc * -gr_fir_sysconfig_powerpc::create_gr_fir_scc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - -#if 0 - if (gr_cpu::has_altivec ()){ - if (first){ - cerr << ">>> gr_fir_scc: using altivec\n"; - first = false; - } - return make_gr_fir_scc_altivec (taps); - } -#endif - - if (0 && first){ - cerr << ">>> gr_fir_scc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_scc (taps); -} - -/* - * ---------------------------------------------------------------- - * Return info about available implementations - * ---------------------------------------------------------------- - */ - -void -gr_fir_sysconfig_powerpc::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); - -#if 0 - // add our stuff... - gr_fir_ccf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccf_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); - -#if 0 - // add our stuff... - gr_fir_fcc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fcc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); - -#if 0 - // add our stuff... - gr_fir_ccc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccc_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); - - // add our stuff... - gr_fir_fff_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fff_altivec; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); - -#if 0 - // add our stuff... - gr_fir_fsf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_fsf_altivec; - (*info).push_back (t); - } -#endif -} - -void -gr_fir_sysconfig_powerpc::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) -{ - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); - -#if 0 - // add our stuff... - gr_fir_scc_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_scc_altivec; - (*info).push_back (t); - } -#endif -} diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h deleted file mode 100644 index 09a7a0ba04..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_powerpc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H -#define INCLUDED_GR_FIR_SYSCONFIG_POWERPC_H - -#include <gr_core_api.h> -#include <gr_fir_sysconfig_generic.h> - -class GR_CORE_API gr_fir_sysconfig_powerpc : public gr_fir_sysconfig_generic { -public: - virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); - virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); - virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps); - virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps); - virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps); - virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps); -//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps); - - virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info); - virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info); - virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info); - virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info); - virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info); - virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info); -//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc deleted file mode 100644 index 97b8106994..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc +++ /dev/null @@ -1,553 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_x86.h> -#include <gr_cpu.h> - -#include <gr_fir_ccf.h> -#include <gr_fir_ccf_generic.h> -#include <gr_fir_ccf_x86.h> -#include <gr_fir_fcc.h> -#include <gr_fir_fcc_generic.h> -#include <gr_fir_fcc_x86.h> -#include <gr_fir_fff.h> -#include <gr_fir_fff_generic.h> -#include <gr_fir_fff_x86.h> -#include <gr_fir_fsf.h> -#include <gr_fir_fsf_generic.h> -#include <gr_fir_fsf_x86.h> -#include <gr_fir_ccc.h> -#include <gr_fir_ccc_generic.h> -#include <gr_fir_ccc_x86.h> -#include <gr_fir_scc.h> -#include <gr_fir_scc_generic.h> -#include <gr_fir_scc_x86.h> -// #include <gr_fir_sss.h> -// #include <gr_fir_sss_generic.h> -// #include <gr_fir_sss_mmx.h> -// #include <gr_fir_sss_sse2.h> - -#include <iostream> -using std::cerr; - -/* - * ---------------------------------------------------------------- - * static functions that serve as constructors... - * Is it possible to take the address of a normal constructor? - * ---------------------------------------------------------------- - */ - -static gr_fir_ccf * -make_gr_fir_ccf_3dnow(const std::vector<float> &taps) -{ - return new gr_fir_ccf_3dnow(taps); -} - -static gr_fir_ccf * -make_gr_fir_ccf_sse(const std::vector<float> &taps) -{ - return new gr_fir_ccf_sse(taps); -} - -static gr_fir_fcc * -make_gr_fir_fcc_3dnow(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_3dnow(taps); -} - -static gr_fir_fcc * -make_gr_fir_fcc_sse(const std::vector<gr_complex> &taps) -{ - return new gr_fir_fcc_sse(taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_3dnow (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_3dnow (taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_3dnowext (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_3dnowext (taps); -} - -static gr_fir_ccc * -make_gr_fir_ccc_sse (const std::vector<gr_complex> &taps) -{ - return new gr_fir_ccc_sse (taps); -} - -static gr_fir_fff * -make_gr_fir_fff_3dnow (const std::vector<float> &taps) -{ - return new gr_fir_fff_3dnow (taps); -} - -static gr_fir_fff * -make_gr_fir_fff_sse (const std::vector<float> &taps) -{ - return new gr_fir_fff_sse (taps); -} - -static gr_fir_fsf * -make_gr_fir_fsf_3dnow (const std::vector<float> &taps) -{ - return new gr_fir_fsf_3dnow (taps); -} - -static gr_fir_fsf * -make_gr_fir_fsf_sse (const std::vector<float> &taps) -{ - return new gr_fir_fsf_sse (taps); -} - -#if 0 -static gr_fir_sss * -make_gr_fir_sss_mmx (const std::vector<short> &taps) -{ - return new gr_fir_sss_mmx (taps); -} - -static gr_fir_sss * -make_gr_fir_sss_sse2 (const std::vector<short> &taps) -{ - return new gr_fir_sss_sse2 (taps); -} -#endif - -static gr_fir_scc * -make_gr_fir_scc_3dnow(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_3dnow(taps); -} - -static gr_fir_scc * -make_gr_fir_scc_3dnowext(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_3dnowext(taps); -} - -static gr_fir_scc * -make_gr_fir_scc_sse(const std::vector<gr_complex> &taps) -{ - return new gr_fir_scc_sse(taps); -} - -/* - * ---------------------------------------------------------------- - * Return instances of the fastest x86 versions of these classes. - * - * check CPUID, if has 3DNowExt, return 3DNow!Ext version, - * else if 3DNow, return 3DNow! version, - * else if SSE2, return SSE2 version, - * else if SSE, return SSE version, - * else if MMX, return MMX version, - * else return generic version. - * - * FIXME: benchmark, store result, use stored result to - * select the fastest version. - * ---------------------------------------------------------------- - */ - -gr_fir_ccf * -gr_fir_sysconfig_x86::create_gr_fir_ccf (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using 3DNow!\n"; - first = false; - } - return make_gr_fir_ccf_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_ccf: using SSE\n"; - first = false; - } - return make_gr_fir_ccf_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_ccf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps); -} - -gr_fir_fcc * -gr_fir_sysconfig_x86::create_gr_fir_fcc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using 3DNow!\n"; - first = false; - } - return make_gr_fir_fcc_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_fcc: using SSE\n"; - first = false; - } - return make_gr_fir_fcc_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_fcc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps); -} - -gr_fir_ccc * -gr_fir_sysconfig_x86::create_gr_fir_ccc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnowext ()){ - if (first) { - cerr << ">>> gr_fir_ccc: using 3DNow!Ext\n"; - first = false; - } - return make_gr_fir_ccc_3dnowext (taps); - } - - if (gr_cpu::has_3dnow ()){ - if (first) { - cerr << ">>> gr_fir_ccc: using 3DNow!\n"; - first = false; - } - return make_gr_fir_ccc_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_ccc: using SSE\n"; - first = false; - } - return make_gr_fir_ccc_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_ccc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps); -} - -gr_fir_fff * -gr_fir_sysconfig_x86::create_gr_fir_fff (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first) { - cerr << ">>> gr_fir_fff: using 3DNow!\n"; - first = false; - } - return make_gr_fir_fff_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_fff: using SSE\n"; - first = false; - } - return make_gr_fir_fff_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_fff: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fff (taps); -} - -gr_fir_fsf * -gr_fir_sysconfig_x86::create_gr_fir_fsf (const std::vector<float> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnow ()){ - if (first) { - cerr << ">>> gr_fir_fsf: using 3DNow!\n"; - first = false; - } - return make_gr_fir_fsf_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_fsf: using SSE\n"; - first = false; - } - return make_gr_fir_fsf_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_fsf: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps); -} - -#if 0 -gr_fir_sss * -gr_fir_sysconfig_x86::create_gr_fir_sss (const std::vector<short> &taps) -{ - // FIXME -- probably want to figure out best answer for Athlon and code - // add code to select it here... - - if (gr_cpu::has_sse2 ()){ - cerr << ">>> gr_fir_sss: using SSE2\n"; - return make_gr_fir_sss_sse2 (taps); - } - - if (gr_cpu::has_mmx ()){ - cerr << ">>> gr_fir_sss: using MMX\n"; - return make_gr_fir_sss_mmx (taps); - } - - cerr << ">>> gr_fir_sss: handing off to parent class\n"; - return gr_fir_sysconfig_generic::create_gr_fir_sss (taps); -} -#endif - -gr_fir_scc * -gr_fir_sysconfig_x86::create_gr_fir_scc (const std::vector<gr_complex> &taps) -{ - static bool first = true; - - if (gr_cpu::has_3dnowext ()){ - if (first){ - cerr << ">>> gr_fir_scc: using 3DNow!Ext\n"; - first = false; - } - return make_gr_fir_scc_3dnowext (taps); - } - - if (gr_cpu::has_3dnow ()){ - if (first){ - cerr << ">>> gr_fir_scc: using 3DNow!\n"; - first = false; - } - return make_gr_fir_scc_3dnow (taps); - } - - if (gr_cpu::has_sse ()){ - if (first){ - cerr << ">>> gr_fir_scc: using SSE\n"; - first = false; - } - return make_gr_fir_scc_sse (taps); - } - - if (first){ - cerr << ">>> gr_fir_scc: handing off to parent class\n"; - first = false; - } - return gr_fir_sysconfig_generic::create_gr_fir_scc (taps); -} - -/* - * ---------------------------------------------------------------- - * Return info about available implementations - * ---------------------------------------------------------------- - */ - -void -gr_fir_sysconfig_x86::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) -{ - gr_fir_ccf_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_ccf_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_ccf_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) -{ - gr_fir_fcc_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_fcc_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_fcc_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) -{ - gr_fir_ccc_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); - - // add our stuff... - if (gr_cpu::has_3dnowext ()){ - t.name = "3DNow!Ext"; - t.create = make_gr_fir_ccc_3dnowext; - (*info).push_back (t); - } - - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_ccc_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_ccc_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) -{ - gr_fir_fff_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_fff_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_fff_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) -{ - gr_fir_fsf_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); - - // add our stuff... - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_fsf_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_fsf_sse; - (*info).push_back (t); - } -} - -void -gr_fir_sysconfig_x86::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) -{ - gr_fir_scc_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); - - // add our stuff... - if (gr_cpu::has_3dnowext ()){ - t.name = "3DNow!Ext"; - t.create = make_gr_fir_scc_3dnowext; - (*info).push_back (t); - } - - if (gr_cpu::has_3dnow ()){ - t.name = "3DNow!"; - t.create = make_gr_fir_scc_3dnow; - (*info).push_back (t); - } - - if (gr_cpu::has_sse ()){ - t.name = "SSE"; - t.create = make_gr_fir_scc_sse; - (*info).push_back (t); - } -} - -#if 0 -void -gr_fir_sysconfig_x86::get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info) -{ - gr_fir_sss_info t; - - // invoke parent.. - gr_fir_sysconfig_generic::get_gr_fir_sss_info (info); - - // add our stuff... - if (gr_cpu::has_mmx ()){ - t.name = "MMX"; - t.create = make_gr_fir_sss_mmx; - (*info).push_back (t); - } - - if (gr_cpu::has_sse2 ()){ - t.name = "SSE2"; - t.create = make_gr_fir_sss_sse2; - (*info).push_back (t); - } -} -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h deleted file mode 100644 index ebb399c8ba..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_FIR_SYSCONFIG_X86_H -#define INCLUDED_GR_FIR_SYSCONFIG_X86_H - -#include <gr_core_api.h> -#include <gr_fir_sysconfig_generic.h> - -class GR_CORE_API gr_fir_sysconfig_x86 : public gr_fir_sysconfig_generic { -public: - virtual gr_fir_ccf *create_gr_fir_ccf (const std::vector<float> &taps); - virtual gr_fir_fcc *create_gr_fir_fcc (const std::vector<gr_complex> &taps); - virtual gr_fir_fff *create_gr_fir_fff (const std::vector<float> &taps); - virtual gr_fir_fsf *create_gr_fir_fsf (const std::vector<float> &taps); - virtual gr_fir_scc *create_gr_fir_scc (const std::vector<gr_complex> &taps); - virtual gr_fir_ccc *create_gr_fir_ccc (const std::vector<gr_complex> &taps); -//virtual gr_fir_sss *create_gr_fir_sss (const std::vector<short> &taps); - - virtual void get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info); - virtual void get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info); - virtual void get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info); - virtual void get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info); - virtual void get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info); - virtual void get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info); -//virtual void get_gr_fir_sss_info (std::vector<gr_fir_sss_info> *info); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc deleted file mode 100644 index 500958e3da..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_io_signature.h> -#include <gr_fractional_interpolator_cc.h> -#include <gri_mmse_fir_interpolator_cc.h> -#include <stdexcept> - -// Public constructor -gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc(float phase_shift, float interp_ratio) -{ - return gnuradio::get_initial_sptr(new gr_fractional_interpolator_cc(phase_shift, interp_ratio)); -} - -gr_fractional_interpolator_cc::gr_fractional_interpolator_cc(float phase_shift, float interp_ratio) - : gr_block ("fractional_interpolator_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new gri_mmse_fir_interpolator_cc()) -{ - if (interp_ratio <= 0) - throw std::out_of_range ("interpolation ratio must be > 0"); - if (phase_shift < 0 || phase_shift > 1) - throw std::out_of_range ("phase shift ratio must be > 0 and < 1"); - - set_relative_rate (1.0 / interp_ratio); -} - -gr_fractional_interpolator_cc::~gr_fractional_interpolator_cc() -{ - delete d_interp; -} - -void -gr_fractional_interpolator_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - - ninput_items_required[i] = - (int) ceil((noutput_items * d_mu_inc) + d_interp->ntaps()); -} - -int -gr_fractional_interpolator_cc::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - int ii = 0; // input index - int oo = 0; // output index - - while (oo < noutput_items) { - - out[oo++] = d_interp->interpolate(&in[ii], d_mu); - - double s = d_mu + d_mu_inc; - double f = floor (s); - int incr = (int) f; - d_mu = s - f; - ii += incr; - } - - consume_each (ii); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h deleted file mode 100644 index 29c67895a4..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H -#define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_CC_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gri_mmse_fir_interpolator_cc; - -class gr_fractional_interpolator_cc; -typedef boost::shared_ptr<gr_fractional_interpolator_cc> gr_fractional_interpolator_cc_sptr; - -// public constructor -GR_CORE_API gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -/*! - * \brief Interpolating mmse filter with gr_complex input, gr_complex output - * \ingroup filter_blk - */ -class GR_CORE_API gr_fractional_interpolator_cc : public gr_block -{ -public: - ~gr_fractional_interpolator_cc (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - float mu() const { return d_mu;} - float interp_ratio() const { return d_mu_inc;} - void set_mu (float mu) { d_mu = mu; } - void set_interp_ratio (float interp_ratio) { d_mu_inc = interp_ratio; } - -protected: - gr_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -private: - float d_mu; - float d_mu_inc; - gri_mmse_fir_interpolator_cc *d_interp; - - friend GR_CORE_API gr_fractional_interpolator_cc_sptr - gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i deleted file mode 100644 index d7341176a7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fractional_interpolator_cc); - -gr_fractional_interpolator_cc_sptr gr_make_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -class gr_fractional_interpolator_cc : public gr_block -{ -private: - gr_fractional_interpolator_cc (float phase_shift, float interp_ratio); - -public: - float mu() const; - float interp_ratio() const; - void set_mu (float mu); - void set_interp_ratio (float interp_ratio); -}; diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc deleted file mode 100644 index 9cbe31635d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_io_signature.h> -#include <gr_fractional_interpolator_ff.h> -#include <gri_mmse_fir_interpolator.h> -#include <stdexcept> - -// Public constructor -gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff(float phase_shift, float interp_ratio) -{ - return gnuradio::get_initial_sptr(new gr_fractional_interpolator_ff(phase_shift, interp_ratio)); -} - -gr_fractional_interpolator_ff::gr_fractional_interpolator_ff(float phase_shift, float interp_ratio) - : gr_block ("fractional_interpolator_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_mu (phase_shift), d_mu_inc (interp_ratio), d_interp(new gri_mmse_fir_interpolator()) -{ - if (interp_ratio <= 0) - throw std::out_of_range ("interpolation ratio must be > 0"); - if (phase_shift < 0 || phase_shift > 1) - throw std::out_of_range ("phase shift ratio must be > 0 and < 1"); - - set_relative_rate (1.0 / interp_ratio); -} - -gr_fractional_interpolator_ff::~gr_fractional_interpolator_ff() -{ - delete d_interp; -} - -void -gr_fractional_interpolator_ff::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size(); - for (unsigned i=0; i < ninputs; i++) - - ninput_items_required[i] = - (int) ceil((noutput_items * d_mu_inc) + d_interp->ntaps()); -} - -int -gr_fractional_interpolator_ff::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - int ii = 0; // input index - int oo = 0; // output index - - while (oo < noutput_items) { - - out[oo++] = d_interp->interpolate(&in[ii], d_mu); - - double s = d_mu + d_mu_inc; - double f = floor (s); - int incr = (int) f; - d_mu = s - f; - ii += incr; - } - - consume_each (ii); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h deleted file mode 100644 index 7e000a6d1c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H -#define INCLUDED_GR_FRACTIONAL_INTERPOLATOR_FF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gri_mmse_fir_interpolator; - -class gr_fractional_interpolator_ff; -typedef boost::shared_ptr<gr_fractional_interpolator_ff> gr_fractional_interpolator_ff_sptr; - -// public constructor -GR_CORE_API gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -/*! - * \brief Interpolating mmse filter with float input, float output - * \ingroup filter_blk - */ -class GR_CORE_API gr_fractional_interpolator_ff : public gr_block -{ -public: - ~gr_fractional_interpolator_ff (); - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - float mu() const { return d_mu;} - float interp_ratio() const { return d_mu_inc;} - void set_mu (float mu) { d_mu = mu; } - void set_interp_ratio (float interp_ratio) { d_mu_inc = interp_ratio; } - -protected: - gr_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -private: - float d_mu; - float d_mu_inc; - gri_mmse_fir_interpolator *d_interp; - - friend GR_CORE_API gr_fractional_interpolator_ff_sptr - gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i b/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i deleted file mode 100644 index 4ec7c85cfc..0000000000 --- a/gnuradio-core/src/lib/filter/gr_fractional_interpolator_ff.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,fractional_interpolator_ff); - -gr_fractional_interpolator_ff_sptr gr_make_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -class gr_fractional_interpolator_ff : public gr_block -{ -private: - gr_fractional_interpolator_ff (float phase_shift, float interp_ratio); - -public: - float mu() const; - float interp_ratio() const; - void set_mu (float mu); - void set_interp_ratio (float interp_ratio); -}; diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t deleted file mode 100644 index 3d65f872e6..0000000000 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.cc.t +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_freq_xlating_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq) -{ - return gnuradio::get_initial_sptr (new @NAME@ (decimation, taps, center_freq, sampling_freq)); -} - - -@NAME@::@NAME@ ( - - int decimation, - const std::vector<@TAP_TYPE@> &taps, - double center_freq, - double sampling_freq) - - : gr_sync_decimator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - decimation), - d_proto_taps (taps), d_center_freq (center_freq), d_sampling_freq (sampling_freq), - d_updated (false) -{ - std::vector<gr_complex> dummy_taps; - d_composite_fir = gr_fir_util::create_@FIR_TYPE@ (dummy_taps); - - set_history (d_proto_taps.size ()); - build_composite_fir (); -} - -@NAME@::~@NAME@ () -{ - delete d_composite_fir; -} - -void -@NAME@::build_composite_fir () -{ - std::vector<gr_complex> ctaps (d_proto_taps.size ()); - - float fwT0 = 2 * M_PI * d_center_freq / d_sampling_freq; - for (unsigned int i = 0; i < d_proto_taps.size (); i++) - ctaps[i] = d_proto_taps[i] * exp (gr_complex (0, i * fwT0)); - - d_composite_fir->set_taps (gr_reverse(ctaps)); - d_r.set_phase_incr (exp (gr_complex (0, fwT0 * decimation ()))); -} - -void -@NAME@::set_center_freq (double center_freq) -{ - d_center_freq = center_freq; - d_updated = true; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_proto_taps = taps; - d_updated = true; -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @I_TYPE@ *in = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - // rebuild composite FIR if the center freq has changed - - if (d_updated){ - set_history (d_proto_taps.size ()); - build_composite_fir (); - d_updated = false; - return 0; // history requirements may have changed. - } - - unsigned j = 0; - for (int i = 0; i < noutput_items; i++){ - out[i] = d_r.rotate (d_composite_fir->filter (&in[j])); - j += decimation (); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t deleted file mode 100644 index 97d20e04f5..0000000000 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.h.t +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_freq_xlating_fir_filter_XXX.py Any changes made to this file - * will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> -#include <gr_rotator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -/*! - * Construct a FIR filter with the given taps and a composite frequency - * translation that shifts center_freq down to zero Hz. The frequency - * translation logically comes before the filtering operation. - */ -GR_CORE_API @SPTR_NAME@ -gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - -class @FIR_TYPE@; - -/*! - * \brief FIR filter combined with frequency translation with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - * - * This class efficiently combines a frequency translation - * (typically "down conversion") with a FIR filter (typically low-pass) - * and decimation. It is ideally suited for a "channel selection filter" - * and can be efficiently used to select and decimate a narrow band signal - * out of wide bandwidth input. - * - * Uses a single input array to produce a single output array. - * Additional inputs and/or outputs are ignored. - */ -class GR_CORE_API @NAME@ : public gr_sync_decimator -{ - public: - virtual ~@NAME@ (); - - void set_center_freq (double center_freq); - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - private: - friend GR_CORE_API @SPTR_NAME@ - gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - protected: - std::vector<@TAP_TYPE@> d_proto_taps; - @FIR_TYPE@ *d_composite_fir; - gr_rotator d_r; - double d_center_freq; - double d_sampling_freq; - bool d_updated; - - virtual void build_composite_fir (); - - /*! - * Construct a FIR filter with the given taps and a composite frequency - * translation that shifts center_freq down to zero Hz. The frequency - * translation logically comes before the filtering operation. - */ - @NAME@ (int decimation, - const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); -}; - -#endif /* _@NAME@_H_ */ diff --git a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t deleted file mode 100644 index ac6c8c9e1e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_freq_xlating_fir_filter_XXX.i.t +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_freq_xlating_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - -class @NAME@ : public gr_sync_decimator -{ - protected: - @NAME@ (int decimation, const std::vector<@TAP_TYPE@> &taps, - double center_freq, double sampling_freq); - - public: - ~@NAME@ (); - - void set_center_freq (double center_freq); - void set_taps (const std::vector<@TAP_TYPE@> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc b/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc deleted file mode 100644 index 07bed8157b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_goertzel_fc.h> -#include <gr_io_signature.h> - -// public constructor -gr_goertzel_fc_sptr -gr_make_goertzel_fc(int rate, int len, float freq) -{ - return gnuradio::get_initial_sptr(new gr_goertzel_fc(rate, len, freq)); -} - -gr_goertzel_fc::gr_goertzel_fc(int rate, int len, float freq) - : gr_sync_decimator("goertzel_fc", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex)), - len), - d_goertzel(rate, len, freq) -{ - d_len = len; - d_rate = rate; - d_freq = freq; -} - -int gr_goertzel_fc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *)input_items[0]; - gr_complex *out = (gr_complex *)output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - *out++ = d_goertzel.batch(in); - in += d_len; - } - - return noutput_items; -} - -void -gr_goertzel_fc::set_freq(float freq) -{ - d_freq = freq; - d_goertzel.gri_setparms(d_rate, d_len, d_freq); -} - -void -gr_goertzel_fc::set_rate(int rate) -{ - d_rate = rate; - d_goertzel.gri_setparms(d_rate, d_len, d_freq); -} diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h deleted file mode 100644 index 5fb6e0ee05..0000000000 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_GOERTZEL_FC_H -#define INCLUDED_GR_GOERTZEL_FC_H - -#include <gr_core_api.h> -#include <gri_goertzel.h> -#include <gr_sync_decimator.h> - -class gr_goertzel_fc; -typedef boost::shared_ptr<gr_goertzel_fc> gr_goertzel_fc_sptr; - -// public constructor -GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq); - -/*! - * \brief Goertzel single-bin DFT calculation. - * \ingroup dft_blk - */ -class GR_CORE_API gr_goertzel_fc : public gr_sync_decimator -{ -private: - friend GR_CORE_API gr_goertzel_fc_sptr gr_make_goertzel_fc (int rate, int len, float freq); - - gr_goertzel_fc(int rate, int len, float freq); - gri_goertzel d_goertzel; - int d_len; - float d_freq; - int d_rate; - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - void set_freq (float freq); - void set_rate (int rate); -}; - -#endif /* INCLUDED_GR_GOERTZEL_FC_H */ - diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i b/gnuradio-core/src/lib/filter/gr_goertzel_fc.i deleted file mode 100644 index 775c78cc8e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,goertzel_fc); - -gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int len, float freq); - -class gr_goertzel_fc : public gr_sync_decimator -{ -private: - gr_goertzel_fc(); - -public: - void set_freq (float freq); - void set_rate (int rate); -}; diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc b/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc deleted file mode 100644 index 385e24ad2b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_hilbert_fc.h> -#include <gr_firdes.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> - -// public constructor -gr_hilbert_fc_sptr -gr_make_hilbert_fc (unsigned int ntaps) -{ - return gnuradio::get_initial_sptr(new gr_hilbert_fc (ntaps)); -} - -gr_hilbert_fc::gr_hilbert_fc (unsigned int ntaps) - : gr_sync_block ("hilbert_fc", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_ntaps (ntaps | 0x1), // ensure ntaps is odd - d_hilb (gr_fir_util::create_gr_fir_fff (gr_firdes::hilbert (d_ntaps))) -{ - set_history (d_ntaps); -} - -gr_hilbert_fc::~gr_hilbert_fc () -{ - delete d_hilb; -} - -int -gr_hilbert_fc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = gr_complex (in[i + d_ntaps/2], - d_hilb->filter (&in[i])); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h b/gnuradio-core/src/lib/filter/gr_hilbert_fc.h deleted file mode 100644 index 2bb5ff9e37..0000000000 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_HILBERT_FC_H -#define INCLUDED_GR_HILBERT_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_io_signature.h> -#include <gr_types.h> - -class gr_hilbert_fc; -typedef boost::shared_ptr<gr_hilbert_fc> gr_hilbert_fc_sptr; - -// public constructor -GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); - - -class gr_fir_fff; - -/*! - * \brief Hilbert transformer. - * \ingroup filter_blk - * - * real output is input appropriately delayed. - * imaginary output is hilbert filtered (90 degree phase shift) - * version of input. - */ -class GR_CORE_API gr_hilbert_fc : public gr_sync_block -{ - public: - ~gr_hilbert_fc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - protected: - gr_hilbert_fc (unsigned int ntaps); - - private: - unsigned int d_ntaps; - gr_fir_fff *d_hilb; - - friend GR_CORE_API gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); -}; - - - -#endif /* INCLUDED_GR_HILBERT_FC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_hilbert_fc.i b/gnuradio-core/src/lib/filter/gr_hilbert_fc.i deleted file mode 100644 index 91d4e23eb7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_hilbert_fc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,hilbert_fc); - -gr_hilbert_fc_sptr gr_make_hilbert_fc (unsigned int ntaps); - -class gr_hilbert_fc : public gr_sync_block -{ -protected: - gr_hilbert_fc (unsigned int ntaps); - -public: - ~gr_hilbert_fc (); -}; diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc deleted file mode 100644 index 4da2aa310b..0000000000 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_iir_filter_ffd.h> -#include <gr_io_signature.h> -#include <stdio.h> - - -gr_iir_filter_ffd_sptr -gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument) -{ - return gnuradio::get_initial_sptr(new gr_iir_filter_ffd (fftaps, fbtaps)); -} - -gr_iir_filter_ffd::gr_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument) - - : gr_sync_block ("iir_filter_ffd", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_iir (fftaps, fbtaps), - d_updated (false) -{ - // fprintf (stderr, "gr_iir_filter_ffd::ctor\n"); -} - -gr_iir_filter_ffd::~gr_iir_filter_ffd () -{ - // nop -} - -void -gr_iir_filter_ffd::set_taps (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument) -{ - - d_new_fftaps = fftaps; - d_new_fbtaps = fbtaps; - d_updated = true; -} - -int -gr_iir_filter_ffd::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - - if (d_updated){ - d_iir.set_taps (d_new_fftaps, d_new_fbtaps); - d_updated = false; - } - - d_iir.filter_n (out, in, noutput_items); - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h deleted file mode 100644 index ab7065e921..0000000000 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_IIR_FILTER_FFD_H -#define INCLUDED_GR_IIR_FILTER_FFD_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_iir.h> -#include <stdexcept> - -class gr_iir_filter_ffd; -typedef boost::shared_ptr<gr_iir_filter_ffd> gr_iir_filter_ffd_sptr; -GR_CORE_API gr_iir_filter_ffd_sptr -gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - -/*! - * \brief IIR filter with float input, float output and double taps - * \ingroup filter_blk - * - * This filter uses the Direct Form I implementation, where - * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones. - * - * - * The input and output satisfy a difference equation of the form - \htmlonly - \f{ - y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] - \f} - \endhtmlonly - - \xmlonly - y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] - \endxmlonly - - * with the corresponding rational system function - \htmlonly - \f{ - H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}} - \f} - \endhtmlonly - - \xmlonly - H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}} - \endxmlonly - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback taps. - */ -class GR_CORE_API gr_iir_filter_ffd : public gr_sync_block -{ - private: - friend GR_CORE_API gr_iir_filter_ffd_sptr - gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - gri_iir<float,float,double> d_iir; - std::vector<double> d_new_fftaps; - std::vector<double> d_new_fbtaps; - bool d_updated; - - /*! - * Construct an IIR filter with the given taps - */ - gr_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - public: - ~gr_iir_filter_ffd (); - - void set_taps (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i b/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i deleted file mode 100644 index 0a35ad89e1..0000000000 --- a/gnuradio-core/src/lib/filter/gr_iir_filter_ffd.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,iir_filter_ffd); - -gr_iir_filter_ffd_sptr -gr_make_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - -class gr_iir_filter_ffd : public gr_sync_block -{ - private: - gr_iir_filter_ffd (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); - - public: - ~gr_iir_filter_ffd (); - - void set_taps (const std::vector<double> &fftaps, - const std::vector<double> &fbtaps) throw (std::invalid_argument); -}; diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t deleted file mode 100644 index 55297d1eb9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.cc.t +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -@SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps) -{ - return gnuradio::get_initial_sptr (new @NAME@ (interpolation, taps)); -} - - -@NAME@::@NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps) - : gr_sync_interpolator ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@)), - interpolation), - d_updated (false), d_firs (interpolation) -{ - if (interpolation == 0) - throw std::out_of_range ("interpolation must be > 0"); - - std::vector<@TAP_TYPE@> dummy_taps; - - for (unsigned i = 0; i < interpolation; i++) - d_firs[i] = gr_fir_util::create_@FIR_TYPE@ (dummy_taps); - - set_taps (taps); - install_taps(d_new_taps); -} - -@NAME@::~@NAME@ () -{ - int interp = interpolation (); - for (int i = 0; i < interp; i++) - delete d_firs[i]; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_new_taps = taps; - d_updated = true; - - // round up length to a multiple of the interpolation factor - int n = taps.size () % interpolation (); - if (n > 0){ - n = interpolation () - n; - while (n-- > 0) - d_new_taps.insert(d_new_taps.begin(), 0); - } - - assert (d_new_taps.size () % interpolation () == 0); -} - - -void -@NAME@::install_taps (const std::vector<@TAP_TYPE@> &taps) -{ - int nfilters = interpolation (); - int nt = taps.size () / nfilters; - - assert (nt * nfilters == (int) taps.size ()); - - std::vector< std::vector <@TAP_TYPE@> > xtaps (nfilters); - - for (int n = 0; n < nfilters; n++) - xtaps[n].resize (nt); - - for (int i = 0; i < (int) taps.size(); i++) - xtaps[i % nfilters][i / nfilters] = taps[i]; - - for (int n = 0; n < nfilters; n++) - d_firs[n]->set_taps (xtaps[n]); - - set_history (nt); - d_updated = false; - -#if 0 - for (int i = 0; i < nfilters; i++){ - std::cout << "filter[" << i << "] = "; - for (int j = 0; j < nt; j++) - std::cout << xtaps[i][j] << " "; - - std::cout << "\n"; - } -#endif - -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - if (d_updated) { - install_taps (d_new_taps); - return 0; // history requirements may have changed. - } - - int nfilters = interpolation (); - int ni = noutput_items / interpolation (); - - for (int i = 0; i < ni; i++){ - for (int nf = 0; nf < nfilters; nf++) - out[nf] = d_firs[nf]->filter (&in[i]); - out += nfilters; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t deleted file mode 100644 index 83904dce21..0000000000 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.h.t +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gr_fir_filter_XXX.py - * Any changes made to this file will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); - -class @FIR_TYPE@; - -/*! - * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - */ -class GR_CORE_API @NAME@ : public gr_sync_interpolator -{ - private: - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); - - std::vector<@TAP_TYPE@> d_new_taps; - bool d_updated; - std::vector<@FIR_TYPE@ *> d_firs; - - /*! - * Construct a FIR filter with the given taps - */ - @NAME@ (unsigned interpolation, const std::vector<@TAP_TYPE@> &taps); - - void install_taps (const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t b/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t deleted file mode 100644 index 2747530016..0000000000 --- a/gnuradio-core/src/lib/filter/gr_interp_fir_filter_XXX.i.t +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_GrFIRfilterXXX.py - * Any changes made to this file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int interpolation, const std::vector<@TAP_TYPE@> &taps); - -class @NAME@ : public gr_sync_interpolator -{ - private: - @NAME@ (int interpolation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc deleted file mode 100644 index 06e98447ec..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_arb_resampler_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size) -{ - return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_ccf (rate, taps, - filter_size)); -} - - -gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size) - : gr_block ("pfb_arb_resampler_ccf", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), - d_updated (false) -{ - d_acc = 0; // start accumulator at 0 - - /* The number of filters is specified by the user as the filter size; - this is also the interpolation rate of the filter. We use it and the - rate provided to determine the decimation rate. This acts as a - rational resampler. The flt_rate is calculated as the residual - between the integer decimation rate and the real decimation rate and - will be used to determine to interpolation point of the resampling - process. - */ - d_int_rate = filter_size; - set_rate(rate); - - // Store the last filter between calls to work - d_last_filter = 0; - - d_start_index = 0; - - d_filters = std::vector<gr_fir_ccf*>(d_int_rate); - d_diff_filters = std::vector<gr_fir_ccf*>(d_int_rate); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_int_rate); - for(unsigned int i = 0; i < d_int_rate; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - } - - // Now, actually set the filters' taps - std::vector<float> dtaps; - create_diff_taps(taps, dtaps); - create_taps(taps, d_taps, d_filters); - create_taps(dtaps, d_dtaps, d_diff_filters); -} - -gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf () -{ - for(unsigned int i = 0; i < d_int_rate; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter) -{ - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_int_rate); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = newtaps; - while((float)(tmp_taps.size()) < d_int_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(unsigned int i = 0; i < d_int_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(unsigned int j = 0; j < d_taps_per_filter; j++) { - ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + 1); - - d_updated = true; -} - -void -gr_pfb_arb_resampler_ccf::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - // Calculate the differential taps (derivative filter) by taking the difference - // between two taps. Duplicate the last one to make both filters the same length. - float tap; - difftaps.clear(); - for(unsigned int i = 0; i < newtaps.size()-1; i++) { - tap = newtaps[i+1] - newtaps[i]; - difftaps.push_back(tap); - } - difftaps.push_back(tap); -} - -void -gr_pfb_arb_resampler_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_int_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n"); - } -} - -int -gr_pfb_arb_resampler_ccf::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i = 0, count = d_start_index; - unsigned int j; - gr_complex o0, o1; - - // Restore the last filter position - j = d_last_filter; - - // produce output as long as we can and there are enough input samples - int max_input = ninput_items[0]-(int)d_taps_per_filter; - while((i < noutput_items) && (count < max_input)) { - // start j by wrapping around mod the number of channels - while((j < d_int_rate) && (i < noutput_items)) { - // Take the current filter and derivative filter output - o0 = d_filters[j]->filter(&in[count]); - o1 = d_diff_filters[j]->filter(&in[count]); - - out[i] = o0 + o1*d_acc; // linearly interpolate between samples - i++; - - // Adjust accumulator and index into filterbank - d_acc += d_flt_rate; - j += d_dec_rate + (int)floor(d_acc); - d_acc = fmodf(d_acc, 1.0); - } - if(i < noutput_items) { // keep state for next entry - float ss = (int)(j / d_int_rate); // number of items to skip ahead by - count += ss; // we have fully consumed another input - j = j % d_int_rate; // roll filter around - } - } - - // Store the current filter position and start of next sample - d_last_filter = j; - d_start_index = std::max(0, count - ninput_items[0]); - - // consume all we've processed but no more than we can - consume_each(std::min(count, ninput_items[0])); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h deleted file mode 100644 index d92898a23e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H -#define INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_arb_resampler_ccf; -typedef boost::shared_ptr<gr_pfb_arb_resampler_ccf> gr_pfb_arb_resampler_ccf_sptr; -GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_fir_ccf; - -/*! - * \class gr_pfb_arb_resampler_ccf - * - * \brief Polyphase filterbank arbitrary resampler with - * gr_complex input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs arbitrary - * resampling. The resampling rate can be any real - * number <EM>r</EM>. The resampling is done by constructing - * <EM>N</EM> filters where <EM>N</EM> is the interpolation rate. We - * then calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>. - * - * Using <EM>N</EM> and <EM>D</EM>, we can perform rational resampling - * where <EM>N/D</EM> is a rational number close to the input rate - * <EM>r</EM> where we have <EM>N</EM> filters and we cycle through - * them as a polyphase filterbank with a stride of <EM>D</EM> so that - * <EM>i+1 = (i + D) % N</EM>. - * - * To get the arbitrary rate, we want to interpolate between two - * points. For each value out, we take an output from the current - * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then - * linearly interpolate between the two based on the real resampling - * rate we want. - * - * The linear interpolation only provides us with an approximation to - * the real sampling rate specified. The error is a quantization error - * between the two filters we used as our interpolation points. To - * this end, the number of filters, <EM>N</EM>, used determines the - * quantization error; the larger <EM>N</EM>, the smaller the - * noise. You can design for a specified noise floor by setting the - * filter size (parameters <EM>filter_size</EM>). The size defaults to - * 32 filters, which is about as good as most implementations need. - * - * The trick with designing this filter is in how to specify the taps - * of the prototype filter. Like the PFB interpolator, the taps are - * specified using the interpolated filter rate. In this case, that - * rate is the input sample rate multiplied by the number of filters - * in the filterbank, which is also the interpolation rate. All other - * values should be relative to this rate. - * - * For example, for a 32-filter arbitrary resampler and using the - * GNU Radio's firdes utility to build the filter, we build a low-pass - * filter with a sampling rate of <EM>fs</EM>, a 3-dB bandwidth of - * <EM>BW</EM> and a transition bandwidth of <EM>TB</EM>. We can also - * specify the out-of-band attenuation to use, <EM>ATT</EM>, and the - * filter window function (a Blackman-harris window in this case). The - * first input is the gain of the filter, which we specify here as the - * interpolation rate (<EM>32</EM>). - * - * <B><EM>self._taps = gr.firdes.low_pass_2(32, 32*fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The theory behind this block can be found in Chapter 7.5 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_arb_resampler_ccf : public gr_block -{ - private: - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - friend GR_CORE_API gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - std::vector<gr_fir_ccf*> d_filters; - std::vector<gr_fir_ccf*> d_diff_filters; - std::vector< std::vector<float> > d_taps; - std::vector< std::vector<float> > d_dtaps; - unsigned int d_int_rate; // the number of filters (interpolation rate) - unsigned int d_dec_rate; // the stride through the filters (decimation rate) - float d_flt_rate; // residual rate for the linear interpolation - float d_acc; - unsigned int d_last_filter; - int d_start_index; - unsigned int d_taps_per_filter; - bool d_updated; - - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - gr_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param newtaps (vector of floats) The prototype filter to populate the filterbank. - * The taps should be generated at the interpolated sampling rate. - * \param ourtaps (vector of floats) Reference to our internal member of holding the taps. - * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for. - */ - void create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter); - - -public: - ~gr_pfb_arb_resampler_ccf (); - - // FIXME: See about a set_taps function during runtime. - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - void set_rate (float rate) { - d_dec_rate = (unsigned int)floor(d_int_rate/rate); - d_flt_rate = (d_int_rate/rate) - d_dec_rate; - set_relative_rate(rate); - } - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i deleted file mode 100644 index da58947e92..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_arb_resampler_ccf); - -gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_pfb_arb_resampler_ccf : public gr_block -{ - private: - gr_pfb_arb_resampler_ccf (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - public: - ~gr_pfb_arb_resampler_ccf (); - - //void set_taps (const std::vector<float> &taps); - void print_taps(); - void set_rate (float rate); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc deleted file mode 100644 index 9a9b869929..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.cc +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_arb_resampler_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size) -{ - return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_fff (rate, taps, - filter_size)); -} - - -gr_pfb_arb_resampler_fff::gr_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size) - : gr_block ("pfb_arb_resampler_fff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (1, 1, sizeof(float))), - d_updated (false) -{ - d_acc = 0; // start accumulator at 0 - - /* The number of filters is specified by the user as the filter size; - this is also the interpolation rate of the filter. We use it and the - rate provided to determine the decimation rate. This acts as a - rational resampler. The flt_rate is calculated as the residual - between the integer decimation rate and the real decimation rate and - will be used to determine to interpolation point of the resampling - process. - */ - d_int_rate = filter_size; - set_rate(rate); - - // Store the last filter between calls to work - d_last_filter = 0; - - d_start_index = 0; - - d_filters = std::vector<gr_fir_fff*>(d_int_rate); - d_diff_filters = std::vector<gr_fir_fff*>(d_int_rate); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_int_rate); - for(unsigned int i = 0; i < d_int_rate; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps); - d_diff_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps); - } - - // Now, actually set the filters' taps - std::vector<float> dtaps; - create_diff_taps(taps, dtaps); - create_taps(taps, d_taps, d_filters); - create_taps(dtaps, d_dtaps, d_diff_filters); -} - -gr_pfb_arb_resampler_fff::~gr_pfb_arb_resampler_fff () -{ - for(unsigned int i = 0; i < d_int_rate; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_arb_resampler_fff::create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter) -{ - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_int_rate); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = newtaps; - while((float)(tmp_taps.size()) < d_int_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(unsigned int i = 0; i < d_int_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(unsigned int j = 0; j < d_taps_per_filter; j++) { - ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + 1); - - d_updated = true; -} - -void -gr_pfb_arb_resampler_fff::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - // Calculate the differential taps (derivative filter) by taking the difference - // between two taps. Duplicate the last one to make both filters the same length. - float tap; - difftaps.clear(); - for(unsigned int i = 0; i < newtaps.size()-1; i++) { - tap = newtaps[i+1] - newtaps[i]; - difftaps.push_back(tap); - } - difftaps.push_back(tap); -} - -void -gr_pfb_arb_resampler_fff::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_int_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n"); - } -} - -int -gr_pfb_arb_resampler_fff::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *) input_items[0]; - float *out = (float *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i = 0, count = d_start_index; - unsigned int j; - float o0, o1; - - // Restore the last filter position - j = d_last_filter; - - // produce output as long as we can and there are enough input samples - int max_input = ninput_items[0]-(int)d_taps_per_filter; - while((i < noutput_items) && (count < max_input)) { - // start j by wrapping around mod the number of channels - while((j < d_int_rate) && (i < noutput_items)) { - // Take the current filter and derivative filter output - o0 = d_filters[j]->filter(&in[count]); - o1 = d_diff_filters[j]->filter(&in[count]); - - out[i] = o0 + o1*d_acc; // linearly interpolate between samples - i++; - - // Adjust accumulator and index into filterbank - d_acc += d_flt_rate; - j += d_dec_rate + (int)floor(d_acc); - d_acc = fmodf(d_acc, 1.0); - } - if(i < noutput_items) { // keep state for next entry - float ss = (int)(j / d_int_rate); // number of items to skip ahead by - count += ss; // we have fully consumed another input - j = j % d_int_rate; // roll filter around - } - } - - // Store the current filter position and start of next sample - d_last_filter = j; - d_start_index = std::max(0, count - ninput_items[0]); - - // consume all we've processed but no more than we can - consume_each(std::min(count, ninput_items[0])); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h deleted file mode 100644 index d2e375210d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_ARB_RESAMPLER_FFF_H -#define INCLUDED_GR_PFB_ARB_RESAMPLER_FFF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_arb_resampler_fff; -typedef boost::shared_ptr<gr_pfb_arb_resampler_fff> gr_pfb_arb_resampler_fff_sptr; -GR_CORE_API gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_fir_fff; - -/*! - * \class gr_pfb_arb_resampler_fff - * - * \brief Polyphase filterbank arbitrary resampler with - * float input, float output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs arbitrary - * resampling. The resampling rate can be any real - * number <EM>r</EM>. The resampling is done by constructing - * <EM>N</EM> filters where <EM>N</EM> is the interpolation rate. We - * then calculate <EM>D</EM> where <EM>D = floor(N/r)</EM>. - * - * Using <EM>N</EM> and <EM>D</EM>, we can perform rational resampling - * where <EM>N/D</EM> is a rational number close to the input rate - * <EM>r</EM> where we have <EM>N</EM> filters and we cycle through - * them as a polyphase filterbank with a stride of <EM>D</EM> so that - * <EM>i+1 = (i + D) % N</EM>. - * - * To get the arbitrary rate, we want to interpolate between two - * points. For each value out, we take an output from the current - * filter, <EM>i</EM>, and the next filter <EM>i+1</EM> and then - * linearly interpolate between the two based on the real resampling - * rate we want. - * - * The linear interpolation only provides us with an approximation to - * the real sampling rate specified. The error is a quantization error - * between the two filters we used as our interpolation points. To - * this end, the number of filters, <EM>N</EM>, used determines the - * quantization error; the larger <EM>N</EM>, the smaller the - * noise. You can design for a specified noise floor by setting the - * filter size (parameters <EM>filter_size</EM>). The size defaults to - * 32 filters, which is about as good as most implementations need. - * - * The trick with designing this filter is in how to specify the taps - * of the prototype filter. Like the PFB interpolator, the taps are - * specified using the interpolated filter rate. In this case, that - * rate is the input sample rate multiplied by the number of filters - * in the filterbank, which is also the interpolation rate. All other - * values should be relative to this rate. - * - * For example, for a 32-filter arbitrary resampler and using the - * GNU Radio's firdes utility to build the filter, we build a low-pass - * filter with a sampling rate of <EM>fs</EM>, a 3-dB bandwidth of - * <EM>BW</EM> and a transition bandwidth of <EM>TB</EM>. We can also - * specify the out-of-band attenuation to use, <EM>ATT</EM>, and the - * filter window function (a Blackman-harris window in this case). The - * first input is the gain of the filter, which we specify here as the - * interpolation rate (<EM>32</EM>). - * - * <B><EM>self._taps = gr.firdes.low_pass_2(32, 32*fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The theory behind this block can be found in Chapter 7.5 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems", Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_arb_resampler_fff : public gr_block -{ - private: - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - friend GR_CORE_API gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - std::vector<gr_fir_fff*> d_filters; - std::vector<gr_fir_fff*> d_diff_filters; - std::vector< std::vector<float> > d_taps; - std::vector< std::vector<float> > d_dtaps; - unsigned int d_int_rate; // the number of filters (interpolation rate) - unsigned int d_dec_rate; // the stride through the filters (decimation rate) - float d_flt_rate; // residual rate for the linear interpolation - float d_acc; - unsigned int d_last_filter; - int d_start_index; - unsigned int d_taps_per_filter; - bool d_updated; - - /*! - * Build the polyphase filterbank arbitray resampler. - * \param rate (float) Specifies the resampling rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the filter_size sampling rate. - * \param filter_size (unsigned int) The number of filters in the filter bank. This is directly - related to quantization noise introduced during the resampling. - Defaults to 32 filters. - */ - gr_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param newtaps (vector of floats) The prototype filter to populate the filterbank. - * The taps should be generated at the interpolated sampling rate. - * \param ourtaps (vector of floats) Reference to our internal member of holding the taps. - * \param ourfilter (vector of filters) Reference to our internal filter to set the taps for. - */ - void create_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - -public: - ~gr_pfb_arb_resampler_fff (); - - // FIXME: See about a set_taps function during runtime. - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - void set_rate (float rate) { - d_dec_rate = (unsigned int)floor(d_int_rate/rate); - d_flt_rate = (d_int_rate/rate) - d_dec_rate; - set_relative_rate(rate); - } - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i deleted file mode 100644 index ad09053610..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_fff.i +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_arb_resampler_fff); - -gr_pfb_arb_resampler_fff_sptr gr_make_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size=32); - -class gr_pfb_arb_resampler_fff : public gr_block -{ - private: - gr_pfb_arb_resampler_fff (float rate, - const std::vector<float> &taps, - unsigned int filter_size); - - public: - ~gr_pfb_arb_resampler_fff (); - - //void set_taps (const std::vector<float> &taps); - void print_taps(); - void set_rate (float rate); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc deleted file mode 100644 index a8cb849e27..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc +++ /dev/null @@ -1,240 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_channelizer_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <cstring> - -gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate) -{ - return gnuradio::get_initial_sptr(new gr_pfb_channelizer_ccf (numchans, taps, - oversample_rate)); -} - - -gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate) - : gr_block ("pfb_channelizer_ccf", - gr_make_io_signature (numchans, numchans, sizeof(gr_complex)), - gr_make_io_signature (1, numchans, sizeof(gr_complex))), - d_updated (false), d_numchans(numchans), d_oversample_rate(oversample_rate) -{ - // The over sampling rate must be rationally related to the number of channels - // in that it must be N/i for i in [1,N], which gives an outputsample rate - // of [fs/N, fs] where fs is the input sample rate. - // This tests the specified input sample rate to see if it conforms to this - // requirement within a few significant figures. - double intp = 0; - double fltp = modf(numchans / oversample_rate, &intp); - if(fltp != 0.0) - throw std::invalid_argument("gr_pfb_channelizer: oversample rate must be N/i for i in [1, N]"); - - set_relative_rate(1.0/intp); - - d_filters = std::vector<gr_fir_ccf*>(d_numchans); - d_channel_map.resize(d_numchans); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_numchans); - for(unsigned int i = 0; i < d_numchans; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_channel_map[i] = i; - } - - // Now, actually set the filters' taps - set_taps(taps); - - // Create the FFT to handle the output de-spinning of the channels - d_fft = new gri_fft_complex (d_numchans, false); - - // Although the filters change, we use this look up table - // to set the index of the FFT input buffer, which equivalently - // performs the FFT shift operation on every other turn. - d_rate_ratio = (int)rintf(d_numchans / d_oversample_rate); - d_idxlut = new int[d_numchans]; - for(unsigned int i = 0; i < d_numchans; i++) { - d_idxlut[i] = d_numchans - ((i + d_rate_ratio) % d_numchans) - 1; - } - - // Calculate the number of filtering rounds to do to evenly - // align the input vectors with the output channels - d_output_multiple = 1; - while((d_output_multiple * d_rate_ratio) % d_numchans != 0) - d_output_multiple++; - set_output_multiple(d_output_multiple); -} - -gr_pfb_channelizer_ccf::~gr_pfb_channelizer_ccf () -{ - delete d_fft; - delete [] d_idxlut; - - for(unsigned int i = 0; i < d_numchans; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_channelizer_ccf::set_taps (const std::vector<float> &taps) -{ - gruel::scoped_lock guard(d_mutex); - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_numchans); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = taps; - while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_numchans; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter+1); - - d_updated = true; -} - -void -gr_pfb_channelizer_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_numchans; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - -std::vector< std::vector<float> > -gr_pfb_channelizer_ccf::taps() const -{ - return d_taps; -} - -void -gr_pfb_channelizer_ccf::set_channel_map(const std::vector<int> &map) -{ - gruel::scoped_lock guard(d_mutex); - - if(map.size() > 0) { - unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end()); - unsigned int min = (unsigned int)*std::min_element(map.begin(), map.end()); - if((max >= d_numchans) || (min < 0)) { - throw std::invalid_argument("gr_pfb_channelizer_ccf::set_channel_map: map range out of bounds.\n"); - } - d_channel_map = map; - } -} - -std::vector<int> -gr_pfb_channelizer_ccf::channel_map() const -{ - return d_channel_map; -} - - -int -gr_pfb_channelizer_ccf::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock guard(d_mutex); - - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - size_t noutputs = output_items.size(); - - int n=1, i=-1, j=0, oo=0, last; - int toconsume = (int)rintf(noutput_items/d_oversample_rate); - while(n <= toconsume) { - j = 0; - i = (i + d_rate_ratio) % d_numchans; - last = i; - while(i >= 0) { - in = (gr_complex*)input_items[j]; - d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n]); - j++; - i--; - } - - i = d_numchans-1; - while(i > last) { - in = (gr_complex*)input_items[j]; - d_fft->get_inbuf()[d_idxlut[j]] = d_filters[i]->filter(&in[n-1]); - j++; - i--; - } - - n += (i+d_rate_ratio) >= (int)d_numchans; - - // despin through FFT - d_fft->execute(); - - // Send to output channels - for(unsigned int nn = 0; nn < noutputs; nn++) { - out = (gr_complex*)output_items[nn]; - out[oo] = d_fft->get_outbuf()[d_channel_map[nn]]; - } - oo++; - } - - consume_each(toconsume); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h deleted file mode 100644 index 79ad322f9a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_CHANNELIZER_CCF_H -#define INCLUDED_GR_PFB_CHANNELIZER_CCF_H - -#include <gr_core_api.h> -#include <gr_block.h> -#include <gruel/thread.h> - -class gr_pfb_channelizer_ccf; -typedef boost::shared_ptr<gr_pfb_channelizer_ccf> gr_pfb_channelizer_ccf_sptr; -GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate=1); - -class gr_fir_ccf; -class gri_fft_complex; - - -/*! - * \class gr_pfb_channelizer_ccf - * - * \brief Polyphase filterbank channelizer with - * gr_complex input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in complex inputs and channelizes it to <EM>M</EM> - * channels of equal bandwidth. Each of the resulting channels is - * decimated to the new rate that is the input sampling rate - * <EM>fs</EM> divided by the number of channels, <EM>M</EM>. - * - * The PFB channelizer code takes the taps generated above and builds - * a set of filters. The set contains <EM>M</EM> number of filters - * and each filter contains ceil(taps.size()/decim) number of taps. - * Each tap from the filter prototype is sequentially inserted into - * the next filter. When all of the input taps are used, the remaining - * filters in the filterbank are filled out with 0's to make sure each - * filter has the same number of taps. - * - * Each filter operates using the gr_fir filter classs of GNU Radio, - * which takes the input stream at <EM>i</EM> and performs the inner - * product calculation to <EM>i+(n-1)</EM> where <EM>n</EM> is the - * number of filter taps. To efficiently handle this in the GNU Radio - * structure, each filter input must come from its own input - * stream. So the channelizer must be provided with <EM>M</EM> streams - * where the input stream has been deinterleaved. This is most easily - * done using the gr_stream_to_streams block. - * - * The output is then produced as a vector, where index <EM>i</EM> in - * the vector is the next sample from the <EM>i</EM>th channel. This - * is most easily handled by sending the output to a - * gr_vector_to_streams block to handle the conversion and passing - * <EM>M</EM> streams out. - * - * The input and output formatting is done using a hier_block2 called - * pfb_channelizer_ccf. This can take in a single stream and outputs - * <EM>M</EM> streams based on the behavior described above. - * - * The filter's taps should be based on the input sampling rate. - * - * For example, using the GNU Radio's firdes utility to building - * filters, we build a low-pass filter with a sampling rate of - * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition - * bandwidth of <EM>TB</EM>. We can also specify the out-of-band - * attenuation to use, <EM>ATT</EM>, and the filter window - * function (a Blackman-harris window in this case). The first input - * is the gain of the filter, which we specify here as unity. - * - * <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The filter output can also be overs ampled. The over sampling rate - * is the ratio of the the actual output sampling rate to the normal - * output sampling rate. It must be rationally related to the number - * of channels as N/i for i in [1,N], which gives an outputsample rate - * of [fs/N, fs] where fs is the input sample rate and N is the number - * of channels. - * - * For example, for 6 channels with fs = 6000 Hz, the normal rate is - * 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4, - * 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample - * ratio is 6000 Hz, or 6 times the normal 1000 Hz. A rate of 6/5 = 1.2, - * so the output rate would be 1200 Hz. - * - * The theory behind this block can be found in Chapter 6 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - * - */ - -class GR_CORE_API gr_pfb_channelizer_ccf : public gr_block -{ - private: - /*! - * Build the polyphase filterbank decimator. - * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param oversample_rate (float) The over sampling rate is the ratio of the the actual - * output sampling rate to the normal output sampling rate. - * It must be rationally related to the number of channels - * as N/i for i in [1,N], which gives an outputsample rate - * of [fs/N, fs] where fs is the input sample rate and N is - * the number of channels. - * - * For example, for 6 channels with fs = 6000 Hz, the normal - * rate is 6000/6 = 1000 Hz. Allowable oversampling rates - * are 6/6, 6/5, 6/4, 6/3, 6/2, and 6/1 where the output - * sample rate of a 6/1 oversample ratio is 6000 Hz, or - * 6 times the normal 1000 Hz. - */ - friend GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate); - - bool d_updated; - unsigned int d_numchans; - float d_oversample_rate; - std::vector<gr_fir_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - unsigned int d_taps_per_filter; - gri_fft_complex *d_fft; - int *d_idxlut; - int d_rate_ratio; - int d_output_multiple; - std::vector<int> d_channel_map; - gruel::mutex d_mutex; // mutex to protect set/work access - - /*! - * Build the polyphase filterbank decimator. - * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param oversample_rate (float) The output over sampling rate. - */ - gr_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate); - -public: - ~gr_pfb_channelizer_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - /*! - * Return a vector<vector<>> of the filterbank taps - */ - std::vector<std::vector<float> > taps() const; - - /*! - * Set the channel map. Channels are numbers as: - * - * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 - * <------------------- 0 --------------------> - * freq - * - * So output stream 0 comes from channel 0, etc. Setting a new - * channel map allows the user to specify which channel in frequency - * he/she wants to got to which output stream. - * - * The map should have the same number of elements as the number of - * output connections from the block. The minimum value of the map - * is 0 (for the 0th channel) and the maximum number is N-1 where N - * is the number of channels. - * - * We specify M as the number of output connections made where M <= - * N, so only M out of N channels are driven to an output - * stream. The number of items in the channel map should be at least - * M long. If there are more channels specified, any value in the - * map over M-1 will be ignored. If the size of the map is less than - * M the behavior is unknown (we don't wish to check every entry - * into the work function). - * - * This means that if the channelizer is splitting the signal up - * into N channels but only M channels are specified in the map - * (where M <= N), then M output streams must be connected and the - * map and the channel numbers used must be less than N-1. Output - * channel number can be reused, too. By default, the map is - * [0...M-1] with M = N. - */ - void set_channel_map(const std::vector<int> &map); - - /*! - * Gets the current channel map. - */ - std::vector<int> channel_map() const; - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i deleted file mode 100644 index 1f2b49452f..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_channelizer_ccf); - -gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate=1); - -class gr_pfb_channelizer_ccf : public gr_block -{ - private: - gr_pfb_channelizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - float oversample_rate); - - public: - ~gr_pfb_channelizer_ccf (); - - void set_taps (const std::vector<float> &taps); - void print_taps(); - std::vector<std::vector<float> > taps() const; - - void set_channel_map(const std::vector<int> &map); - std::vector<int> channel_map() const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc deleted file mode 100644 index efe417918a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc +++ /dev/null @@ -1,441 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cstdio> -#include <cmath> - -#include <gr_pfb_clock_sync_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps) -{ - return gnuradio::get_initial_sptr(new gr_pfb_clock_sync_ccf (sps, loop_bw, taps, - filter_size, - init_phase, - max_rate_deviation, - osps)); -} - -static int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -gr_pfb_clock_sync_ccf::gr_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps) - : gr_block ("pfb_clock_sync_ccf", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signaturev (1, 4, iosig)), - d_updated (false), d_nfilters(filter_size), - d_max_dev(max_rate_deviation), - d_osps(osps), d_error(0), d_out_idx(0) -{ - d_nfilters = filter_size; - d_sps = floor(sps); - - // Set the damping factor for a critically damped system - d_damping = sqrtf(2.0f)/2.0f; - - // Set the bandwidth, which will then call update_gains() - set_loop_bandwidth(loop_bw); - - // Store the last filter between calls to work - // The accumulator keeps track of overflow to increment the stride correctly. - // set it here to the fractional difference based on the initial phaes - d_k = init_phase; - d_rate = (sps-floor(sps))*(double)d_nfilters; - d_rate_i = (int)floor(d_rate); - d_rate_f = d_rate - (float)d_rate_i; - d_filtnum = (int)floor(d_k); - - d_filters = std::vector<gr_fir_ccf*>(d_nfilters); - d_diff_filters = std::vector<gr_fir_ccf*>(d_nfilters); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_nfilters); - for(int i = 0; i < d_nfilters; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - } - - // Now, actually set the filters' taps - std::vector<float> dtaps; - create_diff_taps(taps, dtaps); - set_taps(taps, d_taps, d_filters); - set_taps(dtaps, d_dtaps, d_diff_filters); -} - -gr_pfb_clock_sync_ccf::~gr_pfb_clock_sync_ccf () -{ - for(int i = 0; i < d_nfilters; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -bool -gr_pfb_clock_sync_ccf::check_topology(int ninputs, int noutputs) -{ - return noutputs == 1 || noutputs == 4; -} - - - -/******************************************************************* - SET FUNCTIONS -*******************************************************************/ - - -void -gr_pfb_clock_sync_ccf::set_loop_bandwidth(float bw) -{ - if(bw < 0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid bandwidth. Must be >= 0."); - } - - d_loop_bw = bw; - update_gains(); -} - -void -gr_pfb_clock_sync_ccf::set_damping_factor(float df) -{ - if(df < 0 || df > 1.0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid damping factor. Must be in [0,1]."); - } - - d_damping = df; - update_gains(); -} - -void -gr_pfb_clock_sync_ccf::set_alpha(float alpha) -{ - if(alpha < 0 || alpha > 1.0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid alpha. Must be in [0,1]."); - } - d_alpha = alpha; -} - -void -gr_pfb_clock_sync_ccf::set_beta(float beta) -{ - if(beta < 0 || beta > 1.0) { - throw std::out_of_range ("gr_pfb_clock_sync_cc: invalid beta. Must be in [0,1]."); - } - d_beta = beta; -} - -/******************************************************************* - GET FUNCTIONS -*******************************************************************/ - - -float -gr_pfb_clock_sync_ccf::get_loop_bandwidth() const -{ - return d_loop_bw; -} - -float -gr_pfb_clock_sync_ccf::get_damping_factor() const -{ - return d_damping; -} - -float -gr_pfb_clock_sync_ccf::get_alpha() const -{ - return d_alpha; -} - -float -gr_pfb_clock_sync_ccf::get_beta() const -{ - return d_beta; -} - -float -gr_pfb_clock_sync_ccf::get_clock_rate() const -{ - return d_rate_f; -} - -/******************************************************************* -*******************************************************************/ - -void -gr_pfb_clock_sync_ccf::update_gains() -{ - float denom = (1.0 + 2.0*d_damping*d_loop_bw + d_loop_bw*d_loop_bw); - d_alpha = (4*d_damping*d_loop_bw) / denom; - d_beta = (4*d_loop_bw*d_loop_bw) / denom; -} - - -void -gr_pfb_clock_sync_ccf::set_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter) -{ - int i,j; - - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_nfilters); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = newtaps; - while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_nfilters; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - //ourtaps[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0); - ourtaps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - //ourtaps[d_nfilters - 1 - i][j] = tmp_taps[i + j*d_nfilters]; - ourtaps[i][j] = tmp_taps[i + j*d_nfilters]; - } - - // Build a filter for each channel and add it's taps to it - //ourfilter[i]->set_taps(ourtaps[d_nfilters-1-i]); - ourfilter[i]->set_taps(ourtaps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + d_sps); - - // Make sure there is enough output space for d_osps outputs/input. - set_output_multiple(d_osps); - - d_updated = true; -} - -void -gr_pfb_clock_sync_ccf::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - std::vector<float> diff_filter(3); - diff_filter[0] = -1; - diff_filter[1] = 0; - diff_filter[2] = 1; - - float pwr = 0; - difftaps.push_back(0); - for(unsigned int i = 0; i < newtaps.size()-2; i++) { - float tap = 0; - for(int j = 0; j < 3; j++) { - tap += diff_filter[j]*newtaps[i+j]; - pwr += fabsf(tap); - } - difftaps.push_back(tap); - } - difftaps.push_back(0); - - for(unsigned int i = 0; i < difftaps.size(); i++) { - difftaps[i] *= pwr; - } -} - -std::string -gr_pfb_clock_sync_ccf::get_taps_as_string() -{ - int i, j; - std::stringstream str; - str.precision(4); - str.setf(std::ios::scientific); - - str << "[ "; - for(i = 0; i < d_nfilters; i++) { - str << "[" << d_taps[i][0] << ", "; - for(j = 1; j < d_taps_per_filter-1; j++) { - str << d_taps[i][j] << ", "; - } - str << d_taps[i][j] << "],"; - } - str << " ]" << std::endl; - - return str.str(); -} - -std::string -gr_pfb_clock_sync_ccf::get_diff_taps_as_string() -{ - int i, j; - std::stringstream str; - str.precision(4); - str.setf(std::ios::scientific); - - str << "[ "; - for(i = 0; i < d_nfilters; i++) { - str << "[" << d_dtaps[i][0] << ", "; - for(j = 1; j < d_taps_per_filter-1; j++) { - str << d_dtaps[i][j] << ", "; - } - str << d_dtaps[i][j] << "],"; - } - str << " ]" << std::endl; - - return str.str(); -} - -std::vector< std::vector<float> > -gr_pfb_clock_sync_ccf::get_taps() -{ - return d_taps; -} - -std::vector< std::vector<float> > -gr_pfb_clock_sync_ccf::get_diff_taps() -{ - return d_dtaps; -} - -std::vector<float> -gr_pfb_clock_sync_ccf::get_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_taps[channel][i]); - } - return taps; -} - -std::vector<float> -gr_pfb_clock_sync_ccf::get_diff_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_dtaps[channel][i]); - } - return taps; -} - - -int -gr_pfb_clock_sync_ccf::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - float *err = NULL, *outrate = NULL, *outk = NULL; - if(output_items.size() == 4) { - err = (float *) output_items[1]; - outrate = (float*)output_items[2]; - outk = (float*)output_items[3]; - } - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - // We need this many to process one output - int nrequired = ninput_items[0] - d_taps_per_filter - d_osps; - - int i = 0, count = 0; - float error_r, error_i; - - // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < nrequired)) { - while(d_out_idx < d_osps) { - d_filtnum = (int)floor(d_k); - - // Keep the current filter number in [0, d_nfilters] - // If we've run beyond the last filter, wrap around and go to next sample - // If we've go below 0, wrap around and go to previous sample - while(d_filtnum >= d_nfilters) { - d_k -= d_nfilters; - d_filtnum -= d_nfilters; - count += 1; - } - while(d_filtnum < 0) { - d_k += d_nfilters; - d_filtnum += d_nfilters; - count -= 1; - } - - out[i+d_out_idx] = d_filters[d_filtnum]->filter(&in[count+d_out_idx]); - d_k = d_k + d_rate_i + d_rate_f; // update phase - d_out_idx++; - - if(output_items.size() == 4) { - err[i] = d_error; - outrate[i] = d_rate_f; - outk[i] = d_k; - } - - // We've run out of output items we can create; return now. - if(i+d_out_idx >= noutput_items) { - consume_each(count); - return i; - } - } - - // reset here; if we didn't complete a full osps samples last time, - // the early return would take care of it. - d_out_idx = 0; - - // Update the phase and rate estimates for this symbol - gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]); - error_r = out[i].real() * diff.real(); - error_i = out[i].imag() * diff.imag(); - d_error = (error_i + error_r) / 2.0; // average error from I&Q channel - - // Run the control loop to update the current phase (k) and - // tracking rate estimates based on the error value - d_rate_f = d_rate_f + d_beta*d_error; - d_k = d_k + d_alpha*d_error; - - // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); - - i+=d_osps; - count += (int)floor(d_sps); - } - - consume_each(count); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h deleted file mode 100644 index 8715b4b106..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h +++ /dev/null @@ -1,375 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H -#define INCLUDED_GR_PFB_CLOCK_SYNC_CCF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_clock_sync_ccf; -typedef boost::shared_ptr<gr_pfb_clock_sync_ccf> gr_pfb_clock_sync_ccf_sptr; -GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5, - int osps=1); - -class gr_fir_ccf; - -/*! - * \class gr_pfb_clock_sync_ccf - * - * \brief Timing synchronizer using polyphase filterbanks - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block performs timing synchronization for PAM signals by - * minimizing the derivative of the filtered signal, which in turn - * maximizes the SNR and minimizes ISI. - * - * This approach works by setting up two filterbanks; one filterbank - * contains the signal's pulse shaping matched filter (such as a root - * raised cosine filter), where each branch of the filterbank contains - * a different phase of the filter. The second filterbank contains - * the derivatives of the filters in the first filterbank. Thinking of - * this in the time domain, the first filterbank contains filters that - * have a sinc shape to them. We want to align the output signal to be - * sampled at exactly the peak of the sinc shape. The derivative of - * the sinc contains a zero at the maximum point of the sinc (sinc(0) - * = 1, sinc(0)' = 0). Furthermore, the region around the zero point - * is relatively linear. We make use of this fact to generate the - * error signal. - * - * If the signal out of the derivative filters is d_i[n] for the ith - * filter, and the output of the matched filter is x_i[n], we - * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} + - * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in - * the real and imaginary parts. There are two reasons we multiply by - * the signal itself. First, if the symbol could be positive or - * negative going, but we want the error term to always tell us to go - * in the same direction depending on which side of the zero point we - * are on. The sign of x_i[n] adjusts the error term to do - * this. Second, the magnitude of x_i[n] scales the error term - * depending on the symbol's amplitude, so larger signals give us a - * stronger error term because we have more confidence in that - * symbol's value. Using the magnitude of x_i[n] instead of just the - * sign is especially good for signals with low SNR. - * - * The error signal, e[n], gives us a value proportional to how far - * away from the zero point we are in the derivative signal. We want - * to drive this value to zero, so we set up a second order loop. We - * have two variables for this loop; d_k is the filter number in the - * filterbank we are on and d_rate is the rate which we travel through - * the filters in the steady state. That is, due to the natural clock - * differences between the transmitter and receiver, d_rate represents - * that difference and would traverse the filter phase paths to keep - * the receiver locked. Thinking of this as a second-order PLL, the - * d_rate is the frequency and d_k is the phase. So we update d_rate - * and d_k using the standard loop equations based on two error - * signals, d_alpha and d_beta. We have these two values set based on - * each other for a critically damped system, so in the block - * constructor, we just ask for "gain," which is d_alpha while d_beta - * is equal to (gain^2)/4. - * - * The block's parameters are: - * - * \li \p sps: The clock sync block needs to know the number of samples per - * symbol, because it defaults to return a single point representing - * the symbol. The sps can be any positive real number and does not - * need to be an integer. - * - * \li \p loop_bw: The loop bandwidth is used to set the gain of the - * inner control loop (see: - * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html). - * This should be set small (a value of around 2pi/100 is suggested in - * that blog post as the step size for the number of radians around - * the unit circle to move relative to the error). - * - * \li \p taps: One of the most important parameters for this block is - * the taps of the filter. One of the benefits of this algorithm is - * that you can put the matched filter in here as the taps, so you get - * both the matched filter and sample timing correction in one go. So - * create your normal matched filter. For a typical digital - * modulation, this is a root raised cosine filter. The number of taps - * of this filter is based on how long you expect the channel to be; - * that is, how many symbols do you want to combine to get the current - * symbols energy back (there's probably a better way of stating - * that). It's usually 5 to 10 or so. That gives you your filter, but - * now we need to think about it as a filter with different phase - * profiles in each filter. So take this number of taps and multiply - * it by the number of filters. This is the number you would use to - * create your prototype filter. When you use this in the PFB - * filerbank, it segments these taps into the filterbanks in such a - * way that each bank now represents the filter at different phases, - * equally spaced at 2pi/N, where N is the number of filters. - * - * \li \p filter_size (default=32): The number of filters can also be - * set and defaults to 32. With 32 filters, you get a good enough - * resolution in the phase to produce very small, almost unnoticeable, - * ISI. Going to 64 filters can reduce this more, but after that - * there is very little gained for the extra complexity. - * - * \li \p init_phase (default=0): The initial phase is another - * settable parameter and refers to the filter path the algorithm - * initially looks at (i.e., d_k starts at init_phase). This value - * defaults to zero, but it might be useful to start at a different - * phase offset, such as the mid-point of the filters. - * - * \li \p max_rate_deviation (default=1.5): The next parameter is the - * max_rate_devitation, which defaults to 1.5. This is how far we - * allow d_rate to swing, positive or negative, from 0. Constraining - * the rate can help keep the algorithm from walking too far away to - * lock during times when there is no signal. - * - * \li \p osps (default=1): The osps is the number of output samples per symbol. By default, - * the algorithm produces 1 sample per symbol, sampled at the exact - * sample value. This osps value was added to better work with - * equalizers, which do a better job of modeling the channel if they - * have 2 samps/sym. - */ - -class GR_CORE_API gr_pfb_clock_sync_ccf : public gr_block -{ - private: - /*! - * Build the polyphase filterbank timing synchronizer. - * \param sps (double) The number of samples per symbol in the incoming signal - * \param loop_bw (float) The bandwidth of the control loop; set's alpha and beta. - * \param taps (vector<int>) The filter taps. - * \param filter_size (uint) The number of filters in the filterbank (default = 32). - * \param init_phase (float) The initial phase to look at, or which filter to start - * with (default = 0). - * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). - * \param osps (int) The number of output samples per symbol (default=1). - * - */ - - friend GR_CORE_API gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - bool d_updated; - double d_sps; - double d_sample_num; - float d_loop_bw; - float d_damping; - float d_alpha; - float d_beta; - - int d_nfilters; - int d_taps_per_filter; - std::vector<gr_fir_ccf*> d_filters; - std::vector<gr_fir_ccf*> d_diff_filters; - std::vector< std::vector<float> > d_taps; - std::vector< std::vector<float> > d_dtaps; - - float d_k; - float d_rate; - float d_rate_i; - float d_rate_f; - float d_max_dev; - int d_filtnum; - int d_osps; - float d_error; - int d_out_idx; - - /*! - * Build the polyphase filterbank timing synchronizer. - */ - gr_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - -public: - ~gr_pfb_clock_sync_ccf (); - - /*! \brief update the system gains from omega and eta - * - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. - * These two factors can be set separately through their own - * set functions. - */ - void update_gains(); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - */ - void set_taps (const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter); - - /*! - * Returns all of the taps of the matched filter - */ - std::vector< std::vector<float> > get_taps(); - - /*! - * Returns all of the taps of the derivative filter - */ - std::vector< std::vector<float> > get_diff_taps(); - - /*! - * Returns the taps of the matched filter for a particular channel - */ - std::vector<float> get_channel_taps(int channel); - - /*! - * Returns the taps in the derivative filter for a particular channel - */ - std::vector<float> get_diff_channel_taps(int channel); - - /*! - * Return the taps as a formatted string for printing - */ - std::string get_taps_as_string(); - - /*! - * Return the derivative filter taps as a formatted string for printing - */ - std::string get_diff_taps_as_string(); - - - /******************************************************************* - SET FUNCTIONS - *******************************************************************/ - - - /*! - * \brief Set the loop bandwidth - * - * Set the loop filter's bandwidth to \p bw. This should be between - * 2*pi/200 and 2*pi/100 (in rads/samp). It must also be a positive - * number. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param bw (float) new bandwidth - * - */ - void set_loop_bandwidth(float bw); - - /*! - * \brief Set the loop damping factor - * - * Set the loop filter's damping factor to \p df. The damping factor - * should be sqrt(2)/2.0 for critically damped systems. - * Set it to anything else only if you know what you are doing. It must - * be a number between 0 and 1. - * - * When a new damping factor is set, the gains, alpha and beta, of the loop - * are recalculated by a call to update_gains(). - * - * \param df (float) new damping factor - * - */ - void set_damping_factor(float df); - - /*! - * \brief Set the loop gain alpha - * - * Set's the loop filter's alpha gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param alpha (float) new alpha gain - * - */ - void set_alpha(float alpha); - - /*! - * \brief Set the loop gain beta - * - * Set's the loop filter's beta gain parameter. - * - * This value should really only be set by adjusting the loop bandwidth - * and damping factor. - * - * \param beta (float) new beta gain - * - */ - void set_beta(float beta); - - /*! - * Set the maximum deviation from 0 d_rate can have - */ - void set_max_rate_deviation(float m) - { - d_max_dev = m; - } - - /******************************************************************* - GET FUNCTIONS - *******************************************************************/ - - /*! - * \brief Returns the loop bandwidth - */ - float get_loop_bandwidth() const; - - /*! - * \brief Returns the loop damping factor - */ - float get_damping_factor() const; - - /*! - * \brief Returns the loop gain alpha - */ - float get_alpha() const; - - /*! - * \brief Returns the loop gain beta - */ - float get_beta() const; - - /*! - * \brief Returns the current clock rate - */ - float get_clock_rate() const; - - /******************************************************************* - *******************************************************************/ - - bool check_topology(int ninputs, int noutputs); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i deleted file mode 100644 index 85915196f8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_clock_sync_ccf); - -gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5, - int osps=1); - -class gr_pfb_clock_sync_ccf : public gr_block -{ - private: - gr_pfb_clock_sync_ccf (double sps, float loop_bw, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation, - int osps); - - public: - ~gr_pfb_clock_sync_ccf (); - - void set_taps (const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_ccf*> &ourfilter); - - std::vector< std::vector<float> > get_taps(); - std::vector< std::vector<float> > get_diff_taps(); - std::vector<float> get_channel_taps(int channel); - std::vector<float> get_diff_channel_taps(int channel); - std::string get_taps_as_string(); - std::string get_diff_taps_as_string(); - - void set_loop_bandwidth(float bw); - void set_damping_factor(float df); - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_rate_deviation(float m); - - float get_loop_bandwidth() const; - float get_damping_factor() const; - float get_alpha() const; - float get_beta() const; - float get_clock_rate() const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc deleted file mode 100644 index 886f989130..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.cc +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cstdio> -#include <cmath> - -#include <gr_pfb_clock_sync_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation) -{ - return gnuradio::get_initial_sptr(new gr_pfb_clock_sync_fff (sps, gain, taps, - filter_size, - init_phase, - max_rate_deviation)); -} - -static int ios[] = {sizeof(float), sizeof(float), sizeof(float), sizeof(float)}; -static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); -gr_pfb_clock_sync_fff::gr_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation) - : gr_block ("pfb_clock_sync_fff", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signaturev (1, 4, iosig)), - d_updated (false), d_nfilters(filter_size), - d_max_dev(max_rate_deviation) -{ - d_nfilters = filter_size; - d_sps = floor(sps); - - // Store the last filter between calls to work - // The accumulator keeps track of overflow to increment the stride correctly. - // set it here to the fractional difference based on the initial phaes - set_alpha(gain); - set_beta(0.25*gain*gain); - d_k = init_phase; - d_rate = (sps-floor(sps))*(double)d_nfilters; - d_rate_i = (int)floor(d_rate); - d_rate_f = d_rate - (float)d_rate_i; - d_filtnum = (int)floor(d_k); - - d_filters = std::vector<gr_fir_fff*>(d_nfilters); - d_diff_filters = std::vector<gr_fir_fff*>(d_nfilters); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_nfilters); - for(int i = 0; i < d_nfilters; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps); - d_diff_filters[i] = gr_fir_util::create_gr_fir_fff(vtaps); - } - - // Now, actually set the filters' taps - std::vector<float> dtaps; - create_diff_taps(taps, dtaps); - set_taps(taps, d_taps, d_filters); - set_taps(dtaps, d_dtaps, d_diff_filters); -} - -gr_pfb_clock_sync_fff::~gr_pfb_clock_sync_fff () -{ - for(int i = 0; i < d_nfilters; i++) { - delete d_filters[i]; - delete d_diff_filters[i]; - } -} - -bool -gr_pfb_clock_sync_fff::check_topology(int ninputs, int noutputs) -{ - return noutputs == 1 || noutputs == 4; -} - -void -gr_pfb_clock_sync_fff::set_taps (const std::vector<float> &newtaps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter) -{ - int i,j; - - unsigned int ntaps = newtaps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters); - - // Create d_numchan vectors to store each channel's taps - ourtaps.resize(d_nfilters); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = newtaps; - while((float)(tmp_taps.size()) < d_nfilters*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_nfilters; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - ourtaps[d_nfilters - 1 - i][j] = tmp_taps[i + j*d_nfilters]; - } - - // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[d_nfilters-1-i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter + d_sps); - - d_updated = true; -} - -void -gr_pfb_clock_sync_fff::create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps) -{ - float maxtap = 1e-20; - difftaps.clear(); - difftaps.push_back(0); //newtaps[0]); - for(unsigned int i = 1; i < newtaps.size()-1; i++) { - float tap = newtaps[i+1] - newtaps[i-1]; - difftaps.push_back(tap); - if(tap > maxtap) { - maxtap = tap; - } - } - difftaps.push_back(0);//-newtaps[newtaps.size()-1]); - - // Scale the differential taps; helps scale error term to better update state - // FIXME: should this be scaled this way or use the same gain as the taps? - for(unsigned int i = 0; i < difftaps.size(); i++) { - difftaps[i] /= maxtap; - } -} - -void -gr_pfb_clock_sync_fff::print_taps() -{ - int i, j; - printf("[ "); - for(i = 0; i < d_nfilters; i++) { - printf("[%.4e, ", d_taps[i][0]); - for(j = 1; j < d_taps_per_filter-1; j++) { - printf("%.4e,", d_taps[i][j]); - } - printf("%.4e],", d_taps[i][j]); - } - printf(" ]\n"); -} - -void -gr_pfb_clock_sync_fff::print_diff_taps() -{ - int i, j; - printf("[ "); - for(i = 0; i < d_nfilters; i++) { - printf("[%.4e, ", d_dtaps[i][0]); - for(j = 1; j < d_taps_per_filter-1; j++) { - printf("%.4e,", d_dtaps[i][j]); - } - printf("%.4e],", d_dtaps[i][j]); - } - printf(" ]\n"); -} - - -std::vector<float> -gr_pfb_clock_sync_fff::channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_taps[channel][i]); - } - return taps; -} - -std::vector<float> -gr_pfb_clock_sync_fff::diff_channel_taps(int channel) -{ - std::vector<float> taps; - for(int i = 0; i < d_taps_per_filter; i++) { - taps.push_back(d_dtaps[channel][i]); - } - return taps; -} - - -int -gr_pfb_clock_sync_fff::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *in = (float *) input_items[0]; - float *out = (float *) output_items[0]; - - float *err = 0, *outrate = 0, *outk = 0; - if(output_items.size() == 4) { - err = (float *) output_items[1]; - outrate = (float*)output_items[2]; - outk = (float*)output_items[3]; - } - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - // We need this many to process one output - int nrequired = ninput_items[0] - d_taps_per_filter; - - int i = 0, count = 0; - float error; - - // produce output as long as we can and there are enough input samples - while((i < noutput_items) && (count < nrequired)) { - d_filtnum = (int)floor(d_k); - - // Keep the current filter number in [0, d_nfilters] - // If we've run beyond the last filter, wrap around and go to next sample - // If we've go below 0, wrap around and go to previous sample - while(d_filtnum >= d_nfilters) { - d_k -= d_nfilters; - d_filtnum -= d_nfilters; - count += 1; - } - while(d_filtnum < 0) { - d_k += d_nfilters; - d_filtnum += d_nfilters; - count -= 1; - } - - out[i] = d_filters[d_filtnum]->filter(&in[count]); - float diff = d_diff_filters[d_filtnum]->filter(&in[count]); - error = out[i] * diff; - - // Run the control loop to update the current phase (k) and tracking rate - d_k = d_k + d_alpha*error + d_rate_i + d_rate_f; - d_rate_f = d_rate_f + d_beta*error; - - // Keep our rate within a good range - d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); - - i++; - count += (int)floor(d_sps); - - if(output_items.size() == 4) { - err[i] = error; - outrate[i] = d_rate_f; - outk[i] = d_k; - } - } - consume_each(count); - - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h deleted file mode 100644 index 4909d556b9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.h +++ /dev/null @@ -1,266 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H -#define INCLUDED_GR_PFB_CLOCK_SYNC_FFF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_pfb_clock_sync_fff; -typedef boost::shared_ptr<gr_pfb_clock_sync_fff> gr_pfb_clock_sync_fff_sptr; -GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5); - -class gr_fir_fff; - -/*! - * \class gr_pfb_clock_sync_fff - * - * \brief Timing synchronizer using polyphase filterbanks - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block performs timing synchronization for PAM signals by - * minimizing the derivative of the filtered signal, which in turn - * maximizes the SNR and minimizes ISI. - * - * This approach works by setting up two filterbanks; one filterbank - * contains the signal's pulse shaping matched filter (such as a root - * raised cosine filter), where each branch of the filterbank contains - * a different phase of the filter. The second filterbank contains - * the derivatives of the filters in the first filterbank. Thinking of - * this in the time domain, the first filterbank contains filters that - * have a sinc shape to them. We want to align the output signal to be - * sampled at exactly the peak of the sinc shape. The derivative of - * the sinc contains a zero at the maximum point of the sinc (sinc(0) - * = 1, sinc(0)' = 0). Furthermore, the region around the zero point - * is relatively linear. We make use of this fact to generate the - * error signal. - * - * If the signal out of the derivative filters is d_i[n] for the ith - * filter, and the output of the matched filter is x_i[n], we - * calculate the error as: e[n] = (Re{x_i[n]} * Re{d_i[n]} + - * Im{x_i[n]} * Im{d_i[n]}) / 2.0 This equation averages the error in - * the real and imaginary parts. There are two reasons we multiply by - * the signal itself. First, if the symbol could be positive or - * negative going, but we want the error term to always tell us to go - * in the same direction depending on which side of the zero point we - * are on. The sign of x_i[n] adjusts the error term to do - * this. Second, the magnitude of x_i[n] scales the error term - * depending on the symbol's amplitude, so larger signals give us a - * stronger error term because we have more confidence in that - * symbol's value. Using the magnitude of x_i[n] instead of just the - * sign is especially good for signals with low SNR. - * - * The error signal, e[n], gives us a value proportional to how far - * away from the zero point we are in the derivative signal. We want - * to drive this value to zero, so we set up a second order loop. We - * have two variables for this loop; d_k is the filter number in the - * filterbank we are on and d_rate is the rate which we travel through - * the filters in the steady state. That is, due to the natural clock - * differences between the transmitter and receiver, d_rate represents - * that difference and would traverse the filter phase paths to keep - * the receiver locked. Thinking of this as a second-order PLL, the - * d_rate is the frequency and d_k is the phase. So we update d_rate - * and d_k using the standard loop equations based on two error - * signals, d_alpha and d_beta. We have these two values set based on - * each other for a critically damped system, so in the block - * constructor, we just ask for "gain," which is d_alpha while d_beta - * is equal to (gain^2)/4. - * - * The block's parameters are: - * - * \li \p sps: The clock sync block needs to know the number of samples per - * symbol, because it defaults to return a single point representing - * the symbol. The sps can be any positive real number and does not - * need to be an integer. - * - * \li \p loop_bw: The loop bandwidth is used to set the gain of the - * inner control loop (see: - * http://gnuradio.squarespace.com/blog/2011/8/13/control-loop-gain-values.html). - * This should be set small (a value of around 2pi/100 is suggested in - * that blog post as the step size for the number of radians around - * the unit circle to move relative to the error). - * - * \li \p taps: One of the most important parameters for this block is - * the taps of the filter. One of the benefits of this algorithm is - * that you can put the matched filter in here as the taps, so you get - * both the matched filter and sample timing correction in one go. So - * create your normal matched filter. For a typical digital - * modulation, this is a root raised cosine filter. The number of taps - * of this filter is based on how long you expect the channel to be; - * that is, how many symbols do you want to combine to get the current - * symbols energy back (there's probably a better way of stating - * that). It's usually 5 to 10 or so. That gives you your filter, but - * now we need to think about it as a filter with different phase - * profiles in each filter. So take this number of taps and multiply - * it by the number of filters. This is the number you would use to - * create your prototype filter. When you use this in the PFB - * filerbank, it segments these taps into the filterbanks in such a - * way that each bank now represents the filter at different phases, - * equally spaced at 2pi/N, where N is the number of filters. - * - * \li \p filter_size (default=32): The number of filters can also be - * set and defaults to 32. With 32 filters, you get a good enough - * resolution in the phase to produce very small, almost unnoticeable, - * ISI. Going to 64 filters can reduce this more, but after that - * there is very little gained for the extra complexity. - * - * \li \p init_phase (default=0): The initial phase is another - * settable parameter and refers to the filter path the algorithm - * initially looks at (i.e., d_k starts at init_phase). This value - * defaults to zero, but it might be useful to start at a different - * phase offset, such as the mid-point of the filters. - * - * \li \p max_rate_deviation (default=1.5): The next parameter is the - * max_rate_devitation, which defaults to 1.5. This is how far we - * allow d_rate to swing, positive or negative, from 0. Constraining - * the rate can help keep the algorithm from walking too far away to - * lock during times when there is no signal. - * - * \li \p osps: note that unlike the ccf version of this algorithm, - * this block does \a not have a setting for the number of output - * samples per symbol. This is mostly because it should not be - * necessary as the reason for having multiple output sps is to - * perform equalization and the equalizers will take in complex - * numbers in order to do magnitude and phase correction. - */ - -class GR_CORE_API gr_pfb_clock_sync_fff : public gr_block -{ - private: - /*! - * Build the polyphase filterbank timing synchronizer. - * \param sps (double) The number of samples per second in the incoming signal - * \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default. - * \param taps (vector<int>) The filter taps. - * \param filter_size (uint) The number of filters in the filterbank (default = 32). - * \param init_phase (float) The initial phase to look at, or which filter to start - * with (default = 0). - * \param max_rate_deviation (float) Distance from 0 d_rate can get (default = 1.5). - * - */ - friend GR_CORE_API gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation); - - bool d_updated; - double d_sps; - double d_sample_num; - float d_alpha; - float d_beta; - int d_nfilters; - std::vector<gr_fir_fff*> d_filters; - std::vector<gr_fir_fff*> d_diff_filters; - std::vector< std::vector<float> > d_taps; - std::vector< std::vector<float> > d_dtaps; - float d_k; - float d_rate; - float d_rate_i; - float d_rate_f; - float d_max_dev; - int d_filtnum; - int d_taps_per_filter; - - /*! - * Build the polyphase filterbank timing synchronizer. - */ - gr_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation); - - void create_diff_taps(const std::vector<float> &newtaps, - std::vector<float> &difftaps); - -public: - ~gr_pfb_clock_sync_fff (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - */ - void set_taps (const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - /*! - * Returns the taps of the matched filter - */ - std::vector<float> channel_taps(int channel); - - /*! - * Returns the taps in the derivative filter - */ - std::vector<float> diff_channel_taps(int channel); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - /*! - * Print all of the filterbank taps of the derivative filter to screen. - */ - void print_diff_taps(); - - /*! - * Set the gain value alpha for the control loop - */ - void set_alpha(float alpha) - { - d_alpha = alpha; - } - - /*! - * Set the gain value beta for the control loop - */ - void set_beta(float beta) - { - d_beta = beta; - } - - /*! - * Set the maximum deviation from 0 d_rate can have - */ - void set_max_rate_deviation(float m) - { - d_max_dev = m; - } - - bool check_topology(int ninputs, int noutputs); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i deleted file mode 100644 index 754af1a87f..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_fff.i +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_clock_sync_fff); - -gr_pfb_clock_sync_fff_sptr gr_make_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0, - float max_rate_deviation=1.5); - -class gr_pfb_clock_sync_fff : public gr_block -{ - private: - gr_pfb_clock_sync_fff (double sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size, - float init_phase, - float max_rate_deviation); - - public: - ~gr_pfb_clock_sync_fff (); - - void set_taps (const std::vector<float> &taps, - std::vector< std::vector<float> > &ourtaps, - std::vector<gr_fir_fff*> &ourfilter); - - std::vector<float> channel_taps(int channel); - std::vector<float> diff_channel_taps(int channel); - void print_taps(); - void print_diff_taps(); - void set_alpha(float alpha); - void set_beta(float beta); - void set_max_rate_deviation(float m); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc deleted file mode 100644 index e563daa513..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_decimator_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <cstdio> - -gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel) -{ - return gnuradio::get_initial_sptr(new gr_pfb_decimator_ccf (decim, taps, channel)); -} - - -gr_pfb_decimator_ccf::gr_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel) - : gr_sync_block ("pfb_decimator_ccf", - gr_make_io_signature (decim, decim, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex))), - d_updated (false) -{ - d_rate = decim; - d_filters = std::vector<gr_fir_ccf*>(d_rate); - d_chan = channel; - d_rotator = new gr_complex[d_rate]; - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_rate); - for(unsigned int i = 0; i < d_rate; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - d_rotator[i] = gr_expj(i*2*M_PI*d_chan/d_rate); - } - - // Now, actually set the filters' taps - set_taps(taps); - - // Create the FFT to handle the output de-spinning of the channels - d_fft = new gri_fft_complex (d_rate, false); -} - -gr_pfb_decimator_ccf::~gr_pfb_decimator_ccf () -{ - delete d_fft; - for(unsigned int i = 0; i < d_rate; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_decimator_ccf::set_taps (const std::vector<float> &taps) -{ - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_rate); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = taps; - while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_rate]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter); - - d_updated = true; -} - -void -gr_pfb_decimator_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - -#define ROTATEFFT - -int -gr_pfb_decimator_ccf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i; - for(i = 0; i < noutput_items; i++) { - // Move through filters from bottom to top - out[i] = 0; - for(int j = d_rate-1; j >= 0; j--) { - // Take in the items from the first input stream to d_rate - in = (gr_complex*)input_items[d_rate - 1 - j]; - - // Filter current input stream from bottom filter to top - // The rotate them by expj(j*k*2pi/M) where M is the number of filters - // (the decimation rate) and k is the channel number to extract - - // This is the real math that goes on; we abuse the FFT to do this quickly - // for decimation rates > N where N is a small number (~5): - // out[i] += d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate); -#ifdef ROTATEFFT - d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]); -#else - out[i] += d_filters[j]->filter(&in[i])*d_rotator[i]; -#endif - } - -#ifdef ROTATEFFT - // Perform the FFT to do the complex multiply despinning for all channels - d_fft->execute(); - - // Select only the desired channel out - out[i] = d_fft->get_outbuf()[d_chan]; -#endif - - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h deleted file mode 100644 index a2b347ae24..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_DECIMATOR_CCF_H -#define INCLUDED_GR_PFB_DECIMATOR_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_pfb_decimator_ccf; -typedef boost::shared_ptr<gr_pfb_decimator_ccf> gr_pfb_decimator_ccf_sptr; -GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel=0); - -class gr_fir_ccf; -class gri_fft_complex; - -/*! - * \class gr_pfb_decimator_ccf - * \brief Polyphase filterbank bandpass decimator with gr_complex - * input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs interger down- - * sampling (decimation) with a polyphase filterbank. The first input - * is the integer specifying how much to decimate by. The second - * input is a vector (Python list) of floating-point taps of the - * prototype filter. The third input specifies the channel to extract. - * By default, the zeroth channel is used, which is the baseband - * channel (first Nyquist zone). - * - * The <EM>channel</EM> parameter specifies which channel to use since - * this class is capable of bandpass decimation. Given a complex input - * stream at a sampling rate of <EM>fs</EM> and a decimation rate of - * <EM>decim</EM>, the input frequency domain is split into - * <EM>decim</EM> channels that represent the Nyquist zones. Using the - * polyphase filterbank, we can select any one of these channels to - * decimate. - * - * The output signal will be the basebanded and decimated signal from - * that channel. This concept is very similar to the PFB channelizer - * (see #gr_pfb_channelizer_ccf) where only a single channel is - * extracted at a time. - * - * The filter's taps should be based on the sampling rate before - * decimation. - * - * For example, using the GNU Radio's firdes utility to building - * filters, we build a low-pass filter with a sampling rate of - * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition - * bandwidth of <EM>TB</EM>. We can also specify the out-of-band - * attenuation to use, <EM>ATT</EM>, and the filter window - * function (a Blackman-harris window in this case). The first input - * is the gain of the filter, which we specify here as unity. - * - * <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The PFB decimator code takes the taps generated above and builds a - * set of filters. The set contains <EM>decim</EM> number of filters - * and each filter contains ceil(taps.size()/decim) number of taps. - * Each tap from the filter prototype is sequentially inserted into - * the next filter. When all of the input taps are used, the remaining - * filters in the filterbank are filled out with 0's to make sure each - * filter has the same number of taps. - * - * The theory behind this block can be found in Chapter 6 of - * the following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_decimator_ccf : public gr_sync_block -{ - private: - /*! - * Build the polyphase filterbank decimator. - * \param decim (unsigned integer) Specifies the decimation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param channel (unsigned integer) Selects the channel to return [default=0]. - */ - friend GR_CORE_API gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - - std::vector<gr_fir_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - gri_fft_complex *d_fft; - unsigned int d_rate; - unsigned int d_chan; - unsigned int d_taps_per_filter; - bool d_updated; - gr_complex *d_rotator; - - /*! - * Build the polyphase filterbank decimator. - * \param decim (unsigned integer) Specifies the decimation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - * \param channel (unsigned integer) Selects the channel to return [default=0]. - */ - gr_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - -public: - ~gr_pfb_decimator_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - //void set_channel (unsigned int channel); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i deleted file mode 100644 index e40d00fa9d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_decimator_ccf); - -gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - -class gr_pfb_decimator_ccf : public gr_sync_block -{ - private: - gr_pfb_decimator_ccf (unsigned int decim, - const std::vector<float> &taps, - unsigned int channel); - - public: - ~gr_pfb_decimator_ccf (); - - void set_taps (const std::vector<float> &taps); - //void set_channel (unsigned int channel); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc deleted file mode 100644 index 9c8e734ea9..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_interpolator_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps) -{ - return gnuradio::get_initial_sptr(new gr_pfb_interpolator_ccf (interp, taps)); -} - - -gr_pfb_interpolator_ccf::gr_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps) - : gr_sync_interpolator ("pfb_interpolator_ccf", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - interp), - d_updated (false) -{ - d_rate = interp; - d_filters = std::vector<gr_fir_ccf*>(d_rate); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_rate); - for(unsigned int i = 0; i < d_rate; i++) { - d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); - } - - // Now, actually set the filters' taps - set_taps(taps); -} - -gr_pfb_interpolator_ccf::~gr_pfb_interpolator_ccf () -{ - for(unsigned int i = 0; i < d_rate; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_interpolator_ccf::set_taps (const std::vector<float> &taps) -{ - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate); - - // Create d_numchan vectors to store each channel's taps - //std::vector< std::vector<float> > vtaps(d_rate); - d_taps.resize(d_rate); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = taps; - while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_rate; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_rate]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter); - - d_updated = true; -} - -void -gr_pfb_interpolator_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_rate; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - -int -gr_pfb_interpolator_ccf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - int i = 0, count = 0; - - while(i < noutput_items) { - for(unsigned int j = 0; j < d_rate; j++) { - out[i] = d_filters[j]->filter(&in[count]); - i++; - } - count++; - } - - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h deleted file mode 100644 index aeae86e408..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_INTERPOLATOR_CCF_H -#define INCLUDED_GR_PFB_INTERPOLATOR_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_pfb_interpolator_ccf; -typedef boost::shared_ptr<gr_pfb_interpolator_ccf> gr_pfb_interpolator_ccf_sptr; -GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - -class gr_fir_ccf; - -/*! - * \class gr_pfb_interpolator_ccf - * \brief Polyphase filterbank interpolator with gr_complex input, - * gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - * - * This block takes in a signal stream and performs interger up- - * sampling (interpolation) with a polyphase filterbank. The first - * input is the integer specifying how much to interpolate by. The - * second input is a vector (Python list) of floating-point taps of - * the prototype filter. - * - * The filter's taps should be based on the interpolation rate - * specified. That is, the bandwidth specified is relative to the - * bandwidth after interpolation. - * - * For example, using the GNU Radio's firdes utility to building - * filters, we build a low-pass filter with a sampling rate of - * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition - * bandwidth of <EM>TB</EM>. We can also specify the out-of-band - * attenuation to use, ATT, and the filter window function (a - * Blackman-harris window in this case). The first input is the gain, - * which is also specified as the interpolation rate so that the - * output levels are the same as the input (this creates an overall - * increase in power). - * - * <B><EM>self._taps = gr.firdes.low_pass_2(interp, interp*fs, BW, TB, - * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B> - * - * The PFB interpolator code takes the taps generated above and builds - * a set of filters. The set contains <EM>interp</EM> number of - * filters and each filter contains ceil(taps.size()/interp) number of - * taps. Each tap from the filter prototype is sequentially inserted - * into the next filter. When all of the input taps are used, the - * remaining filters in the filterbank are filled out with 0's to make - * sure each filter has the same number of taps. - * - * The theory behind this block can be found in Chapter 7.1 of the - * following book. - * - * <B><EM>f. harris, "Multirate Signal Processing for Communication - * Systems</EM>," Upper Saddle River, NJ: Prentice Hall, - * Inc. 2004.</EM></B> - */ - -class GR_CORE_API gr_pfb_interpolator_ccf : public gr_sync_interpolator -{ - private: - /*! - * Build the polyphase filterbank interpolator. - * \param interp (unsigned integer) Specifies the interpolation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the interpolated sampling rate. - */ - friend GR_CORE_API gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - - std::vector<gr_fir_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - unsigned int d_rate; - unsigned int d_taps_per_filter; - bool d_updated; - - /*! - * Construct a Polyphase filterbank interpolator - * \param interp (unsigned integer) Specifies the interpolation rate to use - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the interpolated sampling rate. - */ - gr_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - -public: - ~gr_pfb_interpolator_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps - * should be generated at the interpolated sampling rate. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i deleted file mode 100644 index 427f1b913d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_interpolator_ccf); - -gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - -class gr_pfb_interpolator_ccf : public gr_sync_interpolator -{ - private: - gr_pfb_interpolator_ccf (unsigned int interp, - const std::vector<float> &taps); - - public: - ~gr_pfb_interpolator_ccf (); - - void set_taps (const std::vector<float> &taps); - void print_taps(); -}; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc deleted file mode 100644 index cd01aaff5c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.cc +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_pfb_synthesizer_ccf.h> -#include <gri_fft.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <cstring> - -gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox) -{ - return gr_pfb_synthesizer_ccf_sptr - (new gr_pfb_synthesizer_ccf (numchans, taps, twox)); -} - - -gr_pfb_synthesizer_ccf::gr_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox) - : gr_sync_interpolator ("pfb_synthesizer_ccf", - gr_make_io_signature (1, numchans, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - numchans), - d_updated (false), d_numchans(numchans), d_state(0) -{ - // set up 2x multiplier; if twox==True, set to 2, otherwise to 1 - d_twox = (twox ? 2 : 1); - if(d_numchans % d_twox != 0) { - throw std::invalid_argument("gr_pfb_synthesizer_ccf: number of channels must be even for 2x oversampling.\n"); - } - - d_filters = std::vector<gri_fir_filter_with_buffer_ccf*>(d_twox*d_numchans); - d_channel_map.resize(d_twox*d_numchans); - - // Create an FIR filter for each channel and zero out the taps - std::vector<float> vtaps(0, d_twox*d_numchans); - for(unsigned int i = 0; i < d_twox*d_numchans; i++) { - d_filters[i] = new gri_fir_filter_with_buffer_ccf(vtaps); - d_channel_map[i] = i; - } - - // Now, actually set the filters' taps - set_taps(taps); - - // Create the IFFT to handle the input channel rotations - d_fft = new gri_fft_complex (d_twox*d_numchans, false); - memset(d_fft->get_inbuf(), 0, d_twox*d_numchans*sizeof(gr_complex)); - - set_output_multiple(d_numchans); -} - -gr_pfb_synthesizer_ccf::~gr_pfb_synthesizer_ccf () -{ - delete d_fft; - for(unsigned int i = 0; i < d_twox*d_numchans; i++) { - delete d_filters[i]; - } -} - -void -gr_pfb_synthesizer_ccf::set_taps(const std::vector<float> &taps) -{ - gruel::scoped_lock guard(d_mutex); - if(d_twox == 1) - set_taps1(taps); - else - set_taps2(taps); -} - -void -gr_pfb_synthesizer_ccf::set_taps1(const std::vector<float> &taps) -{ - unsigned int i,j; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_numchans); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = taps; - while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_numchans; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - for(j = 0; j < d_taps_per_filter; j++) { - d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter+1); - - d_updated = true; -} - -void -gr_pfb_synthesizer_ccf::set_taps2 (const std::vector<float> &taps) -{ - unsigned int i,j; - int state = 0; - - unsigned int ntaps = taps.size(); - d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans); - - // Create d_numchan vectors to store each channel's taps - d_taps.resize(d_twox*d_numchans); - - // Make a vector of the taps plus fill it out with 0's to fill - // each polyphase filter with exactly d_taps_per_filter - std::vector<float> tmp_taps; - tmp_taps = taps; - while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) { - tmp_taps.push_back(0.0); - } - - // Partition the filter - for(i = 0; i < d_numchans; i++) { - // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - d_taps[i] = std::vector<float>(d_taps_per_filter, 0); - d_taps[d_numchans+i] = std::vector<float>(d_taps_per_filter, 0); - state = 0; - for(j = 0; j < d_taps_per_filter; j++) { - // add taps to channels in reverse order - // Zero out every other tap - if(state == 0) { - d_taps[i][j] = tmp_taps[i + j*d_numchans]; - d_taps[d_numchans + i][j] = 0; - state = 1; - } - else { - d_taps[i][j] = 0; - d_taps[d_numchans + i][j] = tmp_taps[i + j*d_numchans]; - state = 0; - } - } - - // Build a filter for each channel and add it's taps to it - d_filters[i]->set_taps(d_taps[i]); - d_filters[d_numchans + i]->set_taps(d_taps[d_numchans + i]); - } - - // Set the history to ensure enough input items for each filter - set_history (d_taps_per_filter+1); - - d_updated = true; -} - -void -gr_pfb_synthesizer_ccf::print_taps() -{ - unsigned int i, j; - for(i = 0; i < d_twox*d_numchans; i++) { - printf("filter[%d]: [", i); - for(j = 0; j < d_taps_per_filter; j++) { - printf(" %.4e", d_taps[i][j]); - } - printf("]\n\n"); - } -} - - -std::vector< std::vector<float> > -gr_pfb_synthesizer_ccf::taps() const -{ - return d_taps; -} - -void -gr_pfb_synthesizer_ccf::set_channel_map(const std::vector<int> &map) -{ - gruel::scoped_lock guard(d_mutex); - - if(map.size() > 0) { - unsigned int max = (unsigned int)*std::max_element(map.begin(), map.end()); - unsigned int min = (unsigned int)*std::min_element(map.begin(), map.end()); - if((max >= d_twox*d_numchans) || (min < 0)) { - throw std::invalid_argument("gr_pfb_synthesizer_ccf::set_channel_map: map range out of bounds.\n"); - } - d_channel_map = map; - - // Zero out fft buffer so that unused channels are always 0 - memset(d_fft->get_inbuf(), 0,d_twox*d_numchans*sizeof(gr_complex)); - } -} - -std::vector<int> -gr_pfb_synthesizer_ccf::channel_map() const -{ - return d_channel_map; -} - -int -gr_pfb_synthesizer_ccf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gruel::scoped_lock guard(d_mutex); - - gr_complex *in = (gr_complex*) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - if (d_updated) { - d_updated = false; - return 0; // history requirements may have changed. - } - - unsigned int n, i; - size_t ninputs = input_items.size(); - - // Algoritm for critically sampled channels - if(d_twox == 1) { - for(n = 0; n < noutput_items/d_numchans; n++) { - for(i = 0; i < ninputs; i++) { - in = (gr_complex*)input_items[i]; - d_fft->get_inbuf()[d_channel_map[i]] = in[n]; - } - - // spin through IFFT - d_fft->execute(); - - for(i = 0; i < d_numchans; i++) { - out[i] = d_filters[i]->filter(d_fft->get_outbuf()[i]); - } - out += d_numchans; - } - } - - // Algorithm for oversampling by 2x - else { - for(n = 0; n < noutput_items/d_numchans; n++) { - for(i = 0; i < ninputs; i++) { - in = (gr_complex*)input_items[i]; - d_fft->get_inbuf()[d_channel_map[i]] = in[n]; - } - - // spin through IFFT - d_fft->execute(); - - // Output is sum of two filters, but the input buffer to the filters must be circularly - // shifted by numchans every time through, done by using d_state to determine which IFFT - // buffer position to pull from. - for(i = 0; i < d_numchans; i++) { - out[i] = d_filters[i]->filter(d_fft->get_outbuf()[d_state*d_numchans+i]); - out[i] += d_filters[d_numchans+i]->filter(d_fft->get_outbuf()[(d_state^1)*d_numchans+i]); - } - d_state ^= 1; - - out += d_numchans; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h deleted file mode 100644 index 9e4f85497d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef INCLUDED_GR_PFB_SYNTHESIZER_CCF_H -#define INCLUDED_GR_PFB_SYNTHESIZER_CCF_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> -#include <gri_fir_filter_with_buffer_ccf.h> -#include <gruel/thread.h> - -class gr_pfb_synthesizer_ccf; -typedef boost::shared_ptr<gr_pfb_synthesizer_ccf> gr_pfb_synthesizer_ccf_sptr; -GR_CORE_API gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox=false); - -class gri_fft_complex; - - -/*! - * \class gr_pfb_synthesizer_ccf - * - * \brief Polyphase synthesis filterbank with - * gr_complex input, gr_complex output and float taps - * - * \ingroup filter_blk - * \ingroup pfb_blk - */ - -class GR_CORE_API gr_pfb_synthesizer_ccf : public gr_sync_interpolator -{ - private: - /*! - * Build the polyphase synthesis filterbank. - * \param numchans (unsigned integer) Specifies the number of - channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter to - populate the filterbank. - * \param twox (bool) use 2x oversampling or not (default is no) - */ - friend GR_CORE_API gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox); - - bool d_updated; - unsigned int d_numchans; - unsigned int d_taps_per_filter; - gri_fft_complex *d_fft; - std::vector< gri_fir_filter_with_buffer_ccf*> d_filters; - std::vector< std::vector<float> > d_taps; - int d_state; - std::vector<int> d_channel_map; - unsigned int d_twox; - gruel::mutex d_mutex; // mutex to protect set/work access - - /*! - * \brief Tap setting algorithm for critically sampled channels - */ - void set_taps1(const std::vector<float> &taps); - - /*! - * \brief Tap setting algorithm for 2x over-sampled channels - */ - void set_taps2(const std::vector<float> &taps); - - /*! - * Build the polyphase synthesis filterbank. - * \param numchans (unsigned integer) Specifies the number of - channels <EM>M</EM> - * \param taps (vector/list of floats) The prototype filter - to populate the filterbank. - * \param twox (bool) use 2x oversampling or not (default is no) - */ - gr_pfb_synthesizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - bool twox); - -public: - ~gr_pfb_synthesizer_ccf (); - - /*! - * Resets the filterbank's filter taps with the new prototype filter - * \param taps (vector/list of floats) The prototype filter to - populate the filterbank. - */ - void set_taps (const std::vector<float> &taps); - - /*! - * Print all of the filterbank taps to screen. - */ - void print_taps(); - - /*! - * Return a vector<vector<>> of the filterbank taps - */ - std::vector<std::vector<float> > taps() const; - - /*! - * Set the channel map. Channels are numbers as: - * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2 - * <------------------- 0 --------------------> - * freq - * - * So input stream 0 goes to channel 0, etc. Setting a new channel - * map allows the user to specify where in frequency he/she wants - * the input stream to go. This is especially useful to avoid - * putting signals into the channels on the edge of the spectrum - * which can either wrap around (in the case of odd number of - * channels) and be affected by filter rolloff in the transmitter. - * - * The map must be at least the number of streams being sent to the - * block. Less and the algorithm will not have enough data to - * properly setup the buffers. Any more channels specified will be - * ignored. - */ - void set_channel_map(const std::vector<int> &map); - - /*! - * Gets the current channel map. - */ - std::vector<int> channel_map() const; - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i deleted file mode 100644 index c186ae355a..0000000000 --- a/gnuradio-core/src/lib/filter/gr_pfb_synthesizer_ccf.i +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pfb_synthesizer_ccf); - -gr_pfb_synthesizer_ccf_sptr gr_make_pfb_synthesizer_ccf - (unsigned int numchans, const std::vector<float> &taps, bool twox=false); - -class gr_pfb_synthesizer_ccf : public gr_sync_interpolator -{ - private: - gr_pfb_synthesizer_ccf (unsigned int numchans, - const std::vector<float> &taps, - bool twox=false); - - public: - ~gr_pfb_synthesizer_ccf (); - - void set_taps (const std::vector<float> &taps); - void print_taps(); - std::vector< std::vector<float> > taps() const; - - void set_channel_map(const std::vector<int> &map); - std::vector<int> channel_map() const; -}; diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t deleted file mode 100644 index 445834dda0..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.cc.t +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_rational_resampler_base_XXX.py Any changes made to this - * file will be overwritten. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <@FIR_TYPE@.h> -#include <gr_fir_util.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (unsigned interpolation, - unsigned decimation, - const std::vector<@TAP_TYPE@> &taps) -{ - return gnuradio::get_initial_sptr (new @NAME@ (interpolation, decimation, taps)); -} - -@NAME@::@NAME@ (unsigned interpolation, unsigned decimation, - const std::vector<@TAP_TYPE@> &taps) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), - d_history(1), - d_interpolation(interpolation), d_decimation(decimation), - d_ctr(0), d_updated(false), - d_firs(interpolation) -{ - if (interpolation == 0) - throw std::out_of_range ("interpolation must be > 0"); - if (decimation == 0) - throw std::out_of_range ("decimation must be > 0"); - - set_relative_rate (1.0 * interpolation / decimation); - set_output_multiple (1); - - std::vector<@TAP_TYPE@> dummy_taps; - - for (unsigned i = 0; i < interpolation; i++) - d_firs[i] = gr_fir_util::create_@FIR_TYPE@ (dummy_taps); - - set_taps (taps); - install_taps (d_new_taps); -} - -@NAME@::~@NAME@ () -{ - int interp = interpolation(); - for (int i = 0; i < interp; i++) - delete d_firs[i]; -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_new_taps = taps; - d_updated = true; - - // round up length to a multiple of the interpolation factor - int n = taps.size () % interpolation (); - if (n > 0){ - n = interpolation () - n; - while (n-- > 0) - d_new_taps.insert(d_new_taps.begin(), 0); - } - - assert (d_new_taps.size () % interpolation () == 0); -} - - -void -@NAME@::install_taps (const std::vector<@TAP_TYPE@> &taps) -{ - int nfilters = interpolation (); - int nt = taps.size () / nfilters; - - assert (nt * nfilters == (int) taps.size ()); - - std::vector< std::vector <@TAP_TYPE@> > xtaps (nfilters); - - for (int n = 0; n < nfilters; n++) - xtaps[n].resize (nt); - - for (int i = 0; i < (int) taps.size(); i++) - xtaps[i % nfilters][i / nfilters] = taps[i]; - - for (int n = 0; n < nfilters; n++) - d_firs[n]->set_taps (xtaps[n]); - - set_history (nt); - d_updated = false; - -#if 0 - for (int i = 0; i < nfilters; i++){ - std::cout << "filter[" << i << "] = "; - for (int j = 0; j < nt; j++) - std::cout << xtaps[i][j] << " "; - - std::cout << "\n"; - } -#endif - -} - -void -@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * decimation() / interpolation()) + history() - 1); - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = nreqd; -} - -int -@NAME@::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]; - - if (d_updated) { - install_taps (d_new_taps); - return 0; // history requirement may have increased. - } - - unsigned int ctr = d_ctr; - - int i = 0; - while (i < noutput_items){ - out[i++] = d_firs[ctr]->filter(in); - ctr += decimation(); - while (ctr >= interpolation()){ - ctr -= interpolation(); - in++; - } - } - - d_ctr = ctr; - consume_each(in - (@I_TYPE@ *) input_items[0]); - return i; -} diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t deleted file mode 100644 index 3eb85a9795..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.h.t +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_rational_resampler_base_XXX.py Any changes made to this - * file will be overwritten. - */ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_block.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -GR_CORE_API @SPTR_NAME@ -gr_make_@BASE_NAME@ (unsigned interpolation, - unsigned decimation, - const std::vector<@TAP_TYPE@> &taps); - -class @FIR_TYPE@; - -/*! - * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter_blk - */ -class GR_CORE_API @NAME@ : public gr_block -{ - private: - unsigned d_history; - unsigned d_interpolation, d_decimation; - unsigned d_ctr; - std::vector<@TAP_TYPE@> d_new_taps; - bool d_updated; - std::vector<@FIR_TYPE@ *> d_firs; - - friend GR_CORE_API @SPTR_NAME@ - gr_make_@BASE_NAME@ (unsigned interpolation, unsigned decimation, const std::vector<@TAP_TYPE@> &taps); - - - /*! - * Construct a FIR filter with the given taps - */ - @NAME@ (unsigned interpolation, unsigned decimation, - const std::vector<@TAP_TYPE@> &taps); - - void install_taps (const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - unsigned history () const { return d_history; } - void set_history (unsigned history) { d_history = history; } - - unsigned interpolation() const { return d_interpolation; } - unsigned decimation() const { return d_decimation; } - - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t b/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t deleted file mode 100644 index 1f789b0a35..0000000000 --- a/gnuradio-core/src/lib/filter/gr_rational_resampler_base_XXX.i.t +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by - * generate_gr_rational_resampler_base_XXX.py Any changes made to this - * file will be overwritten. - */ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (int interpolation, int decimation, const std::vector<@TAP_TYPE@> &taps); - -class @NAME@ : public gr_block -{ - private: - @NAME@ (int interpolation, int decimation, const std::vector<@TAP_TYPE@> &taps); - - public: - ~@NAME@ (); - - void set_taps (const std::vector<@TAP_TYPE@> &taps); -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc deleted file mode 100644 index ae4f654dda..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_single_pole_iir_filter_cc.h> -#include <gr_io_signature.h> -#include <stdio.h> - - -gr_single_pole_iir_filter_cc_sptr -gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen) -{ - return gnuradio::get_initial_sptr(new gr_single_pole_iir_filter_cc(alpha, vlen)); -} - -gr_single_pole_iir_filter_cc::gr_single_pole_iir_filter_cc ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_pole_iir_filter_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen), - gr_make_io_signature (1, 1, sizeof (gr_complex) * vlen)), - d_vlen(vlen), d_iir(vlen) -{ - set_taps(alpha); -} - -gr_single_pole_iir_filter_cc::~gr_single_pole_iir_filter_cc () -{ - // nop -} - -void -gr_single_pole_iir_filter_cc::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_iir[i].set_taps(alpha); -} - -int -gr_single_pole_iir_filter_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_iir[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_iir[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h deleted file mode 100644 index 13c595826d..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H -#define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> -#include <gr_complex.h> -#include <stdexcept> - -class gr_single_pole_iir_filter_cc; -typedef boost::shared_ptr<gr_single_pole_iir_filter_cc> gr_single_pole_iir_filter_cc_sptr; - -GR_CORE_API gr_single_pole_iir_filter_cc_sptr -gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1); - -/*! - * \brief single pole IIR filter with complex input, complex output - * \ingroup filter_blk - * - * The input and output satisfy a difference equation of the form - \htmlonly - \f{ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f} - \endhtmlonly - - \xmlonly - y[n] - (1-alpha) y[n-1] = alpha x[n] - \endxmlonly - - * with the corresponding rational system function - \htmlonly - \f{ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f} - \endhtmlonly - - \xmlonly - H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}} - \endxmlonly - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class GR_CORE_API gr_single_pole_iir_filter_cc : public gr_sync_block -{ - private: - friend GR_CORE_API gr_single_pole_iir_filter_cc_sptr - gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector<gr_single_pole_iir<gr_complex,gr_complex,double> > d_iir; - - gr_single_pole_iir_filter_cc (double alpha, unsigned int vlen); - - public: - ~gr_single_pole_iir_filter_cc (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i deleted file mode 100644 index 2f1f285de7..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_cc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_pole_iir_filter_cc); - -gr_single_pole_iir_filter_cc_sptr -gr_make_single_pole_iir_filter_cc (double alpha, unsigned int vlen=1); - -class gr_single_pole_iir_filter_cc : public gr_sync_block -{ - public: - ~gr_single_pole_iir_filter_cc (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc deleted file mode 100644 index 047b2ba25c..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_single_pole_iir_filter_ff.h> -#include <gr_io_signature.h> -#include <stdio.h> - - -gr_single_pole_iir_filter_ff_sptr -gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen) -{ - return gnuradio::get_initial_sptr(new gr_single_pole_iir_filter_ff(alpha, vlen)); -} - -gr_single_pole_iir_filter_ff::gr_single_pole_iir_filter_ff ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_pole_iir_filter_ff", - gr_make_io_signature (1, 1, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (float) * vlen)), - d_vlen(vlen), d_iir(vlen) -{ - set_taps(alpha); -} - -gr_single_pole_iir_filter_ff::~gr_single_pole_iir_filter_ff () -{ - // nop -} - -void -gr_single_pole_iir_filter_ff::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_iir[i].set_taps(alpha); -} - -int -gr_single_pole_iir_filter_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_iir[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_iir[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h deleted file mode 100644 index 8dcdad2c94..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H -#define INCLUDED_GR_SINGLE_POLE_IIR_FILTER_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> -#include <stdexcept> - -class gr_single_pole_iir_filter_ff; -typedef boost::shared_ptr<gr_single_pole_iir_filter_ff> gr_single_pole_iir_filter_ff_sptr; - -GR_CORE_API gr_single_pole_iir_filter_ff_sptr -gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1); - -/*! - * \brief single pole IIR filter with float input, float output - * \ingroup filter_blk - * - * The input and output satisfy a difference equation of the form - \htmlonly - \f{ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f} - \endhtmlonly - - \xmlonly - y[n] - (1-alpha) y[n-1] = alpha x[n] - \endxmlonly - - * with the corresponding rational system function - \htmlonly - \f{ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f} - \endhtmlonly - - \xmlonly -H(z) = \ frac{alpha}{1 - (1-alpha) z^{-1}} - \endxmlonly - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class GR_CORE_API gr_single_pole_iir_filter_ff : public gr_sync_block -{ - private: - friend GR_CORE_API gr_single_pole_iir_filter_ff_sptr - gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector<gr_single_pole_iir<float,float,double> > d_iir; - - gr_single_pole_iir_filter_ff (double alpha, unsigned int vlen); - - public: - ~gr_single_pole_iir_filter_ff (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i deleted file mode 100644 index a835fabb2e..0000000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_iir_filter_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_pole_iir_filter_ff); - -gr_single_pole_iir_filter_ff_sptr -gr_make_single_pole_iir_filter_ff (double alpha, unsigned int vlen=1); - -class gr_single_pole_iir_filter_ff : public gr_sync_block -{ - public: - ~gr_single_pole_iir_filter_ff (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_vec_types.h b/gnuradio-core/src/lib/filter/gr_vec_types.h deleted file mode 100644 index 2bcec44bf8..0000000000 --- a/gnuradio-core/src/lib/filter/gr_vec_types.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Cell single token vector types - Copyright (C) 2007 Free Software Foundation, Inc. - - This file is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This file is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with this file; see the file COPYING. If not, write to the Free - Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ - -/* As a special exception, if you include this header file into source files - compiled by GCC, this header file does not by itself cause the resulting - executable to be covered by the GNU General Public License. This exception - does not however invalidate any other reasons why the executable file might be - covered by the GNU General Public License. */ - -/* Single token vector data types for the PowerPC SIMD/Vector Multi-media - eXtension */ - -#ifndef INCLUDED_GR_VEC_TYPES_H -#define INCLUDED_GR_VEC_TYPES_H - -#define qword __vector unsigned char - -#define vec_uchar16 __vector unsigned char -#define vec_char16 __vector signed char -#define vec_bchar16 __vector bool char - -#define vec_ushort8 __vector unsigned short -#define vec_short8 __vector signed short -#define vec_bshort8 __vector bool short - -#define vec_pixel8 __vector pixel - -#define vec_uint4 __vector unsigned int -#define vec_int4 __vector signed int -#define vec_bint4 __vector bool int - -#define vec_float4 __vector float - -#define vec_ullong2 __vector bool char -#define vec_llong2 __vector bool short - -#define vec_double2 __vector bool int - -#endif /* INCLUDED_GR_VEC_TYPES_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc deleted file mode 100644 index e958c5061f..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gri_fft_filter_ccc_generic.h> -#include <gri_fft.h> -#include <volk/volk.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <cstring> -#include <fftw3.h> - -gri_fft_filter_ccc_generic::gri_fft_filter_ccc_generic (int decimation, - const std::vector<gr_complex> &taps, - int nthreads) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0), d_nthreads(nthreads) -{ - set_taps(taps); -} - -gri_fft_filter_ccc_generic::~gri_fft_filter_ccc_generic () -{ - delete d_fwdfft; - delete d_invfft; - gri_fft_free(d_xformed_taps); -} - -#if 0 -static void -print_vector_complex(const std::string label, const std::vector<gr_complex> &x) -{ - std::cout << label; - for (unsigned i = 0; i < x.size(); i++) - std::cout << x[i] << " "; - std::cout << "\n"; -} -#endif - - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_ccc_generic::set_taps (const std::vector<gr_complex> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - gr_complex *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_ccc_generic::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_ccc_generic: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_complex(d_fftsize, true, d_nthreads); - d_invfft = new gri_fft_complex(d_fftsize, false, d_nthreads); - d_xformed_taps = gri_fft_malloc_complex(d_fftsize); - } -} - -void -gri_fft_filter_ccc_generic::set_nthreads(int n) -{ - d_nthreads = n; - if(d_fwdfft) - d_fwdfft->set_nthreads(n); - if(d_invfft) - d_invfft->set_nthreads(n); -} - -int -gri_fft_filter_ccc_generic::nthreads() const -{ - return d_nthreads; -} - -int -gri_fft_filter_ccc_generic::filter (int nitems, const gr_complex *input, gr_complex *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - gr_complex *a = d_fwdfft->get_outbuf(); - gr_complex *b = d_xformed_taps; - gr_complex *c = d_invfft->get_inbuf(); - - volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize); - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(gr_complex)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h deleted file mode 100644 index 648c2b8c54..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H -#define INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_complex; - -/*! - * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps - * \ingroup filter_blk - */ -class GR_CORE_API gri_fft_filter_ccc_generic -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_complex *d_fwdfft; // forward "plan" - gri_fft_complex *d_invfft; // inverse "plan" - int d_nthreads; // number of FFTW threads to use - std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add - std::vector<gr_complex> d_new_taps; - gr_complex *d_xformed_taps; // Fourier xformed taps - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for complex vectors (such as gr_fft_filter_ccc). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (complex) - * \param nthreads The number of threads for the FFT to use (int) - */ - gri_fft_filter_ccc_generic (int decimation, const std::vector<gr_complex> &taps, - int nthreads=1); - ~gri_fft_filter_ccc_generic (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (complex) - */ - int set_taps (const std::vector<gr_complex> &taps); - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const gr_complex *input, gr_complex *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc deleted file mode 100644 index bfc939869e..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.cc +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gri_fft_filter_ccc_sse.h> -#include <gri_fft.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <xmmintrin.h> -#include <fftw3.h> - -gri_fft_filter_ccc_sse::gri_fft_filter_ccc_sse (int decimation, - const std::vector<gr_complex> &taps) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0) -{ - d_xformed_taps = (gr_complex*)fftwf_malloc(1*sizeof(gr_complex)); - set_taps(taps); -} - -gri_fft_filter_ccc_sse::~gri_fft_filter_ccc_sse () -{ - fftwf_free(d_xformed_taps); - delete d_fwdfft; - delete d_invfft; -} - -#if 0 -static void -print_vector_complex(const std::string label, const std::vector<gr_complex> &x) -{ - std::cout << label; - for (unsigned i = 0; i < x.size(); i++) - std::cout << x[i] << " "; - std::cout << "\n"; -} -#endif - - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_ccc_sse::set_taps (const std::vector<gr_complex> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - gr_complex *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_ccc_sse::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_ccc_sse: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_complex(d_fftsize, true); - d_invfft = new gri_fft_complex(d_fftsize, false); - - fftwf_free(d_xformed_taps); - d_xformed_taps = (gr_complex*)fftwf_malloc((d_fftsize)*sizeof(gr_complex)); - } -} - -int -gri_fft_filter_ccc_sse::filter (int nitems, const gr_complex *input, gr_complex *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(gr_complex)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - float *a = (float*)(d_fwdfft->get_outbuf()); - float *b = (float*)(&d_xformed_taps[0]); - float *c = (float*)(d_invfft->get_inbuf()); - - __m128 x0, x1, x2, t0, t1, m; - m = _mm_set_ps(-1, 1, -1, 1); - for (j = 0; j < 2*d_fftsize; j+=4) { // filter in the freq domain - x0 = _mm_load_ps(&a[j]); - t0 = _mm_load_ps(&b[j]); - - t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(3, 3, 1, 1)); - t0 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(2, 2, 0, 0)); - t1 = _mm_mul_ps(t1, m); - - x1 = _mm_mul_ps(x0, t0); - x2 = _mm_mul_ps(x0, t1); - - x2 = _mm_shuffle_ps(x2, x2, _MM_SHUFFLE(2, 3, 0, 1)); - x2 = _mm_add_ps(x1, x2); - - _mm_store_ps(&c[j], x2); - } - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(gr_complex)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h deleted file mode 100644 index 64b8c0c153..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_sse.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GRI_FFT_FILTER_CCC_SSE_H -#define INCLUDED_GRI_FFT_FILTER_CCC_SSE_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_complex; - -/*! - * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps - * \ingroup filter_blk - */ -class GR_CORE_API gri_fft_filter_ccc_sse -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_complex *d_fwdfft; // forward "plan" - gri_fft_complex *d_invfft; // inverse "plan" - std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add - gr_complex *d_xformed_taps; - std::vector<gr_complex> d_new_taps; - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for complex vectors (such as gr_fft_filter_ccc). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (complex) - */ - gri_fft_filter_ccc_sse (int decimation, const std::vector<gr_complex> &taps); - ~gri_fft_filter_ccc_sse (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (complex) - */ - int set_taps (const std::vector<gr_complex> &taps); - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const gr_complex *input, gr_complex *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_CCC_SSE_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc deleted file mode 100644 index c6e923ee11..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gri_fft_filter_fff_generic.h> -#include <gri_fft.h> -#include <volk/volk.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <cstring> - -gri_fft_filter_fff_generic::gri_fft_filter_fff_generic (int decimation, - const std::vector<float> &taps, - int nthreads) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0), d_nthreads(nthreads) -{ - set_taps(taps); -} - -gri_fft_filter_fff_generic::~gri_fft_filter_fff_generic () -{ - delete d_fwdfft; - delete d_invfft; - gri_fft_free(d_xformed_taps); -} - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_fff_generic::set_taps (const std::vector<float> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - float *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize/2+1; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_fff_generic::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_fff_generic: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_real_fwd(d_fftsize); - d_invfft = new gri_fft_real_rev(d_fftsize); - d_xformed_taps = gri_fft_malloc_complex(d_fftsize/2+1); - } -} - -void -gri_fft_filter_fff_generic::set_nthreads(int n) -{ - d_nthreads = n; - if(d_fwdfft) - d_fwdfft->set_nthreads(n); - if(d_invfft) - d_invfft->set_nthreads(n); -} - -int -gri_fft_filter_fff_generic::nthreads() const -{ - return d_nthreads; -} - -int -gri_fft_filter_fff_generic::filter (int nitems, const float *input, float *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - gr_complex *a = d_fwdfft->get_outbuf(); - gr_complex *b = d_xformed_taps; - gr_complex *c = d_invfft->get_inbuf(); - - volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize/2+1); - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - - //memcpy(out, d_invfft->get_outbuf(), d_nsamples * sizeof(float)); - //out += d_nsamples; - - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(float)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h deleted file mode 100644 index 528bf5dd7d..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H -#define INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_real_fwd; -class gri_fft_real_rev; - -class GR_CORE_API gri_fft_filter_fff_generic -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_real_fwd *d_fwdfft; // forward "plan" - gri_fft_real_rev *d_invfft; // inverse "plan" - int d_nthreads; // number of FFTW threads to use - std::vector<float> d_tail; // state carried between blocks for overlap-add - std::vector<float> d_new_taps; - gr_complex *d_xformed_taps; // Fourier xformed taps - - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct a FFT filter for float vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for floating point vectors (such as gr_fft_filter_fff). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (float) - * \param nthreads The number of threads for the FFT to use (int) - */ - gri_fft_filter_fff_generic (int decimation, const std::vector<float> &taps, - int nthreads=1); - ~gri_fft_filter_fff_generic (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (float) - */ - int set_taps (const std::vector<float> &taps); - - /*! - * \brief Set number of threads to use. - */ - void set_nthreads(int n); - - /*! - * \brief Get number of threads being used. - */ - int nthreads() const; - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const float *input, float *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc deleted file mode 100644 index 84fcfa4380..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.cc +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gri_fft_filter_fff_sse.h> -#include <gri_fft.h> -#include <assert.h> -#include <stdexcept> -#include <cstdio> -#include <xmmintrin.h> -#include <fftw3.h> - -gri_fft_filter_fff_sse::gri_fft_filter_fff_sse (int decimation, - const std::vector<float> &taps) - : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0) -{ - d_xformed_taps = (gr_complex*)fftwf_malloc(1*sizeof(gr_complex)); - set_taps(taps); -} - -gri_fft_filter_fff_sse::~gri_fft_filter_fff_sse () -{ - fftwf_free(d_xformed_taps); - delete d_fwdfft; - delete d_invfft; -} - -/* - * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps - */ -int -gri_fft_filter_fff_sse::set_taps (const std::vector<float> &taps) -{ - int i = 0; - compute_sizes(taps.size()); - - d_tail.resize(tailsize()); - for (i = 0; i < tailsize(); i++) - d_tail[i] = 0; - - float *in = d_fwdfft->get_inbuf(); - gr_complex *out = d_fwdfft->get_outbuf(); - - float scale = 1.0 / d_fftsize; - - // Compute forward xform of taps. - // Copy taps into first ntaps slots, then pad with zeros - for (i = 0; i < d_ntaps; i++) - in[i] = taps[i] * scale; - - for (; i < d_fftsize; i++) - in[i] = 0; - - d_fwdfft->execute(); // do the xform - - // now copy output to d_xformed_taps - for (i = 0; i < d_fftsize/2+1; i++) - d_xformed_taps[i] = out[i]; - - return d_nsamples; -} - -// determine and set d_ntaps, d_nsamples, d_fftsize - -void -gri_fft_filter_fff_sse::compute_sizes(int ntaps) -{ - int old_fftsize = d_fftsize; - d_ntaps = ntaps; - d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2)))); - d_nsamples = d_fftsize - d_ntaps + 1; - - if (0) - fprintf(stderr, "gri_fft_filter_fff_sse: ntaps = %d, fftsize = %d, nsamples = %d\n", - d_ntaps, d_fftsize, d_nsamples); - - assert(d_fftsize == d_ntaps + d_nsamples -1 ); - - if (d_fftsize != old_fftsize){ // compute new plans - delete d_fwdfft; - delete d_invfft; - d_fwdfft = new gri_fft_real_fwd(d_fftsize); - d_invfft = new gri_fft_real_rev(d_fftsize); - //d_xformed_taps.resize(d_fftsize/2+1); - - fftwf_free(d_xformed_taps); - d_xformed_taps = (gr_complex*)fftwf_malloc((d_fftsize/2+1)*sizeof(gr_complex)); - } -} - -int -gri_fft_filter_fff_sse::filter (int nitems, const float *input, float *output) -{ - int dec_ctr = 0; - int j = 0; - int ninput_items = nitems * d_decimation; - - for (int i = 0; i < ninput_items; i += d_nsamples){ - - memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float)); - - for (j = d_nsamples; j < d_fftsize; j++) - d_fwdfft->get_inbuf()[j] = 0; - - d_fwdfft->execute(); // compute fwd xform - - float *a = (float*)(d_fwdfft->get_outbuf()); - float *b = (float*)(&d_xformed_taps[0]); - float *c = (float*)(d_invfft->get_inbuf()); - - __m128 x0, x1, x2, t0, t1, m; - m = _mm_set_ps(-1, 1, -1, 1); - for (j = 0; j < d_fftsize; j+=4) { // filter in the freq domain - x0 = _mm_load_ps(&a[j]); - t0 = _mm_load_ps(&b[j]); - - t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(3, 3, 1, 1)); - t0 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(2, 2, 0, 0)); - t1 = _mm_mul_ps(t1, m); - - x1 = _mm_mul_ps(x0, t0); - x2 = _mm_mul_ps(x0, t1); - - x2 = _mm_shuffle_ps(x2, x2, _MM_SHUFFLE(2, 3, 0, 1)); - x2 = _mm_add_ps(x1, x2); - - _mm_store_ps(&c[j], x2); - } - - // Finish off the last one; do the complex multiply as floats - j = d_fftsize/2; - c[j] = (a[j] * b[j]) - (a[j+1] * b[j+1]); - c[j+1] = (a[j] * b[j+1]) + (a[j+1] * b[j]); - - d_invfft->execute(); // compute inv xform - - // add in the overlapping tail - - for (j = 0; j < tailsize(); j++) - d_invfft->get_outbuf()[j] += d_tail[j]; - - // copy nsamples to output - - //memcpy(out, d_invfft->get_outbuf(), d_nsamples * sizeof(float)); - //out += d_nsamples; - - j = dec_ctr; - while (j < d_nsamples) { - *output++ = d_invfft->get_outbuf()[j]; - j += d_decimation; - } - dec_ctr = (j - d_nsamples); - - // stash the tail - memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples, - tailsize() * sizeof(float)); - } - - assert(dec_ctr == 0); - - return nitems; -} diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h deleted file mode 100644 index b6086562d9..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_sse.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GRI_FFT_FILTER_FFF_SSE_H -#define INCLUDED_GRI_FFT_FILTER_FFF_SSE_H - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gri_fft_real_fwd; -class gri_fft_real_rev; - -class GR_CORE_API gri_fft_filter_fff_sse -{ - private: - int d_ntaps; - int d_nsamples; - int d_fftsize; // fftsize = ntaps + nsamples - 1 - int d_decimation; - gri_fft_real_fwd *d_fwdfft; // forward "plan" - gri_fft_real_rev *d_invfft; // inverse "plan" - std::vector<float> d_tail; // state carried between blocks for overlap-add - //std::vector<gr_complex> d_xformed_taps; // Fourier xformed taps - gr_complex *d_xformed_taps; - std::vector<float> d_new_taps; - - - void compute_sizes(int ntaps); - int tailsize() const { return d_ntaps - 1; } - - public: - /*! - * \brief Construct a FFT filter for float vectors with the given taps and decimation rate. - * - * This is the basic implementation for performing FFT filter for fast convolution - * in other blocks for floating point vectors (such as gr_fft_filter_fff). - * \param decimation The decimation rate of the filter (int) - * \param taps The filter taps (float) - */ - gri_fft_filter_fff_sse (int decimation, const std::vector<float> &taps); - ~gri_fft_filter_fff_sse (); - - /*! - * \brief Set new taps for the filter. - * - * Sets new taps and resets the class properties to handle different sizes - * \param taps The filter taps (float) - */ - int set_taps (const std::vector<float> &taps); - - /*! - * \brief Perform the filter operation - * - * \param nitems The number of items to produce - * \param input The input vector to be filtered - * \param output The result of the filter operation - */ - int filter (int nitems, const float *input, float *output); - -}; - -#endif /* INCLUDED_GRI_FFT_FILTER_FFF_SSE_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t deleted file mode 100644 index 0ae644cc65..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <@NAME@.h> - -@NAME@::@NAME@(const std::vector<@TAP_TYPE@> &taps) -{ - d_buffer = NULL; - set_taps(taps); -} - -@NAME@::~@NAME@() -{ - if(d_buffer != NULL) - free(d_buffer); -} - -void -@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps) -{ - d_taps = gr_reverse(taps); - - if(d_buffer != NULL) { - free(d_buffer); - d_buffer = NULL; - } - - // FIXME: memalign this to 16-byte boundaries for SIMD later - size_t t = sizeof(@I_TYPE@) * 2 * d_taps.size(); - d_buffer = (@I_TYPE@*)malloc(t); - memset(d_buffer, 0x00, t); - d_idx = 0; -} - -@O_TYPE@ -@NAME@::filter (@I_TYPE@ input) -{ - unsigned int i; - - d_buffer[d_idx] = input; - d_buffer[d_idx+ntaps()] = input; - - // using the later for the case when ntaps=0; - // profiling shows this doesn't make a difference - //d_idx = (d_idx + 1) % ntaps(); - d_idx++; - if(d_idx >= ntaps()) - d_idx = 0; - - @ACC_TYPE@ out = 0; - for(i = 0; i < ntaps(); i++) { - out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i]; - } - return (@O_TYPE@)out; -} - -@O_TYPE@ -@NAME@::filter (const @I_TYPE@ input[], unsigned long dec) -{ - unsigned int i; - - for(i = 0; i < dec; i++) { - d_buffer[d_idx] = input[i]; - d_buffer[d_idx+ntaps()] = input[i]; - d_idx++; - if(d_idx >= ntaps()) - d_idx = 0; - } - - @ACC_TYPE@ out = 0; - for(i = 0; i < ntaps(); i++) { - out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i]; - } - return (@O_TYPE@)out; -} - -void -@NAME@::filterN (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n) -{ - for(unsigned long i = 0; i < n; i++) { - output[i] = filter(input[i]); - } -} - -void -@NAME@::filterNdec (@O_TYPE@ output[], - const @I_TYPE@ input[], - unsigned long n, - unsigned long decimate) -{ - unsigned long j = 0; - for(unsigned long i = 0; i < n; i++) { - output[i] = filter(&input[j], decimate); - j += decimate; - } -} diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t deleted file mode 100644 index efb314bed0..0000000000 --- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * WARNING: This file is automatically generated by generate_gri_fir_XXX.py - * Any changes made to this file will be overwritten. - */ - - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <vector> -#include <gr_types.h> -#include <gr_reverse.h> -#include <string.h> -#include <cstdio> - -/*! - * \brief FIR with internal buffer for @I_TYPE@ input, - @O_TYPE@ output and @TAP_TYPE@ taps - * \ingroup filter - * - */ - -class GR_CORE_API @NAME@ { - -protected: - std::vector<@TAP_TYPE@> d_taps; // reversed taps - @I_TYPE@ *d_buffer; - unsigned int d_idx; - -public: - - // CONSTRUCTORS - - /*! - * \brief construct new FIR with given taps. - * - * Note that taps must be in forward order, e.g., coefficient 0 is - * stored in new_taps[0], coefficient 1 is stored in - * new_taps[1], etc. - */ - @NAME@ (const std::vector<@TAP_TYPE@> &taps); - - ~@NAME@ (); - - // MANIPULATORS - - /*! - * \brief compute a single output value. - * - * \p input is a single input value of the filter type - * - * \returns the filtered input value. - */ - @O_TYPE@ filter (@I_TYPE@ input); - - - /*! - * \brief compute a single output value; designed for decimating filters. - * - * \p input is a single input value of the filter type. The value of dec is the - * decimating value of the filter, so input[] must have dec valid values. - * The filter pushes dec number of items onto the circ. buffer before computing - * a single output. - * - * \returns the filtered input value. - */ - @O_TYPE@ filter (const @I_TYPE@ input[], unsigned long dec); - - /*! - * \brief compute an array of N output values. - * - * \p input must have (n - 1 + ntaps()) valid entries. - * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values. - */ - void filterN (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n); - - /*! - * \brief compute an array of N output values, decimating the input - * - * \p input must have (decimate * (n - 1) + ntaps()) valid entries. - * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to - * compute the output values. - */ - void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[], - unsigned long n, unsigned long decimate); - - /*! - * \brief install \p new_taps as the current taps. - */ - void set_taps (const std::vector<@TAP_TYPE@> &taps); - - // ACCESSORS - - /*! - * \return number of taps in filter. - */ - unsigned ntaps () const { return d_taps.size (); } - - /*! - * \return current taps - */ - const std::vector<@TAP_TYPE@> get_taps () const - { - return gr_reverse(d_taps); - } -}; - -#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/filter/gri_iir.h b/gnuradio-core/src/lib/filter/gri_iir.h deleted file mode 100644 index 86345f6c09..0000000000 --- a/gnuradio-core/src/lib/filter/gri_iir.h +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GRI_IIR_H -#define INCLUDED_GRI_IIR_H - -#include <gr_core_api.h> -#include <vector> -#include <stdexcept> - -/*! - * \brief base class template for Infinite Impulse Response filter (IIR) - */ -template<class i_type, class o_type, class tap_type> -class gri_iir { -public: - /*! - * \brief Construct an IIR with the given taps. - * - * This filter uses the Direct Form I implementation, where - * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones. - * - * \p fftaps and \p fbtaps must have equal numbers of taps - * - * The input and output satisfy a difference equation of the form - - \f[ - y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] - \f] - - * with the corresponding rational system function - - \f[ - H(z) = \frac{\sum_{k=0}^{N} b_k z^{-k}}{1 - \sum_{k=1}^{M} a_k z^{-k}} - \f] - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback taps. - */ - gri_iir (const std::vector<tap_type>& fftaps, - const std::vector<tap_type>& fbtaps) throw (std::invalid_argument) - { - set_taps (fftaps, fbtaps); - } - - gri_iir () : d_latest_n(0),d_latest_m(0) { } - - ~gri_iir () {} - - /*! - * \brief compute a single output value. - * \returns the filtered input value. - */ - o_type filter (const i_type input); - - /*! - * \brief compute an array of N output values. - * \p input must have N valid entries. - */ - void filter_n (o_type output[], const i_type input[], long n); - - /*! - * \return number of taps in filter. - */ - unsigned ntaps_ff () const { return d_fftaps.size (); } - unsigned ntaps_fb () const { return d_fbtaps.size (); } - - /*! - * \brief install new taps. - */ - void set_taps (const std::vector<tap_type> &fftaps, - const std::vector<tap_type> &fbtaps) throw (std::invalid_argument) - { - - - d_latest_n = 0; - d_latest_m = 0; - d_fftaps = fftaps; - d_fbtaps = fbtaps; - - int n = fftaps.size (); - int m = fbtaps.size (); - d_prev_input.resize (2 * n); - d_prev_output.resize (2 * m); - - for (int i = 0; i < 2 * n; i++){ - d_prev_input[i] = 0; - } - for (int i = 0; i < 2 * m; i++){ - d_prev_output[i] = 0; - } - } - -protected: - std::vector<tap_type> d_fftaps; - std::vector<tap_type> d_fbtaps; - int d_latest_n; - int d_latest_m; - std::vector<tap_type> d_prev_output; - std::vector<i_type> d_prev_input; -}; - - -// -// general case. We may want to specialize this -// -template<class i_type, class o_type, class tap_type> -o_type -gri_iir<i_type, o_type, tap_type>::filter (const i_type input) -{ - tap_type acc; - unsigned i = 0; - unsigned n = ntaps_ff (); - unsigned m = ntaps_fb (); - - if (n == 0) - return (o_type) 0; - - int latest_n = d_latest_n; - int latest_m = d_latest_m; - - acc = d_fftaps[0] * input; - for (i = 1; i < n; i ++) - acc += (d_fftaps[i] * d_prev_input[latest_n + i]); - for (i = 1; i < m; i ++) - acc += (d_fbtaps[i] * d_prev_output[latest_m + i]); - - // store the values twice to avoid having to handle wrap-around in the loop - d_prev_output[latest_m] = acc; - d_prev_output[latest_m+m] = acc; - d_prev_input[latest_n] = input; - d_prev_input[latest_n+n] = input; - - latest_n--; - latest_m--; - if (latest_n < 0) - latest_n += n; - if (latest_m < 0) - latest_m += m; - - d_latest_m = latest_m; - d_latest_n = latest_n; - return (o_type) acc; -} - - -template<class i_type, class o_type, class tap_type> -void -gri_iir<i_type, o_type, tap_type>::filter_n (o_type output[], - const i_type input[], - long n) -{ - for (int i = 0; i < n; i++) - output[i] = filter (input[i]); -} - -#endif /* INCLUDED_GRI_IIR_H */ - diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc deleted file mode 100644 index 52098bf1aa..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gri_mmse_fir_interpolator.h> -#include <gr_fir_util.h> -#include <gr_fir_fff.h> -#include <assert.h> -#include <cmath> -#include "interpolator_taps.h" - -gri_mmse_fir_interpolator::gri_mmse_fir_interpolator () -{ - filters.resize (NSTEPS + 1); - - for (int i = 0; i < NSTEPS + 1; i++){ - std::vector<float> t (&taps[i][0], &taps[i][NTAPS]); - filters[i] = gr_fir_util::create_gr_fir_fff (t); - } -} - -gri_mmse_fir_interpolator::~gri_mmse_fir_interpolator () -{ - for (int i = 0; i < NSTEPS + 1; i++) - delete filters[i]; -} - -unsigned -gri_mmse_fir_interpolator::ntaps () const -{ - return NTAPS; -} - -unsigned -gri_mmse_fir_interpolator::nsteps () const -{ - return NSTEPS; -} - -float -gri_mmse_fir_interpolator::interpolate (const float input[], float mu) const -{ - int imu = (int) rint (mu * NSTEPS); - - assert (imu >= 0); - assert (imu <= NSTEPS); - - float r = filters[imu]->filter (input); - return r; -} diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h deleted file mode 100644 index f479169bc8..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _GRI_MMSE_FIR_INTERPOLATOR_H_ -#define _GRI_MMSE_FIR_INTERPOLATOR_H_ - -#include <gr_core_api.h> -#include <vector> - -class gr_fir_fff; - -/*! - * \brief Compute intermediate samples between signal samples x(k*Ts) - * \ingroup filter_primitive - * - * This implements a Mininum Mean Squared Error interpolator with 8 taps. - * It is suitable for signals where the bandwidth of interest B = 1/(4*Ts) - * Where Ts is the time between samples. - * - * Although mu, the fractional delay, is specified as a float, it is actually - * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate - * method to 32nd's of a sample. - * - * For more information, in the GNU Radio source code, see: - * \li gnuradio-core/src/gen_interpolator_taps/README - * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt - */ - -class GR_CORE_API gri_mmse_fir_interpolator { -public: - gri_mmse_fir_interpolator (); - ~gri_mmse_fir_interpolator (); - - unsigned ntaps () const; - unsigned nsteps () const; - - /*! - * \brief compute a single interpolated output value. - * \p input must have ntaps() valid entries. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * - * \p mu must be in the range [0, 1] and specifies the fractional delay. - * - * \returns the interpolated input value. - */ - float interpolate (const float input[], float mu) const; - -protected: - std::vector<gr_fir_fff *> filters; -}; - - -#endif /* _GRI_MMSE_FIR_INTERPOLATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc deleted file mode 100644 index 174378c22a..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gri_mmse_fir_interpolator_cc.h> -#include <gr_fir_util.h> -#include <gr_fir_ccf.h> -#include <assert.h> -#include <cmath> -#include "interpolator_taps.h" - -gri_mmse_fir_interpolator_cc::gri_mmse_fir_interpolator_cc () -{ - filters.resize (NSTEPS + 1); - - for (int i = 0; i < NSTEPS + 1; i++){ - std::vector<float> t (&taps[i][0], &taps[i][NTAPS]); - filters[i] = gr_fir_util::create_gr_fir_ccf (t); - } -} - -gri_mmse_fir_interpolator_cc::~gri_mmse_fir_interpolator_cc () -{ - for (int i = 0; i < NSTEPS + 1; i++) - delete filters[i]; -} - -unsigned -gri_mmse_fir_interpolator_cc::ntaps () const -{ - return NTAPS; -} - -unsigned -gri_mmse_fir_interpolator_cc::nsteps () const -{ - return NSTEPS; -} - -gr_complex -gri_mmse_fir_interpolator_cc::interpolate (const gr_complex input[], float mu) -{ - int imu = (int) rint (mu * NSTEPS); - - assert (imu >= 0); - assert (imu <= NSTEPS); - - gr_complex r = filters[imu]->filter (input); - return r; -} diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h deleted file mode 100644 index bacd9ed92a..0000000000 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ -#define _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ - -#include <gr_core_api.h> -#include <gr_complex.h> -#include <vector> - -class gr_fir_ccf; - -/*! - * \brief Compute intermediate samples between signal samples x(k*Ts) - * \ingroup filter_primitive - * - * This implements a Mininum Mean Squared Error interpolator with 8 taps. - * It is suitable for signals where the bandwidth of interest B = 1/(4*Ts) - * Where Ts is the time between samples. - * - * Although mu, the fractional delay, is specified as a float, it is actually - * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate - * method to 32nd's of a sample. - * - * For more information, in the GNU Radio source code, see: - * \li gnuradio-core/src/gen_interpolator_taps/README - * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt - */ - -class GR_CORE_API gri_mmse_fir_interpolator_cc { -public: - gri_mmse_fir_interpolator_cc (); - ~gri_mmse_fir_interpolator_cc (); - - unsigned ntaps () const; - unsigned nsteps () const; - - /*! - * \brief compute a single interpolated output value. - * - * \p input must have ntaps() valid entries and be 8-byte aligned. - * input[0] .. input[ntaps() - 1] are referenced to compute the output value. - * \throws std::invalid_argument if input is not 8-byte aligned. - * - * \p mu must be in the range [0, 1] and specifies the fractional delay. - * - * \returns the interpolated input value. - */ - gr_complex interpolate (const gr_complex input[], float mu); - -protected: - std::vector<gr_fir_ccf *> filters; -}; - - -#endif /* _GRI_MMSE_FIR_INTERPOLATOR_CC_H_ */ diff --git a/gnuradio-core/src/lib/filter/interpolator_taps.h b/gnuradio-core/src/lib/filter/interpolator_taps.h deleted file mode 100644 index 76702b63fa..0000000000 --- a/gnuradio-core/src/lib/filter/interpolator_taps.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This file was machine generated by gen_interpolator_taps. - * DO NOT EDIT BY HAND. - */ - -static const int NTAPS = 8; -static const int NSTEPS = 128; - -static const float taps[NSTEPS+1][NTAPS] = { - // -4 -3 -2 -1 0 1 2 3 mu - { 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 0/128 - { -1.54700e-04, 8.53777e-04, -2.76968e-03, 7.89295e-03, 9.98534e-01, -5.41054e-03, 1.24642e-03, -1.98993e-04 }, // 1/128 - { -3.09412e-04, 1.70888e-03, -5.55134e-03, 1.58840e-02, 9.96891e-01, -1.07209e-02, 2.47942e-03, -3.96391e-04 }, // 2/128 - { -4.64053e-04, 2.56486e-03, -8.34364e-03, 2.39714e-02, 9.95074e-01, -1.59305e-02, 3.69852e-03, -5.92100e-04 }, // 3/128 - { -6.18544e-04, 3.42130e-03, -1.11453e-02, 3.21531e-02, 9.93082e-01, -2.10389e-02, 4.90322e-03, -7.86031e-04 }, // 4/128 - { -7.72802e-04, 4.27773e-03, -1.39548e-02, 4.04274e-02, 9.90917e-01, -2.60456e-02, 6.09305e-03, -9.78093e-04 }, // 5/128 - { -9.26747e-04, 5.13372e-03, -1.67710e-02, 4.87921e-02, 9.88580e-01, -3.09503e-02, 7.26755e-03, -1.16820e-03 }, // 6/128 - { -1.08030e-03, 5.98883e-03, -1.95925e-02, 5.72454e-02, 9.86071e-01, -3.57525e-02, 8.42626e-03, -1.35627e-03 }, // 7/128 - { -1.23337e-03, 6.84261e-03, -2.24178e-02, 6.57852e-02, 9.83392e-01, -4.04519e-02, 9.56876e-03, -1.54221e-03 }, // 8/128 - { -1.38589e-03, 7.69462e-03, -2.52457e-02, 7.44095e-02, 9.80543e-01, -4.50483e-02, 1.06946e-02, -1.72594e-03 }, // 9/128 - { -1.53777e-03, 8.54441e-03, -2.80746e-02, 8.31162e-02, 9.77526e-01, -4.95412e-02, 1.18034e-02, -1.90738e-03 }, // 10/128 - { -1.68894e-03, 9.39154e-03, -3.09033e-02, 9.19033e-02, 9.74342e-01, -5.39305e-02, 1.28947e-02, -2.08645e-03 }, // 11/128 - { -1.83931e-03, 1.02356e-02, -3.37303e-02, 1.00769e-01, 9.70992e-01, -5.82159e-02, 1.39681e-02, -2.26307e-03 }, // 12/128 - { -1.98880e-03, 1.10760e-02, -3.65541e-02, 1.09710e-01, 9.67477e-01, -6.23972e-02, 1.50233e-02, -2.43718e-03 }, // 13/128 - { -2.13733e-03, 1.19125e-02, -3.93735e-02, 1.18725e-01, 9.63798e-01, -6.64743e-02, 1.60599e-02, -2.60868e-03 }, // 14/128 - { -2.28483e-03, 1.27445e-02, -4.21869e-02, 1.27812e-01, 9.59958e-01, -7.04471e-02, 1.70776e-02, -2.77751e-03 }, // 15/128 - { -2.43121e-03, 1.35716e-02, -4.49929e-02, 1.36968e-01, 9.55956e-01, -7.43154e-02, 1.80759e-02, -2.94361e-03 }, // 16/128 - { -2.57640e-03, 1.43934e-02, -4.77900e-02, 1.46192e-01, 9.51795e-01, -7.80792e-02, 1.90545e-02, -3.10689e-03 }, // 17/128 - { -2.72032e-03, 1.52095e-02, -5.05770e-02, 1.55480e-01, 9.47477e-01, -8.17385e-02, 2.00132e-02, -3.26730e-03 }, // 18/128 - { -2.86289e-03, 1.60193e-02, -5.33522e-02, 1.64831e-01, 9.43001e-01, -8.52933e-02, 2.09516e-02, -3.42477e-03 }, // 19/128 - { -3.00403e-03, 1.68225e-02, -5.61142e-02, 1.74242e-01, 9.38371e-01, -8.87435e-02, 2.18695e-02, -3.57923e-03 }, // 20/128 - { -3.14367e-03, 1.76185e-02, -5.88617e-02, 1.83711e-01, 9.33586e-01, -9.20893e-02, 2.27664e-02, -3.73062e-03 }, // 21/128 - { -3.28174e-03, 1.84071e-02, -6.15931e-02, 1.93236e-01, 9.28650e-01, -9.53307e-02, 2.36423e-02, -3.87888e-03 }, // 22/128 - { -3.41815e-03, 1.91877e-02, -6.43069e-02, 2.02814e-01, 9.23564e-01, -9.84679e-02, 2.44967e-02, -4.02397e-03 }, // 23/128 - { -3.55283e-03, 1.99599e-02, -6.70018e-02, 2.12443e-01, 9.18329e-01, -1.01501e-01, 2.53295e-02, -4.16581e-03 }, // 24/128 - { -3.68570e-03, 2.07233e-02, -6.96762e-02, 2.22120e-01, 9.12947e-01, -1.04430e-01, 2.61404e-02, -4.30435e-03 }, // 25/128 - { -3.81671e-03, 2.14774e-02, -7.23286e-02, 2.31843e-01, 9.07420e-01, -1.07256e-01, 2.69293e-02, -4.43955e-03 }, // 26/128 - { -3.94576e-03, 2.22218e-02, -7.49577e-02, 2.41609e-01, 9.01749e-01, -1.09978e-01, 2.76957e-02, -4.57135e-03 }, // 27/128 - { -4.07279e-03, 2.29562e-02, -7.75620e-02, 2.51417e-01, 8.95936e-01, -1.12597e-01, 2.84397e-02, -4.69970e-03 }, // 28/128 - { -4.19774e-03, 2.36801e-02, -8.01399e-02, 2.61263e-01, 8.89984e-01, -1.15113e-01, 2.91609e-02, -4.82456e-03 }, // 29/128 - { -4.32052e-03, 2.43930e-02, -8.26900e-02, 2.71144e-01, 8.83893e-01, -1.17526e-01, 2.98593e-02, -4.94589e-03 }, // 30/128 - { -4.44107e-03, 2.50946e-02, -8.52109e-02, 2.81060e-01, 8.77666e-01, -1.19837e-01, 3.05345e-02, -5.06363e-03 }, // 31/128 - { -4.55932e-03, 2.57844e-02, -8.77011e-02, 2.91006e-01, 8.71305e-01, -1.22047e-01, 3.11866e-02, -5.17776e-03 }, // 32/128 - { -4.67520e-03, 2.64621e-02, -9.01591e-02, 3.00980e-01, 8.64812e-01, -1.24154e-01, 3.18153e-02, -5.28823e-03 }, // 33/128 - { -4.78866e-03, 2.71272e-02, -9.25834e-02, 3.10980e-01, 8.58189e-01, -1.26161e-01, 3.24205e-02, -5.39500e-03 }, // 34/128 - { -4.89961e-03, 2.77794e-02, -9.49727e-02, 3.21004e-01, 8.51437e-01, -1.28068e-01, 3.30021e-02, -5.49804e-03 }, // 35/128 - { -5.00800e-03, 2.84182e-02, -9.73254e-02, 3.31048e-01, 8.44559e-01, -1.29874e-01, 3.35600e-02, -5.59731e-03 }, // 36/128 - { -5.11376e-03, 2.90433e-02, -9.96402e-02, 3.41109e-01, 8.37557e-01, -1.31581e-01, 3.40940e-02, -5.69280e-03 }, // 37/128 - { -5.21683e-03, 2.96543e-02, -1.01915e-01, 3.51186e-01, 8.30432e-01, -1.33189e-01, 3.46042e-02, -5.78446e-03 }, // 38/128 - { -5.31716e-03, 3.02507e-02, -1.04150e-01, 3.61276e-01, 8.23188e-01, -1.34699e-01, 3.50903e-02, -5.87227e-03 }, // 39/128 - { -5.41467e-03, 3.08323e-02, -1.06342e-01, 3.71376e-01, 8.15826e-01, -1.36111e-01, 3.55525e-02, -5.95620e-03 }, // 40/128 - { -5.50931e-03, 3.13987e-02, -1.08490e-01, 3.81484e-01, 8.08348e-01, -1.37426e-01, 3.59905e-02, -6.03624e-03 }, // 41/128 - { -5.60103e-03, 3.19495e-02, -1.10593e-01, 3.91596e-01, 8.00757e-01, -1.38644e-01, 3.64044e-02, -6.11236e-03 }, // 42/128 - { -5.68976e-03, 3.24843e-02, -1.12650e-01, 4.01710e-01, 7.93055e-01, -1.39767e-01, 3.67941e-02, -6.18454e-03 }, // 43/128 - { -5.77544e-03, 3.30027e-02, -1.14659e-01, 4.11823e-01, 7.85244e-01, -1.40794e-01, 3.71596e-02, -6.25277e-03 }, // 44/128 - { -5.85804e-03, 3.35046e-02, -1.16618e-01, 4.21934e-01, 7.77327e-01, -1.41727e-01, 3.75010e-02, -6.31703e-03 }, // 45/128 - { -5.93749e-03, 3.39894e-02, -1.18526e-01, 4.32038e-01, 7.69305e-01, -1.42566e-01, 3.78182e-02, -6.37730e-03 }, // 46/128 - { -6.01374e-03, 3.44568e-02, -1.20382e-01, 4.42134e-01, 7.61181e-01, -1.43313e-01, 3.81111e-02, -6.43358e-03 }, // 47/128 - { -6.08674e-03, 3.49066e-02, -1.22185e-01, 4.52218e-01, 7.52958e-01, -1.43968e-01, 3.83800e-02, -6.48585e-03 }, // 48/128 - { -6.15644e-03, 3.53384e-02, -1.23933e-01, 4.62289e-01, 7.44637e-01, -1.44531e-01, 3.86247e-02, -6.53412e-03 }, // 49/128 - { -6.22280e-03, 3.57519e-02, -1.25624e-01, 4.72342e-01, 7.36222e-01, -1.45004e-01, 3.88454e-02, -6.57836e-03 }, // 50/128 - { -6.28577e-03, 3.61468e-02, -1.27258e-01, 4.82377e-01, 7.27714e-01, -1.45387e-01, 3.90420e-02, -6.61859e-03 }, // 51/128 - { -6.34530e-03, 3.65227e-02, -1.28832e-01, 4.92389e-01, 7.19116e-01, -1.45682e-01, 3.92147e-02, -6.65479e-03 }, // 52/128 - { -6.40135e-03, 3.68795e-02, -1.30347e-01, 5.02377e-01, 7.10431e-01, -1.45889e-01, 3.93636e-02, -6.68698e-03 }, // 53/128 - { -6.45388e-03, 3.72167e-02, -1.31800e-01, 5.12337e-01, 7.01661e-01, -1.46009e-01, 3.94886e-02, -6.71514e-03 }, // 54/128 - { -6.50285e-03, 3.75341e-02, -1.33190e-01, 5.22267e-01, 6.92808e-01, -1.46043e-01, 3.95900e-02, -6.73929e-03 }, // 55/128 - { -6.54823e-03, 3.78315e-02, -1.34515e-01, 5.32164e-01, 6.83875e-01, -1.45993e-01, 3.96678e-02, -6.75943e-03 }, // 56/128 - { -6.58996e-03, 3.81085e-02, -1.35775e-01, 5.42025e-01, 6.74865e-01, -1.45859e-01, 3.97222e-02, -6.77557e-03 }, // 57/128 - { -6.62802e-03, 3.83650e-02, -1.36969e-01, 5.51849e-01, 6.65779e-01, -1.45641e-01, 3.97532e-02, -6.78771e-03 }, // 58/128 - { -6.66238e-03, 3.86006e-02, -1.38094e-01, 5.61631e-01, 6.56621e-01, -1.45343e-01, 3.97610e-02, -6.79588e-03 }, // 59/128 - { -6.69300e-03, 3.88151e-02, -1.39150e-01, 5.71370e-01, 6.47394e-01, -1.44963e-01, 3.97458e-02, -6.80007e-03 }, // 60/128 - { -6.71985e-03, 3.90083e-02, -1.40136e-01, 5.81063e-01, 6.38099e-01, -1.44503e-01, 3.97077e-02, -6.80032e-03 }, // 61/128 - { -6.74291e-03, 3.91800e-02, -1.41050e-01, 5.90706e-01, 6.28739e-01, -1.43965e-01, 3.96469e-02, -6.79662e-03 }, // 62/128 - { -6.76214e-03, 3.93299e-02, -1.41891e-01, 6.00298e-01, 6.19318e-01, -1.43350e-01, 3.95635e-02, -6.78902e-03 }, // 63/128 - { -6.77751e-03, 3.94578e-02, -1.42658e-01, 6.09836e-01, 6.09836e-01, -1.42658e-01, 3.94578e-02, -6.77751e-03 }, // 64/128 - { -6.78902e-03, 3.95635e-02, -1.43350e-01, 6.19318e-01, 6.00298e-01, -1.41891e-01, 3.93299e-02, -6.76214e-03 }, // 65/128 - { -6.79662e-03, 3.96469e-02, -1.43965e-01, 6.28739e-01, 5.90706e-01, -1.41050e-01, 3.91800e-02, -6.74291e-03 }, // 66/128 - { -6.80032e-03, 3.97077e-02, -1.44503e-01, 6.38099e-01, 5.81063e-01, -1.40136e-01, 3.90083e-02, -6.71985e-03 }, // 67/128 - { -6.80007e-03, 3.97458e-02, -1.44963e-01, 6.47394e-01, 5.71370e-01, -1.39150e-01, 3.88151e-02, -6.69300e-03 }, // 68/128 - { -6.79588e-03, 3.97610e-02, -1.45343e-01, 6.56621e-01, 5.61631e-01, -1.38094e-01, 3.86006e-02, -6.66238e-03 }, // 69/128 - { -6.78771e-03, 3.97532e-02, -1.45641e-01, 6.65779e-01, 5.51849e-01, -1.36969e-01, 3.83650e-02, -6.62802e-03 }, // 70/128 - { -6.77557e-03, 3.97222e-02, -1.45859e-01, 6.74865e-01, 5.42025e-01, -1.35775e-01, 3.81085e-02, -6.58996e-03 }, // 71/128 - { -6.75943e-03, 3.96678e-02, -1.45993e-01, 6.83875e-01, 5.32164e-01, -1.34515e-01, 3.78315e-02, -6.54823e-03 }, // 72/128 - { -6.73929e-03, 3.95900e-02, -1.46043e-01, 6.92808e-01, 5.22267e-01, -1.33190e-01, 3.75341e-02, -6.50285e-03 }, // 73/128 - { -6.71514e-03, 3.94886e-02, -1.46009e-01, 7.01661e-01, 5.12337e-01, -1.31800e-01, 3.72167e-02, -6.45388e-03 }, // 74/128 - { -6.68698e-03, 3.93636e-02, -1.45889e-01, 7.10431e-01, 5.02377e-01, -1.30347e-01, 3.68795e-02, -6.40135e-03 }, // 75/128 - { -6.65479e-03, 3.92147e-02, -1.45682e-01, 7.19116e-01, 4.92389e-01, -1.28832e-01, 3.65227e-02, -6.34530e-03 }, // 76/128 - { -6.61859e-03, 3.90420e-02, -1.45387e-01, 7.27714e-01, 4.82377e-01, -1.27258e-01, 3.61468e-02, -6.28577e-03 }, // 77/128 - { -6.57836e-03, 3.88454e-02, -1.45004e-01, 7.36222e-01, 4.72342e-01, -1.25624e-01, 3.57519e-02, -6.22280e-03 }, // 78/128 - { -6.53412e-03, 3.86247e-02, -1.44531e-01, 7.44637e-01, 4.62289e-01, -1.23933e-01, 3.53384e-02, -6.15644e-03 }, // 79/128 - { -6.48585e-03, 3.83800e-02, -1.43968e-01, 7.52958e-01, 4.52218e-01, -1.22185e-01, 3.49066e-02, -6.08674e-03 }, // 80/128 - { -6.43358e-03, 3.81111e-02, -1.43313e-01, 7.61181e-01, 4.42134e-01, -1.20382e-01, 3.44568e-02, -6.01374e-03 }, // 81/128 - { -6.37730e-03, 3.78182e-02, -1.42566e-01, 7.69305e-01, 4.32038e-01, -1.18526e-01, 3.39894e-02, -5.93749e-03 }, // 82/128 - { -6.31703e-03, 3.75010e-02, -1.41727e-01, 7.77327e-01, 4.21934e-01, -1.16618e-01, 3.35046e-02, -5.85804e-03 }, // 83/128 - { -6.25277e-03, 3.71596e-02, -1.40794e-01, 7.85244e-01, 4.11823e-01, -1.14659e-01, 3.30027e-02, -5.77544e-03 }, // 84/128 - { -6.18454e-03, 3.67941e-02, -1.39767e-01, 7.93055e-01, 4.01710e-01, -1.12650e-01, 3.24843e-02, -5.68976e-03 }, // 85/128 - { -6.11236e-03, 3.64044e-02, -1.38644e-01, 8.00757e-01, 3.91596e-01, -1.10593e-01, 3.19495e-02, -5.60103e-03 }, // 86/128 - { -6.03624e-03, 3.59905e-02, -1.37426e-01, 8.08348e-01, 3.81484e-01, -1.08490e-01, 3.13987e-02, -5.50931e-03 }, // 87/128 - { -5.95620e-03, 3.55525e-02, -1.36111e-01, 8.15826e-01, 3.71376e-01, -1.06342e-01, 3.08323e-02, -5.41467e-03 }, // 88/128 - { -5.87227e-03, 3.50903e-02, -1.34699e-01, 8.23188e-01, 3.61276e-01, -1.04150e-01, 3.02507e-02, -5.31716e-03 }, // 89/128 - { -5.78446e-03, 3.46042e-02, -1.33189e-01, 8.30432e-01, 3.51186e-01, -1.01915e-01, 2.96543e-02, -5.21683e-03 }, // 90/128 - { -5.69280e-03, 3.40940e-02, -1.31581e-01, 8.37557e-01, 3.41109e-01, -9.96402e-02, 2.90433e-02, -5.11376e-03 }, // 91/128 - { -5.59731e-03, 3.35600e-02, -1.29874e-01, 8.44559e-01, 3.31048e-01, -9.73254e-02, 2.84182e-02, -5.00800e-03 }, // 92/128 - { -5.49804e-03, 3.30021e-02, -1.28068e-01, 8.51437e-01, 3.21004e-01, -9.49727e-02, 2.77794e-02, -4.89961e-03 }, // 93/128 - { -5.39500e-03, 3.24205e-02, -1.26161e-01, 8.58189e-01, 3.10980e-01, -9.25834e-02, 2.71272e-02, -4.78866e-03 }, // 94/128 - { -5.28823e-03, 3.18153e-02, -1.24154e-01, 8.64812e-01, 3.00980e-01, -9.01591e-02, 2.64621e-02, -4.67520e-03 }, // 95/128 - { -5.17776e-03, 3.11866e-02, -1.22047e-01, 8.71305e-01, 2.91006e-01, -8.77011e-02, 2.57844e-02, -4.55932e-03 }, // 96/128 - { -5.06363e-03, 3.05345e-02, -1.19837e-01, 8.77666e-01, 2.81060e-01, -8.52109e-02, 2.50946e-02, -4.44107e-03 }, // 97/128 - { -4.94589e-03, 2.98593e-02, -1.17526e-01, 8.83893e-01, 2.71144e-01, -8.26900e-02, 2.43930e-02, -4.32052e-03 }, // 98/128 - { -4.82456e-03, 2.91609e-02, -1.15113e-01, 8.89984e-01, 2.61263e-01, -8.01399e-02, 2.36801e-02, -4.19774e-03 }, // 99/128 - { -4.69970e-03, 2.84397e-02, -1.12597e-01, 8.95936e-01, 2.51417e-01, -7.75620e-02, 2.29562e-02, -4.07279e-03 }, // 100/128 - { -4.57135e-03, 2.76957e-02, -1.09978e-01, 9.01749e-01, 2.41609e-01, -7.49577e-02, 2.22218e-02, -3.94576e-03 }, // 101/128 - { -4.43955e-03, 2.69293e-02, -1.07256e-01, 9.07420e-01, 2.31843e-01, -7.23286e-02, 2.14774e-02, -3.81671e-03 }, // 102/128 - { -4.30435e-03, 2.61404e-02, -1.04430e-01, 9.12947e-01, 2.22120e-01, -6.96762e-02, 2.07233e-02, -3.68570e-03 }, // 103/128 - { -4.16581e-03, 2.53295e-02, -1.01501e-01, 9.18329e-01, 2.12443e-01, -6.70018e-02, 1.99599e-02, -3.55283e-03 }, // 104/128 - { -4.02397e-03, 2.44967e-02, -9.84679e-02, 9.23564e-01, 2.02814e-01, -6.43069e-02, 1.91877e-02, -3.41815e-03 }, // 105/128 - { -3.87888e-03, 2.36423e-02, -9.53307e-02, 9.28650e-01, 1.93236e-01, -6.15931e-02, 1.84071e-02, -3.28174e-03 }, // 106/128 - { -3.73062e-03, 2.27664e-02, -9.20893e-02, 9.33586e-01, 1.83711e-01, -5.88617e-02, 1.76185e-02, -3.14367e-03 }, // 107/128 - { -3.57923e-03, 2.18695e-02, -8.87435e-02, 9.38371e-01, 1.74242e-01, -5.61142e-02, 1.68225e-02, -3.00403e-03 }, // 108/128 - { -3.42477e-03, 2.09516e-02, -8.52933e-02, 9.43001e-01, 1.64831e-01, -5.33522e-02, 1.60193e-02, -2.86289e-03 }, // 109/128 - { -3.26730e-03, 2.00132e-02, -8.17385e-02, 9.47477e-01, 1.55480e-01, -5.05770e-02, 1.52095e-02, -2.72032e-03 }, // 110/128 - { -3.10689e-03, 1.90545e-02, -7.80792e-02, 9.51795e-01, 1.46192e-01, -4.77900e-02, 1.43934e-02, -2.57640e-03 }, // 111/128 - { -2.94361e-03, 1.80759e-02, -7.43154e-02, 9.55956e-01, 1.36968e-01, -4.49929e-02, 1.35716e-02, -2.43121e-03 }, // 112/128 - { -2.77751e-03, 1.70776e-02, -7.04471e-02, 9.59958e-01, 1.27812e-01, -4.21869e-02, 1.27445e-02, -2.28483e-03 }, // 113/128 - { -2.60868e-03, 1.60599e-02, -6.64743e-02, 9.63798e-01, 1.18725e-01, -3.93735e-02, 1.19125e-02, -2.13733e-03 }, // 114/128 - { -2.43718e-03, 1.50233e-02, -6.23972e-02, 9.67477e-01, 1.09710e-01, -3.65541e-02, 1.10760e-02, -1.98880e-03 }, // 115/128 - { -2.26307e-03, 1.39681e-02, -5.82159e-02, 9.70992e-01, 1.00769e-01, -3.37303e-02, 1.02356e-02, -1.83931e-03 }, // 116/128 - { -2.08645e-03, 1.28947e-02, -5.39305e-02, 9.74342e-01, 9.19033e-02, -3.09033e-02, 9.39154e-03, -1.68894e-03 }, // 117/128 - { -1.90738e-03, 1.18034e-02, -4.95412e-02, 9.77526e-01, 8.31162e-02, -2.80746e-02, 8.54441e-03, -1.53777e-03 }, // 118/128 - { -1.72594e-03, 1.06946e-02, -4.50483e-02, 9.80543e-01, 7.44095e-02, -2.52457e-02, 7.69462e-03, -1.38589e-03 }, // 119/128 - { -1.54221e-03, 9.56876e-03, -4.04519e-02, 9.83392e-01, 6.57852e-02, -2.24178e-02, 6.84261e-03, -1.23337e-03 }, // 120/128 - { -1.35627e-03, 8.42626e-03, -3.57525e-02, 9.86071e-01, 5.72454e-02, -1.95925e-02, 5.98883e-03, -1.08030e-03 }, // 121/128 - { -1.16820e-03, 7.26755e-03, -3.09503e-02, 9.88580e-01, 4.87921e-02, -1.67710e-02, 5.13372e-03, -9.26747e-04 }, // 122/128 - { -9.78093e-04, 6.09305e-03, -2.60456e-02, 9.90917e-01, 4.04274e-02, -1.39548e-02, 4.27773e-03, -7.72802e-04 }, // 123/128 - { -7.86031e-04, 4.90322e-03, -2.10389e-02, 9.93082e-01, 3.21531e-02, -1.11453e-02, 3.42130e-03, -6.18544e-04 }, // 124/128 - { -5.92100e-04, 3.69852e-03, -1.59305e-02, 9.95074e-01, 2.39714e-02, -8.34364e-03, 2.56486e-03, -4.64053e-04 }, // 125/128 - { -3.96391e-04, 2.47942e-03, -1.07209e-02, 9.96891e-01, 1.58840e-02, -5.55134e-03, 1.70888e-03, -3.09412e-04 }, // 126/128 - { -1.98993e-04, 1.24642e-03, -5.41054e-03, 9.98534e-01, 7.89295e-03, -2.76968e-03, 8.53777e-04, -1.54700e-04 }, // 127/128 - { 0.00000e+00, 0.00000e+00, 0.00000e+00, 1.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00 }, // 128/128 -}; - diff --git a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc deleted file mode 100644 index 0d7b878da5..0000000000 --- a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.cc +++ /dev/null @@ -1,341 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <cppunit/TestAssert.h> -#include <qa_ccomplex_dotprod_x86.h> -#include <ccomplex_dotprod_x86.h> -#include <string.h> -#include <iostream> -#include <malloc16.h> -#include <sse_debug.h> -#include <cmath> -#include <gr_cpu.h> -#include <random.h> - -using std::cerr; - -/// Macro for primitive value comparisons -#define assertcomplexEqual(expected0,expected1,actual,delta) \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected0, actual[0], delta); \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected1, actual[1], delta); - - -#define MAX_BLKS 10 -#define FLOATS_PER_BLK 4 - -#define ERR_DELTA (1e-6) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = rint (uniform () * 32767); -} - -static void -zero_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0.0; -} - -void -ref_ccomplex_dotprod (const float *input, - const float *taps, unsigned n_2_ccomplex_blocks, - float *result) -{ - float sum0[2] = {0,0}; - float sum1[2] = {0,0}; - - do { - - sum0[0] += input[0] * taps[0] - input[1] * taps[1]; - sum0[1] += input[0] * taps[1] + input[1] * taps[0]; - sum1[0] += input[2] * taps[2] - input[3] * taps[3]; - sum1[1] += input[2] * taps[3] + input[3] * taps[2]; - - input += 4; - taps += 4; - - } while (--n_2_ccomplex_blocks != 0); - - - result[0] = sum0[0] + sum1[0]; - result[1] = sum0[1] + sum1[1]; -} - -void -qa_ccomplex_dotprod_x86::setUp () -{ - taps = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - input = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - if (taps == 0 || input == 0) - abort (); -} - -void -qa_ccomplex_dotprod_x86::tearDown () -{ - free16Align (taps); - free16Align (input); - taps = 0; - input = 0; -} - - -void -qa_ccomplex_dotprod_x86::zb () // "zero both" -{ - zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - zero_floats (input, MAX_BLKS * FLOATS_PER_BLK); -} - -// -// t1 -// - -void -qa_ccomplex_dotprod_x86::t1_base (ccomplex_dotprod_t ccomplex_dotprod) -{ - float result[2]; - - // cerr << "Testing dump_xmm_regs\n"; - // dump_xmm_regs (); - - // test basic cases, 1 block - - zb (); - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.0, 0.0, result, ERR_DELTA); - - // vary each input - - zb (); - input[0] = 1.0; taps[0] = 1.0; taps[1] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - //cerr << result[0] << " " << result[1] << "\n"; - assertcomplexEqual (1.0, -1.0, result, ERR_DELTA); - - zb (); - input[1] = 2.0; taps[0] = 1.0; taps[1] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, 2.0, result, ERR_DELTA); - - zb (); - input[2] = 3.0; taps[2] = 1.0; taps[3] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[3] = 4.0; taps[2] = 1.0; taps[3] = -1.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (4.0, 4.0, result, ERR_DELTA); - - // vary each tap - - zb (); - input[0] = 1.0; taps[0] = 0.5; taps[1] = -0.5; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.5, -0.5, result, ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 2.0; taps[1] = -2.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, -2.0, result, ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 3.0; taps[1] = -3.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 4.0; taps[1] = -4.0; - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (4.0, -4.0, result, ERR_DELTA); -} - -// -// t2 -// -void -qa_ccomplex_dotprod_x86::t2_base (ccomplex_dotprod_t ccomplex_dotprod) -{ - float result[2]; - - zb (); - input[0] = 1.0; input[1] = 3.0; taps[0] = 5.0; taps[1] = -2.0; - - //1*5-3*-2 =11, 1*-2+3*5=13 - - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (11.0, 13.0, result, ERR_DELTA); - - //7*5-13*-5 =100, 7*-5+13*5=30 - - input[2] = 7.0; input[3] = 13.0; taps[2] = 5.0; taps[3] = -5.0; - - ccomplex_dotprod (input, taps, 1, result); - assertcomplexEqual (111.0, 43.0, result, ERR_DELTA); - - input[4] = 19; input[5] = -19; taps[4] = 23.0; taps[5] = -23.0; - - //19*23--19*-23 =0, 19*-23+-19*23=-874 - - ccomplex_dotprod (input, taps, 2, result); - assertcomplexEqual (111.0, -831.0, result, ERR_DELTA); - -} - -// -// t3 -// -void -qa_ccomplex_dotprod_x86::t3_base (ccomplex_dotprod_t ccomplex_dotprod) -{ - srandom (0); // we want reproducibility - - for (unsigned int i = 0; i < 10; i++){ - random_floats (input, MAX_BLKS * FLOATS_PER_BLK); - random_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - float ref[2]; - ref_ccomplex_dotprod (input, taps, MAX_BLKS, ref); - float calc[2]; - ccomplex_dotprod (input, taps, MAX_BLKS, calc); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[0], - calc[0], - fabs (ref[0]) * 1e-4); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[1], - calc[1], - fabs (ref[1]) * 1e-4); - } -} - -void -qa_ccomplex_dotprod_x86::t1_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t1_base (ccomplex_dotprod_3dnowext); -} - -void -qa_ccomplex_dotprod_x86::t2_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t2_base (ccomplex_dotprod_3dnowext); -} - -void -qa_ccomplex_dotprod_x86::t3_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t3_base (ccomplex_dotprod_3dnowext); -} - -void -qa_ccomplex_dotprod_x86::t1_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t1_base (ccomplex_dotprod_3dnow); -} - -void -qa_ccomplex_dotprod_x86::t2_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t2_base (ccomplex_dotprod_3dnow); -} - -void -qa_ccomplex_dotprod_x86::t3_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t3_base (ccomplex_dotprod_3dnow); -} - -void -qa_ccomplex_dotprod_x86::t1_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t1_base (ccomplex_dotprod_sse); -} - -void -qa_ccomplex_dotprod_x86::t2_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t2_base (ccomplex_dotprod_sse); -} - -void -qa_ccomplex_dotprod_x86::t3_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t3_base (ccomplex_dotprod_sse); -} - diff --git a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h deleted file mode 100644 index d24561c72b..0000000000 --- a/gnuradio-core/src/lib/filter/qa_ccomplex_dotprod_x86.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_CCOMPLEX_DOTPROD_X86_H_ -#define _QA_CCOMPLEX_DOTPROD_X86_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_ccomplex_dotprod_x86 : public CppUnit::TestCase { - public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_ccomplex_dotprod_x86); - CPPUNIT_TEST (t1_3dnowext); - CPPUNIT_TEST (t2_3dnowext); - CPPUNIT_TEST (t3_3dnowext); - CPPUNIT_TEST (t1_3dnow); - CPPUNIT_TEST (t2_3dnow); - CPPUNIT_TEST (t3_3dnow); - CPPUNIT_TEST (t1_sse); - CPPUNIT_TEST (t2_sse); - CPPUNIT_TEST (t3_sse); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1_3dnowext (); - void t2_3dnowext (); - void t3_3dnowext (); - void t1_3dnow (); - void t2_3dnow (); - void t3_3dnow (); - void t1_sse (); - void t2_sse (); - void t3_sse (); - - - typedef void (*ccomplex_dotprod_t)(const float *input, - const float *taps, - unsigned n_2_ccomplex_blocks, - float *result); - - void t1_base (ccomplex_dotprod_t); - void t2_base (ccomplex_dotprod_t); - void t3_base (ccomplex_dotprod_t); - - void zb (); - - float *taps; // 16-byte aligned - float *input; // 16-byte aligned -}; - - -#endif /* _QA_CCOMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc deleted file mode 100644 index a21b95f633..0000000000 --- a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.cc +++ /dev/null @@ -1,347 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <cppunit/TestAssert.h> -#include <qa_complex_dotprod_x86.h> -#include <complex_dotprod_x86.h> -#include <string.h> -#include <iostream> -#include <malloc16.h> -#include <sse_debug.h> -#include <cmath> -#include <gr_cpu.h> -#include <random.h> - -using std::cerr; - -/// Macro for primitive value comparisons -#define assertcomplexEqual(expected0,expected1,actual,delta) \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected0, actual[0], delta); \ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected1, actual[1], delta); - - -#define MAX_BLKS 10 -#define FLOATS_PER_BLK 4 -#define SHORTS_PER_BLK 2 - -#define ERR_DELTA (1e-6) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = rint (uniform () * 32767); -} - -static void -zero_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0.0; -} - -static void -random_shorts (short *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (short) rint (uniform () * 32767); -} - -static void -zero_shorts (short *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0; -} - -void -ref_complex_dotprod (const short *input, - const float *taps, unsigned n_2_complex_blocks, - float *result) -{ - float sum0[2] = {0,0}; - float sum1[2] = {0,0}; - - do { - - sum0[0] += input[0] * taps[0]; - sum0[1] += input[0] * taps[1]; - sum1[0] += input[1] * taps[2]; - sum1[1] += input[1] * taps[3]; - - input += 2; - taps += 4; - - } while (--n_2_complex_blocks != 0); - - - result[0] = sum0[0] + sum1[0]; - result[1] = sum0[1] + sum1[1]; -} - -void -qa_complex_dotprod_x86::setUp () -{ - taps = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - input = (short *) calloc16Align (MAX_BLKS, - sizeof (short) * SHORTS_PER_BLK); - - if (taps == 0 || input == 0) - abort (); -} - -void -qa_complex_dotprod_x86::tearDown () -{ - free16Align (taps); - free16Align (input); - taps = 0; - input = 0; -} - - -void -qa_complex_dotprod_x86::zb () // "zero both" -{ - zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - zero_shorts (input, MAX_BLKS * SHORTS_PER_BLK); -} - -// -// t1 -// - -void -qa_complex_dotprod_x86::t1_base (complex_dotprod_t complex_dotprod) -{ - float result[2]; - - // cerr << "Testing dump_xmm_regs\n"; - // dump_xmm_regs (); - - // test basic cases, 1 block - - zb (); - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.0, 0.0, result, ERR_DELTA); - - // vary each input - - zb (); - input[0] = 1; taps[0] = 1.0; taps[1] = -1.0; - complex_dotprod (input, taps, 1, result); - //cerr << result[0] << " " << result[1] << "\n"; - assertcomplexEqual (1.0, -1.0, result, ERR_DELTA); - - zb (); - input[1] = 2; taps[2] = 1.0; taps[3] = -1.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, -2.0, result, ERR_DELTA); - - zb (); - input[2] = 3; taps[4] = 1.0; taps[5] = -1.0; - complex_dotprod (input, taps, 2, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[3] = 4; taps[6] = 1.0; taps[7] = -1.0; - complex_dotprod (input, taps, 2, result); - assertcomplexEqual (4.0, -4.0, result, ERR_DELTA); - - // vary each tap - - zb (); - input[0] = 1; taps[0] = 0.5; taps[1] = -0.5; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (0.5, -0.5, result, ERR_DELTA); - - zb (); - input[0] = 1; taps[0] = 2.0; taps[1] = -2.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (2.0, -2.0, result, ERR_DELTA); - - zb (); - input[0] = 1; taps[0] = 3.0; taps[1] = -3.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (3.0, -3.0, result, ERR_DELTA); - - zb (); - input[0] = 1; taps[0] = 4.0; taps[1] = -4.0; - complex_dotprod (input, taps, 1, result); - assertcomplexEqual (4.0, -4.0, result, ERR_DELTA); -} - -// -// t2 -// -void -qa_complex_dotprod_x86::t2_base (complex_dotprod_t complex_dotprod) -{ - float result[2]; - - zb (); - input[0] = 1; taps[0] = 2.0; taps[1] = -2.0; - input[1] = 3; taps[2] = 5.0; taps[3] = -5.0; - input[2] = 7; taps[4] = 11.0; taps[5] = -11.0; - input[3] = 13; taps[6] = 17.0; taps[7] = -17.0; - - complex_dotprod (input, taps, 2, result); - assertcomplexEqual (315.0, -315.0, result, ERR_DELTA); - - input[4] = 19; taps[8] = 23.0; taps[9] = -23.0; - complex_dotprod (input, taps, 3, result); - assertcomplexEqual (752.0, -752.0, result, ERR_DELTA); - -} - -// -// t3 -// -void -qa_complex_dotprod_x86::t3_base (complex_dotprod_t complex_dotprod) -{ - srandom (0); // we want reproducibility - - for (unsigned int i = 0; i < 10; i++){ - random_shorts (input, MAX_BLKS * SHORTS_PER_BLK); - random_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - float ref[2]; - ref_complex_dotprod (input, taps, MAX_BLKS, ref); - float calc[2]; - complex_dotprod (input, taps, MAX_BLKS, calc); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[0], - calc[0], - fabs (ref[0]) * 1e-4); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref[1], - calc[1], - fabs (ref[1]) * 1e-4); - } -} - -void -qa_complex_dotprod_x86::t1_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t1_base (complex_dotprod_3dnowext); -} - -void -qa_complex_dotprod_x86::t2_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t2_base (complex_dotprod_3dnowext); -} - -void -qa_complex_dotprod_x86::t3_3dnowext () -{ - if (!gr_cpu::has_3dnowext ()){ - cerr << "No 3DNow!Ext support; not tested\n"; - } - else - t3_base (complex_dotprod_3dnowext); -} - -void -qa_complex_dotprod_x86::t1_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t1_base (complex_dotprod_3dnow); -} - -void -qa_complex_dotprod_x86::t2_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t2_base (complex_dotprod_3dnow); -} - -void -qa_complex_dotprod_x86::t3_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t3_base (complex_dotprod_3dnow); -} - -void -qa_complex_dotprod_x86::t1_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t1_base (complex_dotprod_sse); -} - -void -qa_complex_dotprod_x86::t2_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t2_base (complex_dotprod_sse); -} - -void -qa_complex_dotprod_x86::t3_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t3_base (complex_dotprod_sse); -} - diff --git a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h deleted file mode 100644 index 9f9b460399..0000000000 --- a/gnuradio-core/src/lib/filter/qa_complex_dotprod_x86.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_COMPLEX_DOTPROD_X86_H_ -#define _QA_COMPLEX_DOTPROD_X86_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_complex_dotprod_x86 : public CppUnit::TestCase { - public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_complex_dotprod_x86); - CPPUNIT_TEST (t1_3dnowext); - CPPUNIT_TEST (t2_3dnowext); - CPPUNIT_TEST (t3_3dnowext); - CPPUNIT_TEST (t1_3dnow); - CPPUNIT_TEST (t2_3dnow); - CPPUNIT_TEST (t3_3dnow); - CPPUNIT_TEST (t1_sse); - CPPUNIT_TEST (t2_sse); - CPPUNIT_TEST (t3_sse); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1_3dnowext (); - void t2_3dnowext (); - void t3_3dnowext (); - void t1_3dnow (); - void t2_3dnow (); - void t3_3dnow (); - void t1_sse (); - void t2_sse (); - void t3_sse (); - - - typedef void (*complex_dotprod_t)(const short *input, - const float *taps, - unsigned n_2_complex_blocks, - float *result); - - void t1_base (complex_dotprod_t); - void t2_base (complex_dotprod_t); - void t3_base (complex_dotprod_t); - - void zb (); - - float *taps; // 16-byte aligned - short *input; // 16-byte aligned -}; - - -#endif /* _QA_COMPLEX_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_dotprod.h b/gnuradio-core/src/lib/filter/qa_dotprod.h deleted file mode 100644 index bd5ba8f3ae..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_DOTPROD_H_ -#define _QA_DOTPROD_H_ - -#include <cppunit/TestSuite.h> - -CppUnit::TestSuite *qa_dotprod_suite (); - -#endif // _QA_DOTPROD_H_ - diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc b/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc deleted file mode 100644 index 1e1ded7ea1..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_armv7_a.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#include "qa_dotprod.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - // empty test suite - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc b/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc deleted file mode 100644 index 2c49d1d28f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_generic.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#include "qa_dotprod.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - // empty test suite - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc b/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc deleted file mode 100644 index 2c49d1d28f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_powerpc.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#include "qa_dotprod.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - // empty test suite - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc deleted file mode 100644 index ec5625f10c..0000000000 --- a/gnuradio-core/src/lib/filter/qa_dotprod_x86.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#include "qa_dotprod.h" -#include "qa_float_dotprod_x86.h" -#include "qa_complex_dotprod_x86.h" -#include "qa_ccomplex_dotprod_x86.h" - -CppUnit::TestSuite * -qa_dotprod_suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("dotprod"); - - s->addTest (qa_float_dotprod_x86::suite ()); - s->addTest (qa_complex_dotprod_x86::suite ()); - s->addTest (qa_ccomplex_dotprod_x86::suite ()); - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_filter.cc b/gnuradio-core/src/lib/filter/qa_filter.cc deleted file mode 100644 index 6296350845..0000000000 --- a/gnuradio-core/src/lib/filter/qa_filter.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2002,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * This class gathers together all the test cases for the gr - * directory into a single test suite. As you create new test cases, - * add them here. - */ - -#include <qa_filter.h> -#include <qa_gr_fir_ccf.h> -#include <qa_gr_fir_fff.h> -#include <qa_gr_fir_ccc.h> -#include <qa_gr_fir_fcc.h> -#include <qa_gr_fir_scc.h> -#include <qa_gr_firdes.h> -#include <qa_dotprod.h> -#include <qa_gri_mmse_fir_interpolator.h> -#include <qa_gri_mmse_fir_interpolator_cc.h> -#include <qa_gr_rotator.h> -#include <qa_gri_fir_filter_with_buffer_ccf.h> -#include <qa_gri_fir_filter_with_buffer_ccc.h> -#include <qa_gri_fir_filter_with_buffer_fcc.h> -#include <qa_gri_fir_filter_with_buffer_fff.h> -#include <qa_gri_fir_filter_with_buffer_fsf.h> -#include <qa_gri_fir_filter_with_buffer_scc.h> - -CppUnit::TestSuite * -qa_filter::suite () -{ - CppUnit::TestSuite *s = new CppUnit::TestSuite ("filter"); - - s->addTest (qa_dotprod_suite ()); - s->addTest (qa_gr_fir_fff::suite ()); - s->addTest (qa_gr_fir_ccc::suite ()); - s->addTest (qa_gr_fir_fcc::suite ()); - s->addTest (qa_gr_fir_scc::suite ()); - s->addTest (qa_gr_fir_ccf::suite ()); - s->addTest (qa_gri_mmse_fir_interpolator::suite ()); - s->addTest (qa_gri_mmse_fir_interpolator_cc::suite ()); - s->addTest (qa_gr_rotator::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_ccf::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_ccc::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_fcc::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_fff::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_fsf::suite ()); - s->addTest (qa_gri_fir_filter_with_buffer_scc::suite ()); - - return s; -} diff --git a/gnuradio-core/src/lib/filter/qa_filter.h b/gnuradio-core/src/lib/filter/qa_filter.h deleted file mode 100644 index 740d05ce40..0000000000 --- a/gnuradio-core/src/lib/filter/qa_filter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _QA_FILTER_H_ -#define _QA_FILTER_H_ - -#include <gruel/attributes.h> -#include <cppunit/TestSuite.h> - -//! collect all the tests for the gr directory - -class __GR_ATTR_EXPORT qa_filter { - public: - //! return suite of tests for all of gr directory - static CppUnit::TestSuite *suite (); -}; - - -#endif /* _QA_FILTER_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc deleted file mode 100644 index f8752d0716..0000000000 --- a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.cc +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <cppunit/TestAssert.h> -#include <qa_float_dotprod_x86.h> -#include <float_dotprod_x86.h> -#include <string.h> -#include <iostream> -#include <malloc16.h> -#include <sse_debug.h> -#include <cmath> -#include <gr_cpu.h> -#include <random.h> - -using std::cerr; - - -#define MAX_BLKS 10 -#define FLOATS_PER_BLK 4 - -#define ERR_DELTA (1e-6) - - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = random () - RANDOM_MAX/2; -} - -static void -zero_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = 0.0; -} - -float -ref_float_dotprod (const float *input, - const float *taps, unsigned n_4_float_blocks) -{ - float sum0 = 0; - float sum1 = 0; - float sum2 = 0; - float sum3 = 0; - - do { - - sum0 += input[0] * taps[0]; - sum1 += input[1] * taps[1]; - sum2 += input[2] * taps[2]; - sum3 += input[3] * taps[3]; - - input += 4; - taps += 4; - - } while (--n_4_float_blocks != 0); - - - return sum0 + sum1 + sum2 + sum3; -} - -void -qa_float_dotprod_x86::setUp () -{ - taps = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - input = (float *) calloc16Align (MAX_BLKS, - sizeof (float) * FLOATS_PER_BLK); - - if (taps == 0 || input == 0) - abort (); -} - -void -qa_float_dotprod_x86::tearDown () -{ - free16Align (taps); - free16Align (input); - taps = 0; - input = 0; -} - - -void -qa_float_dotprod_x86::zb () // "zero both" -{ - zero_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - zero_floats (input, MAX_BLKS * FLOATS_PER_BLK); -} - -// -// t1 -// - -void -qa_float_dotprod_x86::t1_base (float_dotprod_t float_dotprod) -{ - - // cerr << "Testing dump_xmm_regs\n"; - // dump_xmm_regs (); - - // test basic cases, 1 block - - zb (); - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.0, float_dotprod (input, taps, 1), ERR_DELTA); - - // vary each input - - zb (); - input[0] = 0.5; taps[0] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[1] = 2.0; taps[1] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (2.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[2] = 3.0; taps[2] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[3] = 4.0; taps[3] = 1.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, float_dotprod (input, taps, 1), ERR_DELTA); - - // vary each tap - - zb (); - input[0] = 1.0; taps[0] = 0.5; - CPPUNIT_ASSERT_DOUBLES_EQUAL (0.5, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 2.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (2.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 3.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0, float_dotprod (input, taps, 1), ERR_DELTA); - - zb (); - input[0] = 1.0; taps[0] = 4.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, float_dotprod (input, taps, 1), ERR_DELTA); -} - -// -// t2 -// -void -qa_float_dotprod_x86::t2_base (float_dotprod_t float_dotprod) -{ - zb (); - input[0] = 1.0; taps[0] = 2.0; - input[1] = 3.0; taps[1] = 5.0; - input[2] = 7.0; taps[2] = 11.0; - input[3] = 13.0; taps[3] = 17.0; - - CPPUNIT_ASSERT_DOUBLES_EQUAL (315.0, float_dotprod (input, taps, 1), ERR_DELTA); - - input[4] = 19.0; taps[4] = 23.0; - CPPUNIT_ASSERT_DOUBLES_EQUAL (752.0, float_dotprod (input, taps, 2), ERR_DELTA); - -} - -// -// t3 -// -void -qa_float_dotprod_x86::t3_base (float_dotprod_t float_dotprod) -{ - srandom (0); // we want reproducibility - - for (unsigned int i = 0; i < 10; i++){ - random_floats (input, MAX_BLKS * FLOATS_PER_BLK); - random_floats (taps, MAX_BLKS * FLOATS_PER_BLK); - - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - float ref = ref_float_dotprod (input, taps, MAX_BLKS); - CPPUNIT_ASSERT_DOUBLES_EQUAL (ref, - float_dotprod (input, taps, MAX_BLKS), - fabs (ref) * 1e-4); - } -} - -void -qa_float_dotprod_x86::t1_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t1_base (float_dotprod_3dnow); -} - -void -qa_float_dotprod_x86::t2_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t2_base (float_dotprod_3dnow); -} - -void -qa_float_dotprod_x86::t3_3dnow () -{ - if (!gr_cpu::has_3dnow ()){ - cerr << "No 3DNow! support; not tested\n"; - } - else - t3_base (float_dotprod_3dnow); -} - -void -qa_float_dotprod_x86::t1_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t1_base (float_dotprod_sse); -} - -void -qa_float_dotprod_x86::t2_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t2_base (float_dotprod_sse); -} - -void -qa_float_dotprod_x86::t3_sse () -{ - if (!gr_cpu::has_sse ()){ - cerr << "No SSE support; not tested\n"; - } - else - t3_base (float_dotprod_sse); -} diff --git a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h b/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h deleted file mode 100644 index 38d6104fab..0000000000 --- a/gnuradio-core/src/lib/filter/qa_float_dotprod_x86.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_FLOAT_DOTPROD_X86_H_ -#define _QA_FLOAT_DOTPROD_X86_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_float_dotprod_x86 : public CppUnit::TestCase { - public: - void setUp (); - void tearDown (); - - CPPUNIT_TEST_SUITE (qa_float_dotprod_x86); - CPPUNIT_TEST (t1_3dnow); - CPPUNIT_TEST (t2_3dnow); - CPPUNIT_TEST (t3_3dnow); - CPPUNIT_TEST (t1_sse); - CPPUNIT_TEST (t2_sse); - CPPUNIT_TEST (t3_sse); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1_3dnow (); - void t2_3dnow (); - void t3_3dnow (); - void t1_sse (); - void t2_sse (); - void t3_sse (); - - - typedef float (*float_dotprod_t)(const float *input, - const float *taps, - unsigned n_4_float_blocks); - - void t1_base (float_dotprod_t); - void t2_base (float_dotprod_t); - void t3_base (float_dotprod_t); - - - void zb (); - - float *taps; // 16-byte aligned - float *input; // 16-byte aligned - -}; - - -#endif /* _QA_FLOAT_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc deleted file mode 100644 index 7474b76e25..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.cc +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_ccc.h> -#include <gr_fir_ccc.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_input (i_type *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (i_type) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Our SIMD ccc kernel requires that the complex input be 64-bit (8-byte) aligned. - // i_type input[INPUT_LEN]; - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_input (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_ccc *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], - actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } - free16Align(input); -} - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_ccc_info> info; - gr_fir_util::get_gr_fir_ccc_info (&info); // get all known ccc implementations - - for (std::vector<gr_fir_ccc_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_ccc::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h deleted file mode 100644 index 0535e66528..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GR_FIR_CCC_H_ -#define _QA_GR_FIR_CCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_ccc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_ccc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - - -#endif /* _QA_GR_FIR_CCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc deleted file mode 100644 index 84cb924aea..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.cc +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef float tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_ccf.h> -#include <gr_fir_ccf.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<tap_type> &taps); - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Our SIMD ccc kernel requires that the complex input be 64-bit (8-byte) aligned. - //i_type input[INPUT_LEN]; - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_complex (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_ccf *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } - free16Align(input); -} - - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_ccf_info> info; - gr_fir_util::get_gr_fir_ccf_info (&info); // get all known ccf implementations - - for (std::vector<gr_fir_ccf_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - - -void -qa_gr_fir_ccf::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h b/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h deleted file mode 100644 index bda79cc2fa..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_ccf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GR_FIR_CCF_H_ -#define _QA_GR_FIR_CCF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_ccf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_ccf); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1 (); - // void t2 (); - // void t3 (); - -}; - - -#endif /* _QA_GR_FIR_CCF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc deleted file mode 100644 index 4c77a5e5c0..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef float i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_fcc.h> -#include <gr_fir_fcc.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <string.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_input (i_type *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (i_type) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - i_type input[INPUT_LEN]; - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_input (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_fcc *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], - actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } -} - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_fcc_info> info; - gr_fir_util::get_gr_fir_fcc_info (&info); // get all known fcc implementations - - for (std::vector<gr_fir_fcc_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_fcc::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h deleted file mode 100644 index 23706fd9c1..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GR_FIR_FCC_H_ -#define _QA_GR_FIR_FCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_fcc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_fcc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1 (); -}; - - -#endif /* _QA_GR_FIR_FCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc deleted file mode 100644 index 80ed674658..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_gr_fir_fff.h> -#include <gr_fir_fff.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <string.h> - -using std::vector; - -typedef float i_type; -typedef float o_type; -typedef float tap_type; -typedef float acc_type; - -#define ERR_DELTA (1e-6) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_fff* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -// ---------------------------------------------------------------- - -const static i_type input_1[] = { - 234, -4, 23, -56, 45, 98, -23, -7 -}; - -const static tap_type taps_1a[] = { - -3 -}; - -const static o_type expected_1a[] = { - -702, 12, -69, 168, -135, -294, 69, 21 -}; - -const static tap_type taps_1b[] = { - -4, 5 -}; - -const static o_type expected_1b[] = { - 1186, -112, 339, -460, -167, 582, -87 -}; - -// ---------------------------------------------------------------- - -static void -test_known_io (fir_maker_t maker) -{ - vector<tap_type> t1a (&taps_1a[0], &taps_1a[NELEM (taps_1a)]); - vector<tap_type> t1b (&taps_1b[0], &taps_1b[NELEM (taps_1b)]); - - gr_fir_fff *f1 = maker (t1a); // create filter - CPPUNIT_ASSERT_EQUAL ((unsigned) 1, f1->ntaps ()); // check ntaps - - // check filter output - int n = NELEM (input_1) - f1->ntaps () + 1; - for (int i = 0; i < n; i++) - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1a[i], f1->filter (&input_1[i]), ERR_DELTA); - - f1->set_taps (t1b); // set new taps - CPPUNIT_ASSERT_EQUAL ((unsigned) 2, f1->ntaps ()); // check ntaps - - // check filter output - n = NELEM (input_1) - f1->ntaps () + 1; - for (int i = 0; i < n; i++) - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1b[i], f1->filter (&input_1[i]), ERR_DELTA); - - // test filterN interface - - o_type output[NELEM (expected_1b)]; - memset (output, 0, sizeof (output)); - - f1->filterN (output, input_1, n); - for (int i = 0; i < n; i++) - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_1b[i], output[i], ERR_DELTA); - - delete f1; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = rint (uniform () * 32768); -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += input[i] * taps[ntaps - i - 1]; - - return sum; -} - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 32; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - i_type input[INPUT_LEN]; - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_fff *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected_output[o], actual_output[o], - fabs (expected_output[o]) * 9e-3); - } - - delete f1; - } - } -} - - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_fff_info> info; - gr_fir_util::get_gr_fir_fff_info (&info); // get all known fff implementations - - for (std::vector<gr_fir_fff_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_fff::t1 () -{ - for_each (test_known_io); -} - -void -qa_gr_fir_fff::t2 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h deleted file mode 100644 index c896728960..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GR_FIR_FFF_H_ -#define _QA_GR_FIR_FFF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_fff : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_fff); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST_SUITE_END (); - - private: - - void t1 (); - void t2 (); - -}; - - -#endif /* _QA_GR_FIR_FFF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc deleted file mode 100644 index 3f4a7be2c4..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -/* - * FIXME. This code is virtually identical to qa_gr_fir_?CC.cc - * Kludge up some kind of macro to handle the minor differences. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> - -typedef short i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - - -#include <qa_gr_fir_scc.h> -#include <gr_fir_scc.h> -#include <gr_fir_util.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <gr_types.h> -#include <cppunit/TestAssert.h> -#include <random.h> - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// -// typedef for something logically "pointer to constructor". -// there may be a better way, please let me know... -// -typedef gr_fir_scc* (*fir_maker_t)(const std::vector<tap_type> &taps); - - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_input (i_type *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (i_type) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) - sum += (float) input[i] * taps[ntaps - i - 1]; - - return sum; -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// - -static void -test_random_io (fir_maker_t maker) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - i_type input[INPUT_LEN]; - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - - srandom (0); // we want reproducibility - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_input (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - for (int o = 0; o < ol; o++){ - expected_output[o] = ref_dotprod (&input[o], taps, n); - } - - // build filter - - vector<tap_type> f1_taps (&taps[0], &taps[n]); - gr_fir_scc *f1 = maker (f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterN (actual_output, input, ol); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < ol; o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], - actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - - delete f1; - } - } -} - -static void -for_each (void (*f)(fir_maker_t)) -{ - std::vector<gr_fir_scc_info> info; - gr_fir_util::get_gr_fir_scc_info (&info); // get all known scc implementations - - for (std::vector<gr_fir_scc_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - std::cerr << " [" << p->name << "]"; - f (p->create); - } - - std::cerr << std::endl; -} - -void -qa_gr_fir_scc::t1 () -{ - for_each (test_random_io); -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h deleted file mode 100644 index 4b5ffdae3c..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GR_FIR_SCC_H_ -#define _QA_GR_FIR_SCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_fir_scc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_fir_scc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - - -#endif /* _QA_GR_FIR_SCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc deleted file mode 100644 index b2885a12d4..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_gr_rotator.h> -#include <gr_rotator.h> -#include <stdio.h> -#include <cmath> -#include <gr_expj.h> - - -// error vector magnitude -__GR_ATTR_UNUSED static float -error_vector_mag(gr_complex a, gr_complex b) -{ - return abs(a-b); -} - -void -qa_gr_rotator::t1 () -{ - static const unsigned int N = 100000; - - gr_rotator r; - - double phase_incr = 2*M_PI / 1003; - double phase = 0; - - // Old code: We increment then return the rotated value, thus we need to start one tick back - // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr))); - - r.set_phase(gr_complex(1,0)); - r.set_phase_incr(gr_expj(phase_incr)); - - for (unsigned i = 0; i < N; i++){ - gr_complex expected = gr_expj(phase); - gr_complex actual = r.rotate(gr_complex(1, 0)); - -#if 0 - float evm = error_vector_mag(expected, actual); - printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", - i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); -#endif - - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); - - phase += phase_incr; - if (phase >= 2*M_PI) - phase -= 2*M_PI; - } -} diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.h b/gnuradio-core/src/lib/filter/qa_gr_rotator.h deleted file mode 100644 index 739b23f8c3..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gr_rotator.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GR_ROTATOR_H_ -#define _QA_GR_ROTATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gr_rotator : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_rotator); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - -#endif /* _QA_GR_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc deleted file mode 100644 index cfdbc53eb3..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_ccc.h> -#include <gri_fir_filter_with_buffer_ccc.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define MAX_DATA (32767) -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * MAX_DATA); - float im = rint (uniform () * MAX_DATA); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_ccc::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_ccc::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_ccc::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_complex (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_ccc *f1 = new gri_fir_filter_with_buffer_ccc(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h deleted file mode 100644 index c1f2df10c0..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_ccc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc deleted file mode 100644 index 9a5be03518..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_ccf.h> -#include <gri_fir_filter_with_buffer_ccf.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef gr_complex i_type; -typedef gr_complex o_type; -typedef float tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_ccf::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_ccf::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_ccf::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_ccf::test_decimate (unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_complex (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_ccf *f1 = new gri_fir_filter_with_buffer_ccf(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h deleted file mode 100644 index 686bc85411..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_ccf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccf); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc deleted file mode 100644 index 583697165f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_fcc.h> -#include <gri_fir_filter_with_buffer_fcc.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef float i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_fcc::t1() -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_fcc::t2() -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_fcc::t3() -{ - test_decimate(5); -} - - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_fcc::test_decimate(unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_fcc *f1 = new gri_fir_filter_with_buffer_fcc(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h deleted file mode 100644 index 64eed25d3a..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_fcc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fcc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc deleted file mode 100644 index 208ae01dbb..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_fff.h> -#include <gri_fir_filter_with_buffer_fff.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef float i_type; -typedef float o_type; -typedef float tap_type; -typedef float acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 32767); -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - return sum; -} - -void -qa_gri_fir_filter_with_buffer_fff::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_fff::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_fff::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_fff::test_decimate(unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_fff *f1 = new gri_fir_filter_with_buffer_fff(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_output[o], actual_output[o], - fabsf (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h deleted file mode 100644 index d219ec72d9..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_fff : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fff); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FFF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc deleted file mode 100644 index e2b6fb04f0..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_fsf.h> -#include <gri_fir_filter_with_buffer_fsf.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef float i_type; -typedef short o_type; -typedef float tap_type; -typedef float acc_type; - -using std::vector; - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_floats (float *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (float) rint (uniform () * 128); -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += input[i] * taps[i]; - } - return (o_type)sum; -} - -void -qa_gri_fir_filter_with_buffer_fsf::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_fsf::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_fsf::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_fsf::test_decimate (unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_floats (input, INPUT_LEN); - random_floats (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_fsf *f1 = new gri_fir_filter_with_buffer_fsf(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_EQUAL(expected_output[o], actual_output[o]); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h deleted file mode 100644 index 70030a0721..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_fsf : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fsf); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FSF_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc deleted file mode 100644 index 15f8b1f95a..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_types.h> -#include <qa_gri_fir_filter_with_buffer_scc.h> -#include <gri_fir_filter_with_buffer_scc.h> -#include <string.h> -#include <iostream> -#include <cmath> -#include <cppunit/TestAssert.h> -#include <random.h> -#include <malloc16.h> -#include <string.h> - -typedef short i_type; -typedef gr_complex o_type; -typedef gr_complex tap_type; -typedef gr_complex acc_type; - -using std::vector; - -#define ERR_DELTA (1e-5) - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -static float -uniform () -{ - return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1) -} - -static void -random_shorts (short *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++) - buf[i] = (short) rint (uniform () * 16384); -} - -static void -random_complex (gr_complex *buf, unsigned n) -{ - for (unsigned i = 0; i < n; i++){ - float re = rint (uniform () * 32767); - float im = rint (uniform () * 32767); - buf[i] = gr_complex (re, im); - } -} - -static o_type -ref_dotprod (const i_type input[], const tap_type taps[], int ntaps) -{ - acc_type sum = 0; - for (int i = 0; i < ntaps; i++) { - sum += (float)input[i] * taps[i]; - } - - return sum; -} - -void -qa_gri_fir_filter_with_buffer_scc::t1 () -{ - test_decimate(1); -} - -void -qa_gri_fir_filter_with_buffer_scc::t2 () -{ - test_decimate(2); -} - -void -qa_gri_fir_filter_with_buffer_scc::t3 () -{ - test_decimate(5); -} - -// -// Test for ntaps in [0,9], and input lengths in [0,17]. -// This ensures that we are building the shifted taps correctly, -// and exercises all corner cases on input alignment and length. -// -void -qa_gri_fir_filter_with_buffer_scc::test_decimate (unsigned int decimate) -{ - const int MAX_TAPS = 9; - const int OUTPUT_LEN = 17; - const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - - // Mem aligned buffer not really necessary, but why not? - i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type)); - i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type)); - o_type expected_output[OUTPUT_LEN]; - o_type actual_output[OUTPUT_LEN]; - tap_type taps[MAX_TAPS]; - - srandom (0); // we want reproducibility - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - - for (int n = 0; n <= MAX_TAPS; n++){ - for (int ol = 0; ol <= OUTPUT_LEN; ol++){ - - // cerr << "@@@ n:ol " << n << ":" << ol << endl; - - // build random test case - random_shorts (input, INPUT_LEN); - random_complex (taps, MAX_TAPS); - - // compute expected output values - memset(dline, 0, INPUT_LEN*sizeof(i_type)); - for (int o = 0; o < (int)(ol/decimate); o++){ - // use an actual delay line for this test - for(int dd = 0; dd < (int)decimate; dd++) { - for(int oo = INPUT_LEN-1; oo > 0; oo--) - dline[oo] = dline[oo-1]; - dline[0] = input[decimate*o+dd]; - } - expected_output[o] = ref_dotprod (dline, taps, n); - } - - // build filter - vector<tap_type> f1_taps(&taps[0], &taps[n]); - gri_fir_filter_with_buffer_scc *f1 = new gri_fir_filter_with_buffer_scc(f1_taps); - - // zero the output, then do the filtering - memset (actual_output, 0, sizeof (actual_output)); - f1->filterNdec (actual_output, input, ol/decimate, decimate); - - // check results - // - // we use a sloppy error margin because on the x86 architecture, - // our reference implementation is using 80 bit floating point - // arithmetic, while the SSE version is using 32 bit float point - // arithmetic. - - for (int o = 0; o < (int)(ol/decimate); o++){ - CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o], - abs (expected_output[o]) * ERR_DELTA); - } - delete f1; - } - } - free16Align(input); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h deleted file mode 100644 index f80056189f..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_ -#define _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_fir_filter_with_buffer_scc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_scc); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void test_decimate(unsigned int decimate); - - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_SCC_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc deleted file mode 100644 index 7dca65b9a1..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <cppunit/TestAssert.h> -#include <qa_gri_mmse_fir_interpolator.h> -#include <gri_mmse_fir_interpolator.h> -#include <stdio.h> -#include <cmath> - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -static float -test_fcn (double index) -{ - return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI) - + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI)); -} - - -void -qa_gri_mmse_fir_interpolator::t1 () -{ - static const unsigned N = 100; - float input[N + 10]; - - for (unsigned i = 0; i < NELEM(input); i++) - input[i] = test_fcn ((double) i); - - gri_mmse_fir_interpolator intr; - float inv_nsteps = 1.0 / intr.nsteps (); - - for (unsigned i = 0; i < N; i++){ - for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){ - float expected = test_fcn ((i + 3) + imu * inv_nsteps); - float actual = intr.interpolate (&input[i], imu * inv_nsteps); - - CPPUNIT_ASSERT_DOUBLES_EQUAL (expected, actual, 0.004); - // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual); - } - } -} - diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h deleted file mode 100644 index 3f4dec7c29..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_MMSE_FIR_INTERPOLATOR_H_ -#define _QA_GRI_MMSE_FIR_INTERPOLATOR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_mmse_fir_interpolator : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gri_mmse_fir_interpolator); - CPPUNIT_TEST (t1); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - -}; - - -#endif /* _QA_GRI_MMSE_FIR_INTERPOLATOR_H_ */ diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc deleted file mode 100644 index 1f70d7f42d..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gruel/attributes.h> -#include <cppunit/TestAssert.h> -#include <qa_gri_mmse_fir_interpolator_cc.h> -#include <gri_mmse_fir_interpolator_cc.h> -#include <stdio.h> -#include <cmath> -#include <stdexcept> -#include <unistd.h> - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -static float -test_fcn_sin(double index) -{ - return (2 * sin (index * 0.25 * 2 * M_PI + 0.125 * M_PI) - + 3 * sin (index * 0.077 * 2 * M_PI + 0.3 * M_PI)); -} - -static float -test_fcn_cos(double index) -{ - return (2 * cos (index * 0.25 * 2 * M_PI + 0.125 * M_PI) - + 3 * cos (index * 0.077 * 2 * M_PI + 0.3 * M_PI)); -} - -static gr_complex -test_fcn(double index) -{ - return gr_complex(test_fcn_cos(index), test_fcn_sin(index)); -} - - -void -qa_gri_mmse_fir_interpolator_cc::t1() -{ - static const unsigned N = 100; - __GR_ATTR_ALIGNED(8) gr_complex input[N + 10]; - - for (unsigned i = 0; i < NELEM(input); i++) - input[i] = test_fcn ((double) i); - - gri_mmse_fir_interpolator_cc intr; - float inv_nsteps = 1.0 / intr.nsteps (); - - for (unsigned i = 0; i < N; i++){ - for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){ - gr_complex expected = test_fcn ((i + 3) + imu * inv_nsteps); - gr_complex actual = intr.interpolate (&input[i], imu * inv_nsteps); - - CPPUNIT_ASSERT_COMPLEXES_EQUAL (expected, actual, 0.004); - // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual); - } - } -} - - -/* - * Force bad alignment and confirm that it raises an exception - */ -void -qa_gri_mmse_fir_interpolator_cc::t2_body() -{ - static const unsigned N = 100; - float float_input[2*(N+10) + 1]; - gr_complex *input; - - // We require that gr_complex be aligned on an 8-byte boundary. - // Ensure that we ARE NOT ;) - - if (((intptr_t) float_input & 0x7) == 0) - input = reinterpret_cast<gr_complex *>(&float_input[1]); - else - input = reinterpret_cast<gr_complex *>(&float_input[0]); - - - for (unsigned i = 0; i < (N+10); i++) - input[i] = test_fcn ((double) i); - - gri_mmse_fir_interpolator_cc intr; - float inv_nsteps = 1.0 / intr.nsteps (); - - for (unsigned i = 0; i < N; i++){ - for (unsigned imu = 0; imu <= intr.nsteps (); imu += 1){ - gr_complex expected = test_fcn ((i + 3) + imu * inv_nsteps); - gr_complex actual = intr.interpolate (&input[i], imu * inv_nsteps); - - CPPUNIT_ASSERT_COMPLEXES_EQUAL (expected, actual, 0.004); - // printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual); - } - } -} - -void -qa_gri_mmse_fir_interpolator_cc::t2() -{ - CPPUNIT_ASSERT_THROW(t2_body(), std::invalid_argument); -} diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h deleted file mode 100644 index 6be3d97433..0000000000 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ -#define _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_mmse_fir_interpolator_cc : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gri_mmse_fir_interpolator_cc); - CPPUNIT_TEST(t1); - // CPPUNIT_TEST(t2); - CPPUNIT_TEST_SUITE_END(); - - private: - void t1(); - void t2(); - void t2_body(); - -}; - -#endif /* _QA_GRI_MMSE_FIR_INTERPOLATOR_CC_H_ */ diff --git a/gnuradio-core/src/lib/filter/short_dotprod_generic.c b/gnuradio-core/src/lib/filter/short_dotprod_generic.c deleted file mode 100644 index 49a9c0483c..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_generic.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "short_dotprod_generic.h" - - -int -short_dotprod_generic (const short *input, - const short *taps, unsigned n_4_short_blocks) -{ - int sum0 = 0; - int sum1 = 0; - int sum2 = 0; - int sum3 = 0; - - do { - - sum0 += input[0] * taps[0]; - sum1 += input[1] * taps[1]; - sum2 += input[2] * taps[2]; - sum3 += input[3] * taps[3]; - - input += 4; - taps += 4; - - } while (--n_4_short_blocks != 0); - - - return (sum0 + sum1 + sum2 + sum3); -} diff --git a/gnuradio-core/src/lib/filter/short_dotprod_generic.h b/gnuradio-core/src/lib/filter/short_dotprod_generic.h deleted file mode 100644 index e7d977a007..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_generic.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _SHORT_DOTPROD_GENERIC_H_ -#define _SHORT_DOTPROD_GENERIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int -short_dotprod_generic (const short *input, - const short *taps, unsigned n_4_short_blocks); - - -#ifdef __cplusplus -} -#endif - - - -#endif /* _SHORT_DOTPROD_GENERIC_H_ */ diff --git a/gnuradio-core/src/lib/filter/short_dotprod_mmx.S b/gnuradio-core/src/lib/filter/short_dotprod_mmx.S deleted file mode 100644 index 48f634a18d..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_mmx.S +++ /dev/null @@ -1,117 +0,0 @@ -# -# Copyright 2002 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# SIMD MMX dot product -# Equivalent to the following C code: -# long dotprod(signed short *a,signed short *b,int cnt) -# { -# long sum = 0; -# cnt *= 4; -# while(cnt--) -# sum += *a++ + *b++; -# return sum; -# } -# a and b should also be 64-bit aligned, or speed will suffer greatly -# Copyright 1999, Phil Karn KA9Q -# May be used under the terms of the GNU public license - -#include "assembly.h" - - - .file "short_dotprod_mmx.S" - .version "01.01" -.text - .p2align 3 -.globl GLOB_SYMB(short_dotprod_mmx) - DEF_FUNC_HEAD(short_dotprod_mmx) -GLOB_SYMB(short_dotprod_mmx): - pushl %ebp - movl %esp,%ebp - pushl %esi - pushl %edi - pushl %ecx - pushl %ebx - movl 8(%ebp),%esi # a - movl 12(%ebp),%edi # b - movl 16(%ebp),%ecx # cnt - pxor %mm0,%mm0 # clear running sum (in two 32-bit halves) - -# MMX dot product loop unrolled 4 times, crunching 16 terms per loop - .p2align 4 -.Loop1mmx: subl $4,%ecx - jl .Loop1Done - - movq (%esi),%mm1 # mm1 = a[3],a[2],a[1],a[0] - pmaddwd (%edi),%mm1 # mm1 = b[3]*a[3]+b[2]*a[2],b[1]*a[1]+b[0]*a[0] - paddd %mm1,%mm0 - - movq 8(%esi),%mm1 - pmaddwd 8(%edi),%mm1 - paddd %mm1,%mm0 - - movq 16(%esi),%mm1 - pmaddwd 16(%edi),%mm1 - paddd %mm1,%mm0 - - movq 24(%esi),%mm1 - addl $32,%esi - pmaddwd 24(%edi),%mm1 - addl $32,%edi - paddd %mm1,%mm0 - - jmp .Loop1mmx -.Loop1Done: - - addl $4,%ecx - -# MMX dot product loop, not unrolled, crunching 4 terms per loop -# This could be redone as Duff's Device on the unrolled loop above -.Loop2: subl $1,%ecx - jl .Loop2Done - - movq (%esi),%mm1 - addl $8,%esi - pmaddwd (%edi),%mm1 - addl $8,%edi - paddd %mm1,%mm0 - jmp .Loop2 -.Loop2Done: - - movd %mm0,%ebx # right-hand word to ebx - punpckhdq %mm0,%mm0 # left-hand word to right side of %mm0 - movd %mm0,%eax - addl %ebx,%eax # running sum now in %eax - emms # done with MMX - - popl %ebx - popl %ecx - popl %edi - popl %esi - movl %ebp,%esp - popl %ebp - ret - -FUNC_TAIL(short_dotprod_mmx) - .ident "Hand coded x86 MMX assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S b/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S deleted file mode 100644 index c8c9da30a6..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_mmx64.S +++ /dev/null @@ -1,105 +0,0 @@ -# -# Copyright 2002,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -# SIMD MMX dot product -# Equivalent to the following C code: -# long dotprod(signed short *a,signed short *b,int cnt) -# { -# long sum = 0; -# cnt *= 4; -# while(cnt--) -# sum += *a++ + *b++; -# return sum; -# } -# a and b should also be 64-bit aligned, or speed will suffer greatly -# Copyright 1999, Phil Karn KA9Q -# May be used under the terms of the GNU public license - -#include "assembly.h" - - - .file "short_dotprod_mmx64.S" - .version "01.01" -.text - .p2align 3 -.globl GLOB_SYMB(short_dotprod_mmx) - DEF_FUNC_HEAD(short_dotprod_mmx) -GLOB_SYMB(short_dotprod_mmx): - - # a: rdi, b: rsi, cnt: rdx - - pxor %mm0,%mm0 # clear running sum (in two 32-bit halves) - -# MMX dot product loop unrolled 4 times, crunching 16 terms per loop - .p2align 4 -.Loop1mmx: sub $4,%rdx - jl .Loop1Done - - movq (%rdi),%mm1 # mm1 = a[3],a[2],a[1],a[0] - pmaddwd (%rsi),%mm1 # mm1 = b[3]*a[3]+b[2]*a[2],b[1]*a[1]+b[0]*a[0] - paddd %mm1,%mm0 - - movq 8(%rdi),%mm1 - pmaddwd 8(%rsi),%mm1 - paddd %mm1,%mm0 - - movq 16(%rdi),%mm1 - pmaddwd 16(%rsi),%mm1 - paddd %mm1,%mm0 - - movq 24(%rdi),%mm1 - add $32,%rdi - pmaddwd 24(%rsi),%mm1 - add $32,%rsi - paddd %mm1,%mm0 - - jmp .Loop1mmx -.Loop1Done: - - add $4,%rdx - -# MMX dot product loop, not unrolled, crunching 4 terms per loop -# This could be redone as Duff's Device on the unrolled loop above -.Loop2: sub $1,%rdx - jl .Loop2Done - - movq (%rdi),%mm1 - add $8,%rdi - pmaddwd (%rsi),%mm1 - add $8,%rsi - paddd %mm1,%mm0 - jmp .Loop2 -.Loop2Done: - - movd %mm0,%edx # right-hand word to edx - punpckhdq %mm0,%mm0 # left-hand word to right side of %mm0 - movd %mm0,%eax - addl %edx,%eax # running sum now in %eax - emms # done with MMX - - retq - -FUNC_TAIL(short_dotprod_mmx) - .ident "Hand coded x86_64 MMX assembly" - -#if defined(__linux__) && defined(__ELF__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/gnuradio-core/src/lib/filter/short_dotprod_x86.h b/gnuradio-core/src/lib/filter/short_dotprod_x86.h deleted file mode 100644 index 13d5ae2a3c..0000000000 --- a/gnuradio-core/src/lib/filter/short_dotprod_x86.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _SHORT_DOTPROD_X86_H_ -#define _SHORT_DOTPROD_X86_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int -short_dotprod_mmx (const short *input, - const short *taps, unsigned n_4_short_blocks); - -int -short_dotprod_sse2 (const short *input, - const short *taps, unsigned n_4_short_blocks); - -#ifdef __cplusplus -} -#endif - - - -#endif /* _SHORT_DOTPROD_X86_H_ */ diff --git a/gnuradio-core/src/lib/filter/sse_debug.c b/gnuradio-core/src/lib/filter/sse_debug.c deleted file mode 100644 index 870cc0543e..0000000000 --- a/gnuradio-core/src/lib/filter/sse_debug.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#include <stdio.h> -#include <sse_debug.h> -#include <string.h> - -void -format_xmm_regs (FILE *f, struct xmm_regs *r) -{ - int i; - - for (i = 0; i < 8; i++){ - union xmm_register *x = &r->xmm[i]; - fprintf (f, "xmm%d: %08lx %08lx %08lx %08lx", i, - x->ul[0], x->ul[1], x->ul[2], x->ul[3]); - fprintf (f, " %12g %12g %12g %12g\n", - x->f[0], x->f[1], x->f[2], x->f[3]); - } -} - - -void -get_xmm_regs (struct xmm_regs *x) -{ - asm ("movups %%xmm0,0x00(%0); \n" - "movups %%xmm1,0x10(%0); \n" - "movups %%xmm2,0x20(%0); \n" - "movups %%xmm3,0x30(%0); \n" - "movups %%xmm4,0x40(%0); \n" - "movups %%xmm5,0x50(%0); \n" - "movups %%xmm6,0x60(%0); \n" - "movups %%xmm7,0x70(%0); \n" : : "r" (x)); -} - -void -dump_xmm_regs (void) -{ - struct xmm_regs r; - - get_xmm_regs (&r); - format_xmm_regs (stderr, &r); -} - diff --git a/gnuradio-core/src/lib/filter/sse_debug.h b/gnuradio-core/src/lib/filter/sse_debug.h deleted file mode 100644 index b19b4e646c..0000000000 --- a/gnuradio-core/src/lib/filter/sse_debug.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _SSE_DEBUG_H_ -#define _SSE_DEBUG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - union xmm_register { - unsigned long ul[4]; - float f[4]; - }; - - struct xmm_regs { - union xmm_register xmm[8]; - }; - - // callable from asm, dumps all xmm regs - void dump_xmm_regs (void); - - void get_xmm_regs (struct xmm_regs *x); - -#ifdef __cplusplus -} -#endif - -#endif // _SSE_DEBUG_H_ diff --git a/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc deleted file mode 100644 index 2c415863b5..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_armv7_a.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_fir_sysconfig_armv7_a.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_armv7_a (); - return singleton; -} diff --git a/gnuradio-core/src/lib/filter/sysconfig_generic.cc b/gnuradio-core/src/lib/filter/sysconfig_generic.cc deleted file mode 100644 index 88508f62b1..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_generic.cc +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_fir_sysconfig_generic.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_generic (); - return singleton; -} diff --git a/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc b/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc deleted file mode 100644 index 911beae2a7..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_powerpc.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_powerpc.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_powerpc (); - return singleton; -} diff --git a/gnuradio-core/src/lib/filter/sysconfig_x86.cc b/gnuradio-core/src/lib/filter/sysconfig_x86.cc deleted file mode 100644 index 582df0ab72..0000000000 --- a/gnuradio-core/src/lib/filter/sysconfig_x86.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <gr_fir_sysconfig_x86.h> - -gr_fir_sysconfig * -gr_fir_sysconfig_singleton () -{ - static gr_fir_sysconfig *singleton = 0; - - if (singleton) - return singleton; - - singleton = new gr_fir_sysconfig_x86 (); - return singleton; -} diff --git a/gnuradio-core/src/lib/hier/CMakeLists.txt b/gnuradio-core/src/lib/hier/CMakeLists.txt deleted file mode 100644 index 192dd5939a..0000000000 --- a/gnuradio-core/src/lib/hier/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -list(APPEND gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.cc -) - -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "core_devel" -) - -if(ENABLE_PYTHON) - install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/hier.i - ${CMAKE_CURRENT_SOURCE_DIR}/gr_channel_model.i - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "core_swig" - ) -endif(ENABLE_PYTHON) diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.cc b/gnuradio-core/src/lib/hier/gr_channel_model.cc deleted file mode 100644 index bb01972d29..0000000000 --- a/gnuradio-core/src/lib/hier/gr_channel_model.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_channel_model.h> -#include <gr_io_signature.h> -#include <gr_sig_source_f.h> -#include <iostream> - -// Shared pointer constructor -gr_channel_model_sptr -gr_make_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed) -{ - return gnuradio::get_initial_sptr(new gr_channel_model(noise_voltage, - frequency_offset, - epsilon, - taps, - noise_seed)); -} - -// Hierarchical block constructor -gr_channel_model::gr_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed) - : gr_hier_block2("gr_channel_model", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) -{ - d_taps = taps; - while(d_taps.size() < 2) { - d_taps.push_back(0); - } - - d_timing_offset = gr_make_fractional_interpolator_cc(0, epsilon); - - d_multipath = gr_make_fir_filter_ccc(1, d_taps); - - d_noise_adder = gr_make_add_cc(); - d_noise = gr_make_noise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed); - d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0); - d_mixer_offset = gr_make_multiply_cc(); - - connect(self(), 0, d_timing_offset, 0); - connect(d_timing_offset, 0, d_multipath, 0); - connect(d_multipath, 0, d_mixer_offset, 0); - connect(d_freq_offset, 0, d_mixer_offset, 1); - connect(d_mixer_offset, 0, d_noise_adder, 1); - connect(d_noise, 0, d_noise_adder, 0); - connect(d_noise_adder, 0, self(), 0); -} - -void -gr_channel_model::set_noise_voltage(double noise_voltage) -{ - d_noise->set_amplitude(noise_voltage); -} - -void -gr_channel_model::set_frequency_offset(double frequency_offset) -{ - d_freq_offset->set_frequency(frequency_offset); -} - -void -gr_channel_model::set_taps(const std::vector<gr_complex> &taps) -{ - d_taps = taps; - while(d_taps.size() < 2) { - d_taps.push_back(0); - } - d_multipath->set_taps(d_taps); -} - -void -gr_channel_model::set_timing_offset(double epsilon) -{ - d_timing_offset->set_interp_ratio(epsilon); -} - - -double -gr_channel_model::noise_voltage() const -{ - return d_noise->amplitude(); -} - -double -gr_channel_model::frequency_offset() const -{ - return d_freq_offset->frequency(); -} - -std::vector<gr_complex> -gr_channel_model::taps() const -{ - return d_multipath->taps(); -} - -double -gr_channel_model::timing_offset() const -{ - return d_timing_offset->interp_ratio(); -} diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.h b/gnuradio-core/src/lib/hier/gr_channel_model.h deleted file mode 100644 index 3f289e320d..0000000000 --- a/gnuradio-core/src/lib/hier/gr_channel_model.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_core_api.h> -#include <gr_top_block.h> -#include <gr_fractional_interpolator_cc.h> -#include <gr_sig_source_c.h> -#include <gr_fir_filter_ccc.h> -#include <gr_add_cc.h> -#include <gr_noise_source_c.h> -#include <gr_multiply_cc.h> - -class gr_channel_model; -typedef boost::shared_ptr<gr_channel_model> gr_channel_model_sptr; - - -GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, - double frequency_offset=0.0, - double epsilon=1.0, - const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1), - double noise_seed=3021); - -/*! - * \brief channel simulator - * \ingroup misc_blk - */ -class GR_CORE_API gr_channel_model : public gr_hier_block2 -{ - private: - gr_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed); - - friend GR_CORE_API gr_channel_model_sptr gr_make_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed); - - gr_fractional_interpolator_cc_sptr d_timing_offset; - gr_sig_source_c_sptr d_freq_offset; - gr_fir_filter_ccc_sptr d_multipath; - gr_add_cc_sptr d_noise_adder; - gr_noise_source_c_sptr d_noise; - gr_multiply_cc_sptr d_mixer_offset; - - std::vector<gr_complex> d_taps; - - public: - void set_noise_voltage(double noise_voltage); - void set_frequency_offset(double frequency_offset); - void set_taps(const std::vector<gr_complex> &taps); - void set_timing_offset(double epsilon); - - double noise_voltage() const; - double frequency_offset() const; - std::vector<gr_complex> taps() const; - double timing_offset() const; -}; diff --git a/gnuradio-core/src/lib/hier/gr_channel_model.i b/gnuradio-core/src/lib/hier/gr_channel_model.i deleted file mode 100644 index 24a9388e56..0000000000 --- a/gnuradio-core/src/lib/hier/gr_channel_model.i +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,channel_model) - -gr_channel_model_sptr gr_make_channel_model(double noise_voltage=0.0, - double frequency_offset=0.0, - double epsilon=1.0, - const std::vector<gr_complex> &taps=std::vector<gr_complex>(1, 1), - double noise_seed=3021); - -class gr_channel_model : public gr_hier_block2 -{ - private: - gr_channel_model(double noise_voltage, - double frequency_offset, - double epsilon, - const std::vector<gr_complex> &taps, - double noise_seed); - - public: - void set_noise_voltage(double noise_voltage); - void set_frequency_offset(double frequency_offset); - void set_taps(const std::vector<gr_complex> &taps); - void set_timing_offset(double epsilon); - - double noise_voltage() const; - double frequency_offset() const; - std::vector<gr_complex> taps() const; - double timing_offset() const; -}; diff --git a/gnuradio-core/src/lib/hier/hier.i b/gnuradio-core/src/lib/hier/hier.i deleted file mode 100644 index 82044415e1..0000000000 --- a/gnuradio-core/src/lib/hier/hier.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%{ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_channel_model.h> -%} - -%include "gr_channel_model.i" - diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt index d3c381b4bc..bc2fadcecf 100644 --- a/gnuradio-core/src/lib/swig/CMakeLists.txt +++ b/gnuradio-core/src/lib/swig/CMakeLists.txt @@ -43,9 +43,9 @@ set(GR_SWIG_LIBRARIES gnuradio-core) # X86_64, g++'s resident set size was 650MB! # ---------------------------------------------------------------- -set(GR_SWIG_TARGET_DEPS gengen_generated filter_generated) +set(GR_SWIG_TARGET_DEPS gengen_generated) -foreach(what runtime general gengen filter io hier) +foreach(what runtime general gengen io) SET(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${what}_swig_doc.i) SET(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../${what} ${CMAKE_CURRENT_BINARY_DIR}/../${what}) GR_SWIG_MAKE(gnuradio_core_${what} gnuradio_core_${what}.i) diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.py b/gnuradio-core/src/lib/swig/gnuradio_core.py index 23de740778..1fd558a11b 100644 --- a/gnuradio-core/src/lib/swig/gnuradio_core.py +++ b/gnuradio-core/src/lib/swig/gnuradio_core.py @@ -23,6 +23,4 @@ from gnuradio_core_runtime import * from gnuradio_core_general import * from gnuradio_core_gengen import * -from gnuradio_core_filter import * from gnuradio_core_io import * -from gnuradio_core_hier import * diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i deleted file mode 100644 index e9a44e54b9..0000000000 --- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2009,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -%include "filter_swig_doc.i" - -#ifndef SWIGIMPORTED -%module(directors="1") gnuradio_core_filter -#endif - - //%feature("autodoc", "1"); // generate python docstrings - -%include "gnuradio.i" // the common stuff - -%include "filter.i" diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py b/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py deleted file mode 100644 index e5cd471df5..0000000000 --- a/gnuradio-core/src/python/gnuradio/blks2impl/channel_model.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr - -# This block is now a C++ hierarchical block, gr.channel_model -channel_model = gr.channel_model diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py b/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py deleted file mode 100755 index 1757358676..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_dc_blocker.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - -class test_dc_blocker(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - ''' Test impulse response - long form, cc ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.02072429656982422+0j), (-0.02081298828125+0j), - (0.979156494140625+0j), (-0.02081298828125+0j), - (-0.02072429656982422+0j)) - - src = gr.vector_source_c(src_data) - op = gr.dc_blocker_cc(32, True) - dst = gr.vector_sink_c() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around 2D-2 - result_data = dst.data()[60:65] - self.assertComplexTuplesAlmostEqual (expected_result, result_data) - - def test_002(self): - ''' Test impulse response - short form, cc ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.029296875+0j), (-0.0302734375+0j), - (0.96875+0j), (-0.0302734375+0j), - (-0.029296875+0j)) - - src = gr.vector_source_c(src_data) - op = gr.dc_blocker_cc(32, False) - dst = gr.vector_sink_c() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around D-1 - result_data = dst.data()[29:34] - self.assertComplexTuplesAlmostEqual (expected_result, result_data) - - - def test_003(self): - ''' Test impulse response - long form, ff ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.02072429656982422), (-0.02081298828125), - (0.979156494140625), (-0.02081298828125), - (-0.02072429656982422)) - - src = gr.vector_source_f(src_data) - op = gr.dc_blocker_ff(32, True) - dst = gr.vector_sink_f() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around 2D-2 - result_data = dst.data()[60:65] - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_004(self): - ''' Test impulse response - short form, ff ''' - src_data = [1,] + 100*[0,] - expected_result = ((-0.029296875), (-0.0302734375), - (0.96875), (-0.0302734375), - (-0.029296875)) - - src = gr.vector_source_f(src_data) - op = gr.dc_blocker_ff(32, False) - dst = gr.vector_sink_f() - - self.tb.connect (src, op, dst) - self.tb.run() - - # only test samples around D-1 - result_data = dst.data()[29:34] - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - -if __name__ == '__main__': - gr_unittest.run(test_dc_blocker, "test_dc_blocker.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py deleted file mode 100755 index c0aadc306f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py +++ /dev/null @@ -1,383 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -import sys -import random - -def make_random_complex_tuple(L): - result = [] - for x in range(L): - result.append(complex(random.uniform(-1000,1000), - random.uniform(-1000,1000))) - return tuple(result) - -def make_random_float_tuple(L): - result = [] - for x in range(L): - result.append(float(int(random.uniform(-1000,1000)))) - return tuple(result) - - -def reference_filter_ccc(dec, taps, input): - """ - compute result using conventional fir filter - """ - tb = gr.top_block() - #src = gr.vector_source_c(((0,) * (len(taps) - 1)) + input) - src = gr.vector_source_c(input) - op = gr.fir_filter_ccc(dec, taps) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - return dst.data() - -def reference_filter_fff(dec, taps, input): - """ - compute result using conventional fir filter - """ - tb = gr.top_block() - #src = gr.vector_source_f(((0,) * (len(taps) - 1)) + input) - src = gr.vector_source_f(input) - op = gr.fir_filter_fff(dec, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - return dst.data() - - -def print_complex(x): - for i in x: - i = complex(i) - sys.stdout.write("(%6.3f,%6.3fj), " % (i.real, i.imag)) - sys.stdout.write('\n') - - -class test_fft_filter(gr_unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - pass - - def assert_fft_ok2(self, expected_result, result_data): - expected_result = expected_result[:len(result_data)] - self.assertComplexTuplesAlmostEqual2 (expected_result, result_data, - abs_eps=1e-9, rel_eps=4e-4) - - def assert_fft_float_ok2(self, expected_result, result_data, abs_eps=1e-9, rel_eps=4e-4): - expected_result = expected_result[:len(result_data)] - self.assertFloatTuplesAlmostEqual2 (expected_result, result_data, - abs_eps, rel_eps) - - #def test_ccc_000(self): - # self.assertRaises (RuntimeError, gr.fft_filter_ccc, 2, (1,)) - - def test_ccc_001(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (1,) - expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_ccc_002(self): - # Test nthreads - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - nthreads = 2 - expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps, nthreads) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - def test_ccc_003(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_ccc_004(self): - random.seed(0) - for i in xrange(25): - # sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - src_len = 4*1024 - src_data = make_random_complex_tuple(src_len) - ntaps = int(random.uniform(2, 1000)) - taps = make_random_complex_tuple(ntaps) - expected_result = reference_filter_ccc(1, taps, src_data) - - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(1, taps) - dst = gr.vector_sink_c() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - del tb - - self.assert_fft_ok2(expected_result, result_data) - - def test_ccc_005(self): - random.seed(0) - for i in xrange(25): - # sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_complex_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_complex_tuple(ntaps) - expected_result = reference_filter_ccc(dec, taps, src_data) - - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(dec, taps) - dst = gr.vector_sink_c() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - del tb - result_data = dst.data() - - self.assert_fft_ok2(expected_result, result_data) - - def test_ccc_006(self): - # Test decimating with nthreads=2 - random.seed(0) - nthreads = 2 - for i in xrange(25): - # sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_complex_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_complex_tuple(ntaps) - expected_result = reference_filter_ccc(dec, taps, src_data) - - src = gr.vector_source_c(src_data) - op = gr.fft_filter_ccc(dec, taps, nthreads) - dst = gr.vector_sink_c() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - del tb - result_data = dst.data() - - self.assert_fft_ok2(expected_result, result_data) - - # ---------------------------------------------------------------- - # test _fff version - # ---------------------------------------------------------------- - - def test_fff_001(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (1,) - expected_result = tuple([float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_fff_002(self): - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - #print 'expected:', expected_result - #print 'results: ', result_data - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) - - def test_fff_003(self): - # Test 02 with nthreads - tb = gr.top_block() - src_data = (0,1,2,3,4,5,6,7) - taps = (2,) - nthreads = 2 - expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)]) - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps, nthreads) - dst = gr.vector_sink_f() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) - - def xtest_fff_004(self): - random.seed(0) - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - src_len = 4096 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 1000)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(1, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - #print "src_len =", src_len, " ntaps =", ntaps - try: - self.assert_fft_float_ok2(expected_result, result_data, abs_eps=1.0) - except: - expected = open('expected', 'w') - for x in expected_result: - expected.write(`x` + '\n') - actual = open('actual', 'w') - for x in result_data: - actual.write(`x` + '\n') - raise - - def xtest_fff_005(self): - random.seed(0) - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - src_len = 4*1024 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 1000)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(1, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(1, taps) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - self.assert_fft_float_ok2(expected_result, result_data, abs_eps=2.0) - - def xtest_fff_006(self): - random.seed(0) - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(dec, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(dec, taps) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - self.assert_fft_float_ok2(expected_result, result_data) - - def xtest_fff_007(self): - # test decimation with nthreads - random.seed(0) - nthreads = 2 - for i in xrange(25): - sys.stderr.write("\n>>> Loop = %d\n" % (i,)) - dec = i + 1 - src_len = 4*1024 - src_data = make_random_float_tuple(src_len) - ntaps = int(random.uniform(2, 100)) - taps = make_random_float_tuple(ntaps) - expected_result = reference_filter_fff(dec, taps, src_data) - - src = gr.vector_source_f(src_data) - op = gr.fft_filter_fff(dec, taps, nthreads) - dst = gr.vector_sink_f() - tb = gr.top_block() - tb.connect(src, op, dst) - tb.run() - result_data = dst.data() - - self.assert_fft_float_ok2(expected_result, result_data) - - def test_fff_get0(self): - random.seed(0) - for i in xrange(25): - ntaps = int(random.uniform(2, 100)) - taps = make_random_float_tuple(ntaps) - - op = gr.fft_filter_fff(1, taps) - result_data = op.taps() - #print result_data - - self.assertEqual(taps, result_data) - - def test_ccc_get0(self): - random.seed(0) - for i in xrange(25): - ntaps = int(random.uniform(2, 100)) - taps = make_random_complex_tuple(ntaps) - - op = gr.fft_filter_ccc(1, taps) - result_data = op.taps() - #print result_data - - self.assertComplexTuplesAlmostEqual(taps, result_data, 4) - - -if __name__ == '__main__': - gr_unittest.run(test_fft_filter, "test_fft_filter.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py deleted file mode 100755 index 8d325fc3e6..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py +++ /dev/null @@ -1,317 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -import math - -class test_filter_delay_fc (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001_filter_delay_one_input (self): - - # expected result - expected_result = ( -1.4678005338941702e-11j, - -0.0011950774351134896j, - -0.0019336787518113852j, - -0.0034673355985432863j, - -0.0036765895783901215j, - -0.004916108213365078j, - -0.0042778430506587029j, - -0.006028641015291214j, - -0.005476709920912981j, - -0.0092810001224279404j, - -0.0095402700826525688j, - -0.016060983762145042j, - -0.016446959227323532j, - -0.02523401565849781j, - -0.024382550269365311j, - -0.035477779805660248j, - -0.033021725714206696j, - -0.048487484455108643j, - -0.04543270543217659j, - -0.069477587938308716j, - -0.066984444856643677j, - -0.10703597217798233j, - -0.10620346665382385j, - -0.1852707713842392j, - -0.19357112050056458j, - (7.2191945754696007e-09 -0.50004088878631592j), - (0.58778399229049683 -0.6155126690864563j), - (0.95105588436126709 -0.12377222627401352j), - (0.95105588436126709 +0.41524654626846313j), - (0.5877838134765625 +0.91611981391906738j), - (5.8516356205018383e-09 +1.0670661926269531j), - (-0.5877840518951416 +0.87856143712997437j), - (-0.95105588436126709 +0.35447561740875244j), - (-0.95105588436126709 -0.26055556535720825j), - (-0.5877838134765625 -0.77606213092803955j), - (-8.7774534307527574e-09 -0.96460390090942383j), - (0.58778399229049683 -0.78470128774642944j), - (0.95105588436126709 -0.28380891680717468j), - (0.95105588436126709 +0.32548999786376953j), - (0.5877838134765625 +0.82514488697052002j), - (1.4629089051254596e-08 +1.0096219778060913j), - (-0.5877840518951416 +0.81836479902267456j), - (-0.95105588436126709 +0.31451958417892456j), - (-0.95105588436126709 -0.3030143678188324j), - (-0.5877838134765625 -0.80480599403381348j), - (-1.7554906861505515e-08 -0.99516552686691284j), - (0.58778399229049683 -0.80540722608566284j), - (0.95105582475662231 -0.30557557940483093j), - (0.95105588436126709 +0.31097668409347534j), - (0.5877838134765625 +0.81027895212173462j), - (2.3406542482007353e-08 +1.0000816583633423j), - (-0.5877840518951416 +0.80908381938934326j), - (-0.95105588436126709 +0.30904293060302734j), - (-0.95105588436126709 -0.30904296040534973j), - (-0.5877838134765625 -0.80908387899398804j), - (-2.6332360292258272e-08 -1.0000815391540527j), - (0.58778399229049683 -0.80908381938934326j), - (0.95105582475662231 -0.30904299020767212j), - (0.95105588436126709 +0.30904293060302734j), - (0.5877838134765625 +0.80908381938934326j), - (3.218399768911695e-08 +1.0000815391540527j)) - - tb = self.tb - - sampling_freq = 100 - - ntaps = 51 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - dst2 = gr.vector_sink_c () - - # calculate taps - taps = gr.firdes_hilbert (ntaps) - hd = gr.filter_delay_fc (taps) - - tb.connect (src1, head) - tb.connect (head, hd) - tb.connect (hd,dst2) - - tb.run () - - # get output - result_data = dst2.data () - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - def test_002_filter_delay_two_inputs (self): - - # giving the same signal to both the inputs should fetch the same results - # as above - - # expected result - expected_result = ( -1.4678005338941702e-11j, - -0.0011950774351134896j, - -0.0019336787518113852j, - -0.0034673355985432863j, - -0.0036765895783901215j, - -0.004916108213365078j, - -0.0042778430506587029j, - -0.006028641015291214j, - -0.005476709920912981j, - -0.0092810001224279404j, - -0.0095402700826525688j, - -0.016060983762145042j, - -0.016446959227323532j, - -0.02523401565849781j, - -0.024382550269365311j, - -0.035477779805660248j, - -0.033021725714206696j, - -0.048487484455108643j, - -0.04543270543217659j, - -0.069477587938308716j, - -0.066984444856643677j, - -0.10703597217798233j, - -0.10620346665382385j, - -0.1852707713842392j, - -0.19357112050056458j, - (7.2191945754696007e-09 -0.50004088878631592j), - (0.58778399229049683 -0.6155126690864563j), - (0.95105588436126709 -0.12377222627401352j), - (0.95105588436126709 +0.41524654626846313j), - (0.5877838134765625 +0.91611981391906738j), - (5.8516356205018383e-09 +1.0670661926269531j), - (-0.5877840518951416 +0.87856143712997437j), - (-0.95105588436126709 +0.35447561740875244j), - (-0.95105588436126709 -0.26055556535720825j), - (-0.5877838134765625 -0.77606213092803955j), - (-8.7774534307527574e-09 -0.96460390090942383j), - (0.58778399229049683 -0.78470128774642944j), - (0.95105588436126709 -0.28380891680717468j), - (0.95105588436126709 +0.32548999786376953j), - (0.5877838134765625 +0.82514488697052002j), - (1.4629089051254596e-08 +1.0096219778060913j), - (-0.5877840518951416 +0.81836479902267456j), - (-0.95105588436126709 +0.31451958417892456j), - (-0.95105588436126709 -0.3030143678188324j), - (-0.5877838134765625 -0.80480599403381348j), - (-1.7554906861505515e-08 -0.99516552686691284j), - (0.58778399229049683 -0.80540722608566284j), - (0.95105582475662231 -0.30557557940483093j), - (0.95105588436126709 +0.31097668409347534j), - (0.5877838134765625 +0.81027895212173462j), - (2.3406542482007353e-08 +1.0000816583633423j), - (-0.5877840518951416 +0.80908381938934326j), - (-0.95105588436126709 +0.30904293060302734j), - (-0.95105588436126709 -0.30904296040534973j), - (-0.5877838134765625 -0.80908387899398804j), - (-2.6332360292258272e-08 -1.0000815391540527j), - (0.58778399229049683 -0.80908381938934326j), - (0.95105582475662231 -0.30904299020767212j), - (0.95105588436126709 +0.30904293060302734j), - (0.5877838134765625 +0.80908381938934326j), - (3.218399768911695e-08 +1.0000815391540527j)) - - - tb = self.tb - - sampling_freq = 100 - ntaps = 51 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - dst2 = gr.vector_sink_c () - - - # calculate taps - taps = gr.firdes_hilbert (ntaps) - hd = gr.filter_delay_fc (taps) - - tb.connect (src1, head) - tb.connect (head, (hd,0)) - tb.connect (head, (hd,1)) - tb.connect (hd,dst2) - tb.run () - - # get output - result_data = dst2.data () - - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - - def test_003_filter_delay_two_inputs (self): - - # give two different inputs - - # expected result - expected_result = ( -0.0020331963896751404j, - -0.0016448829555884004j, - -0.0032375147566199303j, - -0.0014826074475422502j, - -0.0033034090884029865j, - -0.00051144487224519253j, - -0.0043686260469257832j, - -0.0010198024101555347j, - -0.0082517862319946289j, - -0.003456643782556057j, - -0.014193611219525337j, - -0.005875137634575367j, - -0.020293503999710083j, - -0.0067503536120057106j, - -0.026798896491527557j, - -0.0073488112539052963j, - -0.037041611969470978j, - -0.010557252913713455j, - -0.055669989436864853j, - -0.018332764506340027j, - -0.089904911816120148j, - -0.033361352980136871j, - -0.16902604699134827j, - -0.074318811297416687j, - -0.58429563045501709j, - (7.2191945754696007e-09 -0.35892376303672791j), - (0.58778399229049683 +0.63660913705825806j), - (0.95105588436126709 +0.87681591510772705j), - (0.95105588436126709 +0.98705857992172241j), - (0.5877838134765625 +0.55447429418563843j), - (5.8516356205018383e-09 +0.026006083935499191j), - (-0.5877840518951416 -0.60616838932037354j), - (-0.95105588436126709 -0.9311758279800415j), - (-0.95105588436126709 -0.96169203519821167j), - (-0.5877838134765625 -0.57292771339416504j), - (-8.7774534307527574e-09 -0.0073488391935825348j), - (0.58778399229049683 +0.59720659255981445j), - (0.95105588436126709 +0.94438445568084717j), - (0.95105588436126709 +0.95582199096679688j), - (0.5877838134765625 +0.58196049928665161j), - (1.4629089051254596e-08 +0.0026587247848510742j), - (-0.5877840518951416 -0.59129220247268677j), - (-0.95105588436126709 -0.94841635227203369j), - (-0.95105588436126709 -0.95215457677841187j), - (-0.5877838134765625 -0.58535969257354736j), - (-1.7554906861505515e-08 -0.00051158666610717773j), - (0.58778399229049683 +0.58867418766021729j), - (0.95105582475662231 +0.94965213537216187j), - (0.95105588436126709 +0.95050644874572754j), - (0.5877838134765625 +0.58619076013565063j), - (2.3406542482007353e-08 +1.1920928955078125e-07j), - (-0.5877840518951416 -0.58783555030822754j), - (-0.95105588436126709 -0.95113480091094971j), - (-0.95105588436126709 -0.95113474130630493j), - (-0.5877838134765625 -0.58783555030822754j), - (-2.6332360292258272e-08 -8.1956386566162109e-08j), - (0.58778399229049683 +0.58783555030822754j), - (0.95105582475662231 +0.95113474130630493j), - (0.95105588436126709 +0.95113474130630493j), - (0.5877838134765625 +0.58783560991287231j), - (3.218399768911695e-08 +1.1920928955078125e-07j)) - - tb = self.tb - - sampling_freq = 100 - ntaps = 51 - - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE,sampling_freq * 0.10, 1.0) - src2 = gr.sig_source_f (sampling_freq, gr.GR_COS_WAVE,sampling_freq * 0.10, 1.0) - - head1 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - head2 = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - - taps = gr.firdes_hilbert (ntaps) - hd = gr.filter_delay_fc (taps) - - dst2 = gr.vector_sink_c () - - tb.connect (src1, head1) - tb.connect (src2, head2) - - tb.connect (head1, (hd,0)) - tb.connect (head2, (hd,1)) - tb.connect (hd, dst2) - - tb.run () - - # get output - result_data = dst2.data () - - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - - -if __name__ == '__main__': - gr_unittest.run(test_filter_delay_fc, "test_filter_delay_fc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py deleted file mode 100755 index e19bb28f31..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - -class test_fractional_resampler (gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_000_make(self): - op = gr.fractional_interpolator_ff(0.0, 1.0) - op2 = gr.fractional_interpolator_cc(0.0, 1.0) - -if __name__ == '__main__': - gr_unittest.run(test_fractional_resampler, "test_fractional_resampler.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py deleted file mode 100755 index 77f1b5f897..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -from math import pi, cos - -class test_goertzel(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def make_tone_data(self, rate, freq): - return [cos(2*pi*x*freq/rate) for x in range(rate)] - - def transform(self, src_data, rate, freq): - src = gr.vector_source_f(src_data, False) - dft = gr.goertzel_fc(rate, rate, freq) - dst = gr.vector_sink_c() - self.tb.connect(src, dft, dst) - self.tb.run() - return dst.data() - - def test_001(self): # Measure single tone magnitude - rate = 8000 - freq = 100 - bin = freq - src_data = self.make_tone_data(rate, freq) - expected_result = 0.5 - actual_result = abs(self.transform(src_data, rate, bin)[0]) - self.assertAlmostEqual(expected_result, actual_result, places=4) - - def test_002(self): # Measure off frequency magnitude - rate = 8000 - freq = 100 - bin = freq/2 - src_data = self.make_tone_data(rate, freq) - expected_result = 0.0 - actual_result = abs(self.transform(src_data, rate, bin)[0]) - self.assertAlmostEqual(expected_result, actual_result, places=4) - -if __name__ == '__main__': - gr_unittest.run(test_goertzel, "test_goertzel.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py deleted file mode 100755 index 27d01092bb..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -import math - -class test_hilbert (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_hilbert (self): - tb = self.tb - ntaps = 51 - sampling_freq = 100 - - expected_result = ( -1.4678005338941702e-11j, - -0.0011950774351134896j, - -0.0019336787518113852j, - -0.0034673355985432863j, - -0.0036765895783901215j, - -0.004916108213365078j, - -0.0042778430506587029j, - -0.006028641015291214j, - -0.005476709920912981j, - -0.0092810001224279404j, - -0.0095402700826525688j, - -0.016060983762145042j, - -0.016446959227323532j, - -0.02523401565849781j, - -0.024382550269365311j, - -0.035477779805660248j, - -0.033021725714206696j, - -0.048487484455108643j, - -0.04543270543217659j, - -0.069477587938308716j, - -0.066984444856643677j, - -0.10703597217798233j, - -0.10620346665382385j, - -0.1852707713842392j, - -0.19357112050056458j, - (7.2191945754696007e-09 -0.50004088878631592j), - (0.58778399229049683 -0.6155126690864563j), - (0.95105588436126709 -0.12377222627401352j), - (0.95105588436126709 +0.41524654626846313j), - (0.5877838134765625 +0.91611981391906738j), - (5.8516356205018383e-09 +1.0670661926269531j), - (-0.5877840518951416 +0.87856143712997437j), - (-0.95105588436126709 +0.35447561740875244j), - (-0.95105588436126709 -0.26055556535720825j), - (-0.5877838134765625 -0.77606213092803955j), - (-8.7774534307527574e-09 -0.96460390090942383j), - (0.58778399229049683 -0.78470128774642944j), - (0.95105588436126709 -0.28380891680717468j), - (0.95105588436126709 +0.32548999786376953j), - (0.5877838134765625 +0.82514488697052002j), - (1.4629089051254596e-08 +1.0096219778060913j), - (-0.5877840518951416 +0.81836479902267456j), - (-0.95105588436126709 +0.31451958417892456j), - (-0.95105588436126709 -0.3030143678188324j), - (-0.5877838134765625 -0.80480599403381348j), - (-1.7554906861505515e-08 -0.99516552686691284j), - (0.58778399229049683 -0.80540722608566284j), - (0.95105582475662231 -0.30557557940483093j), - (0.95105588436126709 +0.31097668409347534j), - (0.5877838134765625 +0.81027895212173462j), - (2.3406542482007353e-08 +1.0000816583633423j), - (-0.5877840518951416 +0.80908381938934326j), - (-0.95105588436126709 +0.30904293060302734j), - (-0.95105588436126709 -0.30904296040534973j), - (-0.5877838134765625 -0.80908387899398804j), - (-2.6332360292258272e-08 -1.0000815391540527j), - (0.58778399229049683 -0.80908381938934326j), - (0.95105582475662231 -0.30904299020767212j), - (0.95105588436126709 +0.30904293060302734j), - (0.5877838134765625 +0.80908381938934326j), - (3.218399768911695e-08 +1.0000815391540527j)) - - - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - - head = gr.head (gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) - hilb = gr.hilbert_fc (ntaps) - dst1 = gr.vector_sink_c () - tb.connect (src1, head) - tb.connect (head, hilb) - tb.connect (hilb, dst1) - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_hilbert, "test_hilbert.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py deleted file mode 100755 index 06b8d767ed..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - -class test_iir (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_iir_direct_001 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = () - fbtaps = () - expected_result = (0, 0, 0, 0, 0, 0, 0, 0) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_002 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2,) - fbtaps = (0,) - expected_result = (2, 4, 6, 8, 10, 12, 14, 16) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_003 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2, 11) - fbtaps = (0, 0) - expected_result = (2, 15, 28, 41, 54, 67, 80, 93) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_004 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2, 11) - fbtaps = (0, -1) - expected_result = (2, 13, 15, 26, 28, 39, 41, 52) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_005 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - fftaps = (2, 11, 0) - fbtaps = (0, -1, 3) - expected_result = (2, 13, 21, 59, 58, 186, 68, 583) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_006 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - expected_result = (2, 13, 21, 59, 58, 186, 68, 583) - fftaps = (2, 1) - fbtaps = (0, -1) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - fftaps = (2, 11, 0) - fbtaps = (0, -1, 3) - op.set_taps (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_007 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - expected_result = (2,2,5,5,8,8,11,11) - fftaps = (2, 1) - fbtaps = (0, -1) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - fftaps = (2,0,1) - fbtaps = (0, -1) - op.set_taps (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_iir_direct_008 (self): - src_data = (1, 2, 3, 4, 5, 6, 7, 8) - expected_result = (2,4,4,10,18,14,26,56) - fftaps = (2,) - fbtaps = (0, 1) - src = gr.vector_source_f (src_data) - op = gr.iir_filter_ffd (fftaps, fbtaps) - fftaps_data = (1) - fbtaps = (0,0, -1,3) - op.set_taps (fftaps, fbtaps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - - - -if __name__ == '__main__': - gr_unittest.run(test_iir, "test_iir.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py deleted file mode 100755 index 9bd9977c75..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -import math - -class test_interp_fir_filter (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_fff (self): - taps = [1, 10, 100, 1000, 10000] - src_data = (0, 2, 3, 5, 7, 11, 13, 17) - interpolation = 3 - xr = (0,0,0,0,2,20,200,2003,20030,300,3005,30050,500,5007,50070,700,7011,70110,1100,11013,110130,1300,13017,130170) - expected_result = tuple ([float (x) for x in xr]) - - src = gr.vector_source_f (src_data) - op = gr.interp_fir_filter_fff (interpolation, taps) - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - L = min(len(result_data), len(expected_result)) - self.assertEqual (expected_result[0:L], result_data[0:L]) - - -if __name__ == '__main__': - gr_unittest.run(test_interp_fir_filter, "test_interp_fir_filter.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py deleted file mode 100755 index bfe2d8fc8c..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - -class test_single_pole_iir(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = (0, 1000, 2000, 3000, 4000, 5000) - expected_result = src_data - src = gr.vector_source_f(src_data) - op = gr.single_pole_iir_filter_ff (1.0) - dst = gr.vector_sink_f() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data) - - def test_002(self): - src_data = (0, 1000, 2000, 3000, 4000, 5000) - expected_result = (0, 125, 359.375, 689.453125, 1103.271484, 1590.36255) - src = gr.vector_source_f(src_data) - op = gr.single_pole_iir_filter_ff (0.125) - dst = gr.vector_sink_f() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 3) - - def test_003(self): - block_size = 2 - src_data = (0, 1000, 2000, 3000, 4000, 5000) - expected_result = (0, 125, 250, 484.375, 718.75, 1048.828125) - src = gr.vector_source_f(src_data) - s2p = gr.serial_to_parallel(gr.sizeof_float, block_size) - op = gr.single_pole_iir_filter_ff (0.125, block_size) - p2s = gr.parallel_to_serial(gr.sizeof_float, block_size) - dst = gr.vector_sink_f() - self.tb.connect (src, s2p, op, p2s, dst) - self.tb.run() - result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data, 3) - - -if __name__ == '__main__': - gr_unittest.run(test_single_pole_iir, "test_single_pole_iir.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py deleted file mode 100755 index 353df1bc0d..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2007,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest - -class test_single_pole_iir_cc(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001(self): - src_data = (0+0j, 1000+1000j, 2000+2000j, 3000+3000j, 4000+4000j, 5000+5000j) - expected_result = src_data - src = gr.vector_source_c(src_data) - op = gr.single_pole_iir_filter_cc (1.0) - dst = gr.vector_sink_c() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual (expected_result, result_data) - - def test_002(self): - src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000), complex(3000,-3000), complex(4000,-4000), complex(5000,-5000)) - expected_result = (complex(0,0), complex(125,-125), complex(359.375,-359.375), complex(689.453125,-689.453125), complex(1103.271484,-1103.271484), complex(1590.36255,-1590.36255)) - src = gr.vector_source_c(src_data) - op = gr.single_pole_iir_filter_cc (0.125) - dst = gr.vector_sink_c() - self.tb.connect (src, op, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 3) - - def test_003(self): - block_size = 2 - src_data = (complex(0,0), complex(1000,-1000), complex(2000,-2000), complex(3000,-3000), complex(4000,-4000), complex(5000,-5000)) - expected_result = (complex(0,0), complex(125,-125), complex(250,-250), complex(484.375,-484.375), complex(718.75,-718.75), complex(1048.828125,-1048.828125)) - src = gr.vector_source_c(src_data) - s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, block_size) - op = gr.single_pole_iir_filter_cc (0.125, block_size) - p2s = gr.parallel_to_serial(gr.sizeof_gr_complex, block_size) - dst = gr.vector_sink_c() - self.tb.connect (src, s2p, op, p2s, dst) - self.tb.run() - result_data = dst.data() - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 3) - - -if __name__ == '__main__': - gr_unittest.run(test_single_pole_iir_cc, "test_single_pole_iir_cc.xml") - diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt index 3c7f632b37..d752df6dc8 100644 --- a/gnuradio-core/src/tests/CMakeLists.txt +++ b/gnuradio-core/src/tests/CMakeLists.txt @@ -37,18 +37,10 @@ link_directories(${CPPUNIT_LIBRARY_DIRS}) # Build benchmarks and non-registered tests ######################################################################## set(tests_not_run #single source per test - benchmark_dotprod_fff.cc - benchmark_dotprod_fsf.cc - benchmark_dotprod_ccf.cc - benchmark_dotprod_fcc.cc - benchmark_dotprod_scc.cc - benchmark_dotprod_ccc.cc benchmark_nco.cc benchmark_vco.cc test_runtime.cc test_general.cc - test_filter.cc - #test_atsc.cc test_vmcircbuf.cc ) diff --git a/gnuradio-core/src/tests/benchmark_dotprod b/gnuradio-core/src/tests/benchmark_dotprod deleted file mode 100755 index 82f3b5c3fc..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -DIR=. - -tests=" -benchmark_dotprod_fff -benchmark_dotprod_ccf -benchmark_dotprod_ccc -benchmark_dotprod_fcc -benchmark_dotprod_scc -benchmark_dotprod_fsf -" - -echo "uname -a" -uname -a - -if test -e /proc/cpuinfo -then - cat /proc/cpuinfo -fi - -for t in $tests -do - echo - echo "$t": - $DIR/$t -done diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc deleted file mode 100644 index 8ef26a40dc..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_ccc.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_ccc filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - gr_complex coeffs[NTAPS]; - //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned - gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start= (double) clock() / CLOCKS_PER_SEC; -#endif - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter ((gr_complex*)&input[j]); - } - } - - // get ending CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end = (double) clock() / CLOCKS_PER_SEC; - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; - delete [] input; -} - -static void -do_all () -{ - std::vector<gr_fir_ccc_info> info; - gr_fir_util::get_gr_fir_ccc_info (&info); // get all known CCC implementations - - for (std::vector<gr_fir_ccc_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc deleted file mode 100644 index ed3c491651..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_ccf.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<float> &taps); -typedef gr_fir_ccf filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - float coeffs[NTAPS]; - //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned - gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = random() - RANDOM_MAX/2; - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start= (double) clock() / CLOCKS_PER_SEC; -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock() / CLOCKS_PER_SEC; - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; - delete [] input; -} - -static void -do_all () -{ - std::vector<gr_fir_ccf_info> info; - gr_fir_util::get_gr_fir_ccf_info (&info); // get all known CCF implementations - - for (std::vector<gr_fir_ccf_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc b/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc deleted file mode 100644 index e9eeee43a1..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_fcc.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_fcc filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - gr_complex coeffs[NTAPS]; - float input[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC); - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_fcc_info> info; - gr_fir_util::get_gr_fir_fcc_info (&info); // get all known FCC implementations - - for (std::vector<gr_fir_fcc_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fff.cc b/gnuradio-core/src/tests/benchmark_dotprod_fff.cc deleted file mode 100644 index 56e0645062..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_fff.cc +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif - -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_fff.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_fff* (*fir_maker_t)(const std::vector<float> &taps); -typedef gr_fir_fff filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - float coeffs[NTAPS]; - float input[BLOCK_SIZE + NTAPS]; - long n; - float result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = random() - RANDOM_MAX/2; - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC); - double total = clock_end -clock_start; -#endif - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_fff_info> info; - gr_fir_util::get_gr_fir_fff_info (&info); // get all known FFF implementations - - for (std::vector<gr_fir_fff_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc deleted file mode 100644 index a254a8eab4..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_fsf.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_fsf* (*fir_maker_t)(const std::vector<float> &taps); -typedef gr_fir_fsf filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - float coeffs[NTAPS]; - float input[BLOCK_SIZE + NTAPS]; - long n; - short result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = random() - RANDOM_MAX/2; - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC); - double total = clock_end - clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_fsf_info> info; - gr_fir_util::get_gr_fir_fsf_info (&info); // get all known FFF implementations - - for (std::vector<gr_fir_fsf_info>::iterator p = info.begin (); - p != info.end (); - ++p){ - - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc b/gnuradio-core/src/tests/benchmark_dotprod_scc.cc deleted file mode 100644 index 9a65bb4c62..0000000000 --- a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdio.h> -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> -#include <gr_fir_util.h> -#include <gr_fir_scc.h> -#include <random.h> - -#define TOTAL_TEST_SIZE (40 * 1000 * 1000L) -#define NTAPS 256 -#define BLOCK_SIZE (50 * 1000) /* fits in cache */ - -#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0) -#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0" -#endif - -typedef gr_fir_scc* (*fir_maker_t)(const std::vector<gr_complex> &taps); -typedef gr_fir_scc filter_t; - - -static double -timeval_to_double (const struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - - -static void -benchmark (fir_maker_t filter_maker, const char *implementation_name) -{ - int i; - gr_complex coeffs[NTAPS]; - short input[BLOCK_SIZE + NTAPS]; - long n; - gr_complex result; -#ifdef HAVE_SYS_RESOURCE_H - struct rusage rusage_start; - struct rusage rusage_stop; -#else - double clock_start; - double clock_end; -#endif - - - // setup coefficients and input data - - for (i = 0; i < NTAPS; i++) - coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2); - - for (i = 0; i < BLOCK_SIZE + NTAPS; i++) - input[i] = random() - RANDOM_MAX/2; - - std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]); - filter_t *f = filter_maker (taps); - - // get starting CPU usage - -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_start) < 0){ - perror ("getrusage"); - exit (1); - } -#else - clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC); -#endif - - // do the actual work - - for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){ - int j; - for (j = 0; j < BLOCK_SIZE; j++){ - result = f->filter (&input[j]); - } - } - - // get ending CPU usage -#ifdef HAVE_SYS_RESOURCE_H - if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){ - perror ("getrusage"); - exit (1); - } - - // compute results - - double user = - timeval_to_double (&rusage_stop.ru_utime) - - timeval_to_double (&rusage_start.ru_utime); - - double sys = - timeval_to_double (&rusage_stop.ru_stime) - - timeval_to_double (&rusage_start.ru_stime); - - double total = user + sys; -#else - clock_end= (double) clock () * (1000000. / CLOCKS_PER_SEC); - double total = clock_end -clock_start; -#endif - - double macs = NTAPS * (double) TOTAL_TEST_SIZE; - - printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n", - implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total); - - delete f; -} - -static void -do_all () -{ - std::vector<gr_fir_scc_info> info; - gr_fir_util::get_gr_fir_scc_info (&info); // get all known SCC implementations - - for (std::vector<gr_fir_scc_info>::iterator p = info.begin (); - p != info.end () ; - ++p){ - benchmark (p->create, p->name); - } -} - -int -main (int argc, char **argv) -{ - do_all (); - return 0; -} diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 8a1423e9ea..fb45cbf8f4 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -26,8 +26,6 @@ #include <gr_unittests.h> #include <qa_runtime.h> #include <qa_general.h> -#include <qa_filter.h> -// #include <qa_atsc.h> // FIXME add atsc back in. @@ -40,8 +38,6 @@ main (int argc, char **argv) runner.addTest (qa_runtime::suite ()); runner.addTest (qa_general::suite ()); - runner.addTest (qa_filter::suite ()); - // runner.addTest (qa_atsc::suite ()); runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc deleted file mode 100644 index 8b17034c60..0000000000 --- a/gnuradio-core/src/tests/test_filter.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2010,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <cppunit/TextTestRunner.h> -#include <cppunit/XmlOutputter.h> - -#include <gr_unittests.h> -#include <qa_filter.h> - -int -main (int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str()); - CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); - - runner.addTest (qa_filter::suite ()); - runner.setOutputter(xmlout); - - bool was_successful = runner.run ("", false); - - return was_successful ? 0 : 1; -} |