From 8429f52c36dc638a9a1f809e7e08c2ddb1cc92d6 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Thu, 5 Jun 2014 07:14:31 +0000 Subject: [PATCH] recoded dig osc mag normalisation as per Steve's suggstions - thanks Steve git-svn-id: https://svn.code.sf.net/p/freetel/code@1639 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/fdmdv.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/codec2-dev/src/fdmdv.c b/codec2-dev/src/fdmdv.c index 90814c0f..6c664f79 100644 --- a/codec2-dev/src/fdmdv.c +++ b/codec2-dev/src/fdmdv.c @@ -445,9 +445,10 @@ void tx_filter(COMP tx_baseband[NC+1][M], int Nc, COMP tx_symbols[], COMP tx_fil void fdm_upconvert(COMP tx_fdm[], int Nc, COMP tx_baseband[NC+1][M], COMP phase_tx[], COMP freq[]) { - int i,c; - COMP two = {2.0, 0.0}; - COMP pilot; + int i,c; + COMP two = {2.0, 0.0}; + COMP pilot; + float mag; for(i=0; ireal /= cabsolute(*foff_phase_rect); - foff_phase_rect->imag /= cabsolute(*foff_phase_rect); + mag = cabsolute(*foff_phase_rect); + foff_phase_rect->real /= mag; + foff_phase_rect->imag /= mag; } /*---------------------------------------------------------------------------*\ @@ -788,7 +792,8 @@ void CODEC2_WIN32SUPPORT fdmdv_freq_shift(COMP rx_fdm_fcorr[], COMP rx_fdm[], fl void fdm_downconvert(COMP rx_baseband[NC+1][M+M/P], int Nc, COMP rx_fdm[], COMP phase_rx[], COMP freq[], int nin) { - int i,c; + int i,c; + float mag; /* maximum number of input samples to demod */ @@ -821,8 +826,9 @@ void fdm_downconvert(COMP rx_baseband[NC+1][M+M/P], int Nc, COMP rx_fdm[], COMP /* normalise digital oscilators as the magnitude can drift over time */ for (c=0; c