Browse Source

send whole modem frames to dml

use lower amplitude as 0dB
master
Jeroen Vreeken 9 months ago
parent
commit
7baad6d059
3 changed files with 20 additions and 12 deletions
  1. +5
    -8
      freedv_eth_rx.c
  2. +1
    -1
      freedv_eth_rxa.c
  3. +14
    -3
      freedv_eth_transcode.c

+ 5
- 8
freedv_eth_rx.c View File

@ -106,14 +106,11 @@ void freedv_eth_rx(int16_t *hw_samples, int hw_nr)
cdc |= (ret && rx_sync > RX_SYNC_THRESHOLD);
if (ret && cdc) {
int i;
for (i = 0; i < bytes_per_freedv_frame/bytes_per_codec2_frame; i++) {
freedv_eth_voice_rx(
bcast, rx_add, eth_type_rx,
packed_codec_bits + i * bytes_per_codec2_frame,
bytes_per_codec2_frame, true,
transmission, level_dbm);
}
freedv_eth_voice_rx(
bcast, rx_add, eth_type_rx,
packed_codec_bits,
bytes_per_freedv_frame, true,
transmission, level_dbm);
printf(".");
fflush(NULL);
cdc_voice = true;


+ 1
- 1
freedv_eth_rxa.c View File

@ -164,7 +164,7 @@ int freedv_eth_rxa_init(int hw_rate, uint8_t mac_init[ETH_AR_MAC_SIZE],
val=1;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &val);
// Add factor 2.0 since speex seems to aim on half the value
fval=32768.0 / rx_gain * 2.0;
fval=32768.0 / rx_gain;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &fval);
val = 40; // default 12


+ 14
- 3
freedv_eth_transcode.c View File

@ -36,6 +36,7 @@ struct freedv_eth_transcode {
int trans_enc_mode;
int trans_enc_samples_frame;
int trans_enc_bytes_frame;
int trans_dec_bytes_frame;
int trans_rate_native;
struct sound_resample *sr;
int sr_rate_in;
@ -106,8 +107,12 @@ int freedv_eth_transcode(struct freedv_eth_transcode *tc, struct tx_packet *pack
codec2_destroy(tc->trans_dec);
tc->trans_dec_mode = from_codecmode;
tc->trans_dec = codec2_create(tc->trans_dec_mode);
tc->trans_dec_bytes_frame = codec2_bits_per_frame(tc->trans_dec);
tc->trans_dec_bytes_frame += 7;
tc->trans_dec_bytes_frame /= 8;
}
samples_in = codec2_samples_per_frame(tc->trans_dec);
int frames = packet->len / tc->trans_dec_bytes_frame;
samples_in = codec2_samples_per_frame(tc->trans_dec) * frames;
break;
}
}
@ -149,9 +154,15 @@ int freedv_eth_transcode(struct freedv_eth_transcode *tc, struct tx_packet *pack
}
break;
}
default:
codec2_decode(tc->trans_dec, speech_in, packet->data);
default: {
int cbytes = 0;
int i;
for (i = 0; i < samples_in; i+= codec2_samples_per_frame(tc->trans_dec)) {
codec2_decode(tc->trans_dec, speech_in + i, packet->data + cbytes);
cbytes += tc->trans_dec_bytes_frame;
}
break;
}
}
int samples_out = 0;


Loading…
Cancel
Save