Skip to content

Commit 58fbd33

Browse files
authored
Merge pull request #198 from drowe67/dr-cohpsk-nan
Avoid NANs in cohpsk modem with 0 inputs
2 parents 0515645 + 3f076dc commit 58fbd33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cohpsk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ void corr_with_pilots(float *corr_out, float *mag_out, struct COHPSK *coh, int t
543543
f_fine_rect[p].imag = sinf(result);
544544
}
545545

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

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

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

0 commit comments

Comments
 (0)