From a162f6d69afdcf13059a05d49ec44a315b834f48 Mon Sep 17 00:00:00 2001 From: JvanKatwijk Date: Fri, 29 Sep 2023 18:55:55 +0200 Subject: [PATCH] edits --- README.md | 65 +-- includes/ofdm/phasereference.h | 79 --- includes/support/text-mapper.h-xxx | 44 -- .../forms-v6/new-display/scopewidget.ui-orig | 449 ------------------ .../forms-v6/new-display/scopewidget.ui-xxx | 407 ---------------- src/ofdm/phasereference.cpp | 233 --------- src/ofdm/tii_detector.cpp-old | 291 ------------ src/support/text-mapper.cpp-xxx | 227 --------- 8 files changed, 33 insertions(+), 1762 deletions(-) delete mode 100755 includes/ofdm/phasereference.h delete mode 100755 includes/support/text-mapper.h-xxx delete mode 100755 qt-dab-s6/forms-v6/new-display/scopewidget.ui-orig delete mode 100755 qt-dab-s6/forms-v6/new-display/scopewidget.ui-xxx delete mode 100755 src/ofdm/phasereference.cpp delete mode 100755 src/ofdm/tii_detector.cpp-old delete mode 100755 src/support/text-mapper.cpp-xxx diff --git a/README.md b/README.md index c2218655..d4a86494 100755 --- a/README.md +++ b/README.md @@ -18,13 +18,14 @@ Table of Contents * [Features](#features) * [Widgets and scopes](#widgets-and-scopes-for-qt-dab) * [Showing a map for TII](#a-note-on-showing-a-map) -* [Notes on building an executable](#building-an-executable-for-qt-dab-a-few-notes) +* [Documentation](#Documentation{ * [Installation on Windows](#Installation-on-Windows) * [Installation on Linux](#Installation-on-Linux) +* [Notes on building an executable](#building-an-executable-for-qt-dab-a-few-notes) * [Using user specified bands](#Using-user-specified-bands) * [xml-files and support](#xml-files-and-support) * [A Note on previous versions](#A-Note-on-previous-versions) -* [Copyright](#copyright) +* [Copyright](#Copyright) Introduction ================================================================= @@ -105,11 +106,11 @@ in the main widget, gives full information about the selected audio service. Different from previous versions, a single widget, the spectrum widget, contains - as tabbed widget - the 4 or 5 scopes to show different aspects -of the DAN signal. -It contains an IQscope, showing the constellation of the decoded data, -and a waterfall scope, showinh the progress in time of the data +of the DAB signal. +Furthermore, it contains an IQscope, +showing the constellation of the decoded data, +and a waterfall scope, showing the progress in time of the data that is displayed in the selected scope. -Previous versions V5.4 and V4.7 will be maintained. Scopes are * spectrum scope, showing the spectrum of the incoming DAB signal; @@ -145,7 +146,32 @@ The feature will not work if * handling the TII database is not installed on the system, and/or * you did not provide your "home" coordinates. -The latter is easily done by touching the button "coordinates" on the configuration (configuration/control) widget. +The latter is easily done by touching the button "coordinates" on the +configuration and control widget. + +Documentation +================================================================= + +An extensive **user's guide** - in PDF format - for the 6.1 version can be found in the "docs" section of the source tree. The documentation contains a complete description of the widgets, of the values in the `.ini` file, on configuring for creating an executable (Linux), and even a complete description on how to add a device to the configuration. + +![Qt-DAB documentation](/qt-dab-manual.png?raw=true) + + +Installation on Windows +================================================================= + +For Windows an **installer** can be found in the releases section, https://github.com/JvanKatwijk/qt-dab/releases. The installer will install the executable as well as required libraries. + +The installer will also call the official installer for the dll implementing the 2.3 api for getting access to the SDRplay devices. + + +Installation on Linux-x64 +================================================================= + +For Linux-x64 systems, an **appImage** can be found in the releases section, http://github.com/JvanKatwijk/qt-dab/releases. The appImage contains +next to the executable qt-dab program, the required libraries. + +Of course it is possible to generate an executable, the manual contains a complete script for Ubuntu type Linux versions. Building an executable for qt-dab: a few notes @@ -201,31 +227,6 @@ If running on an x64 PC or *bullseye* on the RPI you might consider to install ` ``` -Documentation -================================================================= - -An extensive **user's guide** - in PDF format - for the 6.1 version can be found in the "docs" section of the source tree. The documentation contains a complete description of the widgets, of the values in the `.ini` file, on configuring for creating an executable (Linux), and even a complete description on how to add a device to the configuration. - -![Qt-DAB documentation](/qt-dab-manual.png?raw=true) - - -Installation on Windows -================================================================= - -For Windows an **installer** can be found in the releases section, https://github.com/JvanKatwijk/qt-dab/releases. The installer will install the executable as well as required libraries. - -The installer will also call the official installer for the dll implementing the 2.3 api for getting access to the SDRplay devices. - - -Installation on Linux-x64 -================================================================= - -For Linux-x64 systems, an **appImage** can be found in the releases section, http://github.com/JvanKatwijk/qt-dab/releases. The appImage contains -next to the executable qt-dab program, the required libraries. - -Of course it is possible to generate an executable, the manual contains a complete script for Ubuntu type Linux versions. - - Using user specified bands ================================================================= diff --git a/includes/ofdm/phasereference.h b/includes/ofdm/phasereference.h deleted file mode 100755 index b38443ea..00000000 --- a/includes/ofdm/phasereference.h +++ /dev/null @@ -1,79 +0,0 @@ -# -/* - * Copyright (C) 2013 .. 2017 - * Jan van Katwijk (J.vanKatwijk@gmail.com) - * Lazy Chair Computing - * - * This file is part of the Qt-DAB program - * - * Qt-DAB is free software; you can 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. - * - * Qt-DAB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Qt-DAB; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -# -#pragma once - -#include -#include -#include -#include -#include "fft-handler.h" -#include "phasetable.h" -#include "dab-constants.h" -#include "dab-params.h" -#include "process-params.h" -#include "ringbuffer.h" -class RadioInterface; -#ifdef __WITH_JAN__ -class channel; -#endif -#include "fft-handler.h" - -class phaseReference : public QObject, public phaseTable { -Q_OBJECT -public: - phaseReference (RadioInterface *, - processParams *); - ~phaseReference (); - int32_t findIndex (std::vector, int); - int16_t estimate_CarrierOffset (std::vector); - float phase (std::vector&, int); -#ifdef __WITH_JAN__ - void estimate (std::vector); -#endif -// This one is used in the ofdm decoder - std::vector refTable; -private: - dabParams params; -#ifdef __WITH_JAN__ - channel *theEstimator; -#endif - RingBuffer *response; - std::vector phaseDifferences; - int16_t diff_length; - int16_t depth; - int32_t T_u; - int32_t T_g; - int16_t carriers; - - int32_t fft_counter; - int32_t framesperSecond; - int32_t displayCounter; - - fftHandler fft_forward; - fftHandler fft_backwards; - -signals: - void showCorrelation (int, int, QVector); -}; - diff --git a/includes/support/text-mapper.h-xxx b/includes/support/text-mapper.h-xxx deleted file mode 100755 index 153f5cdc..00000000 --- a/includes/support/text-mapper.h-xxx +++ /dev/null @@ -1,44 +0,0 @@ -# -/* - * Copyright (C) 2013, 2014, 2015, 2016, 2017 - * Jan van Katwijk (J.vanKatwijk@gmail.com) - * Lazy Chair Computing - * - * This file is part of the Qt-DAB (formerly SDR-J, JSDR). - * - * Qt-DAB is free software; you can 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. - * - * Qt-DAB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Qt-DAB; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -# -#ifndef __TEXT_MAPPER__ -#define __TEXT_MAPPER__ - -// -// simple convenience class - -#include "dab-constants.h" - - -class textMapper { -public: - textMapper(); - ~textMapper(); -const -char *get_programm_type_string (int16_t type); -const -char *get_programm_language_string (int16_t language); -}; - -#endif diff --git a/qt-dab-s6/forms-v6/new-display/scopewidget.ui-orig b/qt-dab-s6/forms-v6/new-display/scopewidget.ui-orig deleted file mode 100755 index 365125b7..00000000 --- a/qt-dab-s6/forms-v6/new-display/scopewidget.ui-orig +++ /dev/null @@ -1,449 +0,0 @@ - - - scopeWidget - - - - 0 - 0 - 686 - 474 - - - - spectrumscope - - - - - - - - - 421 - 231 - - - - 3 - - - - Spectrum - - - - - - Qt::Vertical - - - - - - - - 0 - 175 - - - - - - - - - Corr - - - - - - - 0 - 141 - - - - - 16777215 - 150 - - - - - - - - - - TextLabel - - - - - - - 400 - - - 8005 - - - 50 - - - 600 - - - - - - - - - - NULL - - - - - 0 - 10 - 481 - 171 - - - - - 16777215 - 171 - - - - - - - TII - - - - - - - 401 - 140 - - - - - - - - TextLabel - - - - - - - - - - - - - - 219 - 138 - - - - <html><head/><body><p>IQ constallation of the decoded signal. Ideally one sees 4 dots, one in each quadrant</p></body></html> - - - - - - - <html><head/><body><p>Zoom in/out</p></body></html> - - - 50 - - - Qt::Horizontal - - - - - - - - - - 15 - 75 - true - - - - QFrame::NoFrame - - - 7 - - - QLCDNumber::Flat - - - - - - - MHz - - - - - - - - - - - - - - - - 400 - 159 - - - - - - 0 - 0 - 24 - 160 - - - - 100 - - - 50 - - - Qt::Vertical - - - - - - - - - - - 75 - true - - - - <html><head/><body><p>Frequeny offset, the computed frequency error, after applying the estimated frequency correction.</p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - time offset - - - - - - - <html><head/><body><p>Frequency correction, The software computed an estimate of the frequency offset by lokking at phasedifferences in the samples in the time domain. Based on the difference found a correction factor is applied to the input stream.</p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - freq offset - - - - - - - clock Offset - - - - - - - <html><head/><body><p>SNR, i.e. Signal Noise ratio, compoted from the difference in signal strength between the datablocks and the nullperiod.</p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - snr - - - - - - - - 75 - true - - - - clock offset. The value indicates the number of samples too many or too few for 10 DAB frames (which is about 1 second). - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - freq Correction - - - - - - - std deviation - - - - - - - - 75 - true - - - - Quality indicator: rather than the Modulation Error as specified in Tr 101 290, we merely look at the std deviation of the phases of the DAB signal, since the information is encoded in phases (phase differences) - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - - 75 - true - - - - <html><head/><body><p>Sample clock offset. </p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - - - - - - - CPU - - - - - - - - 13 - 75 - true - - - - QFrame::Panel - - - QLCDNumber::Flat - - - - - - - epg - - - - - - - 24 - - - - - - - - - - QwtPlot - QFrame -
qwt_plot.h
- 1 -
-
- - -
diff --git a/qt-dab-s6/forms-v6/new-display/scopewidget.ui-xxx b/qt-dab-s6/forms-v6/new-display/scopewidget.ui-xxx deleted file mode 100755 index 2c90dd59..00000000 --- a/qt-dab-s6/forms-v6/new-display/scopewidget.ui-xxx +++ /dev/null @@ -1,407 +0,0 @@ - - - scopeWidget - - - - 0 - 0 - 686 - 428 - - - - spectrumscope - - - - - - - - - 421 - 231 - - - - 3 - - - - Spectrum - - - - - - Qt::Vertical - - - - - - - - 0 - 175 - - - - - - - - - Corr - - - - - - - 0 - 141 - - - - - 16777215 - 150 - - - - - - - - - - TextLabel - - - - - - - 400 - - - 8005 - - - 50 - - - 600 - - - - - - - - - - NULL - - - - - 0 - 10 - 481 - 171 - - - - - 16777215 - 171 - - - - - - - TII - - - - - - - 401 - 140 - - - - - - - - TextLabel - - - - - - - - - - - - - - 219 - 138 - - - - <html><head/><body><p>IQ constallation of the decoded signal. Ideally one sees 4 dots, one in each quadrant</p></body></html> - - - - - - - <html><head/><body><p>Zoom in/out</p></body></html> - - - 50 - - - Qt::Horizontal - - - - - - - - - - 15 - 75 - true - - - - QFrame::NoFrame - - - 7 - - - QLCDNumber::Flat - - - - - - - MHz - - - - - - - - - - - - - - - - 16777215 - 159 - - - - - - 0 - 0 - 24 - 160 - - - - 100 - - - 50 - - - Qt::Vertical - - - - - - - - - - - 75 - true - - - - <html><head/><body><p>Frequeny offset, the computed frequency error, after applying the estimated frequency correction.</p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - time offset - - - - - - - <html><head/><body><p>Frequency correction, The software computed an estimate of the frequency offset by lokking at phasedifferences in the samples in the time domain. Based on the difference found a correction factor is applied to the input stream.</p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - freq offset - - - - - - - clock Offset - - - - - - - <html><head/><body><p>SNR, i.e. Signal Noise ratio, compoted from the difference in signal strength between the datablocks and the nullperiod.</p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - snr - - - - - - - - 75 - true - - - - clock offset. The value indicates the number of samples too many or too few for 10 DAB frames (which is about 1 second). - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - freq Correction - - - - - - - std deviation - - - - - - - - 75 - true - - - - Quality indicator: rather than the Modulation Error as specified in Tr 101 290, we merely look at the std deviation of the phases of the DAB signal, since the information is encoded in phases (phase differences) - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - - 75 - true - - - - <html><head/><body><p>Sample clock offset. </p></body></html> - - - QFrame::NoFrame - - - QLCDNumber::Flat - - - - - - - - - - - - QwtPlot - QFrame -
qwt_plot.h
- 1 -
-
- - -
diff --git a/src/ofdm/phasereference.cpp b/src/ofdm/phasereference.cpp deleted file mode 100755 index 4f34d093..00000000 --- a/src/ofdm/phasereference.cpp +++ /dev/null @@ -1,233 +0,0 @@ -# -/* - * Copyright (C) 2014 .. 2017 - * Jan van Katwijk (J.vanKatwijk@gmail.com) - * Lazy Chair Computing - * - * This file is part of the Qt-DAB program - * - * Qt-DAB is free software; you can 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. - * - * Qt-DAB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Qt-DAB; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "phasereference.h" -#include -#include -#include "radio.h" -#include -#ifdef __WITH_JAN__ -#include "channel.h" -#endif -/** - * \class phaseReference - * Implements the correlation that is used to identify - * the "first" element (following the cyclic prefix) of - * the first non-null block of a frame - * The class inherits from the phaseTable. - */ - -#define PILOTS 100 -#define TAPS 100 - - phaseReference::phaseReference (RadioInterface *mr, - processParams *p): - phaseTable (p -> dabMode), - params (p -> dabMode), - fft_forward (params. get_T_u (), false), - fft_backwards (params. get_T_u (), true) { -int32_t i; -float Phi_k; - - this -> response = p -> responseBuffer; - this -> diff_length = p -> diff_length; - this -> diff_length = 128; - this -> depth = p -> echo_depth; - this -> T_u = params. get_T_u(); - this -> T_g = params. get_T_g(); - this -> carriers = params. get_carriers(); - - refTable. resize (T_u); - phaseDifferences. resize (diff_length); - - framesperSecond = 2048000 / params. get_T_F(); - displayCounter = 0; - - for (i = 0; i < T_u; i ++) - refTable [i] = std::complex (0, 0); - - for (i = 1; i <= params. get_carriers() / 2; i ++) { - Phi_k = get_Phi (i); - refTable [i] = std::complex (cos (Phi_k), sin (Phi_k)); - Phi_k = get_Phi (-i); - refTable [T_u - i] = std::complex (cos (Phi_k), sin (Phi_k)); - } - -// -// prepare a table for the coarse frequency synchronization -// can be a static one, actually, we are only interested in -// the ones with a null - for (i = 1; i <= diff_length; i ++) - phaseDifferences [i - 1] = abs (arg (refTable [(T_u + i) % T_u] * - conj (refTable [(T_u + i + 1) % T_u]))); - - connect (this, SIGNAL (showCorrelation (int, int, QVector)), - mr, SLOT (showCorrelation (int, int, QVector))); - -#ifdef __WITH_JAN__ - theEstimator = new channel (refTable, PILOTS, TAPS); -#endif -} - - phaseReference::~phaseReference () { -#ifdef __WITH_JAN__ - delete theEstimator; -#endif -} - -/** - * \brief findIndex - * the vector v contains "T_u" samples that are believed to - * belong to the first non-null block of a DAB frame. - * We correlate the data in this vector with the predefined - * data, and if the maximum exceeds a threshold value, - * we believe that that indicates the first sample we were - * looking for. - */ - -int32_t phaseReference::findIndex (std::vector > v, - int threshold ) { -int32_t i; -int32_t maxIndex = -1; -float sum = 0; -float Max = -1000; -float lbuf [T_u / 2]; - - fft_forward. fft (v); -// -// into the frequency domain, now correlate - for (i = 0; i < T_u; i ++) - v [i] = v [i] * conj (refTable [i]); - -// and, again, back into the time domain - fft_backwards. fft (v); -/** - * We compute the average and the max signal values - */ - for (i = 0; i < T_u / 2; i ++) { - lbuf [i] = jan_abs (v[i]); - sum += lbuf [i]; - } - - sum /= T_u / 2; - QVector indices; - - for (i = T_g - 250; i < T_g + 250; i ++) { - if (lbuf [i] / sum > threshold) { - bool foundOne = true; - for (int j = 1; (j < 10) && (i + j < T_g + 250); j ++) { - if (lbuf [i + j] > lbuf [i]) { - foundOne = false; - break; - } - } - if (foundOne) { - indices. push_back (i); - if (lbuf [i]> Max){ - Max = lbuf [i]; - maxIndex = i; - } - i += 10; - } - } - } - - if (Max / sum < threshold) { - return (- abs (Max / sum) - 1); - } - - if (response != nullptr) { - if (++displayCounter > framesperSecond / 2) { - response -> putDataIntoBuffer (lbuf, T_u / 2); - showCorrelation (T_u / 2, T_g, indices); - displayCounter = 0; - } - } - - return maxIndex; -} -// -// -// an approach that works fine is to correlate the phasedifferences -// between subsequent carriers -#define SEARCH_RANGE (2 * 35) -int16_t phaseReference:: - estimate_CarrierOffset (std::vector> v) { -int16_t index_1 = 100, index_2 = 100; -float computedDiffs [SEARCH_RANGE + diff_length + 1]; - - fft_forward. fft (v); - - for (int i = T_u - SEARCH_RANGE / 2; - i < T_u + SEARCH_RANGE / 2 + diff_length; i ++) { - computedDiffs [i - (T_u - SEARCH_RANGE / 2)] = - abs (arg (v [i % T_u] * - conj (v [(i + 1) % T_u]))); - } - - float Mmin = 1000; - float Mmax = 0; - for (int i = T_u - SEARCH_RANGE / 2; - i < T_u + SEARCH_RANGE / 2; i ++) { - float sum = 0; - float sum2 = 0; - - for (int j = 1; j < diff_length; j ++) { - if (phaseDifferences [j - 1] < 0.1) { - sum += computedDiffs [i - (T_u - SEARCH_RANGE / 2) + j]; - } - if (phaseDifferences [j - 1] > M_PI - 0.1) { - sum2 += computedDiffs [i - (T_u - SEARCH_RANGE / 2) + j]; - } - } - if (sum < Mmin) { - Mmin = sum; - index_1 = i; - } - if (sum2 > Mmax) { - Mmax = sum2; - index_2 = i; - } - } - - if (index_1 != index_2) - return 100; - return index_1 - T_u; -} - -float phaseReference::phase (std::vector> &v, int Ts) { -std::complex sum = std::complex (0, 0); - - for (int i = 0; i < Ts; i ++) - sum += v [i]; - - return arg (sum); -} - -#ifdef __WITH_JAN__ -void phaseReference::estimate (std::vector> v) { -std::complex h_td [TAPS]; - - fft_forward. fft (v); - theEstimator -> estimate (v, h_td); -} -#endif diff --git a/src/ofdm/tii_detector.cpp-old b/src/ofdm/tii_detector.cpp-old deleted file mode 100755 index 8fce4a19..00000000 --- a/src/ofdm/tii_detector.cpp-old +++ /dev/null @@ -1,291 +0,0 @@ -# -/* - * Copyright (C) 2014 .. 2017 - * Jan van Katwijk (J.vanKatwijk@gmail.com) - * Lazy Chair Computing - * - * This file is part of the Qt-DAB program - * - * Qt-DAB is free software; you can 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. - * - * Qt-DAB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Qt-DAB; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "tii_detector.h" -#include -#include -// - -static -uint8_t table [] = { - 0017, // 0 0 0 0 1 1 1 1 0 - 0027, // 0 0 0 1 0 1 1 1 1 - 0033, // 0 0 0 1 1 0 1 1 2 - 0035, // 0 0 0 1 1 1 0 1 3 - 0036, // 0 0 0 1 1 1 1 0 4 - 0047, // 0 0 1 0 0 1 1 1 5 - 0053, // 0 0 1 0 1 0 1 1 6 - 0055, // 0 0 1 0 1 1 0 1 7 - 0056, // 0 0 1 0 1 1 1 0 8 - 0063, // 0 0 1 1 0 0 1 1 9 - - 0065, // 0 0 1 1 0 1 0 1 10 - 0066, // 0 0 1 1 0 1 1 0 11 - 0071, // 0 0 1 1 1 0 0 1 12 - 0072, // 0 0 1 1 1 0 1 0 13 - 0074, // 0 0 1 1 1 1 0 0 14 - 0107, // 0 1 0 0 0 1 1 1 15 - 0113, // 0 1 0 0 1 0 1 1 16 - 0115, // 0 1 0 0 1 1 0 1 17 - 0116, // 0 1 0 0 1 1 1 0 18 - 0123, // 0 1 0 1 0 0 1 1 19 - - 0125, // 0 1 0 1 0 1 0 1 20 - 0126, // 0 1 0 1 0 1 1 0 21 - 0131, // 0 1 0 1 1 0 0 1 22 - 0132, // 0 1 0 1 1 0 1 0 23 - 0134, // 0 1 0 1 1 1 0 0 24 - 0143, // 0 1 1 0 0 0 1 1 25 - 0145, // 0 1 1 0 0 1 0 1 26 - 0146, // 0 1 1 0 0 1 1 0 27 - 0151, // 0 1 1 0 1 0 0 1 28 - 0152, // 0 1 1 0 1 0 1 0 29 - - 0154, // 0 1 1 0 1 1 0 0 30 - 0161, // 0 1 1 1 0 0 0 1 31 - 0162, // 0 1 1 1 0 0 1 0 32 - 0164, // 0 1 1 1 0 1 0 0 33 - 0170, // 0 1 1 1 1 0 0 0 34 - 0207, // 1 0 0 0 0 1 1 1 35 - 0213, // 1 0 0 0 1 0 1 1 36 - 0215, // 1 0 0 0 1 1 0 1 37 - 0216, // 1 0 0 0 1 1 1 0 38 - 0223, // 1 0 0 1 0 0 1 1 39 - - 0225, // 1 0 0 1 0 1 0 1 40 - 0226, // 1 0 0 1 0 1 1 0 41 - 0231, // 1 0 0 1 1 0 0 1 42 - 0232, // 1 0 0 1 1 0 1 0 43 - 0234, // 1 0 0 1 1 1 0 0 44 - 0243, // 1 0 1 0 0 0 1 1 45 - 0245, // 1 0 1 0 0 1 0 1 46 - 0246, // 1 0 1 0 0 1 1 0 47 - 0251, // 1 0 1 0 1 0 0 1 48 - 0252, // 1 0 1 0 1 0 1 0 49 - - 0254, // 1 0 1 0 1 1 0 0 50 - 0261, // 1 0 1 1 0 0 0 1 51 - 0262, // 1 0 1 1 0 0 1 0 52 - 0264, // 1 0 1 1 0 1 0 0 53 - 0270, // 1 0 1 1 1 0 0 0 54 - 0303, // 1 1 0 0 0 0 1 1 55 - 0305, // 1 1 0 0 0 1 0 1 56 - 0306, // 1 1 0 0 0 1 1 0 57 - 0311, // 1 1 0 0 1 0 0 1 58 - 0312, // 1 1 0 0 1 0 1 0 59 - - 0314, // 1 1 0 0 1 1 0 0 60 - 0321, // 1 1 0 1 0 0 0 1 61 - 0322, // 1 1 0 1 0 0 1 0 62 - 0324, // 1 1 0 1 0 1 0 0 63 - 0330, // 1 1 0 1 1 0 0 0 64 - 0341, // 1 1 1 0 0 0 0 1 65 - 0342, // 1 1 1 0 0 0 1 0 66 - 0344, // 1 1 1 0 0 1 0 0 67 - 0350, // 1 1 1 0 1 0 0 0 68 - 0360 // 1 1 1 1 0 0 0 0 69 -}; - - - TII_Detector::TII_Detector (uint8_t dabMode, int16_t depth): - params (dabMode), - my_fftHandler (dabMode) { -int16_t i; - - this -> depth = depth; - this -> T_u = params. get_T_u(); - carriers = params. get_carriers(); - theBuffer. resize (T_u); - fft_buffer = my_fftHandler. getVector(); - window. resize (T_u); - for (i = 0; i < T_u; i ++) - window [i] = (0.42 - - 0.5 * cos (2 * M_PI * (float)i / T_u) + - 0.08 * cos (4 * M_PI * (float)i / T_u)); - - for (i = 0; i < 256; ++i) - invTable [i] = -1; - for (i = 0; i < 70; ++i) - invTable [table [i]] = i; -} - - TII_Detector::~TII_Detector() { -} - - -void TII_Detector::reset() { - for (int i = 0; i < T_u; i ++) - theBuffer [i] = std::complex (0, 0); -} - -// To eliminate (reduce?) noise in the input signal, we might -// add a few spectra before computing (up to the user) -void TII_Detector::addBuffer (std::vector> v) { -int i; - - for (i = 0; i < T_u; i ++) - fft_buffer [i] = cmul (v [i], window [i]); - my_fftHandler. do_FFT(); - - for (i = 0; i < T_u; i ++) -// theBuffer [i] = cmul (theBuffer [i], 0.9) + -// cmul (fft_buffer [i], 0.1); - theBuffer [i] += fft_buffer [i]; -} -// -// Note that the input is fft output, not yet reodered -void TII_Detector::collapse (std::complex *inVec, float *outVec) { -int i; - for (i = 0; i < carriers / 8; i ++) { - int carr = - carriers / 2 + 2 * i; - outVec [i] = abs (real (inVec [(T_u + carr) % T_u] * - conj (inVec [(T_u + carr + 1) % T_u]))); - carr = - carriers / 2 + 1 * carriers / 4 + 2 * i; - outVec [i] += abs (real (inVec [(T_u + carr) % T_u] * - conj (inVec [(T_u + carr + 1) % T_u]))); - carr = - carriers / 2 + 2 * carriers / 4 + 2 * i + 1; - outVec [i] += abs (real (inVec [(T_u + carr) % T_u] * - conj (inVec [(T_u + carr + 1) % T_u]))); - - carr = - carriers / 2 + 3 * carriers / 4 + 2 * i + 1; - outVec [i] += abs (real (inVec [(T_u + carr) % T_u] * - conj (inVec [(T_u + carr + 1) % T_u]))); - } -} - -static -uint8_t bits [] = {0x80, 0x40, 0x20, 0x10 , 0x08, 0x04, 0x02, 0x01}; - -#define NUM_GROUPS 8 -#define GROUPSIZE 24 -QByteArray TII_Detector::processNULL () { -int i, j; -float hulpTable [NUM_GROUPS * GROUPSIZE]; // collapses values -float C_table [GROUPSIZE]; // contains the values -int D_table [GROUPSIZE]; // count of indices in C_table with data -float avgTable [NUM_GROUPS]; -QByteArray results; - -// we map the "carriers" carriers (complex values) onto -// a collapsed vector of "carriers / 8" length, -// considered to consist of 8 segments of 24 values -// Each "value" is the sum of 4 pairs of subsequent carriers, -// taken from the 4 quadrants -768 .. 385, 384 .. -1, 1 .. 384, 385 .. 768 - - collapse (theBuffer. data(), hulpTable); -// -// since the "energy levels" in the different GROUPSIZE'd values -// may differ, we compute an average for each of the -// NUM_GROUPS GROUPSIZE - value groups. - - memset (avgTable, 0, NUM_GROUPS * sizeof (float)); - for (i = 0; i < NUM_GROUPS; i ++) { - avgTable [i] = 0; - for (j = 0; j < GROUPSIZE; j ++) - avgTable [i] += hulpTable [i * GROUPSIZE + j]; - - avgTable [i] /= GROUPSIZE; - } -// -// Determining the offset is then easy, look at the corresponding -// elements in the NUM_GROUPS sections and mark the highest ones. -// The summation of the high values are stored in the C_table, -// the number of times the limit is reached in the group -// is recorded in the D_table -// -// So, basically we look into GROUPSIZE colums of NUMGROUPS -// values and look for the maximum -// Threshold 4 * avgTable is 6 dB, we consider that a minimum -// measurement shows that that is a reasonable value, -// alternatively, we could take the "minValue" as reference -// and "raise" the threshold. However, that might be -// too much for 8-bit incoming values - memset (D_table, 0, GROUPSIZE * sizeof (int)); - memset (C_table, 0, GROUPSIZE * sizeof (float)); -// - for (j = 0; j < NUM_GROUPS; j ++) { - for (i = 0; i < GROUPSIZE; i ++) { - if (hulpTable [j * GROUPSIZE + i] > 2 * avgTable [j]) { - C_table [i] += hulpTable [j * GROUPSIZE + i]; - D_table [i] ++; - } - } - } - -// we extract from this result the highest values that -// meet the constraint of 4 values being sufficiently high -// up to "depth" values. - float maxTable [depth]; - int maxIndex [depth]; - uint16_t pattern [depth]; - - for (int k = 0; k < depth; k ++) { - maxTable [k] = 0; - maxIndex [k] = -1; - pattern [k] = 0; - for (j = 0; j < GROUPSIZE; j ++) { - if ((D_table [j] >= 4) && (C_table [j] > maxTable [k])) { - maxTable [k] = C_table [j]; - maxIndex [k] = j; - } - } - if (maxIndex [k] >= 0) { - D_table [maxIndex [k]] = 0; - } - else - break; - } -// -// The - almost - final step is then to figure out which -// groups contributed, obviously only where maxIndex [k] > 0 -// we start with collecting the values of the correct -// elements of the NUM_GROUPS groups -// - for (j = 0; (j < depth) && (maxIndex [j] >= 0); j ++) { - float x [NUM_GROUPS]; - for (i = 0; i < NUM_GROUPS; i ++) { - x [i] = hulpTable [maxIndex [j] + GROUPSIZE * i]; - } -// -// we extract the four max values (it is known that they exist) - for (i = 0; i < 4; i ++) { - float mmax = 0; - int ind = -1; - for (int k = 0; k < NUM_GROUPS; k ++) { - if (x [k] > mmax) { - mmax = x [k]; - ind = k; - } - } - if (ind != -1) { - x [ind] = 0; - pattern [j] |= bits [ind]; - } - } - fprintf (stderr, "adding %d %d\n", maxIndex [j], invTable [pattern [j]]); - results. append (invTable [pattern [j]]); - results. append (maxIndex [j]); - } - return results; -} - diff --git a/src/support/text-mapper.cpp-xxx b/src/support/text-mapper.cpp-xxx deleted file mode 100755 index 011846ef..00000000 --- a/src/support/text-mapper.cpp-xxx +++ /dev/null @@ -1,227 +0,0 @@ -# -/* - * Copyright (C) 2013, 2014, 2015, 2016, 2017 - * Jan van Katwijk (J.vanKatwijk@gmail.com) - * Lazy Chair Computing - * - * This file is part of the Qt-DAB - * - * Qt-DAB is free software; you can 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. - * - * Qt-DAB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Qt-DAB; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "text-mapper.h" - - - textMapper :: textMapper() { -} - - textMapper :: ~textMapper() { -} - -static -const char *table12 [] = { -"none", -"News", -"Current Affairs", -"Information", -"Sport", -"Education", -"Drama", -"Arts", -"Science", -"Talk", -"Pop Music", -"Rock Music", -"Easy Listening", -"Light Classical", -"Classical Music", -"Other Music", -"Weather", -"Finance", -"Children\'s", -"Factual", -"Religion", -"Phone In", -"Travel", -"Leisure", -"Jazz and Blues", -"Country Music", -"National Music", -"Oldies Music", -"Folk Music", -"Documentary", -"entry 30 not used", -"entry 31 not used" -}; - -const char *textMapper::get_programm_type_string (int16_t type) { - if (type > 0x40) { - fprintf (stderr, "GUI: program type wrong (%d)\n", type); - return (table12 [0]); - } - if (type < 0) - return " "; - - return table12 [type]; -} - -static -const char *table9 [] = { -"unknown language", -"Albanian", -"Breton", -"Catalan", -"Croatian", -"Welsh", -"Czech", -"Danish", -"German", -"English", -"Spanish", -"Esperanto", -"Estonian", -"Basque", -"Faroese", -"French", -"Frisian", -"Irish", -"Gaelic", -"Galician", -"Icelandic", -"Italian", -"Lappish", -"Latin", -"Latvian", -"Luxembourgian", -"Lithuanian", -"Hungarian", -"Maltese", -"Dutch", -"Norwegian", -"Occitan", -"Polish", -"Portuguese", -"Romanian", -"Romansh", -"Serbian", -"Slovak", -"Slovene", -"Finnish", -"Swedish", -"Turkish", -"Flemish", -"Walloon", -"rfu", -"rfu", -"rfu", -"rfu", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment", -"Reserved for national assignment" -}; - -static -const char *table10 [] = { -"Background sound/clean feed", -"rfu", -"rfu", -"rfu", -"rfu", -"Zulu", -"Vietnamese", -"Uzbek", -"Urdu", -"Ukranian", -"Thai", -"Telugu", -"Tatar", -"Tamil", -"Tadzhik", -"Swahili", -"Sranan Tongo", -"Somali", -"Sinhalese", -"Shona", -"Serbo-Croat", -"Rusyn", -"Russian", -"Quechua", -"Pushtu", -"Punjabi", -"Persian", -"Papiamento", -"Oriya", -"Nepali", -"Ndebele", -"Marathi", -"Moldavian", -"Malaysian", -"Malagasay", -"Macedonian", -"Laotian", -"Korean", -"Khmer", -"Kazakh", -"Kannada", -"Japanese", -"Indonesian", -"Hindi", -"Hebrew", -"Hausa", -"Gurani", -"Gujurati", -"Greek", -"Greek", -"Georgian", -"Fulani", -"Dari", -"Chuvash", -"Chinese", -"Burmese", -"Bulgarian", -"Bengali", -"Belorussian", -"Bambora", -"Azerbaijani", -"Assamese", -"Armenian", -"Arabic", -"Amharic" -}; - -const char *textMapper::get_programm_language_string (int16_t language) { - if (language < 0) - return " "; - else if (language < 0x40) - return table9[language]; - else if (language < 0x7d) - return table10 [language - 0x40]; - fprintf(stderr, "GUI: wrong language (%d)\n", language); - return table9[0]; -} -