Skip to content

Commit

Permalink
rm FreeDV 2020C
Browse files Browse the repository at this point in the history
  • Loading branch information
drowe67 committed Jul 16, 2023
1 parent 6549fa1 commit 4d6c143
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 74 deletions.
16 changes: 1 addition & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,7 @@ endif()
./ofdm_mod --in /dev/zero --testframes 10 --mode 2020B --ldpc --clip --txbpf |
./ch - - --No -19 |
./ofdm_demod --mode 2020B --testframes --ldpc -v 2 > /dev/null")

# 2020C AWGN test
add_test(NAME test_OFDM_modem_2020C_AWGN
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
./ofdm_mod --in /dev/zero --testframes 10 --mode 2020C --ldpc --clip --txbpf |
./ch - - --No -21 |
./ofdm_demod --mode 2020C --testframes --ldpc -v 2 > /dev/null")


# -------------------------------------------------------------------------
# OFDM Data modes
# -------------------------------------------------------------------------
Expand Down Expand Up @@ -865,13 +858,6 @@ if(LPCNET)
./freedv_rx 2020B - /dev/null --testframes"
)

add_test(NAME test_freedv_api_2020C_mpd
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
dd bs=32000 count=60 if=/dev/zero |
./freedv_tx 2020C - - --testframes --clip 1 |
./ch - - --No -32 --mpd --fading_dir ../unittest |
./freedv_rx 2020C - /dev/null --testframes"
)
endif()

add_test(NAME test_freedv_api_2400A
Expand Down
7 changes: 0 additions & 7 deletions src/freedv_2020.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ void freedv_2020x_open(struct freedv *f) {
case FREEDV_MODE_2020B:
ofdm_init_mode("2020B", &ofdm_config);
break;
case FREEDV_MODE_2020C:
ofdm_init_mode("2020C", &ofdm_config);
break;
default:
assert(0);
}
Expand All @@ -71,10 +68,6 @@ void freedv_2020x_open(struct freedv *f) {
vq_type = 2; /* index optimised VQ for increased robustness to single bit
errors */
break;
case FREEDV_MODE_2020C:
vq_type = 2; /* index optimised VQ for increased robustness to single bit
errors */
break;
default:
assert(0);
}
Expand Down
32 changes: 10 additions & 22 deletions src/freedv_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ struct freedv *freedv_open_advanced(int mode, struct freedv_advanced *adv) {
FDV_MODE_ACTIVE(FREEDV_MODE_800XA, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_FSK_LDPC, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_DATAC0, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_DATAC1, mode) ||
Expand All @@ -143,8 +142,7 @@ struct freedv *freedv_open_advanced(int mode, struct freedv_advanced *adv) {
freedv_ofdm_voice_open(f, "700E");
#ifdef __LPCNET__
if (FDV_MODE_ACTIVE(FREEDV_MODE_2020, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, mode))
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, mode))
freedv_2020x_open(f);
#endif
if (FDV_MODE_ACTIVE(FREEDV_MODE_2400A, mode)) freedv_2400a_open(f);
Expand Down Expand Up @@ -203,8 +201,7 @@ void freedv_close(struct freedv *freedv) {
}

if (FDV_MODE_ACTIVE(FREEDV_MODE_2020, freedv->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, freedv->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, freedv->mode)) {
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, freedv->mode)) {
FREE(freedv->codeword_symbols);
FREE(freedv->codeword_amps);
FREE(freedv->ldpc);
Expand Down Expand Up @@ -263,7 +260,6 @@ static void codec2_encode_upacked(struct freedv *f, uint8_t unpacked_bits[],
static int is_ofdm_mode(struct freedv *f) {
return FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_700D, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_700E, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_DATAC0, f->mode) ||
Expand Down Expand Up @@ -347,8 +343,7 @@ void freedv_comptx(struct freedv *f, COMP mod_out[], short speech_in[]) {
FDV_MODE_ACTIVE(FREEDV_MODE_700D, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_700E, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode));
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode));

if (FDV_MODE_ACTIVE(FREEDV_MODE_1600, f->mode)) {
codec2_encode_upacked(f, f->tx_payload_bits, speech_in);
Expand Down Expand Up @@ -382,8 +377,7 @@ void freedv_comptx(struct freedv *f, COMP mod_out[], short speech_in[]) {

#ifdef __LPCNET__
if (FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode)) {
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode)) {
/* buffer up bits until we get enough encoded bits for interleaver */

for (int j = 0; j < f->n_codec_frames; j++) {
Expand Down Expand Up @@ -764,8 +758,7 @@ int freedv_rx(struct freedv *f, short speech_out[], short demod_in[]) {
if (FDV_MODE_ACTIVE(FREEDV_MODE_1600, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_700C, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode)) {
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode)) {
float gain = 1.0f;

assert(nin <= f->n_max_modem_samples);
Expand Down Expand Up @@ -818,8 +811,7 @@ int freedv_comprx(struct freedv *f, short speech_out[], COMP demod_in[]) {
}

if (FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode)) {
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode)) {
#ifdef __LPCNET__
rx_status = freedv_comprx_2020(f, demod_in);
#endif
Expand Down Expand Up @@ -906,8 +898,7 @@ int freedv_bits_to_speech(struct freedv *f, short speech_out[],
/* pass through received samples so we can hear what's going on, e.g.
* during tuning */

if ((f->mode == FREEDV_MODE_2020) || (f->mode == FREEDV_MODE_2020B) ||
(f->mode == FREEDV_MODE_2020C)) {
if ((f->mode == FREEDV_MODE_2020) || (f->mode == FREEDV_MODE_2020B)) {
/* 8kHz modem sample rate but 16 kHz speech sample
rate, so we need to resample */
nout = 2 * f->nin_prev;
Expand Down Expand Up @@ -953,8 +944,7 @@ int freedv_bits_to_speech(struct freedv *f, short speech_out[],

if (decode_speech) {
if (FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode)) {
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode)) {
#ifdef __LPCNET__
/* LPCNet decoder */

Expand Down Expand Up @@ -1170,8 +1160,7 @@ void freedv_set_callback_txt_sym(struct freedv *f, freedv_callback_rx_sym rx,
if (FDV_MODE_ACTIVE(FREEDV_MODE_700D, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_700E, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode)) {
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode)) {
f->freedv_put_next_rx_symbol = rx;
f->callback_state_sym = state;
}
Expand Down Expand Up @@ -1516,8 +1505,7 @@ int freedv_get_n_max_speech_samples(struct freedv *f) {
array */
int max_output_passthrough_samples;
if (FDV_MODE_ACTIVE(FREEDV_MODE_2020, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode) ||
FDV_MODE_ACTIVE(FREEDV_MODE_2020C, f->mode))
FDV_MODE_ACTIVE(FREEDV_MODE_2020B, f->mode))
// In 2020 we oversample the input modem samples from 8->16 kHz
max_output_passthrough_samples = 2 * freedv_get_n_max_modem_samples(f);
else
Expand Down
4 changes: 0 additions & 4 deletions src/freedv_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ extern "C" {
#define FREEDV_MODE_700E 13
#define FREEDV_MODE_2020 8
#define FREEDV_MODE_2020B 16
#define FREEDV_MODE_2020C 17

// available data modes
#define FREEDV_MODE_FSK_LDPC 9
Expand Down Expand Up @@ -123,9 +122,6 @@ extern "C" {
#if !defined(FREEDV_MODE_2020B_EN)
#define FREEDV_MODE_2020B_EN FREEDV_MODE_EN_DEFAULT
#endif
#if !defined(FREEDV_MODE_2020C_EN)
#define FREEDV_MODE_2020C_EN FREEDV_MODE_EN_DEFAULT
#endif
#if !defined(FREEDV_MODE_FSK_LDPC_EN)
#define FREEDV_MODE_FSK_LDPC_EN FREEDV_MODE_EN_DEFAULT
#endif
Expand Down
6 changes: 2 additions & 4 deletions src/freedv_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) {

char f2020[80] = {0};
#ifdef __LPCNET__
sprintf(f2020, "|2020|2020B|2020C");
sprintf(f2020, "|2020|2020B");
#endif

if (argc < 4) {
Expand Down Expand Up @@ -181,7 +181,6 @@ int main(int argc, char *argv[]) {
#ifdef __LPCNET__
if (!strcmp(argv[dx], "2020")) mode = FREEDV_MODE_2020;
if (!strcmp(argv[dx], "2020B")) mode = FREEDV_MODE_2020B;
if (!strcmp(argv[dx], "2020C")) mode = FREEDV_MODE_2020C;
#endif
if (mode == -1) {
fprintf(stderr, "Error in mode: %s\n", argv[dx]);
Expand Down Expand Up @@ -314,8 +313,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "BER......: %5.4f Tbits: %8d Terrs: %8d\n",
(double)uncoded_ber, Tbits, Terrs);
if ((mode == FREEDV_MODE_700D) || (mode == FREEDV_MODE_700E) ||
(mode == FREEDV_MODE_2020) || (mode == FREEDV_MODE_2020B) ||
(mode == FREEDV_MODE_2020C)) {
(mode == FREEDV_MODE_2020) || (mode == FREEDV_MODE_2020B)) {
int Tbits_coded = freedv_get_total_bits_coded(freedv);
int Terrs_coded = freedv_get_total_bit_errors_coded(freedv);
float coded_ber = (float)Terrs_coded / Tbits_coded;
Expand Down
3 changes: 1 addition & 2 deletions src/freedv_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) {
reliable_text_t reliable_text_obj;
char f2020[80] = {0};
#ifdef __LPCNET__
sprintf(f2020, "|2020|2020B|2020C");
sprintf(f2020, "|2020|2020B");
#endif

if (argc < 4) {
Expand Down Expand Up @@ -144,7 +144,6 @@ int main(int argc, char *argv[]) {
#ifdef __LPCNET__
if (!strcmp(argv[dx], "2020")) mode = FREEDV_MODE_2020;
if (!strcmp(argv[dx], "2020B")) mode = FREEDV_MODE_2020B;
if (!strcmp(argv[dx], "2020C")) mode = FREEDV_MODE_2020C;
#endif
if (mode == -1) {
fprintf(stderr, "Error in mode: %s\n", argv[dx]);
Expand Down
1 change: 0 additions & 1 deletion src/interldpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ void ldpc_mode_specific_setup(struct OFDM *ofdm, struct LDPC *ldpc) {
set_data_bits_per_frame(ldpc, 156);
ldpc->protection_mode = LDPC_PROT_2020B;
}
if (!strcmp(ofdm->mode, "2020C")) set_data_bits_per_frame(ldpc, 156);
if (!strcmp(ofdm->mode, "datac4")) set_data_bits_per_frame(ldpc, 448);
if (!strcmp(ofdm->mode, "datac13")) set_data_bits_per_frame(ldpc, 128);
}
Expand Down
3 changes: 2 additions & 1 deletion src/ldpc_codes.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ struct LDPC ldpc_codes[] = {
HRAb_396_504_MAX_ROW_WEIGHT, HRAb_396_504_MAX_COL_WEIGHT,
(uint16_t *)HRAb_396_504_H_rows, (uint16_t *)HRAb_396_504_H_cols},

/* Rate 0.745 code for mopping up errors on 2020C from Bill VK5DSP */
/* Rate 0.745 code for mopping up errors on 2020C from Bill
VK5DSP. 2020C has been removed but code might be useful in future */
{"H_212_158", H_212_158_MAX_ITER, 0, 1, 1, H_212_158_CODELENGTH,
H_212_158_NUMBERPARITYBITS, H_212_158_NUMBERROWSHCOLS,
H_212_158_MAX_ROW_WEIGHT, H_212_158_MAX_COL_WEIGHT,
Expand Down
2 changes: 1 addition & 1 deletion src/ofdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static void allocate_tx_bpf(struct OFDM *ofdm) {
quisk_filt_cfInit(ofdm->tx_bpf, filtP900S1100,
sizeof(filtP900S1100) / sizeof(float));
quisk_cfTune(ofdm->tx_bpf, ofdm->tx_centre / ofdm->fs);
} else if (!strcmp(ofdm->mode, "2020B") || !strcmp(ofdm->mode, "2020C")) {
} else if (!strcmp(ofdm->mode, "2020B")) {
quisk_filt_cfInit(ofdm->tx_bpf, filtP1100S1300,
sizeof(filtP1100S1300) / sizeof(float));
quisk_cfTune(ofdm->tx_bpf, ofdm->tx_centre / ofdm->fs);
Expand Down
16 changes: 0 additions & 16 deletions src/ofdm_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,6 @@ void ofdm_init_mode(char mode[], struct OFDM_CONFIG *config) {
config->state_machine = "voice2";
config->ftwindowwidth = 64;
config->foff_limiter = true;
} else if (strcmp(mode, "2020C") == 0) {
config->ts = 0.014;
config->tcp = 0.004;
config->nc = 29;
config->ns = 5;
config->codename = "H_212_158";
config->txtbits = 4;
config->nuwbits = 8 * 2;
config->bad_uw_errors = 5;
config->amp_scale = 130E3;
config->clip_gain1 = 2.5;
config->clip_gain2 = 0.8;
config->edge_pilots = 0;
config->state_machine = "voice2";
config->ftwindowwidth = 64;
config->foff_limiter = true;
} else if (strcmp(mode, "qam16") == 0) {
/* not in use yet */
config->ns = 5;
Expand Down
1 change: 0 additions & 1 deletion unittest/check_peak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ if [ "$1" == "LPCNet" ]; then
# these don't get run unless we build with LPCNet
voice_test "2020"
voice_test "2020B"
voice_test "2020C"
else
voice_test "1600"
voice_test "700C"
Expand Down

0 comments on commit 4d6c143

Please sign in to comment.