Skip to content

Commit

Permalink
Merge pull request #198 from drowe67/dr-cohpsk-nan
Browse files Browse the repository at this point in the history
Avoid NANs in cohpsk modem with 0 inputs
  • Loading branch information
drowe67 authored Jul 8, 2021
2 parents 0515645 + 3f076dc commit 58fbd33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cohpsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ void corr_with_pilots(float *corr_out, float *mag_out, struct COHPSK *coh, int t
f_fine_rect[p].imag = sinf(result);
}

corr = 0.0; mag = 0.0;
corr = 0.0; mag = 1E-12;
for (c=0; c<COHPSK_NC*ND; c++) {
acorr.real = 0.0f; acorr.imag = 0.0f; pc = c % COHPSK_NC;
for (p=0; p<NPILOTSFRAME+2; p++) {
Expand Down Expand Up @@ -585,7 +585,7 @@ void frame_sync_fine_freq_est(struct COHPSK *coh, COMP ch_symb[][COHPSK_NC*ND],

/* sample correlation over 2D grid of time and fine freq points */

max_corr = max_mag = 0;
max_corr = 0.0; max_mag = 1E-12;
for (f_fine=-20; f_fine<=20; f_fine+=0.25) {
for (t=0; t<NSYMROWPILOT; t++) {
corr_with_pilots(&corr, &mag, coh, t, f_fine);
Expand Down

0 comments on commit 58fbd33

Please sign in to comment.