mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 20:58:55 -05:00
Fix some bugs uncovered by the signal subtraction project.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5619 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
327a5907b9
commit
b41c813259
@ -359,6 +359,7 @@ void subtract_signal(double *id, double *qd, long np,
|
|||||||
for (j=0; j<256; j++) {
|
for (j=0; j<256; j++) {
|
||||||
k=shift0+i*256+j;
|
k=shift0+i*256+j;
|
||||||
if( (k>0) & (k<np) ) {
|
if( (k>0) & (k<np) ) {
|
||||||
|
nsum++;
|
||||||
i0=i0 + id[k]*c0[j] + qd[k]*s0[j];
|
i0=i0 + id[k]*c0[j] + qd[k]*s0[j];
|
||||||
q0=q0 - id[k]*s0[j] + qd[k]*c0[j];
|
q0=q0 - id[k]*s0[j] + qd[k]*c0[j];
|
||||||
}
|
}
|
||||||
@ -368,7 +369,6 @@ void subtract_signal(double *id, double *qd, long np,
|
|||||||
|
|
||||||
i0=i0/256.0; //will be wrong for partial symbols at the edges...
|
i0=i0/256.0; //will be wrong for partial symbols at the edges...
|
||||||
q0=q0/256.0;
|
q0=q0/256.0;
|
||||||
|
|
||||||
for (j=0; j<256; j++) {
|
for (j=0; j<256; j++) {
|
||||||
k=shift0+i*256+j;
|
k=shift0+i*256+j;
|
||||||
if( (k>0) & (k<np) ) {
|
if( (k>0) & (k<np) ) {
|
||||||
@ -751,7 +751,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
npk=i;
|
npk=i;
|
||||||
|
|
||||||
|
/*
|
||||||
// bubble sort on snr, bringing freq along for the ride
|
// bubble sort on snr, bringing freq along for the ride
|
||||||
int pass;
|
int pass;
|
||||||
float tmp;
|
float tmp;
|
||||||
@ -767,7 +768,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
t0=clock();
|
t0=clock();
|
||||||
/* Make coarse estimates of shift (DT), freq, and drift
|
/* Make coarse estimates of shift (DT), freq, and drift
|
||||||
|
|
||||||
@ -850,7 +851,6 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (j=0; j<npk; j++) {
|
for (j=0; j<npk; j++) {
|
||||||
|
|
||||||
memset(symbols,0,sizeof(char)*nbits*2);
|
memset(symbols,0,sizeof(char)*nbits*2);
|
||||||
memset(callsign,0,sizeof(char)*13);
|
memset(callsign,0,sizeof(char)*13);
|
||||||
memset(call_loc_pow,0,sizeof(char)*23);
|
memset(call_loc_pow,0,sizeof(char)*23);
|
||||||
@ -911,6 +911,7 @@ int main(int argc, char *argv[])
|
|||||||
if((sync1 > minsync2) && (rms > minrms)) {
|
if((sync1 > minsync2) && (rms > minrms)) {
|
||||||
deinterleave(symbols);
|
deinterleave(symbols);
|
||||||
t0 = clock();
|
t0 = clock();
|
||||||
|
|
||||||
not_decoded = fano(&metric,&cycles,&maxnp,decdata,symbols,nbits,
|
not_decoded = fano(&metric,&cycles,&maxnp,decdata,symbols,nbits,
|
||||||
mettab,delta,maxcycles);
|
mettab,delta,maxcycles);
|
||||||
tfano += (double)(clock()-t0)/CLOCKS_PER_SEC;
|
tfano += (double)(clock()-t0)/CLOCKS_PER_SEC;
|
||||||
@ -942,11 +943,11 @@ int main(int argc, char *argv[])
|
|||||||
// sanity checks on grid and power, and return
|
// sanity checks on grid and power, and return
|
||||||
// call_loc_pow string and also callsign (for de-duping).
|
// call_loc_pow string and also callsign (for de-duping).
|
||||||
noprint=unpk_(message,hashtab,call_loc_pow,callsign);
|
noprint=unpk_(message,hashtab,call_loc_pow,callsign);
|
||||||
|
|
||||||
if( subtraction ) {
|
if( subtraction && !noprint ) {
|
||||||
|
|
||||||
unsigned char channel_symbols[162];
|
unsigned char channel_symbols[162];
|
||||||
|
|
||||||
if( get_wspr_channel_symbols(call_loc_pow, channel_symbols) ) {
|
if( get_wspr_channel_symbols(call_loc_pow, channel_symbols) ) {
|
||||||
subtract_signal(idat, qdat, npoints, f1, shift1, drift1, channel_symbols);
|
subtract_signal(idat, qdat, npoints, f1, shift1, drift1, channel_symbols);
|
||||||
} else {
|
} else {
|
||||||
@ -962,9 +963,10 @@ int main(int argc, char *argv[])
|
|||||||
(fabs(f1-allfreqs[i]) <3.0)) dupe=1;
|
(fabs(f1-allfreqs[i]) <3.0)) dupe=1;
|
||||||
}
|
}
|
||||||
if( (verbose || !dupe) && !noprint) {
|
if( (verbose || !dupe) && !noprint) {
|
||||||
uniques++;
|
|
||||||
strcpy(allcalls[uniques],callsign);
|
strcpy(allcalls[uniques],callsign);
|
||||||
allfreqs[uniques]=f1;
|
allfreqs[uniques]=f1;
|
||||||
|
uniques++;
|
||||||
|
|
||||||
// Add an extra space at the end of each line so that wspr-x doesn't
|
// Add an extra space at the end of each line so that wspr-x doesn't
|
||||||
// truncate the power (TNX to DL8FCL!)
|
// truncate the power (TNX to DL8FCL!)
|
||||||
|
|
||||||
|
@ -142,14 +142,13 @@ void unpackgrid( int32_t ngrid, char *grid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpackpfx( int32_t nprefix, char *call)
|
int unpackpfx( int32_t nprefix, char *call)
|
||||||
{
|
{
|
||||||
char nc, pfx[4]="", tmpcall[7]="";
|
char nc, pfx[4]="", tmpcall[7]="";
|
||||||
int i;
|
int i;
|
||||||
int32_t n;
|
int32_t n;
|
||||||
|
|
||||||
strcpy(tmpcall,call);
|
strcpy(tmpcall,call);
|
||||||
|
|
||||||
if( nprefix < 60000 ) {
|
if( nprefix < 60000 ) {
|
||||||
// add a prefix of 1 to 3 characters
|
// add a prefix of 1 to 3 characters
|
||||||
n=nprefix;
|
n=nprefix;
|
||||||
@ -193,7 +192,11 @@ void unpackpfx( int32_t nprefix, char *call)
|
|||||||
strncat(call,"/",1);
|
strncat(call,"/",1);
|
||||||
strncat(call,pfx,2);
|
strncat(call,pfx,2);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void deinterleave(unsigned char *sym)
|
void deinterleave(unsigned char *sym)
|
||||||
@ -248,7 +251,7 @@ int unpk_(signed char *message, char hashtab[32768][13], char *call_loc_pow, cha
|
|||||||
|
|
||||||
* Type 3: hash, 6 digit grid, power - ntype is negative.
|
* Type 3: hash, 6 digit grid, power - ntype is negative.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( (ntype >= 0) && (ntype <= 62) ) {
|
if( (ntype >= 0) && (ntype <= 62) ) {
|
||||||
int nu=ntype%10;
|
int nu=ntype%10;
|
||||||
if( nu == 0 || nu == 3 || nu == 7 ) {
|
if( nu == 0 || nu == 3 || nu == 7 ) {
|
||||||
@ -268,7 +271,7 @@ int unpk_(signed char *message, char hashtab[32768][13], char *call_loc_pow, cha
|
|||||||
if( nu > 3 ) nadd=nu-3;
|
if( nu > 3 ) nadd=nu-3;
|
||||||
if( nu > 7 ) nadd=nu-7;
|
if( nu > 7 ) nadd=nu-7;
|
||||||
n3=n2/128+32768*(nadd-1);
|
n3=n2/128+32768*(nadd-1);
|
||||||
unpackpfx(n3,callsign);
|
if( !unpackpfx(n3,callsign) ) return 1;
|
||||||
ndbm=ntype-nadd;
|
ndbm=ntype-nadd;
|
||||||
memset(call_loc_pow,0,sizeof(char)*23);
|
memset(call_loc_pow,0,sizeof(char)*23);
|
||||||
sprintf(cdbm,"%2d",ndbm);
|
sprintf(cdbm,"%2d",ndbm);
|
||||||
|
@ -16,7 +16,7 @@ void unpackcall( int32_t ncall, char *call );
|
|||||||
|
|
||||||
void unpackgrid( int32_t ngrid, char *grid);
|
void unpackgrid( int32_t ngrid, char *grid);
|
||||||
|
|
||||||
void unpackpfx( int32_t nprefix, char *call);
|
int unpackpfx( int32_t nprefix, char *call);
|
||||||
|
|
||||||
void deinterleave(unsigned char *sym);
|
void deinterleave(unsigned char *sym);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user