aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
Diffstat (limited to 'unittest')
-rw-r--r--unittest/CMakeLists.txt38
-rw-r--r--unittest/fdmdv_mem.c63
-rw-r--r--unittest/function_trace.c36
-rw-r--r--unittest/hts1a_1300.h8002
-rw-r--r--unittest/mksine.c54
-rwxr-xr-xunittest/ofdm_fade_dpsk.sh15
-rw-r--r--unittest/ofdm_mem.c107
-rw-r--r--unittest/ofdm_stack.c229
-rwxr-xr-xunittest/ota_auto.sh15
-rwxr-xr-xunittest/ota_last.sh70
-rwxr-xr-xunittest/ota_summary.sh55
-rwxr-xr-xunittest/ota_test.sh161
-rwxr-xr-xunittest/ota_voice_auto.sh23
-rwxr-xr-xunittest/ota_voice_summary.sh80
-rwxr-xr-xunittest/ota_voice_test.sh309
-rw-r--r--unittest/raw_data_curves/Makefile132
-rwxr-xr-xunittest/raw_data_curves/snr_curves.sh184
-rw-r--r--unittest/sd.c84
-rw-r--r--unittest/sd.h33
-rwxr-xr-xunittest/spectrogram.sh17
-rw-r--r--unittest/t_helpers.c38
-rw-r--r--unittest/t_helpers.h41
-rw-r--r--unittest/tcontphase.c186
-rw-r--r--unittest/tdeframer.c148
-rw-r--r--unittest/test_phi0.c78
-rw-r--r--unittest/tfreedv_2400A_rawdata.c2
-rw-r--r--unittest/tfreedv_2400B_rawdata.c2
-rwxr-xr-xunittest/tnc1_high_snr.sh103
-rwxr-xr-xunittest/tnc4_high_snr_ping.sh114
-rw-r--r--unittest/tprede.c53
-rw-r--r--unittest/tquisk_filter.c3
-rw-r--r--unittest/tst_codec2_fft_init.c97
-rw-r--r--unittest/vq_mbest.c302
33 files changed, 366 insertions, 10508 deletions
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index 080ebc5..656afd0 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -15,9 +15,6 @@ add_executable(tfreedv_data_channel tfreedv_data_channel.c ../src/freedv_data_ch
add_executable(tfmfsk tfmfsk.c ../src/octave.c ../src/modem_probe.c)
target_link_libraries(tfmfsk m)
-add_executable(tdeframer tdeframer.c)
-target_link_libraries(tdeframer m codec2)
-
add_definitions(-DMODEMPROBE_ENABLE -DXXXXX)
add_executable(tofdm tofdm.c ../src/octave.c)
@@ -26,44 +23,18 @@ target_link_libraries(tofdm m codec2)
add_executable(tofdm_acq tofdm_acq.c ../src/octave.c)
target_link_libraries(tofdm_acq m codec2)
-add_executable(tesno_est tesno_est.c)
-target_link_libraries(tesno_est m codec2)
-
if(UNIX) # Uses pthreads
add_executable(tfifo tfifo.c ../src/codec2_fifo.c)
target_link_libraries(tfifo codec2 ${CMAKE_THREAD_LIBS_INIT})
endif()
-add_executable(fdmdv_mem fdmdv_mem.c)
-
-add_executable(ofdm_mem ofdm_mem.c ../src/ofdm.c ../src/octave.c ../src/kiss_fft.c ../src/modem_probe.c ../src/mpdecode_core.c ../src/phi0.c ../src/filter.c)
-target_link_libraries(ofdm_mem m)
-
-add_library(function_trace STATIC ../unittest/function_trace.c)
-
-add_executable(ofdm_stack ofdm_stack.c ../src/ofdm.c ../src/octave.c ../src/kiss_fft.c ../src/modem_probe.c ../src/mpdecode_core.c ../src/phi0.c ../src/filter.c)
-if (CMAKE_C_COMPILER MATCHES "gcc$")
- target_link_libraries(ofdm_stack function_trace m -no-pie "-Wl,-Map=ofdm_stack.map")
- target_compile_options(ofdm_stack PUBLIC -fstack-usage -finstrument-functions)
-else()
- target_link_libraries(ofdm_stack function_trace m -no-pie)
- target_compile_options(ofdm_stack PUBLIC -finstrument-functions)
-endif()
add_definitions(-D__UNITTEST__)
add_executable(tnewamp1 tnewamp1.c ../src/quantise.c ../src/newamp1.c ../src/mbest.c ../src/kiss_fft.c ../src/sine.c ../src/nlp.c ../src/dump.c ../src/octave.c ${CODEBOOKS})
target_link_libraries(tnewamp1 codec2)
add_executable(compare_ints compare_ints.c)
-
add_executable(compare_floats compare_floats.c)
-
-add_executable(test_phi0 test_phi0.c ../src/phi0.c)
-target_link_libraries(test_phi0 m)
-
-add_executable(tst_codec2_fft_init tst_codec2_fft_init.c)
-target_link_libraries(tst_codec2_fft_init m codec2)
-
add_executable(tvq_mbest tvq_mbest.c)
add_executable(tfreedv_800XA_rawdata tfreedv_800XA_rawdata.c)
@@ -141,3 +112,12 @@ target_compile_options(golay23 PUBLIC -DGOLAY23_UNITTEST)
add_executable(golay23_runtime_tables ../src/golay23.c)
target_compile_options(golay23_runtime_tables PUBLIC -DGOLAY23_UNITTEST -DRUN_TIME_TABLES)
+
+add_executable(mksine mksine.c)
+target_link_libraries(mksine m)
+
+add_executable(vq_mbest vq_mbest.c)
+target_link_libraries(vq_mbest codec2)
+
+add_executable(tesno_est tesno_est.c)
+target_link_libraries(tesno_est m codec2) \ No newline at end of file
diff --git a/unittest/fdmdv_mem.c b/unittest/fdmdv_mem.c
deleted file mode 100644
index 6bcc6bc..0000000
--- a/unittest/fdmdv_mem.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*---------------------------------------------------------------------------*\
-
- 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 the 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.1, 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..........: %ld\n", sizeof(struct FDMDV));
- printf("prev_tx_symbols.......: %ld\n", sizeof(fdmdv->prev_tx_symbols));
- printf("tx_filter_memory......: %ld\n", sizeof(fdmdv->tx_filter_memory));
- printf("phase_tx..............: %ld\n", sizeof(fdmdv->phase_tx));
- printf("freq..................: %ld\n", sizeof(fdmdv->freq));
- printf("pilot_lut.............: %ld\n", sizeof(fdmdv->pilot_lut));
- printf("pilot_baseband1.......: %ld\n", sizeof(fdmdv->pilot_baseband1));
- printf("pilot_baseband2.......: %ld\n", sizeof(fdmdv->pilot_baseband2));
- printf("pilot_lpf1............: %ld\n", sizeof(fdmdv->pilot_lpf1));
- printf("pilot_lpf2............: %ld\n", sizeof(fdmdv->pilot_lpf2));
- printf("S1....................: %ld\n", sizeof(fdmdv->S1));
- printf("S2....................: %ld\n", sizeof(fdmdv->S2));
- printf("phase_rx..............: %ld\n", sizeof(fdmdv->phase_rx));
- printf("rx_fdm_mem............: %ld\n", sizeof(fdmdv->rx_fdm_mem));
- printf("rx_filter_mem_timing..: %ld\n", sizeof(fdmdv->rx_filter_mem_timing));
- printf("phase_difference......: %ld\n", sizeof(fdmdv->phase_difference));
- printf("prev_rx_symbols.......: %ld\n", sizeof(fdmdv->prev_rx_symbols));
-
- return 0;
-}
-
diff --git a/unittest/function_trace.c b/unittest/function_trace.c
deleted file mode 100644
index 5ed47a9..0000000
--- a/unittest/function_trace.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <stdio.h>
-
-static FILE *fp_trace;
-
-void
-__attribute__ ((constructor))
-trace_begin (void)
-{
- fp_trace = fopen("function_trace.out", "w");
-}
-
-void
-__attribute__ ((destructor))
-trace_end (void)
-{
- if(fp_trace != NULL) {
- fclose(fp_trace);
- }
-}
-
-
-void
-__cyg_profile_func_enter (void *func, void *caller)
-{
- if(fp_trace != NULL) {
- fprintf(fp_trace, "e %p %p\n", func, caller);
- }
-}
-
-void
-__cyg_profile_func_exit (void *func, void *caller)
-{
- if(fp_trace != NULL) {
- fprintf(fp_trace, "x %p %p\n", func, caller);
- }
-}
diff --git a/unittest/hts1a_1300.h b/unittest/hts1a_1300.h
deleted file mode 100644
index a254ecc..0000000
--- a/unittest/hts1a_1300.h
+++ /dev/null
@@ -1,8002 +0,0 @@
-short hts1a_1300[] = {
-0,
-1,
-1,
-2,
-2,
-3,
-2,
-2,
-2,
-3,
-2,
-4,
-2,
-2,
--1,
-0,
--2,
-0,
-2,
-2,
--3,
--2,
--5,
--2,
--4,
--1,
--5,
--5,
--10,
--11,
--15,
--9,
--8,
-0,
--4,
--5,
--10,
--5,
-0,
-1,
--3,
-7,
-3,
-2,
-0,
-6,
-10,
-12,
-5,
-8,
-9,
-7,
-13,
-13,
-5,
-19,
-23,
-14,
-3,
-0,
-7,
-10,
-9,
-0,
--11,
--18,
--15,
--16,
--15,
--27,
--37,
--46,
--40,
--37,
--49,
--80,
--73,
--65,
--43,
--10,
-39,
-72,
-88,
-82,
-82,
-66,
-57,
-34,
-38,
-32,
-28,
-17,
-28,
-7,
-1,
--12,
--1,
--13,
--2,
--9,
--11,
--24,
--16,
--26,
--16,
--24,
--11,
--17,
--11,
--21,
--14,
--26,
--11,
--9,
-6,
--11,
--3,
--9,
-2,
--5,
-10,
-11,
-23,
-2,
-8,
-5,
-24,
-14,
-29,
-9,
-21,
-14,
-21,
-11,
-12,
-9,
-22,
-4,
-16,
-0,
-5,
--2,
--1,
--12,
-2,
--6,
--13,
--29,
--22,
--37,
--25,
--32,
--29,
--42,
--45,
--60,
--51,
--59,
--45,
--19,
-23,
-57,
-80,
-69,
-65,
-49,
-40,
-34,
-38,
-20,
-10,
-5,
-5,
--6,
--5,
--10,
--3,
--7,
--15,
--20,
--21,
--16,
--9,
--17,
--18,
--21,
--20,
--9,
--5,
--5,
--7,
--19,
--15,
--4,
-2,
-6,
--3,
--3,
-1,
-8,
-7,
-16,
-12,
-7,
-3,
-5,
-15,
-22,
-15,
-17,
-12,
-16,
-6,
-13,
--3,
-8,
-12,
-9,
-1,
-7,
--1,
-6,
--5,
--1,
--7,
--9,
--20,
--17,
--20,
--3,
--8,
--1,
--27,
--35,
--46,
--36,
--34,
--21,
--23,
-2,
-20,
-43,
-41,
-52,
-41,
-37,
-36,
-41,
-24,
-16,
-7,
-1,
--18,
--14,
--22,
--6,
--4,
--5,
--8,
--7,
--15,
--14,
--20,
--10,
--21,
--13,
--3,
--2,
--7,
-0,
-1,
--4,
--10,
--3,
--1,
--1,
--4,
--2,
-4,
-13,
-15,
-11,
-3,
--4,
-3,
-4,
-2,
-7,
-13,
-9,
-9,
-9,
-6,
-0,
-1,
--1,
--1,
-3,
-5,
-1,
-0,
--5,
--2,
--12,
-4,
--7,
--3,
--11,
--8,
--6,
--10,
--14,
--8,
--16,
--12,
--19,
--19,
--20,
--3,
-0,
-10,
-23,
-25,
-27,
-45,
-30,
-28,
-19,
-24,
-13,
-0,
--15,
--20,
--17,
--4,
--9,
--6,
--5,
--10,
--9,
-0,
--1,
--7,
--14,
--14,
--6,
--6,
-4,
-0,
--5,
-1,
-4,
-6,
-4,
--1,
-3,
--8,
--4,
-1,
-11,
-9,
-12,
-6,
-1,
-1,
-10,
-6,
--2,
--3,
-9,
-7,
-4,
-4,
-0,
--8,
-0,
--3,
--1,
--2,
--1,
--6,
--19,
--10,
--18,
--13,
--15,
--14,
--11,
--6,
--4,
-0,
-7,
-18,
-16,
-38,
-34,
-32,
-23,
-17,
-7,
--6,
--24,
--17,
--16,
--9,
--6,
--5,
--12,
--3,
--12,
--5,
--6,
--5,
--15,
--6,
--3,
-2,
-1,
-13,
-0,
-4,
-0,
-0,
--1,
-7,
-6,
-11,
-4,
-2,
-4,
-9,
-5,
-7,
--4,
--1,
-0,
-7,
--1,
--7,
-1,
-1,
-1,
-0,
--5,
--10,
--9,
--9,
--6,
--13,
--13,
--9,
--7,
--10,
--5,
--3,
-10,
-12,
-27,
-21,
-26,
-17,
-13,
-9,
-2,
--4,
-5,
--10,
--4,
--18,
--11,
--15,
--5,
--6,
-2,
--9,
--5,
--17,
--15,
--4,
-13,
-0,
-0,
-4,
-15,
-7,
-2,
--4,
-0,
--7,
-10,
-5,
-13,
-11,
-8,
-4,
-8,
-0,
--1,
-0,
-3,
--2,
-1,
--3,
-0,
-0,
--12,
--14,
--18,
--15,
--14,
--15,
--16,
--7,
-3,
-9,
-7,
-12,
-17,
-24,
-25,
-27,
-16,
-10,
--8,
--2,
--8,
--8,
--14,
--10,
--13,
--2,
--7,
-2,
--12,
--4,
--9,
-3,
--2,
-4,
--2,
-13,
-1,
-7,
--9,
-1,
-0,
-13,
-6,
-11,
-0,
-9,
--2,
-6,
--9,
-3,
--9,
-10,
--5,
--7,
--4,
-5,
--22,
--8,
--28,
--14,
--23,
--11,
--16,
-7,
-13,
-31,
-24,
-35,
-27,
-33,
-16,
-20,
-5,
-3,
--20,
--6,
--13,
--2,
--17,
--10,
--18,
--2,
--7,
-1,
--10,
--5,
--12,
--2,
--6,
-4,
--5,
-6,
--3,
--2,
--9,
--1,
--5,
-1,
-0,
-3,
--8,
-0,
--5,
-0,
--6,
--13,
--11,
-3,
--4,
--10,
--18,
--4,
-0,
-6,
-4,
-17,
-26,
-35,
-38,
-35,
-34,
-24,
-15,
-6,
--2,
-0,
-0,
-5,
-0,
--6,
--10,
--13,
--12,
--6,
--10,
--6,
--2,
--3,
--13,
--13,
--8,
--9,
--9,
--4,
--10,
--10,
--8,
--7,
--15,
--8,
--8,
--14,
--11,
--8,
--9,
--4,
--20,
--13,
--3,
--4,
--11,
--19,
--16,
-1,
-4,
-15,
-21,
-39,
-45,
-56,
-49,
-48,
-30,
-26,
-8,
-4,
--4,
--5,
--3,
-1,
--5,
--7,
--17,
--8,
--4,
--2,
--11,
--1,
--5,
--4,
--9,
--10,
--7,
--9,
--13,
--7,
--2,
--8,
--10,
--14,
--19,
--12,
--4,
--6,
--10,
--11,
--11,
--14,
--9,
--11,
--4,
--8,
--5,
--11,
--17,
--16,
--6,
--3,
-15,
-15,
-38,
-45,
-56,
-53,
-49,
-32,
-31,
-11,
-14,
--7,
--5,
--10,
-1,
--10,
--8,
--22,
--5,
--10,
--7,
--21,
--2,
--12,
-2,
--13,
--1,
--11,
--4,
--17,
-4,
-0,
-1,
--7,
-0,
--6,
-11,
-5,
-4,
--7,
-2,
--10,
-1,
--8,
--3,
--7,
-1,
--11,
--13,
--26,
--16,
--29,
--11,
--12,
-2,
-11,
-27,
-32,
-37,
-32,
-43,
-27,
-25,
-12,
-9,
--4,
--11,
--25,
--20,
--18,
--11,
--13,
--8,
--8,
--8,
--16,
--14,
--5,
-4,
-6,
-10,
-5,
-8,
-7,
-4,
-16,
-8,
-2,
-4,
-9,
-13,
-15,
-4,
-0,
-0,
--3,
--1,
--2,
--7,
--6,
--1,
--6,
--12,
--20,
--21,
--29,
--29,
--16,
--14,
--3,
-9,
-16,
-26,
-31,
-43,
-37,
-31,
-23,
-15,
-7,
--5,
--22,
--23,
--23,
--18,
--18,
--16,
--18,
--5,
--10,
--9,
--16,
--7,
--6,
-7,
-1,
-12,
-7,
-18,
-9,
-11,
-0,
-5,
-0,
-15,
-8,
-23,
-8,
-7,
--6,
-3,
--8,
-10,
--4,
-6,
--10,
-2,
--18,
--1,
--12,
--13,
--32,
--24,
--28,
--15,
--29,
-1,
--6,
-15,
-21,
-45,
-41,
-47,
-32,
-31,
-14,
-12,
--11,
--9,
--19,
--15,
--23,
--16,
--28,
--10,
--15,
--5,
--19,
--12,
--11,
-3,
--4,
-4,
-1,
-7,
-7,
-1,
--1,
-4,
-6,
-16,
-10,
-14,
-13,
-11,
-8,
-7,
-5,
-7,
-5,
-3,
-4,
-1,
--9,
--7,
--8,
--15,
--11,
--20,
--22,
--26,
--26,
--28,
--23,
--17,
--2,
-5,
-30,
-39,
-56,
-47,
-46,
-29,
-23,
-3,
-7,
--7,
--1,
--22,
--22,
--33,
--25,
--30,
--19,
--17,
--11,
--22,
--2,
--5,
-0,
--6,
-12,
-2,
-19,
-2,
-11,
-8,
-16,
-13,
-16,
-4,
-14,
-5,
-13,
-0,
-7,
--1,
-5,
--3,
-7,
--1,
--2,
--6,
--4,
--16,
--6,
--12,
--7,
--13,
--12,
--23,
--22,
--30,
--20,
--23,
--6,
--1,
-15,
-18,
-29,
-33,
-42,
-36,
-44,
-36,
-34,
-21,
-7,
--7,
--11,
--19,
--28,
--32,
--23,
--25,
--16,
--25,
--23,
--26,
--25,
--12,
--4,
--1,
-0,
-3,
-7,
-4,
-7,
-7,
-12,
-14,
-4,
-15,
-16,
-15,
-15,
-14,
-5,
-8,
-4,
-6,
-4,
-6,
-11,
-4,
-6,
-5,
--4,
--10,
--9,
--4,
--5,
--8,
--12,
--17,
--24,
--30,
--28,
--30,
--32,
--28,
--22,
--16,
--5,
-6,
-15,
-27,
-44,
-52,
-61,
-50,
-46,
-36,
-31,
-17,
-1,
--5,
--9,
--15,
--18,
--28,
--26,
--34,
--34,
--32,
--25,
--24,
--19,
--17,
--12,
--9,
-0,
--6,
-7,
-0,
-13,
-9,
-15,
-12,
-16,
-10,
-14,
-13,
-22,
-14,
-17,
-0,
-9,
-1,
-7,
-7,
-16,
-4,
-9,
--7,
--2,
--7,
-4,
--2,
-3,
--3,
--4,
--22,
--9,
--18,
--11,
--19,
--4,
--16,
--22,
--33,
--31,
--40,
--29,
--32,
--14,
--8,
-17,
-26,
-51,
-45,
-57,
-53,
-60,
-53,
-53,
-36,
-31,
-16,
-12,
--7,
--18,
--32,
--36,
--44,
--39,
--45,
--36,
--41,
--35,
--31,
--24,
--28,
--17,
--14,
--2,
--6,
-0,
-8,
-18,
-18,
-19,
-24,
-18,
-11,
-19,
-12,
-15,
-18,
-20,
-19,
-18,
-13,
-9,
-4,
-8,
-6,
-5,
-0,
-1,
--5,
-0,
-3,
-4,
-6,
-4,
-6,
-3,
--5,
--7,
--16,
--18,
--19,
--12,
--4,
--7,
--14,
--24,
--32,
--42,
--39,
--43,
--39,
--30,
--29,
--25,
--20,
--5,
-3,
-16,
-33,
-49,
-68,
-79,
-81,
-84,
-77,
-70,
-58,
-41,
-26,
-9,
--1,
--16,
--30,
--39,
--49,
--53,
--50,
--52,
--51,
--46,
--40,
--41,
--36,
--33,
--27,
--18,
--10,
-3,
-9,
-9,
-16,
-13,
-14,
-10,
-14,
-14,
-11,
-7,
-10,
-21,
-23,
-19,
-16,
-12,
-7,
-2,
-3,
-7,
-8,
-7,
-10,
-10,
-15,
-14,
-6,
-2,
--5,
--1,
--4,
--3,
--3,
--3,
-1,
--1,
--2,
--3,
--12,
--16,
--18,
--12,
--11,
--10,
--6,
--3,
--12,
--19,
--19,
--23,
--24,
--22,
--22,
--34,
--39,
--33,
--31,
--18,
--2,
-21,
-51,
-69,
-82,
-92,
-87,
-86,
-77,
-61,
-42,
-19,
-0,
--11,
--21,
--33,
--43,
--46,
--50,
--54,
--59,
--53,
--47,
--42,
--34,
--26,
--16,
--10,
--1,
-0,
--2,
--1,
-9,
-10,
-15,
-22,
-27,
-16,
-3,
-7,
-2,
-11,
-16,
-15,
-16,
-11,
-10,
-4,
-3,
-8,
-4,
-10,
-6,
-6,
-8,
-3,
-0,
--1,
-2,
--1,
--2,
--4,
--4,
--3,
-0,
--3,
--6,
--7,
--8,
--13,
--15,
--13,
--12,
--14,
--12,
--15,
--17,
--24,
--32,
--36,
--41,
--40,
--26,
--12,
-7,
-25,
-41,
-63,
-79,
-80,
-82,
-70,
-63,
-50,
-24,
-7,
--6,
--17,
--35,
--38,
--33,
--38,
--40,
--45,
--45,
--31,
--30,
--24,
--17,
--18,
--13,
--5,
-3,
-3,
-6,
-5,
-8,
-7,
-10,
-11,
-9,
-11,
-9,
-8,
-6,
-5,
-10,
-11,
-10,
-10,
-10,
-4,
-6,
-7,
-6,
-5,
-7,
-11,
-9,
-9,
-11,
-9,
-4,
-1,
--2,
--3,
-3,
-4,
-0,
--6,
--13,
--15,
--22,
--26,
--25,
--25,
--19,
--18,
--22,
--27,
--28,
--35,
--36,
--35,
--19,
--1,
-21,
-39,
-64,
-69,
-73,
-70,
-64,
-47,
-34,
-15,
-1,
--13,
--16,
--31,
--30,
--39,
--32,
--29,
--17,
--19,
--21,
--17,
--3,
--16,
--7,
--8,
-3,
--2,
-4,
--4,
-0,
--12,
-0,
-6,
-5,
-0,
-7,
-4,
-9,
-0,
-17,
-6,
-8,
-7,
-12,
-8,
-17,
-2,
-5,
-1,
-6,
-5,
-7,
-5,
-6,
--2,
--3,
--3,
-0,
--11,
-0,
-1,
-0,
--6,
--9,
--18,
--6,
--8,
--9,
--14,
--4,
--14,
--19,
--29,
--28,
--29,
--23,
--22,
--7,
-3,
-25,
-39,
-59,
-66,
-68,
-59,
-51,
-30,
-16,
--2,
--14,
--25,
--26,
--40,
--24,
--25,
--12,
--16,
--13,
--17,
--10,
--21,
--10,
--14,
--1,
--9,
-3,
-0,
-1,
--8,
-5,
--8,
--2,
--3,
-14,
-6,
-17,
-1,
-11,
-5,
-4,
--10,
-15,
-3,
-12,
-7,
-14,
-8,
-15,
-2,
-8,
--4,
-9,
-0,
-5,
--5,
-8,
--6,
-0,
--6,
-0,
--15,
--10,
--23,
--15,
--15,
--6,
--20,
--12,
--20,
--17,
--27,
--18,
--14,
-7,
-13,
-32,
-42,
-56,
-43,
-45,
-34,
-26,
-10,
--2,
--14,
--10,
--25,
--21,
--22,
--12,
--18,
--11,
--9,
--17,
--12,
--7,
--15,
--1,
-0,
--1,
--1,
-1,
--12,
--8,
-2,
-8,
-12,
-7,
-9,
-4,
-4,
-3,
-7,
-4,
-12,
-6,
-10,
-15,
-15,
-3,
--3,
--5,
-3,
-6,
-6,
-0,
-1,
--4,
--3,
--9,
--13,
--10,
--9,
--9,
--4,
--9,
--12,
--20,
--23,
--26,
--27,
--26,
--12,
-2,
-19,
-38,
-45,
-48,
-54,
-44,
-26,
-15,
-6,
--5,
--10,
--17,
--21,
--18,
--18,
--21,
--16,
--12,
--14,
--9,
--9,
--16,
--7,
-3,
-2,
-0,
-1,
--3,
-9,
-12,
-1,
--3,
-0,
-3,
-16,
-10,
-8,
-10,
-13,
-4,
-2,
-7,
-15,
-5,
-5,
-3,
-1,
--6,
-1,
--4,
--6,
--7,
--3,
--20,
--7,
--17,
--12,
--18,
--14,
--21,
--25,
--34,
--20,
--22,
--2,
-18,
-44,
-52,
-70,
-50,
-47,
-22,
-4,
--6,
--12,
--21,
--17,
--20,
--10,
--18,
--16,
--15,
--10,
--11,
--9,
--5,
-0,
--8,
--2,
-0,
--4,
--3,
--1,
-4,
-7,
-13,
-12,
-8,
-0,
-7,
-5,
-10,
-5,
-9,
-9,
-6,
--9,
--1,
-0,
-7,
--1,
-7,
--5,
-0,
--18,
--14,
--14,
-2,
--2,
--9,
--34,
--27,
--34,
--18,
--22,
-4,
-9,
-47,
-47,
-67,
-53,
-50,
-20,
-11,
--18,
--2,
--33,
--14,
--16,
--5,
--14,
-2,
--21,
-0,
--11,
-0,
--21,
-0,
--11,
--1,
--10,
-5,
--17,
-5,
--8,
-13,
--3,
-9,
--1,
-17,
--1,
-18,
-2,
-16,
-2,
-21,
-1,
-18,
--5,
-10,
--7,
-9,
--12,
-8,
--17,
--5,
--29,
--14,
--31,
--3,
--27,
--16,
--35,
--11,
--9,
-32,
-16,
-54,
-43,
-46,
-14,
-20,
--19,
-3,
--11,
-5,
--25,
--2,
--17,
--4,
--25,
-7,
--17,
-2,
--19,
-1,
--6,
-11,
--17,
-0,
--9,
-28,
-1,
-16,
--9,
-9,
-2,
-23,
-7,
-20,
-0,
-13,
--3,
-14,
--7,
-9,
--4,
-3,
--14,
-0,
--21,
-3,
--11,
--12,
--23,
--17,
--42,
--20,
--45,
--46,
--39,
--24,
--22,
-11,
--2,
-39,
-89,
-134,
-120,
-101,
-57,
-24,
-3,
-1,
--50,
--71,
--68,
--47,
--53,
--38,
--30,
--33,
--19,
--9,
--27,
--3,
--3,
--14,
--9,
-11,
-12,
-13,
-0,
-19,
-29,
-13,
-16,
-25,
-19,
-18,
-18,
-24,
-15,
-23,
-26,
-13,
-16,
-18,
-11,
-3,
--4,
--2,
--3,
--28,
--30,
--22,
--42,
--41,
--34,
--50,
--35,
--34,
--69,
--66,
--76,
--101,
--94,
--109,
--80,
-16,
-103,
-192,
-318,
-337,
-259,
-220,
-156,
-64,
-6,
--55,
--127,
--185,
--195,
--185,
--182,
--146,
--143,
--137,
--71,
--18,
-3,
-22,
-42,
-46,
-58,
-66,
-57,
-53,
-44,
-30,
-21,
-11,
-8,
--1,
-6,
-7,
-15,
-24,
-30,
-33,
-39,
-42,
-40,
-47,
-63,
-59,
-47,
-31,
-14,
--5,
--19,
--28,
--45,
--46,
--55,
--55,
--65,
--72,
--87,
--100,
--97,
--100,
--99,
--127,
--147,
--166,
--184,
--204,
--177,
--157,
--17,
-398,
-737,
-863,
-867,
-696,
-510,
-337,
-155,
--43,
--288,
--535,
--694,
--732,
--710,
--658,
--558,
--493,
--392,
--178,
-40,
-186,
-298,
-359,
-366,
-397,
-439,
-372,
-242,
-150,
-30,
--79,
--127,
--173,
--207,
--219,
--151,
--86,
--12,
-69,
-136,
-170,
-198,
-223,
-227,
-212,
-183,
-145,
-68,
-8,
--23,
--56,
--76,
--84,
--104,
--137,
--199,
--222,
--219,
--193,
--154,
--109,
--85,
--48,
--34,
--45,
--79,
--106,
--163,
--189,
--284,
--388,
--491,
--520,
--528,
--492,
--334,
--181,
-337,
-1588,
-2517,
-2790,
-2658,
-2100,
-1398,
-804,
-193,
--514,
--1413,
--2214,
--2762,
--2872,
--2689,
--2341,
--1805,
--1254,
--671,
-197,
-1134,
-1850,
-2271,
-2443,
-2238,
-1863,
-1564,
-1131,
-361,
--457,
--1179,
--1843,
--2236,
--2234,
--2109,
--1937,
--1485,
--755,
--24,
-787,
-1557,
-2039,
-2226,
-2373,
-2324,
-1994,
-1476,
-844,
-37,
--724,
--1258,
--1640,
--1935,
--1977,
--1798,
--1435,
--968,
--344,
-216,
-675,
-1089,
-1400,
-1518,
-1429,
-1249,
-876,
-412,
--33,
--430,
--785,
--1070,
--1170,
--1277,
--1314,
--1269,
--1110,
--978,
--804,
--609,
--641,
--697,
--651,
--552,
--494,
--325,
-135,
-500,
-2215,
-5495,
-6796,
-6052,
-5042,
-3147,
-1215,
-116,
--1002,
--3144,
--5589,
--6520,
--6317,
--5735,
--4288,
--2890,
--2091,
--759,
-1408,
-3363,
-4471,
-4948,
-4826,
-3928,
-3044,
-2389,
-1098,
--649,
--2099,
--3161,
--3899,
--4013,
--3612,
--3199,
--2637,
--1418,
-9,
-1187,
-2276,
-3095,
-3361,
-3341,
-3278,
-2863,
-1960,
-1001,
-31,
--1000,
--1789,
--2155,
--2455,
--2552,
--2271,
--1698,
--1070,
--305,
-507,
-1062,
-1471,
-1806,
-1930,
-1752,
-1427,
-964,
-339,
--303,
--834,
--1274,
--1591,
--1681,
--1594,
--1359,
--1020,
--649,
--326,
--41,
-192,
-413,
-493,
-346,
--75,
--535,
--949,
--1245,
--1428,
--1321,
--980,
--317,
-2528,
-6139,
-7000,
-6364,
-5218,
-3303,
-1706,
-628,
--795,
--3546,
--5920,
--6498,
--6545,
--6103,
--4835,
--3917,
--3066,
--1293,
-1199,
-3039,
-3927,
-4666,
-4768,
-4350,
-4274,
-3789,
-2220,
-377,
--1035,
--2202,
--3198,
--3586,
--3753,
--3980,
--3515,
--2339,
--1137,
--45,
-1100,
-2067,
-2672,
-3234,
-3600,
-3294,
-2586,
-1853,
-987,
-2,
--850,
--1499,
--2112,
--2413,
--2256,
--1928,
--1532,
--945,
--262,
-366,
-972,
-1480,
-1667,
-1590,
-1400,
-1114,
-714,
-239,
--184,
--534,
--877,
--1107,
--1193,
--1275,
--1284,
--1066,
--770,
--586,
--439,
--277,
--199,
--166,
--58,
--137,
--537,
--864,
--1068,
--1254,
--1350,
--1073,
--581,
-291,
-3441,
-7266,
-8090,
-7061,
-5406,
-3345,
-1467,
-10,
--1669,
--4631,
--6887,
--6956,
--6475,
--5812,
--4678,
--3607,
--2441,
--531,
-2202,
-3894,
-4422,
-4836,
-4817,
-4194,
-3508,
-2578,
-947,
--906,
--1956,
--2704,
--3506,
--3806,
--3708,
--3506,
--2837,
--1548,
--261,
-710,
-1659,
-2504,
-2934,
-3179,
-3249,
-2844,
-2061,
-1358,
-616,
--247,
--975,
--1414,
--1790,
--1969,
--1781,
--1391,
--1000,
--548,
-140,
-701,
-1053,
-1344,
-1397,
-1199,
-923,
-652,
-241,
--257,
--572,
--828,
--1058,
--1161,
--1162,
--1141,
--996,
--631,
--296,
--10,
-279,
-423,
-307,
-137,
--64,
--363,
--676,
--897,
--1239,
--1631,
--1853,
--1864,
--1797,
--1355,
--681,
-342,
-2668,
-6898,
-9692,
-9193,
-7285,
-4881,
-2444,
-230,
--1644,
--4223,
--7340,
--8228,
--7415,
--6573,
--5662,
--4441,
--2955,
--1304,
-1388,
-3742,
-4299,
-4524,
-4932,
-4858,
-4111,
-3152,
-1788,
--254,
--1512,
--2051,
--2934,
--3781,
--3890,
--3579,
--3057,
--1982,
--708,
--11,
-683,
-1632,
-2286,
-2472,
-2621,
-2660,
-2229,
-1872,
-1752,
-1188,
-366,
--264,
--774,
--1311,
--1553,
--1552,
--1748,
--1830,
--1453,
--964,
--523,
--8,
-474,
-765,
-1050,
-1356,
-1343,
-1042,
-833,
-623,
-350,
-90,
--155,
--527,
--898,
--1037,
--1049,
--1037,
--957,
--808,
--603,
--439,
--291,
--303,
--458,
--601,
--511,
--491,
--695,
--960,
--1106,
--1124,
--1013,
--616,
--129,
-1213,
-5183,
-8228,
-7688,
-5918,
-3998,
-2165,
-464,
--1063,
--2909,
--5096,
--5447,
--4841,
--4942,
--5007,
--4437,
--3402,
--1980,
--204,
-1295,
-1952,
-2731,
-3668,
-3893,
-3588,
-3107,
-2463,
-1659,
-952,
-248,
--785,
--1655,
--2032,
--2130,
--2199,
--2108,
--1876,
--1482,
--1012,
--360,
-102,
-458,
-793,
-1145,
-1295,
-1284,
-1138,
-1002,
-843,
-739,
-622,
-451,
-377,
-481,
-375,
-155,
--17,
--117,
--238,
--274,
--402,
--593,
--772,
--748,
--776,
--836,
--809,
--643,
--500,
--319,
--144,
-7,
-123,
-323,
-472,
-579,
-574,
-458,
-214,
--122,
--464,
--744,
--859,
--976,
--1160,
--1370,
--1517,
--1518,
--1444,
--982,
--524,
-1029,
-4637,
-6859,
-5961,
-4565,
-3378,
-2129,
-1090,
--15,
--1187,
--2183,
--2343,
--2444,
--3464,
--4397,
--4442,
--4000,
--3218,
--2264,
--1375,
--581,
-369,
-1273,
-1793,
-2064,
-2506,
-2839,
-2890,
-2653,
-2186,
-1589,
-1011,
-404,
--166,
--700,
--1027,
--1311,
--1499,
--1686,
--1744,
--1678,
--1455,
--1118,
--694,
--282,
-102,
-418,
-670,
-812,
-971,
-1153,
-1304,
-1331,
-1250,
-1065,
-836,
-544,
-266,
--3,
--156,
--180,
--268,
--519,
--707,
--805,
--809,
--840,
--840,
--795,
--698,
--521,
--314,
--146,
--32,
-10,
-49,
--12,
--107,
--245,
--376,
--365,
--344,
--348,
--490,
--668,
--736,
--795,
--556,
--286,
-348,
-2825,
-5387,
-5002,
-3315,
-2393,
-1505,
-702,
-211,
--402,
--751,
--684,
--948,
--2080,
--3432,
--3953,
--3680,
--3103,
--2450,
--1818,
--1127,
--419,
--9,
-145,
-370,
-965,
-1734,
-2356,
-2572,
-2423,
-2145,
-1741,
-1238,
-753,
-441,
-293,
-89,
--239,
--724,
--1212,
--1515,
--1602,
--1528,
--1360,
--1120,
--814,
--541,
--344,
--138,
-109,
-394,
-709,
-981,
-1141,
-1192,
-1141,
-1008,
-851,
-720,
-599,
-454,
-287,
-95,
--114,
--311,
--473,
--583,
--621,
--636,
--712,
--775,
--779,
--784,
--771,
--761,
--763,
--783,
--811,
--779,
--618,
--374,
--158,
--116,
--126,
--142,
--180,
--17,
-183,
-843,
-2996,
-4968,
-4288,
-2646,
-1929,
-1208,
-464,
-249,
-54,
-97,
-424,
--99,
--1685,
--3049,
--3497,
--3422,
--3049,
--2480,
--1883,
--1313,
--971,
--995,
--1134,
--862,
--44,
-911,
-1655,
-2068,
-2191,
-2109,
-1843,
-1522,
-1281,
-1239,
-1303,
-1226,
-867,
-312,
--232,
--667,
--949,
--1075,
--1019,
--885,
--784,
--781,
--840,
--844,
--719,
--468,
--182,
-102,
-358,
-515,
-586,
-572,
-552,
-521,
-510,
-525,
-508,
-444,
-316,
-152,
--43,
--233,
--378,
--474,
--520,
--567,
--643,
--757,
--884,
--985,
--1056,
--1022,
--850,
--637,
--464,
--411,
--391,
--371,
--257,
-90,
-368,
-1460,
-3843,
-4975,
-3682,
-2294,
-1470,
-670,
-290,
-146,
--168,
--205,
--298,
--1151,
--2520,
--3381,
--3395,
--2867,
--2241,
--1657,
--1224,
--844,
--576,
--415,
--281,
-229,
-991,
-1680,
-2012,
-2055,
-1855,
-1640,
-1354,
-1090,
-820,
-679,
-499,
-236,
--195,
--618,
--944,
--1077,
--1123,
--1024,
--908,
--695,
--525,
--369,
--278,
--117,
-80,
-334,
-530,
-688,
-723,
-751,
-652,
-579,
-443,
-379,
-294,
-223,
-63,
--111,
--338,
--485,
--601,
--615,
--630,
--594,
--629,
--644,
--725,
--794,
--872,
--788,
--650,
--486,
--471,
--540,
--571,
--526,
--364,
--37,
-309,
-1862,
-4190,
-4600,
-3152,
-2067,
-1274,
-715,
-616,
-523,
-145,
--155,
--547,
--1396,
--2551,
--3151,
--3128,
--2715,
--2181,
--1744,
--1572,
--1324,
--954,
--541,
--102,
-497,
-1104,
-1662,
-1956,
-2016,
-1834,
-1620,
-1420,
-1287,
-1066,
-814,
-492,
-208,
--116,
--426,
--722,
--859,
--916,
--843,
--804,
--724,
--686,
--553,
--410,
--212,
--34,
-169,
-325,
-453,
-488,
-492,
-437,
-464,
-415,
-396,
-282,
-183,
-3,
--131,
--280,
--386,
--526,
--568,
--646,
--701,
--839,
--898,
--980,
--910,
--809,
--687,
--610,
--516,
--430,
--315,
--150,
-167,
-562,
-2306,
-4506,
-4563,
-3127,
-2021,
-1106,
-548,
-416,
-226,
--298,
--721,
--1105,
--1838,
--2796,
--3160,
--2969,
--2491,
--1878,
--1259,
--868,
--516,
--136,
-260,
-592,
-1021,
-1463,
-1763,
-1817,
-1633,
-1225,
-923,
-715,
-559,
-317,
-100,
--186,
--453,
--747,
--894,
--966,
--885,
--728,
--518,
--383,
--221,
--79,
-98,
-282,
-440,
-522,
-588,
-604,
-577,
-468,
-399,
-310,
-258,
-162,
-39,
--141,
--279,
--357,
--398,
--430,
--458,
--513,
--578,
--673,
--753,
--848,
--811,
--683,
--575,
--540,
--541,
--543,
--532,
--355,
--14,
-501,
-2415,
-4789,
-4874,
-3247,
-1809,
-813,
-340,
-298,
-5,
--896,
--1698,
--2031,
--2557,
--3148,
--3246,
--2873,
--2215,
--1395,
--706,
--313,
-16,
-617,
-1239,
-1719,
-2007,
-2086,
-1953,
-1662,
-1308,
-898,
-448,
-0,
--343,
--637,
--864,
--1045,
--1159,
--1080,
--895,
--587,
--272,
-58,
-315,
-587,
-663,
-658,
-714,
-798,
-799,
-685,
-474,
-191,
--66,
--284,
--456,
--592,
--671,
--709,
--692,
--605,
--521,
--430,
--361,
--321,
--307,
--343,
--402,
--452,
--385,
--431,
--538,
--653,
--767,
--798,
--722,
--333,
-74,
-2319,
-6417,
-7237,
-4578,
-1893,
-80,
--534,
--305,
--518,
--2023,
--3525,
--3760,
--3773,
--3936,
--3578,
--2753,
--1490,
-63,
-1233,
-1601,
-1711,
-2132,
-2565,
-2695,
-2518,
-1948,
-1219,
-528,
--152,
--810,
--1410,
--1721,
--1920,
--1947,
--1724,
--1397,
--867,
--186,
-379,
-817,
-1180,
-1475,
-1649,
-1664,
-1540,
-1277,
-916,
-479,
-9,
--409,
--756,
--979,
--1131,
--1198,
--1176,
--971,
--620,
--254,
-26,
-163,
-125,
-128,
-93,
--31,
--292,
--478,
--635,
--953,
--1380,
--1583,
--1644,
--1419,
--1152,
--399,
-251,
-4499,
-10959,
-10640,
-5605,
-940,
--1797,
--1900,
--912,
--1437,
--4530,
--6791,
--6083,
--4884,
--3823,
--2752,
--1802,
--493,
-1411,
-3196,
-3629,
-3332,
-3298,
-3084,
-2571,
-1731,
-518,
--743,
--1456,
--1563,
--1716,
--1912,
--1821,
--1440,
--688,
-139,
-720,
-993,
-1170,
-1393,
-1542,
-1498,
-1215,
-727,
-218,
--303,
--680,
--897,
--986,
--982,
--935,
--801,
--570,
--336,
--50,
-215,
-398,
-461,
-412,
-177,
--178,
--514,
--799,
--1120,
--1238,
--1446,
--1914,
--2206,
--2069,
--1724,
--1218,
--675,
-403,
-1587,
-10391,
-17960,
-12996,
-4106,
--3204,
--5756,
--3983,
--2049,
--4025,
--10017,
--11376,
--7444,
--3275,
--60,
-751,
-750,
-1933,
-5097,
-7442,
-6069,
-3469,
-1246,
-87,
-103,
--526,
--2235,
--4086,
--4202,
--2776,
--1238,
--34,
-354,
-956,
-2050,
-2908,
-3065,
-2242,
-1311,
-557,
--49,
--425,
--1171,
--1757,
--1790,
--1290,
--594,
--357,
--284,
--212,
-122,
-809,
-1042,
-818,
-168,
--69,
-474,
-421,
--452,
--1605,
--2380,
--2274,
--1574,
--1230,
--2216,
--2752,
--2511,
--1407,
--640,
-312,
-676,
-4389,
-19943,
-23784,
-11922,
--2128,
--11491,
--10505,
--5286,
--2405,
--8670,
--16588,
--12890,
--4652,
-2789,
-5901,
-4161,
-3109,
-5802,
-10495,
-9957,
-4443,
--427,
--3507,
--3885,
--3529,
--4689,
--6813,
--7109,
--4011,
--349,
-1936,
-2980,
-3045,
-3496,
-4643,
-5230,
-4065,
-1849,
--118,
--1173,
--1445,
--2042,
--2893,
--3375,
--2894,
--1254,
-274,
-1038,
-1307,
-2290,
-2781,
-2132,
-1267,
-106,
--630,
--884,
--1637,
--2480,
--3193,
--3014,
--2220,
--1334,
--981,
--1771,
--2146,
--1551,
--431,
-200,
-527,
-742,
-3176,
-17053,
-21910,
-10382,
--1289,
--7789,
--6810,
--3716,
--4452,
--11521,
--16921,
--10358,
--1918,
-2356,
-3087,
-1882,
-3618,
-8258,
-11358,
-8237,
-2385,
--273,
--1011,
--759,
--2180,
--5560,
--7378,
--5592,
--2185,
--744,
--524,
-8,
-1316,
-3802,
-5109,
-4298,
-2707,
-1756,
-1418,
-649,
--450,
--1740,
--2189,
--1271,
--1100,
--1679,
--1844,
--1360,
--592,
--325,
--144,
-133,
-745,
-1554,
-1549,
-852,
-513,
-308,
--135,
--795,
--1430,
--1921,
--2655,
--3667,
--3859,
--3421,
--2082,
--855,
-743,
-1367,
-11088,
-21800,
-14144,
-3001,
--2687,
--3697,
--1984,
--3637,
--10176,
--15992,
--11894,
--4093,
--1757,
--1223,
--662,
-2685,
-8279,
-10945,
-8109,
-3635,
-2661,
-2783,
-892,
--2400,
--6211,
--7154,
--4982,
--2746,
--2283,
--2438,
--971,
-1750,
-3884,
-4493,
-3457,
-2951,
-3329,
-2881,
-1281,
--590,
--1789,
--2085,
--2185,
--2296,
--2621,
--2183,
--1219,
--538,
--59,
-510,
-1243,
-1925,
-1929,
-1515,
-982,
-511,
--433,
--1173,
--1845,
--2172,
--2228,
--2871,
--3663,
--3279,
--2056,
--670,
-256,
-1334,
-2850,
-15158,
-19429,
-7039,
--384,
--1970,
--1342,
--1607,
--6796,
--13500,
--14145,
--6652,
--2427,
--3188,
--2202,
-996,
-6164,
-9815,
-8518,
-5061,
-3964,
-4637,
-2691,
--1290,
--4764,
--6237,
--5122,
--3867,
--4382,
--4340,
--2171,
-954,
-2885,
-3430,
-3650,
-4302,
-5176,
-4711,
-2169,
-3,
--958,
--1485,
--2344,
--3327,
--3815,
--3159,
--1939,
--888,
--331,
-405,
-1484,
-2494,
-2693,
-2133,
-1396,
-838,
--47,
--874,
--1956,
--2849,
--2975,
--3277,
--3840,
--3478,
--2275,
--834,
-246,
-1425,
-2537,
-15180,
-18376,
-5188,
-410,
-802,
-554,
--1236,
--7656,
--13700,
--12256,
--5313,
--3930,
--5878,
--3184,
-1356,
-6062,
-8660,
-6908,
-5229,
-6261,
-6295,
-2669,
--1615,
--3864,
--4683,
--4685,
--5191,
--6164,
--4786,
--1257,
-803,
-1647,
-2717,
-4277,
-5751,
-5444,
-3534,
-1693,
-788,
-240,
--1209,
--2868,
--3856,
--3683,
--2945,
--2398,
--2127,
--1237,
-221,
-1625,
-2252,
-2363,
-2177,
-2139,
-1646,
-747,
--682,
--1592,
--1973,
--2640,
--4154,
--4457,
--3691,
--2213,
--1609,
-358,
-9,
-8796,
-19973,
-8801,
-323,
-3725,
-4003,
-1287,
--4158,
--11215,
--12123,
--6560,
--4893,
--8680,
--7000,
--1262,
-2843,
-5584,
-5846,
-5210,
-7061,
-8286,
-5502,
-1735,
-34,
--1179,
--2711,
--4369,
--6004,
--5869,
--4326,
--3324,
--2591,
--387,
-2387,
-3383,
-4066,
-4520,
-4303,
-4319,
-3839,
-1928,
--212,
--929,
--1713,
--3166,
--3950,
--4068,
--3727,
--2636,
--1732,
--858,
-429,
-1712,
-2271,
-2567,
-2489,
-2242,
-1508,
-525,
--534,
--1480,
--3190,
--4176,
--4399,
--3711,
--3319,
--1318,
--1529,
-5824,
-18263,
-8980,
-1129,
-6565,
-5402,
-1529,
--2393,
--8897,
--9751,
--5403,
--5862,
--10492,
--7777,
--1518,
-366,
-2076,
-3696,
-4427,
-7644,
-8718,
-5220,
-2988,
-3238,
-1518,
--1549,
--3359,
--4583,
--5273,
--4773,
--4814,
--4600,
--2655,
--692,
-471,
-2320,
-4827,
-5642,
-5031,
-4951,
-4328,
-3095,
-1691,
--433,
--2141,
--2810,
--3720,
--4751,
--4605,
--3658,
--2743,
--1551,
--321,
-614,
-1792,
-2448,
-2382,
-2240,
-1606,
-743,
-87,
--1379,
--3091,
--3718,
--3446,
--3437,
--2448,
--1598,
-213,
-13754,
-13943,
-1573,
-6057,
-9324,
-2801,
--23,
--4927,
--8617,
--5726,
--5704,
--11215,
--10704,
--3695,
--2220,
--2605,
-1165,
-3401,
-5816,
-8504,
-6316,
-4585,
-6307,
-4747,
-594,
--1023,
--1896,
--3709,
--4527,
--5028,
--5585,
--4224,
--2220,
--1274,
-293,
-1942,
-2965,
-3680,
-4734,
-4718,
-3363,
-2892,
-2290,
-475,
--716,
--1845,
--2946,
--3263,
--3337,
--3567,
--3026,
--1758,
--982,
--436,
-702,
-1028,
-1410,
-1741,
-899,
-309,
-291,
--996,
--2445,
--3047,
--2952,
--3078,
--1523,
--2030,
-2577,
-15559,
-9454,
-1329,
-10378,
-8861,
-812,
--178,
--5162,
--7416,
--4607,
--8367,
--13138,
--8360,
--2930,
--5048,
--4060,
-1923,
-3453,
-5460,
-7466,
-5185,
-6214,
-8049,
-3818,
-813,
-1270,
--554,
--3504,
--4259,
--4876,
--4876,
--3386,
--3386,
--3113,
--156,
-1431,
-1404,
-2648,
-3661,
-3690,
-3786,
-3546,
-2712,
-1647,
-1033,
--233,
--1897,
--2276,
--2634,
--3387,
--2877,
--2404,
--2222,
--1388,
--525,
--72,
-513,
-771,
-515,
-361,
-372,
--1054,
--2250,
--2155,
--2433,
--2983,
--1100,
--1463,
-1833,
-14674,
-9493,
-994,
-11938,
-10503,
--113,
-849,
--2621,
--6603,
--4210,
--8873,
--13590,
--7446,
--3923,
--8350,
--5775,
-1855,
-2051,
-2889,
-6569,
-5468,
-6885,
-9044,
-3845,
-1981,
-4585,
-840,
--3160,
--2258,
--3339,
--4931,
--3915,
--4280,
--4171,
--1115,
--336,
--844,
-1792,
-3382,
-2470,
-3089,
-3456,
-2413,
-2294,
-1580,
--213,
--464,
--689,
--2154,
--2373,
--1735,
--1924,
--1759,
--1042,
--263,
--271,
--470,
-311,
-122,
--736,
--585,
--908,
--1820,
--2145,
--2413,
--2727,
--1706,
--627,
--619,
-4874,
-12214,
-7923,
-4151,
-10217,
-8801,
-1832,
--249,
--2252,
--3941,
--5356,
--8809,
--10597,
--8087,
--4985,
--7232,
--7340,
--455,
-1766,
-511,
-3545,
-5644,
-6035,
-7060,
-5689,
-3666,
-4528,
-4075,
--346,
--2183,
--702,
--2923,
--5332,
--3956,
--3938,
--3891,
--1722,
--1618,
--1007,
-2233,
-3124,
-2092,
-3473,
-4677,
-3158,
-2354,
-2344,
-896,
-13,
--353,
--1920,
--2500,
--1876,
--2429,
--2904,
--1931,
--1548,
--1647,
--1143,
--884,
--587,
--356,
--508,
--603,
--570,
--880,
--1604,
--1523,
--1037,
--233,
-392,
-246,
-7721,
-12282,
-3714,
-4320,
-10768,
-5362,
--326,
--905,
--1597,
--3500,
--6473,
--8522,
--9139,
--6295,
--5259,
--8560,
--4871,
-1286,
-254,
--49,
-3842,
-6419,
-5774,
-5068,
-5505,
-4977,
-4533,
-3102,
--292,
--514,
-212,
--2991,
--5293,
--3514,
--2846,
--4594,
--4048,
--1929,
--1453,
--380,
-842,
-1019,
-2564,
-4031,
-2872,
-2666,
-4105,
-3307,
-1387,
-1469,
-1130,
--486,
--1134,
--1432,
--2295,
--2313,
--2289,
--2707,
--2354,
--1718,
--2015,
--1659,
--910,
--1114,
--1046,
--671,
--781,
--696,
--1066,
--920,
--494,
-630,
--299,
-2946,
-11838,
-6153,
-756,
-9967,
-9690,
-956,
--307,
-1845,
--422,
--4869,
--5636,
--7078,
--7135,
--4922,
--8414,
--8790,
--2391,
--1148,
--3767,
--1233,
-4544,
-4553,
-2606,
-5319,
-6810,
-5740,
-4969,
-3580,
-2641,
-2352,
-620,
--2410,
--2839,
--1672,
--3703,
--5513,
--3556,
--2440,
--3208,
--2349,
--432,
-345,
-1085,
-2191,
-2337,
-2745,
-3717,
-2847,
-1849,
-2422,
-2079,
-335,
--214,
--200,
--1094,
--1711,
--1872,
--2344,
--2092,
--1723,
--2328,
--2458,
--1317,
--1102,
--1879,
--1257,
--123,
--629,
--738,
--453,
--109,
-594,
-1436,
-277,
-2464,
-11940,
-6632,
--1004,
-8264,
-10307,
-345,
--2750,
-2361,
-611,
--7160,
--6461,
--5327,
--7288,
--6340,
--7520,
--7649,
--3079,
--742,
--3018,
--1572,
-5171,
-5207,
-1733,
-5350,
-8233,
-5364,
-3687,
-4600,
-3696,
-1606,
-583,
--1252,
--2373,
--1724,
--3315,
--5337,
--3644,
--2214,
--3828,
--3650,
--742,
-30,
--493,
-992,
-2447,
-2577,
-2805,
-3105,
-2993,
-3033,
-2781,
-1472,
-929,
-1016,
--326,
--1571,
--1491,
--1549,
--2321,
--2736,
--2195,
--1921,
--2231,
--2236,
--1424,
--1151,
--1565,
--1131,
--567,
--966,
--660,
--647,
--512,
-129,
-1163,
--39,
-2185,
-9519,
-3970,
-1406,
-8300,
-7218,
-904,
-922,
-4135,
--220,
--3955,
--2012,
--3738,
--5164,
--4935,
--5977,
--5533,
--3731,
--3711,
--4401,
--1222,
-1074,
--614,
-576,
-3421,
-3648,
-2696,
-3423,
-4231,
-3550,
-2987,
-2061,
-1263,
-1521,
-290,
--1497,
--1411,
--887,
--2235,
--3156,
--2033,
--1655,
--2231,
--1780,
--914,
--406,
--37,
-398,
-721,
-1364,
-1844,
-1608,
-1558,
-1991,
-1915,
-1263,
-920,
-1012,
-455,
--182,
--375,
--600,
--1079,
--1270,
--1304,
--1347,
--1242,
--1019,
--991,
--693,
--437,
--596,
--480,
-54,
--152,
--430,
--113,
-13,
--468,
--500,
--521,
--375,
--321,
-46,
--615,
-1857,
-5276,
-1047,
-1304,
-5364,
-3720,
-427,
-969,
-2866,
-60,
--1980,
--856,
--1994,
--2713,
--2620,
--3138,
--3432,
--2515,
--1677,
--2598,
--1889,
-111,
-16,
--190,
-914,
-1912,
-1649,
-1546,
-2185,
-1917,
-1525,
-1621,
-1180,
-585,
-440,
-444,
--330,
--841,
--637,
--867,
--1331,
--1271,
--1064,
--1109,
--1007,
--648,
--539,
--378,
-38,
-310,
-399,
-644,
-932,
-1043,
-1017,
-1087,
-1034,
-896,
-724,
-493,
-249,
-71,
--7,
--260,
--565,
--549,
--526,
--607,
--669,
--547,
--426,
--399,
--283,
--164,
--120,
--9,
-41,
-53,
--42,
--73,
--112,
--179,
--342,
--426,
--469,
--497,
--554,
--574,
--701,
--484,
--266,
--66,
--354,
-757,
-2832,
-1417,
-142,
-2007,
-3958,
-2079,
-28,
-1105,
-1712,
-464,
--647,
--819,
--992,
--1518,
--1511,
--1828,
--2259,
--1935,
--1445,
--1378,
--1419,
--869,
--216,
--39,
-212,
-606,
-932,
-966,
-1093,
-1317,
-1159,
-923,
-869,
-781,
-471,
-155,
-48,
--163,
--431,
--536,
--624,
--717,
--739,
--679,
--574,
--466,
--297,
--136,
-0,
-162,
-282,
-383,
-443,
-478,
-521,
-500,
-418,
-335,
-257,
-194,
-91,
-7,
--59,
--114,
--170,
--186,
--240,
--312,
--257,
--154,
--145,
--165,
--121,
--32,
--7,
-24,
-81,
-90,
-89,
-174,
-205,
-111,
-67,
-89,
-81,
--9,
--51,
--70,
--155,
--284,
--278,
--327,
--429,
--396,
--341,
--381,
--430,
--352,
--310,
--272,
--204,
--85,
--150,
-80,
-662,
-335,
--1,
-222,
-524,
-319,
-344,
-1942,
-1990,
-525,
-363,
-1053,
-1318,
-421,
-50,
-91,
--476,
--747,
--661,
--791,
--1278,
--1465,
--1063,
--965,
--1033,
--768,
--502,
--304,
--172,
-154,
-401,
-463,
-596,
-731,
-746,
-683,
-622,
-562,
-404,
-269,
-151,
--16,
--163,
--270,
--338,
--409,
--413,
--369,
--398,
--358,
--250,
--188,
--222,
--97,
-60,
-158,
-174,
-248,
-307,
-329,
-325,
-354,
-295,
-217,
-162,
-154,
-78,
-0,
--66,
--86,
--97,
--93,
--119,
--104,
--35,
--4,
--11,
--6,
--69,
--43,
-38,
-41,
--7,
--37,
-0,
--13,
--85,
--68,
--68,
--80,
--107,
--81,
--82,
--74,
--86,
--66,
--92,
--61,
--61,
--33,
--59,
--71,
--122,
--126,
--181,
--217,
--254,
--236,
--270,
--342,
--315,
--291,
--285,
--153,
--35,
-78,
-89,
-1837,
-2562,
-831,
-424,
-1316,
-1760,
-754,
--120,
-26,
--317,
--593,
--716,
--1095,
--1379,
--1373,
--1018,
--1002,
--1129,
--762,
--415,
--179,
--2,
-243,
-478,
-604,
-784,
-838,
-751,
-682,
-608,
-504,
-280,
-35,
--118,
--205,
--323,
--476,
--579,
--561,
--566,
--544,
--427,
--292,
--179,
--49,
-98,
-231,
-332,
-430,
-482,
-485,
-478,
-442,
-392,
-283,
-178,
-82,
-18,
--77,
--143,
--208,
--211,
--224,
--225,
--227,
--167,
--112,
--45,
--15,
-50,
-114,
-161,
-178,
-204,
-219,
-205,
-162,
-106,
-66,
--23,
--155,
--194,
--192,
--254,
--307,
--314,
--257,
--247,
--184,
--157,
--118,
--48,
-35,
-34,
-9,
-0,
-53,
--15,
--101,
--126,
--139,
--229,
--321,
--431,
--343,
--225,
--136,
--203,
-155,
-2249,
-2043,
-292,
-680,
-1780,
-1723,
-370,
--146,
-104,
--212,
--411,
--968,
--1471,
--1388,
--1103,
--1045,
--1383,
--1195,
--536,
--254,
--126,
--31,
-344,
-710,
-860,
-881,
-800,
-822,
-866,
-599,
-316,
-112,
-0,
--205,
--447,
--592,
--660,
--669,
--626,
--625,
--510,
--331,
--112,
-20,
-154,
-307,
-459,
-557,
-569,
-515,
-492,
-464,
-383,
-189,
-70,
-5,
--88,
--218,
--281,
--289,
--290,
--312,
--254,
--188,
--103,
--18,
-89,
-160,
-201,
-248,
-324,
-334,
-307,
-255,
-201,
-125,
-47,
--41,
--146,
--175,
--214,
--290,
--298,
--398,
--399,
--262,
--234,
--263,
--198,
--20,
-69,
-41,
-17,
-59,
-80,
-37,
--109,
--163,
--139,
--217,
--396,
--489,
--464,
--241,
--223,
--132,
--266,
-1765,
-2822,
-428,
-325,
-1911,
-2224,
-731,
--466,
-58,
-90,
--363,
--1061,
--1848,
--1478,
--1048,
--1188,
--1626,
--1425,
--500,
--126,
--120,
-29,
-427,
-983,
-1016,
-846,
-890,
-1003,
-968,
-621,
-321,
-168,
-11,
--203,
--507,
--673,
--695,
--714,
--741,
--820,
--670,
--416,
--267,
--153,
-14,
-262,
-468,
-551,
-629,
-658,
-705,
-676,
-571,
-452,
-333,
-200,
-49,
--106,
--193,
--336,
--439,
--444,
--440,
--429,
--382,
--296,
--193,
--87,
-17,
-78,
-148,
-237,
-288,
-278,
-282,
-280,
-243,
-162,
-95,
-67,
-6,
--62,
--121,
--174,
--228,
--261,
--278,
--309,
--330,
--301,
--278,
--304,
--342,
--329,
--283,
--302,
--329,
--278,
--238,
--245,
--244,
--269,
--78,
-41,
-242,
-97,
-1291,
-2890,
-1483,
-993,
-1982,
-2135,
-1016,
-98,
-475,
-68,
--777,
--1112,
--1511,
--1531,
--1717,
--1782,
--1761,
--1558,
--1042,
--930,
--723,
--176,
-262,
-536,
-698,
-1069,
-1263,
-1231,
-1250,
-1085,
-901,
-696,
-423,
-113,
--206,
--382,
--622,
--836,
--909,
--938,
--898,
--852,
--708,
--503,
--323,
--82,
-121,
-340,
-520,
-672,
-780,
-820,
-838,
-808,
-714,
-614,
-452,
-309,
-124,
--30,
--158,
--280,
--378,
--437,
--465,
--459,
--439,
--386,
--330,
--247,
--164,
--94,
--30,
-20,
-75,
-97,
-72,
-38,
-66,
-56,
-10,
-7,
-24,
--3,
--44,
--31,
-2,
--17,
--43,
--11,
--33,
--65,
--125,
--208,
--261,
--399,
--523,
--590,
--648,
--749,
--865,
--727,
--583,
--399,
--359,
-937,
-2246,
-1545,
-1816,
-2823,
-2789,
-1815,
-1425,
-1819,
-907,
-22,
--344,
--736,
--1228,
--1916,
--2187,
--2283,
--2317,
--2281,
--2329,
--1779,
--1327,
--1049,
--609,
--9,
-603,
-799,
-1139,
-1566,
-1672,
-1679,
-1543,
-1538,
-1309,
-954,
-658,
-360,
-66,
--293,
--625,
--752,
--945,
--1055,
--1136,
--1060,
--938,
--895,
--698,
--484,
--262,
--79,
-125,
-365,
-533,
-654,
-779,
-859,
-933,
-880,
-852,
-803,
-690,
-555,
-394,
-291,
-92,
--95,
--230,
--373,
--524,
--625,
--691,
--729,
--764,
--719,
--680,
--583,
--469,
--351,
--222,
--73,
-79,
-170,
-274,
-392,
-423,
-419,
-417,
-393,
-254,
-117,
--36,
--207,
--402,
--607,
--734,
--940,
--1034,
--1216,
--1324,
--1241,
--1034,
--923,
--557,
-1060,
-1737,
-1615,
-2842,
-3811,
-3578,
-2905,
-3300,
-3178,
-1690,
-955,
-455,
--292,
--1483,
--2319,
--2502,
--3018,
--3353,
--3562,
--3301,
--2792,
--2659,
--2195,
--1426,
--640,
--142,
-273,
-1167,
-1653,
-1841,
-2078,
-2310,
-2408,
-2044,
-1855,
-1622,
-1205,
-717,
-206,
--131,
--533,
--952,
--1217,
--1401,
--1429,
--1527,
--1467,
--1251,
--1021,
--781,
--507,
--138,
-199,
-419,
-710,
-910,
-1082,
-1144,
-1180,
-1166,
-1090,
-978,
-809,
-614,
-444,
-219,
-4,
--204,
--352,
--515,
--653,
--746,
--776,
--825,
--810,
--804,
--699,
--617,
--494,
--373,
--190,
--34,
-102,
-214,
-357,
-438,
-477,
-469,
-458,
-394,
-225,
-28,
--148,
--353,
--602,
--785,
--934,
--1033,
--1142,
--1203,
--1058,
--874,
--612,
--427,
-838,
-1786,
-1645,
-2459,
-3425,
-3408,
-2808,
-2738,
-2832,
-1691,
-673,
-137,
--499,
--1435,
--2395,
--2637,
--2831,
--3168,
--3261,
--2988,
--2361,
--2064,
--1671,
--864,
--100,
-419,
-790,
-1411,
-1924,
-1941,
-1943,
-2017,
-1964,
-1554,
-1104,
-872,
-496,
--29,
--470,
--717,
--911,
--1231,
--1365,
--1308,
--1196,
--1146,
--992,
--667,
--350,
--150,
-119,
-446,
-714,
-840,
-956,
-1107,
-1132,
-1064,
-940,
-850,
-690,
-445,
-212,
-24,
--154,
--367,
--514,
--588,
--630,
--683,
--664,
--595,
--502,
--438,
--322,
--194,
--88,
--28,
-67,
-160,
-192,
-218,
-246,
-253,
-204,
-150,
-101,
-1,
--96,
--193,
--284,
--376,
--455,
--555,
--575,
--631,
--659,
--679,
--651,
--615,
--644,
--561,
--425,
--228,
--130,
-276,
-1386,
-1613,
-1695,
-2525,
-2972,
-2674,
-2279,
-2336,
-2011,
-997,
-342,
--163,
--758,
--1590,
--2268,
--2448,
--2639,
--2927,
--2968,
--2601,
--2099,
--1895,
--1414,
--663,
--21,
-374,
-827,
-1410,
-1787,
-1850,
-1929,
-2002,
-1916,
-1555,
-1215,
-942,
-563,
-49,
--358,
--646,
--900,
--1218,
--1356,
--1331,
--1269,
--1215,
--1025,
--714,
--425,
--201,
-114,
-419,
-671,
-789,
-948,
-1040,
-1053,
-955,
-865,
-756,
-580,
-352,
-185,
-22,
--143,
--317,
--395,
--475,
--535,
--564,
--500,
--483,
--398,
--319,
--195,
--106,
--11,
-86,
-152,
-199,
-219,
-243,
-221,
-140,
-94,
-32,
--51,
--104,
--140,
--202,
--240,
--263,
--294,
--345,
--390,
--409,
--483,
--545,
--577,
--602,
--626,
--699,
--643,
--557,
--392,
--292,
-114,
-1059,
-1328,
-1501,
-2285,
-2720,
-2562,
-2319,
-2336,
-2078,
-1242,
-591,
-88,
--507,
--1320,
--2026,
--2257,
--2474,
--2759,
--2782,
--2435,
--1979,
--1679,
--1182,
--459,
-126,
-549,
-972,
-1433,
-1694,
-1699,
-1649,
-1588,
-1338,
-953,
-553,
-236,
--157,
--557,
--827,
--994,
--1099,
--1142,
--1070,
--878,
--648,
--389,
--78,
-231,
-532,
-746,
-930,
-1044,
-1084,
-1028,
-909,
-732,
-516,
-277,
-1,
--263,
--479,
--645,
--807,
--871,
--828,
--761,
--639,
--472,
--236,
--29,
-175,
-347,
-507,
-612,
-652,
-641,
-584,
-501,
-346,
-180,
-22,
--131,
--285,
--416,
--501,
--560,
--574,
--595,
--565,
--495,
--437,
--411,
--363,
--258,
--217,
--226,
--211,
--226,
--253,
--363,
--472,
--483,
--424,
--340,
--341,
-552,
-1617,
-1454,
-1874,
-2855,
-3002,
-2514,
-2085,
-2061,
-1390,
-268,
--528,
--1234,
--1750,
--2502,
--3167,
--3146,
--2930,
--2789,
--2584,
--1872,
--901,
--282,
-308,
-1085,
-1794,
-2213,
-2289,
-2307,
-2303,
-1969,
-1401,
-756,
-267,
--269,
--938,
--1423,
--1683,
--1786,
--1828,
--1744,
--1412,
--955,
--474,
--38,
-439,
-953,
-1308,
-1472,
-1559,
-1581,
-1441,
-1132,
-752,
-391,
--3,
--410,
--793,
--1044,
--1157,
--1200,
--1179,
--984,
--695,
--328,
--29,
-350,
-698,
-959,
-1087,
-1108,
-1083,
-927,
-662,
-339,
-41,
--276,
--572,
--826,
--957,
--1012,
--1024,
--912,
--762,
--514,
--289,
--55,
-187,
-332,
-428,
-429,
-397,
-275,
-14,
--231,
--469,
--727,
--1018,
--1174,
--1020,
--786,
--613,
--228,
-1364,
-2799,
-2457,
-2788,
-3873,
-3684,
-2460,
-1383,
-960,
--70,
--1527,
--2538,
--3408,
--3453,
--3426,
--3769,
--3360,
--2146,
--960,
--415,
-314,
-1728,
-2548,
-2696,
-2764,
-2677,
-2528,
-1897,
-899,
--2,
--669,
--1177,
--1992,
--2608,
--2448,
--2195,
--1980,
--1628,
--901,
-1,
-661,
-1183,
-1643,
-2036,
-2295,
-2105,
-1691,
-1346,
-916,
-309,
--359,
--841,
--1115,
--1364,
--1512,
--1455,
--1159,
--790,
--458,
--64,
-400,
-781,
-977,
-1072,
-1176,
-1113,
-902,
-624,
-333,
-67,
--243,
--501,
--741,
--848,
--834,
--819,
--831,
--736,
--485,
--307,
--216,
--73,
-114,
-244,
-355,
-353,
-266,
-237,
-286,
-158,
--288,
--453,
--492,
--814,
--1143,
--1383,
--1324,
--1111,
--815,
--615,
-442,
-3114,
-3953,
-3029,
-3919,
-4941,
-3971,
-1878,
-374,
--455,
--1974,
--3286,
--4552,
--5650,
--4570,
--3342,
--3483,
--2641,
--269,
-1946,
-2478,
-2830,
-4030,
-4214,
-3803,
-2888,
-1228,
-136,
--491,
--1700,
--3203,
--3856,
--3201,
--2821,
--2817,
--1903,
--637,
-581,
-1606,
-2167,
-2553,
-2896,
-3040,
-2593,
-1551,
-807,
-272,
--605,
--1460,
--2042,
--2202,
--2015,
--1775,
--1386,
--876,
--132,
-665,
-1150,
-1393,
-1651,
-1797,
-1694,
-1299,
-803,
-318,
--107,
--513,
--923,
--1298,
--1358,
--1289,
--1153,
--1084,
--838,
--447,
--41,
-243,
-441,
-656,
-958,
-981,
-839,
-682,
-511,
-236,
--52,
--445,
--778,
--1174,
--1308,
--1352,
--1558,
--1649,
--1547,
--1278,
--879,
--382,
-161,
-644,
-3348,
-6104,
-4816,
-3648,
-4808,
-4552,
-2078,
--784,
--2182,
--3265,
--4352,
--4702,
--5791,
--6030,
--3554,
--1612,
--1271,
--443,
-1928,
-3939,
-4107,
-4000,
-4064,
-3257,
-2711,
-1724,
--334,
--2045,
--2530,
--2818,
--3814,
--4286,
--3290,
--2251,
--1389,
--186,
-846,
-1714,
-2703,
-3331,
-3093,
-2464,
-2180,
-1666,
-523,
--508,
--1187,
--1812,
--2159,
--2176,
--2015,
--1810,
--1193,
--271,
-366,
-829,
-1396,
-1903,
-2099,
-1994,
-1626,
-1124,
-566,
-139,
--409,
--1054,
--1436,
--1468,
--1292,
--1136,
--1026,
--684,
--200,
-225,
-501,
-562,
-625,
-732,
-705,
-523,
-230,
--65,
--282,
--465,
--752,
--1154,
--1418,
--1247,
--1238,
--1499,
--1622,
--1520,
--1164,
--695,
--34,
-403,
-1638,
-5931,
-7958,
-5384,
-4240,
-4911,
-3894,
-836,
--2312,
--4068,
--5473,
--5637,
--5363,
--6650,
--6603,
--3512,
--852,
--104,
-663,
-2831,
-4675,
-5137,
-5106,
-4149,
-2660,
-2205,
-1551,
--531,
--2750,
--3254,
--2848,
--3218,
--3660,
--3123,
--2255,
--1075,
-296,
-1020,
-1242,
-1997,
-3202,
-3380,
-2502,
-1924,
-1596,
-954,
-119,
--773,
--1635,
--2079,
--1966,
--1815,
--1949,
--1750,
--932,
--103,
-443,
-899,
-1332,
-1814,
-2147,
-2079,
-1638,
-1083,
-677,
-232,
--448,
--1163,
--1623,
--1755,
--1731,
--1606,
--1448,
--1105,
--692,
--98,
-367,
-706,
-901,
-1041,
-1012,
-803,
-544,
-56,
--557,
--990,
--1031,
--1320,
--1806,
--2086,
--1988,
--1453,
--840,
--107,
-286,
-2824,
-8161,
-9177,
-5513,
-3632,
-3567,
-2327,
--794,
--3932,
--6200,
--7500,
--6227,
--4761,
--5838,
--5877,
--2578,
-1103,
-2615,
-3068,
-4186,
-5094,
-5568,
-5778,
-4142,
-1250,
--132,
--349,
--1662,
--3998,
--5143,
--4834,
--4300,
--3396,
--2216,
--1395,
--256,
-1793,
-3508,
-3851,
-3570,
-3620,
-3451,
-2651,
-1641,
-418,
--868,
--1653,
--1907,
--2339,
--2754,
--2446,
--1671,
--1065,
--478,
-139,
-677,
-1196,
-1665,
-1890,
-1696,
-1486,
-1340,
-988,
-343,
--254,
--685,
--994,
--1246,
--1391,
--1430,
--1328,
--1092,
--793,
--525,
--158,
-205,
-559,
-744,
-829,
-829,
-758,
-439,
-9,
--296,
--447,
--813,
--1334,
--1615,
--1731,
--1694,
--1559,
--1055,
--694,
-360,
-3442,
-5109,
-3607,
-2189,
-2785,
-4015,
-3152,
-868,
--642,
--1512,
--1742,
--1879,
--2998,
--4294,
--4178,
--2538,
--1395,
--1552,
--1371,
--211,
-1144,
-1968,
-2197,
-2053,
-1917,
-2172,
-2349,
-1636,
-410,
--250,
--406,
--763,
--1506,
--2096,
--2271,
--2112,
--1695,
--1288,
--1062,
--671,
-160,
-1038,
-1398,
-1487,
-1588,
-1643,
-1513,
-1173,
-665,
-72,
--358,
--595,
--820,
--1083,
--1209,
--1030,
--748,
--424,
--140,
-137,
-405,
-691,
-869,
-882,
-764,
-636,
-514,
-322,
-62,
--196,
--408,
--528,
--545,
--548,
--555,
--450,
--265,
--90,
-79,
-217,
-343,
-400,
-391,
-378,
-302,
-180,
-41,
--105,
--226,
--375,
--435,
--459,
--428,
--381,
--321,
--222,
--149,
--79,
-24,
-158,
-248,
-183,
-112,
-63,
-27,
--49,
--119,
--233,
--176,
-64,
-185,
--62,
--229,
--261,
--200,
--123,
--85,
-126,
-1087,
-1992,
-1942,
-1470,
-1327,
-1169,
-695,
--37,
--706,
--1358,
--1547,
--1428,
--1460,
--1608,
--1364,
--798,
--192,
-143,
-449,
-713,
-959,
-1160,
-1184,
-857,
-537,
-313,
-121,
--207,
--539,
--789,
--843,
--801,
--670,
--573,
--439,
--208,
-123,
-325,
-448,
-530,
-617,
-602,
-526,
-364,
-173,
--17,
--133,
--269,
--377,
--447,
--423,
--353,
--257,
--159,
--41,
-67,
-202,
-275,
-321,
-314,
-294,
-244,
-180,
-84,
--28,
--95,
--131,
--186,
--185,
--179,
--147,
--95,
--25,
-31,
-51,
-111,
-150,
-135,
-146,
-122,
-78,
-61,
-43,
--4,
--43,
--51,
--74,
--81,
--66,
--69,
--64,
--40,
--19,
--7,
-4,
-16,
-29,
-27,
-30,
-28,
-8,
-6,
-6,
--7,
-0,
-12,
-6,
--13,
--22,
--26,
--42,
--54,
--51,
--62,
--59,
--32,
--21,
--21,
--11,
-4,
-12,
-7,
-3,
--21,
--56,
--46,
--42,
--68,
--89,
--95,
--84,
--68,
--46,
--32,
--22,
-67,
-214,
-276,
-221,
-144,
-119,
-94,
-30,
--43,
--81,
--46,
-51,
-136,
-177,
-210,
-244,
-262,
-213,
-106,
--21,
--133,
--221,
--299,
--373,
--413,
--380,
--299,
--201,
--98,
-23,
-134,
-230,
-301,
-309,
-268,
-224,
-184,
-103,
--21,
--121,
--166,
--189,
--204,
--211,
--207,
--174,
--96,
--10,
-44,
-72,
-99,
-126,
-137,
-126,
-96,
-48,
-17,
--6,
--40,
--68,
--83,
--75,
--69,
--73,
--58,
--29,
--1,
-14,
-24,
-41,
-47,
-41,
-39,
-38,
-37,
-23,
-0,
--10,
--6,
--1,
--1,
--4,
--3,
--1,
-5,
-7,
-7,
-15,
-11,
--1,
--3,
-6,
--6,
--8,
-0,
--6,
--5,
-6,
-17,
--1,
--7,
-5,
-4,
--3,
--6,
--10,
--26,
--43,
--37,
--28,
--21,
--18,
--28,
--29,
--15,
--3,
--2,
--17,
--22,
--13,
--31,
--36,
--27,
--33,
--57,
--43,
--15,
-5,
-20,
-60,
-107,
-165,
-197,
-199,
-172,
-144,
-102,
-51,
--28,
--94,
--131,
--139,
--157,
--158,
--149,
--117,
--87,
--39,
--7,
-22,
-43,
-67,
-67,
-56,
-40,
-44,
-25,
-13,
--12,
--28,
--31,
--23,
--25,
--18,
--12,
--8,
--6,
-14,
-12,
-6,
-19,
-35,
-25,
-16,
-5,
-0,
-9,
-7,
-2,
-16,
-18,
-3,
--4,
-8,
-18,
-3,
-9,
-5,
-10,
--3,
--10,
--12,
--10,
--13,
--19,
--29,
--10,
--17,
--18,
--24,
--27,
--27,
--10,
--24,
--29,
--43,
--35,
--39,
--31,
--33,
--21,
--30,
--8,
-21,
-53,
-65,
-103,
-117,
-128,
-120,
-119,
-68,
-36,
-2,
--23,
--55,
--71,
--94,
--88,
--81,
--67,
--63,
--48,
--34,
--8,
-6,
-11,
-10,
-30,
-25,
-15,
-27,
-26,
-15,
--1,
-0,
-3,
--6,
--5,
-9,
-3,
-7,
-4,
-8,
--2,
-9,
-12,
-27,
-13,
-6,
--2,
-6,
--17,
-5,
--4,
-0,
--9,
-4,
--16,
--16,
--26,
--10,
--36,
--18,
--30,
--26,
--33,
--19,
--50,
--38,
--43,
--25,
--16,
-24,
-27,
-71,
-92,
-108,
-94,
-97,
-64,
-52,
-16,
--6,
--33,
--36,
--57,
--57,
--68,
--43,
--43,
--37,
--46,
--20,
--10,
-3,
--7,
-10,
-10,
-11,
-13,
-12,
--1,
-19,
-3,
-4,
-12,
-20,
-12,
-10,
-15,
-14,
--2,
-15,
-19,
-5,
-2,
-2,
-1,
--5,
--16,
--1,
--8,
--16,
--8,
--13,
--29,
--24,
--27,
--28,
--28,
--37,
--30,
--24,
--8,
-26,
-58,
-75,
-81,
-73,
-59,
-51,
-30,
-6,
-3,
--5,
--24,
--22,
--15,
--23,
--34,
--38,
--30,
--21,
--10,
--8,
--4,
-0,
-4,
--12,
--15,
--6,
--9,
-13,
-22,
-18,
-28,
-30,
-15,
-10,
-5,
-6,
--13,
--36,
--34,
--42,
--47,
--25,
--14,
--21,
--17,
-22,
-26,
--5,
-4,
-2,
--24,
--32,
--4,
-5,
-11,
-25,
-7,
-6,
-15,
-23,
-26,
-6,
-11,
-43,
-21,
-8,
-39,
-4,
-21,
-40,
-22,
-60,
-75,
-83,
-122,
-95,
-73,
-26,
--23,
--27,
--92,
--119,
--104,
--92,
--41,
--4,
--4,
--6,
-6,
-15,
-38,
-34,
-23,
-31,
-14,
-9,
--15,
--37,
--33,
--83,
--120,
--100,
--81,
--97,
--64,
--11,
-8,
-10,
-41,
-15,
-46,
-174,
-106,
-55,
-99,
-1,
--18,
--30,
--61,
--61,
--67,
--39,
--33,
--12,
-13,
--1,
-5,
-19,
-3,
-9,
--1,
--5,
--25,
--26,
--15,
--37,
--14,
--3,
--10,
-5,
-15,
-22,
-26,
-39,
-40,
-33,
-37,
-30,
-18,
-22,
-7,
-7,
-0,
--5,
--6,
--15,
--11,
--19,
--17,
--21,
--23,
--27,
--27,
--30,
--35,
--27,
--49,
--45,
--64,
--56,
--74,
--28,
--13,
-15,
-429,
-417,
-80,
-188,
-29,
--101,
--111,
--167,
--162,
--171,
--56,
--91,
--72,
-42,
--18,
-15,
-45,
-11,
-31,
-1,
-23,
--7,
--5,
-21,
--21,
-28,
-12,
-5,
-28,
-7,
-26,
-7,
-15,
-25,
-5,
-25,
-10,
-10,
-22,
--9,
-10,
--17,
--5,
--16,
--17,
--9,
--8,
--21,
--11,
--39,
--23,
--46,
--30,
--46,
--26,
--51,
--67,
--76,
--90,
--80,
--63,
-39,
--30,
-635,
-818,
-46,
-147,
--11,
--278,
--216,
--248,
--194,
--242,
--6,
--63,
--100,
-131,
--11,
-44,
-91,
-17,
--18,
--58,
--5,
--49,
-21,
--33,
-34,
-160,
-61,
-42,
-32,
--2,
--113,
--120,
--192,
--75,
-174,
--143,
--100,
--10,
-1,
-79,
-135,
-266,
--1,
-116,
-120,
--89,
-154,
--22,
-10,
--58,
--38,
--202,
--307,
-432,
-240,
--80,
-320,
--182,
--285,
--252,
--618,
--269,
--89,
-401,
-459,
-347,
-472,
-26,
--18,
--47,
--376,
--223,
--199,
--46,
--93,
-22,
-219,
-196,
-46,
--326,
--160,
-115,
--210,
-144,
-129,
--141,
--8,
-140,
-433,
--12,
--87,
-20,
--10,
-30,
--307,
--261,
--690,
--238,
-822,
-469,
-415,
-320,
--6,
-185,
--219,
--145,
--246,
--420,
--115,
--157,
--84,
--87,
-221,
-0,
--23,
-530,
-4,
--15,
-89,
-9,
--58,
--197,
--96,
--421,
--165,
--13,
--452,
-55,
-171,
-130,
-110,
-311,
-464,
--39,
-43,
-10,
--65,
-28,
--164,
-62,
--60,
--209,
--362,
--272,
-244,
--103,
-209,
-819,
-167,
-68,
--34,
--230,
--100,
--10,
-105,
-170,
-423,
-632,
-119,
--199,
-42,
--178,
--85,
--74,
--344,
--439,
--339,
--216,
-311,
-678,
-582,
-435,
--158,
--175,
-73,
--80,
--464,
--815,
--203,
--323,
--664,
--21,
-26,
-433,
-441,
-246,
-333,
-142,
-171,
--387,
--263,
-148,
-23,
-149,
--126,
-30,
-51,
-117,
-188,
--539,
-29,
-205,
--123,
-155,
-131,
-104,
-19,
-145,
--289,
--431,
-0,
--420,
--218,
-56,
-91,
-195,
--103,
-87,
--3,
-343,
-207,
--281,
-35,
--148,
-138,
-93,
--334,
-63,
-36,
-78,
--302,
--526,
--427,
--660,
--238,
--298,
-21,
-790,
-448,
-472,
-757,
-856,
-389,
--389,
-69,
-103,
--63,
--13,
--557,
--170,
-125,
--4,
--352,
--410,
-315,
--48,
--97,
--124,
--527,
-246,
-647,
-71,
--235,
--228,
--451,
--306,
-363,
-382,
--74,
-108,
-28,
--341,
-37,
-162,
--66,
-183,
-454,
-227,
-187,
-517,
-471,
--139,
--228,
-63,
--170,
--150,
-244,
--64,
--456,
--54,
-461,
-195,
--309,
--326,
--89,
-49,
-50,
--323,
--210,
-435,
-988,
-820,
-218,
--165,
--192,
--175,
--579,
--567,
--365,
--146,
-141,
--662,
--1223,
--704,
-227,
-269,
--448,
-337,
-931,
-673,
-437,
--205,
--176,
--156,
--299,
--386,
--496,
-142,
-116,
--154,
--355,
--491,
-17,
--203,
--499,
--298,
-546,
-1489,
-516,
--241,
-67,
-90,
--223,
--616,
--622,
--157,
-616,
-1075,
-610,
-288,
-676,
-659,
-150,
--342,
--244,
--86,
--320,
--220,
--278,
--543,
--80,
-488,
-247,
--54,
--153,
--207,
--283,
--198,
--170,
--266,
-60,
-153,
--215,
--72,
-120,
-76,
-56,
--87,
-22,
-64,
-141,
-73,
--37,
-277,
-136,
--169,
--203,
--127,
--17,
--145,
--140,
--241,
--175,
-15,
--195,
--212,
--100,
--52,
--12,
--178,
--183,
--149,
--57,
--117,
--392,
--91,
-48,
--216,
--271,
--469,
--397,
--181,
-516,
-777,
-1001,
-3479,
-4115,
-1347,
--222,
--177,
--240,
--1385,
--1635,
--1006,
--1541,
--520,
-485,
--557,
--748,
--38,
-644,
-246,
--252,
-468,
-74,
--220,
-342,
--5,
--595,
--393,
-152,
-8,
--347,
-106,
--23,
--344,
-218,
-493,
-39,
--291,
-56,
-296,
--170,
--123,
--127,
--256,
-22,
-115,
--152,
--373,
-40,
-424,
-4,
--81,
-71,
-149,
-196,
-108,
--52,
--140,
-178,
-398,
-119,
--134,
--9,
-219,
-92,
-44,
--49,
-5,
-156,
-240,
-44,
--224,
--7,
-198,
-46,
--57,
--75,
-82,
-53,
-94,
--147,
--214,
-10,
-142,
--60,
--192,
--55,
-4,
-13,
--20,
--153,
--107,
--17,
--1,
--264,
--153,
-125,
-109,
--43,
--215,
--368,
--192,
--77,
--270,
--476,
--241,
-3,
--343,
--672,
--840,
--735,
--154,
-520,
--118,
-638,
-5110,
-5318,
-313,
--1333,
--315,
--312,
--1728,
--2948,
--3283,
--1999,
-2484,
-2536,
--2013,
--1675,
-2109,
-2863,
-441,
--940,
--163,
-507,
-1163,
-406,
--2538,
--2285,
-789,
-1005,
--1405,
--2044,
-21,
-1110,
-607,
-143,
--524,
--70,
-1636,
-1329,
--636,
--1084,
-522,
-978,
--127,
--706,
--462,
--31,
-667,
-392,
--639,
--636,
-527,
-949,
-183,
--322,
--7,
-503,
-716,
-348,
--298,
--269,
-355,
-505,
--116,
--541,
--312,
-179,
-305,
--33,
--464,
--280,
-277,
-425,
--204,
--549,
--279,
-129,
-80,
--348,
--630,
--332,
-214,
-54,
--792,
--987,
--88,
--51,
--616,
--1227,
--1268,
--659,
--335,
--81,
--718,
-4376,
-11477,
-5778,
--1970,
--272,
-1642,
--973,
--5351,
--7281,
--6891,
--2672,
-3193,
--7,
--4939,
-911,
-7202,
-4919,
-629,
-214,
-1744,
-2296,
-1588,
--2183,
--6087,
--2879,
-1197,
--1255,
--4385,
--1998,
-1583,
-2244,
-1509,
-876,
-599,
-2229,
-3512,
-715,
--1625,
--209,
-943,
--848,
--2156,
--1329,
--394,
-36,
-502,
-56,
--46,
-1476,
-2086,
-549,
--412,
-521,
-1004,
--234,
--1188,
--1288,
--1050,
--434,
--346,
--644,
--305,
-722,
-1109,
-337,
--280,
--52,
-5,
-78,
--1079,
--2736,
--2774,
--1980,
--1476,
--1451,
--969,
-245,
-1501,
-10820,
-16134,
-3358,
--4437,
-1229,
-2611,
--3693,
--10270,
--10079,
--5371,
--873,
-1188,
--4267,
--5509,
-6273,
-12488,
-6174,
-732,
-1904,
-4303,
-3430,
--849,
--7991,
--10784,
--3524,
-1056,
--4652,
--7465
-};
diff --git a/unittest/mksine.c b/unittest/mksine.c
new file mode 100644
index 0000000..fb5f822
--- /dev/null
+++ b/unittest/mksine.c
@@ -0,0 +1,54 @@
+/*
+ mksine.c
+ David Rowe
+ 10 Nov 2010
+
+ Creates a file of sine wave samples.
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+
+#define TWO_PI 6.283185307
+#define FS 8000.0
+
+int main(int argc, char *argv[]) {
+ FILE *f;
+ int i,n;
+ float freq, length;
+ short *buf;
+ float amp = 1E4;
+
+ if (argc < 4) {
+ printf("usage: %s outputFile frequencyHz lengthSecs [PeakAmp]\n", argv[0]);
+ exit(1);
+ }
+
+ if (strcmp(argv[1], "-") == 0) {
+ f = stdout;
+ } else if ( (f = fopen(argv[1],"wb")) == NULL ) {
+ fprintf(stderr, "Error opening output file: %s: %s.\n", argv[3], strerror(errno));
+ exit(1);
+ }
+ freq = atof(argv[2]);
+ length = atof(argv[3]);
+ if (argc == 5) amp = atof(argv[4]);
+
+ n = length*FS;
+ buf = (short*)malloc(sizeof(short)*n);
+ assert(buf != NULL);
+
+ for(i=0; i<n; i++)
+ buf[i] = amp*cos(freq*i*(TWO_PI/FS));
+
+ fwrite(buf, sizeof(short), n, f);
+
+ fclose(f);
+ free(buf);
+
+ return 0;
+}
diff --git a/unittest/ofdm_fade_dpsk.sh b/unittest/ofdm_fade_dpsk.sh
deleted file mode 100755
index 18e38bb..0000000
--- a/unittest/ofdm_fade_dpsk.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-#
-# David Sep 2019
-# Tests 2020 OFDM modem fading channel performance in DPSK mode, using a simulated faster (2Hz) high SNR fading channel
-
-fading_dir=$1
-results=$(mktemp)
-
-# Coded BER should be < 1% for this test
-ofdm_mod --in /dev/zero --testframes 300 --mode 2020 --ldpc --verbose 1 --dpsk | \
-ch - - --No -40 -f 10 --ssbfilt 1 --mpd --fading_dir $fading_dir --multipath_delay 2 | \
-ofdm_demod --out /dev/null --testframes --mode 2020 --verbose 1 --ldpc --dpsk 2> $results
-cat $results
-cber=$(cat $results | sed -n "s/^Coded BER.* \([0-9..]*\) Tbits.*/\1/p")
-python3 -c "import sys; sys.exit(0) if $cber<=0.05 else sys.exit(1)"
diff --git a/unittest/ofdm_mem.c b/unittest/ofdm_mem.c
deleted file mode 100644
index c87f067..0000000
--- a/unittest/ofdm_mem.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*---------------------------------------------------------------------------*\
-
- FILE........: ofdm_mem.c
- AUTHOR......: Don Reid
- DATE CREATED: 11 June 2018
-
- Prints out the memory used by the OFDM modem states. Used to optimise
- memory use for the STM32F4 port.
-
-\*---------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2018 Don Reid
-
- 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.1, 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 <complex.h>
-
-#include "codec2_ofdm.h"
-#include "ofdm_internal.h"
-
-int main()
-{
- struct OFDM_CONFIG *ofdm_config;
- struct OFDM *ofdm;
-
- ofdm = ofdm_create(NULL);
- assert(ofdm != NULL);
-
- /* Get a copy of the actual modem config */
- ofdm_config = ofdm_get_config_param(ofdm);
-
- int ofdm_m = (int) (ofdm_config->fs / ofdm_config->rs); /* 144 */
- int ofdm_ncp = (int) (ofdm_config->tcp * ofdm_config->fs); /* 16 */
- int ofdm_bitsperframe = (ofdm_config->ns - 1) * (ofdm_config->nc * ofdm_config->bps);
- int ofdm_rowsperframe = ofdm_bitsperframe / (ofdm_config->nc * ofdm_config->bps);
- int ofdm_samplesperframe = ofdm_config->ns * (ofdm_m + ofdm_ncp);
- int ofdm_rxbuf = 3 * ofdm_samplesperframe + 3 * (ofdm_m + ofdm_ncp);
- int ofdm_nuwbits = (ofdm_config->ns - 1) * ofdm_config->bps - ofdm_config->txtbits;
-
- int used = 0;
-
- printf("struct OFDM.................: %zd\n", sizeof(struct OFDM));
- printf("config......................: %zd\n", sizeof(struct OFDM_CONFIG));
- used += sizeof(struct OFDM_CONFIG);
- printf("pilot_samples...............: %zd\n", sizeof (complex float) * (ofdm_m + ofdm_ncp));
- used += sizeof (complex float) * (ofdm_m + ofdm_ncp);
- printf("rxbuf.......................: %zd\n", sizeof (complex float) * ofdm_rxbuf);
- used += sizeof (complex float) * ofdm_rxbuf;
- printf("pilots......................: %zd\n", sizeof (complex float) * (ofdm_config->nc + 2));
- used += sizeof (complex float) * (ofdm_config->nc + 2);
-
- size_t rxsym_size = sizeof (complex float) * (ofdm_config->ns + 3) * (ofdm_config->nc + 2);
-
- printf("rx_sym......................: %zd\n", rxsym_size);
- used += rxsym_size;
- printf("rx_np.......................: %zd\n", sizeof (complex float) * (ofdm_rowsperframe * ofdm_config->nc));
- used += sizeof (complex float) * (ofdm_rowsperframe * ofdm_config->nc);
- printf("rx_amp......................: %zd\n", sizeof (float) * (ofdm_rowsperframe * ofdm_config->nc));
- used += sizeof (float) * (ofdm_rowsperframe * ofdm_config->nc);
- printf("aphase_est_pilot_log........: %zd\n", sizeof (float) * (ofdm_rowsperframe * ofdm_config->nc));
- used += sizeof (float) * (ofdm_rowsperframe * ofdm_config->nc);
- printf("tx_uw.......................: %zd\n", sizeof (int) * ofdm_nuwbits);
- used += sizeof (int) * ofdm_nuwbits;
- printf("sync_state..................: %zd\n", sizeof (State));
- used += sizeof (State);
- printf("last_sync_state.............: %zd\n", sizeof (State));
- used += sizeof (State);
- printf("sync_state_interleaver......: %zd\n", sizeof (State));
- used += sizeof (State);
- printf("last_sync_state_interleaver.: %zd\n", sizeof (State));
- used += sizeof (State);
-
- // add in non-array sizes
- int single = 0;
- single += 8 * sizeof(int);
- single += 13 * sizeof(float);
- single += 1 * sizeof(complex float);
- single += 1 * sizeof(float *);
- single += 4 * sizeof(bool);
- printf("single values...............: %d\n", single);
- used += single;
-
- printf("Total used .................: %zd\n", (size_t) used);
-
- ofdm_destroy(ofdm);
-
- return 0;
-}
-
diff --git a/unittest/ofdm_stack.c b/unittest/ofdm_stack.c
deleted file mode 100644
index aef6f42..0000000
--- a/unittest/ofdm_stack.c
+++ /dev/null
@@ -1,229 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <complex.h>
-#include <unistd.h>
-#include <assert.h>
-
-#include "comp.h"
-#include "ofdm_internal.h"
-#include "codec2_ofdm.h"
-#include "test_bits_ofdm.h" /* payload_data_bits */
-#include "mpdecode_core.h"
-
-#define MAX_ERRORS 32
-
-static int ofdm_bitsperframe;
-static int ofdm_rowsperframe;
-static int ofdm_nuwbits;
-static int ofdm_ntxtbits;
-static int ofdm_rx_offset;
-static int ofdm_data_bitsperframe;
-static int ofdm_samplesperframe;
-static int ofdm_max_samplesperframe;
-static int ofdm_rxbuf;
-static int ofdm_m;
-static int ofdm_ncp;
-
-// Forwards
-void run_modem(struct OFDM *ofdm, int tx_bits[], int rx_bits[], COMP tx_rx[]);
-void dummy_code();
-
-/////////////////////////////////////////////////////////////
-/// MAIN()
-int main(int argc, char *argv[]) {
- // Options
- int f, i, opt;
- int dummy = 0; // flag to use dummy code
- int frames = 1; // how many frames
- int print = 0; // flag to print all bits
- struct OFDM *ofdm;
- struct OFDM_CONFIG *ofdm_config;
-
- ofdm = ofdm_create(NULL);
- assert(ofdm != NULL);
-
- /* Get a copy of the actual modem config */
-
- ofdm_config = ofdm_get_config_param(ofdm);
-
- ofdm_m = (int) (ofdm_config->fs / ofdm_config->rs);
- ofdm_ncp = (int) (ofdm_config->tcp * ofdm_config->fs);
- ofdm_bitsperframe = ofdm_get_bits_per_frame(ofdm);
- ofdm_rowsperframe = ofdm_bitsperframe / (ofdm_config->nc * ofdm_config->bps);
- ofdm_samplesperframe = ofdm_get_samples_per_frame(ofdm);
- ofdm_max_samplesperframe = ofdm_get_max_samples_per_frame(ofdm);
- ofdm_rxbuf = 3 * ofdm_samplesperframe + 3 * (ofdm_m + ofdm_ncp);
- ofdm_nuwbits = (ofdm_config->ns - 1) * ofdm_config->bps - ofdm_config->txtbits;
- ofdm_ntxtbits = ofdm_config->txtbits;
- ofdm_rx_offset = (ofdm_nuwbits + ofdm_ntxtbits);
- ofdm_data_bitsperframe = (ofdm_bitsperframe - ofdm_rx_offset);
-
- int tx_bits[ofdm_data_bitsperframe];
- int rx_bits[ofdm_data_bitsperframe];
- COMP tx_rx[ofdm_samplesperframe];
-
- while ((opt = getopt(argc, argv, "df:p")) != -1) {
- switch (opt) {
- case 'd':
- dummy = 1;
- break;
- case 'f':
- frames = atoi(optarg);
- break;
- case 'p':
- print = 1;
- break;
- default:
- fprintf(stderr, "Usage: %s [-e] [-f <frames>] [-p]\n", argv[0]);
- }
- }
-
- for (f = 0; f < frames; f++) {
- ////////
- // Prep inputs
-
- for(i=0; i<ofdm_data_bitsperframe; i++) {
- tx_bits[i] = payload_data_bits[(i % (sizeof(payload_data_bits)/sizeof(payload_data_bits[0])))];
- }
-
- ////////
- // Modem (or dummy)
-
- if (dummy) {
- dummy_code(tx_bits, rx_bits);
- } else {
- run_modem(ofdm, tx_bits, rx_bits, tx_rx);
- }
-
- ////////
- // Compare results (or print)
- int errors = 0;
-
- if (print) {
- for(i=0; i<ofdm_data_bitsperframe; i++) {
- fprintf(stderr, "bit %3d: tx = %1d, rx = %1d",
- i, tx_bits[i], rx_bits[i + ofdm_rx_offset]);
-
- if (tx_bits[i] != rx_bits[i + ofdm_rx_offset]) {
- fprintf(stderr, " Error");
- errors ++;
- }
-
- fprintf(stderr, "\n");
- }
- } else {
- for(i=0; i<ofdm_data_bitsperframe; i++) {
- if (tx_bits[i] != rx_bits[i + ofdm_rx_offset]) {
- if (errors < MAX_ERRORS) {
- fprintf(stderr, "Error in bit %3d: tx = %1d, rx = %1d\n",
- i, tx_bits[i], rx_bits[i + ofdm_rx_offset]);
- }
-
- errors++;
- }
- }
- }
-
- fprintf(stderr, "%d Errors\n", errors);
-
- } // for (f<frames
-
- ofdm_destroy(ofdm);
-
-} // end main()
-
-
-//////////////////////////////////
-void run_modem(struct OFDM *ofdm, int tx_bits[], int rx_bits[], COMP tx_rx[]) {
- int mod_bits[ofdm_samplesperframe];
- int i, j;
-
- ///////////
- // Mod
- ///////////
-
- for(i=0; i<ofdm_nuwbits; i++) {
- mod_bits[i] = ofdm->tx_uw[i];
- }
-
- for(i=ofdm_nuwbits; i<ofdm_nuwbits+ofdm_ntxtbits; i++) {
- mod_bits[i] = 0;
- }
-
- for(j=0, i=ofdm_nuwbits+ofdm_ntxtbits; j<ofdm_data_bitsperframe; i++,j++) {
- mod_bits[i] = tx_bits[j];
- }
-
- for(j=0; j<ofdm_data_bitsperframe; i++,j++) {
- mod_bits[i] = tx_bits[j];
- }
-
- ofdm_mod(ofdm, tx_rx, mod_bits);
-
- ///////////
- // DeMod
- ///////////
-
- int Nsam = ofdm_samplesperframe;
- int prx = 0;
- int nin = ofdm_samplesperframe + 2 * (ofdm_m + ofdm_ncp);
-
- int lnew;
- COMP rxbuf_in[ofdm_max_samplesperframe];
-
- for (i=0; i<ofdm_samplesperframe ; i++,prx++) {
- ofdm->rxbuf[ofdm_rxbuf-nin+i] = tx_rx[prx].real + tx_rx[prx].imag * I;
- }
-
- for (i=ofdm_samplesperframe ; i<nin; i++) {
- ofdm->rxbuf[ofdm_rxbuf-nin+i] = 0.0 + 0.0 * I;
- }
-
- /* disable estimators for initial testing */
- ofdm_set_verbose(ofdm, false);
- ofdm_set_timing_enable(ofdm, true);
- ofdm_set_foff_est_enable(ofdm, true);
- ofdm_set_phase_est_enable(ofdm, true);
-
- ofdm->mean_amp = 1.0;
-
- nin = ofdm_get_nin(ofdm);
-
- /* Insert samples at end of buffer, set to zero if no samples
- available to disable phase estimation on future pilots on
- last frame of simulation. */
-
- if ((Nsam-prx) < nin) {
- lnew = Nsam-prx;
- } else {
- lnew = nin;
- }
- for(i=0; i<nin; i++) {
- rxbuf_in[i].real = 0.0;
- rxbuf_in[i].imag = 0.0;
- }
-
- if (lnew) {
- for(i=0; i<lnew; i++, prx++) {
- rxbuf_in[i] = tx_rx[prx];
- }
- }
-
- ofdm_demod(ofdm, rx_bits, rxbuf_in);
-
-
-} // end run_modem()
-
-
-//////////////////////////////////
-void dummy_code(int tx_bits[], int rx_bits[]) {
- int i;
-
- for(i=0; i<ofdm_data_bitsperframe; i++) {
- rx_bits[i] = tx_bits[i];
- }
-
-} // end dummy_code()
-
-/* vi:set ts=4 sts=4 et: */
diff --git a/unittest/ota_auto.sh b/unittest/ota_auto.sh
deleted file mode 100755
index b6355ba..0000000
--- a/unittest/ota_auto.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-# ota_auto.sh
-#
-# Run a single automated test and log results
-
-timestamp=$(date +"%F-%T")
-mkdir -p $timestamp
-start_dir=$(pwd)
-cd $timestamp
-../ota_test.sh "$@" >> log.txt 2>&1
-cd $start_dir
-kiwi_sdr=$(head -n 1 ${timestamp}/log.txt)
-mode=$(head -n 2 ${timestamp}/log.txt | tail -n 1)
-result=$(awk '/FrmGd/{getline; print}' ${timestamp}/log.txt)
-printf "%s %-25s %s %s\n" $timestamp $kiwi_sdr $mode "$result" >> log.txt
diff --git a/unittest/ota_last.sh b/unittest/ota_last.sh
deleted file mode 100755
index 31efa1c..0000000
--- a/unittest/ota_last.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env bash
-#
-# Present summary info from the n-th latest OTA HF data test
-
-function print_help {
- echo
- echo "Summary of last automated Over The Air (OTA) test"
- echo
- echo " usage ./ota_last.sh [options]"
- echo
- echo " -a show scatter diagram"
- echo " -p play the received wave file"
- echo " -n N select N-th from last file"
- echo " -s display spectrogram"
-}
-
-show_spec=0
-show_scatter=0
-play_file=0
-N=1
-
-while [[ $# -gt 0 ]]
-do
-key="$1"
-case $key in
- -n)
- N="$2"
- shift
- shift
- ;;
- -a)
- show_scatter=1
- shift
- ;;
- -s)
- show_spec=1
- shift
- ;;
- -p)
- play_file=1
- shift
- ;;
- -h)
- print_help
- ;;
-esac
-done
-
-# cat the log from the selected test
-directory=$(ls -td 2021* | head -n ${N} | tail -n 1)
-echo ${directory}
-cat ${directory}/log.txt
-
-# optionally show a few plots
-
-if [ $show_spec -eq 1 ]; then
- if [ -f ${directory}/spec.png ]; then
- eog ${directory}/spec.png
- else
- eog ${directory}/spec.jpg
- fi
-fi
-
-if [ $show_scatter -eq 1 ]; then
- eog ${directory}/scatter.png
-fi
-
-if [ $play_file -eq 1 ]; then
- play ${directory}/rx.wav
-fi
diff --git a/unittest/ota_summary.sh b/unittest/ota_summary.sh
deleted file mode 100755
index 5e028e3..0000000
--- a/unittest/ota_summary.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env bash
-#
-# Summarise tests to date
-
-CODEC2=${HOME}/codec2
-
-function print_help {
- echo
- echo "Automated Over The Air (OTA) data test for FreeDV OFDM HF data modems"
- echo
- echo " usage ./ota_summary.sh [-t]"
- echo
- echo " -t create/update thumbnail directory"
- exit 0
-}
-
-thumbnails=0
-while [[ $# -gt 0 ]]
-do
-key="$1"
-case $key in
- -t)
- thumbnails=1
- shift
- ;;
- -h)
- print_help
- ;;
-esac
-done
-
-total_bytes=$(cat log.txt | tr -s ' ' | cut -f6 -d' ' | awk '$0==($0+0)' | paste -sd+ | bc)
-printf "total bytes: %'d\n" ${total_bytes}
-
-# collect SNR averages from log.txt and generate a histogram
-ota_snrs=mktemp
-cat log.txt | tr -s ' ' | cut -f7 -d' ' | awk '$0==($0+0)'| sed '/-nan/d' > ${ota_snrs}
-echo "warning('off', 'all'); \
- snr=load('${ota_snrs}'); \
- hist(snr); \
- print('snr_hist.png','-dpng'); \
- quit" | octave-cli -qf > /dev/null
-
-# option to put small versions of spec/scatter in one dir
-
-if [ $thumbnails -ne 0 ]; then
- mkdir -p thumbnails
- spec_files=$(find . -name spec.jpg -o -name spec.png)
- for f in $spec_files
- do
- d=$(echo $f | sed -r 's/\.(.*)\//\1_/')
- echo $f thumbnails${d}
- cp $f thumbnails${d}
- done
-fi
diff --git a/unittest/ota_test.sh b/unittest/ota_test.sh
deleted file mode 100755
index 37b6ac0..0000000
--- a/unittest/ota_test.sh
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/usr/bin/env bash
-# ota_test.sh
-#
-# Automated Over The Air (OTA) data test for FreeDV OFDM HF data modems
-#
-# 1. Build codec2
-# 2. Install kiwclient:
-# cd ~ && git clone [email protected]:jks-prv/kiwiclient.git
-# 3. Install Hamlib cli tools
-
-PATH=${PATH}:${HOME}/codec2/build_linux/src:${HOME}/kiwiclient
-CODEC2=${HOME}/codec2
-
-kiwi_url=""
-port=8073
-freq_kHz="7177"
-tx_only=0
-Nbursts=5
-mode="datac0"
-model=361
-
-function print_help {
- echo
- echo "Automated Over The Air (OTA) data test for FreeDV OFDM HF data modems"
- echo
- echo " usage ./ota_test.sh [-d] [-f freq_kHz] [-t] [-n Nbursts] [-o model] [-p port] kiwi_url"
- echo
- echo " -d debug mode; trace script execution"
- echo " -o model select radio model number ('rigctl -l' to list)"
- echo " -m mode datac0|datac1|datac3"
- echo " -t Tx only, useful for manually observing SDRs which block multiple sessions from one IP"
- echo
- exit
-}
-
-function run_rigctl {
- command=$1
- model=$2
- echo $command | rigctl -m $model -r /dev/ttyUSB0 > /dev/null
- if [ $? -ne 0 ]; then
- echo "Can't talk to Tx"
- exit 1
- fi
-}
-
-POSITIONAL=()
-while [[ $# -gt 0 ]]
-do
-key="$1"
-case $key in
- -d)
- set -x
- shift
- ;;
- -f)
- freq_kHz="$2"
- shift
- shift
- ;;
- -o)
- model="$2"
- shift
- shift
- ;;
- -m)
- mode="$2"
- shift
- shift
- ;;
- -n)
- Nbursts="$2"
- shift
- shift
- ;;
- -p)
- port="$2"
- shift
- shift
- ;;
- -t)
- tx_only=1
- shift
- ;;
- -h)
- print_help
- ;;
- *)
- POSITIONAL+=("$1") # save it in an array for later
- shift
- ;;
-esac
-done
-set -- "${POSITIONAL[@]}" # restore positional parameters
-
-if [ $tx_only -eq 0 ]; then
- if [ $# -lt 1 ]; then
- print_help
- fi
- kiwi_url="$1"
- echo $kiwi_url
-fi
-
-# create test Tx file
-echo $mode
-freedv_data_raw_tx -q --framesperburst 1 --bursts ${Nbursts} --testframes ${Nbursts} ${mode} /dev/zero test_datac0.raw
-
-usb_lsb=$(python3 -c "print('usb') if ${freq_kHz} >= 10000 else print('lsb')")
-
-if [ $tx_only -eq 0 ]; then
- echo -n "waiting for KiwiSDR "
- # start recording from remote kiwisdr
- kiwi_stdout=$(mktemp)
- kiwirecorder.py -s $kiwi_url -p ${port} -f $freq_kHz -m ${usb_lsb} -r 8000 --filename=rx --time-limit=300 >$kiwi_stdout &
- kiwi_pid=$!
-
- # wait for kiwi to start recording
- timeout_counter=0
- until grep -q -i 'Block: ' $kiwi_stdout
- do
- timeout_counter=$((timeout_counter+1))
- if [ $timeout_counter -eq 10 ]; then
- echo "can't connect to ${kiwi_url}"
- exit 1
- fi
- echo -n "."
- sleep 1
- done
- echo
-fi
-
-# transmit using local SSB radio
-echo "Tx data signal"
-freq_Hz=$((freq_kHz*1000))
-usb_lsb_upper=$(echo ${usb_lsb} | awk '{print toupper($0)}')
-run_rigctl "\\set_mode PKT${usb_lsb_upper} 0" $model
-run_rigctl "\\set_freq ${freq_Hz}" $model
-run_rigctl "\\set_ptt 1" $model
-aplay --device="plughw:CARD=CODEC,DEV=0" -f S16_LE test_datac0.raw 2>/dev/null
-run_rigctl "\\set_ptt 0" $model
-
-if [ $tx_only -eq 0 ]; then
- sleep 2
- echo "Stopping KiwiSDR"
- kill ${kiwi_pid}
- wait ${kiwi_pid} 2>/dev/null
-
- echo "Process receiver sample"
- # generate spectrogram
- echo "pkg load signal; warning('off', 'all'); \
- s=load_raw('rx.wav'); \
- plot_specgram(s, 8000, 500, 2500); print('spec.jpg', '-djpg'); \
- quit" | octave-cli -p ${CODEC2}/octave -qf > /dev/null
- # attempt to demodulate
- freedv_data_raw_rx -q --framesperburst 1 --testframes ${mode} -v --scatter scatter.txt --singleline rx.wav /dev/null
- # render scatter plot (if we get any frames)
- scatter_sz=$(ls -l scatter.txt | cut -f 5 -d' ')
- if [ $scatter_sz -ne 0 ]; then
- echo "pkg load signal; warning('off', 'all'); pl_scatter('scatter.txt'); quit" | octave-cli -p ${CODEC2}/octave -qf > /dev/null
- fi
-fi
-
diff --git a/unittest/ota_voice_auto.sh b/unittest/ota_voice_auto.sh
deleted file mode 100755
index c741f2d..0000000
--- a/unittest/ota_voice_auto.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-# ota_voice_auto.sh
-#
-# Run a single automated voice test, files are put in a time stamped
-# directory, and summarised in single line in the log file
-# log_voice.txt. Designed to be used from cron.
-
-# use crontab -e to edit cron for current user, sample entry:
-
-# m h dom mon dow command
-# */10 6-12 24 4 * cd codec2/unittest; ./ota_voice_auto.sh ~/your_speech_file.s16 your.kiwi.sdr
-
-timestamp=$(date +"%F-%T")
-mkdir -p $timestamp
-start_dir=$(pwd)
-cd $timestamp
-../ota_voice_test.sh "$@" > log.txt 2>&1
-cd $start_dir
-kiwi_sdr=$(head -n 1 ${timestamp}/log.txt)
-mode=$(head -n 2 ${timestamp}/log.txt | tail -n 1)
-Nsync=$(cat ${timestamp}/log.txt | grep Nsync | tr -s ' ' | cut -d' ' -f2)
-SNRav=$(cat ${timestamp}/log.txt | grep SNRav | tr -s ' ' | cut -d' ' -f2)
-printf "%s %-25s %s %3d %5.2f\n" $timestamp $kiwi_sdr $mode $Nsync $SNRav >> log_voice.txt
diff --git a/unittest/ota_voice_summary.sh b/unittest/ota_voice_summary.sh
deleted file mode 100755
index 62014fd..0000000
--- a/unittest/ota_voice_summary.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env bash
-#
-# Summarise tests to date into one directory to allow easy browsing
-
-src=/home/david/Downloads/speech_orig_16k.wav
-length_src=$(sox $src -n stat 2>&1 | grep Length | sed -r 's/.*\:\s*//')
-
-dir=voice_summary
-mkdir -p ${dir}
-time_snr_files=$(find . -name time_snr.jpg | sort)
-p=$(pwd)
-serial=0
-
-echo "<table>"
-echo "<tr>"
-echo "<th>Serial</th><th>Mode</th><th>KiwiSDR</th><th>Rx</th><th>AnDV</th><th>DV</th><th>Spectrogram</th><th>SNR</th>"
-echo "</tr>"
-
-for f in $time_snr_files
-do
- d=$(echo $f | sed -r 's/\.\/(.*)\/time_snr.jpg/\1/')
- sdr_url=$(head ${d}/log.txt -n 1)
- sdr="unk"
- case $sdr_url in
- "kiwisdr.areg.org.au")
- sdr="areg"
- ;;
- "sdr-amradioantennas.com")
- sdr="am"
- ;;
- "vk6qs.proxy.kiwisdr.com")
- sdr="vk6qs"
- ;;
- "sdr.ironstonerange.com")
- sdr="iron"
- ;;
- "kk6pr.ddns.net")
- sdr="kk6pr"
- ;;
- "kiwisdr.owdjim.gen.nz")
- sdr="marahau"
- ;;
- "kiwisdrzl1kfm.ddns.net")
- sdr="zl1kfm"
- ;;
- *)
- echo "Unknown Kiwi SDR"
- ;;
- esac
- mode=$(head ${d}/log.txt -n 2 | tail -n 1)
- serial_str=$(printf "%04d" $serial)
- #echo $serial_str $d $sdr $mode
- echo "<tr>"
- echo "<td>$serial</td>"
- echo "<td>$mode</td>"
- echo "<td>$sdr</td>"
-
- f=${dir}/${serial_str}_${d}_${sdr}_${mode}
- f1=${serial_str}_${d}_${sdr}_${mode}
-
- cp ${d}/rx.wav ${f}_rx.wav
- echo "<td><a href=\"${f1}_rx.wav\">Rx</td>"
-
- cp ${d}/rx_freedv.wav ${f}_rx_freedv.wav
- echo "<td><a href=\"${f1}_rx_freedv.wav\">AnDV</td>"
-
- length_f=$(sox ${f}_rx_freedv.wav -n stat 2>&1 | grep Length | sed -r 's/.*\:\s*//')
- start_dv=$(python -c "print(${length_f}-${length_src}-2)")
- sox ${d}/rx_freedv.wav ${f}_rx_freedv_dv.wav trim $start_dv $length_src
- echo "<td><a href=\"${f1}_rx_freedv_dv.wav\">DV</td>"
-
- cp ${d}/spec.jpg ${f}_spec.jpg
- echo "<td><img src=\"${f1}_spec.jpg\" width="200" height="200" /></td>"
- cp ${d}/time_snr.jpg ${f}_time_snr.jpg
- echo "<td><img src=\"${f1}_time_snr.jpg\" width="200" height="200" /></td>"
- echo "</tr>"
- serial=$((serial + 1))
-done
-
-echo "</table>"
diff --git a/unittest/ota_voice_test.sh b/unittest/ota_voice_test.sh
deleted file mode 100755
index 4f502ec..0000000
--- a/unittest/ota_voice_test.sh
+++ /dev/null
@@ -1,309 +0,0 @@
-#!/usr/bin/env bash
-# ota_voice_test.sh
-#
-# Automated Over The Air (OTA) voice test for FreeDV HF voice modes
-#
-# 1. Build codec2
-# 2. Install kiwclient:
-# cd ~ && git clone [email protected]:jks-prv/kiwiclient.git
-# 3. Install Hamlib cli tools, and add user to dialout group:
-# sudo adduser david dialout
-# 4. To test rigctl:
-# echo "m" | rigctl -m 361 -r /dev/ttyUSB0
-# 5. Adjust Tx drive so ALC is just being tickled, set desired RF power:
-# ../build_linux/src/freedv_tx 2020 ~/Downloads/speech_orig_16k.wav - | aplay -f S16_LE --device="plughw:CARD=CODEC,DEV=0"
-# 6. Sample command line:
-# ./ota_voice_test.sh ~/Downloads/speech_orig_16k.wav -m 700E -i ~/Downloads/vk5dgr_testing_8k.wav sdr.ironstonerange.com -p 8074
-
-MY_PATH=`dirname $0`
-BUILD_PATH=`echo $MY_PATH/../build_*/src`
-PATH=${PATH}:${BUILD_PATH}:${HOME}/kiwiclient
-CODEC2=${MY_PATH}/..
-
-kiwi_url=""
-port=8074
-freq_kHz="7177"
-tx_only=0
-Nbursts=5
-mode="700D"
-model=361
-gain=6
-serialPort="/dev/ttyUSB0"
-rxwavefile=0
-soundDevice="plughw:CARD=CODEC,DEV=0"
-txstats=0
-stationid=""
-
-function print_help {
- echo
- echo "Automated Over The Air (OTA) voice test for FreeDV HF voice modes"
- echo
- echo " usage ./ota_voice_test.sh [options] SpeechWaveFile [kiwi_url]"
- echo " or:"
- echo " usage ./ota_voice_test.sh -r rxWaveFile"
- echo
- echo " -c dev The sound device (in ALSA format on Linux, CoreAudio for macOS)"
- echo " -d debug mode; trace script execution"
- echo " -f Frequency (kHz)"
- echo " -g SSB (analog) compressor gain"
- echo " -i StationIDWaveFile Prepend this file to identify transmission (should be 8KHz mono)"
- echo " -m mode 700c|700d|700e"
- echo " -o model select radio model number ('rigctl -l' to list)"
- echo " -p port kiwi_url port to use (default 8073)."
- echo " -r Rx wave file mode: Rx process supplied rx wave file"
- echo " -s SerialPort The serial port (or hostname:port) to control SSB radio,"
- echo " default /dev/ttyUSB0"
- echo " -t Tx only, useful for manually observing SDRs"
- echo " -x Generate tx.wav file and exit"
- echo
- exit
-}
-
-# Approximation of Hilbert clipper type compressor. Could do with some HF boost
-function analog_compressor {
- input_file=$1
- output_file=$2
- gain=$3
- cat $input_file | ch - - 2>/dev/null | \
- ch - - --No -100 --clip 16384 --gain $gain 2>/dev/null | \
- # final line prints peak and CPAPR for SSB
- ch - - --clip 16384 |
- # manually adjusted to get similar peak levels for SSB and FreeDV
- sox -t .s16 -r 8000 -c 1 -v 0.85 - -t .s16 $output_file
-}
-
-function run_rigctl {
- command=$1
- model=$2
- echo $command | rigctl -m $model -r $serialPort > /dev/null
- if [ $? -ne 0 ]; then
- echo "Can't talk to Tx"
- clean_up
- exit 1
- fi
-}
-
-function clean_up {
- echo "killing KiwiSDR process"
- kill ${kiwi_pid}
- wait ${kiwi_pid} 2>/dev/null
- exit 1
-}
-
-function process_rx {
- echo "Process receiver sample"
- rx=$1
- # generate spectrogram
- echo "pkg load signal; warning('off', 'all'); \
- s=load_raw('${rx}'); \
- plot_specgram(s, 8000, 200, 3000); print('spec.jpg', '-djpg'); \
- quit" | octave-cli -p ${CODEC2}/octave -qf > /dev/null
- # attempt to decode
- freedv_rx ${mode} ${rx} - -v --passthroughgain 1.0 2>rx_stats.txt | sox -t .s16 -r $speechFs -c 1 - rx_freedv.wav
- cat rx_stats.txt | tr -s ' ' | cut -f5 -d' ' | awk '$0==($0+0)' > sync.txt
- cat rx_stats.txt | tr -s ' ' | cut -f10 -d' ' | awk '$0==($0+0)' > snr.txt
- # time domain plot of output speech, SNR, and sync
- echo "pkg load signal; warning('off', 'all'); \
- s=load_raw('rx_freedv.wav'); snr=load('snr.txt'); sync=load('sync.txt'); \
- subplot(211); plot(s); subplot(212); x=1:length(sync); plotyy(x,snr,x,sync); \
- ylim([-5 15]); ylabel('SNR (dB)'); grid; \
- print('time_snr.jpg', '-djpg'); \
- printf('Nsync: %3d\n', sum(sync)); \
- snr_valid = snr(find(snr != -5.0)); \
- if length(snr_valid) printf('SNRav: %5.2f\n', mean(snr_valid)); else printf('SNRav: %5.2f\n', -5); end;
- quit" | octave-cli -p ${CODEC2}/octave -qf
-}
-
-POSITIONAL=()
-while [[ $# -gt 0 ]]
-do
-key="$1"
-case $key in
- -d)
- set -x
- shift
- ;;
- -f)
- freq_kHz="$2"
- shift
- shift
- ;;
- -g)
- gain="$2"
- shift
- shift
- ;;
- -i)
- stationid="$2"
- shift
- shift
- ;;
- -o)
- model="$2"
- shift
- shift
- ;;
- -m)
- mode="$2"
- shift
- shift
- ;;
- -p)
- port="$2"
- shift
- shift
- ;;
- -t)
- tx_only=1
- shift
- ;;
- -r)
- rxwavefile=1
- shift
- ;;
- -x)
- txstats=1
- shift
- ;;
- -c)
- soundDevice="$2"
- shift
- shift
- ;;
- -s)
- serialPort="$2"
- shift
- shift
- ;;
- -h)
- print_help
- ;;
- *)
- POSITIONAL+=("$1") # save it in an array for later
- shift
- ;;
-esac
-done
-set -- "${POSITIONAL[@]}" # restore positional parameters
-
-# determine sample rate of freedv_tx/freedv_rx
-speechFs=8000
-if [ "$mode" == "2020" ] || [ "$mode" == "2020B" ] || [ "$mode" == "2020C" ]; then
- speechFs=16000
-fi
-
-if [ $rxwavefile -eq 1 ]; then
- process_rx $1
- exit 0
-fi
-
-speechfile="$1"
-if [ ! -f $speechfile ]; then
- echo "Can't find input speech wave file: ${speechfile}!"
- exit 1
-fi
-
-if [ $tx_only -eq 0 ]; then
- if [ $# -lt 1 ]; then
- print_help
- fi
- kiwi_url="$2"
- echo $kiwi_url
-fi
-
-# create Tx file ------------------------
-echo $mode
-
-# create compressed analog
-speechfile_raw_8k=$(mktemp)
-comp_in=$(mktemp)
-speech_comp=$(mktemp)
-speech_freedv=$(mktemp)
-# If 16kHz input files for 2020x, we need an 8kHz version for SSB
-sox $speechfile -r 8000 -t .s16 -c 1 $speechfile_raw_8k
-if [ -z $stationid ]; then
- cp $speechfile_raw_8k $comp_in
-else
- # append station ID and apply analog compression
- stationid_raw_8k=$(mktemp)
- sox $stationid -r 8000 -t .s16 -c 1 $stationid_raw_8k
- cat $stationid_raw_8k $speechfile_raw_8k> $comp_in
-fi
-analog_compressor $comp_in $speech_comp $gain
-
-# create modulated FreeDV, with compressor enabled
-sox $speechfile -t .s16 -r $speechFs - | freedv_tx $mode - $speech_freedv --clip 1
-cat $speech_comp $speech_freedv > tx.raw
-sox -t .s16 -r 8000 -c 1 tx.raw tx.wav
-
-if [ $txstats -eq 1 ]; then
- # ch just used to monitor observe peak and RMS level
- ch $speech_freedv /dev/null
- # time domain plot of tx signal
- echo "pkg load signal; warning('off', 'all'); \
- s=load_raw('tx.raw'); plot(s); \
- print('tx.jpg', '-djpg'); \
- quit" | octave-cli -p ${CODEC2}/octave -qf > /dev/null
- exit 0
-fi
-
-# kick off KiwiSDR ----------------------------
-
-usb_lsb=$(python3 -c "print('usb') if ${freq_kHz} >= 10000 else print('lsb')")
-if [ $tx_only -eq 0 ]; then
- # clean up any kiwiSDR processes if we get a ctrl-C
- trap clean_up SIGHUP SIGINT SIGTERM
-
- echo -n "waiting for KiwiSDR "
- # start recording from remote kiwisdr
- kiwi_stdout=$(mktemp)
- kiwirecorder.py -s $kiwi_url -p ${port} -f $freq_kHz -m ${usb_lsb} -r 8000 --filename=rx --time-limit=300 >$kiwi_stdout &
- kiwi_pid=$!
-
- # wait for kiwi to start recording
- timeout_counter=0
- until grep -q -i 'Block: ' $kiwi_stdout
- do
- timeout_counter=$((timeout_counter+1))
- if [ $timeout_counter -eq 10 ]; then
- echo "can't connect to ${kiwi_url}"
- kill ${kiwi_pid}
- wait ${kiwi_pid} 2>/dev/null
- exit 1
- fi
- echo -n "."
- sleep 1
- done
- echo
-fi
-
-# transmit using local SSB radio
-echo "Tx data signal"
-freq_Hz=$((freq_kHz*1000))
-usb_lsb_upper=$(echo ${usb_lsb} | awk '{print toupper($0)}')
-run_rigctl "\\set_mode PKT${usb_lsb_upper} 0" $model
-run_rigctl "\\set_freq ${freq_Hz}" $model
-run_rigctl "\\set_ptt 1" $model
-if [ `uname` == "Darwin" ]; then
- AUDIODEV="${soundDevice}" play -t raw -b 16 -c 1 -r 8000 -e signed-integer --endian little tx.raw
-else
- aplay --device="${soundDevice}" -f S16_LE tx.raw 2>/dev/null
-fi
-if [ $? -ne 0 ]; then
- run_rigctl "\\set_ptt 0" $model
- clean_up
- echo "Problem running aplay!"
- echo "Is ${soundDevice} configured as the default sound device in Settings-Sound?"
- exit 1
-fi
-run_rigctl "\\set_ptt 0" $model
-
-if [ $tx_only -eq 0 ]; then
- sleep 2
- echo "Stopping KiwiSDR"
- kill ${kiwi_pid}
- wait ${kiwi_pid} 2>/dev/null
-
- process_rx rx.wav
-fi
-
diff --git a/unittest/raw_data_curves/Makefile b/unittest/raw_data_curves/Makefile
deleted file mode 100644
index 9f13d1f..0000000
--- a/unittest/raw_data_curves/Makefile
+++ /dev/null
@@ -1,132 +0,0 @@
-# Makefile
-# Dec 2022
-#
-# Automates PER/BER curve generation for raw data mode:
-#
-# 1. Compare "ch" noise injection/SNR measurement against reference Octave Tx
-# 2. Compare C Tx against Octave Tx (with and without compression)
-# 3. Plot curves for SNR estimated from C Rx against actual SNR
-# 4. Plot AWGN/PER C Tx curves for end user documentation
-
-SHELL := /bin/bash
-CODEC2 := $(HOME)/codec2
-
-all: test \
- octave_ch_noise_awgn.png octave_c_tx_awgn.png octave_c_tx_comp_awgn.png \
- octave_ch_noise_mpp.png octave_c_tx_mpp.png octave_c_tx_comp_mpp.png \
- snrest_snr_ctx.png snrest_snr_ctxc.png \
- c_tx_comp.png c_tx_comp_thruput.png
-
-clean:
- rm -f *.txt *.png *.raw
-
-# run this first, traps common CML setup error
-test:
- source snr_curves.sh; test_ldpc
-
-# subset of files generated, but enough to set up Makefile dependencies
-snr_oct = snr_oct_datac0_awgn.txt snr_oct_datac1_awgn.txt snr_oct_datac3_awgn.txt
-snr_ch = snr_ch_datac0_awgn.txt snr_ch_datac1_awgn.txt snr_ch_datac3_awgn.txt
-snr_ctx = snr_ctx_datac0_awgn.txt snr_ctx_datac1_awgn.txt snr_ctx_datac3_awgn.txt
-snr_ctxc = snr_ctxc_datac0_awgn.txt snr_ctxc_datac3_awgn.txt
-
-snr_oct_mpp = snr_oct_datac0_mpp.txt snr_oct_datac1_mpp.txt snr_oct_datac3_mpp.txt
-snr_ch_mpp = snr_ch_datac0_mpp.txt snr_ch_datac1_mpp.txt snr_ch_datac3_mpp.txt
-snr_ctx_mpp = snr_ctx_datac0_mpp.txt snr_ctx_datac1_mpp.txt snr_ctx_datac3_mpp.txt
-snr_ctxc_mpp = snr_ctxc_datac0_mpp.txt snr_ctxc_datac3_mpp.txt
-
-$(snr_oct):
- source snr_curves.sh; generate_octave_tx_data datac0 awgn
- source snr_curves.sh; generate_octave_tx_data datac1 awgn
- source snr_curves.sh; generate_octave_tx_data datac3 awgn
-
-$(snr_oct_mpp):
- source snr_curves.sh; generate_octave_tx_data datac0 mpp
- source snr_curves.sh; generate_octave_tx_data datac1 mpp
- source snr_curves.sh; generate_octave_tx_data datac3 mpp
-
-$(snr_ch):
- source snr_curves.sh; generate_ch_data datac0 awgn
- source snr_curves.sh; generate_ch_data datac1 awgn
- source snr_curves.sh; generate_ch_data datac3 awgn
-
-$(snr_ch_mpp):
- source snr_curves.sh; generate_ch_data datac0 mpp
- source snr_curves.sh; generate_ch_data datac1 mpp
- source snr_curves.sh; generate_ch_data datac3 mpp
-
-# C without compression
-
-$(snr_ctx):
- source snr_curves.sh; generate_snrest_v_snr_data datac0 awgn
- source snr_curves.sh; generate_snrest_v_snr_data datac1 awgn
- source snr_curves.sh; generate_snrest_v_snr_data datac3 awgn
- source snr_curves.sh; generate_snrest_v_snr_data datac4 awgn
- source snr_curves.sh; generate_snrest_v_snr_data datac13 awgn
-
-$(snr_ctx_mpp):
- source snr_curves.sh; generate_snrest_v_snr_data datac0 mpp
- source snr_curves.sh; generate_snrest_v_snr_data datac1 mpp
- source snr_curves.sh; generate_snrest_v_snr_data datac3 mpp
- source snr_curves.sh; generate_snrest_v_snr_data datac4 mpp
- source snr_curves.sh; generate_snrest_v_snr_data datac13 mpp
-
-# C with compression
-
-$(snr_ctxc):
- source snr_curves.sh; generate_snrest_v_snr_data datac0 awgn 1
- source snr_curves.sh; generate_snrest_v_snr_data datac1 awgn 1
- source snr_curves.sh; generate_snrest_v_snr_data datac3 awgn 1
- source snr_curves.sh; generate_snrest_v_snr_data datac4 awgn 1
- source snr_curves.sh; generate_snrest_v_snr_data datac13 awgn 1
-
-$(snr_ctxc_mpp):
- source snr_curves.sh; generate_snrest_v_snr_data datac0 mpp 1
- source snr_curves.sh; generate_snrest_v_snr_data datac1 mpp 1
- source snr_curves.sh; generate_snrest_v_snr_data datac3 mpp 1
- source snr_curves.sh; generate_snrest_v_snr_data datac4 mpp 1
- source snr_curves.sh; generate_snrest_v_snr_data datac13 mpp 1
-
-# Octave and C curves should be on top of each other, indicating Octave
-# and ch noise injection/SNR measurement are equivalent
-octave_ch_noise_awgn.png: $(snr_oct) $(snr_ch)
- echo "snr_curves_plot; octave_ch_noise_print('awgn'); quit" | \
- octave-cli -p $(CODEC2)/octave
-octave_ch_noise_mpp.png: $(snr_oct_mpp) $(snr_ch_mpp)
- echo "snr_curves_plot; octave_ch_noise_print('mpp'); quit" | \
- octave-cli -p $(CODEC2)/octave
-
-# Octave Tx and C Tx curves should be on top of each other
-octave_c_tx_awgn.png: $(snr_oct) $(snr_ctx)
- echo "snr_curves_plot; octave_c_tx_print('awgn'); quit" | \
- octave-cli -p $(CODEC2)/octave
-octave_c_tx_mpp.png: $(snr_oct_mpp) $(snr_ctx_mpp)
- echo "snr_curves_plot; octave_c_tx_print('mpp'); quit" | \
- octave-cli -p $(CODEC2)/octave
-
-# Octave Tx and C Tx (compressed) curves should be close, but C may be 1dB
-# poorer
-octave_c_tx_comp_awgn.png: $(snr_oc) $(snr_ctxc)
- echo "snr_curves_plot; octave_c_tx_comp_print('awgn'); quit" | \
- octave-cli -p $(CODEC2)/octave
-octave_c_tx_comp_mpp.png: $(snr_oct_mpp) $(snr_ctxc_mpp)
- echo "snr_curves_plot; octave_c_tx_comp_print('mpp'); quit" | \
- octave-cli -p $(CODEC2)/octave
-
-# combined AWGN and MPP from C Tx (compressed) - what end users would run
-c_tx_comp.png: $(snr_ctxc) $(snr_ctxc_mpp)
- echo "snr_curves_plot; c_tx_comp_print; quit" | \
- octave-cli -p $(CODEC2)/octave
-
-# Curves of SNR estimates from C Rx compared to actual SNR, useful for "gear shifting"
-snrest_snr_ctx.png: $(snr_ctx)
- echo "snr_curves_plot; snrest_snr_print('ctx', 'awgn'); quit" | \
- octave-cli -p $(CODEC2)/octave
-snrest_snr_ctxc.png: $(snr_ctxc)
- echo "snr_curves_plot; snrest_snr_print('ctxc', 'awgn'); quit" | \
- octave-cli -p $(CODEC2)/octave
-
-# Throughput of payload data in bits/s of modes against SNR
-c_tx_comp_thruput.png: $(snr_ctxc) $(snr_ctxc_mpp)
- echo "snr_curves_plot; c_tx_comp_thruput_print; quit" | \
- octave-cli -p $(CODEC2)/octave
diff --git a/unittest/raw_data_curves/snr_curves.sh b/unittest/raw_data_curves/snr_curves.sh
deleted file mode 100755
index 6da671c..0000000
--- a/unittest/raw_data_curves/snr_curves.sh
+++ /dev/null
@@ -1,184 +0,0 @@
-# snr_curves.sh
-#
-# Library of bash functions to generate data for SNR curves.
-#
-# testing a function example:
-# $ bash -c "source ./snr_curves.sh; generate_octave_tx_data datac0 awgn"
-
-set -x
-
-PATH=${PATH}:${HOME}/codec2/build_linux/src
-CODEC2=${HOME}/codec2
-FADING_DIR=${CODEC2}/build_linux/unittest
-
-snr_list='-5 -4 -3 -2 0 1 2 4'
-No_list='-13 -14 -15 -16 -18 -20 -22 -24 -26'
-Nbursts_awgn=20
-Nbursts_mpp=100
-
-# Octave Tx injects noise and is source of truth for SNR, measure BER/PER v SNR
-function generate_octave_tx_data {
- mode=$1
- channel=$2
-
- Nbursts=$Nbursts_awgn
- snr_nudge=0
- if [ "$channel" == "mpp" ]; then
- Nbursts=$Nbursts_mpp
- snr_nudge=4
- fi
-
- rx_log=$(mktemp)
-
- i=1
- rm -f snr_oct_${mode}_${channel}*.txt
- rm -f ber_oct_${mode}_${channel}*.txt
- rm -f per_oct_${mode}_${channel}*.txt
- for snr in $snr_list
- do
- snr_adj=$((${snr}+${snr_nudge}))
- echo "warning ('off', 'Octave:data-file-in-path');
- ofdm_ldpc_tx('test_${mode}.raw','${mode}',1,${snr_adj},'${channel}','bursts',${Nbursts},'crc');
- quit" | DISPLAY="" octave-cli -p ${CODEC2}/octave
- freedv_data_raw_rx --testframes $mode test_${mode}.raw /dev/null 2>${rx_log} -v
- BERmeas=$(cat ${rx_log} | grep 'BER......:' | cut -d' ' -f2)
- PERmeas=$(cat ${rx_log} | grep 'Coded FER' | cut -d' ' -f3)
-
- echo ${snr_adj} >> snr_oct_${mode}_${channel}.txt
- echo ${BERmeas} >> ber_oct_${mode}_${channel}.txt
- echo ${PERmeas} >> per_oct_${mode}_${channel}.txt
- i=$((i+1))
- done
- echo 0 > offset_oct_${mode}_${channel}.txt
-}
-
-# ch injects noise and is source of truth for SNR, measure BER/PER v SNR
-# Octave Tx
-function generate_ch_data {
- mode=$1
- channel=$2
-
- ch_multipath=''
- Nbursts=$Nbursts_awgn
- snr_nudge=0
- if [ "$channel" == "mpp" ]; then
- ch_multipath='--mpp'
- Nbursts=$Nbursts_mpp
- snr_nudge=4
- fi
-
- octave_log=$(mktemp)
- ch_log=$(mktemp)
- rx_log=$(mktemp)
-
- i=1
- rm -f snr_ch_${mode}_${channel}*.txt
- rm -f ber_ch_${mode}_${channel}*.txt
- rm -f per_ch_${mode}_${channel}*.txt
- for No in $No_list
- do
- No_adj=$((${No}-${snr_nudge}))
- echo "warning ('off', 'Octave:data-file-in-path');
- ofdm_ldpc_tx('test_${mode}.raw','${mode}',1,100,'awgn','bursts',${Nbursts},'crc');
- quit" | DISPLAY="" octave-cli -p ${CODEC2}/octave 1>${octave_log}
- SNRoffset=$(cat ${octave_log} | grep 'Burst offset:' | cut -d' ' -f5)
-
- ch test_${mode}.raw - --No $No_adj ${ch_multipath} --fading_dir ${FADING_DIR} 2>>${ch_log} | \
- freedv_data_raw_rx --testframes $mode - /dev/null -v 2>${rx_log}
- BERmeas=$(cat ${rx_log} | grep 'BER......:' | cut -d' ' -f2)
- PERmeas=$(cat ${rx_log} | grep 'Coded FER' | cut -d' ' -f3)
-
- echo ${BERmeas} >> ber_ch_${mode}_${channel}.txt
- echo ${PERmeas} >> per_ch_${mode}_${channel}.txt
- i=$((i+1))
- done
-
- echo ${SNRoffset} > offset_ch_${mode}_${channel}.txt
- SNRch=$(cat ${ch_log} | grep SNR3k | tr -s ' ' | cut -d' ' -f3)
- echo ${SNRch} > snr_ch_${mode}_${channel}.txt
-}
-
-# ch injects noise and is source of truth for SNR, measure BER/PER v SNR and
-# SNR estimates v SNR from rx, C Tx
-function generate_snrest_v_snr_data {
- mode=$1
- channel=$2
-
- snr_nudge=0
- aNo_list=$No_list
-
- # nudge SNR test range to get meaningful results for these tests
- if [ "$mode" == "datac1" ]; then
- snr_nudge=4
- fi
- if [[ "$mode" == "datac4" || "$mode" == "datac13" ]]; then
- snr_nudge=-6
- fi
-
- ch_multipath=''
- Nbursts=$Nbursts_awgn
- if [ "$channel" == "mpp" ]; then
- ch_multipath='--mpp'
- Nbursts=$Nbursts_mpp
- snr_nudge=$((${snr_nudge}+4))
- fi
-
- clip=0
- id='ctx'
- if [ "$#" -eq 3 ]; then
- clip=$3
- id='ctxc'
- snr_nudge=$((${snr_nudge}-4))
- fi
-
- tx_log=$(mktemp)
- ch_log=$(mktemp)
- rx_log=$(mktemp)
-
- i=1
- rm -f snrest_${id}_${mode}_${channel}*.txt
- rm -f ber_${id}_${mode}_${channel}*.txt
- rm -f per_${id}_${mode}_${channel}*.txt
- for No in $aNo_list
- do
- No_adj=$((${No}-${snr_nudge}))
- freedv_data_raw_tx --clip ${clip} --delay 1000 --txbpf ${clip} --bursts $Nbursts --testframes $Nbursts $mode /dev/zero - 2>${tx_log} | \
- ch - - --No $No_adj ${ch_multipath} --fading_dir ${FADING_DIR} 2>>${ch_log} | \
- freedv_data_raw_rx --testframes $mode - /dev/null 2>${rx_log} -v
- SNRoffset=$(cat ${tx_log} | grep "mark:space" | tr -s ' ' | cut -d' ' -f 5)
-
- SNRest=$(cat ${rx_log} | grep '\-BS\-' | tr -s ' ' | cut -d' ' -f17)
- if [ ! -z "$SNRest" ]; then
- echo ${SNRest} > snrest_${id}_${mode}_${channel}_${i}.txt
- fi
- BERmeas=$(cat ${rx_log} | grep 'BER......:' | cut -d' ' -f2)
- PERmeas=$(cat ${rx_log} | grep 'Coded FER' | cut -d' ' -f3)
- echo ${BERmeas} >> ber_${id}_${mode}_${channel}.txt
- echo ${PERmeas} >> per_${id}_${mode}_${channel}.txt
- i=$((i+1))
- done
-
- echo ${SNRoffset} > offset_${id}_${mode}_${channel}.txt
-
- # trap not enough fading file samples (with mpp)
- grep "Fading file finished" ${ch_log}
- if [ $? -eq 0 ]; then
- cat ${ch_log}
- exit 1
- fi
- SNRch=$(cat ${ch_log} | grep SNR3k | tr -s ' ' | cut -d' ' -f3)
- echo ${SNRch} > snr_${id}_${mode}_${channel}.txt
-}
-
-# Sanity check to make sure Octave/CML is set up OK
-function test_ldpc {
- echo "ldpcut; quit" | DISPLAY="" octave-cli -p ${CODEC2}/octave
- if [ "$?" -ne 0 ]; then
- echo "basic octave test failed, you may need to"
- echo "(a) run ctests to create build_xxx/cml"
- echo "(b) set up ~/.octaverc as per octave/ldpc.m"
- exit 1
- else
- echo "OK"
- fi
-}
diff --git a/unittest/sd.c b/unittest/sd.c
deleted file mode 100644
index 1d1a628..0000000
--- a/unittest/sd.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*--------------------------------------------------------------------------*\
-
- FILE........: sd.c
- AUTHOR......: David Rowe
- DATE CREATED: 20/7/93
-
- Function to determine spectral distortion between two sets of LPCs.
-
-\*--------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2009 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.1, 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/>.
-*/
-
-#define MAX_N 2048 /* maximum DFT size */
-
-#include <math.h>
-#include "four1.h"
-#include "comp.h"
-#include "sd.h"
-
-/*---------------------------------------------------------------------------*\
-
- FUNCTION....: spectral_dist()
-
- AUTHOR......: David Rowe
- DATE CREATED: 20/7/93
-
- This function returns the soectral distoertion between two
- sets of LPCs.
-
-\*---------------------------------------------------------------------------*/
-
-float spectral_dist(float ak1[], float ak2[], int p, int n)
-/* float ak1[]; unquantised set of p+1 LPCs */
-/* float ak2[]; quantised set of p+1 LPCs */
-/* int p; LP order */
-/* int n; DFT size to use for SD calculations (power of 2) */
-{
- COMP A1[MAX_N]; /* DFT of ak1[] */
- COMP A2[MAX_N]; /* DFT of ak2[] */
- float P1,P2; /* power of current bin */
- float sd;
- int i;
-
- for(i=0; i<n; i++) {
- A1[i].real = 0.0;
- A1[i].imag = 0.0;
- A2[i].real = 0.0;
- A2[i].imag = 0.0;
- }
-
- for(i=0; i<p+1; i++) {
- A1[i].real = ak1[i];
- A2[i].real = ak2[i];
- }
-
- #warn Array index -1 is out of bounds
- four1(&A1[-1].imag,n,-1);
- four1(&A2[-1].imag,n,-1);
-
- sd = 0.0;
- for(i=0; i<n; i++) {
- P1 = A1[i].real*A1[i].real + A1[i].imag*A1[i].imag;
- P2 = A2[i].real*A2[i].real + A2[i].imag*A2[i].imag;
- sd += pow(log10(P2/P1),2.0);
- }
- sd = 10.0*sqrt(sd/n); /* sd in dB */
-
- return(sd);
-}
diff --git a/unittest/sd.h b/unittest/sd.h
deleted file mode 100644
index 866b95b..0000000
--- a/unittest/sd.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*--------------------------------------------------------------------------*\
-
- FILE........: sd.h
- AUTHOR......: David Rowe
- DATE CREATED: 22/7/93
-
- Function to determine spectral distortion between two sets of LPCs.
-
-\*--------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2009 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.1, 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/>.
-*/
-
-#ifndef __SD__
-#define __SD__
-
-float spectral_dist(float ak1[], float ak2[], int p, int n);
-
-#endif /* __SD__ */
diff --git a/unittest/spectrogram.sh b/unittest/spectrogram.sh
deleted file mode 100755
index 87d3fa2..0000000
--- a/unittest/spectrogram.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env bash
-# spectrogram.sh
-#
-# Render a spectrogram from a wave file.
-
-PATH=${PATH}:${HOME}/codec2/build_linux/src
-CODEC2=${HOME}/codec2
-
-fullfile=$1
-filename=$(basename -- "$fullfile")
-extension="${filename##*.}"
-filename="${filename%.*}"
-
-echo "pkg load signal; warning('off', 'all'); \
- s=load_raw('${fullfile}'); \
- plot_specgram(s, 8000, 500, 2500); print('${filename}.jpg', '-djpg'); \
- quit" | octave-cli -p ${CODEC2}/octave -qf > /dev/null
diff --git a/unittest/t_helpers.c b/unittest/t_helpers.c
deleted file mode 100644
index 4f20743..0000000
--- a/unittest/t_helpers.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "t_helpers.h"
-
-void test(char * tfn)
-{
- fn = tfn;
- printf("========================================\n");
- printf("test function: %s\n", fn);
- printf("========================================\n");
-}
-
-void test_failed()
-{
- printf("Failed to calculate %s.\n", fn);
- exit(1);
-}
-
-void test_failed_s(char * expected, char * res)
-{
-
- printf("Failed to calculate %s.\n", fn);
-
- printf("expected: %s\ngot: %s\n", expected, res);
- exit(1);
-}
-
-void test_failed_f(float expected, float res)
-{
-
- printf("Failed to calculate %s.\n", fn);
- printf("expected: %f\ngot: %f\n", expected, res);
- exit(1);
-}
-
diff --git a/unittest/t_helpers.h b/unittest/t_helpers.h
deleted file mode 100644
index 2dfcbef..0000000
--- a/unittest/t_helpers.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*---------------------------------------------------------------------------*\
-
- FILE........: t_helpers.c
- AUTHOR......: Phil Ayres
- DATE CREATED: July 2017
-
- * Simple helper functions for unit tests
- *
-\*---------------------------------------------------------------------------*/
-
-/*
- Copyright David Rowe 2017
-
- 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.1, 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/>.
-
- */
-
-#ifndef T_HELPERS_H
-#define T_HELPERS_H
-
-void test(char * tfn);
-void test_failed();
-void test_failed_s(char * expected, char * res);
-void test_failed_f(float expected, float res);
-
-char *fn;
-
-
-#endif /* T_HELPERS_H */
-
diff --git a/unittest/tcontphase.c b/unittest/tcontphase.c
deleted file mode 100644
index 02e51b2..0000000
--- a/unittest/tcontphase.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*---------------------------------------------------------------------------*\
-
- FILE........: tcontphase.c
- AUTHOR......: David Rowe
- DATE CREATED: 11/9/09
-
- Test program for developing continuous phase track synthesis algorithm.
- However while developing this it was discovered that synthesis_mixed()
- worked just as well.
-
-\*---------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2009 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.1, 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/>.
-*/
-
-#define N 80 /* frame size */
-#define F 160 /* frames to synthesis */
-#define P 10 /* LPC order */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "sine.h"
-#include "dump.h"
-#include "synth.h"
-#include "phase.h"
-
-int frames;
-
-float ak[] = {
- 1.000000,
--1.455836,
- 1.361841,
--0.879267,
- 0.915985,
--1.002202,
- 0.944103,
--0.743094,
- 1.053356,
--0.817491,
- 0.431222
-};
-
-
-/*---------------------------------------------------------------------------*\
-
- switch_present()
-
- Searches the command line arguments for a "switch". If the switch is
- found, returns the command line argument where it ws found, else returns
- NULL.
-
-\*---------------------------------------------------------------------------*/
-
-int switch_present(sw,argc,argv)
- char sw[]; /* switch in string form */
- int argc; /* number of command line arguments */
- char *argv[]; /* array of command line arguments in string form */
-{
- int i; /* loop variable */
-
- for(i=1; i<argc; i++)
- if (!strcmp(sw,argv[i]))
- return(i);
-
- return 0;
-}
-
-/*---------------------------------------------------------------------------*\
-
- MAIN
-
-\*---------------------------------------------------------------------------*/
-
-int main(argc,argv)
-int argc;
-char *argv[];
-{
- FILE *fout;
- short buf[N];
- int i,j;
- int dump;
- float phi_prev[MAX_AMP];
- float Wo_prev, ex_phase, G;
- //float ak[P+1];
- COMP H[MAX_AMP];
- float f0;
-
- if (argc < 3) {
- printf("\nusage: %s OutputRawSpeechFile F0\n", argv[0]);
- exit(1);
- }
-
- /* Output file */
-
- if ((fout = fopen(argv[1],"wb")) == NULL) {
- printf("Error opening output speech file: %s\n",argv[1]);
- exit(1);
- }
-
- f0 = atof(argv[2]);
-
- dump = switch_present("--dump",argc,argv);
- if (dump)
- dump_on(argv[dump+1]);
-
- init_decoder();
-
- for(i=0; i<MAX_AMP; i++)
- phi_prev[i] = 0.0;
- Wo_prev = 0.0;
-
- model.Wo = PI*(f0/4000.0);
- G = 1000.0;
- model.L = floor(PI/model.Wo);
-
- //aks_to_H(&model, ak, G , H, P);
- //for(i=1; i<=model.L; i++)
- model.A[i] = sqrt(H[i].real*H[i].real + H[i].imag*H[i].imag);
- //printf("L = %d\n", model.L);
- //model.L = 10;
- for(i=1; i<=model.L; i++) {
- model.A[i] = 1000/model.L;
- model.phi[i] = 0;
- H[i].real = 1.0; H[i].imag = 0.0;
- }
-
- //ak[0] = 1.0;
- //for(i=1; i<=P; i++)
- // ak[i] = 0.0;
-
- frames = 0;
- for(j=0; j<F; j++) {
- frames++;
-
- #ifdef SWAP
- /* lets make phases bounce around from frame to frame. This
- could happen if H[m] is varying, for example due to frame
- to frame Wo variations, or non-stationary speech.
- Continuous model generally results in smooth phase track
- under these circumstances. */
- if (j%2){
- H[1].real = 1.0; H[1].imag = 0.0;
- model.phi[1] = 0.0;
- }
- else {
- H[1].real = 0.0; H[1].imag = 1.0;
- model.phi[1] = PI/2;
- }
- #endif
-
- //#define CONT
- #ifdef CONT
- synthesise_continuous_phase(Pn, &model, Sn_, 1, &Wo_prev, phi_prev);
- #else
- phase_synth_zero_order(5.0, H, &Wo_prev, &ex_phase);
- synthesise_mixed(Pn,&model,Sn_,1);
- #endif
-
- for(i=0; i<N; i++)
- buf[i] = Sn_[i];
- fwrite(buf,sizeof(short),N,fout);
- }
-
- fclose(fout);
- if (dump) dump_off();
-
- return 0;
-}
-
-
diff --git a/unittest/tdeframer.c b/unittest/tdeframer.c
deleted file mode 100644
index 03e8bb1..0000000
--- a/unittest/tdeframer.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*---------------------------------------------------------------------------*\
-
- FILE........: tdeframer.c
- AUTHOR......: Brady O'Brien
- DATE CREATED: 8 April 2016
-
- C unit test for the VHF framer/deframer used by modes 2400A and 2400B.
- The deframer should sync up within one frame at a BER of 10e-3
-\*---------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2016 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.1, 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/>.
-*/
-
-/* BER of test */
-#define TESTBER 0.01
-
-/* Frame count */
-#define FRCNT 1500
-
-/* Random bits leading frame */
-#define LRCNT 44
-
-#include <stdio.h>
-#include <math.h>
-#include <stdint.h>
-#include <freedv_vhf_framing.h>
-#include <golay23.h>
-#include <string.h>
-
-/* The main loop of the test driver */
-int main(int argc,char *argv[]){
- uint8_t * bit_buffer;
- uint8_t c2_buffer[10];
- struct freedv_vhf_deframer * fvd;
- int i,p,k;
- int bitbufferlen;
- int fsize;
- int ftype;
- int first_tol;
-
- if(argc<2){
- fprintf(stderr,"Usage: %s [A|B]\n",argv[0]);
- exit(1);
- }
-
- if(strcmp(argv[1],"A")==0){
- ftype = FREEDV_VHF_FRAME_A;
- first_tol = 2;
- }else if(strcmp(argv[1],"B")==0){
- ftype = FREEDV_HF_FRAME_B;
- first_tol = 5;
- }else{
- fprintf(stderr,"Usage: %s [A|B]\n",argv[0]);
- exit(1);
- }
-
- srand(1);
- golay23_init();
-
- /* Set up the deframer */
- fvd = fvhff_create_deframer(ftype,1);
-
- fsize = fvhff_get_frame_size(fvd);
- bitbufferlen = (LRCNT+fsize*FRCNT);
-
- /* Allocate bit buffer */
- bit_buffer = (uint8_t *) malloc(sizeof(uint8_t)*bitbufferlen);
- p = 0;
-
- /* Fill out front of buffer */
- for(i=0; i<LRCNT; i++){
- bit_buffer[p++] = rand()&0x1;
- }
-
- /* Place frames */
- for(i=0; i<FRCNT; i++){
- /* Encode frame index into golay codeword to protect from test BER*/
- k = golay23_encode((i+1)&0x0FFF);
- c2_buffer[5] = (k )&0xFF;
- c2_buffer[1] = (k>>8 )&0xFF;
- c2_buffer[0] = (k>>16)&0x7F;
- /* Frame the bits */
- fvhff_frame_bits(ftype, &bit_buffer[p+(i*fsize)], c2_buffer,NULL,NULL);
- }
-
- /* Flip bits */
- for(i=0; i<bitbufferlen; i++){
- if( (rand()&0xFFFFFF) < (int)(TESTBER*0xFFFFFF)){
- bit_buffer[i] = bit_buffer[i]?0:1;
- }
- }
-
- p=0;
- int first_extract = 0;
- int total_extract = 0;
- int err_count = 0;
- printf("\n");
- /* Deframe some bits */
- for(i=0; i<bitbufferlen; i+=fsize){
- if( fvhff_deframe_bits(fvd, c2_buffer, NULL, NULL, &bit_buffer[i])){
- /* Extract golay23 codeword */
- k = ((int)c2_buffer[5]) ;
- k |= ((int)c2_buffer[1])<<8 ;
- k |= ((int)c2_buffer[0])<<16;
- k = k & 0x7FFFFF;
- /* Decode frame index */
- p = golay23_decode(k);
- err_count += golay23_count_errors(k,p);
- p = p>>11;
-
- printf("%d,\t",p);
- total_extract++;
- if(first_extract==0)
- first_extract=p;
- }
- }
- printf("\n");
- float measured_ber = (float)err_count/(float)(23*total_extract);
-
- printf("First extracted frame %d\n",first_extract);
- printf("Extracted %d frames of %d, %f hit rate\n",total_extract,FRCNT,((float)total_extract/(float)FRCNT));
- printf("Bit error rate %f measured from golay code\n",measured_ber);
- printf("Bit error rate %f measured by deframer\n",fvd->ber_est);
- printf("Bit error rate %f measured by deframer\n",(float)fvd->total_uw_err/(float)fvd->total_uw_bits);
- /* Check test condition */
- if(first_extract<first_tol){
- printf("Test passed at test BER of %f!\n",TESTBER);
- exit(0);
- }else{
- printf("** Test failed at test BER of %f!\n",TESTBER);
- exit(1);
- }
- fvhff_destroy_deframer(fvd);
-}
diff --git a/unittest/test_phi0.c b/unittest/test_phi0.c
deleted file mode 100644
index 8063843..0000000
--- a/unittest/test_phi0.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- FILE...: test_phi0.c
- AUTHOR.: Matthew C. Valenti, Rohit Iyer Seshadri, David Rowe, Don Reid
- CREATED: Sep 2018
-
- Compare new generated phi0 function to what was originally in mpdecode_core.c
-*/
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "phi0.h"
-
-
-/* Original Phi function */
-static float phi0_orig( float x ) {
- float z;
-
- if (x>10)
- return( 0 );
- else if (x< 9.08e-5 )
- return( 10 );
- else if (x > 9)
- return( 1.6881e-4 );
- /* return( 1.4970e-004 ); */
- else if (x > 8)
- return( 4.5887e-4 );
- /* return( 4.0694e-004 ); */
- else if (x > 7)
- return( 1.2473e-3 );
- /* return( 1.1062e-003 ); */
- else if (x > 6)
- return( 3.3906e-3 );
- /* return( 3.0069e-003 ); */
- else if (x > 5)
- return( 9.2168e-3 );
- /* return( 8.1736e-003 ); */
- else {
- z = (float) exp(x);
- return( (float) log( (z+1)/(z-1) ) );
- }
-}
-
-////////////////////////////////////////////////////
-// Main
-int main(void) {
-
- float xf;
- float error;
- int errsum = 0;
- int errsum2 = 0;
- int errcnt = 0;
-
- for (xf=10.5f; xf>5e-5f; xf = xf * 0.9) {
-
- float orig = phi0_orig(xf);
- float new = phi0(xf);
-
- error = new - orig;
- printf("%10.4f: %10.6f - %10.6f = %10.6f", xf, new, orig, error);
- if ((error >= 0.001) && (error >= (orig * 0.1))) printf(" ****");
- printf("\n");
-
- errsum += error;
- errsum2 += error * error;
- errcnt ++;
-
- }
-
- printf("Net error %f\n", (double)errsum);
- printf("avg error %f\n", (double)errsum/errcnt);
- printf("rms error %f\n", (double)sqrt(errsum2/errcnt));
-
- return(0);
-}
-
-/* vi:set ts=4 et sts=4: */
diff --git a/unittest/tfreedv_2400A_rawdata.c b/unittest/tfreedv_2400A_rawdata.c
index ed65501..8007793 100644
--- a/unittest/tfreedv_2400A_rawdata.c
+++ b/unittest/tfreedv_2400A_rawdata.c
@@ -74,7 +74,6 @@ int main(int argc, char **argv)
printf("freedv_rawdatatx()/freedv_rawdatarx() ");
int frames = 0;
- int fails = 0;
{
short mod[nom_samples * 10];
/* Note: A codec frame is only 6.5 bytes!
@@ -94,7 +93,6 @@ int main(int argc, char **argv)
for (b = 0; b < 7; b++) {
if (payload[b] != payload_rx[b]) {
printf("Received codec bits 0x%02x do not match expected 0x%02x\n", payload_rx[b], payload[b]);
- fails++;
}
}
frames++;
diff --git a/unittest/tfreedv_2400B_rawdata.c b/unittest/tfreedv_2400B_rawdata.c
index 888ba83..0af4e8e 100644
--- a/unittest/tfreedv_2400B_rawdata.c
+++ b/unittest/tfreedv_2400B_rawdata.c
@@ -74,7 +74,6 @@ int main(int argc, char **argv)
printf("freedv_rawdatatx()/freedv_rawdatarx() ");
int frames = 0;
- int fails = 0;
{
short mod[nom_samples * 10];
/* Note: A codec frame is only 6.5 bytes!
@@ -94,7 +93,6 @@ int main(int argc, char **argv)
for (b = 0; b < 7; b++) {
if (payload[b] != payload_rx[b]) {
printf("Received codec bits 0x%02x do not match expected 0x%02x\n", payload_rx[b], payload[b]);
- fails++;
}
}
frames++;
diff --git a/unittest/tnc1_high_snr.sh b/unittest/tnc1_high_snr.sh
deleted file mode 100755
index e9a028a..0000000
--- a/unittest/tnc1_high_snr.sh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env bash
-# tnc1_high_snr.sh
-#
-# HF TNC use case test 1
-# + Send unidirectional frames at high SNR over an alsa loopback virtual sound card
-# + Using the sound card can take some time, so implemented as a service to run automatically in background
-
-NAME=tnc1
-CODEC2_PATH=${HOME}/codec2
-PIDFILE_TX=/tmp/${NAME}_tx.pid
-PIDFILE_RX=/tmp/${NAME}_rx.pid
-LOGFILE=${NAME}.log
-PATH=${CODEC2_PATH}/build_linux/src:${PATH}
-DELAY="${DELAY:-500}"
-MAX_RUN_TIME=3600
-# we use single frame bursts, so BURSTS==FRAME
-BURSTS=$2
-
-function run_tx {
- bursts=$1
- delay=$2
- freedv_data_raw_tx DATAC0 /dev/zero - --testframes ${bursts} --bursts ${bursts} --delay ${delay} | aplay --device="plughw:CARD=CHAT2,DEV=1" -f S16_LE
-}
-
-function start_rx_background {
- arecord --device="plughw:CARD=CHAT2,DEV=0" -f S16_LE -d $MAX_RUN_TIME | freedv_data_raw_rx DATAC0 - /dev/null --framesperburst 1 --vv --testframes &
- echo $!>${PIDFILE_RX}
-}
-
-function stop_service {
- echo "service stopping - bye!" 1>&2
- if [ -e ${PIDFILE_RX} ]; then
- pid_rx=$(cat ${PIDFILE_RX})
- rm ${PIDFILE_RX}
- kill ${pid_rx}
- fi
-
- if [ -e ${PIDFILE_TX} ]; then
- pid_tx=$(cat ${PIDFILE_TX})
- rm ${PIDFILE_TX}
- kill ${pid_tx}
- fi
-}
-
-function check_running {
- if [ -e ${PIDFILE_TX} ]; then
- echo "Tx already running... pid: ${PIDFILE_TX}"
- exit 1
- fi
- if [ -e ${PIDFILE_RX} ]; then
- echo "Rx already running... pid: ${PIDFILE_RX}"
- exit 1
- fi
-}
-
-function check_alsa_loopback {
- lsmod | grep snd_aloop >> /dev/null
- if [ $? -eq 1 ]; then
- echo "ALSA loopback device not present. Please install with:"
- echo
- echo " sudo modprobe snd-aloop index=1,2 enable=1,1 pcm_substreams=1,1 id=CHAT1,CHAT2"
- exit 1
- fi
-}
-
-case "$1" in
- start)
- check_running
- check_alsa_loopback
- ( start_rx_background && sleep 1 && run_tx ${BURSTS} ${DELAY} && stop_service ) 2>${LOGFILE} &
- echo $!>${PIDFILE_TX}
- echo "Results in ${LOGFILE}"
- ;;
- start_verbose)
- set -x
- check_running
- check_alsa_loopback
- # Show all outputs and log output to stderr rather than logfile
- verbose=1
- start_rx_background && sleep 1 && run_tx ${BURSTS} ${DELAY} && stop_service
- ;;
- stop)
- stop_service
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- status)
- if [ -e ${PIDFILE_TX} ]; then
- echo ${NAME} is running, pid=`cat ${PIDFILE_TX}`
- else
- echo ${NAME} is NOT running
- exit 1
- fi
- ;;
- *)
- echo "Usage: $0 {start|start_verbose|stop|restart|status} NumFrames"
- echo " $0 start_verbose 1 - 1 frame packet verbose, logs to stderr"
- echo " $0 start 5 - 5 frames, run as service in background, logs sent to ${LOGFILE}"
-esac
-
-exit 0
diff --git a/unittest/tnc4_high_snr_ping.sh b/unittest/tnc4_high_snr_ping.sh
deleted file mode 100755
index d9bee07..0000000
--- a/unittest/tnc4_high_snr_ping.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/env bash
-# tnc4_high_snr_ping.sh
-#
-# HF TNC use case test 4
-# + Terminal 1 sends frames to Terminal 2
-# + Terminal 2 receives frames and re-transmits them back to Terminal 1
-# + Terminal 1 and 2 count number of frames received (see logfiles)
-# + The modem samples are sent over virtual sound cards, this runs in real time, which
-# can be slow for tests involving many packets. Therefore this test is implemented as a
-# service script.
-
-NAME=tnc4
-CODEC2_PATH=${HOME}/codec2
-PIDFILE_TX1=/tmp/${NAME}_tx1.pid
-PIDFILE_RX1=/tmp/${NAME}_rx1.pid
-PIDFILE_RX2=/tmp/${NAME}_rx2.pid
-LOGFILE1=${NAME}_1.log
-LOGFILE2=${NAME}_2.log
-PATH=${CODEC2_PATH}/build_linux/src:${PATH}
-DELAY="${DELAY:-500}"
-MAX_RUN_TIME=3600
-# in this version we use single frame bursts, so BURSTS==FRAMES
-BURSTS=$2
-MODE=DATAC0
-
-function tx1 {
- freedv_data_raw_tx ${MODE} /dev/zero - --testframes ${BURSTS} --bursts ${BURSTS} --delay ${DELAY} | aplay --device="plughw:CARD=CHAT2,DEV=1" -f S16_LE
-}
-
-function rx2_background {
- # re-transmit any frames we receive
- ( arecord --device="plughw:CARD=CHAT2,DEV=0" -f S16_LE -d $MAX_RUN_TIME | \
- freedv_data_raw_rx ${MODE} - - --framesperburst 1 --vv --testframes | \
- freedv_data_raw_tx ${MODE} - - --delay ${DELAY} | \
- aplay --device="plughw:CARD=CHAT1,DEV=1" -f S16_LE ) 2>${LOGFILE2} &
- # killing arecord kills the entire pipeline
- echo $(pidof arecord)>${PIDFILE_RX2}
-}
-
-function rx1_background {
- arecord --device="plughw:CARD=CHAT1,DEV=0" -f S16_LE -d $MAX_RUN_TIME | freedv_data_raw_rx ${MODE} - /dev/null --framesperburst 1 --vv --testframes &
- echo $!>${PIDFILE_RX1}
-}
-
-function stop_process {
- if [ -e ${1} ]; then
- pid=$(cat ${1})
- rm ${1}
- kill ${pid}
- fi
-}
-
-function stop_service {
- echo "service stopping - bye!" 1>&2
- stop_process ${PIDFILE_RX1}
- stop_process ${PIDFILE_RX2}
- stop_process ${PIDFILE_TX1}
-}
-
-function check_running {
- if [ -e ${PIDFILE_TX1} ]; then
- echo "Tx already running... pid: ${PIDFILE_TX1}"
- exit 1
- fi
- if [ -e ${PIDFILE_RX1} ]; then
- echo "Rx1 already running... pid: ${PIDFILE_RX1}"
- exit 1
- fi
- if [ -e ${PIDFILE_RX2} ]; then
- echo "Rx2 already running... pid: ${PIDFILE_RX2}"
- exit 1
- fi
-}
-
-function check_alsa_loopback {
- lsmod | grep snd_aloop >> /dev/null
- if [ $? -eq 1 ]; then
- echo "ALSA loopback device not present. Please install with:"
- echo
- echo " sudo modprobe snd-aloop index=1,2 enable=1,1 pcm_substreams=1,1 id=CHAT1,CHAT2"
- exit 1
- fi
-}
-
-case "$1" in
- start)
- check_running
- check_alsa_loopback
- rx2_background
- ( rx1_background && sleep 1 && tx1 && sleep 5 && stop_service ) 2>${LOGFILE1} &
- echo $!>${PIDFILE_TX1}
- echo "Results for terminal 1 in ${LOGFILE1} and terminal 2 in ${LOGFILE2}"
- ;;
- stop)
- stop_service
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- status)
- if [ -e ${PIDFILE_TX1} ]; then
- echo ${NAME} is running, pid=`cat ${PIDFILE_TX1}`
- else
- echo ${NAME} is NOT running
- exit 1
- fi
- ;;
- *)
- echo "Usage: $0 {start|start_verbose|stop|restart|status} NumFrames"
- echo " $0 start 5 - test ping over 5 frames; logs sent to ${LOGFILE1} and ${LOGFILE2}"
-esac
-
-exit 0
diff --git a/unittest/tprede.c b/unittest/tprede.c
deleted file mode 100644
index 4d3d09c..0000000
--- a/unittest/tprede.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- tpre_de.c
- David Rowe
- Sep 24 2012
-
- Unit test to generate the combined impulse response of pre & de-emphasis filters.
-
- pl("../unittest/out48.raw",1,3000)
- pl("../unittest/out8.raw",1,3000)
-
- Listening to it also shows up anything nasty:
-
- $ play -s -2 -r 48000 out48.raw
- $ play -s -2 -r 8000 out8.raw
-
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "lpc.h"
-
-#define N 10
-#define F 10
-
-int main() {
- FILE *fprede;
- float Sn[N], Sn_pre[N], Sn_de[N];
- float pre_mem = 0.0, de_mem = 0.0;
- int i, f;
-
- fprede = fopen("prede.txt", "wt");
- assert(fprede != NULL);
-
- for(i=0; i<N; i++)
- Sn[i] = 0.0;
-
- Sn[0]= 1.0;
-
- for(f=0; f<F; f++) {
- pre_emp(Sn_pre, Sn, &pre_mem, N);
- de_emp(Sn_de, Sn_pre, &de_mem, N);
- for(i=0; i<N; i++) {
- fprintf(fprede, "%f\n", Sn_de[i]);
- }
- Sn[0] = 0.0;
- }
-
- fclose(fprede);
-
- return 0;
-}
diff --git a/unittest/tquisk_filter.c b/unittest/tquisk_filter.c
index d6c7529..f31e6bd 100644
--- a/unittest/tquisk_filter.c
+++ b/unittest/tquisk_filter.c
@@ -25,7 +25,6 @@ int main() {
complex float buf[N];
struct quisk_cfFilter *bpf;
int i;
- int n = 0;
bpf = malloc(sizeof(struct quisk_cfFilter));
assert(bpf != NULL);
@@ -39,7 +38,7 @@ int main() {
/* we only output the real part in this test */
for(i=0; i<N; i++)
buf_short[i] = creal(buf[i]);
- n += fwrite(buf_short, sizeof(short), N, stdout);
+ fwrite(buf_short, sizeof(short), N, stdout);
}
quisk_filt_destroy(bpf);
diff --git a/unittest/tst_codec2_fft_init.c b/unittest/tst_codec2_fft_init.c
deleted file mode 100644
index 71ddc38..0000000
--- a/unittest/tst_codec2_fft_init.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*---------------------------------------------------------------------------*\
-
- FILE........: tst_codec2_fft_init.c,
- AUTHOR......: David Rowe, Don Reid
- DATE CREATED: 30 May 2013, Oct 2018, Feb 2018
-
- Test FFT Window initialization in Codec2_create
-
-\*---------------------------------------------------------------------------*/
-
-/*
- 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.1, 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 <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <math.h>
-
-#include "codec2.h"
-#include "codec2_internal.h"
-#include "defines.h"
-
-#include "machdep.h"
-
-static const float expect_w[] = {
- 0.004293, 0.004301, 0.004309, 0.004315,
- 0.004320, 0.004323, 0.004326, 0.004328,
- 0.004328, 0.004328, 0.004326, 0.004323,
- 0.004320, 0.004315, 0.004309, 0.004301};
-
-
-static const float expect_W[] = {
- -0.002176, 0.002195, 0.004429, -0.008645,
- -0.012196, 0.065359, 0.262390, 0.495616,
- 0.601647, 0.495616, 0.262390, 0.065359,
- -0.012196, -0.008645, 0.004429, 0.002195};
-
-
-int float_cmp(float a, float b) {
- if ( fabsf(a - b) < 1e-6f ) return 1;
- else return 0;
- }
-
-int main(int argc, char *argv[]) {
-
- struct CODEC2 *codec2;
- int i, j;
-
- ////////
- codec2 = codec2_create(CODEC2_MODE_700C);
-
- j = (codec2->c2const.m_pitch / 2) - 8;
- for (i=0; i<16; i++) {
- printf("w[%d] = %f", j+i,
- (double)codec2->w[j+i]);
- if (!float_cmp(codec2->w[j+i], expect_w[i])) {
- printf(" Error, expected %f", (double)expect_w[i]);
- }
- printf("\n");
- }
-
- printf("\n");
-
- j = (FFT_ENC / 2) - 8;
- for (i=0; i<16; i++) {
- printf("W[%d] = %f", j+i,
- (double)codec2->W[j+i]);
- if (!float_cmp(codec2->W[j+i], expect_W[i])) {
- printf(" Error, expected %f", (double)expect_W[i]);
- }
- printf("\n");
- }
-
- codec2_destroy(codec2);
-
- printf("\nEnd of Test\n");
- fclose(stdout);
- fclose(stderr);
-
- return(0);
-}
-
-/* vi:set ts=4 et sts=4: */
diff --git a/unittest/vq_mbest.c b/unittest/vq_mbest.c
new file mode 100644
index 0000000..a247f61
--- /dev/null
+++ b/unittest/vq_mbest.c
@@ -0,0 +1,302 @@
+/*
+ vq_mbest.c
+ David Rowe Dec 2019
+
+ Utility to perform a mbest VQ search on vectors from stdin, sending
+ quantised vectors to stdout.
+*/
+
+#include <assert.h>
+#include <getopt.h>
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include "mbest.h"
+
+#define MAX_K 20
+#define MAX_ENTRIES 4096
+#define MAX_STAGES 5
+
+void quant_mbest(float vec_out[],
+ int indexes[],
+ float vec_in[],
+ int num_stages,
+ float vqw[], float vq[],
+ int m[], int k,
+ int mbest_survivors);
+
+int verbose = 0;
+
+int main(int argc, char *argv[]) {
+ float vq[MAX_STAGES*MAX_K*MAX_ENTRIES];
+ float vqw[MAX_STAGES*MAX_K*MAX_ENTRIES];
+ int m[MAX_STAGES];
+ int k=0, mbest_survivors=1, num_stages=0;
+ char fnames[256], fn[256], *comma, *p;
+ FILE *fq;
+ float lower = -1E32;
+ int st = -1;
+ int en = -1;
+ int num = INT_MAX;
+ int output_vec_usage = 0;
+
+ int o = 0; int opt_idx = 0;
+ while (o != -1) {
+ static struct option long_opts[] = {
+ {"k", required_argument, 0, 'k'},
+ {"quant", required_argument, 0, 'q'},
+ {"mbest", required_argument, 0, 'm'},
+ {"lower", required_argument, 0, 'l'},
+ {"verbose", required_argument, 0, 'v'},
+ {"st", required_argument, 0, 't'},
+ {"en", required_argument, 0, 'e'},
+ {"num", required_argument, 0, 'n'},
+ {"vec_usage", no_argument, 0, 'u'},
+ {0, 0, 0, 0}
+ };
+
+ o = getopt_long(argc,argv,"hk:q:m:vt:e:n:u",long_opts,&opt_idx);
+ switch (o) {
+ case 'k':
+ k = atoi(optarg);
+ assert(k <= MAX_K);
+ break;
+ case 'q':
+ /* load up list of comma delimited file names */
+ strcpy(fnames, optarg);
+ p = fnames;
+ num_stages = 0;
+ do {
+ assert(num_stages < MAX_STAGES);
+ strcpy(fn, p);
+ comma = strchr(fn, ',');
+ if (comma) {
+ *comma = 0;
+ p = comma+1;
+ }
+ /* load quantiser file */
+ fprintf(stderr, "stage: %d loading %s ... ", num_stages, fn);
+ fq=fopen(fn, "rb");
+ if (fq == NULL) {
+ fprintf(stderr, "Couldn't open: %s\n", fn);
+ exit(1);
+ }
+ /* count how many entries m of dimension k are in this VQ file */
+ m[num_stages] = 0;
+ float dummy[k];
+ while (fread(dummy, sizeof(float), k, fq) == (size_t)k)
+ m[num_stages]++;
+ assert(m[num_stages] <= MAX_ENTRIES);
+ fprintf(stderr, "%d entries of vectors width %d\n", m[num_stages], k);
+ /* now load VQ into memory */
+ rewind(fq);
+ int rd = fread(&vq[num_stages*k*MAX_ENTRIES], sizeof(float), m[num_stages]*k, fq);
+ assert(rd == m[num_stages]*k);
+ num_stages++;
+ fclose(fq);
+ } while(comma);
+ break;
+ case 'm':
+ mbest_survivors = atoi(optarg);
+ fprintf(stderr, "mbest_survivors = %d\n", mbest_survivors);
+ break;
+ case 'n':
+ num = atoi(optarg);
+ break;
+ case 'l':
+ lower = atof(optarg);
+ break;
+ case 't':
+ st = atoi(optarg);
+ break;
+ case 'e':
+ en = atoi(optarg);
+ break;
+ case 'u':
+ output_vec_usage = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ help:
+ fprintf(stderr, "\n");
+ fprintf(stderr, "usage: %s -k dimension -q vq1.f32,vq2.f32,.... [Options]\n", argv[0]);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "input vectors on stdin, output quantised vectors on stdout\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "--lower lowermeanLimit Only count vectors with average above this level in distortion calculations\n");
+ fprintf(stderr, "--mbest N number of survivors at each stage, set to 0 for standard VQ search\n");
+ fprintf(stderr, "--st Kst start vector element for error calculation (default 0)\n");
+ fprintf(stderr, "--en Ken end vector element for error calculation (default K-1)\n");
+ fprintf(stderr, "--num numToProcess number of vectors to quantise (default to EOF)\n");
+ fprintf(stderr, "--vec_usage Output a record of how many times each vector is used\n");
+ fprintf(stderr, "-v Verbose\n");
+ exit(1);
+ }
+ }
+
+ if ((num_stages == 0) || (k == 0))
+ goto help;
+
+ /* default to measuring error on entire vector */
+ if (st == -1) st = 0;
+ if (en == -1) en = k-1;
+
+ float w[k];
+ for(int i=0; i<st; i++)
+ w[i] = 0.0;
+ for(int i=st; i<=en; i++)
+ w[i] = 1.0;
+ for(int i=en+1; i<k; i++)
+ w[i] = 0.0;
+
+ /* apply weighting to codebook (rather than in search) */
+ memcpy(vqw, vq, sizeof(vq));
+ for(int s=0; s<num_stages; s++) {
+ mbest_precompute_weight(&vqw[s*k*MAX_ENTRIES], w, k, m[s]);
+ }
+
+ int indexes[num_stages], nvecs = 0; int vec_usage[m[0]];
+ for(int i=0; i<m[0]; i++) vec_usage[i] = 0;
+ float target[k], quantised[k];
+ float sqe = 0.0;
+ while(fread(&target, sizeof(float), k, stdin) && (nvecs < num)) {
+ for(int i=0; i<k; i++)
+ target[i] *= w[i];
+ int dont_count = 0;
+ /* optional clamping to lower limit or mean */
+ float mean = 0.0;
+ for(int i=0; i<k; i++)
+ mean += target[i];
+ mean /= k;
+ float difference = mean - lower;
+ if (difference < 0.0) {
+ /* bring target up to lower clamping limit */
+ for(int i=0; i<k; i++)
+ target[i] += -difference;
+ dont_count = 1;
+ }
+ quant_mbest(quantised, indexes, target, num_stages, vqw, vq, m, k, mbest_survivors);
+ if (dont_count == 0) {
+ for(int i=st; i<=en; i++)
+ sqe += pow(target[i]-quantised[i], 2.0);
+ }
+ fwrite(&quantised, sizeof(float), k, stdout);
+ nvecs++;
+ // count number f time each vector is used (just for first stage)
+ vec_usage[indexes[0]]++;
+ }
+
+ fprintf(stderr, "MSE: %4.2f\n", sqe/(nvecs*(en-st+1)));
+
+ if (output_vec_usage) {
+ for(int i=0; i<m[0]; i++)
+ fprintf(stderr, "%d\n", vec_usage[i]);
+ }
+
+ return 0;
+}
+
+// print vector debug function
+
+void pv(char s[], float v[], int k) {
+ int i;
+ if (verbose) {
+ fprintf(stderr, "%s",s);
+ for(i=0; i<k; i++)
+ fprintf(stderr, "%4.2f ", v[i]);
+ fprintf(stderr, "\n");
+ }
+}
+
+// mbest algorithm version, backported from LPCNet/src
+
+void quant_mbest(float vec_out[],
+ int indexes[],
+ float vec_in[],
+ int num_stages,
+ float vqw[], float vq[],
+ int m[], int k,
+ int mbest_survivors)
+{
+ float err[k], se1;
+ int i,j,s,s1,ind;
+
+ struct MBEST *mbest_stage[num_stages];
+ int index[num_stages];
+ float target[k];
+
+ for(i=0; i<num_stages; i++) {
+ mbest_stage[i] = mbest_create(mbest_survivors);
+ index[i] = 0;
+ }
+
+ se1 = 0.0;
+ for(i=0; i<k; i++) {
+ err[i] = vec_in[i];
+ se1 += err[i]*err[i];
+ }
+ se1 /= k;
+
+ /* now quantise err[] using multi-stage mbest search, preserving
+ mbest_survivors at each stage */
+
+ mbest_search(vqw, err, k, m[0], mbest_stage[0], index);
+ if (verbose) mbest_print("Stage 1:", mbest_stage[0]);
+
+ for(s=1; s<num_stages; s++) {
+
+ /* for each candidate in previous stage, try to find best vector in next stage */
+ for (j=0; j<mbest_survivors; j++) {
+ /* indexes that lead us this far */
+ for(s1=0; s1<s; s1++) {
+ index[s1+1] = mbest_stage[s-1]->list[j].index[s1];
+ }
+ /* target is residual err[] vector given path to this candidate */
+ for(i=0; i<k; i++)
+ target[i] = err[i];
+ for(s1=0; s1<s; s1++) {
+ ind = index[s-s1];
+ if (verbose) fprintf(stderr, " s: %d s1: %d s-s1: %d ind: %d\n", s,s1,s-s1,ind);
+ for(i=0; i<k; i++) {
+ target[i] -= vqw[s1*k*MAX_ENTRIES+ind*k+i];
+ }
+ }
+ pv(" target: ", target, k);
+ mbest_search(&vqw[s*k*MAX_ENTRIES], target, k, m[s], mbest_stage[s], index);
+ }
+ char str[80]; sprintf(str,"Stage %d:", s+1);
+ if (verbose) mbest_print(str, mbest_stage[s]);
+ }
+
+ for(s=0; s<num_stages; s++) {
+ indexes[s] = mbest_stage[num_stages-1]->list[0].index[num_stages-1-s];
+ }
+
+ /* OK put it all back together using best survivor */
+ for(i=0; i<k; i++)
+ vec_out[i] = 0.0;
+ for(s=0; s<num_stages; s++) {
+ int ind = indexes[s];
+ float se2 = 0.0;
+ for(i=0; i<k; i++) {
+ err[i] -= vqw[s*k*MAX_ENTRIES+ind*k+i];
+ vec_out[i] += vq[s*k*MAX_ENTRIES+ind*k+i];
+ se2 += err[i]*err[i];
+ }
+ se2 /= k;
+ pv(" err: ", err, k);
+ if (verbose) fprintf(stderr, " se2: %f\n", se2);
+ }
+ pv(" vec_out: ",vec_out, k);
+
+ pv("\n vec_in: ", vec_in, k);
+ pv(" vec_out: ", vec_out, k);
+ pv(" err: ", err, k);
+ if (verbose) fprintf(stderr, " se1: %f\n", se1);
+
+ for(i=0; i<num_stages; i++)
+ mbest_destroy(mbest_stage[i]);
+}