Skip to content

Commit

Permalink
merge with main and fix conflict (I hope)
Browse files Browse the repository at this point in the history
  • Loading branch information
drowe67 committed May 5, 2024
2 parents aebdd11 + d21ff74 commit e9f6406
Show file tree
Hide file tree
Showing 29 changed files with 774 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
shell: bash
run: |
sudo apt-get update
sudo apt-get install octave octave-common octave-signal liboctave-dev gnuplot sox p7zip-full python3-numpy valgrind clang-format
sudo apt-get install octave octave-common octave-signal liboctave-dev gnuplot sox p7zip-full python3-numpy valgrind clang-format texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra texlive-science texmaker texlive-bibtex-extra
- name: Create Build Directory
shell: bash
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Run ctests
working-directory: ${{github.workspace}}/build_linux
shell: bash
run: ctest --output-on-failure -E test_codec2_doc
run: ctest --output-on-failure

- name: Test library installation
working-directory: ${{github.workspace}}/build_linux
Expand Down
30 changes: 29 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ endif()
cd ${CMAKE_CURRENT_BINARY_DIR}/src;
cat test.raw | ./ofdm_demod --mode datac13 --out /dev/null --testframes --ldpc --verbose 2 --packetsperburst 1")

# DATAC14 Octave Tx, C Rx, burst mode
add_test(NAME test_OFDM_modem_datac14_octave
COMMAND sh -c "cd ${CMAKE_CURRENT_SOURCE_DIR}/octave;
DISPLAY=\"\" octave-cli -qf --eval 'ofdm_ldpc_tx(\"${CMAKE_CURRENT_BINARY_DIR}/src/test.raw\",\"datac14\",1,3,\"awgn\",\"bursts\",5)';
cd ${CMAKE_CURRENT_BINARY_DIR}/src;
cat test.raw | ./ofdm_demod --mode datac14 --out /dev/null --testframes --ldpc --verbose 2 --packetsperburst 1")

# DATAC4 C Tx, C Rx, burst mode
add_test(NAME test_OFDM_modem_datac4_ldpc_burst
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
Expand All @@ -676,7 +683,14 @@ endif()
./ch - - --No -17 |
./ofdm_demod --mode datac13 --out /dev/null --testframes --ldpc --verbose 2 --packetsperburst 1")

# -------------------------------------------------------------------------
# DATAC14 C Tx, C Rx, burst mode
add_test(NAME test_OFDM_modem_datac14_ldpc_burst
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
./ofdm_mod --mode datac14 --in /dev/zero --testframes 1 --verbose 1 --ldpc --bursts 10 |
./ch - - --No -17 |
./ofdm_demod --mode datac14 --out /dev/null --testframes --ldpc --verbose 2 --packetsperburst 1")

# -------------------------------------------------------------------------
# LDPC
# -------------------------------------------------------------------------

Expand Down Expand Up @@ -1064,6 +1078,12 @@ if (NOT APPLE)
./freedv_data_raw_tx --testframes 10 DATAC13 /dev/zero /dev/null")
set_tests_properties(test_memory_leak_FreeDV_DATAC13_tx PROPERTIES PASS_REGULAR_EXPRESSION "ERROR SUMMARY: 0 errors")

add_test(NAME test_memory_leak_FreeDV_DATAC14_tx
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes \
./freedv_data_raw_tx --testframes 10 DATAC14 /dev/zero /dev/null")
set_tests_properties(test_memory_leak_FreeDV_DATAC14_tx PROPERTIES PASS_REGULAR_EXPRESSION "ERROR SUMMARY: 0 errors")

add_test(NAME test_memory_leak_FreeDV_700E_tx
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes \
Expand Down Expand Up @@ -1307,6 +1327,13 @@ endif(NOT APPLE)
./freedv_data_raw_rx DATAC13 - binaryOut.bin -v;
diff binaryIn.bin binaryOut.bin")

add_test(NAME test_freedv_data_raw_ofdm_datac14_burst_file
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
head -c $((3*10)) </dev/urandom > binaryIn.bin;
./freedv_data_raw_tx DATAC14 binaryIn.bin - --bursts 10 |
./freedv_data_raw_rx DATAC14 - binaryOut.bin -v;
diff binaryIn.bin binaryOut.bin")

# FSK LDPC default 100 bit/s 2FSK, enough noise for several % raw BER to give
# FEC/acquisition a work out, bursts of 1 frame as that stresses acquisition
add_test(NAME test_freedv_data_raw_fsk_ldpc_100
Expand Down Expand Up @@ -1392,6 +1419,7 @@ endif(NOT APPLE)
test_OFDM_modem_datac3_octave
test_OFDM_modem_datac4_octave
test_OFDM_modem_datac13_octave
test_OFDM_modem_datac14_octave
test_fsk_lib_4fsk_ldpc
test_OFDM_modem_datac0_compression
PROPERTIES
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ The code supporting these modes won't be going away any time soon (and we will c

We have a process for considering Feature Requests and Pull Requests that we will guide you through.

Feature Requests can be submitted via GitHub Issues.
If you have a Feature Request, please answer the questions in the [Feature Request Form](https://freedv.org/wp-content/uploads/sites/8/2024/03/FreeDV-027-Feature-Request-Form-V1.1.pdf), and submit your answers as a GitHub Issue.

Before writing any code or submitting a PR - **please discuss** the PR with developers by raising a GitHub Issue. We have many years of experience and a carefully considered plan for Codec 2 development, and can guide you on work that will most benefit this project.

Some key guidelines about the code in the `codec2` repo:
1. Code that is required to build libcodec2, or to test libcodec2 goes in codec2.
1. Only code that is required to build, test, or document libcodec2 goes in codec2.
2. Experimental work, code used for algorithm development, should probably go into some other repo.
3. Only widely used “production” code goes in codec2. If it has an user base of < 2 (e.g. personal projects, early R&D) - it should probably be application code or a fork.

## Ports to non C99 Compilers

We have standardized on C99 and develop and test using gcc on a Linux platform. We encourage people who want to use non-standard compilers like MSVC and certain embedded compilers to maintain their own Codec 2 forks. Our focus needs to be on what’s unique about our project – the speech codec and modem waveforms – rather than consuming time and resources on non-core activities that others can do equally well. If you decide to fork Codec 2 to a non C99 compiler - please ensure you port the ctests and that they all pass. If the tests have not been ported or do not pass - it's not Codec 2.
For Windows applications (built with MSVC or any compiler) we recommend linking with our [cross-compiled](#building-for-windows) Codec 2 DLLs. This lets you enjoy the benefits of our carefully developed, tested and maintained codebase without having to develop and maintain your own fork.

We have standardized on C99 and develop and test using gcc on a Linux platform. Our focus needs to be on what’s unique about our project – the speech codec and modem waveforms, and we lack the resources to support multiple compilers. If you want to build Codec 2 using a non-standard compiler like MSVC and certain embedded compilers you will need to maintain your own Codec 2 fork (a very large commitment). If you decide to fork Codec 2 to a non C99 compiler - please ensure you port the ctests and that they all pass. If the tests have not been ported or do not pass - it's not Codec 2.

## Quickstart

Expand Down Expand Up @@ -203,7 +205,7 @@ wav - speech files in wave file format
make
```

## Bulding for Windows
## Building for Windows

We develop and test on Linux to the [C99 standard](#ports-to-non-c99-compilers). We recommend using MinGW to cross compile for Windows.

Expand Down
3 changes: 2 additions & 1 deletion README_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ These modes use an OFDM modem with powerful LDPC codes and are designed for send
| DATAC3 | 500 | 321 | 126 | (2048,1024) | 3.19 | 74/100 at 0dB | Forward link data (low SNR) |
| DATAC4 | 250 | 87 | 56 | (1472,448) | 5.17 | 90/100 at -4dB | Forward link data (low SNR) |
| DATAC13 | 200 | 64 | 14 | (384,128) | 2.0 | 90/100 at -4dB | Reverse link ACK packets (low SNR) |
| DATAC14 | 250 | 58 | 3 | (112,56) | 0.69 | 90/100 at -2dB | Reverse link ACK packets (low SNR) |
Notes:
1. 16 bits (2 bytes) per frame are reserved for a 16 bit CRC, e.g. for `datac3` we have 128 byte frames, and 128-2=126 bytes/frame of payload data.
Expand Down Expand Up @@ -245,7 +246,7 @@ This command line demonstrates the effect:
```
Try adjusting `--clip` and `No` argument of `ch` (noise level) for different modes. Note the SNR estimates returned from `freedv_data_raw_rx` compared to the SNR from the channel simulator `ch`. You will notice clipping also increases the RMS power and reduces the PER for a given channel noise power. CPAPR will also reduce with clipping enabled.
The following plots illustrate the SNR estimates versus actual channel SNR with and without compression (clipping). Not that even with the uncompressed waveform there is a small offset of around 1dB, possibly due to modem implementation loss or noise in the frequency, phase, or timing estimators.
The following plots illustrate the SNR estimates versus actual channel SNR with and without compression (clipping). Note that even with the uncompressed waveform there is a small offset of around 1dB, possibly due to modem implementation loss or noise in the frequency, phase, or timing estimators.
![](doc/snrest_snr_ctx.png)
![](doc/snrest_snr_ctxc.png)
Expand Down
4 changes: 2 additions & 2 deletions codec2.pc.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/codec2
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@

Name: codec2
Description: A speech codec for 2400 bit/s and below
Requires:
Version: @CODEC2_VERSION@
Libs: -L${libdir} -lcodec2
Cflags: -I${includedir}
Cflags: -I${includedir} -I${includedir}/codec2
6 changes: 3 additions & 3 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ PATH := $(PATH):$(CODEC2_BINARY)/src
PLOT_FILES := hts2a_37_sn.tex hts2a_37_sw.tex hts2a_37_lpc_lsp.tex hts2a_37_lpc_pf.tex

$(DOCNAME).pdf: $(PLOT_FILES) $(DOCNAME).tex $(DOCNAME)_refs.bib
pdflatex -jobname=$(JOBNAME) $(DOCNAME).tex
pdflatex -shell-escape -file-line-error -jobname=$(JOBNAME) $(DOCNAME).tex
bibtex $(JOBNAME).aux
pdflatex -jobname=$(JOBNAME) $(DOCNAME).tex
pdflatex -jobname=$(JOBNAME) $(DOCNAME).tex
pdflatex -shell-escape -file-line-error -jobname=$(JOBNAME) $(DOCNAME).tex
pdflatex -shell-escape -file-line-error -jobname=$(JOBNAME) $(DOCNAME).tex

$(PLOT_FILES):
echo $(PATH)
Expand Down
Binary file modified doc/c_tx_comp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/c_tx_comp_thruput.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/codec2.pdf
Binary file not shown.
Loading

0 comments on commit e9f6406

Please sign in to comment.