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:
Steven Franke 2015-06-16 02:47:51 +00:00
parent 327a5907b9
commit b41c813259
3 changed files with 19 additions and 14 deletions

View File

@ -359,6 +359,7 @@ void subtract_signal(double *id, double *qd, long np,
for (j=0; j<256; j++) {
k=shift0+i*256+j;
if( (k>0) & (k<np) ) {
nsum++;
i0=i0 + id[k]*c0[j] + qd[k]*s0[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...
q0=q0/256.0;
for (j=0; j<256; j++) {
k=shift0+i*256+j;
if( (k>0) & (k<np) ) {
@ -752,6 +752,7 @@ int main(int argc, char *argv[])
}
npk=i;
/*
// bubble sort on snr, bringing freq along for the ride
int pass;
float tmp;
@ -767,7 +768,7 @@ int main(int argc, char *argv[])
}
}
}
*/
t0=clock();
/* 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++) {
memset(symbols,0,sizeof(char)*nbits*2);
memset(callsign,0,sizeof(char)*13);
memset(call_loc_pow,0,sizeof(char)*23);
@ -911,6 +911,7 @@ int main(int argc, char *argv[])
if((sync1 > minsync2) && (rms > minrms)) {
deinterleave(symbols);
t0 = clock();
not_decoded = fano(&metric,&cycles,&maxnp,decdata,symbols,nbits,
mettab,delta,maxcycles);
tfano += (double)(clock()-t0)/CLOCKS_PER_SEC;
@ -943,7 +944,7 @@ int main(int argc, char *argv[])
// call_loc_pow string and also callsign (for de-duping).
noprint=unpk_(message,hashtab,call_loc_pow,callsign);
if( subtraction ) {
if( subtraction && !noprint ) {
unsigned char channel_symbols[162];
@ -962,9 +963,10 @@ int main(int argc, char *argv[])
(fabs(f1-allfreqs[i]) <3.0)) dupe=1;
}
if( (verbose || !dupe) && !noprint) {
uniques++;
strcpy(allcalls[uniques],callsign);
allfreqs[uniques]=f1;
uniques++;
// Add an extra space at the end of each line so that wspr-x doesn't
// truncate the power (TNX to DL8FCL!)

View File

@ -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]="";
int i;
int32_t n;
strcpy(tmpcall,call);
if( nprefix < 60000 ) {
// add a prefix of 1 to 3 characters
n=nprefix;
@ -193,8 +192,12 @@ void unpackpfx( int32_t nprefix, char *call)
strncat(call,"/",1);
strncat(call,pfx,2);
}
else {
return 0;
}
}
return 1;
}
void deinterleave(unsigned char *sym)
{
@ -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 > 7 ) nadd=nu-7;
n3=n2/128+32768*(nadd-1);
unpackpfx(n3,callsign);
if( !unpackpfx(n3,callsign) ) return 1;
ndbm=ntype-nadd;
memset(call_loc_pow,0,sizeof(char)*23);
sprintf(cdbm,"%2d",ndbm);

View File

@ -16,7 +16,7 @@ void unpackcall( int32_t ncall, char *call );
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);