kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Merge with upstream
commit
8a755f9d4d
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 ==========================
|
||||
//=============================================================================
|
||||
|
|
Ładowanie…
Reference in New Issue