From 2e12ab418509deb62d6be71d5c528e3b29a0e7fe Mon Sep 17 00:00:00 2001 From: Stelios Bounanos Date: Tue, 19 Feb 2008 05:14:36 +0000 Subject: [PATCH] Upstream version 2.10E --- configure.ac | 2 +- src/include/viewpsk.h | 2 -- src/psk/psk.cxx | 51 ++++++++++++++----------------------------- src/psk/viewpsk.cxx | 43 ------------------------------------ 4 files changed, 17 insertions(+), 81 deletions(-) diff --git a/configure.ac b/configure.ac index 864158f9..1667b862 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_COPYRIGHT([Copyright (C) 2007 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)]) AC_PREREQ(2.61) -AC_INIT([fldigi], [2.10D], [w1hkj AT w1hkj DOT com]) +AC_INIT([fldigi], [2.10E], [w1hkj AT w1hkj DOT com]) AC_CONFIG_AUX_DIR([build-aux]) # define build, build_cpu, build_vendor, build_os diff --git a/src/include/viewpsk.h b/src/include/viewpsk.h index 46aacbde..796fa01c 100644 --- a/src/include/viewpsk.h +++ b/src/include/viewpsk.h @@ -81,8 +81,6 @@ private: void findsignal(int); void afc(int); - void sigdensity(); - double sigpeak(int &f, int f1, int f2); public: viewpsk(trx_mode mode); diff --git a/src/psk/psk.cxx b/src/psk/psk.cxx index 410bd7e6..1aa63c2a 100644 --- a/src/psk/psk.cxx +++ b/src/psk/psk.cxx @@ -302,22 +302,16 @@ int waitcount = 0; void psk::findsignal() { - double ftest, sigpwr, noise; - int searchBW; + int ftest, f1, f2; -// fast search for peak signal frequency if (sigsearch > 0) { sigsearch--; - if (mailserver) { -// mail server signal search - searchBW = progdefaults.ServerOffset;// - (int)bandwidth; - ftest = wf->peakFreq((int)(frequency), searchBW + (int)bandwidth/2); - sigpwr = wf->powerDensity(ftest, bandwidth); - noise = wf->powerDensity(ftest + 2 * bandwidth, bandwidth / 2) + - wf->powerDensity(ftest - 2 * bandwidth, bandwidth / 2) + 1e-20; - if (sigpwr/noise > SNTHRESHOLD) { // larger than the search threshold + if (mailserver) { // mail server search algorithm + f1 = (int)(frequency - progdefaults.ServerOffset); + f2 = (int)(frequency + progdefaults.ServerOffset); + if (evalpsk->sigpeak(ftest, f1, f2) > SNTHRESHOLD ) { if (progdefaults.PSKmailSweetSpot) { - if (fabs(ftest - progdefaults.PSKsweetspot) < searchBW) { + if (fabs(ftest - progdefaults.PSKsweetspot) < progdefaults.ServerOffset) { frequency = ftest; set_freq(frequency); freqerr = 0.0; @@ -338,30 +332,17 @@ void psk::findsignal() sigsearch = SIGSEARCH; } } - } else { -// normal signal search - int ftest; - int f1 = (int)(frequency - progdefaults.SearchRange/2); - int f2 = (int)(frequency + progdefaults.SearchRange/2); - if (evalpsk->sigpeak(ftest, f1, f2) > SNTHRESHOLD ){//SNTHRESHOLD) { - frequency = ftest; - set_freq(frequency); - freqerr = 0.0; - sigsearch = 0; - } -// searchBW = progdefaults.SearchRange; -// ftest = wf->peakFreq((int)(frequency), searchBW); -// sigpwr = wf->powerDensity(ftest, bandwidth); -// noise = wf->powerDensity(ftest + 2 * bandwidth / 2, bandwidth / 2) + -// wf->powerDensity(ftest - 2 * bandwidth / 2, bandwidth / 2) + 1e-20; -// if (sigpwr/noise > SNTHRESHOLD) { // larger than the detection threshold) -// frequency = ftest; -// set_freq(frequency); -// freqerr = 0.0; -// } + } else { // normal signal search algorithm + f1 = (int)(frequency - progdefaults.SearchRange/2); + f2 = (int)(frequency + progdefaults.SearchRange/2); + if (evalpsk->sigpeak(ftest, f1, f2) > SNTHRESHOLD ) { + frequency = ftest; + set_freq(frequency); + freqerr = 0.0; + sigsearch = 0; + } } - } - + } } void psk::phaseafc() diff --git a/src/psk/viewpsk.cxx b/src/psk/viewpsk.cxx index 08c897a9..177d051f 100644 --- a/src/psk/viewpsk.cxx +++ b/src/psk/viewpsk.cxx @@ -146,49 +146,6 @@ void viewpsk::restart(trx_mode pskmode) init(); } -//============================================================================= -//========================== viewpsk signal evaluation ======================== -//============================================================================= -void viewpsk::sigdensity() { - double sig = 0.0; - double val; - int hbw = (int)(bandwidth / 2); - int twohbw = 2 * hbw; - int flower = progdefaults.VIEWERstart - 50; - int fupper = flower + 100 * progdefaults.VIEWERchannels + 100; - double *vals = new double[twohbw + 1]; - int j = -1; - sigavg = 0.0; - sigmin = 1e6; - for (int i = flower - hbw; i < fupper + hbw; i++) { - j++; - if (j == twohbw + 1) j = 0; - val = wf->Pwr(i); - if (i >= flower + twohbw) { - sigpwr[i - hbw - 1] = sig; - sig -= vals[j]; - } - vals[j] = val; - sig += val; - sigavg += val; - if (sig > 0 && sig < sigmin) sigmin = sig; - } - sigavg /= (fupper - flower - 100); -} - -double viewpsk::sigpeak(int &f, int f1, int f2) -{ - double peak = 0; - f = (f1 + f2) / 2; - for (int i = f1; i <= f2; i++) - if (sigpwr[i] > peak) { - peak = sigpwr[i]; - f = i; - } - return peak / sigavg; -// return peak / sigmin; -} - //============================================================================= //========================= viewpsk receive routines ========================== //=============================================================================