From 863522d9ff598ec8d818c80237a1c25188ee14de Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 13 Nov 2016 02:59:31 +0100 Subject: [PATCH] SDRPlay support: source plugin interim state (1) compiles --- CMakeLists.txt | 1 + cmake/Modules/FindLibSDRPlay.cmake | 27 + debian/changelog | 8 +- plugins/samplesource/CMakeLists.txt | 8 + plugins/samplesource/sdrplay/CMakeLists.txt | 64 + plugins/samplesource/sdrplay/sdrplaygui.cpp | 824 +++++++++++ plugins/samplesource/sdrplay/sdrplaygui.h | 145 ++ plugins/samplesource/sdrplay/sdrplaygui.ui | 651 +++++++++ plugins/samplesource/sdrplay/sdrplayinput.cpp | 204 +++ plugins/samplesource/sdrplay/sdrplayinput.h | 92 ++ .../samplesource/sdrplay/sdrplayplugin.cpp | 111 ++ plugins/samplesource/sdrplay/sdrplayplugin.h | 47 + .../samplesource/sdrplay/sdrplaysettings.cpp | 99 ++ .../samplesource/sdrplay/sdrplaysettings.h | 50 + .../samplesource/sdrplay/sdrplaythread.cpp | 193 +++ plugins/samplesource/sdrplay/sdrplaythread.h | 70 + sdrbase/dsp/decimators.h | 1215 +++++++++++++++++ sdrbase/gui/aboutdialog.ui | 2 +- sdrbase/mainwindow.cpp | 2 +- 19 files changed, 3810 insertions(+), 3 deletions(-) create mode 100644 cmake/Modules/FindLibSDRPlay.cmake create mode 100644 plugins/samplesource/sdrplay/CMakeLists.txt create mode 100644 plugins/samplesource/sdrplay/sdrplaygui.cpp create mode 100644 plugins/samplesource/sdrplay/sdrplaygui.h create mode 100644 plugins/samplesource/sdrplay/sdrplaygui.ui create mode 100644 plugins/samplesource/sdrplay/sdrplayinput.cpp create mode 100644 plugins/samplesource/sdrplay/sdrplayinput.h create mode 100644 plugins/samplesource/sdrplay/sdrplayplugin.cpp create mode 100644 plugins/samplesource/sdrplay/sdrplayplugin.h create mode 100644 plugins/samplesource/sdrplay/sdrplaysettings.cpp create mode 100644 plugins/samplesource/sdrplay/sdrplaysettings.h create mode 100644 plugins/samplesource/sdrplay/sdrplaythread.cpp create mode 100644 plugins/samplesource/sdrplay/sdrplaythread.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7147bdf69..f1ffe5e4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -535,6 +535,7 @@ if (BUILD_DEBIAN) add_subdirectory(libhackrf) add_subdirectory(librtlsdr) add_subdirectory(libbladerf) + add_subdirectory(libsdrplay) endif (BUILD_DEBIAN) add_subdirectory(plugins) diff --git a/cmake/Modules/FindLibSDRPlay.cmake b/cmake/Modules/FindLibSDRPlay.cmake new file mode 100644 index 000000000..aed3657ca --- /dev/null +++ b/cmake/Modules/FindLibSDRPlay.cmake @@ -0,0 +1,27 @@ +if(NOT LIBSDRPLAY_FOUND) + pkg_check_modules (LIBSDRPLAY_PKG libsdrplay) + find_path(LIBSDRPLAY_INCLUDE_DIRS NAMES mirsdrapi-rsp.h + PATHS + ${LIBSDRPLAY_PKG_INCLUDE_DIRS} + /usr/include + /usr/local/include + ) + + find_library(LIBSDRPLAY_LIBRARIES NAMES mirsdrapi-rsp + PATHS + ${LIBSDRPLAY_PKG_LIBRARY_DIRS} + /usr/lib + /usr/local/lib + ) + +if(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES) + set(LIBSDRPLAY_FOUND TRUE CACHE INTERNAL "libsdrplay found") + message(STATUS "Found libsdrplay: ${LIBSDRPLAY_INCLUDE_DIRS}, ${LIBSDRPLAY_LIBRARIES}") +else(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES) + set(LIBSDRPLAY_FOUND FALSE CACHE INTERNAL "libsdrplay found") + message(STATUS "libsdrplay not found.") +endif(LIBSDRPLAY_INCLUDE_DIRS AND LIBSDRPLAY_LIBRARIES) + +mark_as_advanced(LIBSDRPLAY_LIBRARIES LIBSDRPLAY_INCLUDE_DIRS) + +endif(NOT LIBSDRPLAY_FOUND) diff --git a/debian/changelog b/debian/changelog index 7e5f3241d..9e4369aa3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ +sdrangel (2.3.0-1) unstable; urgency=medium + + * SDRPlay support: new input source plugin + + -- Edouard Griffiths, F4EXB Sun, 13 Nov 2016 23:14:18 +0100 + sdrangel (2.2.2-1) unstable; urgency=medium * Baseband Halfband FIR filter optimizations - -- Edouard Griffiths, F4EXB Wed, 02 Nov 2016 14:15:15 +0100 + -- Edouard Griffiths, F4EXB Wed, 11 Nov 2016 12:25:34 +0100 sdrangel (2.2.1-1) unstable; urgency=medium diff --git a/plugins/samplesource/CMakeLists.txt b/plugins/samplesource/CMakeLists.txt index e3bc889b1..eff8a72f0 100644 --- a/plugins/samplesource/CMakeLists.txt +++ b/plugins/samplesource/CMakeLists.txt @@ -42,6 +42,14 @@ if(LIBUSB_FOUND AND LIBHACKRF_FOUND) add_subdirectory(hackrf) endif(LIBUSB_FOUND AND LIBHACKRF_FOUND) +find_package(LibSDRPlay) +if(LIBUSB_FOUND AND LIBSDRPLAY_FOUND) + add_subdirectory(sdrplay) + message(STATUS "LibSDRPlay found") +else(LIBUSB_FOUND AND LIBSDRPLAY_FOUND) + message(STATUS "LibSDRPlay NOT found") +endif(LIBUSB_FOUND AND LIBSDRPLAY_FOUND) + #find_package(LibNANOMSG) #if(LIBNANOMSG_FOUND) # add_subdirectory(sdrdaemon) diff --git a/plugins/samplesource/sdrplay/CMakeLists.txt b/plugins/samplesource/sdrplay/CMakeLists.txt new file mode 100644 index 000000000..88f47e7c2 --- /dev/null +++ b/plugins/samplesource/sdrplay/CMakeLists.txt @@ -0,0 +1,64 @@ +project(sdrplay) + +set(sdrplay_SOURCES + sdrplaygui.cpp + sdrplayinput.cpp + sdrplayplugin.cpp + sdrplaysettings.cpp + sdrplaythread.cpp +) + +set(sdrplay_HEADERS + sdrplaygui.h + sdrplayinput.h + sdrplayplugin.h + sdrplaysettings.h + sdrplaythread.h +) + +set(sdrplay_FORMS + sdrplaygui.ui +) + +if (BUILD_DEBIAN) +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBSDRPLAYSRC} +) +else (BUILD_DEBIAN) +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBSDRPLAY_INCLUDE_DIRS} +) +endif (BUILD_DEBIAN) + +add_definitions(-DQT_PLUGIN) +add_definitions(-DQT_SHARED) + +qt5_wrap_ui(sdrplay_FORMS_HEADERS ${sdrplay_FORMS}) + +add_library(inputsdrplay SHARED + ${sdrplay_SOURCES} + ${sdrplay_HEADERS_MOC} + ${sdrplay_FORMS_HEADERS} +) + +if (BUILD_DEBIAN) +target_link_libraries(inputsdrplay + ${QT_LIBRARIES} + sdrplay + sdrbase +) +else (BUILD_DEBIAN) +target_link_libraries(inputsdrplay + ${QT_LIBRARIES} + ${LIBSDRPLAY_LIBRARIES} + sdrbase +) +endif (BUILD_DEBIAN) + +qt5_use_modules(inputsdrplay Core Widgets) + +install(TARGETS inputsdrplay DESTINATION lib/plugins/samplesource) diff --git a/plugins/samplesource/sdrplay/sdrplaygui.cpp b/plugins/samplesource/sdrplay/sdrplaygui.cpp new file mode 100644 index 000000000..15eaf7082 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaygui.cpp @@ -0,0 +1,824 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +#include "sdrplaygui.h" + +#include +#include + +#include "ui_sdrplaygui.h" +#include "gui/colormapper.h" +#include "gui/glspectrum.h" +#include "dsp/dspengine.h" +#include "dsp/dspcommands.h" + +// ==================================================================== + +unsigned int SDRPlayGui::m_bbGr[m_nbBands][m_nbGRValues] = { + { // 10k - 12M + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + }, + { // 12 - 30M + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + }, + { // 30 - 60M + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + }, + { // 60 - 120M + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + }, + { // 120 - 250M + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + }, + { // 250 - 420M + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + }, + { // 420M - 1G + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, + + }, + { // 1 - 2G + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, + } +}; + +unsigned int SDRPlayGui::m_lnaGr[m_nbBands][m_nbGRValues] = { + { // 10k - 12M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, + }, + { // 12 - 30M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, + }, + { // 30 - 60M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, + }, + { // 60 - 120M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, + }, + { // 120 - 250M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, + }, + { // 250 - 420M + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, + }, + { // 420M - 1G + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, + }, + { // 1 - 2G + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, + } +}; + +unsigned int SDRPlayGui::m_mixerGr[m_nbBands][m_nbGRValues] = { + { // 10k - 12M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 12 - 30M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 30 - 60M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 60 - 120M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 120 - 250M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 250 - 420M + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 420M - 1G + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + }, + { // 1 - 2G + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, + } +}; + +// ==================================================================== + +SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) : + QWidget(parent), + ui(new Ui::SDRPlayGui), + m_deviceAPI(deviceAPI) +{ + ui->setupUi(this); + ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); + ui->centerFrequency->setValueRange(7, 10U, 12000U); + + ui->fBand->clear(); + for (int i = 0; i < SDRPlayBands::getNbBands(); i++) + { + ui->fBand->addItem(SDRPlayBands::getBandName(i)); + } + + ui->ifFrequency->clear(); + for (int i = 0; i < SDRPlayIF::getNbIFs(); i++) + { + ui->ifFrequency->addItem(QString::number(SDRPlayIF::getIF(i))); + } + + ui->mirDCCorr->clear(); + for (int i = 0; i < SDRPlayDCCorr::getNbDCCorrs(); i++) + { + ui->mirDCCorr->addItem(SDRPlayDCCorr::getDCCorrName(i)); + } + + ui->samplerate->clear(); + for (int i = 0; i < SDRPlaySampleRates::getNbRates(); i++) + { + ui->samplerate->addItem(QString::number(SDRPlaySampleRates::getRate(i))); + } + + ui->bandwidth->clear(); + for (int i = 0; i < SDRPlayBandwidths::getNbBandwidths(); i++) + { + ui->bandwidth->addItem(QString::number(SDRPlayBandwidths::getBandwidth(i))); + } + + connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); + connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); + m_statusTimer.start(500); + + displaySettings(); + + // TODO: +// m_sampleSource = new SDRPlayInput(m_deviceAPI); +// m_deviceAPI->setSource(m_sampleSource); + + connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); + m_deviceAPI->setSource(m_sampleSource); + + char recFileNameCStr[30]; + sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID()); + m_fileSink = new FileRecord(std::string(recFileNameCStr)); + m_deviceAPI->addSink(m_fileSink); + + connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection); +} + +SDRPlayGui::~SDRPlayGui() +{ + delete ui; +} + +void SDRPlayGui::destroy() +{ + delete this; +} + +void SDRPlayGui::setName(const QString& name) +{ + setObjectName(name); +} + +QString SDRPlayGui::getName() const +{ + return objectName(); +} + +void SDRPlayGui::resetToDefaults() +{ + m_settings.resetToDefaults(); + displaySettings(); + sendSettings(); +} + +qint64 SDRPlayGui::getCenterFrequency() const +{ + return m_settings.m_centerFrequency; +} + +void SDRPlayGui::setCenterFrequency(qint64 centerFrequency) +{ + m_settings.m_centerFrequency = centerFrequency; + displaySettings(); + sendSettings(); +} + +QByteArray SDRPlayGui::serialize() const +{ + return m_settings.serialize(); +} + +bool SDRPlayGui::deserialize(const QByteArray& data) +{ + if(m_settings.deserialize(data)) + { + displaySettings(); + sendSettings(); + return true; + } + else + { + resetToDefaults(); + return false; + } +} + +bool SDRPlayGui::handleMessage(const Message& message) +{ + if (SDRPlayInput::MsgReportSDRPlay::match(message)) + { + displaySettings(); + return true; + } + else + { + return false; + } +} + +void SDRPlayGui::displaySettings() +{ + ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); + + ui->ppm->setValue(m_settings.m_LOppmTenths); + ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); + + ui->samplerate->setCurrentIndex(m_settings.m_devSampleRateIndex); + + ui->dcOffset->setChecked(m_settings.m_dcBlock); + ui->iqImbalance->setChecked(m_settings.m_iqCorrection); + + ui->fBand->setCurrentIndex(m_settings.m_frequencyBandIndex); + ui->ifFrequency->setCurrentIndex(m_settings.m_ifFrequencyIndex); + ui->mirDCCorr->setCurrentIndex(m_settings.m_mirDcCorrIndex); + ui->mirDCCorrTrackTime->setValue(m_settings.m_mirDcCorrTrackTimeIndex); + ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrIndex * 3)); + ui->samplerate->setCurrentIndex(m_settings.m_devSampleRateIndex); + + ui->decim->setCurrentIndex(m_settings.m_log2Decim); + ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos); + + ui->gr->setValue(m_settings.m_gainRedctionIndex); + + char grStrChr[20]; + + sprintf(grStrChr, "%02d-%02d-%02d", + 24 - m_lnaGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], + 19 - m_mixerGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], + 59 - m_bbGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex]); + + ui->grText->setText(QString(grStrChr)); +} + +void SDRPlayGui::sendSettings() +{ + if(!m_updateTimer.isActive()) + m_updateTimer.start(100); +} + +void SDRPlayGui::updateHardware() +{ + qDebug() << "SDRPlayGui::updateHardware"; + SDRPlayInput::MsgConfigureSDRPlay* message = SDRPlayInput::MsgConfigureSDRPlay::create( m_settings); + m_sampleSource->getInputMessageQueue()->push(message); + m_updateTimer.stop(); +} + +void SDRPlayGui::on_centerFrequency_changed(quint64 value) +{ + m_settings.m_centerFrequency = ui->centerFrequency->getValue(); + sendSettings(); +} + +void SDRPlayGui::on_ppm_valueChanged(int value) +{ + m_settings.m_LOppmTenths = value; + ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); + sendSettings(); +} + +void SDRPlayGui::on_dcOffset_toggled(bool checked) +{ + m_settings.m_dcBlock = checked; + sendSettings(); +} + +void SDRPlayGui::on_iqImbalance_toggled(bool checked) +{ + m_settings.m_iqCorrection = checked; + sendSettings(); +} + +void SDRPlayGui::on_fBband_currentIndexChanged(int index) +{ + ui->centerFrequency->setValueRange( + 7, + SDRPlayBands::getBandLow(index), + SDRPlayBands::getBandHigh(index)); + + ui->centerFrequency->setValue((SDRPlayBands::getBandLow(index)+SDRPlayBands::getBandHigh(index)) / 2); + m_settings.m_centerFrequency = ui->centerFrequency->getValue(); + m_settings.m_frequencyBandIndex = index; + + sendSettings(); +} + +void SDRPlayGui::on_mirDCCorr_currentIndexChanged(int index) +{ + m_settings.m_mirDcCorrIndex = index; + sendSettings(); +} + +void SDRPlayGui::on_mirDCCorrTrackTime_valueChanged(int value) +{ + m_settings.m_mirDcCorrTrackTimeIndex = value; + ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrIndex * 3)); + sendSettings(); +} + +void SDRPlayGui::on_bandwidth_currentIndexChanged(int index) +{ + m_settings.m_bandwidthIndex = index; + sendSettings(); +} + +void SDRPlayGui::on_samplerate_currentIndexChanged(int index) +{ + m_settings.m_devSampleRateIndex = index; + sendSettings(); +} + +void SDRPlayGui::on_decim_currentIndexChanged(int index) +{ + m_settings.m_log2Decim = index; + sendSettings(); +} + +void SDRPlayGui::on_fcPos_currentIndexChanged(int index) +{ + m_settings.m_fcPos = (SDRPlaySettings::fcPos_t) index; + sendSettings(); +} + +void SDRPlayGui::on_gr_valueChanged(int value) +{ + m_settings.m_gainRedctionIndex = value; + + char grStrChr[20]; + + sprintf(grStrChr, "%02d-%02d-%02d", + 24 - m_lnaGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], + 19 - m_mixerGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], + 59 - m_bbGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex]); + + ui->grText->setText(QString(grStrChr)); + + sendSettings(); +} + +// ==================================================================== + +unsigned int SDRPlaySampleRates::m_rates[m_nb_rates] = { + 2000, // 0 + 2048, // 1 + 2304, // 2 + 2400, // 3 + 3072, // 4 + 3200, // 5 + 4000, // 6 + 4096, // 7 + 4608, // 8 + 4800, // 9 + 5000, // 10 + 6000, // 11 + 6144, // 12 + 8000, // 13 + 8192, // 14 + 9216, // 15 + 9600, // 16 + 10000, // 17 +}; + +unsigned int SDRPlaySampleRates::getRate(unsigned int rate_index) +{ + if (rate_index < m_nb_rates) + { + return m_rates[rate_index]; + } + else + { + return m_rates[0]; + } +} + +unsigned int SDRPlaySampleRates::getRateIndex(unsigned int rate) +{ + for (unsigned int i=0; i < m_nb_rates; i++) + { + if (rate == m_rates[i]) + { + return i; + } + } + + return 0; +} + +unsigned int SDRPlaySampleRates::getNbRates() +{ + return SDRPlaySampleRates::m_nb_rates; +} + +// ==================================================================== + +unsigned int SDRPlayBandwidths::m_bw[m_nb_bw] = { + 200, // 0 + 300, // 1 + 600, // 2 + 1536, // 3 + 5000, // 4 + 6000, // 5 + 7000, // 6 + 8000, // 7 +}; + +unsigned int SDRPlayBandwidths::getBandwidth(unsigned int bandwidth_index) +{ + if (bandwidth_index < m_nb_bw) + { + return m_bw[bandwidth_index]; + } + else + { + return m_bw[0]; + } +} + +unsigned int SDRPlayBandwidths::getBandwidthIndex(unsigned int bandwidth) +{ + for (unsigned int i=0; i < m_nb_bw; i++) + { + if (bandwidth == m_bw[i]) + { + return i; + } + } + + return 0; +} + +unsigned int SDRPlayBandwidths::getNbBandwidths() +{ + return SDRPlayBandwidths::m_nb_bw; +} + +// ==================================================================== + +unsigned int SDRPlayIF::m_if[m_nb_if] = { + 0, // 0 + 450, // 1 + 1620, // 2 + 2048, // 3 +}; + +unsigned int SDRPlayIF::getIF(unsigned int if_index) +{ + if (if_index < m_nb_if) + { + return m_if[if_index]; + } + else + { + return m_if[0]; + } +} + +unsigned int SDRPlayIF::getIFIndex(unsigned int iff) +{ + for (unsigned int i=0; i < m_nb_if; i++) + { + if (iff == m_if[i]) + { + return i; + } + } + + return 0; +} + +unsigned int SDRPlayIF::getNbIFs() +{ + return SDRPlayIF::m_nb_if; +} + +// ==================================================================== + +/** Lower frequency bound in kHz inclusive */ +unsigned int SDRPlayBands::m_bandLow[m_nb_bands] = { + 10, // 0 + 12000, // 1 + 30000, // 2 + 60000, // 3 + 120000, // 4 + 250000, // 5 + 420000, // 6 + 1000000, // 7 +}; + +/** Lower frequency bound in kHz exclusive */ +unsigned int SDRPlayBands::m_bandHigh[m_nb_bands] = { + 12000, // 0 + 30000, // 1 + 60000, // 2 + 120000, // 3 + 250000, // 4 + 420000, // 5 + 1000000, // 6 + 2000000, // 7 +}; + +const char* SDRPlayBands::m_bandName[m_nb_bands] = { + "10k-12M", // 0 + "12-30M", // 1 + "30-60M", // 2 + "60-120M", // 3 + "120-250M", // 4 + "250-420M", // 5 + "420M-1G", // 6 + "1-2G", // 7 +}; + +QString SDRPlayBands::getBandName(unsigned int band_index) +{ + if (band_index < m_nb_bands) + { + return QString(m_bandName[band_index]); + } + else + { + return QString(m_bandName[0]); + } +} + +unsigned int SDRPlayBands::getBandLow(unsigned int band_index) +{ + if (band_index < m_nb_bands) + { + return m_bandLow[band_index]; + } + else + { + return m_bandLow[0]; + } +} + +unsigned int SDRPlayBands::getBandHigh(unsigned int band_index) +{ + if (band_index < m_nb_bands) + { + return m_bandHigh[band_index]; + } + else + { + return m_bandHigh[0]; + } +} + + +unsigned int SDRPlayBands::getNbBands() +{ + return SDRPlayBands::m_nb_bands; +} + +// ==================================================================== + +const char* SDRPlayDCCorr::m_dcCorrName[m_nb_dcCorrs] = { + "None", // 0 + "Per1", // 1 + "Per2", // 2 + "Per3", // 3 + "1Shot", // 4 + "Cont", // 5 +}; + +QString SDRPlayDCCorr::getDCCorrName(unsigned int dcCorr_index) +{ + if (dcCorr_index < m_nb_dcCorrs) + { + return QString(m_dcCorrName[dcCorr_index]); + } + else + { + return QString(m_dcCorrName[0]); + } +} + +unsigned int SDRPlayDCCorr::getNbDCCorrs() +{ + return SDRPlayDCCorr::m_nb_dcCorrs; +} diff --git a/plugins/samplesource/sdrplay/sdrplaygui.h b/plugins/samplesource/sdrplay/sdrplaygui.h new file mode 100644 index 000000000..6499adbac --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaygui.h @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_ +#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_ + +#include +#include "plugin/plugingui.h" + +#include "sdrplayinput.h" +#include "sdrplaysettings.h" + +class DeviceSampleSource; +class DeviceSourceAPI; +class FileRecord; + +namespace Ui { + class SDRPlayGui; +} + +class SDRPlayGui : public QWidget, public PluginGUI { + Q_OBJECT + +public: + explicit SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL); + virtual ~SDRPlayGui(); + void destroy(); + + void setName(const QString& name); + QString getName() const; + + virtual void resetToDefaults(); + virtual qint64 getCenterFrequency() const; + virtual void setCenterFrequency(qint64 centerFrequency); + virtual QByteArray serialize() const; + virtual bool deserialize(const QByteArray& data); + virtual bool handleMessage(const Message& message); + +private: + Ui::SDRPlayGui* ui; + + DeviceSourceAPI* m_deviceAPI; + SDRPlaySettings m_settings; + QTimer m_updateTimer; + QTimer m_statusTimer; + DeviceSampleSource* m_sampleSource; + FileRecord *m_fileSink; //!< File sink to record device I/Q output + int m_sampleRate; + quint64 m_deviceCenterFrequency; //!< Center frequency in device + int m_lastEngineState; + + static const unsigned int m_nbGRValues = 103; + static const unsigned int m_nbBands = 8; + static unsigned int m_bbGr[m_nbBands][m_nbGRValues]; + static unsigned int m_lnaGr[m_nbBands][m_nbGRValues]; + static unsigned int m_mixerGr[m_nbBands][m_nbGRValues]; + + void displaySettings(); + void sendSettings(); + +private slots: + void updateHardware(); + void on_centerFrequency_changed(quint64 value); + void on_ppm_valueChanged(int value); + void on_dcOffset_toggled(bool checked); + void on_iqImbalance_toggled(bool checked); + void on_fBband_currentIndexChanged(int index); + void on_mirDCCorr_currentIndexChanged(int index); + void on_mirDCCorrTrackTime_valueChanged(int value); + void on_bandwidth_currentIndexChanged(int index); + void on_samplerate_currentIndexChanged(int index); + void on_decim_currentIndexChanged(int index); + void on_fcPos_currentIndexChanged(int index); + void on_gr_valueChanged(int value); +}; + + +// ==================================================================== + +class SDRPlaySampleRates { +public: + static unsigned int getRate(unsigned int rate_index); + static unsigned int getRateIndex(unsigned int rate); + static unsigned int getNbRates(); +private: + static const unsigned int m_nb_rates = 18; + static unsigned int m_rates[m_nb_rates]; +}; + +class SDRPlayBandwidths { +public: + static unsigned int getBandwidth(unsigned int bandwidth_index); + static unsigned int getBandwidthIndex(unsigned int bandwidth); + static unsigned int getNbBandwidths(); +private: + static const unsigned int m_nb_bw = 8; + static unsigned int m_bw[m_nb_bw]; +}; + +class SDRPlayIF { +public: + static unsigned int getIF(unsigned int if_index); + static unsigned int getIFIndex(unsigned int iff); + static unsigned int getNbIFs(); +private: + static const unsigned int m_nb_if = 4; + static unsigned int m_if[m_nb_if]; +}; + +class SDRPlayBands { +public: + static QString getBandName(unsigned int band_index); + static unsigned int getBandLow(unsigned int band_index); + static unsigned int getBandHigh(unsigned int band_index); + static unsigned int getNbBands(); +private: + static const unsigned int m_nb_bands = 8; + static unsigned int m_bandLow[m_nb_bands]; + static unsigned int m_bandHigh[m_nb_bands]; + static const char* m_bandName[m_nb_bands]; +}; + +class SDRPlayDCCorr { +public: + static QString getDCCorrName(unsigned int dcCorr_index); + static unsigned int getNbDCCorrs(); +private: + static const unsigned int m_nb_dcCorrs = 6; + static const char* m_dcCorrName[m_nb_dcCorrs]; +}; + +#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_ */ diff --git a/plugins/samplesource/sdrplay/sdrplaygui.ui b/plugins/samplesource/sdrplay/sdrplaygui.ui new file mode 100644 index 000000000..7c6824f77 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaygui.ui @@ -0,0 +1,651 @@ + + + SDRPlayGui + + + + 0 + 0 + 291 + 210 + + + + + 0 + 0 + + + + + 0 + 210 + + + + + Sans Serif + 9 + + + + SDRPlay + + + + 3 + + + 2 + + + + + + + + + + + start/stop acquisition + + + + + + + :/play.png + :/stop.png:/play.png + + + + + + + Toggle record I/Q samples from device + + + + + + + :/record_off.png + :/record_on.png:/record_off.png + + + + + + + + + + + I/Q sample rate kS/s + + + 00000k + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + Monospace + 20 + + + + SizeVerCursor + + + Qt::StrongFocus + + + Tuner center frequency in kHz + + + + + + + kHz + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + + Qt::Horizontal + + + + + + + 3 + + + + + Local Oscillator ppm correction + + + -200 + + + 200 + + + 1 + + + Qt::Horizontal + + + + + + + + 40 + 0 + + + + 0.0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + LO ppm + + + + + + + + + + + Automatic IQ imbalance correction + + + IQ + + + + + + + Automatic DC offset removal + + + DC + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Auto + + + + + + + Frequency band + + + + + + + IF frequency in kHz + + + + + + + + + Qt::Horizontal + + + + + + + 3 + + + + + + 70 + 16777215 + + + + IF bandwidth in kHz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + BW + + + + + + + kHz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + MirSDR DC auto tracking + + + + + + -1 + + + 5 + + + + + + + + 24 + 24 + + + + MirSDR DC auto tracking time in uS + + + 1 + + + 63 + + + 35 + + + + + + + 105uS + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + 3 + + + + + Dec + + + + + + + + 50 + 16777215 + + + + Decimation factor + + + 0 + + + + 1 + + + + + 2 + + + + + 4 + + + + + 8 + + + + + 16 + + + + + 32 + + + + + 64 + + + + + + + + Fp + + + + + + + Relative position of device center frequency + + + + Inf + + + + + Sup + + + + + Cen + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 70 + 16777215 + + + + Sample rate in kS/s + + + + + + + + 0 + 0 + + + + SR + + + + + + + kS/s + + + + + + + + + Qt::Horizontal + + + + + + + 3 + + + + + Gain reduction + + + 0 + + + 102 + + + 1 + + + 35 + + + Qt::Horizontal + + + + + + + + 40 + 0 + + + + LNA-Mixer-BaseBand gains in dB + + + 24-19-59 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + GR + + + + + + + + + Qt::Horizontal + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + + + + + ValueDial + QWidget +
gui/valuedial.h
+ 1 +
+ + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
+
+ + + + +
diff --git a/plugins/samplesource/sdrplay/sdrplayinput.cpp b/plugins/samplesource/sdrplay/sdrplayinput.cpp new file mode 100644 index 000000000..ad5ccad6f --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplayinput.cpp @@ -0,0 +1,204 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +#include "util/simpleserializer.h" +#include "dsp/dspcommands.h" +#include "dsp/dspengine.h" +#include "sdrplaygui.h" +#include "sdrplayinput.h" + +#include + +#include "sdrplaythread.h" + +MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgConfigureSDRPlay, Message) +MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgReportSDRPlay, Message) + +SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) : + m_deviceAPI(deviceAPI), + m_settings(), + m_sdrPlayThread(0), + m_deviceDescription("SDRPlay"), + m_samplesPerPacket(4096) +{ +} + +SDRPlayInput::~SDRPlayInput() +{ + stop(); +} + +bool SDRPlayInput::init(const Message& cmd) +{ + return false; +} + +bool SDRPlayInput::start(int device) +{ + mir_sdr_ErrT r; + QMutexLocker mutexLocker(&m_mutex); + + if (!m_sampleFifo.setSize(96000 * 4)) + { + qCritical("SDRPlayInput::start: could not allocate SampleFifo"); + return false; + } + + if((m_sdrPlayThread = new SDRPlayThread(&m_sampleFifo)) == 0) + { + qFatal("SDRPlayInput::start: failed to create thread"); + return false; + } + + int agcSetPoint = m_settings.m_gainRedctionIndex; + double sampleRateMHz = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex) / 1e3; + double frequencyMHz = m_settings.m_centerFrequency / 1e6; + int infoOverallGr; + + mir_sdr_DCoffsetIQimbalanceControl(1, 0); + mir_sdr_AgcControl(mir_sdr_AGC_DISABLE, agcSetPoint, 0, 0, 0, 0, 1); + + r = mir_sdr_StreamInit( + &agcSetPoint, + sampleRateMHz, + frequencyMHz, + mir_sdr_BW_1_536, + mir_sdr_IF_Zero, + 1, /* LNA */ + &infoOverallGr, + 0, /* use internal gr tables according to band */ + &m_samplesPerPacket, + m_sdrPlayThread->streamCallback, + callbackGC, + 0); + + m_sdrPlayThread->startWork(); +} + +void SDRPlayInput::stop() +{ + mir_sdr_ErrT r; + QMutexLocker mutexLocker(&m_mutex); + + r = mir_sdr_StreamUninit(); + + if (r != mir_sdr_Success) + { + qCritical("SDRPlayInput::stop: stream uninit failed with code %d", (int) r); + } + + if(m_sdrPlayThread != 0) + { + m_sdrPlayThread->stopWork(); + delete m_sdrPlayThread; + m_sdrPlayThread = 0; + } +} + +const QString& SDRPlayInput::getDeviceDescription() const +{ + return m_deviceDescription; +} + +int SDRPlayInput::getSampleRate() const +{ + int rate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex); + return ((rate * 1000) / (1<configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection); + } + + if (m_settings.m_iqCorrection != settings.m_iqCorrection) + { + m_settings.m_iqCorrection = settings.m_iqCorrection; + m_deviceAPI->configureCorrections(m_settings.m_dcBlock, m_settings.m_iqCorrection); + } + + if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) + { + m_settings.m_log2Decim = settings.m_log2Decim; + forwardChange = true; + + if (m_sdrPlayThread != 0) + { + m_sdrPlayThread->setLog2Decimation(m_settings.m_log2Decim); + qDebug() << "SDRPlayInput: set decimation to " << (1<setFcPos((int) m_settings.m_fcPos); + qDebug() << "SDRPlayInput: set fc pos (enum) to " << (int) m_settings.m_fcPos; + } + } + + if (forwardChange) + { + int sampleRate = getSampleRate(); + DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency); + m_deviceAPI->getDeviceInputMessageQueue()->push(notif); + } +} + +void SDRPlayInput::callbackGC(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext) +{ + return; +} diff --git a/plugins/samplesource/sdrplay/sdrplayinput.h b/plugins/samplesource/sdrplay/sdrplayinput.h new file mode 100644 index 000000000..7c37d8af7 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplayinput.h @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ +#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ + +#include + +#include "sdrplaysettings.h" +#include +#include + +class DeviceSourceAPI; +class SDRPlayThread; + +class SDRPlayInput : public DeviceSampleSource { +public: + class MsgConfigureSDRPlay : public Message { + MESSAGE_CLASS_DECLARATION + + public: + const SDRPlaySettings& getSettings() const { return m_settings; } + + static MsgConfigureSDRPlay* create(const SDRPlaySettings& settings) + { + return new MsgConfigureSDRPlay(settings); + } + + private: + SDRPlaySettings m_settings; + + MsgConfigureSDRPlay(const SDRPlaySettings& settings) : + Message(), + m_settings(settings) + { } + }; + + class MsgReportSDRPlay : public Message { + MESSAGE_CLASS_DECLARATION + + public: + static MsgReportSDRPlay* create() + { + return new MsgReportSDRPlay(); + } + + protected: + MsgReportSDRPlay() : + Message() + { } + }; + + SDRPlayInput(DeviceSourceAPI *deviceAPI); + virtual ~SDRPlayInput(); + + virtual bool init(const Message& message); + virtual bool start(int device); + virtual void stop(); + + virtual const QString& getDeviceDescription() const; + virtual int getSampleRate() const; + virtual quint64 getCenterFrequency() const; + + virtual bool handleMessage(const Message& message); + +private: + bool applySettings(const SDRPlaySettings& settings, bool force); + static void callbackGC(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext); + + DeviceSourceAPI *m_deviceAPI; + QMutex m_mutex; + SDRPlaySettings m_settings; + SDRPlayThread* m_sdrPlayThread; + QString m_deviceDescription; + + int m_samplesPerPacket; +}; + +#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ */ diff --git a/plugins/samplesource/sdrplay/sdrplayplugin.cpp b/plugins/samplesource/sdrplay/sdrplayplugin.cpp new file mode 100644 index 000000000..bde51e6f8 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplayplugin.cpp @@ -0,0 +1,111 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include "plugin/pluginapi.h" +#include "util/simpleserializer.h" +#include "sdrplaygui.h" +#include "sdrplayplugin.h" +#include + +const PluginDescriptor SDRPlayPlugin::m_pluginDescriptor = { + QString("SDRPlay Input"), + QString("2.3.0"), + QString("(c) Edouard Griffiths, F4EXB"), + QString("https://github.com/f4exb/sdrangel"), + true, + QString("https://github.com/f4exb/sdrangel") +}; + +const QString SDRPlayPlugin::m_deviceTypeID = SDRPLAY_DEVICE_TYPE_ID; + +SDRPlayPlugin::SDRPlayPlugin(QObject* parent) : + QObject(parent) +{ +} + +const PluginDescriptor& SDRPlayPlugin::getPluginDescriptor() const +{ + return m_pluginDescriptor; +} + +void SDRPlayPlugin::initPlugin(PluginAPI* pluginAPI) +{ + pluginAPI->registerSampleSource(m_deviceTypeID, this); +} + +PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources() +{ + // USB device: + // New USB device found, idVendor=1df7, idProduct=2500 + // New USB device strings: Mfr=0, Product=0, SerialNumber=0 + + libusb_context *usb_context = 0; + ssize_t num_devs; + SamplingDevices result; + libusb_device **devs; + libusb_device *dev; + int i = 0; + + if (libusb_init(&usb_context)) { + return result; + } + + num_devs = libusb_get_device_list(usb_context, &devs); + + if (num_devs > 0) + { + while ((dev = devs[i++]) != 0) + { + struct libusb_device_descriptor desc; + struct libusb_config_descriptor *conf_desc = 0; + int res = libusb_get_device_descriptor(dev, &desc); + unsigned short dev_vid = desc.idVendor; + unsigned short dev_pid = desc.idProduct; + + if ((dev_vid == 0x1df7) && (dev_pid == 0x2500)) + { + QString displayedName(QString("SDRPlay[0] 0")); + + result.append(SamplingDevice(displayedName, + m_deviceTypeID, + QString("0"), + 0)); + break; + } + } + } + + libusb_free_device_list(devs, 1); + + return result; +} + +PluginGUI* SDRPlayPlugin::createSampleSourcePluginGUI(const QString& sourceId,QWidget **widget, DeviceSourceAPI *deviceAPI) +{ + if(sourceId == m_deviceTypeID) + { + SDRPlayGui* gui = new SDRPlayGui(deviceAPI); + *widget = gui; + return gui; + } + else + { + return 0; + } +} diff --git a/plugins/samplesource/sdrplay/sdrplayplugin.h b/plugins/samplesource/sdrplay/sdrplayplugin.h new file mode 100644 index 000000000..b50789a61 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplayplugin.h @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYPLUGIN_H_ +#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYPLUGIN_H_ + +#include +#include "plugin/plugininterface.h" + +class PluginAPI; + +#define SDRPLAY_DEVICE_TYPE_ID "sdrangel.samplesource.sdrplay" + +class SDRPlayPlugin : public QObject, public PluginInterface { + Q_OBJECT + Q_INTERFACES(PluginInterface) + Q_PLUGIN_METADATA(IID SDRPLAY_DEVICE_TYPE_ID) + +public: + explicit SDRPlayPlugin(QObject* parent = NULL); + + const PluginDescriptor& getPluginDescriptor() const; + void initPlugin(PluginAPI* pluginAPI); + + virtual SamplingDevices enumSampleSources(); + virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI); + + static const QString m_deviceTypeID; + +private: + static const PluginDescriptor m_pluginDescriptor; +}; + +#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYPLUGIN_H_ */ diff --git a/plugins/samplesource/sdrplay/sdrplaysettings.cpp b/plugins/samplesource/sdrplay/sdrplaysettings.cpp new file mode 100644 index 000000000..91ec6beb4 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaysettings.cpp @@ -0,0 +1,99 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "sdrplaysettings.h" + +#include +#include "util/simpleserializer.h" + +SDRPlaySettings::SDRPlaySettings() +{ + resetToDefaults(); +} + +void SDRPlaySettings::resetToDefaults() +{ + m_centerFrequency = 7040*1000; + m_LOppmTenths = 0; + m_frequencyBandIndex = 0; + m_ifFrequencyIndex = 0; + m_mirDcCorrIndex = 0; + m_mirDcCorrTrackTimeIndex = 1; + m_bandwidthIndex = 0; + m_devSampleRateIndex = 0; + m_gainRedctionIndex = 35; + m_log2Decim = 0; + m_fcPos = FC_POS_CENTER; + m_dcBlock = false; + m_iqCorrection = false; +} + +QByteArray SDRPlaySettings::serialize() const +{ + SimpleSerializer s(1); + + s.writeS32(1, m_LOppmTenths); + s.writeU32(2, m_frequencyBandIndex); + s.writeU32(3, m_ifFrequencyIndex); + s.writeU32(4, m_mirDcCorrIndex); + s.writeU32(5, m_mirDcCorrTrackTimeIndex); + s.writeU32(6, m_bandwidthIndex); + s.writeU32(7, m_devSampleRateIndex); + s.writeU32(8, m_gainRedctionIndex); + s.writeU32(9, m_log2Decim); + s.writeS32(10, (int) m_fcPos); + s.writeBool(11, m_dcBlock); + s.writeBool(12, m_iqCorrection); + + return s.final(); +} + +bool SDRPlaySettings::deserialize(const QByteArray& data) +{ + SimpleDeserializer d(data); + + if (!d.isValid()) + { + resetToDefaults(); + return false; + } + + if (d.getVersion() == 1) + { + int intval; + + d.readS32(1, &m_LOppmTenths, 0); + d.readU32(2, &m_frequencyBandIndex, 0); + d.readU32(3, &m_ifFrequencyIndex, 0); + d.readU32(4, &m_mirDcCorrIndex, 0); + d.readU32(5, &m_mirDcCorrTrackTimeIndex, 1); + d.readU32(6, &m_bandwidthIndex, 0); + d.readU32(7, &m_devSampleRateIndex, 0); + d.readU32(8, &m_gainRedctionIndex, 35); + d.readU32(9, &m_log2Decim, 0); + d.readS32(10, &intval, 0); + m_fcPos = (fcPos_t) intval; + d.readBool(11, &m_dcBlock, false); + d.readBool(12, &m_iqCorrection, false); + + return true; + } + else + { + resetToDefaults(); + return false; + } +} diff --git a/plugins/samplesource/sdrplay/sdrplaysettings.h b/plugins/samplesource/sdrplay/sdrplaysettings.h new file mode 100644 index 000000000..496befd3c --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaysettings.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 _SDRPLAY_SDRPLAYSETTINGS_H_ +#define _SDRPLAY_SDRPLAYSETTINGS_H_ + +#include +#include + +struct SDRPlaySettings { + typedef enum { + FC_POS_INFRA = 0, + FC_POS_SUPRA, + FC_POS_CENTER + } fcPos_t; + + uint64_t m_centerFrequency; + int32_t m_LOppmTenths; + uint32_t m_frequencyBandIndex; + uint32_t m_ifFrequencyIndex; + uint32_t m_mirDcCorrIndex; + uint32_t m_mirDcCorrTrackTimeIndex; + uint32_t m_bandwidthIndex; + uint32_t m_devSampleRateIndex; + uint32_t m_gainRedctionIndex; + uint32_t m_log2Decim; + fcPos_t m_fcPos; + bool m_dcBlock; + bool m_iqCorrection; + + SDRPlaySettings(); + void resetToDefaults(); + QByteArray serialize() const; + bool deserialize(const QByteArray& data); +}; + +#endif /* _SDRPLAY_SDRPLAYSETTINGS_H_ */ diff --git a/plugins/samplesource/sdrplay/sdrplaythread.cpp b/plugins/samplesource/sdrplay/sdrplaythread.cpp new file mode 100644 index 000000000..a5300e6fd --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaythread.cpp @@ -0,0 +1,193 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include "sdrplaythread.h" +#include "dsp/samplesinkfifo.h" + +SDRPlayThread *SDRPlayThread::m_this = 0; + +SDRPlayThread::SDRPlayThread(SampleSinkFifo* sampleFifo, QObject* parent) : + QThread(parent), + m_running(false), + m_convertBuffer(SDRPLAY_INIT_NBSAMPLES), + m_sampleFifo(sampleFifo), + m_log2Decim(0), + m_fcPos(0) +{ + m_this = this; +} + +SDRPlayThread::~SDRPlayThread() +{ + stopWork(); + m_this = 0; +} + +void SDRPlayThread::startWork() +{ + m_startWaitMutex.lock(); + start(); + while(!m_running) + m_startWaiter.wait(&m_startWaitMutex, 100); + m_startWaitMutex.unlock(); +} + +void SDRPlayThread::stopWork() +{ + m_running = false; + wait(); +} + +void SDRPlayThread::setLog2Decimation(unsigned int log2_decim) +{ + m_log2Decim = log2_decim; +} + +void SDRPlayThread::setFcPos(int fcPos) +{ + m_fcPos = fcPos; +} + +void SDRPlayThread::streamCallback( + short *xi, + short *xq, + unsigned int firstSampleNum, + int grChanged, + int rfChanged, + int fsChanged, + unsigned int numSamples, + unsigned int reset, + void *cbContext) +{ + m_this->callback(xi, xq, numSamples); +} + +void SDRPlayThread::callback(short *xi, short *xq, unsigned int numSamples) +{ + if (m_convertBuffer.size() < numSamples) + { + m_convertBuffer.resize(numSamples); + } + + SampleVector::iterator it = m_convertBuffer.begin(); + + if (m_log2Decim == 0) + { + m_decimators.decimate1(&it, xi, xq, numSamples); + } + else + { + if (m_fcPos == 0) // Infra + { + switch (m_log2Decim) + { + case 1: + m_decimators.decimate2_inf(&it, xi, xq, numSamples); + break; + case 2: + m_decimators.decimate4_inf(&it, xi, xq, numSamples); + break; + case 3: + m_decimators.decimate8_inf(&it, xi, xq, numSamples); + break; + case 4: + m_decimators.decimate16_inf(&it, xi, xq, numSamples); + break; + case 5: + m_decimators.decimate32_inf(&it, xi, xq, numSamples); + break; + case 6: + m_decimators.decimate64_inf(&it, xi, xq, numSamples); + break; + default: + break; + } + } + else if (m_fcPos == 1) // Supra + { + switch (m_log2Decim) + { + case 1: + m_decimators.decimate2_sup(&it, xi, xq, numSamples); + break; + case 2: + m_decimators.decimate4_sup(&it, xi, xq, numSamples); + break; + case 3: + m_decimators.decimate8_sup(&it, xi, xq, numSamples); + break; + case 4: + m_decimators.decimate16_sup(&it, xi, xq, numSamples); + break; + case 5: + m_decimators.decimate32_sup(&it, xi, xq, numSamples); + break; + case 6: + m_decimators.decimate64_sup(&it, xi, xq, numSamples); + break; + default: + break; + } + } + else if (m_fcPos == 2) // Center + { + switch (m_log2Decim) + { + case 1: + m_decimators.decimate2_cen(&it, xi, xq, numSamples); + break; + case 2: + m_decimators.decimate4_cen(&it, xi, xq, numSamples); + break; + case 3: + m_decimators.decimate8_cen(&it, xi, xq, numSamples); + break; + case 4: + m_decimators.decimate16_cen(&it, xi, xq, numSamples); + break; + case 5: + m_decimators.decimate32_cen(&it, xi, xq, numSamples); + break; + case 6: + m_decimators.decimate64_cen(&it, xi, xq, numSamples); + break; + default: + break; + } + } + } + + m_sampleFifo->write(m_convertBuffer.begin(), it); +} + +void SDRPlayThread::run() +{ + int res; + + m_running = true; + m_startWaiter.wakeAll(); + + while(m_running) + { + sleep(1); + } + + m_running = false; +} + + diff --git a/plugins/samplesource/sdrplay/sdrplaythread.h b/plugins/samplesource/sdrplay/sdrplaythread.h new file mode 100644 index 000000000..4de99f303 --- /dev/null +++ b/plugins/samplesource/sdrplay/sdrplaythread.h @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 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 PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_ +#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_ + +#include +#include +#include +#include +#include "dsp/samplesinkfifo.h" +#include "dsp/decimators.h" + +#define SDRPLAY_INIT_NBSAMPLES (1<<14) + +class SDRPlayThread : public QThread { + Q_OBJECT + +public: + SDRPlayThread(SampleSinkFifo* sampleFifo, QObject* parent = NULL); + ~SDRPlayThread(); + + void startWork(); + void stopWork(); + void setLog2Decimation(unsigned int log2_decim); + void setFcPos(int fcPos); + + static void streamCallback ( + short *xi, + short *xq, + unsigned int firstSampleNum, + int grChanged, + int rfChanged, + int fsChanged, + unsigned int numSamples, + unsigned int reset, + void *cbContext); + +private: + QMutex m_startWaitMutex; + QWaitCondition m_startWaiter; + bool m_running; + + SampleVector m_convertBuffer; + SampleSinkFifo* m_sampleFifo; + + unsigned int m_log2Decim; + int m_fcPos; + static SDRPlayThread *m_this; + + Decimators m_decimators; + + void run(); + void callback(short *xi, short *xq, unsigned int numSamples); +}; + +#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_ */ diff --git a/sdrbase/dsp/decimators.h b/sdrbase/dsp/decimators.h index 47a8bba45..f79d95382 100644 --- a/sdrbase/dsp/decimators.h +++ b/sdrbase/dsp/decimators.h @@ -102,6 +102,7 @@ template class Decimators { public: + // interleaved I/Q input buffer 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); @@ -122,6 +123,27 @@ public: 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); + // separate I and Q input buffers (ex: SDRPlay) + void decimate1(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate2_u(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate2_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate2_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate4_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate4_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate4_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate8_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate8_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate8_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate16_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate16_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate16_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate32_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate32_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate32_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate64_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate64_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); + void decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len); private: #ifdef USE_SSE4_1 @@ -156,6 +178,21 @@ void Decimators::decimate1(SampleVector::iterator* it, co } } +template +void Decimators::decimate1(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal, yimag; + + for (int pos = 0; pos < len; pos += 1) + { + xreal = bufI[pos]; + yimag = bufQ[pos]; + (**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) { @@ -177,6 +214,29 @@ void Decimators::decimate2_u(SampleVector::iterator* it, } } +template +void Decimators::decimate2_u(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal, yimag; + + for (int pos = 0; pos < len - 3; pos += 4) + { + // 0: I[0] 1: Q[0] 2: I[1] 3: Q[1] + xreal = (bufI[pos] - bufQ[pos+1]) << decimation_shifts::pre2; + yimag = (bufQ[pos] + bufI[pos+1] - 255) << decimation_shifts::pre2; + (**it).setReal(xreal >> decimation_shifts::post2); + (**it).setImag(yimag >> decimation_shifts::post2); + ++(*it); + + // 4: I[2] 5: Q[2] 6: I[3] 7: Q[3] + xreal = (bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre2; + yimag = (255 - bufQ[pos+2] - bufI[pos+3]) << 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) { @@ -198,6 +258,29 @@ void Decimators::decimate2_inf(SampleVector::iterator* it } } +template +void Decimators::decimate2_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal, yimag; + + for (int pos = 0; pos < len - 3; pos += 4) + { + // 0: I[0] 1: Q[0] 2: I[1] 3: Q[1] + xreal = (bufI[pos] - bufQ[pos+1]) << decimation_shifts::pre2; + yimag = (bufQ[pos] + bufI[pos+1]) << decimation_shifts::pre2; + (**it).setReal(xreal >> decimation_shifts::post2); + (**it).setImag(yimag >> decimation_shifts::post2); + ++(*it); + + // 4: I[2] 5: Q[2] 6: I[3] 7: Q[3] + xreal = (bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre2; + yimag = (- bufQ[pos+2] - bufI[pos+3]) << 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) { @@ -219,6 +302,29 @@ void Decimators::decimate2_sup(SampleVector::iterator* it } } +template +void Decimators::decimate2_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal, yimag; + + for (int pos = 0; pos < len - 3; pos += 4) + { + // 0: I[0] 1: Q[0] 2: I[1] 3: Q[1] + xreal = (bufQ[pos] - bufI[pos+1]) << decimation_shifts::pre2; + yimag = (- bufI[pos] - bufQ[pos+1]) << decimation_shifts::pre2; + (**it).setReal(xreal >> decimation_shifts::post2); + (**it).setImag(yimag >> decimation_shifts::post2); + ++(*it); + + // 4: I[2] 5: Q[2] 6: I[3] 7: Q[3] + xreal = (bufI[pos+3] - bufQ[pos+2]) << decimation_shifts::pre2; + yimag = (bufI[pos+2] + bufQ[pos+3]) << 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) { @@ -236,6 +342,23 @@ void Decimators::decimate4_inf(SampleVector::iterator* it } } +template +void Decimators::decimate4_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal, yimag; + + for (int pos = 0; pos < len - 3; pos += 4) + { + xreal = (bufI[pos] - bufQ[pos+1] + bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre4; + yimag = (bufQ[pos] - bufQ[pos+2] + bufI[pos+1] - bufI[pos+3]) << 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) { @@ -259,6 +382,23 @@ void Decimators::decimate4_sup(SampleVector::iterator* it } } +template +void Decimators::decimate4_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal, yimag; + + for (int pos = 0; pos < len - 3; pos += 4) + { + xreal = (bufQ[pos] - bufI[pos+1] - bufQ[pos+2] + bufI[pos+3]) << decimation_shifts::pre4; + yimag = (- bufI[pos] - bufQ[pos+1] + bufI[pos+2] + bufQ[pos+3]) << 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) { @@ -282,6 +422,29 @@ void Decimators::decimate8_inf(SampleVector::iterator* it } } +template +void Decimators::decimate8_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal[2], yimag[2]; + + for (int pos = 0; pos < len - 7; pos += 4) + { + xreal[0] = (bufI[pos] - bufQ[pos+1] + bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre8; + yimag[0] = (bufQ[pos] - bufQ[pos+2] + bufI[pos+1] - bufI[pos+3]) << decimation_shifts::pre8; + pos += 4; + + xreal[1] = (bufI[pos] - bufQ[pos+1] + bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre8; + yimag[1] = (bufQ[pos] - bufQ[pos+2] + bufI[pos+1] - bufQ[pos+3]) << 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) { @@ -305,6 +468,29 @@ void Decimators::decimate8_sup(SampleVector::iterator* it } } +template +void Decimators::decimate8_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal[2], yimag[2]; + + for (int pos = 0; pos < len - 7; pos += 4) + { + xreal[0] = (bufQ[pos] - bufI[pos+1] - bufQ[pos+2] + bufI[pos+3]) << decimation_shifts::pre8; + yimag[0] = (- bufI[pos] - bufQ[pos+1] + bufI[pos+2] + bufQ[pos+3]) << decimation_shifts::pre8; + pos += 4; + + xreal[1] = (bufQ[pos] - bufI[pos+1] - bufQ[pos+2] + bufI[pos+3]) << decimation_shifts::pre8; + yimag[1] = (- bufI[pos] - bufQ[pos+1] + bufI[pos+2] + bufQ[pos+3]) << 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) { @@ -333,6 +519,34 @@ void Decimators::decimate16_inf(SampleVector::iterator* i } } +template +void Decimators::decimate16_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, 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 - 15; ) + { + for (int i = 0; i < 4; i++) + { + xreal[i] = (bufI[pos] - bufI[pos+1] + bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre16; + yimag[i] = (bufQ[pos] - bufQ[pos+2] + bufI[pos+1] - bufI[pos+3]) << decimation_shifts::pre16; + pos += 4; + } + + 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) { @@ -361,6 +575,34 @@ void Decimators::decimate16_sup(SampleVector::iterator* i } } +template +void Decimators::decimate16_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, 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 - 15; ) + { + for (int i = 0; i < 4; i++) + { + xreal[i] = (bufQ[pos+0] - bufI[pos+1] - bufQ[pos+2] + bufI[pos+3]) << decimation_shifts::pre16; + yimag[i] = (bufI[pos+2] + bufQ[pos+3] - bufI[pos+0] - bufQ[pos+1]) << decimation_shifts::pre16; + pos += 4; + } + + 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) { @@ -392,6 +634,37 @@ void Decimators::decimate32_inf(SampleVector::iterator* i } } +template +void Decimators::decimate32_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal[8], yimag[8]; + + for (int pos = 0; pos < len - 31; ) + { + for (int i = 0; i < 8; i++) + { + xreal[i] = (bufI[pos+0] - bufQ[pos+1] + bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre32; + yimag[i] = (bufQ[pos+0] - bufQ[pos+2] + bufI[pos+1] - bufI[pos+3]) << decimation_shifts::pre32; + pos += 4; + } + + 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) { @@ -423,6 +696,37 @@ void Decimators::decimate32_sup(SampleVector::iterator* i } } +template +void Decimators::decimate32_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal[8], yimag[8]; + + for (int pos = 0; pos < len - 31; ) + { + for (int i = 0; i < 8; i++) + { + xreal[i] = (bufQ[pos+0] - bufI[pos+1] - bufQ[pos+2] + bufI[pos+3]) << decimation_shifts::pre32; + yimag[i] = (bufI[pos+2] + bufQ[pos+3] - bufI[pos+0] - bufQ[pos+1]) << decimation_shifts::pre32; + pos += 4; + } + + 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) { @@ -463,6 +767,46 @@ void Decimators::decimate64_inf(SampleVector::iterator* i } } +template +void Decimators::decimate64_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal[16], yimag[16]; + + for (int pos = 0; pos < len - 63; ) + { + for (int i = 0; i < 16; i++) + { + xreal[i] = (bufI[pos+0] - bufQ[pos+1] + bufQ[pos+3] - bufI[pos+2]) << decimation_shifts::pre64; + yimag[i] = (bufQ[pos+0] - bufQ[pos+2] + bufI[pos+1] - bufI[pos+3]) << decimation_shifts::pre64; + pos += 4; + } + + 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) { @@ -503,6 +847,46 @@ void Decimators::decimate64_sup(SampleVector::iterator* i } } +template +void Decimators::decimate64_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 xreal[16], yimag[16]; + + for (int pos = 0; pos < len - 63; ) + { + for (int i = 0; i < 16; i++) + { + xreal[i] = (bufQ[pos+0] - bufI[pos+1] - bufQ[pos+2] + bufI[pos+3]) << decimation_shifts::pre32; + yimag[i] = (bufI[pos+2] + bufQ[pos+3] - bufI[pos+0] - bufQ[pos+1]) << decimation_shifts::pre32; + pos += 4; + } + + 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) { @@ -525,6 +909,28 @@ void Decimators::decimate2_cen(SampleVector::iterator* it } } +template +void Decimators::decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 intbuf[2]; + + for (int pos = 0; pos < len - 1; pos += 2) + { + intbuf[0] = bufI[pos+1] << decimation_shifts::pre2; + intbuf[1] = bufQ[pos+1] << decimation_shifts::pre2; + + m_decimator2.myDecimate( + bufI[pos+0] << decimation_shifts::pre2, + bufQ[pos+0] << 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) { @@ -560,6 +966,41 @@ void Decimators::decimate4_cen(SampleVector::iterator* it } } +template +void Decimators::decimate4_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 intbuf[4]; + + for (int pos = 0; pos < len - 3; pos += 4) + { + intbuf[0] = bufI[pos+1] << decimation_shifts::pre4; + intbuf[1] = bufQ[pos+1] << decimation_shifts::pre4; + intbuf[2] = bufI[pos+3] << decimation_shifts::pre4; + intbuf[3] = bufQ[pos+3] << decimation_shifts::pre4; + + m_decimator2.myDecimate( + bufI[pos+0] << decimation_shifts::pre4, + bufQ[pos+0] << decimation_shifts::pre4, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + bufI[pos+2] << decimation_shifts::pre4, + bufQ[pos+2] << 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) { @@ -620,6 +1061,66 @@ void Decimators::decimate8_cen(SampleVector::iterator* it } } +template +void Decimators::decimate8_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 intbuf[8]; + + for (int pos = 0; pos < len - 7; pos += 8) + { + intbuf[0] = bufI[pos+1] << decimation_shifts::pre8; + intbuf[1] = bufQ[pos+1] << decimation_shifts::pre8; + intbuf[2] = bufI[pos+3] << decimation_shifts::pre8; + intbuf[3] = bufQ[pos+3] << decimation_shifts::pre8; + intbuf[4] = bufI[pos+5] << decimation_shifts::pre8; + intbuf[5] = bufQ[pos+5] << decimation_shifts::pre8; + intbuf[6] = bufI[pos+7] << decimation_shifts::pre8; + intbuf[7] = bufQ[pos+7] << decimation_shifts::pre8; + + m_decimator2.myDecimate( + bufI[pos+0] << decimation_shifts::pre8, + bufQ[pos+0] << decimation_shifts::pre8, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + bufI[pos+2] << decimation_shifts::pre8, + bufQ[pos+2] << decimation_shifts::pre8, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + bufI[pos+4] << decimation_shifts::pre8, + bufQ[pos+4] << decimation_shifts::pre8, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + bufI[pos+6] << decimation_shifts::pre8, + bufQ[pos+6] << 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) { @@ -729,6 +1230,115 @@ void Decimators::decimate16_cen(SampleVector::iterator* i } } +template +void Decimators::decimate16_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 intbuf[16]; + + for (int pos = 0; pos < len - 15; pos += 16) + { + intbuf[0] = bufI[pos+1] << decimation_shifts::pre16; + intbuf[1] = bufQ[pos+1] << decimation_shifts::pre16; + intbuf[2] = bufI[pos+3] << decimation_shifts::pre16; + intbuf[3] = bufQ[pos+3] << decimation_shifts::pre16; + intbuf[4] = bufI[pos+5] << decimation_shifts::pre16; + intbuf[5] = bufQ[pos+5] << decimation_shifts::pre16; + intbuf[6] = bufI[pos+7] << decimation_shifts::pre16; + intbuf[7] = bufQ[pos+7] << decimation_shifts::pre16; + intbuf[8] = bufI[pos+9] << decimation_shifts::pre16; + intbuf[9] = bufQ[pos+9] << decimation_shifts::pre16; + intbuf[10] = bufI[pos+11] << decimation_shifts::pre16; + intbuf[11] = bufQ[pos+11] << decimation_shifts::pre16; + intbuf[12] = bufI[pos+13] << decimation_shifts::pre16; + intbuf[13] = bufQ[pos+13] << decimation_shifts::pre16; + intbuf[14] = bufI[pos+15] << decimation_shifts::pre16; + intbuf[15] = bufQ[pos+15] << decimation_shifts::pre16; + + m_decimator2.myDecimate( + bufI[pos+0] << decimation_shifts::pre16, + bufQ[pos+0] << decimation_shifts::pre16, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + bufI[pos+2] << decimation_shifts::pre16, + bufQ[pos+2] << decimation_shifts::pre16, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + bufI[pos+4] << decimation_shifts::pre16, + bufQ[pos+4] << decimation_shifts::pre16, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + bufI[pos+6] << decimation_shifts::pre16, + bufQ[pos+6] << decimation_shifts::pre16, + &intbuf[6], + &intbuf[7]); + m_decimator2.myDecimate( + bufI[pos+8] << decimation_shifts::pre16, + bufQ[pos+8] << decimation_shifts::pre16, + &intbuf[8], + &intbuf[9]); + m_decimator2.myDecimate( + bufI[pos+10] << decimation_shifts::pre16, + bufQ[pos+10] << decimation_shifts::pre16, + &intbuf[10], + &intbuf[11]); + m_decimator2.myDecimate( + bufI[pos+12] << decimation_shifts::pre16, + bufQ[pos+12] << decimation_shifts::pre16, + &intbuf[12], + &intbuf[13]); + m_decimator2.myDecimate( + bufI[pos+14] << decimation_shifts::pre16, + bufQ[pos+14] << 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) { @@ -935,6 +1545,211 @@ void Decimators::decimate32_cen(SampleVector::iterator* i } } +template +void Decimators::decimate32_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 intbuf[32]; + + for (int pos = 0; pos < len - 31; pos += 32) + { + intbuf[0] = bufI[pos+1] << decimation_shifts::pre32; + intbuf[1] = bufQ[pos+1] << decimation_shifts::pre32; + intbuf[2] = bufI[pos+3] << decimation_shifts::pre32; + intbuf[3] = bufQ[pos+3] << decimation_shifts::pre32; + intbuf[4] = bufI[pos+5] << decimation_shifts::pre32; + intbuf[5] = bufQ[pos+5] << decimation_shifts::pre32; + intbuf[6] = bufI[pos+7] << decimation_shifts::pre32; + intbuf[7] = bufQ[pos+7] << decimation_shifts::pre32; + intbuf[8] = bufI[pos+9] << decimation_shifts::pre32; + intbuf[9] = bufQ[pos+9] << decimation_shifts::pre32; + intbuf[10] = bufI[pos+11] << decimation_shifts::pre32; + intbuf[11] = bufQ[pos+11] << decimation_shifts::pre32; + intbuf[12] = bufI[pos+13] << decimation_shifts::pre32; + intbuf[13] = bufQ[pos+13] << decimation_shifts::pre32; + intbuf[14] = bufI[pos+15] << decimation_shifts::pre32; + intbuf[15] = bufQ[pos+15] << decimation_shifts::pre32; + intbuf[16] = bufI[pos+17] << decimation_shifts::pre32; + intbuf[17] = bufQ[pos+17] << decimation_shifts::pre32; + intbuf[18] = bufI[pos+19] << decimation_shifts::pre32; + intbuf[19] = bufQ[pos+19] << decimation_shifts::pre32; + intbuf[20] = bufI[pos+21] << decimation_shifts::pre32; + intbuf[21] = bufQ[pos+21] << decimation_shifts::pre32; + intbuf[22] = bufI[pos+23] << decimation_shifts::pre32; + intbuf[23] = bufQ[pos+23] << decimation_shifts::pre32; + intbuf[24] = bufI[pos+25] << decimation_shifts::pre32; + intbuf[25] = bufQ[pos+25] << decimation_shifts::pre32; + intbuf[26] = bufI[pos+27] << decimation_shifts::pre32; + intbuf[27] = bufQ[pos+27] << decimation_shifts::pre32; + intbuf[28] = bufI[pos+29] << decimation_shifts::pre32; + intbuf[29] = bufQ[pos+29] << decimation_shifts::pre32; + intbuf[30] = bufI[pos+31] << decimation_shifts::pre32; + intbuf[31] = bufQ[pos+31] << decimation_shifts::pre32; + + m_decimator2.myDecimate( + bufI[pos+0] << decimation_shifts::pre32, + bufQ[pos+0] << decimation_shifts::pre32, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + bufI[pos+2] << decimation_shifts::pre32, + bufQ[pos+2] << decimation_shifts::pre32, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + bufI[pos+4] << decimation_shifts::pre32, + bufQ[pos+4] << decimation_shifts::pre32, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + bufI[pos+6] << decimation_shifts::pre32, + bufQ[pos+6] << decimation_shifts::pre32, + &intbuf[6], + &intbuf[7]); + m_decimator2.myDecimate( + bufI[pos+8] << decimation_shifts::pre32, + bufQ[pos+8] << decimation_shifts::pre32, + &intbuf[8], + &intbuf[9]); + m_decimator2.myDecimate( + bufI[pos+10] << decimation_shifts::pre32, + bufQ[pos+10] << decimation_shifts::pre32, + &intbuf[10], + &intbuf[11]); + m_decimator2.myDecimate( + bufI[pos+12] << decimation_shifts::pre32, + bufQ[pos+12] << decimation_shifts::pre32, + &intbuf[12], + &intbuf[13]); + m_decimator2.myDecimate( + bufI[pos+14] << decimation_shifts::pre32, + bufQ[pos+14] << decimation_shifts::pre32, + &intbuf[14], + &intbuf[15]); + m_decimator2.myDecimate( + bufI[pos+16] << decimation_shifts::pre32, + bufQ[pos+16] << decimation_shifts::pre32, + &intbuf[16], + &intbuf[17]); + m_decimator2.myDecimate( + bufI[pos+18] << decimation_shifts::pre32, + bufQ[pos+18] << decimation_shifts::pre32, + &intbuf[18], + &intbuf[19]); + m_decimator2.myDecimate( + bufI[pos+20] << decimation_shifts::pre32, + bufQ[pos+20] << decimation_shifts::pre32, + &intbuf[20], + &intbuf[21]); + m_decimator2.myDecimate( + bufI[pos+22] << decimation_shifts::pre32, + bufQ[pos+22] << decimation_shifts::pre32, + &intbuf[22], + &intbuf[23]); + m_decimator2.myDecimate( + bufI[pos+24] << decimation_shifts::pre32, + bufQ[pos+24] << decimation_shifts::pre32, + &intbuf[24], + &intbuf[25]); + m_decimator2.myDecimate( + bufI[pos+26] << decimation_shifts::pre32, + bufQ[pos+26] << decimation_shifts::pre32, + &intbuf[26], + &intbuf[27]); + m_decimator2.myDecimate( + bufI[pos+28] << decimation_shifts::pre32, + bufQ[pos+28] << decimation_shifts::pre32, + &intbuf[28], + &intbuf[29]); + m_decimator2.myDecimate( + bufI[pos+30] << decimation_shifts::pre32, + bufQ[pos+30] << decimation_shifts::pre32, + &intbuf[30], + &intbuf[31]); + + 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_decimator4.myDecimate( + intbuf[16], + intbuf[17], + &intbuf[18], + &intbuf[19]); + m_decimator4.myDecimate( + intbuf[20], + intbuf[21], + &intbuf[22], + &intbuf[23]); + m_decimator4.myDecimate( + intbuf[24], + intbuf[25], + &intbuf[26], + &intbuf[27]); + m_decimator4.myDecimate( + intbuf[28], + intbuf[29], + &intbuf[30], + &intbuf[31]); + + m_decimator8.myDecimate( + intbuf[2], + intbuf[3], + &intbuf[6], + &intbuf[7]); + m_decimator8.myDecimate( + intbuf[10], + intbuf[11], + &intbuf[14], + &intbuf[15]); + m_decimator8.myDecimate( + intbuf[18], + intbuf[19], + &intbuf[22], + &intbuf[23]); + m_decimator8.myDecimate( + intbuf[26], + intbuf[27], + &intbuf[30], + &intbuf[31]); + + m_decimator16.myDecimate( + intbuf[6], + intbuf[7], + &intbuf[14], + &intbuf[15]); + m_decimator16.myDecimate( + intbuf[22], + intbuf[23], + &intbuf[30], + &intbuf[31]); + + m_decimator32.myDecimate( + intbuf[14], + intbuf[15], + &intbuf[30], + &intbuf[31]); + + (**it).setReal(intbuf[30] >> decimation_shifts::post32); + (**it).setImag(intbuf[31] >> decimation_shifts::post32); + ++(*it); + } +} template void Decimators::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len) @@ -1336,6 +2151,406 @@ void Decimators::decimate64_cen(SampleVector::iterator* i } } +template +void Decimators::decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len) +{ + qint32 intbuf[64]; + + for (int pos = 0; pos < len - 63; pos += 64) + { + intbuf[0] = bufI[pos+1] << decimation_shifts::pre64; + intbuf[1] = bufQ[pos+1] << decimation_shifts::pre64; + intbuf[2] = bufI[pos+3] << decimation_shifts::pre64; + intbuf[3] = bufQ[pos+3] << decimation_shifts::pre64; + intbuf[4] = bufI[pos+5] << decimation_shifts::pre64; + intbuf[5] = bufQ[pos+5] << decimation_shifts::pre64; + intbuf[6] = bufI[pos+7] << decimation_shifts::pre64; + intbuf[7] = bufQ[pos+7] << decimation_shifts::pre64; + intbuf[8] = bufI[pos+9] << decimation_shifts::pre64; + intbuf[9] = bufQ[pos+9] << decimation_shifts::pre64; + intbuf[10] = bufI[pos+11] << decimation_shifts::pre64; + intbuf[11] = bufQ[pos+11] << decimation_shifts::pre64; + intbuf[12] = bufI[pos+13] << decimation_shifts::pre64; + intbuf[13] = bufQ[pos+13] << decimation_shifts::pre64; + intbuf[14] = bufI[pos+15] << decimation_shifts::pre64; + intbuf[15] = bufQ[pos+15] << decimation_shifts::pre64; + intbuf[16] = bufI[pos+17] << decimation_shifts::pre64; + intbuf[17] = bufQ[pos+17] << decimation_shifts::pre64; + intbuf[18] = bufI[pos+19] << decimation_shifts::pre64; + intbuf[19] = bufQ[pos+19] << decimation_shifts::pre64; + intbuf[20] = bufI[pos+21] << decimation_shifts::pre64; + intbuf[21] = bufQ[pos+21] << decimation_shifts::pre64; + intbuf[22] = bufI[pos+23] << decimation_shifts::pre64; + intbuf[23] = bufQ[pos+23] << decimation_shifts::pre64; + intbuf[24] = bufI[pos+25] << decimation_shifts::pre64; + intbuf[25] = bufQ[pos+25] << decimation_shifts::pre64; + intbuf[26] = bufI[pos+27] << decimation_shifts::pre64; + intbuf[27] = bufQ[pos+27] << decimation_shifts::pre64; + intbuf[28] = bufI[pos+29] << decimation_shifts::pre64; + intbuf[29] = bufQ[pos+29] << decimation_shifts::pre64; + intbuf[30] = bufI[pos+31] << decimation_shifts::pre64; + intbuf[31] = bufQ[pos+31] << decimation_shifts::pre64; + + intbuf[32] = bufI[pos+33] << decimation_shifts::pre64; + intbuf[33] = bufQ[pos+33] << decimation_shifts::pre64; + intbuf[34] = bufI[pos+35] << decimation_shifts::pre64; + intbuf[35] = bufQ[pos+35] << decimation_shifts::pre64; + intbuf[36] = bufI[pos+37] << decimation_shifts::pre64; + intbuf[37] = bufQ[pos+37] << decimation_shifts::pre64; + intbuf[38] = bufI[pos+39] << decimation_shifts::pre64; + intbuf[39] = bufQ[pos+39] << decimation_shifts::pre64; + intbuf[40] = bufI[pos+41] << decimation_shifts::pre64; + intbuf[41] = bufQ[pos+41] << decimation_shifts::pre64; + intbuf[42] = bufI[pos+43] << decimation_shifts::pre64; + intbuf[43] = bufQ[pos+43] << decimation_shifts::pre64; + intbuf[44] = bufI[pos+45] << decimation_shifts::pre64; + intbuf[45] = bufQ[pos+45] << decimation_shifts::pre64; + intbuf[46] = bufI[pos+47] << decimation_shifts::pre64; + intbuf[47] = bufQ[pos+47] << decimation_shifts::pre64; + intbuf[48] = bufI[pos+49] << decimation_shifts::pre64; + intbuf[49] = bufQ[pos+49] << decimation_shifts::pre64; + intbuf[50] = bufI[pos+51] << decimation_shifts::pre64; + intbuf[51] = bufQ[pos+51] << decimation_shifts::pre64; + intbuf[52] = bufI[pos+53] << decimation_shifts::pre64; + intbuf[53] = bufQ[pos+53] << decimation_shifts::pre64; + intbuf[54] = bufI[pos+55] << decimation_shifts::pre64; + intbuf[55] = bufQ[pos+55] << decimation_shifts::pre64; + intbuf[56] = bufI[pos+57] << decimation_shifts::pre64; + intbuf[57] = bufQ[pos+57] << decimation_shifts::pre64; + intbuf[58] = bufI[pos+59] << decimation_shifts::pre64; + intbuf[59] = bufQ[pos+59] << decimation_shifts::pre64; + intbuf[60] = bufI[pos+61] << decimation_shifts::pre64; + intbuf[61] = bufQ[pos+61] << decimation_shifts::pre64; + intbuf[62] = bufI[pos+63] << decimation_shifts::pre64; + intbuf[63] = bufQ[pos+63] << decimation_shifts::pre64; + + m_decimator2.myDecimate( + bufI[pos+0] << decimation_shifts::pre64, + bufQ[pos+0] << decimation_shifts::pre64, + &intbuf[0], + &intbuf[1]); + m_decimator2.myDecimate( + bufI[pos+2] << decimation_shifts::pre64, + bufQ[pos+2] << decimation_shifts::pre64, + &intbuf[2], + &intbuf[3]); + m_decimator2.myDecimate( + bufI[pos+4] << decimation_shifts::pre64, + bufQ[pos+4] << decimation_shifts::pre64, + &intbuf[4], + &intbuf[5]); + m_decimator2.myDecimate( + bufI[pos+6] << decimation_shifts::pre64, + bufQ[pos+6] << decimation_shifts::pre64, + &intbuf[6], + &intbuf[7]); + m_decimator2.myDecimate( + bufI[pos+8] << decimation_shifts::pre64, + bufQ[pos+8] << decimation_shifts::pre64, + &intbuf[8], + &intbuf[9]); + m_decimator2.myDecimate( + bufI[pos+10] << decimation_shifts::pre64, + bufQ[pos+10] << decimation_shifts::pre64, + &intbuf[10], + &intbuf[11]); + m_decimator2.myDecimate( + bufI[pos+12] << decimation_shifts::pre64, + bufQ[pos+12] << decimation_shifts::pre64, + &intbuf[12], + &intbuf[13]); + m_decimator2.myDecimate( + bufI[pos+14] << decimation_shifts::pre64, + bufQ[pos+14] << decimation_shifts::pre64, + &intbuf[14], + &intbuf[15]); + m_decimator2.myDecimate( + bufI[pos+16] << decimation_shifts::pre64, + bufQ[pos+16] << decimation_shifts::pre64, + &intbuf[16], + &intbuf[17]); + m_decimator2.myDecimate( + bufI[pos+18] << decimation_shifts::pre64, + bufQ[pos+18] << decimation_shifts::pre64, + &intbuf[18], + &intbuf[19]); + m_decimator2.myDecimate( + bufI[pos+20] << decimation_shifts::pre64, + bufQ[pos+20] << decimation_shifts::pre64, + &intbuf[20], + &intbuf[21]); + m_decimator2.myDecimate( + bufI[pos+22] << decimation_shifts::pre64, + bufQ[pos+22] << decimation_shifts::pre64, + &intbuf[22], + &intbuf[23]); + m_decimator2.myDecimate( + bufI[pos+24] << decimation_shifts::pre64, + bufQ[pos+24] << decimation_shifts::pre64, + &intbuf[24], + &intbuf[25]); + m_decimator2.myDecimate( + bufI[pos+26] << decimation_shifts::pre64, + bufQ[pos+26] << decimation_shifts::pre64, + &intbuf[26], + &intbuf[27]); + m_decimator2.myDecimate( + bufI[pos+28] << decimation_shifts::pre64, + bufQ[pos+28] << decimation_shifts::pre64, + &intbuf[28], + &intbuf[29]); + m_decimator2.myDecimate( + bufI[pos+30] << decimation_shifts::pre64, + bufQ[pos+30] << decimation_shifts::pre64, + &intbuf[30], + &intbuf[31]); + m_decimator2.myDecimate( + bufI[pos+32] << decimation_shifts::pre64, + bufQ[pos+32] << decimation_shifts::pre64, + &intbuf[32], + &intbuf[33]); + m_decimator2.myDecimate( + bufI[pos+34] << decimation_shifts::pre64, + bufQ[pos+34] << decimation_shifts::pre64, + &intbuf[34], + &intbuf[35]); + m_decimator2.myDecimate( + bufI[pos+36] << decimation_shifts::pre64, + bufQ[pos+36] << decimation_shifts::pre64, + &intbuf[36], + &intbuf[37]); + m_decimator2.myDecimate( + bufI[pos+38] << decimation_shifts::pre64, + bufQ[pos+38] << decimation_shifts::pre64, + &intbuf[38], + &intbuf[39]); + m_decimator2.myDecimate( + bufI[pos+40] << decimation_shifts::pre64, + bufQ[pos+40] << decimation_shifts::pre64, + &intbuf[40], + &intbuf[41]); + m_decimator2.myDecimate( + bufI[pos+42] << decimation_shifts::pre64, + bufQ[pos+42] << decimation_shifts::pre64, + &intbuf[42], + &intbuf[43]); + m_decimator2.myDecimate( + bufI[pos+44] << decimation_shifts::pre64, + bufQ[pos+44] << decimation_shifts::pre64, + &intbuf[44], + &intbuf[45]); + m_decimator2.myDecimate( + bufI[pos+46] << decimation_shifts::pre64, + bufQ[pos+46] << decimation_shifts::pre64, + &intbuf[46], + &intbuf[47]); + m_decimator2.myDecimate( + bufI[pos+48] << decimation_shifts::pre64, + bufQ[pos+48] << decimation_shifts::pre64, + &intbuf[48], + &intbuf[49]); + m_decimator2.myDecimate( + bufI[pos+50] << decimation_shifts::pre64, + bufQ[pos+50] << decimation_shifts::pre64, + &intbuf[50], + &intbuf[51]); + m_decimator2.myDecimate( + bufI[pos+52] << decimation_shifts::pre64, + bufQ[pos+52] << decimation_shifts::pre64, + &intbuf[52], + &intbuf[53]); + m_decimator2.myDecimate( + bufI[pos+54] << decimation_shifts::pre64, + bufQ[pos+54] << decimation_shifts::pre64, + &intbuf[54], + &intbuf[55]); + m_decimator2.myDecimate( + bufI[pos+56] << decimation_shifts::pre64, + bufQ[pos+56] << decimation_shifts::pre64, + &intbuf[56], + &intbuf[57]); + m_decimator2.myDecimate( + bufI[pos+58] << decimation_shifts::pre64, + bufQ[pos+58] << decimation_shifts::pre64, + &intbuf[58], + &intbuf[59]); + m_decimator2.myDecimate( + bufI[pos+60] << decimation_shifts::pre64, + bufQ[pos+60] << decimation_shifts::pre64, + &intbuf[60], + &intbuf[61]); + m_decimator2.myDecimate( + bufI[pos+62] << decimation_shifts::pre64, + bufQ[pos+62] << decimation_shifts::pre64, + &intbuf[62], + &intbuf[63]); + + 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_decimator4.myDecimate( + intbuf[16], + intbuf[17], + &intbuf[18], + &intbuf[19]); + m_decimator4.myDecimate( + intbuf[20], + intbuf[21], + &intbuf[22], + &intbuf[23]); + m_decimator4.myDecimate( + intbuf[24], + intbuf[25], + &intbuf[26], + &intbuf[27]); + m_decimator4.myDecimate( + intbuf[28], + intbuf[29], + &intbuf[30], + &intbuf[31]); + m_decimator4.myDecimate( + intbuf[32], + intbuf[33], + &intbuf[34], + &intbuf[35]); + m_decimator4.myDecimate( + intbuf[36], + intbuf[37], + &intbuf[38], + &intbuf[39]); + m_decimator4.myDecimate( + intbuf[40], + intbuf[41], + &intbuf[42], + &intbuf[43]); + m_decimator4.myDecimate( + intbuf[44], + intbuf[45], + &intbuf[46], + &intbuf[47]); + m_decimator4.myDecimate( + intbuf[48], + intbuf[49], + &intbuf[50], + &intbuf[51]); + m_decimator4.myDecimate( + intbuf[52], + intbuf[53], + &intbuf[54], + &intbuf[55]); + m_decimator4.myDecimate( + intbuf[56], + intbuf[57], + &intbuf[58], + &intbuf[59]); + m_decimator4.myDecimate( + intbuf[60], + intbuf[61], + &intbuf[62], + &intbuf[63]); + + m_decimator8.myDecimate( + intbuf[2], + intbuf[3], + &intbuf[6], + &intbuf[7]); + m_decimator8.myDecimate( + intbuf[10], + intbuf[11], + &intbuf[14], + &intbuf[15]); + m_decimator8.myDecimate( + intbuf[18], + intbuf[19], + &intbuf[22], + &intbuf[23]); + m_decimator8.myDecimate( + intbuf[26], + intbuf[27], + &intbuf[30], + &intbuf[31]); + m_decimator8.myDecimate( + intbuf[34], + intbuf[35], + &intbuf[38], + &intbuf[39]); + m_decimator8.myDecimate( + intbuf[42], + intbuf[43], + &intbuf[46], + &intbuf[47]); + m_decimator8.myDecimate( + intbuf[50], + intbuf[51], + &intbuf[54], + &intbuf[55]); + m_decimator8.myDecimate( + intbuf[58], + intbuf[59], + &intbuf[62], + &intbuf[63]); + + m_decimator16.myDecimate( + intbuf[6], + intbuf[7], + &intbuf[14], + &intbuf[15]); + m_decimator16.myDecimate( + intbuf[22], + intbuf[23], + &intbuf[30], + &intbuf[31]); + m_decimator16.myDecimate( + intbuf[38], + intbuf[39], + &intbuf[46], + &intbuf[47]); + m_decimator16.myDecimate( + intbuf[54], + intbuf[55], + &intbuf[62], + &intbuf[63]); + + m_decimator32.myDecimate( + intbuf[14], + intbuf[15], + &intbuf[30], + &intbuf[31]); + m_decimator32.myDecimate( + intbuf[46], + intbuf[47], + &intbuf[62], + &intbuf[63]); + + m_decimator64.myDecimate( + intbuf[30], + intbuf[31], + &intbuf[62], + &intbuf[63]); + + (**it).setReal(intbuf[62] >> decimation_shifts::post64); + (**it).setImag(intbuf[63] >> decimation_shifts::post64); + ++(*it); + } +} + /* template void Decimators::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len) diff --git a/sdrbase/gui/aboutdialog.ui b/sdrbase/gui/aboutdialog.ui index 5b7eb6a66..259b9fe88 100644 --- a/sdrbase/gui/aboutdialog.ui +++ b/sdrbase/gui/aboutdialog.ui @@ -84,7 +84,7 @@ - <html><head/><body><p>Version 2.2.2 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. </p><p>Code at <a href="https://github.com/f4exb/sdrangel"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/f4exb/sdrangel</span></a> This is a complete redesign from RTL-SDRangelove at <a href="https://github.com/hexameron/rtl-sdrangelove"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/hexameron/rtl-sdrangelove</span></a></p><p>Many thanks to the original developers:</p><p>The osmocom developer team - especially horizon, Hoernchen &amp; tnt.</p><p>Christian Daniel from maintech GmbH.</p><p>John Greb (hexameron) for the contributions in RTL-SDRangelove</p><p>The following rules apply to the SDRangel main application and libsdrbase:<br/>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; either version 2 of the License, or (at your option) any later version. 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. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>.</p><p>For the license of installed plugins, look into the plugin list.</p></body></html> + <html><head/><body><p>Version 2.3.0 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. </p><p>Code at <a href="https://github.com/f4exb/sdrangel"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/f4exb/sdrangel</span></a> This is a complete redesign from RTL-SDRangelove at <a href="https://github.com/hexameron/rtl-sdrangelove"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/hexameron/rtl-sdrangelove</span></a></p><p>Many thanks to the original developers:</p><p>The osmocom developer team - especially horizon, Hoernchen &amp; tnt.</p><p>Christian Daniel from maintech GmbH.</p><p>John Greb (hexameron) for the contributions in RTL-SDRangelove</p><p>The following rules apply to the SDRangel main application and libsdrbase:<br/>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; either version 2 of the License, or (at your option) any later version. 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. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>.</p><p>For the license of installed plugins, look into the plugin list.</p></body></html> true diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index a63d1c7d9..ffda2f864 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -450,7 +450,7 @@ void MainWindow::savePresetSettings(Preset* preset, int tabIndex) void MainWindow::createStatusBar() { QString qtVersionStr = QString("Qt %1 ").arg(QT_VERSION_STR); - m_showSystemWidget = new QLabel("SDRangel v2.2.2 " + qtVersionStr + QSysInfo::prettyProductName(), this); + m_showSystemWidget = new QLabel("SDRangel v2.3.0 " + qtVersionStr + QSysInfo::prettyProductName(), this); statusBar()->addPermanentWidget(m_showSystemWidget); m_dateTimeWidget = new QLabel(tr("Date"), this);