From: drowe67 Date: Sun, 11 Jun 2017 22:14:09 +0000 (+0000) Subject: first pass at tofdm.c X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=2063af0c63e7524b434860bb29bf2b0b01ef4cad;p=freetel-svn-tracking.git first pass at tofdm.c git-svn-id: https://svn.code.sf.net/p/freetel/code@3170 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/unittest/CMakeLists.txt b/codec2-dev/unittest/CMakeLists.txt index c358f044..c45706ca 100644 --- a/codec2-dev/unittest/CMakeLists.txt +++ b/codec2-dev/unittest/CMakeLists.txt @@ -13,12 +13,6 @@ target_link_libraries(extract codec2) add_executable(vqtrain vqtrain.c) target_link_libraries(vqtrain codec2) -add_executable(genphdata genphdata.c) -target_link_libraries(genphdata codec2) - -add_executable(genampdata genampdata.c) -target_link_libraries(genampdata codec2) - add_executable(polar2rect polar2rect.c) target_link_libraries(polar2rect codec2) @@ -30,9 +24,6 @@ set(CODEBOOKS ../src/codebook.c ../src/codebookd.c ../src/codebookvq.c ../src/co add_executable(tnlp tnlp.c ../src/sine.c ../src/nlp.c ../src/kiss_fft.c ../src/dump.c) target_link_libraries(tnlp codec2) -add_executable(tinterp tinterp.c ../src/sine.c ../src/kiss_fft.c ../src/interp.c ../src/lpc.c ../src/lsp.c ../src/quantise.c ${CODEBOOKS} ../src/dump.c) -target_link_libraries(tinterp codec2) - add_executable(tquant tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/kiss_fft.c ${CODEBOOKS}) target_link_libraries(tquant codec2) @@ -63,15 +54,15 @@ target_link_libraries(tfmfsk m) add_executable(tdeframer tdeframer.c) target_link_libraries(tdeframer m codec2) +add_executable(tofdm tofdm.c ../src/ofdm.c ../src/octave.c) +target_link_libraries(tofdm m) + add_executable(tfreedv_data_channel tfreedv_data_channel.c) target_link_libraries(tfreedv_data_channel codec2) add_executable(create_interleaver create_interleaver.c) target_link_libraries(create_interleaver codec2) -add_executable(tlspsens tlspsens.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/kiss_fft.c ../src/codec2.c ../src/sine.c ../src/nlp.c ../src/pack.c ../src/interp.c ../src/postfilter.c ../src/phase.c ${CODEBOOKS}) -target_link_libraries(tlspsens codec2) - add_executable(tprede tprede.c ../src/lpc.c) target_link_libraries(tprede codec2) diff --git a/codec2-dev/unittest/tofdm.c b/codec2-dev/unittest/tofdm.c new file mode 100644 index 00000000..b1fdb357 --- /dev/null +++ b/codec2-dev/unittest/tofdm.c @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: tcohpsk.c + AUTHORS.....: David Rowe & Steve Sampson + DATE CREATED: June 2017 + + Tests for the C version of the OFDM modem. This program + outputs a file of Octave vectors that are loaded and automatically + tested against the Octave version of the modem by the Octave script + tofdm.m + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2017 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 + +#include "ofdm_internal.h" +#include "codec2_ofdm.h" +#include "octave.h" +#include "test_bits_ofdm.h" + +#define FRAMES 10 + +int main(int argc, char *argv[]) +{ + struct OFDM *ofdm; + int tx_bits[OFDM_BITSPERFRAME]; /* one frame of input bits */ + COMP tx[OFDM_SAMPLESPERFRAME]; /* one frame of tx samples */ + + int tx_bits_log[OFDM_BITSPERFRAME*FRAMES]; + COMP tx_log[OFDM_SAMPLESPERFRAME*FRAMES]; + + FILE *fout; + int i,f; + + ofdm = ofdm_create(); assert(ofdm != NULL); + + /* Main Loop ---------------------------------------------------------------------*/ + + for(f=0; fW, OFDM_M, OFDM_NC + 2, OFDM_NC + 2); + octave_save_int(fout, "tx_bits_log_c", tx_bits_log, 1, OFDM_BITSPERFRAME*FRAMES); + octave_save_complex(fout, "tx_log_c", (COMP*)tx_log, 1, OFDM_BITSPERFRAME*FRAMES, OFDM_SAMPLESPERFRAME*FRAMES); + fclose(fout); + + ofdm_destroy(ofdm); + + return 0; +} +