From c5f80f3e41b31056d902b5523d7f718109453f61 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 30 Jun 2014 23:24:20 +0000 Subject: [PATCH] UT to measure memory, and fixed to tfdmdv.c for new d/c + filter git-svn-id: https://svn.code.sf.net/p/freetel/code@1719 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/unittest/CMakeLists.txt | 2 + codec2-dev/unittest/fdmdv_mem.c | 65 ++++++++++++++++++++++++++++++ codec2-dev/unittest/tfdmdv.c | 7 +++- 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 codec2-dev/unittest/fdmdv_mem.c diff --git a/codec2-dev/unittest/CMakeLists.txt b/codec2-dev/unittest/CMakeLists.txt index 00b17f80..74d0f8af 100644 --- a/codec2-dev/unittest/CMakeLists.txt +++ b/codec2-dev/unittest/CMakeLists.txt @@ -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 index 00000000..06a0ca0f --- /dev/null +++ b/codec2-dev/unittest/fdmdv_mem.c @@ -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 . +*/ + +#include +#include +#include +#include +#include + +#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; +} + diff --git a/codec2-dev/unittest/tfdmdv.c b/codec2-dev/unittest/tfdmdv.c index 2be95812..af962fc6 100644 --- a/codec2-dev/unittest/tfdmdv.c +++ b/codec2-dev/unittest/tfdmdv.c @@ -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; iprev_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; cphase_difference[c]; -- 2.25.1