diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b25b3d16..e4798d1db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -155,89 +155,89 @@ set(sdrbase_SOURCES
)
set(sdrbase_HEADERS
- include/mainwindow.h
+ sdrbase/mainwindow.h
- include/audio/audiodeviceinfo.h
- include/audio/audiofifo.h
- include/audio/audiooutput.h
+ sdrbase/audio/audiodeviceinfo.h
+ sdrbase/audio/audiofifo.h
+ sdrbase/audio/audiooutput.h
- include/dsp/afsquelch.h
- include/dsp/channelizer.h
- include/dsp/channelmarker.h
- include/dsp/complex.h
- include/dsp/decimators.h
- include/dsp/dspcommands.h
- include/dsp/dspengine.h
- include/dsp/dspdeviceengine.h
- include/dsp/dsptypes.h
- include/dsp/fftengine.h
- include/dsp/fftfilt.h
- include/dsp/fftwengine.h
- include/dsp/fftwindow.h
- include/dsp/filterrc.h
- include/dsp/filesink.h
- include/dsp/gfft.h
- include/dsp/interpolator.h
- include/dsp/inthalfbandfilter.h
- include/dsp/kissfft.h
- include/dsp/kissengine.h
- include/dsp/lowpass.h
- include/dsp/misc.h
- include/dsp/movingaverage.h
- include/dsp/nco.h
- include/dsp/phasediscri.h
- include/dsp/phaselock.h
+ sdrbase/dsp/afsquelch.h
+ sdrbase/dsp/channelizer.h
+ sdrbase/dsp/channelmarker.h
+ sdrbase/dsp/complex.h
+ sdrbase/dsp/decimators.h
+ sdrbase/dsp/dspcommands.h
+ sdrbase/dsp/dspengine.h
+ sdrbase/dsp/dspdeviceengine.h
+ sdrbase/dsp/dsptypes.h
+ sdrbase/dsp/fftengine.h
+ sdrbase/dsp/fftfilt.h
+ sdrbase/dsp/fftwengine.h
+ sdrbase/dsp/fftwindow.h
+ sdrbase/dsp/filterrc.h
+ sdrbase/dsp/filesink.h
+ sdrbase/dsp/gfft.h
+ sdrbase/dsp/interpolator.h
+ sdrbase/dsp/inthalfbandfilter.h
+ sdrbase/dsp/kissfft.h
+ sdrbase/dsp/kissengine.h
+ sdrbase/dsp/lowpass.h
+ sdrbase/dsp/misc.h
+ sdrbase/dsp/movingaverage.h
+ sdrbase/dsp/nco.h
+ sdrbase/dsp/phasediscri.h
+ sdrbase/dsp/phaselock.h
sdrbase/dsp/pidcontroller.h
- include/dsp/samplefifo.h
- include/dsp/samplesink.h
- include/dsp/nullsink.h
- include/dsp/scopevis.h
- include/dsp/spectrumvis.h
- include/dsp/threadedsamplesink.h
+ sdrbase/dsp/samplefifo.h
+ sdrbase/dsp/samplesink.h
+ sdrbase/dsp/nullsink.h
+ sdrbase/dsp/scopevis.h
+ sdrbase/dsp/spectrumvis.h
+ sdrbase/dsp/threadedsamplesink.h
- include/gui/aboutdialog.h
- include/gui/addpresetdialog.h
- include/gui/basicchannelsettingswidget.h
- include/gui/buttonswitch.h
- include/gui/channelwindow.h
- include/gui/colormapper.h
- include/gui/glscope.h
- include/gui/glscopegui.h
- include/gui/glshadersimple.h
- include/gui/glshadertextured.h
- include/gui/glspectrum.h
- include/gui/glspectrumgui.h
- include/gui/indicator.h
- include/gui/physicalunit.h
- include/gui/pluginsdialog.h
- include/gui/preferencesdialog.h
- include/gui/presetitem.h
- include/gui/rollupwidget.h
- include/gui/scale.h
- include/gui/scaleengine.h
- include/gui/valuedial.h
+ sdrbase/gui/aboutdialog.h
+ sdrbase/gui/addpresetdialog.h
+ sdrbase/gui/basicchannelsettingswidget.h
+ sdrbase/gui/buttonswitch.h
+ sdrbase/gui/channelwindow.h
+ sdrbase/gui/colormapper.h
+ sdrbase/gui/glscope.h
+ sdrbase/gui/glscopegui.h
+ sdrbase/gui/glshadersimple.h
+ sdrbase/gui/glshadertextured.h
+ sdrbase/gui/glspectrum.h
+ sdrbase/gui/glspectrumgui.h
+ sdrbase/gui/indicator.h
+ sdrbase/gui/physicalunit.h
+ sdrbase/gui/pluginsdialog.h
+ sdrbase/gui/preferencesdialog.h
+ sdrbase/gui/presetitem.h
+ sdrbase/gui/rollupwidget.h
+ sdrbase/gui/scale.h
+ sdrbase/gui/scaleengine.h
+ sdrbase/gui/valuedial.h
- include/dsp/samplesource.h
+ sdrbase/dsp/samplesource.h
- include/plugin/pluginapi.h
- include/plugin/plugingui.h
- include/plugin/plugininterface.h
- include/plugin/pluginmanager.h
+ sdrbase/plugin/pluginapi.h
+ sdrbase/plugin/plugingui.h
+ sdrbase/plugin/plugininterface.h
+ sdrbase/plugin/pluginmanager.h
- include/settings/preferences.h
- include/settings/preset.h
- include/settings/mainsettings.h
+ sdrbase/settings/preferences.h
+ sdrbase/settings/preset.h
+ sdrbase/settings/mainsettings.h
- include/util/CRC64.h
- include/util/db.h
- include/util/export.h
- include/util/message.h
- include/util/messagequeue.h
- include/util/prettyprint.h
- include/util/syncmessenger.h
- include/util/samplesourceserializer.h
- include/util/simpleserializer.h
- #include/util/spinlock.h
+ sdrbase/util/CRC64.h
+ sdrbase/util/db.h
+ sdrbase/util/export.h
+ sdrbase/util/message.h
+ sdrbase/util/messagequeue.h
+ sdrbase/util/prettyprint.h
+ sdrbase/util/syncmessenger.h
+ sdrbase/util/samplesourceserializer.h
+ sdrbase/util/simpleserializer.h
+ #sdrbase/util/spinlock.h
)
set(sdrbase_SOURCES
@@ -268,7 +268,7 @@ if(FFTW3F_FOUND)
)
set(sdrbase_HEADERS
${sdrbase_HEADERS}
- include/dsp/fftwengine.h
+ sdrbase/dsp/fftwengine.h
)
add_definitions(-DUSE_FFTW)
include_directories(${FFTW3F_INCLUDE_DIRS})
@@ -276,11 +276,11 @@ else(FFTW3F_FOUND)
set(sdrbase_SOURCES
${sdrbase_SOURCES}
sdrbase/dsp/kissengine.cpp
- include/dsp/kissfft.h
+ sdrbase/dsp/kissfft.h
)
set(sdrbase_HEADERS
${sdrbase_HEADERS}
- include/dsp/kissengine.h
+ sdrbase/dsp/kissengine.h
)
add_definitions(-DUSE_KISSFFT)
endif(FFTW3F_FOUND)
@@ -319,8 +319,7 @@ qt5_use_modules(sdrbase Core Widgets OpenGL Multimedia)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_SOURCE_DIR}/sdrbase
${OPENGL_INCLUDE_DIR}
)
@@ -341,7 +340,7 @@ endif()
##############################################################################
set(sdrangel_SOURCES
- main.cpp
+ app/main.cpp
)
if(WIN32)
diff --git a/main.cpp b/app/main.cpp
similarity index 100%
rename from main.cpp
rename to app/main.cpp
diff --git a/include/audio/audiodeviceinfo.h b/include.old/audio/audiodeviceinfo.h
similarity index 100%
rename from include/audio/audiodeviceinfo.h
rename to include.old/audio/audiodeviceinfo.h
diff --git a/include/audio/audiofifo.h b/include.old/audio/audiofifo.h
similarity index 100%
rename from include/audio/audiofifo.h
rename to include.old/audio/audiofifo.h
diff --git a/include/audio/audiooutput.h b/include.old/audio/audiooutput.h
similarity index 100%
rename from include/audio/audiooutput.h
rename to include.old/audio/audiooutput.h
diff --git a/include/dsp/afsquelch.h b/include.old/dsp/afsquelch.h
similarity index 100%
rename from include/dsp/afsquelch.h
rename to include.old/dsp/afsquelch.h
diff --git a/include/dsp/agc.h b/include.old/dsp/agc.h
similarity index 100%
rename from include/dsp/agc.h
rename to include.old/dsp/agc.h
diff --git a/include/dsp/bandpass.h b/include.old/dsp/bandpass.h
similarity index 100%
rename from include/dsp/bandpass.h
rename to include.old/dsp/bandpass.h
diff --git a/include/dsp/channelizer.h b/include.old/dsp/channelizer.h
similarity index 100%
rename from include/dsp/channelizer.h
rename to include.old/dsp/channelizer.h
diff --git a/include/dsp/channelmarker.h b/include.old/dsp/channelmarker.h
similarity index 100%
rename from include/dsp/channelmarker.h
rename to include.old/dsp/channelmarker.h
diff --git a/include/dsp/complex.h b/include.old/dsp/complex.h
similarity index 100%
rename from include/dsp/complex.h
rename to include.old/dsp/complex.h
diff --git a/include/dsp/ctcssdetector.h b/include.old/dsp/ctcssdetector.h
similarity index 100%
rename from include/dsp/ctcssdetector.h
rename to include.old/dsp/ctcssdetector.h
diff --git a/include/dsp/decimators.h b/include.old/dsp/decimators.h
similarity index 100%
rename from include/dsp/decimators.h
rename to include.old/dsp/decimators.h
diff --git a/include/dsp/dspcommands.h b/include.old/dsp/dspcommands.h
similarity index 100%
rename from include/dsp/dspcommands.h
rename to include.old/dsp/dspcommands.h
diff --git a/include/dsp/dspdeviceengine.h b/include.old/dsp/dspdeviceengine.h
similarity index 100%
rename from include/dsp/dspdeviceengine.h
rename to include.old/dsp/dspdeviceengine.h
diff --git a/include/dsp/dspengine.h b/include.old/dsp/dspengine.h
similarity index 100%
rename from include/dsp/dspengine.h
rename to include.old/dsp/dspengine.h
diff --git a/include/dsp/dsptypes.h b/include.old/dsp/dsptypes.h
similarity index 100%
rename from include/dsp/dsptypes.h
rename to include.old/dsp/dsptypes.h
diff --git a/include/dsp/fftengine.h b/include.old/dsp/fftengine.h
similarity index 100%
rename from include/dsp/fftengine.h
rename to include.old/dsp/fftengine.h
diff --git a/include/dsp/fftfilt.h b/include.old/dsp/fftfilt.h
similarity index 100%
rename from include/dsp/fftfilt.h
rename to include.old/dsp/fftfilt.h
diff --git a/include/dsp/fftwengine.h b/include.old/dsp/fftwengine.h
similarity index 100%
rename from include/dsp/fftwengine.h
rename to include.old/dsp/fftwengine.h
diff --git a/include/dsp/fftwindow.h b/include.old/dsp/fftwindow.h
similarity index 100%
rename from include/dsp/fftwindow.h
rename to include.old/dsp/fftwindow.h
diff --git a/include/dsp/filesink.h b/include.old/dsp/filesink.h
similarity index 100%
rename from include/dsp/filesink.h
rename to include.old/dsp/filesink.h
diff --git a/include/dsp/filterrc.h b/include.old/dsp/filterrc.h
similarity index 100%
rename from include/dsp/filterrc.h
rename to include.old/dsp/filterrc.h
diff --git a/include/dsp/gfft.h b/include.old/dsp/gfft.h
similarity index 100%
rename from include/dsp/gfft.h
rename to include.old/dsp/gfft.h
diff --git a/include/dsp/highpass.h b/include.old/dsp/highpass.h
similarity index 100%
rename from include/dsp/highpass.h
rename to include.old/dsp/highpass.h
diff --git a/include/dsp/interpolator.h b/include.old/dsp/interpolator.h
similarity index 100%
rename from include/dsp/interpolator.h
rename to include.old/dsp/interpolator.h
diff --git a/include/dsp/inthalfbandfilter.h b/include.old/dsp/inthalfbandfilter.h
similarity index 100%
rename from include/dsp/inthalfbandfilter.h
rename to include.old/dsp/inthalfbandfilter.h
diff --git a/include/dsp/kissengine.h b/include.old/dsp/kissengine.h
similarity index 100%
rename from include/dsp/kissengine.h
rename to include.old/dsp/kissengine.h
diff --git a/include/dsp/kissfft.h b/include.old/dsp/kissfft.h
similarity index 100%
rename from include/dsp/kissfft.h
rename to include.old/dsp/kissfft.h
diff --git a/include/dsp/lowpass.h b/include.old/dsp/lowpass.h
similarity index 100%
rename from include/dsp/lowpass.h
rename to include.old/dsp/lowpass.h
diff --git a/include/dsp/misc.h b/include.old/dsp/misc.h
similarity index 100%
rename from include/dsp/misc.h
rename to include.old/dsp/misc.h
diff --git a/include/dsp/movingaverage.h b/include.old/dsp/movingaverage.h
similarity index 100%
rename from include/dsp/movingaverage.h
rename to include.old/dsp/movingaverage.h
diff --git a/include/dsp/nco.h b/include.old/dsp/nco.h
similarity index 100%
rename from include/dsp/nco.h
rename to include.old/dsp/nco.h
diff --git a/include/dsp/nullsink.h b/include.old/dsp/nullsink.h
similarity index 100%
rename from include/dsp/nullsink.h
rename to include.old/dsp/nullsink.h
diff --git a/include/dsp/phasediscri.h b/include.old/dsp/phasediscri.h
similarity index 100%
rename from include/dsp/phasediscri.h
rename to include.old/dsp/phasediscri.h
diff --git a/include/dsp/phaselock.h b/include.old/dsp/phaselock.h
similarity index 100%
rename from include/dsp/phaselock.h
rename to include.old/dsp/phaselock.h
diff --git a/include/dsp/pidcontroller.h b/include.old/dsp/pidcontroller.h
similarity index 100%
rename from include/dsp/pidcontroller.h
rename to include.old/dsp/pidcontroller.h
diff --git a/include/dsp/samplefifo.h b/include.old/dsp/samplefifo.h
similarity index 100%
rename from include/dsp/samplefifo.h
rename to include.old/dsp/samplefifo.h
diff --git a/include/dsp/samplesink.h b/include.old/dsp/samplesink.h
similarity index 100%
rename from include/dsp/samplesink.h
rename to include.old/dsp/samplesink.h
diff --git a/include/dsp/samplesource.h b/include.old/dsp/samplesource.h
similarity index 100%
rename from include/dsp/samplesource.h
rename to include.old/dsp/samplesource.h
diff --git a/include/dsp/scopevis.h b/include.old/dsp/scopevis.h
similarity index 100%
rename from include/dsp/scopevis.h
rename to include.old/dsp/scopevis.h
diff --git a/include/dsp/spectrumscopecombovis.h b/include.old/dsp/spectrumscopecombovis.h
similarity index 100%
rename from include/dsp/spectrumscopecombovis.h
rename to include.old/dsp/spectrumscopecombovis.h
diff --git a/include/dsp/spectrumvis.h b/include.old/dsp/spectrumvis.h
similarity index 100%
rename from include/dsp/spectrumvis.h
rename to include.old/dsp/spectrumvis.h
diff --git a/include/dsp/threadedsamplesink.h b/include.old/dsp/threadedsamplesink.h
similarity index 100%
rename from include/dsp/threadedsamplesink.h
rename to include.old/dsp/threadedsamplesink.h
diff --git a/include/gui/aboutdialog.h b/include.old/gui/aboutdialog.h
similarity index 100%
rename from include/gui/aboutdialog.h
rename to include.old/gui/aboutdialog.h
diff --git a/include/gui/addpresetdialog.h b/include.old/gui/addpresetdialog.h
similarity index 100%
rename from include/gui/addpresetdialog.h
rename to include.old/gui/addpresetdialog.h
diff --git a/include/gui/basicchannelsettingswidget.h b/include.old/gui/basicchannelsettingswidget.h
similarity index 100%
rename from include/gui/basicchannelsettingswidget.h
rename to include.old/gui/basicchannelsettingswidget.h
diff --git a/include/gui/buttonswitch.h b/include.old/gui/buttonswitch.h
similarity index 100%
rename from include/gui/buttonswitch.h
rename to include.old/gui/buttonswitch.h
diff --git a/include/gui/channelwindow.h b/include.old/gui/channelwindow.h
similarity index 100%
rename from include/gui/channelwindow.h
rename to include.old/gui/channelwindow.h
diff --git a/include/gui/colormapper.h b/include.old/gui/colormapper.h
similarity index 100%
rename from include/gui/colormapper.h
rename to include.old/gui/colormapper.h
diff --git a/include/gui/glscope.h b/include.old/gui/glscope.h
similarity index 100%
rename from include/gui/glscope.h
rename to include.old/gui/glscope.h
diff --git a/include/gui/glscopegui.h b/include.old/gui/glscopegui.h
similarity index 100%
rename from include/gui/glscopegui.h
rename to include.old/gui/glscopegui.h
diff --git a/include/gui/glshadersimple.h b/include.old/gui/glshadersimple.h
similarity index 100%
rename from include/gui/glshadersimple.h
rename to include.old/gui/glshadersimple.h
diff --git a/include/gui/glshadertextured.h b/include.old/gui/glshadertextured.h
similarity index 100%
rename from include/gui/glshadertextured.h
rename to include.old/gui/glshadertextured.h
diff --git a/include/gui/glspectrum.h b/include.old/gui/glspectrum.h
similarity index 100%
rename from include/gui/glspectrum.h
rename to include.old/gui/glspectrum.h
diff --git a/include/gui/glspectrumgui.h b/include.old/gui/glspectrumgui.h
similarity index 100%
rename from include/gui/glspectrumgui.h
rename to include.old/gui/glspectrumgui.h
diff --git a/include/gui/indicator.h b/include.old/gui/indicator.h
similarity index 100%
rename from include/gui/indicator.h
rename to include.old/gui/indicator.h
diff --git a/include/gui/physicalunit.h b/include.old/gui/physicalunit.h
similarity index 100%
rename from include/gui/physicalunit.h
rename to include.old/gui/physicalunit.h
diff --git a/include/gui/pluginsdialog.h b/include.old/gui/pluginsdialog.h
similarity index 100%
rename from include/gui/pluginsdialog.h
rename to include.old/gui/pluginsdialog.h
diff --git a/include/gui/preferencesdialog.h b/include.old/gui/preferencesdialog.h
similarity index 100%
rename from include/gui/preferencesdialog.h
rename to include.old/gui/preferencesdialog.h
diff --git a/include/gui/presetitem.h b/include.old/gui/presetitem.h
similarity index 100%
rename from include/gui/presetitem.h
rename to include.old/gui/presetitem.h
diff --git a/include/gui/rollupwidget.h b/include.old/gui/rollupwidget.h
similarity index 100%
rename from include/gui/rollupwidget.h
rename to include.old/gui/rollupwidget.h
diff --git a/include/gui/scale.h b/include.old/gui/scale.h
similarity index 100%
rename from include/gui/scale.h
rename to include.old/gui/scale.h
diff --git a/include/gui/scaleengine.h b/include.old/gui/scaleengine.h
similarity index 100%
rename from include/gui/scaleengine.h
rename to include.old/gui/scaleengine.h
diff --git a/include/gui/valuedial.h b/include.old/gui/valuedial.h
similarity index 100%
rename from include/gui/valuedial.h
rename to include.old/gui/valuedial.h
diff --git a/include/mainwindow.h b/include.old/mainwindow.h
similarity index 100%
rename from include/mainwindow.h
rename to include.old/mainwindow.h
diff --git a/include/plugin/pluginapi.h b/include.old/plugin/pluginapi.h
similarity index 100%
rename from include/plugin/pluginapi.h
rename to include.old/plugin/pluginapi.h
diff --git a/include/plugin/plugingui.h b/include.old/plugin/plugingui.h
similarity index 100%
rename from include/plugin/plugingui.h
rename to include.old/plugin/plugingui.h
diff --git a/include/plugin/plugininterface.h b/include.old/plugin/plugininterface.h
similarity index 100%
rename from include/plugin/plugininterface.h
rename to include.old/plugin/plugininterface.h
diff --git a/include/plugin/pluginmanager.h b/include.old/plugin/pluginmanager.h
similarity index 100%
rename from include/plugin/pluginmanager.h
rename to include.old/plugin/pluginmanager.h
diff --git a/include/settings/mainsettings.h b/include.old/settings/mainsettings.h
similarity index 100%
rename from include/settings/mainsettings.h
rename to include.old/settings/mainsettings.h
diff --git a/include/settings/preferences.h b/include.old/settings/preferences.h
similarity index 100%
rename from include/settings/preferences.h
rename to include.old/settings/preferences.h
diff --git a/include/settings/preset.h b/include.old/settings/preset.h
similarity index 100%
rename from include/settings/preset.h
rename to include.old/settings/preset.h
diff --git a/include/util/CRC64.h b/include.old/util/CRC64.h
similarity index 100%
rename from include/util/CRC64.h
rename to include.old/util/CRC64.h
diff --git a/include/util/bitfieldindex.h b/include.old/util/bitfieldindex.h
similarity index 100%
rename from include/util/bitfieldindex.h
rename to include.old/util/bitfieldindex.h
diff --git a/include/util/db.h b/include.old/util/db.h
similarity index 100%
rename from include/util/db.h
rename to include.old/util/db.h
diff --git a/include/util/export.h b/include.old/util/export.h
similarity index 100%
rename from include/util/export.h
rename to include.old/util/export.h
diff --git a/include/util/message.h b/include.old/util/message.h
similarity index 100%
rename from include/util/message.h
rename to include.old/util/message.h
diff --git a/include/util/messagequeue.h b/include.old/util/messagequeue.h
similarity index 100%
rename from include/util/messagequeue.h
rename to include.old/util/messagequeue.h
diff --git a/include/util/prettyprint.h b/include.old/util/prettyprint.h
similarity index 100%
rename from include/util/prettyprint.h
rename to include.old/util/prettyprint.h
diff --git a/include/util/samplesourceserializer.h b/include.old/util/samplesourceserializer.h
similarity index 100%
rename from include/util/samplesourceserializer.h
rename to include.old/util/samplesourceserializer.h
diff --git a/include/util/simpleserializer.h b/include.old/util/simpleserializer.h
similarity index 100%
rename from include/util/simpleserializer.h
rename to include.old/util/simpleserializer.h
diff --git a/include/util/spinlock.h b/include.old/util/spinlock.h
similarity index 100%
rename from include/util/spinlock.h
rename to include.old/util/spinlock.h
diff --git a/include/util/stacktrace.h b/include.old/util/stacktrace.h
similarity index 100%
rename from include/util/stacktrace.h
rename to include.old/util/stacktrace.h
diff --git a/include/util/syncmessenger.h b/include.old/util/syncmessenger.h
similarity index 100%
rename from include/util/syncmessenger.h
rename to include.old/util/syncmessenger.h
diff --git a/include/util/threadsafesingleton.h b/include.old/util/threadsafesingleton.h
similarity index 100%
rename from include/util/threadsafesingleton.h
rename to include.old/util/threadsafesingleton.h
diff --git a/include/util/udpsink.h b/include.old/util/udpsink.h
similarity index 100%
rename from include/util/udpsink.h
rename to include.old/util/udpsink.h
diff --git a/sdrbase/audio/audiodeviceinfo.h b/sdrbase/audio/audiodeviceinfo.h
new file mode 100644
index 000000000..c2a018651
--- /dev/null
+++ b/sdrbase/audio/audiodeviceinfo.h
@@ -0,0 +1,49 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
+// written by Christian Daniel //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDE_AUDIODEVICEINFO_H
+#define INCLUDE_AUDIODEVICEINFO_H
+
+#include
+#include "util/export.h"
+
+class SDRANGEL_API AudioDeviceInfo {
+public:
+ struct Device {
+ QString name;
+ QString api;
+ int id;
+
+ Device(const QString& _name, const QString& _api, int _id) :
+ name(_name),
+ api(_api),
+ id(_id)
+ { }
+ };
+ typedef QList Devices;
+
+ AudioDeviceInfo();
+
+ int match(const QString& api, const QString device) const;
+
+ const Devices& getDevices() const { return m_devices; }
+
+private:
+ Devices m_devices;
+};
+
+#endif // INCLUDE_AUDIODEVICEINFO_H
diff --git a/sdrbase/audio/audiofifo.h b/sdrbase/audio/audiofifo.h
new file mode 100644
index 000000000..ce6b1ba89
--- /dev/null
+++ b/sdrbase/audio/audiofifo.h
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
+// written by Christian Daniel //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDE_AUDIOFIFO_H
+#define INCLUDE_AUDIOFIFO_H
+
+#include
+#include
+#include
+#include "util/export.h"
+
+class SDRANGEL_API AudioFifo : public QObject {
+ Q_OBJECT
+public:
+ AudioFifo();
+ AudioFifo(uint sampleSize, uint numSamples);
+ ~AudioFifo();
+
+ bool setSize(uint sampleSize, uint numSamples);
+
+ uint write(const quint8* data, uint numSamples, int timeout_ms = INT_MAX);
+ uint read(quint8* data, uint numSamples, int timeout_ms = INT_MAX);
+
+ uint drain(uint numSamples);
+ void clear();
+
+ inline uint flush() { return drain(m_fill); }
+ inline uint fill() const { return m_fill; }
+ inline bool isEmpty() const { return m_fill == 0; }
+ inline bool isFull() const { return m_fill == m_size; }
+ inline uint size() const { return m_size; }
+
+private:
+ QMutex m_mutex;
+
+ qint8* m_fifo;
+
+ uint m_sampleSize;
+
+ uint m_size;
+ uint m_fill;
+ uint m_head;
+ uint m_tail;
+
+ QMutex m_writeWaitLock;
+ QMutex m_readWaitLock;
+ QWaitCondition m_writeWaitCondition;
+ QWaitCondition m_readWaitCondition;
+
+ bool create(uint sampleSize, uint numSamples);
+};
+
+#endif // INCLUDE_AUDIOFIFO_H
diff --git a/sdrbase/audio/audiooutput.h b/sdrbase/audio/audiooutput.h
new file mode 100644
index 000000000..eeb802333
--- /dev/null
+++ b/sdrbase/audio/audiooutput.h
@@ -0,0 +1,62 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
+// written by Christian Daniel //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDE_AUDIOOUTPUT_H
+#define INCLUDE_AUDIOOUTPUT_H
+
+#include
+#include
+#include
+#include
+#include
+#include "util/export.h"
+
+class QAudioOutput;
+class AudioFifo;
+class AudioOutputPipe;
+
+class SDRANGEL_API AudioOutput : QIODevice {
+public:
+ AudioOutput();
+ virtual ~AudioOutput();
+
+ bool start(int device, int rate);
+ void stop();
+
+ void addFifo(AudioFifo* audioFifo);
+ void removeFifo(AudioFifo* audioFifo);
+
+ uint getRate() const { return m_audioFormat.sampleRate(); }
+
+private:
+ QMutex m_mutex;
+ QAudioOutput* m_audioOutput;
+
+ typedef std::list AudioFifos;
+ AudioFifos m_audioFifos;
+ std::vector m_mixBuffer;
+
+ QAudioFormat m_audioFormat;
+
+ //virtual bool open(OpenMode mode);
+ virtual qint64 readData(char* data, qint64 maxLen);
+ virtual qint64 writeData(const char* data, qint64 len);
+
+ friend class AudioOutputPipe;
+};
+
+#endif // INCLUDE_AUDIOOUTPUT_H
diff --git a/sdrbase/dsp/afsquelch.h b/sdrbase/dsp/afsquelch.h
new file mode 100644
index 000000000..eb587995d
--- /dev/null
+++ b/sdrbase/dsp/afsquelch.h
@@ -0,0 +1,90 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2015 Edouard Griffiths, F4EXB. //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDE_GPL_DSP_AFSQUELCH_H_
+#define INCLUDE_GPL_DSP_AFSQUELCH_H_
+
+#include "dsp/dsptypes.h"
+#include "dsp/movingaverage.h"
+
+/** AFSquelch: AF squelch class based on the Modified Goertzel
+ * algorithm.
+ */
+class AFSquelch {
+public:
+ // Constructors and Destructor
+ AFSquelch();
+ // allows user defined tone pair
+ AFSquelch(unsigned int nbTones,
+ const Real *tones);
+ virtual ~AFSquelch();
+
+ // setup the basic parameters and coefficients
+ void setCoefficients(
+ int N, //!< the algorithm "block" size
+ unsigned int nbAvg, //!< averaging size
+ int SampleRate, //!< input signal sample rate
+ int _samplesAttack, //!< number of results before squelch opens
+ int _samplesDecay); //!< number of results keeping squelch open
+
+ // set the detection threshold
+ void setThreshold(double _threshold);
+
+ // analyze a sample set and optionally filter
+ // the tone frequencies.
+ bool analyze(Real sample); // input signal sample
+ bool evaluate(); // evaluate result
+
+ // get the tone set
+ const Real *getToneSet() const
+ {
+ return m_toneSet;
+ }
+
+ bool open() const {
+ return m_isOpen;
+ }
+
+ void reset(); // reset the analysis algorithm
+
+protected:
+ void feedback(Real sample);
+ void feedForward();
+
+private:
+ unsigned int m_nbAvg; //!< number of power samples taken for moving average
+ int m_N;
+ int m_sampleRate;
+ int m_samplesProcessed;
+ int m_maxPowerIndex;
+ int m_nTones;
+ int m_samplesAttack;
+ int m_attackCount;
+ int m_samplesDecay;
+ int m_decayCount;
+ bool m_isOpen;
+ double m_threshold;
+ double *m_k;
+ double *m_coef;
+ Real *m_toneSet;
+ double *m_u0;
+ double *m_u1;
+ double *m_power;
+ std::vector > m_movingAverages;
+};
+
+
+#endif /* INCLUDE_GPL_DSP_CTCSSDETECTOR_H_ */
diff --git a/sdrbase/dsp/agc.h b/sdrbase/dsp/agc.h
new file mode 100644
index 000000000..e6e320800
--- /dev/null
+++ b/sdrbase/dsp/agc.h
@@ -0,0 +1,128 @@
+/*
+ * kissagc.h
+ *
+ * Created on: May 12, 2015
+ * Author: f4exb
+ */
+
+#ifndef INCLUDE_GPL_DSP_AGC_H_
+#define INCLUDE_GPL_DSP_AGC_H_
+
+#include "movingaverage.h"
+
+class AGC
+{
+public:
+
+ AGC();
+ AGC(int historySize, Real R);
+ virtual ~AGC();
+
+ void resize(int historySize, Real R);
+ Real getValue();
+ Real getAverage();
+ virtual void feed(Complex& ci) = 0;
+
+protected:
+ Real m_u0;
+ Real m_R; // objective mag
+ MovingAverage m_moving_average; // Averaging engine. The stack length conditions the smoothness of AGC.
+ int m_historySize;
+ int m_count;
+};
+
+class MagSquaredAGC : public AGC
+{
+public:
+ MagSquaredAGC();
+ MagSquaredAGC(int historySize, Real R);
+ virtual ~MagSquaredAGC();
+ virtual void feed(Complex& ci);
+ Real getMagSq() const { return m_magsq; }
+private:
+ Real m_magsq;
+};
+
+class MagAGC : public AGC
+{
+public:
+ MagAGC();
+ MagAGC(int historySize, Real R);
+ virtual ~MagAGC();
+ virtual void feed(Complex& ci);
+ Real getMagSq() const { return m_magsq; }
+private:
+ Real m_magsq;
+};
+
+class AlphaAGC : public AGC
+{
+public:
+ AlphaAGC();
+ AlphaAGC(int historySize, Real R);
+ AlphaAGC(int historySize, Real R, Real alpha);
+ virtual ~AlphaAGC();
+ void resize(int historySize, Real R, Real alpha);
+ virtual void feed(Complex& ci);
+ Real getMagSq() const { return m_magsq; }
+private:
+ Real m_alpha;
+ Real m_magsq;
+ bool m_squelchOpen;
+};
+
+class SimpleAGC
+{
+public:
+ SimpleAGC() :
+ m_squelchOpen(false),
+ m_fill(0),
+ m_cutoff(0),
+ m_clip(0),
+ m_moving_average()
+ {}
+
+ SimpleAGC(int historySize, Real initial, Real cutoff=0, Real clip=0) :
+ m_squelchOpen(false),
+ m_fill(initial),
+ m_cutoff(cutoff),
+ m_clip(clip),
+ m_moving_average(historySize, initial)
+ {}
+
+ void resize(int historySize, Real initial, Real cutoff=0, Real clip=0)
+ {
+ m_fill = initial;
+ m_cutoff = cutoff;
+ m_clip = clip;
+ m_moving_average.resize(historySize, initial);
+ }
+
+ Real getValue()
+ {
+ if (m_moving_average.average() > m_clip)
+ {
+ return m_moving_average.average();
+ } else
+ {
+ return m_clip;
+ }
+ }
+
+ void feed(Real value)
+ {
+ if (value > m_cutoff)
+ {
+ m_moving_average.feed(value);
+ }
+ }
+
+private:
+ bool m_squelchOpen; // open for processing
+ Real m_fill; // refill average at this level
+ Real m_cutoff; // consider samples only above this level
+ Real m_clip; // never go below this level
+ MovingAverage m_moving_average; // Averaging engine. The stack length conditions the smoothness of AGC.
+};
+
+#endif /* INCLUDE_GPL_DSP_AGC_H_ */
diff --git a/sdrbase/dsp/bandpass.h b/sdrbase/dsp/bandpass.h
new file mode 100644
index 000000000..3e0ffb147
--- /dev/null
+++ b/sdrbase/dsp/bandpass.h
@@ -0,0 +1,127 @@
+#ifndef INCLUDE_BANDPASS_H
+#define INCLUDE_BANDPASS_H
+
+#define _USE_MATH_DEFINES
+#include
+#include "dsp/dsptypes.h"
+
+template class Bandpass {
+public:
+ Bandpass() { }
+
+ void create(int nTaps, double sampleRate, double lowCutoff, double highCutoff)
+ {
+ std::vector taps_lp;
+ std::vector taps_hp;
+ double wcl = 2.0 * M_PI * lowCutoff;
+ double Wcl = wcl / sampleRate;
+ double wch = 2.0 * M_PI * highCutoff;
+ double Wch = wch / sampleRate;
+ int i;
+
+ // check constraints
+ if(!(nTaps & 1)) {
+ qDebug("Bandpass filter has to have an odd number of taps");
+ nTaps++;
+ }
+
+ // make room
+ m_samples.resize(nTaps);
+ for(int i = 0; i < nTaps; i++)
+ m_samples[i] = 0;
+ m_ptr = 0;
+ m_taps.resize(nTaps / 2 + 1);
+ taps_lp.resize(nTaps / 2 + 1);
+ taps_hp.resize(nTaps / 2 + 1);
+
+ // generate Sinc filter core
+ for(i = 0; i < nTaps / 2 + 1; i++) {
+ if(i == (nTaps - 1) / 2) {
+ taps_lp[i] = Wch / M_PI;
+ taps_hp[i] = -(Wcl / M_PI);
+ }
+ else {
+ taps_lp[i] = sin(((double)i - ((double)nTaps - 1.0) / 2.0) * Wch) / (((double)i - ((double)nTaps - 1.0) / 2.0) * M_PI);
+ taps_hp[i] = -sin(((double)i - ((double)nTaps - 1.0) / 2.0) * Wcl) / (((double)i - ((double)nTaps - 1.0) / 2.0) * M_PI);
+ }
+ }
+
+ taps_hp[(nTaps - 1) / 2] += 1;
+
+ // apply Hamming window and combine lowpass and highpass
+ for(i = 0; i < nTaps / 2 + 1; i++) {
+ taps_lp[i] *= 0.54 + 0.46 * cos((2.0 * M_PI * ((double)i - ((double)nTaps - 1.0) / 2.0)) / (double)nTaps);
+ taps_hp[i] *= 0.54 + 0.46 * cos((2.0 * M_PI * ((double)i - ((double)nTaps - 1.0) / 2.0)) / (double)nTaps);
+ m_taps[i] = -(taps_lp[i]+taps_hp[i]);
+ }
+
+ m_taps[(nTaps - 1) / 2] += 1;
+
+ // normalize
+ Real sum = 0;
+
+ for(i = 0; i < (int)m_taps.size() - 1; i++) {
+ sum += m_taps[i] * 2;
+ }
+
+ sum += m_taps[i];
+
+ for(i = 0; i < (int)m_taps.size(); i++) {
+ m_taps[i] /= sum;
+ }
+ }
+
+ Type filter(Type sample)
+ {
+ Type acc = 0;
+ int a = m_ptr;
+ int b = a - 1;
+ int i, n_taps, size;
+
+ m_samples[m_ptr] = sample;
+ size = m_samples.size(); // Valgrind optim (2)
+
+ while(b < 0)
+ {
+ b += size;
+ }
+
+ n_taps = m_taps.size() - 1; // Valgrind optim
+
+ for(i = 0; i < n_taps; i++)
+ {
+ acc += (m_samples[a] + m_samples[b]) * m_taps[i];
+ a++;
+
+ while (a >= size)
+ {
+ a -= size;
+ }
+
+ b--;
+
+ while(b < 0)
+ {
+ b += size;
+ }
+ }
+
+ acc += m_samples[a] * m_taps[i];
+
+ m_ptr++;
+
+ while (m_ptr >= size)
+ {
+ m_ptr -= size;
+ }
+
+ return acc;
+ }
+
+private:
+ std::vector m_taps;
+ std::vector m_samples;
+ int m_ptr;
+};
+
+#endif // INCLUDE_BANDPASS_H
diff --git a/sdrbase/dsp/channelizer.h b/sdrbase/dsp/channelizer.h
new file mode 100644
index 000000000..a45b21fed
--- /dev/null
+++ b/sdrbase/dsp/channelizer.h
@@ -0,0 +1,85 @@
+#ifndef INCLUDE_CHANNELIZER_H
+#define INCLUDE_CHANNELIZER_H
+
+#include
+#include
+#include "dsp/samplesink.h"
+#include "util/export.h"
+#include "util/message.h"
+
+class MessageQueue;
+class IntHalfbandFilter;
+
+class SDRANGEL_API Channelizer : public SampleSink {
+ Q_OBJECT
+public:
+ class SDRANGEL_API MsgChannelizerNotification : public Message {
+ MESSAGE_CLASS_DECLARATION
+
+ public:
+ MsgChannelizerNotification(int samplerate, qint64 frequencyOffset) :
+ Message(),
+ m_sampleRate(samplerate),
+ m_frequencyOffset(frequencyOffset)
+ { }
+
+ int getSampleRate() const { return m_sampleRate; }
+ qint64 getFrequencyOffset() const { return m_frequencyOffset; }
+
+ private:
+ int m_sampleRate;
+ qint64 m_frequencyOffset;
+ };
+
+ Channelizer(SampleSink* sampleSink);
+ virtual ~Channelizer();
+
+ void configure(MessageQueue* messageQueue, int sampleRate, int centerFrequency);
+ int getInputSampleRate() const { return m_inputSampleRate; }
+
+ virtual void start();
+ virtual void stop();
+ virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
+ virtual bool handleMessage(const Message& cmd);
+
+protected:
+ struct FilterStage {
+ enum Mode {
+ ModeCenter,
+ ModeLowerHalf,
+ ModeUpperHalf
+ };
+
+ typedef bool (IntHalfbandFilter::*WorkFunction)(Sample* s);
+ IntHalfbandFilter* m_filter;
+ WorkFunction m_workFunction;
+
+ FilterStage(Mode mode);
+ ~FilterStage();
+
+ bool work(Sample* sample)
+ {
+ return (m_filter->*m_workFunction)(sample);
+ }
+ };
+ typedef std::list FilterStages;
+ FilterStages m_filterStages;
+ SampleSink* m_sampleSink;
+ int m_inputSampleRate;
+ int m_requestedOutputSampleRate;
+ int m_requestedCenterFrequency;
+ int m_currentOutputSampleRate;
+ int m_currentCenterFrequency;
+ SampleVector m_sampleBuffer;
+ QMutex m_mutex;
+
+ void applyConfiguration();
+ bool signalContainsChannel(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd) const;
+ Real createFilterChain(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd);
+ void freeFilterChain();
+
+signals:
+ void inputSampleRateChanged();
+};
+
+#endif // INCLUDE_CHANNELIZER_H
diff --git a/sdrbase/dsp/channelmarker.h b/sdrbase/dsp/channelmarker.h
new file mode 100644
index 000000000..66ed138ab
--- /dev/null
+++ b/sdrbase/dsp/channelmarker.h
@@ -0,0 +1,62 @@
+#ifndef INCLUDE_CHANNELMARKER_H
+#define INCLUDE_CHANNELMARKER_H
+
+#include
+#include
+#include "util/export.h"
+
+class SDRANGEL_API ChannelMarker : public QObject {
+ Q_OBJECT
+
+public:
+ typedef enum sidebands_e
+ {
+ dsb,
+ lsb,
+ usb
+ } sidebands_t;
+
+ ChannelMarker(QObject* parent = NULL);
+
+ void setTitle(const QString& title);
+ const QString& getTitle() const { return m_title; }
+
+ void setCenterFrequency(int centerFrequency);
+ int getCenterFrequency() const { return m_centerFrequency; }
+
+ void setBandwidth(int bandwidth);
+ int getBandwidth() const { return m_bandwidth; }
+
+ void setLowCutoff(int lowCutoff);
+ int getLowCutoff() const { return m_lowCutoff; }
+
+ void setSidebands(sidebands_t sidebands);
+ sidebands_t getSidebands() const { return m_sidebands; }
+
+ void setVisible(bool visible);
+ bool getVisible() const { return m_visible; }
+
+ void setHighlighted(bool highlighted);
+ bool getHighlighted() const { return m_highlighted; }
+
+ void setColor(const QColor& color);
+ const QColor& getColor() const { return m_color; }
+
+protected:
+ static QRgb m_colorTable[];
+ static int m_nextColor;
+
+ QString m_title;
+ int m_centerFrequency;
+ int m_bandwidth;
+ int m_lowCutoff;
+ sidebands_t m_sidebands;
+ bool m_visible;
+ bool m_highlighted;
+ QColor m_color;
+
+signals:
+ void changed();
+};
+
+#endif // INCLUDE_CHANNELMARKER_H
diff --git a/sdrbase/dsp/complex.h b/sdrbase/dsp/complex.h
new file mode 100644
index 000000000..2653a591c
--- /dev/null
+++ b/sdrbase/dsp/complex.h
@@ -0,0 +1,43 @@
+// ----------------------------------------------------------------------------
+// complex.h -- Complex arithmetic
+//
+// Copyright (C) 2006-2008
+// Dave Freese, W1HKJ
+// Copyright (C) 2008
+// Stelios Bounanos, M0GLD
+//
+// This file is part of fldigi.
+//
+// Fldigi is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Fldigi is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with fldigi. If not, see .
+// ----------------------------------------------------------------------------
+
+#ifndef _COMPLEX_H
+#define _COMPLEX_H
+
+#include
+#include
+
+typedef std::complex cmplx;
+
+inline cmplx cmac (const cmplx *a, const cmplx *b, int ptr, int len) {
+ cmplx z;
+ ptr %= len;
+ for (int i = 0; i < len; i++) {
+ z += a[i] * b[ptr];
+ ptr = (ptr + 1) % len;
+ }
+ return z;
+}
+
+#endif
diff --git a/sdrbase/dsp/ctcssdetector.h b/sdrbase/dsp/ctcssdetector.h
new file mode 100644
index 000000000..e3799c07c
--- /dev/null
+++ b/sdrbase/dsp/ctcssdetector.h
@@ -0,0 +1,88 @@
+/*
+ * ctcssdetector.h
+ *
+ * Created on: Jun 16, 2015
+ * Author: f4exb
+ * See: http://www.embedded.com/design/connectivity/4025660/Detecting-CTCSS-tones-with-Goertzel-s-algorithm
+ */
+
+#ifndef INCLUDE_GPL_DSP_CTCSSDETECTOR_H_
+#define INCLUDE_GPL_DSP_CTCSSDETECTOR_H_
+
+#include "dsp/dsptypes.h"
+
+/** CTCSSDetector: Continuous Tone Coded Squelch System
+ * tone detector class based on the Modified Goertzel
+ * algorithm.
+ */
+class CTCSSDetector {
+public:
+ // Constructors and Destructor
+ CTCSSDetector();
+ // allows user defined CTCSS tone set
+ CTCSSDetector(int _nTones, Real *tones);
+ virtual ~CTCSSDetector();
+
+ // setup the basic parameters and coefficients
+ void setCoefficients(
+ int zN, // the algorithm "block" size
+ int SampleRate); // input signal sample rate
+
+ // set the detection threshold
+ void setThreshold(double thold);
+
+ // analyze a sample set and optionally filter
+ // the tone frequencies.
+ bool analyze(Real *sample); // input signal sample
+
+ // get the number of defined tones.
+ int getNTones() const {
+ return nTones;
+ }
+
+ // get the tone set
+ const Real *getToneSet() const
+ {
+ return toneSet;
+ }
+
+ // get the currently detected tone, if any
+ bool getDetectedTone(int &maxTone) const
+ {
+ maxTone = maxPowerIndex;
+ return toneDetected;
+ }
+
+ // Get the max power at the detected tone.
+ Real getMaxPower() const
+ {
+ return maxPower;
+ }
+
+ void reset(); // reset the analysis algorithm
+
+protected:
+ // Override these to change behavior of the detector
+ virtual void initializePower();
+ virtual void evaluatePower();
+ void feedback(Real sample);
+ void feedForward();
+
+private:
+ int N;
+ int sampleRate;
+ int nTones;
+ int samplesProcessed;
+ int maxPowerIndex;
+ bool toneDetected;
+ Real maxPower;
+ Real *k;
+ Real *coef;
+ Real *toneSet;
+ Real *u0;
+ Real *u1;
+ Real *power;
+};
+
+
+#endif /* INCLUDE_GPL_DSP_CTCSSDETECTOR_H_ */
diff --git a/sdrbase/dsp/decimators.h b/sdrbase/dsp/decimators.h
new file mode 100644
index 000000000..403e908fc
--- /dev/null
+++ b/sdrbase/dsp/decimators.h
@@ -0,0 +1,1538 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2015 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDE_GPL_DSP_DECIMATORS_H_
+#define INCLUDE_GPL_DSP_DECIMATORS_H_
+
+#include "dsp/dsptypes.h"
+#include "dsp/inthalfbandfilter.h"
+
+template
+struct decimation_shifts
+{
+ static const uint pre1 = 0;
+ static const uint pre2 = 0;
+ static const uint post2 = 0;
+ static const uint pre4 = 0;
+ static const uint post4 = 0;
+ static const uint pre8 = 0;
+ static const uint post8 = 0;
+ static const uint pre16 = 0;
+ static const uint post16 = 0;
+ static const uint pre32 = 0;
+ static const uint post32 = 0;
+ static const uint pre64 = 0;
+ static const uint post64 = 0;
+};
+
+template<>
+struct decimation_shifts<16, 16>
+{
+ static const uint pre1 = 0;
+ static const uint pre2 = 0;
+ static const uint post2 = 1;
+ static const uint pre4 = 0;
+ static const uint post4 = 2;
+ static const uint pre8 = 0;
+ static const uint post8 = 3;
+ static const uint pre16 = 0;
+ static const uint post16 = 4;
+ static const uint pre32 = 0;
+ static const uint post32 = 5;
+ static const uint pre64 = 0;
+ static const uint post64 = 6;
+};
+
+template<>
+struct decimation_shifts<16, 12>
+{
+ static const uint pre1 = 4;
+ static const uint pre2 = 3;
+ static const uint post2 = 0;
+ static const uint pre4 = 2;
+ static const uint post4 = 0;
+ static const uint pre8 = 1;
+ static const uint post8 = 0;
+ static const uint pre16 = 0;
+ static const uint post16 = 0;
+ static const uint pre32 = 0;
+ static const uint post32 = 1;
+ static const uint pre64 = 0;
+ static const uint post64 = 2;
+};
+
+template<>
+struct decimation_shifts<16, 8>
+{
+ static const uint pre1 = 6;
+ static const uint pre2 = 5;
+ static const uint post2 = 0;
+ static const uint pre4 = 4;
+ static const uint post4 = 0;
+ static const uint pre8 = 3;
+ static const uint post8 = 0;
+ static const uint pre16 = 2;
+ static const uint post16 = 0;
+ static const uint pre32 = 1;
+ static const uint post32 = 0;
+ static const uint pre64 = 0;
+ static const uint post64 = 0;
+};
+
+template
+class Decimators
+{
+public:
+ void decimate1(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len);
+ void decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len);
+
+private:
+ IntHalfbandFilter m_decimator2; // 1st stages
+ IntHalfbandFilter m_decimator4; // 2nd stages
+ IntHalfbandFilter m_decimator8; // 3rd stages
+ IntHalfbandFilter m_decimator16; // 4th stages
+ IntHalfbandFilter m_decimator32; // 5th stages
+ IntHalfbandFilter m_decimator64; // 6th stages
+};
+
+template
+void Decimators::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal, yimag;
+
+ for (int pos = 0; pos < len - 1; pos += 2)
+ {
+ xreal = buf[pos+0];
+ yimag = buf[pos+1];
+ (**it).setReal(xreal << decimation_shifts::pre1); // Valgrind optim (2 - comment not repeated)
+ (**it).setImag(yimag << decimation_shifts::pre1);
+ ++(*it); // Valgrind optim (comment not repeated)
+ }
+}
+
+template
+void Decimators::decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal, yimag;
+
+ for (int pos = 0; pos < len - 7; pos += 8)
+ {
+ xreal = (buf[pos+0] - buf[pos+3]) << decimation_shifts::pre2;
+ yimag = (buf[pos+1] + buf[pos+2] - 255) << decimation_shifts::pre2;
+ (**it).setReal(xreal >> decimation_shifts::post2);
+ (**it).setImag(yimag >> decimation_shifts::post2);
+ ++(*it);
+
+ xreal = (buf[pos+7] - buf[pos+4]) << decimation_shifts::pre2;
+ yimag = (255 - buf[pos+5] - buf[pos+6]) << decimation_shifts::pre2;
+ (**it).setReal(xreal >> decimation_shifts::post2);
+ (**it).setImag(yimag >> decimation_shifts::post2);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal, yimag;
+
+ for (int pos = 0; pos < len - 7; pos += 8)
+ {
+ xreal = (buf[pos+0] - buf[pos+3]) << decimation_shifts::pre2;
+ yimag = (buf[pos+1] + buf[pos+2]) << decimation_shifts::pre2;
+ (**it).setReal(xreal >> decimation_shifts::post2);
+ (**it).setImag(yimag >> decimation_shifts::post2);
+ ++(*it);
+
+ xreal = (buf[pos+7] - buf[pos+4]) << decimation_shifts::pre2;
+ yimag = (- buf[pos+5] - buf[pos+6]) << decimation_shifts::pre2;
+ (**it).setReal(xreal >> decimation_shifts::post2);
+ (**it).setImag(yimag >> decimation_shifts::post2);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal, yimag;
+
+ for (int pos = 0; pos < len - 7; pos += 8)
+ {
+ xreal = (buf[pos+1] - buf[pos+2]) << decimation_shifts::pre2;
+ yimag = (- buf[pos+0] - buf[pos+3]) << decimation_shifts::pre2;
+ (**it).setReal(xreal >> decimation_shifts::post2);
+ (**it).setImag(yimag >> decimation_shifts::post2);
+ ++(*it);
+
+ xreal = (buf[pos+6] - buf[pos+5]) << decimation_shifts::pre2;
+ yimag = (buf[pos+4] + buf[pos+7]) << decimation_shifts::pre2;
+ (**it).setReal(xreal >> decimation_shifts::post2);
+ (**it).setImag(yimag >> decimation_shifts::post2);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal, yimag;
+
+ for (int pos = 0; pos < len - 7; pos += 8)
+ {
+ xreal = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre4;
+ yimag = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre4;
+
+ (**it).setReal(xreal >> decimation_shifts::post4);
+ (**it).setImag(yimag >> decimation_shifts::post4);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ // Sup (USB):
+ // x y x y x y x y / x -> 1,-2,-5,6 / y -> -0,-3,4,7
+ // [ rotate: 1, 0, -2, 3, -5, -4, 6, -7]
+ // Inf (LSB):
+ // x y x y x y x y / x -> 0,-3,-4,7 / y -> 1,2,-5,-6
+ // [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
+ qint32 xreal, yimag;
+
+ for (int pos = 0; pos < len - 7; pos += 8)
+ {
+ xreal = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre4;
+ yimag = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) << decimation_shifts::pre4;
+
+ (**it).setReal(xreal >> decimation_shifts::post4);
+ (**it).setImag(yimag >> decimation_shifts::post4);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal[2], yimag[2];
+
+ for (int pos = 0; pos < len - 15; pos += 8)
+ {
+ xreal[0] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre8;
+ yimag[0] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre8;
+ pos += 8;
+
+ xreal[1] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre8;
+ yimag[1] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre8;
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+
+ (**it).setReal(xreal[1] >> decimation_shifts::post8);
+ (**it).setImag(yimag[1] >> decimation_shifts::post8);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal[2], yimag[2];
+
+ for (int pos = 0; pos < len - 15; pos += 8)
+ {
+ xreal[0] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre8;
+ yimag[0] = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) << decimation_shifts::pre8;
+ pos += 8;
+
+ xreal[1] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre8;
+ yimag[1] = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]) << decimation_shifts::pre8;
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+
+ (**it).setReal(xreal[1] >> decimation_shifts::post8);
+ (**it).setImag(yimag[1] >> decimation_shifts::post8);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ // Offset tuning: 4x downsample and rotate, then
+ // downsample 4x more. [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
+ qint32 xreal[4], yimag[4];
+
+ for (int pos = 0; pos < len - 31; )
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre16;
+ yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre16;
+ pos += 8;
+ }
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+ m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]);
+
+ m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]);
+
+ (**it).setReal(xreal[3] >> decimation_shifts::post16);
+ (**it).setImag(yimag[3] >> decimation_shifts::post16);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ // Offset tuning: 4x downsample and rotate, then
+ // downsample 4x more. [ rotate: 1, 0, -2, 3, -5, -4, 6, -7]
+ qint32 xreal[4], yimag[4];
+
+ for (int pos = 0; pos < len - 31; )
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ xreal[i] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre16;
+ yimag[i] = (buf[pos+4] + buf[pos+7] - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre16;
+ pos += 8;
+ }
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+ m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]);
+
+ m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]);
+
+ (**it).setReal(xreal[3] >> decimation_shifts::post16);
+ (**it).setImag(yimag[3] >> decimation_shifts::post16);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal[8], yimag[8];
+
+ for (int pos = 0; pos < len - 63; )
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre32;
+ yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre32;
+ pos += 8;
+ }
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+ m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]);
+ m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]);
+ m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]);
+
+ m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]);
+ m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]);
+
+ m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]);
+
+ (**it).setReal(xreal[7] >> decimation_shifts::post32);
+ (**it).setImag(yimag[7] >> decimation_shifts::post32);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal[8], yimag[8];
+
+ for (int pos = 0; pos < len - 63; )
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ xreal[i] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre32;
+ yimag[i] = (buf[pos+4] + buf[pos+7] - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre32;
+ pos += 8;
+ }
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+ m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]);
+ m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]);
+ m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]);
+
+ m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]);
+ m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]);
+
+ m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]);
+
+ (**it).setReal(xreal[7] >> decimation_shifts::post32);
+ (**it).setImag(yimag[7] >> decimation_shifts::post32);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal[16], yimag[16];
+
+ for (int pos = 0; pos < len - 127; )
+ {
+ for (int i = 0; i < 16; i++)
+ {
+ xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << decimation_shifts::pre64;
+ yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << decimation_shifts::pre64;
+ pos += 8;
+ }
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+ m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]);
+ m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]);
+ m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]);
+ m_decimator2.myDecimate(xreal[8], yimag[8], &xreal[9], &yimag[9]);
+ m_decimator2.myDecimate(xreal[10], yimag[10], &xreal[11], &yimag[11]);
+ m_decimator2.myDecimate(xreal[12], yimag[12], &xreal[13], &yimag[13]);
+ m_decimator2.myDecimate(xreal[14], yimag[14], &xreal[15], &yimag[15]);
+
+ m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]);
+ m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]);
+ m_decimator4.myDecimate(xreal[9], yimag[9], &xreal[11], &yimag[11]);
+ m_decimator4.myDecimate(xreal[13], yimag[13], &xreal[15], &yimag[15]);
+
+ m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]);
+ m_decimator8.myDecimate(xreal[11], yimag[11], &xreal[15], &yimag[15]);
+
+ m_decimator16.myDecimate(xreal[7], yimag[7], &xreal[15], &yimag[15]);
+
+ (**it).setReal(xreal[15] >> decimation_shifts::post64);
+ (**it).setImag(yimag[15] >> decimation_shifts::post64);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 xreal[16], yimag[16];
+
+ for (int pos = 0; pos < len - 127; )
+ {
+ for (int i = 0; i < 16; i++)
+ {
+ xreal[i] = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]) << decimation_shifts::pre32;
+ yimag[i] = (buf[pos+4] + buf[pos+7] - buf[pos+0] - buf[pos+3]) << decimation_shifts::pre32;
+ pos += 8;
+ }
+
+ m_decimator2.myDecimate(xreal[0], yimag[0], &xreal[1], &yimag[1]);
+ m_decimator2.myDecimate(xreal[2], yimag[2], &xreal[3], &yimag[3]);
+ m_decimator2.myDecimate(xreal[4], yimag[4], &xreal[5], &yimag[5]);
+ m_decimator2.myDecimate(xreal[6], yimag[6], &xreal[7], &yimag[7]);
+ m_decimator2.myDecimate(xreal[8], yimag[8], &xreal[9], &yimag[9]);
+ m_decimator2.myDecimate(xreal[10], yimag[10], &xreal[11], &yimag[11]);
+ m_decimator2.myDecimate(xreal[12], yimag[12], &xreal[13], &yimag[13]);
+ m_decimator2.myDecimate(xreal[14], yimag[14], &xreal[15], &yimag[15]);
+
+ m_decimator4.myDecimate(xreal[1], yimag[1], &xreal[3], &yimag[3]);
+ m_decimator4.myDecimate(xreal[5], yimag[5], &xreal[7], &yimag[7]);
+ m_decimator4.myDecimate(xreal[9], yimag[9], &xreal[11], &yimag[11]);
+ m_decimator4.myDecimate(xreal[13], yimag[13], &xreal[15], &yimag[15]);
+
+ m_decimator8.myDecimate(xreal[3], yimag[3], &xreal[7], &yimag[7]);
+ m_decimator8.myDecimate(xreal[11], yimag[11], &xreal[15], &yimag[15]);
+
+ m_decimator16.myDecimate(xreal[7], yimag[7], &xreal[15], &yimag[15]);
+
+ (**it).setReal(xreal[15] >> decimation_shifts::post64);
+ (**it).setImag(yimag[15] >> decimation_shifts::post64);
+
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 intbuf[2];
+
+ for (int pos = 0; pos < len - 3; pos += 4)
+ {
+ intbuf[0] = buf[pos+2] << decimation_shifts::pre2;
+ intbuf[1] = buf[pos+3] << decimation_shifts::pre2;
+
+ m_decimator2.myDecimate(
+ buf[pos+0] << decimation_shifts::pre2,
+ buf[pos+1] << decimation_shifts::pre2,
+ &intbuf[0],
+ &intbuf[1]);
+
+ (**it).setReal(intbuf[0] >> decimation_shifts::post2);
+ (**it).setImag(intbuf[1] >> decimation_shifts::post2);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 intbuf[4];
+
+ for (int pos = 0; pos < len - 7; pos += 8)
+ {
+ intbuf[0] = buf[pos+2] << decimation_shifts::pre4;
+ intbuf[1] = buf[pos+3] << decimation_shifts::pre4;
+ intbuf[2] = buf[pos+6] << decimation_shifts::pre4;
+ intbuf[3] = buf[pos+7] << decimation_shifts::pre4;
+
+ m_decimator2.myDecimate(
+ buf[pos+0] << decimation_shifts::pre4,
+ buf[pos+1] << decimation_shifts::pre4,
+ &intbuf[0],
+ &intbuf[1]);
+ m_decimator2.myDecimate(
+ buf[pos+4] << decimation_shifts::pre4,
+ buf[pos+5] << decimation_shifts::pre4,
+ &intbuf[2],
+ &intbuf[3]);
+
+ m_decimator4.myDecimate(
+ intbuf[0],
+ intbuf[1],
+ &intbuf[2],
+ &intbuf[3]);
+
+ (**it).setReal(intbuf[2] >> decimation_shifts::post4);
+ (**it).setImag(intbuf[3] >> decimation_shifts::post4);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 intbuf[8];
+
+ for (int pos = 0; pos < len - 15; pos += 16)
+ {
+ intbuf[0] = buf[pos+2] << decimation_shifts::pre8;
+ intbuf[1] = buf[pos+3] << decimation_shifts::pre8;
+ intbuf[2] = buf[pos+6] << decimation_shifts::pre8;
+ intbuf[3] = buf[pos+7] << decimation_shifts::pre8;
+ intbuf[4] = buf[pos+10] << decimation_shifts::pre8;
+ intbuf[5] = buf[pos+11] << decimation_shifts::pre8;
+ intbuf[6] = buf[pos+14] << decimation_shifts::pre8;
+ intbuf[7] = buf[pos+15] << decimation_shifts::pre8;
+
+ m_decimator2.myDecimate(
+ buf[pos+0] << decimation_shifts::pre8,
+ buf[pos+1] << decimation_shifts::pre8,
+ &intbuf[0],
+ &intbuf[1]);
+ m_decimator2.myDecimate(
+ buf[pos+4] << decimation_shifts::pre8,
+ buf[pos+5] << decimation_shifts::pre8,
+ &intbuf[2],
+ &intbuf[3]);
+ m_decimator2.myDecimate(
+ buf[pos+8] << decimation_shifts::pre8,
+ buf[pos+9] << decimation_shifts::pre8,
+ &intbuf[4],
+ &intbuf[5]);
+ m_decimator2.myDecimate(
+ buf[pos+12] << decimation_shifts::pre8,
+ buf[pos+13] << decimation_shifts::pre8,
+ &intbuf[6],
+ &intbuf[7]);
+
+ m_decimator4.myDecimate(
+ intbuf[0],
+ intbuf[1],
+ &intbuf[2],
+ &intbuf[3]);
+ m_decimator4.myDecimate(
+ intbuf[4],
+ intbuf[5],
+ &intbuf[6],
+ &intbuf[7]);
+
+ m_decimator8.myDecimate(
+ intbuf[2],
+ intbuf[3],
+ &intbuf[6],
+ &intbuf[7]);
+
+ (**it).setReal(intbuf[6] >> decimation_shifts::post8);
+ (**it).setImag(intbuf[7] >> decimation_shifts::post8);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 intbuf[16];
+
+ for (int pos = 0; pos < len - 31; pos += 32)
+ {
+ intbuf[0] = buf[pos+2] << decimation_shifts::pre16;
+ intbuf[1] = buf[pos+3] << decimation_shifts::pre16;
+ intbuf[2] = buf[pos+6] << decimation_shifts::pre16;
+ intbuf[3] = buf[pos+7] << decimation_shifts::pre16;
+ intbuf[4] = buf[pos+10] << decimation_shifts::pre16;
+ intbuf[5] = buf[pos+11] << decimation_shifts::pre16;
+ intbuf[6] = buf[pos+14] << decimation_shifts::pre16;
+ intbuf[7] = buf[pos+15] << decimation_shifts::pre16;
+ intbuf[8] = buf[pos+18] << decimation_shifts::pre16;
+ intbuf[9] = buf[pos+19] << decimation_shifts::pre16;
+ intbuf[10] = buf[pos+22] << decimation_shifts::pre16;
+ intbuf[11] = buf[pos+23] << decimation_shifts::pre16;
+ intbuf[12] = buf[pos+26] << decimation_shifts::pre16;
+ intbuf[13] = buf[pos+27] << decimation_shifts::pre16;
+ intbuf[14] = buf[pos+30] << decimation_shifts::pre16;
+ intbuf[15] = buf[pos+31] << decimation_shifts::pre16;
+
+ m_decimator2.myDecimate(
+ buf[pos+0] << decimation_shifts::pre16,
+ buf[pos+1] << decimation_shifts::pre16,
+ &intbuf[0],
+ &intbuf[1]);
+ m_decimator2.myDecimate(
+ buf[pos+4] << decimation_shifts::pre16,
+ buf[pos+5] << decimation_shifts::pre16,
+ &intbuf[2],
+ &intbuf[3]);
+ m_decimator2.myDecimate(
+ buf[pos+8] << decimation_shifts::pre16,
+ buf[pos+9] << decimation_shifts::pre16,
+ &intbuf[4],
+ &intbuf[5]);
+ m_decimator2.myDecimate(
+ buf[pos+12] << decimation_shifts::pre16,
+ buf[pos+13] << decimation_shifts::pre16,
+ &intbuf[6],
+ &intbuf[7]);
+ m_decimator2.myDecimate(
+ buf[pos+16] << decimation_shifts::pre16,
+ buf[pos+17] << decimation_shifts::pre16,
+ &intbuf[8],
+ &intbuf[9]);
+ m_decimator2.myDecimate(
+ buf[pos+20] << decimation_shifts::pre16,
+ buf[pos+21] << decimation_shifts::pre16,
+ &intbuf[10],
+ &intbuf[11]);
+ m_decimator2.myDecimate(
+ buf[pos+24] << decimation_shifts::pre16,
+ buf[pos+25] << decimation_shifts::pre16,
+ &intbuf[12],
+ &intbuf[13]);
+ m_decimator2.myDecimate(
+ buf[pos+28] << decimation_shifts::pre16,
+ buf[pos+29] << decimation_shifts::pre16,
+ &intbuf[14],
+ &intbuf[15]);
+
+ m_decimator4.myDecimate(
+ intbuf[0],
+ intbuf[1],
+ &intbuf[2],
+ &intbuf[3]);
+ m_decimator4.myDecimate(
+ intbuf[4],
+ intbuf[5],
+ &intbuf[6],
+ &intbuf[7]);
+ m_decimator4.myDecimate(
+ intbuf[8],
+ intbuf[9],
+ &intbuf[10],
+ &intbuf[11]);
+ m_decimator4.myDecimate(
+ intbuf[12],
+ intbuf[13],
+ &intbuf[14],
+ &intbuf[15]);
+
+ m_decimator8.myDecimate(
+ intbuf[2],
+ intbuf[3],
+ &intbuf[6],
+ &intbuf[7]);
+ m_decimator8.myDecimate(
+ intbuf[10],
+ intbuf[11],
+ &intbuf[14],
+ &intbuf[15]);
+
+ m_decimator16.myDecimate(
+ intbuf[6],
+ intbuf[7],
+ &intbuf[14],
+ &intbuf[15]);
+
+ (**it).setReal(intbuf[14] >> decimation_shifts::post16);
+ (**it).setImag(intbuf[15] >> decimation_shifts::post16);
+ ++(*it);
+ }
+}
+
+template
+void Decimators::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
+{
+ qint32 intbuf[32];
+
+ for (int pos = 0; pos < len - 63; pos += 64)
+ {
+ intbuf[0] = buf[pos+2] << decimation_shifts::pre32;
+ intbuf[1] = buf[pos+3] << decimation_shifts::pre32;
+ intbuf[2] = buf[pos+6] << decimation_shifts::pre32;
+ intbuf[3] = buf[pos+7] << decimation_shifts::pre32;
+ intbuf[4] = buf[pos+10] << decimation_shifts::pre32;
+ intbuf[5] = buf[pos+11] << decimation_shifts::pre32;
+ intbuf[6] = buf[pos+14] << decimation_shifts::pre32;
+ intbuf[7] = buf[pos+15] << decimation_shifts::pre32;
+ intbuf[8] = buf[pos+18] << decimation_shifts::pre32;
+ intbuf[9] = buf[pos+19] << decimation_shifts::pre32;
+ intbuf[10] = buf[pos+22] << decimation_shifts::pre32;
+ intbuf[11] = buf[pos+23] << decimation_shifts::pre32;
+ intbuf[12] = buf[pos+26] << decimation_shifts::pre32;
+ intbuf[13] = buf[pos+27] << decimation_shifts::pre32;
+ intbuf[14] = buf[pos+30] << decimation_shifts::pre32;
+ intbuf[15] = buf[pos+31] << decimation_shifts::pre32;
+ intbuf[16] = buf[pos+34] << decimation_shifts::pre32;
+ intbuf[17] = buf[pos+35] << decimation_shifts::pre32;
+ intbuf[18] = buf[pos+38] << decimation_shifts::pre32;
+ intbuf[19] = buf[pos+39] << decimation_shifts::pre32;
+ intbuf[20] = buf[pos+42] << decimation_shifts::pre32;
+ intbuf[21] = buf[pos+43] << decimation_shifts::pre32;
+ intbuf[22] = buf[pos+46] << decimation_shifts::pre32;
+ intbuf[23] = buf[pos+47] << decimation_shifts::pre32;
+ intbuf[24] = buf[pos+50] << decimation_shifts::pre32;
+ intbuf[25] = buf[pos+51] << decimation_shifts::pre32;
+ intbuf[26] = buf[pos+54] << decimation_shifts::pre32;
+ intbuf[27] = buf[pos+55] << decimation_shifts::pre32;
+ intbuf[28] = buf[pos+58] << decimation_shifts::pre32;
+ intbuf[29] = buf[pos+59] << decimation_shifts::pre32;
+ intbuf[30] = buf[pos+62] << decimation_shifts::pre32;
+ intbuf[31] = buf[pos+63] << decimation_shifts::pre32;
+
+ m_decimator2.myDecimate(
+ buf[pos+0] << decimation_shifts::pre32,
+ buf[pos+1] << decimation_shifts::pre32,
+ &intbuf[0],
+ &intbuf[1]);
+ m_decimator2.myDecimate(
+ buf[pos+4] << decimation_shifts::pre32,
+ buf[pos+5] << decimation_shifts::pre32,
+ &intbuf[2],
+ &intbuf[3]);
+ m_decimator2.myDecimate(
+ buf[pos+8] << decimation_shifts::pre32,
+ buf[pos+9] << decimation_shifts::pre32,
+ &intbuf[4],
+ &intbuf[5]);
+ m_decimator2.myDecimate(
+ buf[pos+12] << decimation_shifts::pre32,
+ buf[pos+13] << decimation_shifts::pre32,
+ &intbuf[6],
+ &intbuf[7]);
+ m_decimator2.myDecimate(
+ buf[pos+16] << decimation_shifts::pre32,
+ buf[pos+17] << decimation_shifts::pre32,
+ &intbuf[8],
+ &intbuf[9]);
+ m_decimator2.myDecimate(
+ buf[pos+20] << decimation_shifts::pre32,
+ buf[pos+21] << decimation_shifts::pre32,
+ &intbuf[10],
+ &intbuf[11]);
+ m_decimator2.myDecimate(
+ buf[pos+24] << decimation_shifts::pre32,
+ buf[pos+25] << decimation_shifts::pre32,
+ &intbuf[12],
+ &intbuf[13]);
+ m_decimator2.myDecimate(
+ buf[pos+28] << decimation_shifts::pre32,
+ buf[pos+29] << decimation_shifts