UT to measure memory, and fixed to tfdmdv.c for new d/c + filter
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 30 Jun 2014 23:24:20 +0000 (23:24 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 30 Jun 2014 23:24:20 +0000 (23:24 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1719 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/unittest/CMakeLists.txt
codec2-dev/unittest/fdmdv_mem.c [new file with mode: 0644]
codec2-dev/unittest/tfdmdv.c

index 00b17f8040713a479bef7829e5e048d482bcbea5..74d0f8afd7c12e4015fd5c97ba0df8627ac0fb20 100644 (file)
@@ -78,6 +78,8 @@ target_link_libraries(tfifo codec2 ${CMAKE_THREAD_LIBS_INIT})
 add_executable(speexnoisesup speexnoisesup.c)
 target_link_libraries(speexnoisesup speexdsp)
 
+add_executable(fdmdv_mem fdmdv_mem.c)
+
 add_definitions(-D__UNITTEST__)
 add_executable(c2validate c2validate.c)
 target_link_libraries(c2validate codec2)
diff --git a/codec2-dev/unittest/fdmdv_mem.c b/codec2-dev/unittest/fdmdv_mem.c
new file mode 100644 (file)
index 0000000..06a0ca0
--- /dev/null
@@ -0,0 +1,65 @@
+/*---------------------------------------------------------------------------*\
+                                                                             
+  FILE........: fdmdv_mem.c
+  AUTHOR......: David Rowe  
+  DATE CREATED: 25 June 2014
+                                                                             
+  Prints out the memory used by the FDMDV modem states.  Used to optimise
+  memory use for thw STM32F4 port.
+                                                                             
+\*---------------------------------------------------------------------------*/
+
+/*
+  Copyright (C) 2014 David Rowe
+
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License version 2, as
+  published by the Free Software Foundation.  This program is
+  distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "fdmdv_internal.h"
+
+extern float pilot_coeff[];
+
+int main(int argc, char *argv[])
+{
+    struct FDMDV *fdmdv;
+
+    printf("struct FDMDV..........: %d\n", sizeof(struct FDMDV));
+    printf("prev_tx_symbols.......: %d\n", sizeof(fdmdv->prev_tx_symbols));
+    printf("tx_filter_memory......: %d\n", sizeof(fdmdv->tx_filter_memory));
+    printf("phase_tx..............: %d\n", sizeof(fdmdv->phase_tx));
+    printf("freq..................: %d\n", sizeof(fdmdv->freq));
+    printf("pilot_lut.............: %d\n", sizeof(fdmdv->pilot_lut));
+    printf("pilot_baseband1.......: %d\n", sizeof(fdmdv->pilot_baseband1));
+    printf("pilot_baseband2.......: %d\n", sizeof(fdmdv->pilot_baseband2));
+    printf("pilot_lpf1............: %d\n", sizeof(fdmdv->pilot_lpf1));
+    printf("pilot_lpf2............: %d\n", sizeof(fdmdv->pilot_lpf2));
+    printf("S1....................: %d\n", sizeof(fdmdv->S1));
+    printf("S2....................: %d\n", sizeof(fdmdv->S2));
+    printf("phase_rx..............: %d\n", sizeof(fdmdv->phase_rx));
+    printf("rx_fdm_mem............: %d\n", sizeof(fdmdv->rx_fdm_mem));
+    printf("rx_filter_mem_timing..: %d\n", sizeof(fdmdv->rx_filter_mem_timing));
+    printf("phase_difference......: %d\n", sizeof(fdmdv->phase_difference));
+    printf("prev_rx_symbols.......: %d\n", sizeof(fdmdv->prev_rx_symbols));
+    printf("fft_buf...............: %d\n", sizeof(fdmdv->fft_buf));
+    printf("kiss_fft_cfg..........: %d\n", sizeof(fdmdv->fft_cfg));
+
+    return 0;
+}
+
index 2be958124e9005ddd3c0c8353f63a67dab98ee8e..af962fc61fbd165ec51a2d00903233c9c52464f7 100644 (file)
@@ -161,15 +161,17 @@ int main(int argc, char *argv[])
        
        /* baseband processing */
 
-       fdm_downconvert(rx_baseband, FDMDV_NC, rx_fdm_fcorr, fdmdv->phase_rx, fdmdv->freq, nin);
-       rx_filter(rx_filt, FDMDV_NC, rx_baseband, fdmdv->rx_filter_memory, nin);
+        down_convert_and_rx_filter(rx_filt, fdmdv->Nc, rx_fdm_fcorr, fdmdv->rx_fdm_mem, fdmdv->phase_rx, fdmdv->freq, 
+                                   fdmdv->freq_pol, nin);
        rx_timing = rx_est_timing(rx_symbols, FDMDV_NC, rx_filt, fdmdv->rx_filter_mem_timing, env, nin);         
        foff_fine = qpsk_to_bits(rx_bits, &sync_bit, FDMDV_NC, fdmdv->phase_difference, fdmdv->prev_rx_symbols, rx_symbols, 0);
+
         //for(i=0; i<FDMDV_NC;i++)
         //    printf("rx_symbols: %f %f prev_rx_symbols: %f %f phase_difference: %f %f\n", rx_symbols[i].real, rx_symbols[i].imag,
         //          fdmdv->prev_rx_symbols[i].real, fdmdv->prev_rx_symbols[i].imag, fdmdv->phase_difference[i].real, fdmdv->phase_difference[i].imag);
         //if (f==1)
         //   exit(0);
+
        snr_update(fdmdv->sig_est, fdmdv->noise_est, FDMDV_NC, fdmdv->phase_difference);
        memcpy(fdmdv->prev_rx_symbols, rx_symbols, sizeof(COMP)*(FDMDV_NC+1));
        
@@ -225,6 +227,7 @@ int main(int argc, char *argv[])
        memcpy(&env_log[NT*P*f], env, sizeof(float)*NT*P);
        rx_timing_log[f] = rx_timing;
        nin_log[f] = nin;
+        
        for(c=0; c<FDMDV_NC+1; c++) {
            rx_symbols_log[c][f] = rx_symbols[c];
            phase_difference_log[c][f] = fdmdv->phase_difference[c];