From d01a49dffb8465faffa16495efe4c31adcbe7732 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 6 May 2024 17:17:30 +0200 Subject: [PATCH 1/2] Update LC3plus version to V1.5.1 --- lib_dec/lib_dec.c | 4 +- lib_lc3plus/.clang-format | 1 + lib_lc3plus/adjust_global_gain.c | 9 +- lib_lc3plus/al_fec_fl.c | 4 +- lib_lc3plus/apply_global_gain.c | 3 +- lib_lc3plus/ari_codec.c | 819 +--------- lib_lc3plus/attack_detector.c | 3 +- lib_lc3plus/clib.h | 3 +- lib_lc3plus/constants.c | 24 +- lib_lc3plus/constants.h | 20 +- lib_lc3plus/cutoff_bandwidth.c | 3 +- lib_lc3plus/dct4.c | 7 +- lib_lc3plus/dec_entropy.c | 3 +- lib_lc3plus/dec_lc3_fl.c | 34 +- lib_lc3plus/defines.h | 85 +- lib_lc3plus/detect_cutoff_warped.c | 5 +- lib_lc3plus/enc_entropy.c | 3 +- lib_lc3plus/enc_lc3_fl.c | 19 +- lib_lc3plus/estimate_global_gain.c | 3 +- lib_lc3plus/fft/cfft.c | 4 +- lib_lc3plus/fft/cfft.h | 4 +- lib_lc3plus/fft/fft_15_16.h | 3 +- lib_lc3plus/fft/fft_240_480.h | 3 +- lib_lc3plus/fft/fft_2_9.h | 3 +- lib_lc3plus/fft/fft_32.h | 3 +- lib_lc3plus/fft/fft_384_768.h | 3 +- lib_lc3plus/fft/fft_60_128.h | 3 +- lib_lc3plus/fft/fft_generic.h | 3 +- lib_lc3plus/fft/iis_fft.c | 7 +- lib_lc3plus/fft/iis_fft.h | 3 +- lib_lc3plus/fft/iisfft.c | 4 +- lib_lc3plus/fft/iisfft.h | 3 +- lib_lc3plus/functions.h | 36 +- lib_lc3plus/imdct.c | 3 +- lib_lc3plus/lc3.c | 20 +- lib_lc3plus/lc3.h | 9 +- lib_lc3plus/lc3plus_fft.c | 3 +- lib_lc3plus/license.h | 5 +- lib_lc3plus/ltpf_coder.c | 14 +- lib_lc3plus/ltpf_decoder.c | 95 +- lib_lc3plus/mdct.c | 12 +- lib_lc3plus/mdct_shaping.c | 3 +- lib_lc3plus/near_nyquist_detector.c | 16 +- lib_lc3plus/noise_factor.c | 5 +- lib_lc3plus/noise_filling.c | 5 +- lib_lc3plus/olpa.c | 32 +- lib_lc3plus/pc_apply.c | 4 +- lib_lc3plus/pc_classify.c | 4 +- lib_lc3plus/pc_main.c | 4 +- lib_lc3plus/pc_update.c | 4 +- lib_lc3plus/per_band_energy.c | 9 +- lib_lc3plus/plc_classify.c | 50 +- lib_lc3plus/plc_compute_stab_fac.c | 4 +- lib_lc3plus/plc_damping_scrambling.c | 54 +- lib_lc3plus/plc_main.c | 69 +- lib_lc3plus/plc_noise_substitution.c | 4 +- lib_lc3plus/plc_phecu_f0_refine_first.c | 4 +- lib_lc3plus/plc_phecu_fec_hq.c | 4 +- lib_lc3plus/plc_phecu_hq_ecu.c | 21 +- lib_lc3plus/plc_phecu_lf_peak_analysis.c | 4 +- lib_lc3plus/plc_phecu_rec_frame.c | 10 +- lib_lc3plus/plc_phecu_setf0hz.c | 4 +- lib_lc3plus/plc_phecu_spec_ana.c | 5 +- lib_lc3plus/plc_phecu_subst_spec.c | 43 +- lib_lc3plus/plc_phecu_tba_per_band_gain.c | 4 +- lib_lc3plus/plc_phecu_tba_spect_Xavg.c | 4 +- lib_lc3plus/plc_phecu_tba_trans_dect_gains.c | 106 +- lib_lc3plus/plc_phecu_trans_burst_ana_sub.c | 10 +- lib_lc3plus/plc_tdc.c | 67 +- lib_lc3plus/plc_tdc_tdac.c | 4 +- lib_lc3plus/plc_update.c | 5 +- lib_lc3plus/quantize_spec.c | 17 +- lib_lc3plus/reorder_bitstream.c | 4 +- lib_lc3plus/resamp12k8.c | 5 +- lib_lc3plus/residual_coding.c | 3 +- lib_lc3plus/residual_decoding.c | 3 +- lib_lc3plus/setup_com_lc3.c | 4 +- lib_lc3plus/setup_dec_lc3.c | 60 +- lib_lc3plus/setup_dec_lc3.h | 9 +- lib_lc3plus/setup_enc_lc3.c | 35 +- lib_lc3plus/setup_enc_lc3.h | 9 +- lib_lc3plus/sns_compute_scf.c | 3 +- lib_lc3plus/sns_interpolate_scf.c | 3 +- lib_lc3plus/sns_quantize_scf.c | 13 +- lib_lc3plus/structs.h | 10 +- lib_lc3plus/tns_coder.c | 7 +- lib_lc3plus/tns_decoder.c | 3 +- lib_lc3plus/util.h | 3 +- scripts/lc3plus_lib_setup/get_lc3plus.sh | 81 +- scripts/lc3plus_lib_setup/lc3plus.patch | 1474 ------------------ scripts/prepare_instrumentation.sh | 3 +- 91 files changed, 280 insertions(+), 3326 deletions(-) delete mode 100644 scripts/lc3plus_lib_setup/lc3plus.patch diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 71f89ea508..331d97e3ad 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3907,8 +3907,10 @@ static void *pcm_buffer_offset( } break; default: - return NULL; + break; } + + return NULL; } diff --git a/lib_lc3plus/.clang-format b/lib_lc3plus/.clang-format index 47a38a93f2..dc13f4a6e0 100644 --- a/lib_lc3plus/.clang-format +++ b/lib_lc3plus/.clang-format @@ -1,2 +1,3 @@ + DisableFormat: true SortIncludes: Never diff --git a/lib_lc3plus/adjust_global_gain.c b/lib_lc3plus/adjust_global_gain.c index 24eb596c87..d5c122d525 100644 --- a/lib_lc3plus/adjust_global_gain.c +++ b/lib_lc3plus/adjust_global_gain.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -19,11 +18,7 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_ LC3_FLOAT delta; LC3_INT delta2; LC3_INT gg_idx_inc; -#ifdef CR8_G_ADD_75MS LC3_FLOAT factor; -#else - LC3_INT factor; -#endif if (frame_dms == 25) { @@ -37,12 +32,10 @@ void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_ { factor = 2; } -#ifdef CR8_G_ADD_75MS else if (frame_dms == 75) { factor = 1.2; } -#endif else { factor = 1; diff --git a/lib_lc3plus/al_fec_fl.c b/lib_lc3plus/al_fec_fl.c index 92861d65b2..adae19dc39 100644 --- a/lib_lc3plus/al_fec_fl.c +++ b/lib_lc3plus/al_fec_fl.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -715,7 +714,6 @@ LC3_INT32 fec_decoder(LC3_UINT8 *iobuf, LC3_INT16 slot_bytes, LC3_INT32 *data_by if (*bfi == 1) { - return ERROR_REPORT_BEC_MASK; } diff --git a/lib_lc3plus/apply_global_gain.c b/lib_lc3plus/apply_global_gain.c index 450997e20e..48305676cd 100644 --- a/lib_lc3plus/apply_global_gain.c +++ b/lib_lc3plus/apply_global_gain.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/ari_codec.c b/lib_lc3plus/ari_codec.c index 23a540e911..5ba87a32bc 100644 --- a/lib_lc3plus/ari_codec.c +++ b/lib_lc3plus/ari_codec.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -19,105 +18,17 @@ static void write_uint_forward_fl(Encoder_State_fl* st, LC3_INT val, LC3_INT num static void ari_enc_init(Encoder_State_fl* st, LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side); static LC3_INT sign(LC3_INT x); -#ifdef CR9_SIMPLIFY_ARI_DECODER static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); -#else -static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left); -#endif -#ifdef CR9_SIMPLIFY_ARI_DECODER -static void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); -#else static void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); -#endif -#ifdef CR9_SIMPLIFY_ARI_DECODER static LC3_INT32 ac_decode_fl(Decoder_State_fl* st, const LC3_INT16* sym_freq, LC3_INT32 num_sym, LC3_UINT8* ptr, LC3_INT32* bp, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin); -#else -static LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side); -#endif -#ifdef CR9_SIMPLIFY_ARI_DECODER static LC3_INT16 pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin); -#else -static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side); -#endif static void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed); static void findNonZero(LC3_INT* in, LC3_INT len, LC3_INT* outLen); -#ifndef CR9_SIMPLIFY_ARI_DECODER -static void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); - -static void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); - -static void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym); - -void ac_freq(LC3_INT pki, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) -{ - LC3_INT i = 0, j = 0; - - *numsym = 18 - 1; - - j = 0; - for (i = 1; i <= *numsym; i++) { - symfreq[j] = ari_spec_cumfreq_fl[pki][i]; - j++; - } - - for (i = 0; i < *numsym; i++) { - symfreq[i] -= ari_spec_cumfreq_fl[pki][i]; - } - - for (i = 0; i < *numsym; i++) { - cumfreq[i] = ari_spec_cumfreq_fl[pki][i]; - } -} - -void tns_coef_freq(LC3_INT k, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) -{ - LC3_INT i = 0, j = 0; - - *numsym = 18 - 1; - - j = 0; - for (i = 1; i <= *numsym; i++) { - symfreq[j] = ari_tns_freq_cf[k][i]; - j++; - } - - for (i = 0; i < *numsym; i++) { - symfreq[i] -= ari_tns_freq_cf[k][i]; - } - - for (i = 0; i < *numsym; i++) { - cumfreq[i] = ari_tns_freq_cf[k][i]; - } -} - -void tns_order_freq(LC3_INT enable_lpc_weighting, LC3_INT* symfreq, LC3_INT* cumfreq, LC3_INT* numsym) -{ - LC3_INT i = 0, j = 0; - - *numsym = 8; - - j = 0; - for (i = 1; i < 9; i++) { - symfreq[j] = ari_tns_order_cf[enable_lpc_weighting][i]; - j++; - } - - for (i = 0; i < *numsym; i++) { - symfreq[i] -= ari_tns_order_cf[enable_lpc_weighting][i]; - } - - for (i = 0; i < *numsym; i++) { - cumfreq[i] = ari_tns_order_cf[enable_lpc_weighting][i]; - } -} - -#endif - void findNonZero(LC3_INT* in, LC3_INT len, LC3_INT* outLen) { LC3_INT i = 0, j = 0; @@ -147,7 +58,6 @@ void calculate_nfseed(LC3_INT *x, LC3_INT L_spec, LC3_INT *nf_seed) } } -#ifdef CR9_SIMPLIFY_ARI_DECODER static LC3_INT16 pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin) { LC3_INT32 bp_local, bp_side_local, offset; @@ -241,95 +151,6 @@ static LC3_INT16 pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT3 return 0; } -#else - -static void pc_check_bytes(LC3_INT32* bp, Decoder_State_fl* st_fl, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side) -{ - LC3_INT32 bp_local, bp_side_local, offset; - - if (st_fl->pc_bytes > 0) - { - if (!from_left && mask_side != 1) - { - return; - } - - if (st_fl->pc_c_bp_side > 0 && *bp_side < 0) - { - assert(mask_side == 1); - assert(st_fl->pc_b_right != -1); - *bp_side = st_fl->pc_b_right; - return; - } - - bp_local = *bp; - bp_side_local = *bp_side; - - if (from_left) - { - if (mask_side == 1) - { - bp_side_local = bp_side_local + 1; - } - } else { - bp_local = bp_local - 1; - } - - if (st_fl->pc_b_right == -1) - { - offset = -1; - if (!st_fl->pc_enc) - { - offset = offset + st_fl->pc_bytes; - } - - if ((bp_side_local + offset - bp_local) == st_fl->pc_bytes) - { - st_fl->pc_b_left = bp_local + 1; - st_fl->pc_b_right = bp_side_local - 1; - - if (st_fl->pc_enc) - { - st_fl->pc_return = 1; - return; - } - } - } - - if (!st_fl->pc_enc && st_fl->pc_b_right > -1) - { - if (from_left && *bp == st_fl->pc_b_left) - { - *bp = 0; - st_fl->pc_c_bp = 1; - } - - if (!from_left && bp_side_local == st_fl->pc_b_right) - { - *bp_side = st_fl->pc_bytes - 1; - st_fl->pc_c_bp_side = 1; - } - - if (st_fl->pc_bfi == 2) - { - - if ((st_fl->pc_c_bp && (*bp + 1) >= st_fl->pc_be_bp_left) || (st_fl->pc_c_bp_side && (*bp_side + 1) <= st_fl->pc_be_bp_right)) - { - st_fl->pc_bbi = 2; - } else if ((st_fl->pc_c_bp && *bp >= 0) || (st_fl->pc_c_bp_side && *bp_side <= (st_fl->pc_bytes - 1))) - { - st_fl->pc_bbi = 1; - } - } - } - } - - return; -} - -#endif - -#ifdef CR9_SIMPLIFY_ARI_DECODER void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) { LC3_INT i; @@ -355,34 +176,7 @@ void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_IN st_fl->BER_detect = 0; } -#else - -void ac_dec_init_fl(LC3_UINT8* ptr, LC3_INT* bp, Decoder_State_fl* st_fl, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) -{ - LC3_INT i = 0; - - if (!st_fl->pc_enc) - { - *bp = *bp + st_fl->pc_bytes; - } - - st_fl->ac_low_fl = 0; - - st_fl->ac_range_fl = (LC3_UINT32)pow(2, 24) - (LC3_UINT32)1; - for (i = 0; i < 3; i++) { - pc_check_bytes(bp, st_fl, from_left, mask_side, bp_side); - - st_fl->ac_low_fl = (st_fl->ac_low_fl << 8) + (LC3_UINT32)ptr[*bp]; - *bp = *bp + 1; - } - - st_fl->BER_detect = 0; -} - -#endif - /* Returns val */ -#ifdef CR9_SIMPLIFY_ARI_DECODER LC3_INT32 ac_decode_fl(Decoder_State_fl* st, const LC3_INT16* freq, LC3_INT32 num_sym, LC3_UINT8* ptr, LC3_INT32* bp, LC3_INT32 from_left, LC3_INT32 mask_side, LC3_INT32 *bp_side, LC3_INT16 cur_bin) { LC3_INT val, tmp, symfreq_loc; @@ -428,46 +222,6 @@ LC3_INT32 ac_decode_fl(Decoder_State_fl* st, const LC3_INT16* freq, LC3_INT32 nu return val; } -#else - -LC3_INT ac_decode_fl(Decoder_State_fl* st, LC3_INT* sym_freq, LC3_INT* cum_freq, LC3_INT num_sym, LC3_UINT8* ptr, LC3_INT* bp, LC3_INT from_left, LC3_INT mask_side, LC3_INT *bp_side) -{ - LC3_INT val = 0, tmp = 0; - - - tmp = st->ac_range_fl >> 10; - - if (st->ac_low_fl >= (LC3_UINT32)(tmp << 10)) { - st->BER_detect = 1; - } - - val = num_sym - 1; - - while (st->ac_low_fl < (LC3_UINT32)(tmp * cum_freq[val])) { - val--; - } - - st->ac_low_fl = st->ac_low_fl - tmp * cum_freq[val]; - st->ac_range_fl = tmp * sym_freq[val]; - - while (st->ac_range_fl < pow(2, 16)) { - st->ac_low_fl = st->ac_low_fl << 8; - st->ac_low_fl = ((LC3_INT)st->ac_low_fl) & ((LC3_INT)(pow(2, 24) - 1)); - - pc_check_bytes(bp, st, from_left, mask_side, bp_side); - - st->ac_low_fl = st->ac_low_fl + ptr[*bp]; - *bp = *bp + 1; - st->ac_range_fl = st->ac_range_fl << 8; - } - - return val; -} - - -#endif - -#ifdef CR9_SIMPLIFY_ARI_DECODER void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit) { if (ptr[*bp_side] & *mask_side) { @@ -484,33 +238,6 @@ void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* } } -#else - -void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit, LC3_INT *bp, Decoder_State_fl* st_fl, LC3_INT from_left) -{ - *bit = 0; - - UNUSED(bp); - UNUSED(st_fl); - UNUSED(from_left); - - if (ptr[*bp_side] & *mask_side) { - *bit = 1; - } else { - *bit = 0; - } - - if (*mask_side == 128) { - *mask_side = 1; - *bp_side = *bp_side - 1; - } else { - *mask_side = *mask_side * 2; - } -} - -#endif - -#ifdef CR9_SIMPLIFY_ARI_DECODER void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting, LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx, LC3_INT gg_idx, uint8_t * resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes, @@ -938,550 +665,6 @@ bail: (void)0; } -#else - - -void processAriDecoder_fl(LC3_UINT8* bytes, LC3_INT bp_side, LC3_INT mask_side, LC3_INT L_spec, LC3_INT fs_idx, LC3_INT enable_lpc_weighting, - LC3_INT tns_numfilters, LC3_INT lsbMode, LC3_INT lastnz, LC3_INT* bfi, LC3_INT* tns_order, LC3_INT fac_ns_idx, - LC3_INT gg_idx, uint8_t * resBits, LC3_INT* x, LC3_INT* nf_seed, LC3_INT* tns_idx, LC3_INT* zero_frame, LC3_INT numbytes, - LC3_INT* nbits_residual, LC3_INT* residualPresent, LC3_INT frame_dms, - LC3_INT32 n_pc, LC3_INT32 be_bp_left, LC3_INT32 be_bp_right, LC3_INT32 enc, LC3_INT32 *b_left, LC3_INT32 *spec_inv_idx, - LC3_INT hrmode -) -{ - Decoder_State_fl st; - LC3_INT a = 0, b = 0, t = 0, bp = 0; - LC3_INT c = 0; - LC3_INT nbits_side = 0, extra_bits = 0; - LC3_UINT8* ptr = NULL; - LC3_INT n = 0, k = 0, lev = 0; - LC3_INT max_lev = 0, tmp = 0; - LC3_INT sym_freq[MAX_LEN] = {0}, cum_freq[MAX_LEN] = {0}, numsym = 0, bit = 0, lev1 = 0, pki = 0, sym = 0, - save_lev[MAX_LEN] = {0}, idx_len = 0, total_bits = 0, nbits_ari = 0, rateFlag = 0; - - total_bits = 8 * numbytes; - - memset(&st, 0, sizeof(st)); - - - st.pc_bytes = (n_pc + 1) >> 1; - st.pc_b_left = numbytes + 1; - st.pc_b_right = -1; - st.pc_enc = enc; - st.pc_bfi = *bfi; - st.pc_be_bp_left = floor(be_bp_left / 8); - st.pc_be_bp_right = floor(be_bp_right / 8) - 1; - *spec_inv_idx = L_spec + 1; - assert(st.pc_be_bp_right < st.pc_bytes || st.pc_bytes == 0); - - /* Rate flag */ - if (fs_idx != 5) - { - if (total_bits > (160 + fs_idx * 160)) { - rateFlag = 512; - } - } - - /* Init */ - c = 0; - t = 0; - bp = 0; - - *b_left = -1; - - ptr = bytes; - - /* Start Decoding */ - ac_dec_init_fl(ptr, &bp, &st, 1, mask_side, &bp_side); - - /* Decode TNS data */ - tmp = MAXLAG; - if (frame_dms == 25) - { - tmp /= 2; - } - if (frame_dms == 50) - { - tmp /= 2; - } - - /* Decode TNS data */ - for (n = 0; n < tns_numfilters; n++) { - - if (tns_order[n] > 0) { - tns_order_freq(enable_lpc_weighting, sym_freq, cum_freq, &numsym); - - tns_order[n] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - tns_order[n] = tns_order[n] + 1; - - if (tns_order[n] > tmp) - { - st.BER_detect = 1; - } - - if (st.pc_bbi == 1) - { - spec_inv_idx = 0; - } else if (st.pc_bbi == 2) - { - st.BER_detect = 1; - } - - for (k = 0; k < tns_order[n]; k++) { - if (bp_side < bp) - { - *bfi = 1; - return; - } - - tns_coef_freq(k, sym_freq, cum_freq, &numsym); - tns_idx[n * 8 + k] = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 1) - { - spec_inv_idx = 0; - } else if (st.pc_bbi == 2) - { - st.BER_detect = 1; - } - } - } - } - - if (st.BER_detect > 0) { - *bfi = 1; - return; - } - - /* Spectral data */ - for (k = 0; k < lastnz; k = k + 2) { - /* Context */ - t = c + rateFlag; - - if (k > L_spec / 2) { - t = t + 256; - } - - /* Decode amplitude */ - x[k] = 0; - x[k + 1] = 0; - - if (hrmode == 1) { - max_lev = 13 + 8; - } else { - max_lev = 13; - } - - for (lev = 0; lev <= max_lev; lev++) { - lev1 = MIN(lev, 3); - pki = ari_spec_lookup_fl[t + lev1 * 1024]; - ac_freq(pki, sym_freq, cum_freq, &numsym); - sym = ac_decode_fl(&st, sym_freq, cum_freq, numsym, ptr, &bp, 1, mask_side, &bp_side); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 1) - { - *spec_inv_idx = MIN(*spec_inv_idx, k); - } else if (st.pc_bbi == 2) - { - *spec_inv_idx = k; - x[k] = 0; - x[k + 1] = 0; - calculate_nfseed(x, k, nf_seed); - return; - } - - if (sym < 16) { - break; - } - - if (lsbMode == 0 || lev > 0) { - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *spec_inv_idx = k; - x[k] = 0; - x[k + 1] = 0; - calculate_nfseed(x, k, nf_seed); - return; - } - - x[k] = x[k] + (bit << lev); - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *spec_inv_idx = k; - x[k] = 0; - x[k + 1] = 0; - calculate_nfseed(x, k, nf_seed); - return; - } - - x[k + 1] = x[k + 1] + (bit << lev); - } - } - - if ((lev - 1) == 13 && sym == 16) - { - st.BER_detect = 1; - } - - if (hrmode == 0) { - lev = MIN(lev, 13); - } - - if (lsbMode == 1) { - save_lev[k] = lev; - } - - a = sym & 3; - b = sym >> 2; - - x[k] = x[k] + (a << lev); - x[k + 1] = x[k + 1] + (b << lev); - - /* Decode signs */ - if (x[k] > 0) { - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *spec_inv_idx = k; - x[k] = 0; - x[k + 1] = 0; - calculate_nfseed(x, k, nf_seed); - return; - } - - if (bit == 1) { - x[k] = -x[k]; - } - } - - if (x[k + 1] > 0) { - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *spec_inv_idx = k + 1; - x[k + 1] = 0; - calculate_nfseed(x, k, nf_seed); - return; - } - - if (bit == 1) { - x[k + 1] = -x[k + 1]; - } - } - - /* Context */ - lev1 = MIN(lev, 3); - if (lev1 <= 1) { - t = 1 + (a + b) * (lev1 + 1); - } else { - t = 12 + lev1; - } - - c = (c & 15) * 16 + t; - - if (((bp - bp_side) > 3 && (st.pc_c_bp == st.pc_c_bp_side))) { - - if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) - { - *bfi = 2; - calculate_nfseed(x, k, nf_seed); - return; - } - - *bfi = 1; - return; - } - - if (st.BER_detect > 0) - { - if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) - { - *bfi = 2; - calculate_nfseed(x, k, nf_seed); - return; - } - - *bfi = 1; - return; - } - } - - /* Residual bits */ - nbits_side = total_bits - (8 * bp_side + 8 - (31 - clz_func(mask_side))); - nbits_ari = (bp - 3) * 8; - extra_bits = 25 - (31 - clz_func(st.ac_range_fl)); - - if (enc == 0) - { - if (st.pc_c_bp == 0) - { - nbits_ari = (bp - st.pc_bytes - 3) * 8; - } else { - nbits_ari = (bp + st.pc_b_left - st.pc_bytes - 3) * 8; - } - - if (st.pc_c_bp_side != 0) - { - nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side)); - } - } - - - *nbits_residual = total_bits - (nbits_side + nbits_ari + extra_bits); - - if (*nbits_residual < 0) { - if ((0 < *spec_inv_idx) && (*spec_inv_idx < (L_spec + 1))) - { - *bfi = 2; - calculate_nfseed(x, k, nf_seed); - return; - } - - *bfi = 1; - return; - } - - if (lsbMode == 0) { - findNonZero(x, L_spec, &idx_len); - if (hrmode) - { - idx_len *= EXT_RES_ITER_MAX; - } - *nbits_residual = MIN(*nbits_residual, idx_len); - *residualPresent = 1; - - memset(resBits, 0, MAX_RESBITS_LEN); - - for (k = 0; k < *nbits_residual; k++) { - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &tmp, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *bfi = 0; - memset(resBits, 0, sizeof(uint8_t) * (*nbits_residual)); - calculate_nfseed(x, k, nf_seed); - return; - } - - resBits[k >> 3] |= tmp << (k & 7); - } - } else { - for (k = 0; k < lastnz; k = k + 2) { - if (save_lev[k] > 0) { - if (*nbits_residual == 0) { - break; - } - - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *bfi = 0; - memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); - calculate_nfseed(x, k, nf_seed); - return; - } - - *nbits_residual = *nbits_residual - 1; - - if (bit == 1) { - if (x[k] > 0) { - x[k] = x[k] + 1; - } else if (x[k] < 0) { - x[k] = x[k] - 1; - } else { - if (*nbits_residual == 0) { - break; - } - - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *bfi = 0; - memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); - calculate_nfseed(x, k, nf_seed); - return; - } - - *nbits_residual = *nbits_residual - 1; - - if (bit == 0) { - x[k] = 1; - } else { - x[k] = -1; - } - } - } - - if (*nbits_residual == 0) { - break; - } - - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *bfi = 0; - memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); - calculate_nfseed(x, k, nf_seed); - return; - } - - *nbits_residual = *nbits_residual - 1; - - if (bit == 1) { - if (x[k + 1] > 0) { - x[k + 1] = x[k + 1] + 1; - } else if (x[k + 1] < 0) { - x[k + 1] = x[k + 1] - 1; - } else { - if (*nbits_residual == 0) { - break; - } - - pc_check_bytes(&bp, &st, 0, mask_side, &bp_side); - read_bit_fl(ptr, &mask_side, &bp_side, &bit, &bp, &st, 0); - - if (st.pc_return) - { - *b_left = st.pc_b_left; - return; - } - - if (st.pc_bbi == 2) - { - *bfi = 0; - memset(resBits, 0, sizeof(LC3_INT32) * (*nbits_residual)); - calculate_nfseed(x, k, nf_seed); - return; - } - - *nbits_residual = *nbits_residual - 1; - - if (bit == 0) { - x[k + 1] = 1; - } else { - x[k + 1] = -1; - } - } - } - } - } - } - - /* Noise-filling seed */ - calculate_nfseed(x, L_spec, nf_seed); - - /* Zero frame flag */ - if (lastnz == 2 && x[0] == 0 && x[1] == 0 && gg_idx == 0 && fac_ns_idx == 7) { - *zero_frame = 1; - } else { - *zero_frame = 0; - } - - if (enc) - { - if (st.pc_bytes > 0) - { - if (st.pc_b_left > numbytes) - { - *b_left = bp_side - st.pc_bytes; - } - } - } - - if ((*bfi == 2) && (*spec_inv_idx == (L_spec + 1))) - { - *bfi = 0; - } - - *spec_inv_idx = *spec_inv_idx - 1; -} - -#endif - void ac_encode_fl(Encoder_State_fl* st, LC3_INT sym_freq, LC3_INT cum_freq) { LC3_INT r; diff --git a/lib_lc3plus/attack_detector.c b/lib_lc3plus/attack_detector.c index 59af3abfdc..10e3617c8b 100644 --- a/lib_lc3plus/attack_detector.c +++ b/lib_lc3plus/attack_detector.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/clib.h b/lib_lc3plus/clib.h index 44e70de788..7d2fb7bb10 100644 --- a/lib_lc3plus/clib.h +++ b/lib_lc3plus/clib.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef CLIB_H #define CLIB_H diff --git a/lib_lc3plus/constants.c b/lib_lc3plus/constants.c index 3709a3f5a4..047b21226d 100644 --- a/lib_lc3plus/constants.c +++ b/lib_lc3plus/constants.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -1000,7 +999,6 @@ const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER] = {0, 1, 2, 2, 3, 0}; const LC3_INT BW_cutoff_bin_all_5ms[MAX_BW_BANDS_NUMBER] = {40, 80, 120, 160, 200, 200}; const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER] = {20, 40, 60, 80, 100, 100}; -#ifdef CR8_G_ADD_75MS const LC3_INT BW_cutoff_bin_all_7_5ms[] = {60, 120, 180, 240, 300, 300}; const LC3_INT bands_number_7_5ms_HR [] = {60, 64, 64, 64, 64, 64}; const LC3_INT bands_number_7_5ms [] = {60, 64, 64, 64, 64}; @@ -1023,7 +1021,6 @@ const LC3_INT* BW_warp_idx_start_all_7_5ms[4] = {BW_warp_idx_start_16k_7_5ms, BW BW_warp_idx_start_32k_7_5ms, BW_warp_idx_start_48k_7_5ms}; const LC3_INT* BW_warp_idx_stop_all_7_5ms[4] = {BW_warp_idx_stop_16k_7_5ms, BW_warp_idx_stop_24k_7_5ms, BW_warp_idx_stop_32k_7_5ms, BW_warp_idx_stop_48k_7_5ms}; -#endif /* Arithmetic coding */ const LC3_INT tns_cf[8][18] = {{0, 1, 6, 21, 52, 106, 192, 289, 409, 568, 720, 831, 935, 994, 1016, 1022, 1023, 1024}, @@ -1039,9 +1036,6 @@ const LC3_INT tns_freq_cf[2][9] = {{0, 3, 12, 35, 89, 200, 390, 658, 1024}, {0, /* MDCT Windows */ - -#ifdef CR8_G_ADD_75MS - const LC3_FLOAT MDCT_HRA_WINDOW_480_7_5ms[720] = { 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00, @@ -3404,7 +3398,6 @@ const LC3_FLOAT MDCT_WINDOW_480_7_5ms[720] = {0.00172152668161197, 0, 0, 0}; -#endif /* #ifdef CR8_G_ADD_75MS */ const LC3_FLOAT MDCT_WINDOW_80_2_5ms[40] = { 6.737914289329320e-03, 2.732289618100209e-02, 6.163560962361236e-02, 1.119125037883055e-01, 1.787053464784875e-01, @@ -5488,12 +5481,10 @@ const LC3_FLOAT* MDCT_WINS_10ms[2][6] = { {NULL, NULL, NULL, NULL, MDCT_HRA_WINDOW_480_10ms, MDCT_HRA_WINDOW_960_10ms}}; const LC3_INT MDCT_la_zeroes[6] = {30, 60, 90, 120, 180, 360}; -#ifdef CR8_G_ADD_75MS const LC3_FLOAT* MDCT_WINS_7_5ms[2][6] = { {MDCT_WINDOW_80_7_5ms, MDCT_WINDOW_160_7_5ms, MDCT_WINDOW_240_7_5ms, MDCT_WINDOW_320_7_5ms, MDCT_WINDOW_480_7_5ms, NULL}, {NULL , NULL , NULL , NULL , MDCT_HRA_WINDOW_480_7_5ms, MDCT_HRA_WINDOW_960_7_5ms}}; const LC3_INT32 MDCT_la_zeroes_7_5ms[6] = {14, 28, 42, 56, 84, 168}; -#endif const LC3_FLOAT* MDCT_WINS_2_5ms[2][6] = { {MDCT_WINDOW_80_2_5ms, MDCT_WINDOW_160_2_5ms, MDCT_WINDOW_240_2_5ms, MDCT_WINDOW_320_2_5ms, MDCT_WINDOW_480_2_5ms, @@ -5624,7 +5615,6 @@ const LC3_INT* ACC_COEFF_PER_BAND_5ms[5] = {ACC_COEFF_PER_BAND_8_5ms, ACC_COEFF_ ACC_COEFF_PER_BAND_24_5ms, ACC_COEFF_PER_BAND_32_5ms, ACC_COEFF_PER_BAND_48_5ms}; -#ifdef CR8_G_ADD_75MS const LC3_INT ACC_COEFF_PER_BAND_8_7_5ms[61] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -5704,17 +5694,14 @@ const LC3_INT ACC_COEFF_PER_BAND_PLC_96_7_5ms[81] = { const LC3_INT* ACC_COEFF_PER_BAND_PLC_7_5ms[] = { ACC_COEFF_PER_BAND_PLC_8_7_5ms, ACC_COEFF_PER_BAND_PLC_16_7_5ms, ACC_COEFF_PER_BAND_PLC_24_7_5ms, ACC_COEFF_PER_BAND_PLC_32_7_5ms, ACC_COEFF_PER_BAND_PLC_48_7_5ms, ACC_COEFF_PER_BAND_PLC_96_7_5ms}; -#endif /* Near Nyquist detector */ const LC3_INT NN_thresh = 30; /* Tone detector */ -#ifdef CR8_E_TONE_DETECTOR const LC3_INT32 TD_HR_thresh_10ms = 83402; const LC3_INT32 TD_HR_thresh_7_5ms = 743496; const LC3_INT32 TD_HR_thresh_5ms = 382564; const LC3_INT32 TD_HR_thresh_2_5ms = 301695; -#endif // CR8_E_TONE_DETECTOR const LC3_INT32 xavg_N_grp[5] = { 4, 5, 6, 7, 8 }; @@ -5722,8 +5709,6 @@ const LC3_INT32 xavg_N_grp[5] = { 4, 5, 6, 7, 8 }; const LC3_INT32 gwlpr[MAX_LGW+1] = { 1, 3*QUOT_LPR_LTR, 5*QUOT_LPR_LTR, 9*QUOT_LPR_LTR, 17*QUOT_LPR_LTR, 33*QUOT_LPR_LTR, 49*QUOT_LPR_LTR, 65*QUOT_LPR_LTR, 81*QUOT_LPR_LTR, 97*QUOT_LPR_LTR}; - -#ifdef CR8_A_PLC_FADEOUT_TUNING /* PLC_FADEOUT_TUNING, extended table ranging from 30 ms to 140 ms */ const LC3_INT16 fade_scheme_tab[24 / 2][3] = { /* tabled {att_per_frame_idx_p3dB , burst_att_thresh, beta_mute_thr } */ @@ -5742,11 +5727,8 @@ const LC3_INT16 fade_scheme_tab[24 / 2][3] = { }; - - /*compressed ATH Abolute hearing THreshold function weights at band borders */ const LC3_FLOAT scATHFx[MAX_LGW - 2] = { .455444335937500 , 0.930755615234375 , 0.973083496093750 , 0.999969482421875 , 0.908508300781250 , 0.775665283203125 , 0.5 }; -#endif const LC3_FLOAT PhECU_whr16ms_NB[128]={ 8.000000000000002e-02, 8.393536376804722e-02, 9.567411990702857e-02, 1.150154150448081e-01, 1.416283142591582e-01, @@ -6330,7 +6312,7 @@ const LC3_INT* ACC_COEFF_PER_BAND_PLC_5ms[] = { const LC3_INT32 mdct_grp_bins[10] = { 4, 14, 24, 44, 84, 164, 244, 324, 404, 484 }; -#if defined(CR8_A_PLC_FADEOUT_TUNING) const LC3_INT16 plc_fadeout_param_maxlen[4] = {800, 400, 266, 200}; const LC3_INT16 plc_fadeout_param_maxbytes[4] = {27, 14, 9, 7}; -#endif + +const LC3_INT16 PLC_FADEOUT_TYPE_2_SELECTOR = 10; /* can take values from 0 to 10, default is 10 for longer fadeout */ diff --git a/lib_lc3plus/constants.h b/lib_lc3plus/constants.h index ace0f93830..88d9ed137d 100644 --- a/lib_lc3plus/constants.h +++ b/lib_lc3plus/constants.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef CONSTANTS_H #define CONSTANTS_H @@ -114,7 +113,6 @@ extern const LC3_INT bands_number_2_5ms_HR[6]; extern const LC3_INT BW_cutoff_bin_all_2_5ms[MAX_BW_BANDS_NUMBER]; extern const LC3_INT bands_number_2_5ms[5]; - extern const LC3_INT BW_warp_idx_start_16k_5ms[4]; extern const LC3_INT BW_warp_idx_stop_16k_5ms[4]; extern const LC3_INT BW_warp_idx_start_24k_5ms[4]; @@ -132,7 +130,6 @@ extern const LC3_INT BW_cutoff_bin_all_5ms_HR[MAX_BW_BANDS_NUMBER]; extern const LC3_INT BW_cutoff_bin_all[MAX_BW_BANDS_NUMBER]; extern const LC3_INT BW_cutoff_bits_all[MAX_BW_BANDS_NUMBER]; -#ifdef CR8_G_ADD_75MS extern const LC3_INT BW_cutoff_bin_all_7_5ms[MAX_BW_BANDS_NUMBER]; extern const LC3_INT bands_number_7_5ms[6]; extern const LC3_INT bands_number_7_5ms_HR[6]; @@ -140,7 +137,6 @@ extern const LC3_INT* BW_warp_idx_start_all_7_5ms[4]; extern const LC3_INT* BW_warp_idx_stop_all_7_5ms[4]; extern const LC3_INT brickwall_dist_7_5ms[4]; extern const LC3_INT* ACC_COEFF_PER_BAND_PLC_7_5ms[]; -#endif /* Arithmetic coding */ extern const LC3_INT tns_cf[8][18]; @@ -172,10 +168,8 @@ extern const LC3_FLOAT MDCT_WINDOW_480_5ms[480]; extern const LC3_FLOAT* MDCT_WINS_5ms[2][6]; extern const LC3_INT MDCT_la_zeroes_5ms[6]; -#ifdef CR8_G_ADD_75MS extern const LC3_FLOAT* MDCT_WINS_7_5ms[2][6]; extern const LC3_INT32 MDCT_la_zeroes_7_5ms[6]; -#endif extern const LC3_INT MDCT_WINDOWS_LENGTHS_10ms[6]; extern const LC3_INT MDCT_WINDOWS_LENGTHS_7_5ms[6]; @@ -189,10 +183,8 @@ extern const LC3_INT* ACC_COEFF_PER_BAND_HR[6]; extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms_HR[6]; extern const LC3_INT* ACC_COEFF_PER_BAND_2_5ms[5]; -#ifdef CR8_G_ADD_75MS extern const LC3_INT* ACC_COEFF_PER_BAND_7_5ms_HR[6]; extern const LC3_INT* ACC_COEFF_PER_BAND_7_5ms[5]; -#endif extern const LC3_INT* ACC_COEFF_PER_BAND_5ms_HR[6]; extern const LC3_INT* ACC_COEFF_PER_BAND_5ms[5]; @@ -200,20 +192,16 @@ extern const LC3_INT* ACC_COEFF_PER_BAND_5ms[5]; /* Near Nyquist detector */ extern const LC3_INT NN_thresh; /* Tone detector */ -#ifdef CR8_E_TONE_DETECTOR extern const LC3_INT32 TD_HR_thresh_10ms; extern const LC3_INT32 TD_HR_thresh_7_5ms; extern const LC3_INT32 TD_HR_thresh_5ms; -extern const LC3_INT32 TD_HR_thresh_2_5ms; -#endif // CR8_E_TONE_DETECTOR +extern const LC3_INT32 TD_HR_thresh_2_5ms; extern const LC3_INT32 xavg_N_grp[5]; extern const LC3_FLOAT *hannOla_wins[5]; extern const LC3_INT32 gwlpr[MAX_LGW+1]; -#ifdef CR8_A_PLC_FADEOUT_TUNING extern const LC3_INT16 fade_scheme_tab[24 / 2][3]; extern const LC3_FLOAT scATHFx[MAX_LGW - 2]; -#endif extern const LC3_INT32 mdct_grp_bins[10]; extern const LC3_FLOAT* PhECU_whr16ms_wins[5]; @@ -230,9 +218,7 @@ extern const LC3_FLOAT plc_tdc_lpc_48[17]; extern const LC3_FLOAT plc_tdc_lpc_96[17]; extern const LC3_FLOAT plc_tdc_lpc_8_25ms[9]; -#if defined(CR8_A_PLC_FADEOUT_TUNING) extern const LC3_INT16 plc_fadeout_param_maxlen[4]; extern const LC3_INT16 plc_fadeout_param_maxbytes[4]; -#endif - +extern const LC3_INT16 PLC_FADEOUT_TYPE_2_SELECTOR; #endif /* CONSTANTS_H */ diff --git a/lib_lc3plus/cutoff_bandwidth.c b/lib_lc3plus/cutoff_bandwidth.c index c0ee62c62c..a2a617bd0d 100644 --- a/lib_lc3plus/cutoff_bandwidth.c +++ b/lib_lc3plus/cutoff_bandwidth.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/dct4.c b/lib_lc3plus/dct4.c index 055db02cbd..4b4a3f6a0f 100644 --- a/lib_lc3plus/dct4.c +++ b/lib_lc3plus/dct4.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -56,8 +55,8 @@ void dct4_init(Dct4* dct, int length) dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); for (i = 0; i < length / 2; i++) { - dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI * (i + (LC3_FLOAT)0.25) / length); - dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI * i / length); + dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * (i + (LC3_FLOAT)0.25) / length); + dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * i / length); } fft_init(&dct->fft, length / 2); } diff --git a/lib_lc3plus/dec_entropy.c b/lib_lc3plus/dec_entropy.c index 4e1f830a24..cd82570a81 100644 --- a/lib_lc3plus/dec_entropy.c +++ b/lib_lc3plus/dec_entropy.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/dec_lc3_fl.c b/lib_lc3plus/dec_lc3_fl.c index 6483265677..f86eff3430 100644 --- a/lib_lc3plus/dec_lc3_fl.c +++ b/lib_lc3plus/dec_lc3_fl.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs_in, void* s_out, int bps, int bfi_ext) { DecSetup* h_DecSetup; @@ -65,11 +63,9 @@ static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs case 50: max_bw_stopband = max_bw_stopband >> 1; break; -#ifdef CR8_G_ADD_75MS case 75: max_bw_stopband = 3 * (max_bw_stopband >> 2); break; -#endif case 100: break; } @@ -149,9 +145,7 @@ static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs h_DecSetup->PlcSetup.q_d_prev, h_DecSetup->sqQdec_fl, h_DecSetup->spec_inv_idx, decoder->yLen, bfi, decoder->frame_dms, h_DecSetup->concealMethod, h_DecSetup->ltpf_mem_pitch, h_DecSetup->ltpf_param[0], &h_DecSetup->PlcAdvSetup->cum_fflcAtten -#ifdef CR8_A_PLC_FADEOUT_TUNING , h_DecSetup->PlcAdvSetup->plc_fadeout_type -#endif ); /* IMDCT */ @@ -172,9 +166,7 @@ static int Dec_LC3PLUS_Channel_fl(LC3PLUS_Dec* decoder, int channel, uint8_t* bs bfi, h_DecSetup->ltpf_param, h_DecSetup->ltpf_param_mem, h_DecSetup->ltpf_conf_beta_idx, h_DecSetup->ltpf_conf_beta, h_DecSetup->concealMethod, h_DecSetup->alpha , &h_DecSetup->ltpf_mem_active -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , &h_DecSetup->rel_pitch_change, decoder->hrmode, decoder->frame_dms -#endif ); { @@ -244,7 +236,10 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num } bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi); - input += decoder->channel_setup[ch]->targetBytes; + if (input != NULL) + { + input += decoder->channel_setup[ch]->targetBytes; + } } } else @@ -275,7 +270,11 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num channel_bfi = 1; } - input = input + np_zero; + if (input != NULL) + { + input = input + np_zero; + } + decoder->n_pc = MAX(decoder->n_pc - (2 * np_zero), 0); if (channel_bfi == 2) @@ -313,7 +312,10 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num channel_bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, channel_bfi); out_bfi |= channel_bfi; - input += fec_num_bytes; + if (input != NULL) + { + input += fec_num_bytes; + } } bfi = out_bfi & 1; @@ -360,14 +362,16 @@ LC3PLUS_Error Dec_LC3PLUS_fl(LC3PLUS_Dec* decoder, uint8_t* input, LC3_INT32 num } bfi = Dec_LC3PLUS_Channel_fl(decoder, ch, input, output[ch], bps, bfi); - input += decoder->channel_setup[ch]->targetBytes; + if (input != NULL) + { + input += decoder->channel_setup[ch]->targetBytes; + } } } - if ((decoder->last_error == LC3PLUS_OK) && bfi) + if ((decoder->last_error == LC3PLUS_OK) && bfi) { decoder->last_error = LC3PLUS_DECODE_ERROR; } - return bfi == 1 ? LC3PLUS_DECODE_ERROR : LC3PLUS_OK; } diff --git a/lib_lc3plus/defines.h b/lib_lc3plus/defines.h index 2ee688e6c9..48c89f9ca0 100644 --- a/lib_lc3plus/defines.h +++ b/lib_lc3plus/defines.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef DEFINES_H #define DEFINES_H @@ -26,10 +25,6 @@ typedef int8_t LC3_INT8; typedef uint32_t LC3_UINT32; /* Release defines */ -#define ENABLE_2_5MS_MODE -#define ENABLE_5MS_MODE -#define ENABLE_075_DMS_MODE -#define ENABLE_10_MS_MODE #define ENABLE_ADVANCED_PLC_FL #define ENABLE_ADVANCED_PLC_FL_DEFAULT #define ENABLE_BW_CONTROLLER @@ -44,41 +39,12 @@ typedef uint32_t LC3_UINT32; #define ENABLE_FRAME_MS_FLAG #define ENABLE_HR_MODE_FL_FLAG -#define CR8_G_ADD_75MS - #ifndef NO_POST_REL_CHANGES /* Post-release non-bitexact changes */ -#define CR8_A_PLC_FADEOUT_TUNING /* Adapt PLC fadeout to avoid gaps in signal */ -#define CR9_D_FLOATING_POINT_CODE_SIMPLIFICATIONS -#define CR9_F_PITCH_WIN_LEN_FIX /* Increase window length for pitch calculation */ -#define CR9_G_IMPROVE_TDC /* summarize G,H,J,L,N */ -#ifdef CR9_G_IMPROVE_TDC -#define CR9_G_PLC_NS_TDC_FIX /* Always use TDC if pitch > 0 */ -#define CR9_H_REMOVE_SWITCH_TO_PLC_NS -#define CR9_J_SLOW_TDC_FADEOUT -#define CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER -#ifdef ENABLE_HR_MODE_FL -#ifdef PLC_TUNING_SHORT_FADEOUT -#define CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH -#endif -#endif -#endif /* CR9_G_IMPROVE_TDC */ -#define CR9_I_INC_TDC_FADEOUT_LEN -#define CR9_K_REDUCE_NORM_CORR_TH #endif /* NO_POST_REL_CHANGES */ -#ifdef CR9_D_FLOATING_POINT_CODE_SIMPLIFICATIONS -#define CR9_SIMPLIFY_LOOP -#define CR9_LTPF_REWRITE -#define CR9_QUANT_SPEC_REWRITE -#define CR9_SIMPLIFY_ARI_DECODER -#endif - -#ifdef CR8_A_PLC_FADEOUT_TUNING #define MAX_UINT8 255 -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER -#ifdef CR9_K_REDUCE_NORM_CORR_TH #define THRESH_100_DMS_TDC_CNT 9 #define THRESH_100_DMS_NS_CNT 7 #define THRESH_100_DMS_TDC_NS_CNT 73 @@ -91,33 +57,11 @@ typedef uint32_t LC3_UINT32; #define THRESH_025_DMS_TDC_CNT 20 #define THRESH_025_DMS_NS_CNT 21 #define THRESH_025_DMS_TDC_NS_CNT 278 -#else -#define THRESH_100_DMS_TDC_CNT 3 -#define THRESH_100_DMS_NS_CNT 35 -#define THRESH_100_DMS_TDC_NS_CNT 114 -#define THRESH_075_DMS_TDC_CNT 6 -#define THRESH_075_DMS_NS_CNT 37 -#define THRESH_075_DMS_TDC_NS_CNT 130 -#define THRESH_050_DMS_TDC_CNT 12 -#define THRESH_050_DMS_NS_CNT 55 -#define THRESH_050_DMS_TDC_NS_CNT 227 -#define THRESH_025_DMS_TDC_CNT 10 -#define THRESH_025_DMS_NS_CNT 138 -#define THRESH_025_DMS_TDC_NS_CNT 431 -#endif -#else -#define FAC1_FADEOUT 0.2 -#define FAC2_FADEOUT 1.5 -#define FAC3_FADEOUT 1.75 -#endif #define REL_PITCH_THRESH 0.36 #define PLC_LONGTERM_ANALYSIS_MS 200 /* Analysis window 2000 ms / 10 ms */ #define PLC_LONGTERM_ANALYSIS_STARTUP_FILL 0.5f /* required buffer fill amount, set to 0.0 to not require any fill at all */ - -#endif - /* Precision Defines */ #define LC3_FABS(x) (fabsf(x)) #define LC3_POW(x, y) (powf(x, y)) @@ -137,7 +81,6 @@ typedef uint32_t LC3_UINT32; #define MAX_BR_100DMS_WB 221600 /* for 100ms at 16kHz */ #define MAX_BR_100DMS_SSWB 314400 /* for 100ms at 24kHz */ -#ifdef CR8_G_ADD_75MS #define MIN_BR_075DMS_48KHZ_HR ((int)124800/ 800/2)* 800 #define MIN_BR_075DMS_96KHZ_HR ((int)149600/ 800/2)* 800 #define MIN_BR_075DMS 21334 /* ceil( 20 * 800 * 100/ 75) */ @@ -145,9 +88,6 @@ typedef uint32_t LC3_UINT32; #define MAX_BR_075DMS_NB 152534 /* ceil(143 * 800 * 100/ 75) */ #define MAX_BR_075DMS_WB 295467 /* ceil(277 * 800 * 100/ 75) */ #define MAX_BR_075DMS_SSWB 419200 /* ceil(393 * 800 * 100/ 75) */ -#endif -#define CR8_E_TONE_DETECTOR /* Tone detector for hrmode to deactivate TNS - improves SNR and THD+N */ - typedef int32_t LC3_INT32; #if defined(__xtensa__) @@ -158,11 +98,6 @@ typedef int32_t LC3_INT32; #define ALIGNMENT_BALLOC_RED 7 #endif -#ifndef CR8_A_PLC_FADEOUT_TUNING -#define PLC2_FADEOUT_IN_MS 30 -#endif - -#ifdef CR8_A_PLC_FADEOUT_TUNING /* PLC2/PhEcu fading settings */ /* PLC2/PHEcu muting Table setup settings */ #define PLC2_FADEOUT_IN_MS_MIN 30 /* Table min */ @@ -173,8 +108,6 @@ typedef int32_t LC3_INT32; #define PLC2_FADEOUT_IN_MS 30 /* 30 P800 fadeout optimized */ #define PLC2_FADEOUT_LONG_IN_MS 120 /* 120 MUSHRA, && stable tonal fadeout optimized */ -#endif - #define PHECU_FRES 62.5 #define PHECU_C_JACOB 1.1429 #define MAX_LGW 9 /* LGW48K + 1 !! */ @@ -206,16 +139,12 @@ typedef int32_t LC3_INT32; #define TDC_L_FIR_HP 11 #define PLC3_HPBLENDTHROTTLE 30 /* higher numbers increase throttled blending from hp filtered to unfiltered uv excitation (0 is no throttle) */ -#ifdef CR9_I_INC_TDC_FADEOUT_LEN #define PLC_FADEOUT_TYPE_1_IN_MS 200 -#endif #define PLC_FADEOUT_IN_MS 60 /* fade-out to zero in ms for TD-PLC and NS, minimum value is 20 */ #define PLC4_TRANSIT_START_IN_MS 20 /* begin of transition time for noise substitution for voiced signals */ #define PLC4_TRANSIT_END_IN_MS PLC_FADEOUT_IN_MS /* end of transition time for noise substitution */ #define PLC34_ATTEN_FAC_100 0.5000 /* attenuation factor for NS and TDC @ 10 ms*/ -#ifdef CR8_G_ADD_75MS #define PLC34_ATTEN_FAC_075 0.5946 /* attenuation factor for NS and TDC @ 7.5 ms */ -#endif #define PLC34_ATTEN_FAC_050 0.7071 /* attenuation factor for NS and TDC @ 5.0 ms*/ #define PLC34_ATTEN_FAC_025 0.8409 /* attenuation factor for NS and TDC @ 2.5 ms*/ @@ -246,21 +175,13 @@ typedef int32_t LC3_INT32; #define LC3_EPS (1.1e-7f) -#define M_PI 3.14159265358979323846 +#define M_PI_LC3PLUS 3.14159265358979323846 /* FUNCTION MACROS */ #define CEILING(x, y) (((x) + (y)-1) / (y)) - - -#ifdef CR8_A_PLC_FADEOUT_TUNING #define FRAME2FS_IDX_10MS(x) (x<500 ? (x/100) : 5) /* 80 -> 0, 160 -> 1, 240 -> 2, 320 -> 3, 480 -> 4 , 960 -> 5*/ #define FS2FS_IDX(x) ((x) == 96000 ? 5 : (x) / 10000) /* 8000 -> 0, 16000 -> 1, 24000 -> 2, 32000 -> 3, 48000 -> 4, 96000 -> 5 */ -#else -#define FRAME2FS_IDX(x) (x / 100) /* 80 -> 0, 160 -> 1, 240 -> 2, 320 -> 3, 480 -> 4*/ -#define FS2FS_IDX(x) \ - (x / 10000) /* 8000 -> 0, 16000 -> 1, 24000 -> 2, 32000 -> 3, 48000 -> 4 \ - */ -#endif + #define UNUSED(x) (void)(x) /* silence unused parameter warning */ #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/lib_lc3plus/detect_cutoff_warped.c b/lib_lc3plus/detect_cutoff_warped.c index 21b73e8063..4005c68e74 100644 --- a/lib_lc3plus/detect_cutoff_warped.c +++ b/lib_lc3plus/detect_cutoff_warped.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -34,13 +33,11 @@ void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_d warp_idx_stop = BW_warp_idx_stop_all_5ms[fs_idx - 1]; bw_dist = brickwall_dist; break; -#ifdef CR8_G_ADD_75MS case 75: warp_idx_start = BW_warp_idx_start_all_7_5ms[fs_idx - 1]; warp_idx_stop = BW_warp_idx_stop_all_7_5ms[fs_idx - 1]; bw_dist = brickwall_dist_7_5ms; break; -#endif case 100: warp_idx_start = BW_warp_idx_start_all[fs_idx - 1]; warp_idx_stop = BW_warp_idx_stop_all[fs_idx - 1]; diff --git a/lib_lc3plus/enc_entropy.c b/lib_lc3plus/enc_entropy.c index dc285088a4..28e3cea69c 100644 --- a/lib_lc3plus/enc_entropy.c +++ b/lib_lc3plus/enc_entropy.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/enc_lc3_fl.c b/lib_lc3plus/enc_lc3_fl.c index 56771ce5b8..0729df98dc 100644 --- a/lib_lc3plus/enc_lc3_fl.c +++ b/lib_lc3plus/enc_lc3_fl.c @@ -1,13 +1,12 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - - + #include "options.h" #include "wmc_auto.h" #include "functions.h" @@ -64,9 +63,7 @@ static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s /* Pitch estimation */ processOlpa_fl(h_EncSetup->s_12k8, h_EncSetup->olpa_mem_s12k8, h_EncSetup->olpa_mem_s6k4, &h_EncSetup->olpa_mem_pitch, -#ifdef CR9_F_PITCH_WIN_LEN_FIX &h_EncSetup->pitch_flag, -#endif &T0_out, &normcorr, s_12k8_len, encoder->frame_dms); /* LTPF encoder */ @@ -75,9 +72,7 @@ static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s &h_EncSetup->ltpf_mem_normcorr, &h_EncSetup->ltpf_mem_ltpf_on, &h_EncSetup->ltpf_mem_pitch, h_EncSetup->ltpf_param, &h_EncSetup->ltpf_mem_mem_normcorr, <pfBits -#ifdef CR9_K_REDUCE_NORM_CORR_TH - ,encoder->hrmode -#endif + , encoder->hrmode ); /* Attack detector */ @@ -88,12 +83,8 @@ static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s /* Per-band energy */ processPerBandEnergy_fl(encoder->bands_number, encoder->bands_offset, encoder->hrmode, encoder->frame_dms, h_EncSetup->ener, d_fl); /* Near Nyquist detector */ - processNearNyquistdetector_fl(&encoder->near_nyquist_flag, encoder->fs_idx, encoder->near_nyquist_index, encoder->bands_number, h_EncSetup->ener -#ifdef CR8_E_TONE_DETECTOR - , encoder->frame_dms, encoder->hrmode ); -#else - ); -#endif + processNearNyquistdetector_fl(&encoder->near_nyquist_flag, encoder->fs_idx, encoder->near_nyquist_index, encoder->bands_number, h_EncSetup->ener + , encoder->frame_dms, encoder->hrmode ); /* Disable LTPF if nyquist detector triggers or -lfe mode is active*/ if (encoder->near_nyquist_flag != 0 || h_EncSetup->lfe == 1) { diff --git a/lib_lc3plus/estimate_global_gain.c b/lib_lc3plus/estimate_global_gain.c index 2e69d239b2..c32d85c363 100644 --- a/lib_lc3plus/estimate_global_gain.c +++ b/lib_lc3plus/estimate_global_gain.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/fft/cfft.c b/lib_lc3plus/fft/cfft.c index d965163916..6ec89eb299 100644 --- a/lib_lc3plus/fft/cfft.c +++ b/lib_lc3plus/fft/cfft.c @@ -1,13 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/fft/cfft.h b/lib_lc3plus/fft/cfft.h index 18f1e80ad3..a67d66f057 100644 --- a/lib_lc3plus/fft/cfft.h +++ b/lib_lc3plus/fft/cfft.h @@ -1,13 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/fft/fft_15_16.h b/lib_lc3plus/fft/fft_15_16.h index c527f1bf56..ced87c6671 100644 --- a/lib_lc3plus/fft/fft_15_16.h +++ b/lib_lc3plus/fft/fft_15_16.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/fft_240_480.h b/lib_lc3plus/fft/fft_240_480.h index 18a0c8707a..40969ba48e 100644 --- a/lib_lc3plus/fft/fft_240_480.h +++ b/lib_lc3plus/fft/fft_240_480.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/fft_2_9.h b/lib_lc3plus/fft/fft_2_9.h index 55fe84f3b7..0166ad43d7 100644 --- a/lib_lc3plus/fft/fft_2_9.h +++ b/lib_lc3plus/fft/fft_2_9.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/fft_32.h b/lib_lc3plus/fft/fft_32.h index 803923a015..39cffc6977 100644 --- a/lib_lc3plus/fft/fft_32.h +++ b/lib_lc3plus/fft/fft_32.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/fft_384_768.h b/lib_lc3plus/fft/fft_384_768.h index bd89393c17..404ef79492 100644 --- a/lib_lc3plus/fft/fft_384_768.h +++ b/lib_lc3plus/fft/fft_384_768.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/fft_60_128.h b/lib_lc3plus/fft/fft_60_128.h index e5a88ccad8..e2b17450e7 100644 --- a/lib_lc3plus/fft/fft_60_128.h +++ b/lib_lc3plus/fft/fft_60_128.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/fft_generic.h b/lib_lc3plus/fft/fft_generic.h index 903875ab5a..32030b5ca4 100644 --- a/lib_lc3plus/fft/fft_generic.h +++ b/lib_lc3plus/fft/fft_generic.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /* guard against unindended includes */ #ifndef INCLUDED_FROM_IISFFT_C diff --git a/lib_lc3plus/fft/iis_fft.c b/lib_lc3plus/fft/iis_fft.c index be71d8e4ab..085e60635c 100644 --- a/lib_lc3plus/fft/iis_fft.c +++ b/lib_lc3plus/fft/iis_fft.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -43,11 +42,11 @@ static IIS_FFT_ERROR create(HANDLE_IIS_FFT* handle, LC3_INT type, LC3_INT len, I return IIS_FFT_INTERNAL_ERROR; } + if (!(*handle)) { - (*handle) = (HANDLE_IIS_FFT)calloc(1, sizeof(IIS_FFT)); + (*handle) = (HANDLE_IIS_FFT)calloc(1, sizeof(IIS_FFT)); } - if (!(*handle)) { return IIS_FFT_MEMORY_ERROR; diff --git a/lib_lc3plus/fft/iis_fft.h b/lib_lc3plus/fft/iis_fft.h index a145c490d1..d68b27d891 100644 --- a/lib_lc3plus/fft/iis_fft.h +++ b/lib_lc3plus/fft/iis_fft.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef IIS_FFT_H #define IIS_FFT_H diff --git a/lib_lc3plus/fft/iisfft.c b/lib_lc3plus/fft/iisfft.c index bcd00503fa..aaca87db9f 100644 --- a/lib_lc3plus/fft/iisfft.c +++ b/lib_lc3plus/fft/iisfft.c @@ -1,13 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/fft/iisfft.h b/lib_lc3plus/fft/iisfft.h index a77a1af7e8..4fe8f3abc3 100644 --- a/lib_lc3plus/fft/iisfft.h +++ b/lib_lc3plus/fft/iisfft.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef IISFFT_H #define IISFFT_H diff --git a/lib_lc3plus/functions.h b/lib_lc3plus/functions.h index 01ad936f00..46daa64bf3 100644 --- a/lib_lc3plus/functions.h +++ b/lib_lc3plus/functions.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef FUNCTIONS_H #define FUNCTIONS_H @@ -109,9 +108,7 @@ void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3 void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx); void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4, LC3_INT* mem_old_T0, -#ifdef CR9_F_PITCH_WIN_LEN_FIX LC3_INT* pitch_flag, -#endif LC3_INT* T0_out,LC3_FLOAT* normcorr_out, LC3_INT len, LC3_INT frame_dms); void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, LC3_INT fs, LC3_INT N, LC3_INT frame_dms, LC3_INT nBits, @@ -128,12 +125,8 @@ void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx); void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, - const LC3_INT bands_number, const LC3_FLOAT* ener -#ifdef CR8_E_TONE_DETECTOR - , const LC3_INT16 frame_dms, const LC3_INT16 hrmode ); -#else - ); -#endif + const LC3_INT bands_number, const LC3_FLOAT* ener + , const LC3_INT16 frame_dms, const LC3_INT16 hrmode ); void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d); void ProcessingIMDCT_fl(LC3_FLOAT* y, LC3_INT yLen, const LC3_FLOAT* win, LC3_INT winLen, LC3_INT last_zeros, LC3_FLOAT* mem, LC3_FLOAT* x, @@ -144,18 +137,14 @@ void ProcessingITDA_WIN_OLA_fl(LC3_FLOAT* x_tda, LC3_INT32 yLen, const LC3_FLOAT void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC3_INT pitch_ol, LC3_FLOAT pitch_ol_norm_corr, LC3_INT frame_dms, LC3_FLOAT* mem_old_x, LC3_INT memLen, LC3_FLOAT* mem_norm_corr_past, LC3_INT* mem_on, LC3_FLOAT* mem_pitch, LC3_INT* param, LC3_FLOAT* mem_norm_corr_past_past, LC3_INT* bits -#ifdef CR9_K_REDUCE_NORM_CORR_TH - ,LC3_INT16 hrmode -#endif + , LC3_INT16 hrmode ); void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, LC3_INT* mem_pitch_LC3_INT, LC3_INT* mem_pitch_fr, LC3_FLOAT* mem_gain, LC3_INT* mem_beta_idx, LC3_INT bfi, LC3_INT* param, LC3_INT* mem_param, LC3_INT conf_beta_idx, LC3_FLOAT conf_beta, LC3_INT concealMethod, LC3_FLOAT damping , LC3_INT *mem_ltpf_active -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , LC3_FLOAT *rel_pitch_change, LC3_INT hrmode, LC3_INT frame_dms -#endif ); void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], @@ -242,17 +231,13 @@ void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, LC3_FLOAT *spec_prev, LC3_FLOAT *spec, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 bfi, LC3_INT32 frame_dms, LC3_INT32 concealMethod, LC3_INT32 pitch_present_bfi1, LC3_INT32 pitch_present_bfi2, LC3_FLOAT *cum_fflcAtten -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ); void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 nbLostCmpt, LC3_FLOAT *stabFac, LC3_INT32 processDampScramb, LC3_FLOAT *cum_fflcAtten, LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, LC3_INT32 *seed, LC3_INT32 spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ); void plc_phEcu_F0_refine_first(LC3_INT32 *plocs, LC3_INT32 n_plocs, LC3_FLOAT *f0est, const LC3_INT32 Xabs_len, @@ -279,10 +264,8 @@ void plc_phEcu_spec_ana(LC3_FLOAT* xfp, LC3_INT32 xfp_len, const LC3_FLOAT* void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_INT32 time_offs, Complex* X, LC3_INT32 X_len, LC3_FLOAT* mag_chg_gr, LC3_INT32 *seed, LC3_FLOAT* alpha, LC3_FLOAT* beta, LC3_FLOAT* Xavg, LC3_INT32 t_adv_in, LC3_INT32 Lprot, LC3_INT32 delta_corr, -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT16 fadeout, /* needed for DC muting */ LC3_INT16* nonpure_tone_flag_ptr, /* i/o: flag */ -#endif LC3_FLOAT *corr_phase_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg); void plc_phEcu_rec_frame(Complex *X_in, LC3_INT32 xfp_len, LC3_INT32 Lecu, const LC3_FLOAT *whr, const LC3_FLOAT *winMDCT, LC3_INT32 Lprot, @@ -300,18 +283,14 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_FLOAT *ph_dith, LC3_INT32 *tr_dec, LC3_FLOAT *att_val, LC3_INT32 *attDegreeFrames, LC3_FLOAT *thresh_dbg -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ); void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ); void plc_phEcu_hq_ecu( LC3_FLOAT *f0binPtr, LC3_FLOAT *f0ltpGainPtr, @@ -326,10 +305,8 @@ void plc_phEcu_hq_ecu( LC3_FLOAT *st_beta_mute, LC3_FLOAT *st_mag_chg_1st, LC3_FLOAT *st_Xavg, LC3_INT32 LA_ZEROS, LC3_FLOAT *x_tda, LC3_FLOAT *xsubst_dbg, Complex *X_out_m_dbg, LC3_INT32 *seed_dbg, LC3_FLOAT *mag_chg_dbg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg, LC3_FLOAT *corr_phase_dbg ,Fft* PhEcu_Fft,Fft* PhEcu_Ifft -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type, LC3_INT16 *nonpure_tone_flag_ptr -#endif ); void processTdcPreemphasis_fl(LC3_FLOAT *in, LC3_FLOAT *pre_emph_factor, LC3_INT32 n_bands); @@ -340,12 +317,11 @@ void processTdcInverseOdft_fl(LC3_FLOAT *in, LC3_INT32 n_bands, LC3_FLOAT *out, void processTdcApply_fl(const LC3_INT32 pitch_LC3_INT, const LC3_FLOAT *preemphFac, const LC3_FLOAT* A, const LC3_INT32 lpc_order, const LC3_FLOAT* pcmbufHist, const LC3_INT32 max_len_pcm_plc, const LC3_INT32 N, const LC3_INT32 frame_dms, const LC3_INT32 SampRate, const LC3_INT32 nbLostCmpt, const LC3_INT32 overlap, const LC3_FLOAT *stabFac, LC3_FLOAT harmonicBuf[MAX_PITCH], LC3_FLOAT synthHist[M], LC3_INT32* fract, LC3_INT16* seed, LC3_FLOAT* gain_c, LC3_FLOAT* alpha, LC3_FLOAT* synth -#ifdef CR9_I_INC_TDC_FADEOUT_LEN ,LC3_UINT8 plc_fadeout_type -#endif + ,LC3_FLOAT* alpha_type_2_table ); void* balloc(void* base, size_t* base_size, size_t size); - +LC3_FLOAT type_2_fadeout(LC3_INT32 nbLostFramesInRow, LC3_INT32 frame_dms); #endif diff --git a/lib_lc3plus/imdct.c b/lib_lc3plus/imdct.c index b2ef8ee925..b8fc4e7985 100644 --- a/lib_lc3plus/imdct.c +++ b/lib_lc3plus/imdct.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/lc3.c b/lib_lc3plus/lc3.c index e3f4491d2b..56a39286f8 100644 --- a/lib_lc3plus/lc3.c +++ b/lib_lc3plus/lc3.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -72,9 +71,7 @@ static int lc3plus_frame_size_supported(float frame_ms) { case 25: /* fallthru */ case 50: /* fallthru */ -#ifdef CR8_G_ADD_75MS case 75: /* fallthru */ -#endif case 100: return 1; default: break; } @@ -112,9 +109,12 @@ LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channel RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); - for (ch = 0; ch < channels; ch++) + if (lfe_channel_array != NULL) { - RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); + for (ch = 0; ch < channels; ch++) + { + RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); + } } return FillEncSetup(encoder, samplerate, channels, hrmode, lfe_channel_array); /* real bitrate check happens here */ @@ -305,7 +305,13 @@ int lc3plus_dec_get_delay(const LC3PLUS_Dec* decoder) LC3PLUS_Error lc3plus_dec_fl(LC3PLUS_Dec* decoder, void* input_bytes, int num_bytes, void** output_samples, int bps, int bfi_ext) { - RETURN_IF(!decoder || !input_bytes || !output_samples, LC3PLUS_NULL_ERROR); + if (bfi_ext == 1) + { + RETURN_IF(!decoder || !output_samples, LC3PLUS_NULL_ERROR); + } else { + RETURN_IF(!decoder || !input_bytes || !output_samples, LC3PLUS_NULL_ERROR); + } + RETURN_IF(null_in_list((void**)output_samples, decoder->channels), LC3PLUS_NULL_ERROR); return Dec_LC3PLUS_fl(decoder, input_bytes, num_bytes, output_samples, bps, bfi_ext); } diff --git a/lib_lc3plus/lc3.h b/lib_lc3plus/lc3.h index fab259e96d..b5f8809e7e 100644 --- a/lib_lc3plus/lc3.h +++ b/lib_lc3plus/lc3.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /*! \file lc3.h * This header provides the API for LC3plus. @@ -38,7 +37,7 @@ typedef __int32 int32_t; #define LC3PLUS_VERSION_INT(major, minor, micro) (((major) << 16) | ((minor) << 8) | (micro)) /*! Version number to ensure header and binary are matching. */ -#define LC3PLUS_VERSION LC3PLUS_VERSION_INT(1, 7, 2) +#define LC3PLUS_VERSION LC3PLUS_VERSION_INT(1, 7, 4) /*! Maximum number of supported channels. The actual binary might support * less, use lc3plus_channels_supported() to check. */ @@ -171,6 +170,7 @@ int lc3plus_samplerate_supported(int samplerate); * \param[in] samplerate Input sampling rate. Allowed sampling rates are: * 8000, 16000, 24000, 32000, 44100, 48000 * \param[in] hrmode High resolution mode. + * \param[in] lfe_channel_array Array containing activation of LFE mode for each individual channel. Can be NULL if LFE activation is not required. * \return LC3PLUS_OK on success or appropriate error code. */ LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc* encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]); @@ -387,7 +387,8 @@ LC3PLUS_Error lc3plus_dec_init(LC3PLUS_Dec* decoder, int samplerate, int channel * should provide enough space to hold at most LC3PLUS_MAX_SAMPLES. The * left channel is stored in output_samples[0], the right channel in * output_samples[1]. - * \param scratch Scratch parameter only works as dummy parameter to align fixed-point and floating-point APIs + * \param scratch Scratch parameter only works as dummy parameter to align fixed-point and floating-point APIs. + * \param[in] bfi_ext Bad Frame Indicator. 0: Good Frame. 1: Bad Frame, apply PLC. * \return Returns LC3PLUS_OK on success or appropriate error code. Note there is * a special case for LC3PLUS_DECODE_ERROR where the output is still valid. */ diff --git a/lib_lc3plus/lc3plus_fft.c b/lib_lc3plus/lc3plus_fft.c index c7911b92dd..75f8787e25 100644 --- a/lib_lc3plus/lc3plus_fft.c +++ b/lib_lc3plus/lc3plus_fft.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/license.h b/lib_lc3plus/license.h index 077df126ea..0ea743b404 100644 --- a/lib_lc3plus/license.h +++ b/lib_lc3plus/license.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -14,7 +13,7 @@ static const char *const LICENSE = "*******************************************************************************\n" - "* ETSI TS 103 634 V1.4.3 *\n" + "* ETSI TS 103 634 V1.5.1 *\n" "* Low Complexity Communication Codec Plus (LC3plus) *\n" "* Floating Point Software V%i.%i.%iETSI, " __DATE__ " *\n" "* Copyright licence is solely granted through ETSI Intellectual Property *\n" diff --git a/lib_lc3plus/ltpf_coder.c b/lib_lc3plus/ltpf_coder.c index 81a491ab93..3457b6ba66 100644 --- a/lib_lc3plus/ltpf_coder.c +++ b/lib_lc3plus/ltpf_coder.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -36,9 +35,7 @@ LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len) void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC3_INT pitch_ol, LC3_FLOAT pitch_ol_norm_corr, LC3_INT frame_dms, LC3_FLOAT* mem_old_x, LC3_INT memLen, LC3_FLOAT* mem_norm_corr_past, LC3_INT* mem_on, LC3_FLOAT* mem_pitch, LC3_INT* param, LC3_FLOAT* mem_norm_corr_past_past, LC3_INT* bits -#ifdef CR9_K_REDUCE_NORM_CORR_TH , LC3_INT16 hrmode -#endif ) { LC3_FLOAT buffer[LTPF_MEMIN_LEN + LEN_12K8 + 1 + (LEN_12K8 >> 2)], sum = 0, cor_up[(MAX_PITCH_12K8 - MIN_PITCH_12K8) / 2] = {0}, *x; @@ -49,14 +46,12 @@ void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC LC3_FLOAT cor_tmp, cor_int_tmp, norm_corr = 0, cor[MAX_LEN_NR], cor_int[MAX_LEN_NR], sum1 = 0, sum2 = 0, sum3 = 0; LC3_FLOAT pitch = 0; -#ifdef CR9_K_REDUCE_NORM_CORR_TH LC3_FLOAT normCorrTh = 0.0f; if (hrmode) { normCorrTh = 0.4; } else { normCorrTh = 0.6; } -#endif /* Signal Buffer */ N = xLen - 1; @@ -73,12 +68,7 @@ void process_ltpf_coder_fl(LC3_FLOAT* xin, LC3_INT xLen, LC3_INT ltpf_enable, LC pitch_search_upsamp = 4; pitch_search_L_interpol1 = 4; -#ifdef CR9_K_REDUCE_NORM_CORR_TH - if (pitch_ol_norm_corr > normCorrTh) -#else - if (pitch_ol_norm_corr > 0.6) -#endif - { + if (pitch_ol_norm_corr > normCorrTh) { /* Search Bounds */ t0_min = pitch_ol - pitch_search_delta; t0_max = pitch_ol + pitch_search_delta; diff --git a/lib_lc3plus/ltpf_decoder.c b/lib_lc3plus/ltpf_decoder.c index d51c7ffe3c..3ccd452bcb 100644 --- a/lib_lc3plus/ltpf_decoder.c +++ b/lib_lc3plus/ltpf_decoder.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -16,10 +15,8 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f LC3_INT* mem_pitch_int, LC3_INT* mem_pitch_fr, LC3_FLOAT* mem_gain, LC3_INT* mem_beta_idx, LC3_INT bfi, LC3_INT* param, LC3_INT* mem_param, LC3_INT conf_beta_idx, LC3_FLOAT conf_beta, LC3_INT concealMethod, LC3_FLOAT damping - , LC3_INT *mem_ltpf_active -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH + , LC3_INT *mem_ltpf_active , LC3_FLOAT *rel_pitch_change, LC3_INT hrmode, LC3_INT frame_dms -#endif ) { LC3_INT i, j, n, N, L_past_x, N4, N34, @@ -28,20 +25,14 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f LC3_FLOAT conf_alpha, gain, a1[12], a2[12], b1[11], b2[11], buf_x[4 * MAX_LEN], buf_y[4 * MAX_LEN], buf_z[4 * MAX_LEN], pitch, sum1, sum2; -#ifdef CR9_LTPF_REWRITE LC3_FLOAT *p_x, *p_y, *p_y2, *p_x_init, *p_y_init, *p_a1, *p_b1, *p_a2, *p_b2, fade_fac, current_fade_fac_up, current_fade_fac_down; -#endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH LC3_FLOAT pitch_fl_c_old, pitch_delta; -#endif const LC3_FLOAT *inter_filter[4], *tilt_filter[4]; #ifdef WMOPS push_wmops("process_ltpf_decoder_fl"); #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH pitch_fl_c_old = (LC3_FLOAT) *mem_pitch_int + (LC3_FLOAT)*mem_pitch_fr / 4.0; -#endif conf_alpha = 0.85; if (bfi != 1) { @@ -227,12 +218,10 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f } /* First quarter of the current frame: cross-fading */ -#ifdef CR9_LTPF_REWRITE fade_fac = 1. / (LC3_FLOAT) N4; current_fade_fac_up = 0.f; current_fade_fac_down = 1.f; (void) p_x; (void) p_y; (void) p_a1; (void) p_b1; -#endif if (mem_param[1] == 0 && param[1] == 0) { memmove(&buf_y[L_past_y], &buf_x[L_past_x], sizeof(LC3_FLOAT) * N4); @@ -253,14 +242,9 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f j++; } -#ifdef CR9_LTPF_REWRITE buf_y[L_past_y + n] = buf_x[L_past_x + n] - current_fade_fac_down * sum1 + current_fade_fac_down * sum2; current_fade_fac_down -= fade_fac; -#else - buf_y[L_past_y + n] = buf_x[L_past_x + n] - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum1 + - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum2; -#endif } } else if (mem_param[1] == 0 && param[1] == 1) { @@ -279,12 +263,8 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f j++; } -#ifdef CR9_LTPF_REWRITE buf_y[L_past_y + n] = buf_x[L_past_x + n] - current_fade_fac_up * sum1 + current_fade_fac_up * sum2; current_fade_fac_up += fade_fac; -#else - buf_y[L_past_y + n] = buf_x[L_past_x + n] - ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum1 + ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum2; -#endif } } else if (*mem_pitch_int == pitch_int && *mem_pitch_fr == pitch_fr) { for (n = 0; n < N4; n++) { @@ -305,7 +285,6 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f buf_y[L_past_y + n] = buf_x[L_past_x + n] - sum1 + sum2; } } else { -#ifdef CR9_LTPF_REWRITE p_x_init = &buf_x[L_past_x]; p_y_init = &buf_y[L_past_y - p1 + inter_len - 1]; p_y2 = &buf_y[L_past_y]; @@ -367,49 +346,8 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f p_y_init++; p_y2++; } -#else - for (n = 0; n < N4; n++) { - sum1 = 0; - sum2 = 0; - j = 0; - for (i = L_past_x + n; i >= L_past_x + n - tilt_len; i--) { - sum1 += b1[j] * buf_x[i]; - j++; - } - - j = 0; - for (i = L_past_y + n - p1 + inter_len - 1; i >= L_past_y + n - p1 - inter_len; i--) { - sum2 += a1[j] * buf_y[i]; - j++; - } - - buf_y[L_past_y + n] = buf_x[L_past_x + n] - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum1 + - (((LC3_FLOAT)N4 - (LC3_FLOAT)n) / (LC3_FLOAT)N4) * sum2; - } - - memmove(buf_z, buf_y, sizeof(LC3_FLOAT) * (old_y_len + xLen)); - - for (n = 0; n < N4; n++) { - sum1 = 0; - sum2 = 0; - j = 0; - for (i = L_past_y + n; i >= L_past_y + n - tilt_len; i--) { - sum1 += b2[j] * buf_z[i]; - j++; - } - - j = 0; - for (i = L_past_y + n - p2 + inter_len - 1; i >= L_past_y + n - p2 - inter_len; i--) { - sum2 += a2[j] * buf_y[i]; - j++; - } - - buf_y[L_past_y + n] = buf_z[L_past_y + n] - ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum1 + ((LC3_FLOAT)n / (LC3_FLOAT)N4) * sum2; - } -#endif } -#ifdef CR9_LTPF_REWRITE /* Second quarter of the current frame */ if (param[1] == 0) { move_float(&buf_y[L_past_y + N4], &buf_x[L_past_x + N4], @@ -444,31 +382,6 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f p_y2++; } } -#else - /* Second quarter of the current frame */ - if (param[1] == 0) { - memmove(&buf_y[L_past_y + N4], &buf_x[L_past_x + N4], - sizeof(LC3_FLOAT) * ((L_past_x + N4 + N34) - (L_past_x + N4))); - } else { - for (n = 0; n < N34; n++) { - sum1 = 0; - sum2 = 0; - j = 0; - for (i = L_past_x + N4 + n; i >= L_past_x + n + N4 - tilt_len; i--) { - sum1 += b2[j] * buf_x[i]; - j++; - } - - j = 0; - for (i = L_past_y + N4 + n - p2 + inter_len - 1; i >= L_past_y + N4 + n - p2 - inter_len; i--) { - sum2 += a2[j] * buf_y[i]; - j++; - } - - buf_y[L_past_y + N4 + n] = buf_x[L_past_x + N4 + n] - sum1 + sum2; - } - } -#endif /* Output */ move_float(y, &buf_y[L_past_y], N); @@ -484,13 +397,11 @@ void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT f *mem_pitch_int = pitch_int; *mem_pitch_fr = pitch_fr; *mem_gain = gain; - *mem_beta_idx = conf_beta_idx; -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH + *mem_beta_idx = conf_beta_idx; if (bfi == 0 && hrmode == 1 && (frame_dms == 50 || frame_dms == 25)){ pitch_delta = LC3_FABS(pitch_fl_c_old - (LC3_FLOAT)pitch_int - (LC3_FLOAT)(pitch_fr / 4.0)); *rel_pitch_change = pitch_delta / MAX(pitch_fl_c_old, 1); } -#endif #ifdef WMOPS pop_wmops(); diff --git a/lib_lc3plus/mdct.c b/lib_lc3plus/mdct.c index ef2d7c087a..4698afd4bf 100644 --- a/lib_lc3plus/mdct.c +++ b/lib_lc3plus/mdct.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -32,7 +31,6 @@ static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT h return NULL; } } -#ifdef CR8_G_ADD_75MS else if (frame_dms == 75) { switch (length) { case 60: @@ -51,7 +49,6 @@ static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT h return NULL; } } -#endif else if (frame_dms == 50) { switch (length) { case 40: @@ -96,11 +93,9 @@ void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC if (frame_dms == 100) { mdct->leading_zeros = MDCT_la_zeroes[fs_idx]; } -#ifdef CR8_G_ADD_75MS else if (frame_dms == 75) { mdct->leading_zeros = MDCT_la_zeroes_7_5ms[fs_idx]; } -#endif else if (frame_dms == 50) { mdct->leading_zeros = MDCT_la_zeroes_5ms[fs_idx]; } @@ -151,7 +146,4 @@ void mdct_apply(const LC3_FLOAT* input, LC3_FLOAT* output, Mdct* mdct) dct4_apply(&mdct->dct, tmp, output); } -void processMdct_fl(LC3_FLOAT* in, LC3_FLOAT* out, Mdct* mdctStruct) -{ - mdct_apply(in, out, mdctStruct); -} +void processMdct_fl(LC3_FLOAT* in, LC3_FLOAT* out, Mdct* mdctStruct) { mdct_apply(in, out, mdctStruct); } diff --git a/lib_lc3plus/mdct_shaping.c b/lib_lc3plus/mdct_shaping.c index eba6f32704..296a8cd454 100644 --- a/lib_lc3plus/mdct_shaping.c +++ b/lib_lc3plus/mdct_shaping.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/near_nyquist_detector.c b/lib_lc3plus/near_nyquist_detector.c index ee34361ef2..5d81392b21 100644 --- a/lib_lc3plus/near_nyquist_detector.c +++ b/lib_lc3plus/near_nyquist_detector.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -11,19 +11,11 @@ #include "wmc_auto.h" #include "functions.h" - void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, - const LC3_INT bands_number, const LC3_FLOAT* ener -#ifdef CR8_E_TONE_DETECTOR - , const LC3_INT16 frame_dms, const LC3_INT16 hrmode -#endif -) + const LC3_INT bands_number, const LC3_FLOAT* ener , const LC3_INT16 frame_dms, const LC3_INT16 hrmode) { *near_nyquist_flag = 0; -#ifdef CR8_E_TONE_DETECTOR - if (hrmode == 0) -#endif - { + if (hrmode == 0){ if (fs_idx < 4) { LC3_INT i = 0; @@ -44,7 +36,6 @@ void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT f } } } -#ifdef CR8_E_TONE_DETECTOR else // hrmode == 1 { // inverse spectral flatness = mean(energy) ./ 2^(mean(log2(energy))); @@ -89,5 +80,4 @@ void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT f *near_nyquist_flag = 1; } } -#endif // CR8_E_TONE_DETECTOR } diff --git a/lib_lc3plus/noise_factor.c b/lib_lc3plus/noise_factor.c index 5e4ecd7b9a..72b2602251 100644 --- a/lib_lc3plus/noise_factor.c +++ b/lib_lc3plus/noise_factor.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -30,12 +29,10 @@ void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3 nTransWidth = 1; startOffset = 12; break; -#ifdef CR8_G_ADD_75MS case 75: nTransWidth = 2; startOffset = 18; break; -#endif case 100: nTransWidth = 3; startOffset = 24; diff --git a/lib_lc3plus/noise_filling.c b/lib_lc3plus/noise_filling.c index b844aef080..f929338d0c 100644 --- a/lib_lc3plus/noise_filling.c +++ b/lib_lc3plus/noise_filling.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -28,12 +27,10 @@ void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, nTransWidth = 1; startOffset = 12; break; -#ifdef CR8_G_ADD_75MS case 75: nTransWidth = 2; startOffset = 18; break; -#endif case 100: nTransWidth = 3; startOffset = 24; diff --git a/lib_lc3plus/olpa.c b/lib_lc3plus/olpa.c index 62a303f26f..976f0a177e 100644 --- a/lib_lc3plus/olpa.c +++ b/lib_lc3plus/olpa.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -47,9 +46,7 @@ LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len) } void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4, LC3_INT* mem_old_T0, -#ifdef CR9_F_PITCH_WIN_LEN_FIX LC3_INT* pitch_flag, -#endif LC3_INT* T0_out, LC3_FLOAT* normcorr_out, LC3_INT len, LC3_INT frame_dms) { LC3_FLOAT norm_corr = 0, sum = 0, sum0 = 0, sum1 = 0, sum2 = 0, norm_corr2 = 0, *s6k4; @@ -57,7 +54,6 @@ void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4 LC3_INT i = 0, len2 = 0, T0 = 0, T02 = 0, min_pitch = 0, max_pitch = 0, L = 0, mem_in_len = 0, acflen = 0, delta = 0; len2 = len / 2; -#ifdef CR9_F_PITCH_WIN_LEN_FIX switch(frame_dms) { case 50: @@ -71,22 +67,11 @@ void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4 break; default: -#endif delta = 0; acflen = len2; -#ifdef CR9_F_PITCH_WIN_LEN_FIX } -#endif mem_in_len = MAX_PITCH_6K4 + delta; - -#ifndef CR9_F_PITCH_WIN_LEN_FIX - if (frame_dms == 25) - { - mem_in_len += 16; - acflen += 16; - } -#endif /* Downsampling */ move_float(buf, mem_s12k8, 3); @@ -95,21 +80,10 @@ void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4 filter_olpa(buf, R0, olpa_down2, len + 3); /* Compute autocorrelation */ -#ifdef CR9_F_PITCH_WIN_LEN_FIX s6k4 = &buf[mem_in_len - delta]; move_float(&buf[mem_in_len], R0, len2); move_float(buf, mem_s6k4, mem_in_len); move_float(mem_s6k4, &buf[len2], mem_in_len); -#else - s6k4 = &buf[mem_in_len]; - move_float(buf, mem_s6k4, mem_in_len); - move_float(s6k4, R0, len2); - move_float(mem_s6k4, &buf[len2], mem_in_len); - if (frame_dms == 25) - { - s6k4 = s6k4 - 16; - } -#endif for (i = MIN_PITCH_6K4; i <= MAX_PITCH_6K4; i++) { sum = mac_loop(s6k4, &s6k4[-i], acflen); R0[i - MIN_PITCH_6K4] = sum; @@ -161,7 +135,6 @@ void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4 } } -#ifdef CR9_F_PITCH_WIN_LEN_FIX switch(frame_dms) { case 50: @@ -189,11 +162,8 @@ void processOlpa_fl(LC3_FLOAT* s_12k8, LC3_FLOAT* mem_s12k8, LC3_FLOAT* mem_s6k4 break; default: -#endif *mem_old_T0 = T0; -#ifdef CR9_F_PITCH_WIN_LEN_FIX } -#endif *T0_out = T0 * 2.0; *normcorr_out = norm_corr; diff --git a/lib_lc3plus/pc_apply.c b/lib_lc3plus/pc_apply.c index 89bab44eb6..a7113f1bc7 100644 --- a/lib_lc3plus/pc_apply.c +++ b/lib_lc3plus/pc_apply.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processPcApply_fl(LC3_FLOAT *q_res, LC3_FLOAT *q_old_res, LC3_FLOAT *q_d_prev, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_FLOAT *prev_gg, LC3_FLOAT *fac, LC3_INT32 *pc_nbLostCmpt) { LC3_FLOAT gg, mean_nrg_low, mean_nrg_high, ener_prev, ener_curr, fac_local; diff --git a/lib_lc3plus/pc_classify.c b/lib_lc3plus/pc_classify.c index 9ea5e02dae..adb8a59713 100644 --- a/lib_lc3plus/pc_classify.c +++ b/lib_lc3plus/pc_classify.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - LC3_FLOAT pc_peak_detector(LC3_FLOAT *q_d_prev, LC3_INT32 yLen); void processPcClassify_fl(LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *q_d_prev, LC3_FLOAT *q_old_res, LC3_INT32 yLen, LC3_INT32 spec_inv_idx, LC3_FLOAT stab_fac, LC3_INT32 *bfi) diff --git a/lib_lc3plus/pc_main.c b/lib_lc3plus/pc_main.c index 6ee2bc0727..5ef1676d48 100644 --- a/lib_lc3plus/pc_main.c +++ b/lib_lc3plus/pc_main.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processPcMain_fl(LC3_INT32 *bfi, LC3PLUS_Dec* decoder, LC3_FLOAT *sqQdec, DecSetup* h_DecSetup, LC3_INT32 pitch_present, LC3_FLOAT stab_fac, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 fac_ns_idx, pcState *statePC, LC3_INT32 spec_inv_idx, LC3_INT32 yLen) { LC3_FLOAT fac; diff --git a/lib_lc3plus/pc_update.c b/lib_lc3plus/pc_update.c index e57016d401..b24b2ea62a 100644 --- a/lib_lc3plus/pc_update.c +++ b/lib_lc3plus/pc_update.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processPcUpdate_fl(LC3_INT32 bfi, LC3_FLOAT *q_res, LC3_INT32 gg_idx, LC3_INT32 gg_idx_off, LC3_INT32 rframe, LC3_INT32 *BW_cutoff_idx_nf, LC3_INT32 *prev_BW_cutoff_idx_nf, LC3_INT32 fac_ns_idx, LC3_FLOAT *prev_fac_ns, LC3_FLOAT *fac, LC3_FLOAT *q_old_res, LC3_FLOAT *prev_gg, LC3_INT32 spec_inv_idx, LC3_INT32 yLen) { diff --git a/lib_lc3plus/per_band_energy.c b/lib_lc3plus/per_band_energy.c index 5785ef82ba..413b6cfd84 100644 --- a/lib_lc3plus/per_band_energy.c +++ b/lib_lc3plus/per_band_energy.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -31,21 +30,15 @@ void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_ } switch (frame_dms) { -#ifdef ENABLE_2_5MS_MODE case 25: maxBwBin = maxBwBin >> 2; break; -#endif -#ifdef ENABLE_5MS_MODE case 50: maxBwBin = maxBwBin >> 1; break; -#endif -#ifdef CR8_G_ADD_75MS case 75: maxBwBin = (maxBwBin >> 2) * 3; break; -#endif } for (i = 0; i < bands_number; i++) { diff --git a/lib_lc3plus/plc_classify.c b/lib_lc3plus/plc_classify.c index fe650f44bf..f1f1878d4b 100644 --- a/lib_lc3plus/plc_classify.c +++ b/lib_lc3plus/plc_classify.c @@ -1,19 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" -#ifdef CR8_A_PLC_FADEOUT_TUNING - static LC3_INT32 change_bit_at_position(LC3_INT32 value, LC3_UINT8 bit_position, LC3_INT8 bit) { LC3_INT32 helper_mask = ~(1 << bit_position); @@ -24,7 +21,7 @@ static LC3_INT32 change_bit_at_position(LC3_INT32 value, LC3_UINT8 bit_position, static void update_bit_and_byte_positions(LC3_INT16 longterm_analysis_counter_max_bytebuffer, LC3_INT8 *byte_position, LC3_INT8 *bit_position) { - if (*bit_position == 30) + if (*bit_position == 29) { *bit_position = 0; @@ -55,11 +52,7 @@ static void array_insert_and_shift(LC3_INT32 *array, LC3_UINT8 value, LC3_INT16 array[*byte_position] = current_byte; } -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER static void array_calculate(LC3_INT32 *array_tdc, LC3_INT32 *array_ns, int length, LC3_INT16 *counter_tdc, LC3_INT16 *counter_ns, LC3_INT16 longterm_analysis_counter_max) -#else -static void array_calculate(LC3_INT32 *array_tdc, LC3_INT32 *array_ns, int length, LC3_INT16 *counter_tdc, LC3_INT16 *counter_ns, LC3_INT16 *counter_phecu, LC3_INT16 overall_counter, LC3_INT16 longterm_analysis_counter_max) -#endif { int i, k; LC3_INT32 current_byte_tdc = 0, current_byte_ns = 0; @@ -88,11 +81,7 @@ static void array_calculate(LC3_INT32 *array_tdc, LC3_INT32 *array_ns, int lengt *counter_tdc = counter_loc_tdc; *counter_ns = counter_loc_ns; -#ifndef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER - *counter_phecu = overall_counter - counter_loc_tdc - counter_loc_ns; -#endif } -#endif static void plc_xcorr_lc(LC3_FLOAT *pcmbufHist, LC3_INT32 max_len_pcm_plc, LC3_INT32 pitch_int, LC3_INT32 framelength, LC3_INT32 frame_dms, LC3_INT32 fs, LC3_FLOAT *xcorr); static void spectral_centroid_lc(LC3_FLOAT *gains, LC3_INT32 tilt, const LC3_INT *bands_offset, LC3_INT32 bands_number, LC3_INT32 framelength, LC3_INT32 fs, LC3_FLOAT *sc); @@ -104,45 +93,27 @@ void processPlcClassify_fl(LC3_INT plcMeth, LC3_INT *concealMethod, LC3_INT32 *n ) { LC3_FLOAT sc, class; -#ifdef CR8_A_PLC_FADEOUT_TUNING int fs_idx_tmp; -#endif if (plcAd) { *xcorr = 0; } -#ifdef CR8_A_PLC_FADEOUT_TUNING fs_idx_tmp = FS2FS_IDX(fs); /* Save statistics for 24 kHz, 48 kHz and 96 kHz */ if ((bfi == 1) || ((bfi >= 0) && (bfi <= 2) && ((fs_idx_tmp == 2) || (fs_idx_tmp == 4) || (fs_idx_tmp == 5)))) /* Partial Concealment PC(bfi==2) requires allowing value 2 to pass thru as well */ -#else - if (bfi == 1) -#endif { -#ifdef CR8_A_PLC_FADEOUT_TUNING if (bfi == 1) { *nbLostCmpt = *nbLostCmpt + 1; } -#else - *nbLostCmpt = *nbLostCmpt + 1; -#endif /* Use pitch correlation at ltpf integer lag if available */ -#ifdef CR8_A_PLC_FADEOUT_TUNING if ((*nbLostCmpt == 1) || (bfi != 1) )/* PC(bfi==2) requires allowing 2 to pass thru as well */ -#else - if (*nbLostCmpt == 1) -#endif { -#ifdef CR8_A_PLC_FADEOUT_TUNING *concealMethod = 4; /* Noise Substitution */ UNUSED(plcMeth); -#else - *concealMethod = plcMeth; // this is a dangerous mapping! -#endif /* Advanced PLC */ if (pitch_int > 0) @@ -158,46 +129,29 @@ void processPlcClassify_fl(LC3_INT plcMeth, LC3_INT *concealMethod, LC3_INT32 *n if (frame_dms == 100 && hrmode == 0) { *concealMethod = 2; /* PhaseEcu selected */ -#ifdef CR8_A_PLC_FADEOUT_TUNING array_insert_and_shift(plcAd->plc_longterm_advc_tdc, 0, plcAd->longterm_analysis_counter_max, &plcAd->overall_counter, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); array_insert_and_shift(plcAd->plc_longterm_advc_ns, 0, plcAd->longterm_analysis_counter_max, NULL, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); -#endif } else { -#ifndef CR9_G_PLC_NS_TDC_FIX - *concealMethod = 4; /* Noise Substitution */ -#endif -#ifdef CR8_A_PLC_FADEOUT_TUNING array_insert_and_shift(plcAd->plc_longterm_advc_tdc, 0, plcAd->longterm_analysis_counter_max, &plcAd->overall_counter, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); array_insert_and_shift(plcAd->plc_longterm_advc_ns, 0, plcAd->longterm_analysis_counter_max, NULL, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); -#endif } } -#ifdef CR8_A_PLC_FADEOUT_TUNING else { array_insert_and_shift(plcAd->plc_longterm_advc_tdc, 1, plcAd->longterm_analysis_counter_max, &plcAd->overall_counter, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); array_insert_and_shift(plcAd->plc_longterm_advc_ns, 0, plcAd->longterm_analysis_counter_max, NULL, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); } -#endif } else { *concealMethod = 4; /* Noise Substitution */ -#ifdef CR8_A_PLC_FADEOUT_TUNING array_insert_and_shift(plcAd->plc_longterm_advc_tdc, 0, plcAd->longterm_analysis_counter_max, &plcAd->overall_counter, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); array_insert_and_shift(plcAd->plc_longterm_advc_ns, 1, plcAd->longterm_analysis_counter_max, NULL, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); -#endif } -#ifdef CR8_A_PLC_FADEOUT_TUNING -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER array_calculate(plcAd->plc_longterm_advc_tdc, plcAd->plc_longterm_advc_ns, plcAd->longterm_analysis_counter_max_bytebuffer, &plcAd->longterm_counter_plcTdc, &plcAd->longterm_counter_plcNsAdv, plcAd->longterm_analysis_counter_max); -#else - array_calculate(plcAd->plc_longterm_advc_tdc, plcAd->plc_longterm_advc_ns, plcAd->longterm_analysis_counter_max_bytebuffer, &plcAd->longterm_counter_plcTdc, &plcAd->longterm_counter_plcNsAdv, &plcAd->longterm_counter_plcPhaseEcu, plcAd->overall_counter, plcAd->longterm_analysis_counter_max); -#endif update_bit_and_byte_positions(plcAd->longterm_analysis_counter_max_bytebuffer, &plcAd->longterm_counter_byte_position, &plcAd->longterm_counter_bit_position); -#endif } } } diff --git a/lib_lc3plus/plc_compute_stab_fac.c b/lib_lc3plus/plc_compute_stab_fac.c index 5c7a736e68..121c2f06a2 100644 --- a/lib_lc3plus/plc_compute_stab_fac.c +++ b/lib_lc3plus/plc_compute_stab_fac.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - static void processPlcComputeStabFac_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_INT32 prev_bfi, LC3_FLOAT *stab_fac); void processPlcComputeStabFacMain_fl(LC3_FLOAT *scf_q, LC3_FLOAT *old_scf_q, LC3_FLOAT *old_old_scf_q, LC3_INT32 bfi, LC3_INT32 prev_bfi, diff --git a/lib_lc3plus/plc_damping_scrambling.c b/lib_lc3plus/plc_damping_scrambling.c index fd9efd7c0e..ac4526b4ec 100644 --- a/lib_lc3plus/plc_damping_scrambling.c +++ b/lib_lc3plus/plc_damping_scrambling.c @@ -1,27 +1,23 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, LC3_INT32 *pc_seed, LC3_INT32 ns_nbLostCmpt_pc, LC3_INT32 ns_nbLostCmpt, LC3_FLOAT *stabFac, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, LC3_FLOAT *spec_prev, LC3_FLOAT *spec, LC3_INT32 spec_inv_idx, LC3_INT32 yLen, LC3_INT32 bfi, LC3_INT32 frame_dms, LC3_INT32 concealMethod, LC3_INT32 pitch_present_bfi1, LC3_INT32 pitch_present_bfi2, LC3_FLOAT *cum_fflcAtten -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ) { @@ -37,31 +33,25 @@ void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, processDampScramb = 1; } -#ifdef CR8_A_PLC_FADEOUT_TUNING if (ns_nbLostCmpt == 1) { *cum_fading_slow = 1; *cum_fading_fast = 1; *cum_fflcAtten = 1; - } -#endif + } if ( bfi == 1 ) { processPlcDampingScrambling_fl(spec, yLen, ns_nbLostCmpt, stabFac, processDampScramb, cum_fflcAtten, pitch_present_bfi1, frame_dms, cum_fading_slow, cum_fading_fast, ns_seed, 0 -#ifdef CR8_A_PLC_FADEOUT_TUNING , plc_fadeout_type -#endif ); } else /* bfi == 2 */ { processPlcDampingScrambling_fl(spec, yLen, ns_nbLostCmpt_pc, stabFac, processDampScramb, cum_fflcAtten, pitch_present_bfi2, frame_dms, cum_fading_slow, cum_fading_fast, pc_seed, spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , plc_fadeout_type -#endif ); processPlcUpdateSpec_fl(spec_prev, spec, yLen); } @@ -71,9 +61,7 @@ void processPlcDampingScramblingMain_fl(LC3_INT32 *ns_seed, void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 nbLostCmpt, LC3_FLOAT *stabFac, LC3_INT32 processDampScramb, LC3_FLOAT *cum_fflcAtten, LC3_INT32 pitch_present, LC3_INT32 frame_dms, LC3_FLOAT *cum_fading_slow, LC3_FLOAT *cum_fading_fast, LC3_INT32 *seed, LC3_INT32 spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ) { LC3_INT32 plc_start_inFrames, plc_end_inFrames, plc_duration_inFrames, x, b, i, ad_ThreshFac_start; @@ -81,16 +69,6 @@ void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 n frame_energy = 0; -#ifndef CR8_A_PLC_FADEOUT_TUNING - /* Main process */ - if (nbLostCmpt == 1) - { - *cum_fading_slow = 1; - *cum_fading_fast = 1; - *cum_fflcAtten = 1; - } -#endif - slow = 0.8 + 0.2 * (*stabFac); fast = 0.3 + 0.2 * (*stabFac); @@ -104,27 +82,20 @@ void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 n slow = LC3_SQRT(slow); fast = LC3_SQRT(fast); break; -#ifdef CR8_G_ADD_75MS case 75: slow = LC3_SQRT(LC3_SQRT(slow*slow*slow)); fast = LC3_SQRT(LC3_SQRT(fast*fast*fast)); break; -#endif } -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type == 0) { -#endif *cum_fading_slow = *cum_fading_slow * slow; *cum_fading_fast = *cum_fading_fast * fast; -#ifdef CR8_A_PLC_FADEOUT_TUNING } -#endif if (processDampScramb == 1) { -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type != 0) { if (nbLostCmpt < (4 * (100.0 / (LC3_FLOAT)frame_dms))) { @@ -141,7 +112,6 @@ void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 n cum_fading_slow_local = *cum_fading_slow; } else { -#endif fflcAtten = 1; cum_fading_slow_local = *cum_fading_slow; cum_fading_fast_local = *cum_fading_fast; @@ -159,9 +129,7 @@ void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 n { case 25: fflcAtten = PLC34_ATTEN_FAC_025; break; case 50: fflcAtten = PLC34_ATTEN_FAC_050; break; -#ifdef CR8_G_ADD_75MS case 75: fflcAtten = PLC34_ATTEN_FAC_075; break; -#endif case 100: fflcAtten = PLC34_ATTEN_FAC_100; break; } } @@ -199,37 +167,25 @@ void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 n } randThreshold = -32768 * linFuncStartStop; -#ifdef CR8_A_PLC_FADEOUT_TUNING } -#endif for (i = spec_inv_idx; i < yLen; i++) { *seed = 16831 + *seed * 12821; *seed = (LC3_INT16)(*seed); - if (*seed == 32768) - { - *seed -= 32768; - } if (*seed < 0) { -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type != 0 || pitch_present == 0 || *seed < randThreshold ) -#else - if (pitch_present == 0 || *seed < randThreshold) -#endif { spec[i] = -spec[i]; } } } -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type == 0) { -#endif ad_ThreshFac_start = 10; ad_ThreshFac_end = 1.2; ad_threshFac = (ad_ThreshFac_start - ad_ThreshFac_end) * linFuncStartStop + ad_ThreshFac_end; @@ -250,17 +206,11 @@ void processPlcDampingScrambling_fl(LC3_FLOAT *spec, LC3_INT32 yLen, LC3_INT32 n energThreshold = LC3_SQRT(ad_threshFac * mean_energy); fac = (cum_fading_slow_local - cum_fading_fast_local) * energThreshold; -#ifdef CR8_A_PLC_FADEOUT_TUNING } -#endif for (i = spec_inv_idx; i < yLen; i++) { -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type != 0 || LC3_FABS(spec[i]) < energThreshold ) -#else - if (LC3_FABS(spec[i]) < energThreshold) -#endif { m = cum_fading_slow_local; n = 0; diff --git a/lib_lc3plus/plc_main.c b/lib_lc3plus/plc_main.c index ca4a6bbcb2..01fe7b237c 100644 --- a/lib_lc3plus/plc_main.c +++ b/lib_lc3plus/plc_main.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -26,15 +25,11 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* LC3_FLOAT phEcu_env_stab_local[1]; LC3_FLOAT phEcu_pfind_sens[1]; -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT16 consecutiveLostThreshold = 0; -#endif -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER LC3_INT16 thresh_tdc_cnt; LC3_INT16 thresh_ns_cnt; LC3_INT16 thresh_tdc_ns_cnt; -#endif prev_bfi_plc2 = 1; if (PlcSetup->nbLostCmpt == 0) @@ -50,12 +45,6 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* } pitch_classifier = ltpf_pitch_int; -#ifdef NONBE_PLC_CLASSIFER_LAG_FIX - if (ltpf_pitch_fr > 2) - { - pitch_classifier++; - } -#endif processPlcClassify_fl(plcMeth, &h_DecSetup->concealMethod, &PlcSetup->nbLostCmpt, bfi, &xcorr, decoder->frame_length, decoder->frame_dms, pitch_classifier, decoder->fs, @@ -64,44 +53,34 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* if (bfi == 1) { -#ifdef CR8_A_PLC_FADEOUT_TUNING switch(decoder->frame_dms) { case 25: consecutiveLostThreshold = 16; -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER thresh_tdc_cnt = THRESH_025_DMS_TDC_CNT; thresh_ns_cnt = THRESH_025_DMS_NS_CNT; - thresh_tdc_ns_cnt = THRESH_025_DMS_TDC_NS_CNT; -#endif + thresh_tdc_ns_cnt = THRESH_025_DMS_TDC_NS_CNT; break; case 50: consecutiveLostThreshold = 8; -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER thresh_tdc_cnt = THRESH_050_DMS_TDC_CNT; thresh_ns_cnt = THRESH_050_DMS_NS_CNT; - thresh_tdc_ns_cnt = THRESH_050_DMS_TDC_NS_CNT; -#endif + thresh_tdc_ns_cnt = THRESH_050_DMS_TDC_NS_CNT; break; case 75: consecutiveLostThreshold = 6; -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER thresh_tdc_cnt = THRESH_075_DMS_TDC_CNT; thresh_ns_cnt = THRESH_075_DMS_NS_CNT; - thresh_tdc_ns_cnt = THRESH_075_DMS_TDC_NS_CNT; -#endif + thresh_tdc_ns_cnt = THRESH_075_DMS_TDC_NS_CNT; break; case 100: consecutiveLostThreshold = 4; -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER thresh_tdc_cnt = THRESH_100_DMS_TDC_CNT; thresh_ns_cnt = THRESH_100_DMS_NS_CNT; thresh_tdc_ns_cnt = THRESH_100_DMS_TDC_NS_CNT; -#endif break; default: assert(0); } if (decoder->fs_idx == 2 || decoder->fs_idx >= 4) { -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER if (PlcAdvSetup->longterm_counter_plcTdc < thresh_tdc_cnt){ PlcAdvSetup->plc_fadeout_type = 1; } @@ -114,41 +93,14 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* else { PlcAdvSetup->plc_fadeout_type = 0; } -#else - if (((PlcAdvSetup->longterm_counter_plcPhaseEcu < PlcAdvSetup->longterm_counter_plcTdc*FAC1_FADEOUT) || - (PlcAdvSetup->longterm_counter_plcPhaseEcu < PlcAdvSetup->longterm_counter_plcNsAdv*FAC1_FADEOUT)) && - (PlcAdvSetup->longterm_counter_plcTdc / (PlcAdvSetup->longterm_counter_plcNsAdv + LC3_EPS) < FAC2_FADEOUT)) - { - PlcAdvSetup->plc_fadeout_type = 0; - } else { - if ((PlcAdvSetup->longterm_counter_plcPhaseEcu > FAC3_FADEOUT * PlcAdvSetup->longterm_counter_plcTdc) || - (PlcAdvSetup->longterm_counter_plcPhaseEcu > FAC3_FADEOUT * PlcAdvSetup->longterm_counter_plcNsAdv)) - { - PlcAdvSetup->plc_fadeout_type = 1; - } else { - PlcAdvSetup->plc_fadeout_type = 0; - } - } -#endif if ((PlcAdvSetup->overall_counter - (int)(PLC_LONGTERM_ANALYSIS_STARTUP_FILL * PlcAdvSetup->longterm_analysis_counter_max)) < 0) { PlcAdvSetup->plc_fadeout_type = 0; } -#ifndef CR9_H_REMOVE_SWITCH_TO_PLC_NS - if (PlcSetup->nbLostCmpt >= consecutiveLostThreshold && PlcAdvSetup->plc_fadeout_type == 1) - { - if ( h_DecSetup->concealMethod == 3 ) - { - h_DecSetup->concealMethod = 4; - } - } -#endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH if (h_DecSetup->rel_pitch_change > REL_PITCH_THRESH && hrmode == 1 && (decoder->frame_dms == 50 || decoder->frame_dms == 25) ){ PlcAdvSetup->plc_fadeout_type = 2; } else -#endif if ( h_DecSetup->concealMethod != 2 ) { /* not PhECU */ if (PlcSetup->nbLostCmpt < consecutiveLostThreshold ) @@ -159,11 +111,7 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* } else { PlcAdvSetup->plc_fadeout_type = 0; } -#endif -#ifdef PLC_CR8_A_PRINTF - printf("plc_fadeout_type = %d\n", PlcAdvSetup->plc_fadeout_type); -#endif switch (h_DecSetup->concealMethod) { case 2: @@ -176,7 +124,7 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* if (decoder->frame_dms != 100) { - // muting, if frame size changed during phaseECU concealment + /* muting, if frame size changed during phaseECU concealment */ memset(q_d_fl_c, 0, sizeof(LC3_FLOAT) * decoder->frame_length); h_DecSetup->alpha = 0; break; @@ -266,10 +214,8 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* , &(PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft), &(PlcAdvSetup->PlcPhEcuSetup.PhEcu_Ifft) -#ifdef CR8_A_PLC_FADEOUT_TUNING ,PlcAdvSetup->plc_fadeout_type, &(PlcAdvSetup->PlcPhEcuSetup.PhECU_nonpure_tone_flag) /* nonpure tone flag */ -#endif ); @@ -295,9 +241,8 @@ void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder->frame_dms, decoder->fs, PlcSetup->nbLostCmpt, decoder->frame_length - decoder->la_zeroes, &PlcAdvSetup->stabFac, PlcAdvSetup->PlcTdcSetup.harmonicBuf, PlcAdvSetup->PlcTdcSetup.synthHist, &PlcAdvSetup->PlcTdcSetup.fract, &PlcAdvSetup->PlcTdcSetup.seed, &PlcAdvSetup->PlcTdcSetup.gain_c, &h_DecSetup->alpha, synth -#ifdef CR9_I_INC_TDC_FADEOUT_LEN - ,PlcAdvSetup->plc_fadeout_type -#endif + , PlcAdvSetup->plc_fadeout_type + , decoder->alpha_type_2_table ); processTdcTdac_fl(synth, decoder->imdct_win, decoder->frame_length, decoder->la_zeroes, h_DecSetup->imdct_mem); diff --git a/lib_lc3plus/plc_noise_substitution.c b/lib_lc3plus/plc_noise_substitution.c index c366015fc0..dc8e4d56fc 100644 --- a/lib_lc3plus/plc_noise_substitution.c +++ b/lib_lc3plus/plc_noise_substitution.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processNoiseSubstitution_fl(LC3_FLOAT* spec, LC3_FLOAT* spec_prev, LC3_INT32 yLen) { memmove(spec, spec_prev, sizeof(LC3_FLOAT) * yLen); diff --git a/lib_lc3plus/plc_phecu_f0_refine_first.c b/lib_lc3plus/plc_phecu_f0_refine_first.c index c3f8edfab2..7abb19813c 100644 --- a/lib_lc3plus/plc_phecu_f0_refine_first.c +++ b/lib_lc3plus/plc_phecu_f0_refine_first.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - void plc_phEcu_F0_refine_first( LC3_INT32 *plocs, /* i/o 0 ... Lprot/2 +1*/ LC3_INT32 n_plocs, LC3_FLOAT *f0est, /* i/o f0est */ diff --git a/lib_lc3plus/plc_phecu_fec_hq.c b/lib_lc3plus/plc_phecu_fec_hq.c index 9213b9ea53..bb7be94bf0 100644 --- a/lib_lc3plus/plc_phecu_fec_hq.c +++ b/lib_lc3plus/plc_phecu_fec_hq.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - LC3_FLOAT plc_phEcu_imax2_jacobsen_mag(const Complex *y, LC3_FLOAT *c_jacobPtr) { LC3_FLOAT posi; diff --git a/lib_lc3plus/plc_phecu_hq_ecu.c b/lib_lc3plus/plc_phecu_hq_ecu.c index 577a56e83a..8b2b981582 100644 --- a/lib_lc3plus/plc_phecu_hq_ecu.c +++ b/lib_lc3plus/plc_phecu_hq_ecu.c @@ -1,20 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - - void plc_phEcu_hq_ecu( LC3_FLOAT *f0binPtr, LC3_FLOAT *f0ltpGainPtr, LC3_FLOAT *xfp, LC3_INT16 prev_bfi, LC3_INT32 *short_flag_prev, LC3_INT32 fs, @@ -27,9 +24,7 @@ void plc_phEcu_hq_ecu( LC3_INT32 *seed_dbg, LC3_FLOAT *mag_chg_dbg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg, LC3_FLOAT *corr_phase_dbg, Fft *PhEcu_Fft, Fft *PhEcu_Ifft -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type, LC3_INT16 *nonpure_tone_flag_ptr /* nonpure tone flag */ -#endif ) { @@ -78,19 +73,13 @@ void plc_phEcu_hq_ecu( xfp_local_rnd[i] = 0.0; } } -#ifdef CR8_A_PLC_FADEOUT_TUNING *nonpure_tone_flag_ptr = -1; /* set nonpure tone flag for new analysis */ -#endif - *time_offs = 0; burst_len = (*time_offs / L + 1); plc_phEcu_trans_burst_ana_sub(fs_idx, burst_len, n_grp, oold_grp_shape, oold_EwPtr , old_grp_shape, old_EwPtr, st_beta_mute, st_mag_chg_1st, st_Xavg, alpha, beta, mag_chg, NULL, NULL - -#ifdef CR8_A_PLC_FADEOUT_TUNING - ,plc_fadeout_type -#endif + , plc_fadeout_type ); plc_phEcu_spec_ana(xfp_local_rnd, Lprot, winWhr, pfind_sensPtr, plocs, n_plocs, f0est, X_sav_m, &LXsav, f0binPtr, f0ltpGainPtr, fs_idx, PhEcu_Fft); @@ -103,9 +92,7 @@ void plc_phEcu_hq_ecu( plc_phEcu_trans_burst_ana_sub(fs_idx, burst_len, n_grp, oold_grp_shape, oold_EwPtr, old_grp_shape, old_EwPtr, st_beta_mute, st_mag_chg_1st, st_Xavg, alpha, beta, mag_chg, NULL, NULL -#ifdef CR8_A_PLC_FADEOUT_TUNING - ,plc_fadeout_type -#endif + , plc_fadeout_type ); } @@ -121,10 +108,8 @@ void plc_phEcu_hq_ecu( /* inplace X_out_m update */ plc_phEcu_subst_spec(plocs, *n_plocs, f0est, *time_offs, X_out_m, LXsav, mag_chg, &seed, alpha, beta, st_Xavg, t_adv, Lprot, delta_corr, -#ifdef CR8_A_PLC_FADEOUT_TUNING plc_fadeout_type, nonpure_tone_flag_ptr, /* nonpure_tone_flag , a state updated here */ -#endif NULL, NULL, NULL); diff --git a/lib_lc3plus/plc_phecu_lf_peak_analysis.c b/lib_lc3plus/plc_phecu_lf_peak_analysis.c index 53c10410c0..a53b6a4352 100644 --- a/lib_lc3plus/plc_phecu_lf_peak_analysis.c +++ b/lib_lc3plus/plc_phecu_lf_peak_analysis.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - void plc_phEcu_LF_peak_analysis(LC3_INT32 *plocs, /* i/o 0 ... Lprot/2 +1*/ LC3_INT32 *n_plocs, /* i/o 0.. MAX_PLOCS */ LC3_FLOAT *f0est, /* i/o Q16*/ diff --git a/lib_lc3plus/plc_phecu_rec_frame.c b/lib_lc3plus/plc_phecu_rec_frame.c index 4586e1d625..412c5205ca 100644 --- a/lib_lc3plus/plc_phecu_rec_frame.c +++ b/lib_lc3plus/plc_phecu_rec_frame.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - void plc_phEcu_rec_frame(Complex *X_in, LC3_INT32 L, LC3_INT32 Lecu, @@ -53,11 +51,7 @@ void plc_phEcu_rec_frame(Complex *X_in, UNUSED(xsubst_dbg); UNUSED(xsubst_LL); -#ifdef CR8_A_PLC_FADEOUT_TUNING - fs_idx = FRAME2FS_IDX_10MS(L); -#else - fs_idx = FRAME2FS_IDX(L); -#endif + fs_idx = FRAME2FS_IDX_10MS(L); hannOla = hannOla_wins[fs_idx]; X_in[0].i = X_in[Lprot / 2].r; /* move fs/2 real to imag part of X_in[0]*/ diff --git a/lib_lc3plus/plc_phecu_setf0hz.c b/lib_lc3plus/plc_phecu_setf0hz.c index 79a82d0928..c67f96d410 100644 --- a/lib_lc3plus/plc_phecu_setf0hz.c +++ b/lib_lc3plus/plc_phecu_setf0hz.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - LC3_FLOAT plc_phEcuSetF0Hz(LC3_INT32 fs, LC3_FLOAT * old_pitchPtr) { LC3_FLOAT result; diff --git a/lib_lc3plus/plc_phecu_spec_ana.c b/lib_lc3plus/plc_phecu_spec_ana.c index 463d3d1ae6..c8b46309ba 100644 --- a/lib_lc3plus/plc_phecu_spec_ana.c +++ b/lib_lc3plus/plc_phecu_spec_ana.c @@ -1,22 +1,19 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - #define PEAK_LOCATOR_RES_FX 1 /* fixed point resolution minimum value */ - static LC3_INT16 plc_phEcu_find_ind_fx( /* o : output maximum indx 0.. len-1 */ const LC3_INT16 *inp, /* i : vector */ const LC3_INT16 len, /* i : length */ diff --git a/lib_lc3plus/plc_phecu_subst_spec.c b/lib_lc3plus/plc_phecu_subst_spec.c index 388ae3cb80..62a1d4434e 100644 --- a/lib_lc3plus/plc_phecu_subst_spec.c +++ b/lib_lc3plus/plc_phecu_subst_spec.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -18,20 +17,15 @@ static LC3_INT32 own_rand(LC3_INT32 seed); static Complex valley_magnitude_adj(Complex X_i_in, LC3_INT32 uni_seed, LC3_FLOAT cos_F); static LC3_INT32 rand_phase(LC3_INT32 seed_in, LC3_FLOAT* cos_F); -#ifdef CR8_A_PLC_FADEOUT_TUNING - #define ONE_SIDED_SINE_WIDTH (4) /* expected pure sine main lobe maximum width (4+1+4) bins *62.5 hz/bin => approx 560 Hz total width */ static LC3_INT16 plc_phEcu_nonpure_tone_ana(const LC3_INT32* plocs, const LC3_INT32 n_plocs, const Complex* X, const LC3_FLOAT* Xavg, const LC3_INT32 Lprot); -#endif void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_INT32 time_offs, Complex* X, LC3_INT32 X_len, LC3_FLOAT* mag_chg_gr, LC3_INT32 *seed, LC3_FLOAT* alpha, LC3_FLOAT* beta, LC3_FLOAT* Xavg, LC3_INT32 t_adv_in, LC3_INT32 Lprot, LC3_INT32 delta_corr, -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT16 fadeout, /* need for DC muting */ LC3_INT16* nonpure_tone_flag_ptr, -#endif LC3_FLOAT *corr_phase_dbg, LC3_FLOAT *X_i_new_re_dbg, LC3_FLOAT *X_i_new_im_dbg) { @@ -44,9 +38,7 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, LC3_FLOAT Xph; LC3_FLOAT seed_local; LC3_INT32 binCounter = 1, subInd = 0; -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT16 fs_idx; -#endif UNUSED(corr_phase_dbg); UNUSED(X_i_new_re_dbg); @@ -59,13 +51,12 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, t_adv = t_adv_in + time_offs; for (i = 0; i < n_plocs; i++) { - corr_phase[i] = (LC3_FLOAT)2.0 * (LC3_FLOAT)M_PI * (f0est[i]/Lprot)*(LC3_FLOAT)t_adv; + corr_phase[i] = (LC3_FLOAT)2.0 * (LC3_FLOAT)M_PI_LC3PLUS * (f0est[i]/Lprot)*(LC3_FLOAT)t_adv; } // EVOLVE PHASE ----------------- - one_peak_flag_mask = -1; -#ifdef CR8_A_PLC_FADEOUT_TUNING + one_peak_flag_mask = -1; fs_idx = (LC3_INT16)LC3_FLOOR((LC3_FLOAT)Lprot / 160.0); /* aquire, fs_idx for 10 ms frame sizes */ if (n_plocs < 3 && n_plocs > 0) { @@ -84,11 +75,6 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, } } -#else - if (n_plocs < 3 && n_plocs > 0) { - one_peak_flag_mask = 0; - } -#endif noise_mag_scale = 0; if (n_plocs == 0 || time_offs != 0) { @@ -100,7 +86,6 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, X[X_len-1] = realtoc(0); } -#ifdef CR8_A_PLC_FADEOUT_TUNING /* binary selection of fadeout scheme */ assert(PLC2_FADEOUT_LONG_IN_MS >= PLC2_FADEOUT_IN_MS_MIN && PLC2_FADEOUT_IN_MS >= PLC2_FADEOUT_IN_MS_MIN); assert(PLC2_FADEOUT_LONG_IN_MS <= PLC2_FADEOUT_IN_MS_MAX && PLC2_FADEOUT_IN_MS <= PLC2_FADEOUT_IN_MS_MAX); @@ -122,7 +107,6 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, /* start fs/by2 attenuation */ X[X_len - 1].r = alpha[(xavg_N_grp[fs_idx] - 1)] * X[X_len - 1].r; } -#endif if (n_plocs != 0) { for (i = 0; i < n_plocs; i++) { @@ -143,7 +127,7 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, seed_local = (LC3_FLOAT)rand_phase((LC3_INT32)seed_local, &cos_F); X_i = X[binCounter]; - X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0)); + X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI_LC3PLUS*seed_local / (LC3_FLOAT)32768.0)); seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); @@ -162,7 +146,7 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, tmp = 0; X_i_new = realtoc(0); } - X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0))); + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI_LC3PLUS*seed_local / (LC3_FLOAT)32768.0))); } else { if (one_peak_flag_mask == 0) { @@ -194,9 +178,9 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, X_i = X[binCounter]; { - LC3_INT32 nrep =(LC3_INT32) LC3_FLOOR(Xph / (2.0f*(LC3_FLOAT)M_PI)); + LC3_INT32 nrep =(LC3_INT32) LC3_FLOOR(Xph / (2.0f*(LC3_FLOAT)M_PI_LC3PLUS)); - X_i_new = cmul(X_i, cexpi(Xph - (2.0f*(LC3_FLOAT)M_PI*(LC3_FLOAT)nrep))); + X_i_new = cmul(X_i, cexpi(Xph - (2.0f*(LC3_FLOAT)M_PI_LC3PLUS*(LC3_FLOAT)nrep))); } @@ -210,7 +194,7 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, assert(alpha_local == mag_chg_local); tmp = beta_local * Xavg[subInd]; - X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local / (LC3_FLOAT)32768.0))); + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI_LC3PLUS*seed_local / (LC3_FLOAT)32768.0))); } else { @@ -232,7 +216,7 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, seed_local = (LC3_FLOAT)rand_phase((LC3_INT32)seed_local, &cos_F); X_i = X[binCounter]; - X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI*seed_local/(LC3_FLOAT)32768.0)); + X_i_new = cmul(X_i, cexpi((LC3_FLOAT)M_PI_LC3PLUS*seed_local/(LC3_FLOAT)32768.0)); seed_local = (LC3_FLOAT)own_rand((LC3_INT32)seed_local); @@ -256,7 +240,7 @@ void plc_phEcu_subst_spec(LC3_INT32* plocs, LC3_INT32 n_plocs, LC3_FLOAT* f0est, tmp = 0; } - X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI*seed_local/(LC3_FLOAT)32768.0))); + X[binCounter] = cadd(cmul(realtoc(alpha_local), X_i_new), cmul(realtoc(tmp), cexpi((LC3_FLOAT)M_PI_LC3PLUS*seed_local/(LC3_FLOAT)32768.0))); } else { @@ -295,13 +279,10 @@ static Complex valley_magnitude_adj(Complex X_i_in, LC3_INT32 uni_seed, LC3_FLOA static LC3_INT32 rand_phase(LC3_INT32 seed_in, LC3_FLOAT* cos_F) { LC3_FLOAT seed = (LC3_FLOAT)own_rand(seed_in); - *cos_F = LC3_COS((LC3_FLOAT)M_PI*seed/(LC3_FLOAT)32768.0); + *cos_F = LC3_COS((LC3_FLOAT)M_PI_LC3PLUS*seed/(LC3_FLOAT)32768.0); return (LC3_INT32) seed; } - -#ifdef CR8_A_PLC_FADEOUT_TUNING - static LC3_INT16 plc_phEcu_nonpure_tone_ana(const LC3_INT32* plocs, const LC3_INT32 n_plocs, const Complex* X, const LC3_FLOAT* Xavg, const LC3_INT32 Lprot) { @@ -452,5 +433,3 @@ static LC3_INT16 plc_phEcu_nonpure_tone_ana(const LC3_INT32* plocs, const LC3_I return nonpure_tone_detect; } -#endif /* CR8_A_PLC_FADEOUT_TUNING */ - diff --git a/lib_lc3plus/plc_phecu_tba_per_band_gain.c b/lib_lc3plus/plc_phecu_tba_per_band_gain.c index 10aef92346..8bf33b8853 100644 --- a/lib_lc3plus/plc_phecu_tba_per_band_gain.c +++ b/lib_lc3plus/plc_phecu_tba_per_band_gain.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) { LC3_INT32 i; diff --git a/lib_lc3plus/plc_phecu_tba_spect_Xavg.c b/lib_lc3plus/plc_phecu_tba_spect_Xavg.c index 20baf4e796..ca58ade71e 100644 --- a/lib_lc3plus/plc_phecu_tba_spect_Xavg.c +++ b/lib_lc3plus/plc_phecu_tba_spect_Xavg.c @@ -1,19 +1,17 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - void plc_phEcu_tba_spect_Xavg(LC3_INT32 fs_idx, LC3_INT32 n_grp, LC3_FLOAT *oold_spec_shape, LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spec_shape, LC3_FLOAT *old_EwPtr, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *Xavg) diff --git a/lib_lc3plus/plc_phecu_tba_trans_dect_gains.c b/lib_lc3plus/plc_phecu_tba_trans_dect_gains.c index 69d6bf3968..0ea04fe1af 100644 --- a/lib_lc3plus/plc_phecu_tba_trans_dect_gains.c +++ b/lib_lc3plus/plc_phecu_tba_trans_dect_gains.c @@ -1,31 +1,23 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - #define BETA_MUTE_FAC 0.5 /* % attenuation factor per additional bad frame, FX uses 0.5 (shift right with 1 bit) */ #define BETA_MUTE_FAC_INI 0.5 - - #define OFF_FRAMES_LIMIT 30 /* 300 ms for LC3 10 ms */ - - - #define LGW32k 7 #define LGW16k 5 - /* Tables for attentuation of mag_chg, copied from FX */ /* Tables are in Q15 */ /* 0.3 dB attenuation per frame for 16 frames, then 6 dB attenuation per frame */ @@ -41,15 +33,8 @@ const LC3_INT32 POW_ATT_TABLE0[OFF_FRAMES_LIMIT + 1] = { 32767, 31293, 29885, 28 #ifdef PLC2_FADEOUT_IN_MS #if PLC2_FADEOUT_IN_MS == 0 -#ifndef CR8_A_PLC_FADEOUT_TUNING -/* default setting only requires two tables */ -const Word16* const POW_ATT_TABLES[1 + 2] = -{ NULL, POW_ATT_TABLE1/*1 0.3dB steps */ , POW_ATT_TABLE0/*2 0.4 dB steps*/, -}; -#endif #else -#ifdef CR8_A_PLC_FADEOUT_TUNING const LC3_INT32 POW_ATT_TABLE_p3x9_14_7[OFF_FRAMES_LIMIT + 1] = { 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 24857, 24013, /* 9 times .3dB steps , 14 6 dB steps, 7 muted steps */ @@ -61,8 +46,6 @@ const LC3_INT32 POW_ATT_TABLE_p4x9_14_7[OFF_FRAMES_LIMIT + 1] = 31293, 29885, 28540, 27255, 26029, 24857, 23738, 22670, 21650, /* 9 times .4dB steps , 14 6 dB steps, 7 muted steps */ 10825, 5413, 2706, 1353, 677, 338, 169, 85, 42, 21, 11, 5, 3, 1, 0, 0,0,0,0,0,0 }; -#endif - const LC3_INT32 POW_ATT_TABLE_p3x8_6[] = { 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 12865, 6433, @@ -100,7 +83,6 @@ const LC3_INT32 POW_ATT_TABLE_p4x1_6[OFF_FRAMES_LIMIT + 1] = { 32, 16, 8, 4, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#ifdef CR8_A_PLC_FADEOUT_TUNING const LC3_INT32 *const POW_ATT_TABLES[1 + 12] = { NULL, /*0.3dB col , 0.4dB col */ @@ -112,17 +94,6 @@ const LC3_INT32 *const POW_ATT_TABLES[1 + 12] = /*11*/POW_ATT_TABLE1, POW_ATT_TABLE0, /* 15 0.3dB, 14 6dB , 1 mute */ /* 0.4dB version */ /* original curves */ }; -#else - -const LC3_INT32* const POW_ATT_TABLES[1 + 10] = -{ NULL, - POW_ATT_TABLE1 , POW_ATT_TABLE0, /* .3dB x16,16 6dB steps */ /* .4dB x16, 16 6dB steps */ /*original/default */ - POW_ATT_TABLE_p3x8_6, POW_ATT_TABLE_p4x8_6, /* .3dB x8, 24 6dB steps */ /* .4dB x8, 24 6dB steps */ - POW_ATT_TABLE_p3x4_6, POW_ATT_TABLE_p4x4_6, /* .3dB x4, 28 6dB steps */ /* .4dB x4, 28 6dB steps */ - POW_ATT_TABLE_p3x2_6, POW_ATT_TABLE_p4x2_6, /* .3dB x2, 30 6dB steps */ /* .4dB x2, 30 6dB steps */ - POW_ATT_TABLE_p3x1_6, POW_ATT_TABLE_p4x1_6 /* .3dB x1, 30 6dB steps */ /* .4dB x1, 30 6dB steps */ -}; -#endif #endif #endif @@ -130,9 +101,7 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_FLOAT *ph_dith, LC3_INT32 *tr_dec, LC3_FLOAT *att_val, LC3_INT32 *attDegreeFrames_dbg, LC3_FLOAT *thresh_dbg -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ) { @@ -145,19 +114,8 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL LC3_INT32 burst_att_thresh; LC3_INT32 att_per_frame_idx; LC3_INT32 att_always, attDegreeFrames; -#ifndef CR8_A_PLC_FADEOUT_TUNING - LC3_INT32 FADEOUT_IN_MS, PLC_P800_SPEECH_FADEOUT_IN_FRAMES, - PLC2_FADEOUT_IN_FRAMES, BURST_ATT_THRESH_PRE; -#endif const LC3_INT32 *TABLEQ15; -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT32 beta_mute_thr; /* time threshold in 10 ms frames to start beta - noise attenuation */ -#endif -#ifndef CR8_A_PLC_FADEOUT_TUNING - LC3_INT32 BURST_ATT_THRESH; /* start attenuate with losses in a row, also starts FADE2AVG actions */ - LC3_INT32 ATT_PER_FRAME; /* initial msuic attenuation table ptr, actually implemented in table lookup! */ - LC3_INT32 BETA_MUTE_THR; /* time threshold in 10 ms frames to start beta - noise attenuation */ -#endif UNUSED(attDegreeFrames_dbg); /* constants setup */ @@ -165,47 +123,12 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL XavgFadeinFactor = -1.0; -#ifndef CR8_A_PLC_FADEOUT_TUNING - if (PLC2_FADEOUT_IN_MS < 0) - { - FADEOUT_IN_MS = PLC_FADEOUT_IN_MS; /* % use TDC - SETTING as basic input */ - } - else - { - FADEOUT_IN_MS = PLC2_FADEOUT_IN_MS; /* % use a PLC2 individual settings */ - } -#endif - -#ifndef CR8_A_PLC_FADEOUT_TUNING - PLC_P800_SPEECH_FADEOUT_IN_FRAMES = (LC3_INT32)LC3_FLOOR((LC3_FLOAT)FADEOUT_IN_MS / (LC3_FLOAT)10.0); /* % nominal value for speech */ - - PLC2_FADEOUT_IN_FRAMES = MIN(OFF_FRAMES_LIMIT, MAX(6, 3 * PLC_P800_SPEECH_FADEOUT_IN_FRAMES)); /* for PLC2 we typically maintain energy 3x longer */ - - BURST_ATT_THRESH_PRE = MIN(5, MAX(1, (1 * PLC2_FADEOUT_IN_FRAMES) / 6)); /* nominal 20-40 ms to start actual muting, will be thresh +1 */ - ATT_PER_FRAME = MIN(10, MAX(2, 2 * (6 - BURST_ATT_THRESH_PRE))); /* % we let the BURST_ATT_thresh control the initial table selection */ - BURST_ATT_THRESH = MIN(BURST_ATT_THRESH_PRE, 4); - BETA_MUTE_THR = MIN(4 + (OFF_FRAMES_LIMIT / 2) + 1, MAX(4, BURST_ATT_THRESH + 1 + (LC3_INT32)LC3_POW((LC3_FLOAT)2.0, BURST_ATT_THRESH_PRE - (LC3_FLOAT)1))); /* nominal time to start mandatory decrease of Xavg */ - -/* Initialize in the same way as done in trans_burst_ana_fx(), even though this is not really needed */ - burst_att_thresh = BURST_ATT_THRESH; - att_per_frame_idx = ATT_PER_FRAME; -#endif - - /* 10ms constants */ thresh_tr_dB = 10.0; /* dB threshold kept same as for 20ms, even though transient analysis frame size was shortened */ max_increase_grp_pow = 0; /* maximum amplification(dB) in case of onset transients, offset always deacy */ max_increase_grp_pow_lin = (LC3_FLOAT)1.0*LC3_POW((LC3_FLOAT)10.0, max_increase_grp_pow / (LC3_FLOAT)10.0)*(LC3_FLOAT)(32767.0 / 32768.0); - -#ifndef CR8_A_PLC_FADEOUT_TUNING - /* envelope setting */ - burst_att_thresh = BURST_ATT_THRESH + 1; - att_per_frame_idx = ATT_PER_FRAME - 1; -#endif - -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type != 0) { i = (PLC2_FADEOUT_LONG_IN_MS - PLC2_FADEOUT_IN_MS_MIN) / PLC2_FADEOUT_RES; /*a long fading table entry in fade_scheme_tab */ @@ -218,7 +141,6 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL burst_att_thresh = fade_scheme_tab[i][1]; /* number of 1.0 frames before muting/mixing phase */ /* band gain muting may can take place earlier due to a band transient */ beta_mute_thr = fade_scheme_tab[i][2]; /* muting of Xavg contribution start when slow fadeout is over */ -#endif attDegreeFrames = 0; if (burst_len > burst_att_thresh) @@ -289,33 +211,12 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL assert(burst_len >= 2); /* states used here */ tr_dec[i] = 0; -#ifndef CR8_A_PLC_FADEOUT_TUNING - if (PLC_FADEOUT_IN_MS > 0) -#endif { -#ifdef CR8_A_PLC_FADEOUT_TUNING assert(att_per_frame_idx >= 1 && att_per_frame_idx <= (10+2)); -#else - assert(att_per_frame_idx >= 1 && att_per_frame_idx <= 10); -#endif TABLEQ15 = POW_ATT_TABLES[att_per_frame_idx]; att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT) TABLEQ15[MIN(OFF_FRAMES_LIMIT, attDegreeFrames )] / (LC3_FLOAT)32768.0); /* Table idx 0...N-1 therefore no + 1 */ att_val[i] = att_val[i]; } -#ifndef CR8_A_PLC_FADEOUT_TUNING - else - { - - if (att_per_frame_idx == ATT_PER_FRAME) - { - att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT)POW_ATT_TABLE0[MIN(OFF_FRAMES_LIMIT, attDegreeFrames)] / (LC3_FLOAT)32768.0); - } - else - { - att_val[i] = (LC3_FLOAT)1.0 * ( (LC3_FLOAT)POW_ATT_TABLE1[MIN(OFF_FRAMES_LIMIT, attDegreeFrames)] / (LC3_FLOAT)32768.0); - } - } -#endif if ( (att_val[i] != 0) && (att_val[i] * (LC3_FLOAT)32768.0 < (LC3_FLOAT)0.5) ) { @@ -332,13 +233,8 @@ void plc_phEcu_tba_trans_dect_gains(LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FL mag_chg[i] = 0; /* for SNR measurments match in float lowest possible level to BASOP representation */ } - -#ifdef CR8_A_PLC_FADEOUT_TUNING /* note beta_mute decreased once per frame, not once per band */ if (i == 0 && burst_len > beta_mute_thr) -#else - if(burst_len > BETA_MUTE_THR) -#endif { *stPhECU_beta_mute = *stPhECU_beta_mute * (LC3_FLOAT)BETA_MUTE_FAC; } diff --git a/lib_lc3plus/plc_phecu_trans_burst_ana_sub.c b/lib_lc3plus/plc_phecu_trans_burst_ana_sub.c index a25947a186..52bee02583 100644 --- a/lib_lc3plus/plc_phecu_trans_burst_ana_sub.c +++ b/lib_lc3plus/plc_phecu_trans_burst_ana_sub.c @@ -1,28 +1,22 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "defines.h" #include "functions.h" - - - void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg -#ifdef CR8_A_PLC_FADEOUT_TUNING , LC3_UINT8 plc_fadeout_type -#endif ) { LC3_FLOAT gr_pow_left[MAX_LGW]; @@ -48,9 +42,7 @@ void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_IN } plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg -#ifdef CR8_A_PLC_FADEOUT_TUNING , plc_fadeout_type -#endif ); diff --git a/lib_lc3plus/plc_tdc.c b/lib_lc3plus/plc_tdc.c index 25c4aa0640..d789a9df29 100644 --- a/lib_lc3plus/plc_tdc.c +++ b/lib_lc3plus/plc_tdc.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - /***************************************************************************\ * contents/description: Main function for Time domain concealment @@ -16,7 +15,7 @@ #include "wmc_auto.h" #include #include "functions.h" - +#include "constants.h" static LC3_INT16 TDC_random_short(LC3_INT16 *seed); static LC3_FLOAT TDC_get_gainp(const LC3_FLOAT x[], const LC3_FLOAT y[], LC3_INT32 n); @@ -33,7 +32,7 @@ const LC3_FLOAT TDC_high_32_harm[TDC_L_FIR_HP] = {-0.0053f, -0.0037f, -0.0140f, static void TDC_levinson(LC3_FLOAT *acf, LC3_INT32 len, LC3_FLOAT *out); static void TDC_copyFLOAT(const LC3_FLOAT * X, LC3_FLOAT * Z, LC3_INT32 n); static LC3_FLOAT TDC_dotFLOAT(const LC3_FLOAT * X, const LC3_FLOAT * Y, LC3_INT32 n); - +static LC3_FLOAT type_2_alpha_long(LC3_INT32 nbLostFramesInRow, LC3_INT32 frame_dms); const LC3_INT32 beforeNextIncArray[4][4] = {{0,0,0,1}, {0,1,0,1}, {0,1,1,1}, @@ -62,9 +61,8 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, LC3_FLOAT* gain_c, LC3_FLOAT* alpha, LC3_FLOAT* synth -#ifdef CR9_I_INC_TDC_FADEOUT_LEN - ,LC3_UINT8 plc_fadeout_type -#endif + , LC3_UINT8 plc_fadeout_type + , LC3_FLOAT* alpha_type_2_table ) { LC3_FLOAT step, step_n; @@ -81,9 +79,7 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, LC3_FLOAT alphaPrev; LC3_FLOAT throttle; LC3_INT32 frame_dms_idx, nbLostFramesInRow_mod; -#ifdef CR9_I_INC_TDC_FADEOUT_LEN LC3_INT32 plc_fadeout_len = 0; -#endif memset(synth_mem, 0, M * sizeof(LC3_FLOAT)); memset(scratchSpace, 0, (MAX_LEN_PCM_PLC + MDCT_MEM_LEN_MAX + MAX_LEN_PCM_PLC + 1 + M) * sizeof(LC3_FLOAT)); @@ -96,22 +92,16 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, nbLostFramesInRow_mod = (nbLostFramesInRow - 1) % 4; beforeNextInc = beforeNextIncArray[frame_dms_idx][nbLostFramesInRow_mod]; - nextInc = nextIncArray [frame_dms_idx][nbLostFramesInRow_mod]; + nextInc = nextIncArray [frame_dms_idx][nbLostFramesInRow_mod]; -#ifdef CR9_I_INC_TDC_FADEOUT_LEN - if (plc_fadeout_type == 1){ + if (plc_fadeout_type >= 1){ plc_fadeout_len = PLC_FADEOUT_TYPE_1_IN_MS; } else{ plc_fadeout_len = PLC_FADEOUT_IN_MS; } -#endif -#ifdef CR9_I_INC_TDC_FADEOUT_LEN if (nbLostCmpt_loc > plc_fadeout_len/10) -#else - if (nbLostCmpt_loc > PLC_FADEOUT_IN_MS/10) -#endif { gain_p = 0; *gain_c = 0; @@ -219,12 +209,10 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, alphaPrev = *alpha; } -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH if (plc_fadeout_type == 2){ - *alpha = LC3_POW(0.5,(nbLostFramesInRow + LC3_ROUND(100.0/frame_dms) - 1) * frame_dms/100.0); + *alpha = alpha_type_2_table[nbLostFramesInRow]; } else{ -#endif if (nextInc != 0) { @@ -258,14 +246,8 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, switch (frame_dms) { case 25: *alpha *= PLC34_ATTEN_FAC_025; break; -#ifdef CR9_J_SLOW_TDC_FADEOUT case 50: *alpha *= PLC34_ATTEN_FAC_025; break; -#else - case 50: *alpha *= PLC34_ATTEN_FAC_050; break; -#endif -#ifdef CR8_G_ADD_75MS case 75: *alpha *= PLC34_ATTEN_FAC_075; break; -#endif case 100: *alpha *= PLC34_ATTEN_FAC_100; break; } } @@ -274,9 +256,7 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, { gain_p = *alpha; } -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH } -#endif /*---------------------------------------------------------------* * Construct the harmonic part * * Last pitch cycle of the previous frame is repeatedly copied. * @@ -413,11 +393,7 @@ void processTdcApply_fl(const LC3_INT32 pitch_int, *----------------------------------------------------------*/ if (beforeNextInc != 0) { -#ifdef CR9_I_INC_TDC_FADEOUT_LEN if (nbLostCmpt_loc == plc_fadeout_len/10) -#else - if (nbLostCmpt_loc == PLC_FADEOUT_IN_MS/10) -#endif { gain_h = 1; step = 1.0f/(LC3_FLOAT)N; @@ -465,13 +441,13 @@ void processTdcInverseOdft_fl(LC3_FLOAT *in, LC3_INT32 n_bands, LC3_FLOAT *out, res.r = 0, res.i = 0; for (k = 0; k < n_bands; k++) { - res = cexpi((2 * M_PI * (LC3_FLOAT) (j * k)) / (LC3_FLOAT) n_bands); + res = cexpi((2 * M_PI_LC3PLUS * (LC3_FLOAT) (j * k)) / (LC3_FLOAT) n_bands); res.r = res.r * buf[k]; res.i = res.i * buf[k]; sum = cadd(sum, res); } - res = cexpi((LC3_FLOAT) j * M_PI / (2.0 * (LC3_FLOAT) n_bands)); + res = cexpi((LC3_FLOAT) j * M_PI_LC3PLUS / (2.0 * (LC3_FLOAT) n_bands)); out[j] = (sum.r * res.r - sum.i * res.i); } @@ -489,7 +465,7 @@ void processTdcPreemphasis_fl(LC3_FLOAT *in, LC3_FLOAT *pre_emph_factor, LC3_INT for (i = 0; i < n_bands; i++) { - in[i] = in[i] * (1.0 - 2.0 * (*pre_emph_factor) * LC3_COS(2.0 * M_PI * (0.5 + (LC3_FLOAT) i) / (2.0 * (LC3_FLOAT) n_bands)) + (*pre_emph_factor) * (*pre_emph_factor)); + in[i] = in[i] * (1.0 - 2.0 * (*pre_emph_factor) * LC3_COS(2.0 * M_PI_LC3PLUS * (0.5 + (LC3_FLOAT) i) / (2.0 * (LC3_FLOAT) n_bands)) + (*pre_emph_factor) * (*pre_emph_factor)); } } @@ -801,3 +777,24 @@ static void TDC_levinson(LC3_FLOAT *acf, LC3_INT32 len, LC3_FLOAT *out) } } +static LC3_FLOAT type_2_alpha_long(LC3_INT32 nbLostFramesInRow, LC3_INT32 frame_dms) +{ + if (nbLostFramesInRow <= 3*100.0/frame_dms){ + return LC3_POW(0.95,(nbLostFramesInRow + (100.0/frame_dms) - 1) * frame_dms/100.0); + } + else { + LC3_INT32 n_shift = (nbLostFramesInRow - 3*100.0/frame_dms) * 50/frame_dms; + return LC3_POW(0.7,(n_shift + 100.0/frame_dms - 1) * frame_dms/100.0); + } +} + +LC3_FLOAT type_2_fadeout(LC3_INT32 nbLostFramesInRow, LC3_INT32 frame_dms) +{ + LC3_FLOAT selector = PLC_FADEOUT_TYPE_2_SELECTOR * 2 * 100/frame_dms; + if (selector >= nbLostFramesInRow){ + return type_2_alpha_long(nbLostFramesInRow, frame_dms); + } + else { + return LC3_POW(0.5,(nbLostFramesInRow + (100.0/frame_dms) - 1) * frame_dms/100.0); + } +} diff --git a/lib_lc3plus/plc_tdc_tdac.c b/lib_lc3plus/plc_tdc_tdac.c index 596c23db03..5aa4248bdf 100644 --- a/lib_lc3plus/plc_tdc_tdac.c +++ b/lib_lc3plus/plc_tdc_tdac.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processTdcTdac_fl(const LC3_FLOAT *synth_inp, const LC3_FLOAT *win, LC3_INT32 frame_length, LC3_INT32 la_zeroes, LC3_FLOAT *ola_mem) { LC3_INT32 i, L, LD2, NZ, synth_len; diff --git a/lib_lc3plus/plc_update.c b/lib_lc3plus/plc_update.c index 40520fb256..f45afb4062 100644 --- a/lib_lc3plus/plc_update.c +++ b/lib_lc3plus/plc_update.c @@ -1,17 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * -******************************************************************************/ +******************************************************************************/ #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, LC3_INT32 *nbLostCmpt, LC3_FLOAT *cum_alpha, LC3_INT32 bfi, LC3_INT32 *prevBfi, LC3_INT32 *prevprevBfi) { diff --git a/lib_lc3plus/quantize_spec.c b/lib_lc3plus/quantize_spec.c index fdaee2890a..568dbe1fe1 100644 --- a/lib_lc3plus/quantize_spec.c +++ b/lib_lc3plus/quantize_spec.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -66,9 +65,7 @@ void processQuantizeSpec_fl(LC3_FLOAT x[], LC3_FLOAT gain, LC3_INT xq[], LC3_INT LC3_INT lastnz = 1, nt_half; LC3_FLOAT offset = 0.375; LC3_INT32 bits, bits2; -#ifdef CR9_QUANT_SPEC_REWRITE LC3_FLOAT inv_gain; -#endif assert(target >= 0); @@ -77,34 +74,22 @@ void processQuantizeSpec_fl(LC3_FLOAT x[], LC3_FLOAT gain, LC3_INT xq[], LC3_INT nt_half = nt >> 1; rateFlag = 0; c = 0; - if (hrmode) { offset = 0.5; } /* Quantization */ - -#ifdef CR9_QUANT_SPEC_REWRITE inv_gain = 1.0 / gain; -#endif for (i = 0; i < nt; i++) { if (x[i] > 0) { -#ifdef CR9_QUANT_SPEC_REWRITE xq[i] = (LC3_INT32) ( x[i] * inv_gain + offset); -#else - xq[i] = (LC3_INT32) ( x[i] / gain + offset); -#endif } else { -#ifdef CR9_QUANT_SPEC_REWRITE xq[i] = -((LC3_INT32) (-x[i] * inv_gain + offset)); -#else - xq[i] = -((LC3_INT32) (-x[i] / gain + offset)); -#endif } if (hrmode == 0) { assert(xq[i] <= 32767 && xq[i] >= -32768); diff --git a/lib_lc3plus/reorder_bitstream.c b/lib_lc3plus/reorder_bitstream.c index 118a05b6ef..3ab549d04b 100644 --- a/lib_lc3plus/reorder_bitstream.c +++ b/lib_lc3plus/reorder_bitstream.c @@ -1,18 +1,16 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" #include "functions.h" - void processReorderBitstream_fl(LC3_UINT8* bytes, LC3_INT32 n_pccw, LC3_INT32 n_pc, LC3_INT32 b_left, LC3_INT32 len) { LC3_UINT8 bytes_local[MAX_NBYTES2]; diff --git a/lib_lc3plus/resamp12k8.c b/lib_lc3plus/resamp12k8.c index 295b6e7f29..0909b67b9b 100644 --- a/lib_lc3plus/resamp12k8.c +++ b/lib_lc3plus/resamp12k8.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -32,11 +31,9 @@ void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3 case 50: len_12k8 = LEN_12K8 / 2; break; -#ifdef CR8_G_ADD_75MS case 75: len_12k8 = (LEN_12K8 / 4) * 3; break; -#endif case 100: len_12k8 = LEN_12K8; break; diff --git a/lib_lc3plus/residual_coding.c b/lib_lc3plus/residual_coding.c index 777b97d73a..282b7655e7 100644 --- a/lib_lc3plus/residual_coding.c +++ b/lib_lc3plus/residual_coding.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/residual_decoding.c b/lib_lc3plus/residual_decoding.c index 90084c9811..9970c094ba 100644 --- a/lib_lc3plus/residual_decoding.c +++ b/lib_lc3plus/residual_decoding.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/setup_com_lc3.c b/lib_lc3plus/setup_com_lc3.c index 33574f577e..f37af56a31 100644 --- a/lib_lc3plus/setup_com_lc3.c +++ b/lib_lc3plus/setup_com_lc3.c @@ -1,12 +1,12 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - + #include "options.h" #include "wmc_auto.h" #include "functions.h" diff --git a/lib_lc3plus/setup_dec_lc3.c b/lib_lc3plus/setup_dec_lc3.c index 1a6e4e7cc3..7bdbf0523d 100644 --- a/lib_lc3plus/setup_dec_lc3.c +++ b/lib_lc3plus/setup_dec_lc3.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -16,7 +15,7 @@ #include /* if decoder is null only size is reported */ -# include "fft/iis_fft.h" +#include "fft/iis_fft.h" int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels) { @@ -36,10 +35,8 @@ int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels) HANDLE_IIS_FFT handle_ifft_phaseecu; LC3_FLOAT *q_old_res; -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT32 * plc_longterm_advc_tdc = NULL, *plc_longterm_advc_ns = NULL; LC3_INT16 longterm_analysis_counter_max = 0, longterm_analysis_counter_max_bytebuffer = 0; -#endif for (ch = 0; ch < channels; ch++) { DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); @@ -64,14 +61,11 @@ int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels) sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); -#ifdef CR8_A_PLC_FADEOUT_TUNING - longterm_analysis_counter_max = plc_fadeout_param_maxlen[0]; - longterm_analysis_counter_max_bytebuffer = plc_fadeout_param_maxbytes[0]; - + longterm_analysis_counter_max = plc_fadeout_param_maxlen[0]; + longterm_analysis_counter_max_bytebuffer = plc_fadeout_param_maxbytes[0]; - plc_longterm_advc_tdc = balloc(decoder, &size, sizeof(LC3_INT32) * longterm_analysis_counter_max_bytebuffer); - plc_longterm_advc_ns = balloc(decoder, &size, sizeof(LC3_INT32) * longterm_analysis_counter_max_bytebuffer); -#endif + plc_longterm_advc_tdc = balloc(decoder, &size, sizeof(LC3_INT32) * longterm_analysis_counter_max_bytebuffer); + plc_longterm_advc_ns = balloc(decoder, &size, sizeof(LC3_INT32) * longterm_analysis_counter_max_bytebuffer); q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); @@ -96,13 +90,11 @@ int alloc_decoder(LC3PLUS_Dec* decoder, int samplerate, int channels) setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu->sine_table = sine_table1_phecu; setup->PlcAdvSetup->PlcPhEcuSetup.handle_ifft_phaseecu->sine_table = sine_table2_phecu; -#ifdef CR8_A_PLC_FADEOUT_TUNING setup->PlcAdvSetup->longterm_analysis_counter_max = longterm_analysis_counter_max; setup->PlcAdvSetup->longterm_analysis_counter_max_bytebuffer = longterm_analysis_counter_max_bytebuffer; setup->PlcAdvSetup->plc_longterm_advc_tdc = plc_longterm_advc_tdc; setup->PlcAdvSetup->plc_longterm_advc_ns = plc_longterm_advc_ns; -#endif setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot = (CODEC_FS(samplerate) * 16) / 1000; real_fft_init(&(setup->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft), setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_Lprot, &(setup->PlcAdvSetup->PlcPhEcuSetup.handle_fft_phaseecu)); @@ -128,11 +120,6 @@ LC3PLUS_Error FillDecSetup(LC3PLUS_Dec* decoder, int samplerate, int channels, L decoder->hrmode = hrmode != 0; -#ifndef CR8_A_PLC_FADEOUT_TUNING - if (decoder->fs_idx > 4) { - decoder->fs_idx = 5; - } -#endif decoder->channels = channels; decoder->frame_ms = 10; decoder->frame_dms = 100; @@ -164,7 +151,8 @@ LC3PLUS_Error FillDecSetup(LC3PLUS_Dec* decoder, int samplerate, int channels, L void set_dec_frame_params(LC3PLUS_Dec* decoder) { int ch = 0; - + int n; + if (decoder->fs_idx == 5) { decoder->hrmode = 1; @@ -200,7 +188,6 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) decoder->yLen /= 2; decoder->bands_number = bands_number_5ms[decoder->fs_idx]; } -#ifdef CR8_G_ADD_75MS if (decoder->frame_ms == 7.5) { decoder->frame_length = (decoder->frame_length >> 2) * 3; @@ -214,7 +201,6 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) decoder->bands_number = bands_number_7_5ms[decoder->fs_idx]; } } -#endif if (decoder->hrmode) { @@ -261,7 +247,6 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) } decoder->cutoffBins = BW_cutoff_bin_all_5ms; } -#ifdef CR8_G_ADD_75MS else if (decoder->frame_ms == 7.5) { if (decoder->hrmode) @@ -274,7 +259,6 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) } decoder->cutoffBins = BW_cutoff_bin_all_7_5ms; } -#endif decoder->n_bandsPLC = MIN(decoder->frame_length, 80); @@ -300,22 +284,15 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) decoder->n_bandsPLC = 60; } } -#ifdef CR8_G_ADD_75MS else if (decoder->frame_ms == 7.5) { decoder->bands_offsetPLC = ACC_COEFF_PER_BAND_PLC_7_5ms[decoder->fs_idx]; -#ifdef FIX_1082_INSTRUM_FAILED_LC3PLUS - if (decoder->fs != 32000 && decoder->fs != 96000) -#else if (decoder->fs != 32000 && decoder->fs != 96000) - if (decoder->fs != 32000) -#endif - { - decoder->n_bandsPLC = 60; - } + { + decoder->n_bandsPLC = 60; + } } -#endif assert(decoder->bands_offsetPLC); @@ -334,13 +311,11 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) decoder->imdct_laZeros = MDCT_la_zeroes_5ms[decoder->fs_idx]; decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_5ms[decoder->fs_idx]; } -#ifdef CR8_G_ADD_75MS else if (decoder->frame_ms == 7.5) { decoder->imdct_win = MDCT_WINS_7_5ms[decoder->hrmode][decoder->fs_idx]; decoder->imdct_laZeros = MDCT_la_zeroes_7_5ms[decoder->fs_idx]; decoder->imdct_winLen = MDCT_WINDOWS_LENGTHS_7_5ms[decoder->fs_idx]; } -#endif decoder->la_zeroes = decoder->imdct_laZeros; @@ -386,10 +361,8 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) setup->PlcAdvSetup->cum_fading_slow = 1; setup->PlcAdvSetup->cum_fflcAtten = 1; -#ifdef CR8_A_PLC_FADEOUT_TUNING setup->PlcAdvSetup->longterm_analysis_counter_max = plc_fadeout_param_maxlen[(decoder->frame_dms / 25) - 1]; setup->PlcAdvSetup->longterm_analysis_counter_max_bytebuffer = plc_fadeout_param_maxbytes[(decoder->frame_dms / 25) - 1]; -#endif if (decoder->fs_idx <= 4 && decoder->frame_dms == 100) { @@ -423,12 +396,13 @@ void set_dec_frame_params(LC3PLUS_Dec* decoder) } setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_short_flag_prev = 0; /* fullband transient */ setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_num_plocs = 0; -#ifdef CR8_A_PLC_FADEOUT_TUNING setup->PlcAdvSetup->PlcPhEcuSetup.PhECU_nonpure_tone_flag = -1; /* nonpure tone flag, -1==new calc., 0==pure, 1==nonpure */ -#endif } } } + for (n=0; n < LC3_ROUND(PLC_FADEOUT_TYPE_1_IN_MS*10/decoder->frame_dms);n++){ + decoder->alpha_type_2_table[n] = type_2_fadeout(n, decoder->frame_dms); + } } LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) @@ -448,12 +422,10 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) maxBytes = 375; minBytes = MIN_NBYTES; break; -#ifdef CR8_G_ADD_75MS case 75: maxBytes = 625; minBytes = MIN_NBYTES; break; -#endif case 100: maxBytes = 625; minBytes = MIN_NBYTES; @@ -465,7 +437,7 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) else { minBytes = MIN_NBYTES; - maxBytes = MAX_NBYTES_100; // for backward compatibility, MAX_NBYTES_100 is used for all frame lengths + maxBytes = MAX_NBYTES_100; /* for backward compatibility, MAX_NBYTES_100 is used for all frame lengths */ } channel_bytes = nBytes; @@ -498,12 +470,10 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) setup->enable_lpc_weighting = (setup->total_bits < 240); totalBits = setup->total_bits * 2 - 160; } -#ifdef CR8_G_ADD_75MS if (decoder->frame_ms == 7.5) { setup->enable_lpc_weighting = (setup->total_bits < 360); totalBits = round(setup->total_bits * 10 / 7.5); } -#endif if (decoder->frame_length > 40 * ((LC3_FLOAT) (decoder->frame_dms) / 10.0)) { setup->N_red_tns = 40 * ((LC3_FLOAT) (decoder->frame_dms) / 10.0); diff --git a/lib_lc3plus/setup_dec_lc3.h b/lib_lc3plus/setup_dec_lc3.h index 17201a4a93..c3d26ee8eb 100644 --- a/lib_lc3plus/setup_dec_lc3.h +++ b/lib_lc3plus/setup_dec_lc3.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef SETUP_DEC_LC3_FL_H #define SETUP_DEC_LC3_FL_H @@ -51,10 +50,7 @@ typedef struct { LC3_FLOAT x_fl[MAX_LEN]; LC3_FLOAT imdct_mem[MAX_LEN]; LC3_FLOAT alpha; -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH - LC3_FLOAT rel_pitch_change; -#endif - + LC3_FLOAT rel_pitch_change; Dct4 dct4structImdct; PlcSetup PlcSetup; @@ -66,6 +62,7 @@ typedef struct { /* Constants and sampling rate derived values go in this struct */ struct LC3PLUS_Dec { + LC3_FLOAT alpha_type_2_table[PLC_FADEOUT_TYPE_1_IN_MS*10/25]; /* [80] */ DecSetup* channel_setup[MAX_CHANNELS]; const LC3_INT* W_fx; const LC3_INT* bands_offset; diff --git a/lib_lc3plus/setup_enc_lc3.c b/lib_lc3plus/setup_enc_lc3.c index e991c50f46..750a97bb04 100644 --- a/lib_lc3plus/setup_enc_lc3.c +++ b/lib_lc3plus/setup_enc_lc3.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -44,11 +43,9 @@ LC3PLUS_Error FillEncSetup(LC3PLUS_Enc* encoder, int samplerate, int channels encoder->fs_idx = FS2FS_IDX(encoder->fs); encoder->frame_dms = 100; -#ifndef CR8_A_PLC_FADEOUT_TUNING if (encoder->fs_idx > 4) { encoder->fs_idx = 5; } -#endif encoder->hrmode = hrmode != 0; @@ -62,9 +59,12 @@ LC3PLUS_Error FillEncSetup(LC3PLUS_Enc* encoder, int samplerate, int channels encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; encoder->r12k8_mem_out_len = 24; - for (ch = 0; ch < encoder->channels; ch++) + if (lfe_channel_array != NULL) { - encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; + for (ch = 0; ch < encoder->channels; ch++) + { + encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; + } } encoder->bw_ctrl_active = 0; @@ -145,7 +145,6 @@ void set_enc_frame_params(LC3PLUS_Enc* encoder) encoder->attdec_damping = 0.5; encoder->attdec_hangover_thresh = 2; } -#ifdef CR8_G_ADD_75MS else if (encoder->frame_ms == 7.5) { if (encoder->hrmode) { @@ -177,7 +176,6 @@ void set_enc_frame_params(LC3PLUS_Enc* encoder) encoder->near_nyquist_index = encoder->bands_number - 4; encoder->r12k8_mem_out_len = ceil(2.0 * ((LC3_FLOAT) encoder->frame_length / 2.0 - (LC3_FLOAT) encoder->la_zeroes) * 12800.0 / (LC3_FLOAT) encoder->fs - 8.0); } -#endif else if (encoder->frame_ms == 5) { encoder->frame_length = encoder->frame_length >> 1; encoder->yLen /= 2; @@ -228,9 +226,7 @@ void set_enc_frame_params(LC3PLUS_Enc* encoder) setup = encoder->channel_setup[ch]; setup->olpa_mem_pitch = 17; -#ifdef CR9_F_PITCH_WIN_LEN_FIX setup->pitch_flag = 0; -#endif if (setup->mdctStruct.mem != NULL) { mdct_free(&setup->mdctStruct); mdct_init(&setup->mdctStruct, encoder->frame_length, encoder->frame_dms, encoder->fs_idx, encoder->hrmode); @@ -269,14 +265,12 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) else if (encoder->fs == 96000) {minBR = MIN_BR_50MS_96KHZ_HR;} else { return LC3PLUS_HRMODE_ERROR;} break; -#ifdef CR8_G_ADD_75MS case 75: maxBR = 500000; if (encoder->fs == 48000) {minBR = MIN_BR_075DMS_48KHZ_HR;} else if (encoder->fs == 96000) {minBR = MIN_BR_075DMS_96KHZ_HR;} else {return LC3PLUS_HRMODE_ERROR;} break; -#endif case 100: maxBR = 500000; if (encoder->fs == 48000) {minBR = MIN_BR_100MS_48KHZ_HR;} @@ -309,7 +303,6 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) default: break; } break; -#ifdef CR8_G_ADD_75MS case 75: minBR = MIN_BR_075DMS; maxBR = MAX_BR_075DMS; @@ -322,7 +315,6 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) default: break; } break; -#endif case 100: /* have additional limitations for 10ms */ minBR = MIN_BR_100DMS; @@ -443,11 +435,9 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) setup->targetBitsAri = setup->total_bits; setup->enable_lpc_weighting = setup->total_bits < 480; -#ifdef CR8_G_ADD_75MS if (encoder->frame_ms == 7.5) { setup->enable_lpc_weighting = setup->total_bits < 360; } -#endif if (encoder->frame_ms == 5) { setup->enable_lpc_weighting = setup->total_bits < 240; } @@ -493,11 +483,9 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) if (encoder->frame_ms == 5) { bitsTmp = bitsTmp * 2 - 160; } -#ifdef CR8_G_ADD_75MS if (encoder->frame_ms == 7.5) { bitsTmp = round(bitsTmp * 10 / 7.5); } -#endif if (bitsTmp < 400 + (encoder->fs_idx - 1) * 80) { setup->ltpf_enable = 1; @@ -526,14 +514,12 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) encoder->sns_damping = 6881.0/32768.0; } } -#ifdef CR8_G_ADD_75MS if (encoder->frame_ms == 7.5) { if (setup->total_bits > 3*4400/4) { encoder->sns_damping = 5898.0/32768.0; } } -#endif if (encoder->frame_ms == 5) { if (setup->total_bits > 4600/2) { @@ -560,12 +546,10 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) { setup->regBits +=2; } -#ifdef CR8_G_ADD_75MS if (encoder->frame_ms == 7.5) { setup->regBits +=1; } -#endif if (encoder->frame_ms == 2.5) { setup->regBits -= 6; @@ -581,12 +565,10 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc* encoder, int bitrate) { setup->regBits += 0; } -#ifdef CR8_G_ADD_75MS if (encoder->frame_ms == 7.5) { setup->regBits +=2; } -#endif if (encoder->frame_ms == 10) { setup->regBits += 5; @@ -623,11 +605,6 @@ void update_enc_bandwidth(LC3PLUS_Enc* encoder, int bandwidth) { encoder->bandwidth = bandwidth; index = FS2FS_IDX(bandwidth); -#ifndef CR8_A_PLC_FADEOUT_TUNING - if (index > 4) { - index = 5; - } -#endif encoder->bw_ctrl_cutoff_bin = encoder->cutoffBins[index]; } } diff --git a/lib_lc3plus/setup_enc_lc3.h b/lib_lc3plus/setup_enc_lc3.h index e3f62ba556..7947a0e649 100644 --- a/lib_lc3plus/setup_enc_lc3.h +++ b/lib_lc3plus/setup_enc_lc3.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef SETUP_ENC_LC3_FL_H #define SETUP_ENC_LC3_FL_H @@ -24,11 +23,7 @@ typedef struct { LC3_FLOAT attdec_acc_energy; LC3_FLOAT r12k8_mem_50[2]; LC3_FLOAT r12k8_mem_in[120]; -#ifdef CR8_G_ADD_75MS LC3_FLOAT r12k8_mem_out[44]; -#else - LC3_FLOAT r12k8_mem_out[24]; -#endif LC3_FLOAT olpa_mem_s12k8[3]; LC3_FLOAT olpa_mem_s6k4[LEN_6K4 + MAX_PITCH_6K4 + 16]; LC3_FLOAT ltpf_mem_in[LTPF_MEMIN_LEN + LEN_12K8 + 1]; @@ -50,9 +45,7 @@ typedef struct { LC3_INT tns_bits; LC3_INT targetBitsQuant; LC3_INT olpa_mem_pitch; -#ifdef CR9_F_PITCH_WIN_LEN_FIX LC3_INT pitch_flag; -#endif LC3_INT ltpf_mem_ltpf_on; LC3_INT mem_targetBits; LC3_INT mem_specBits; diff --git a/lib_lc3plus/sns_compute_scf.c b/lib_lc3plus/sns_compute_scf.c index 7f78b36667..d81c61c42a 100644 --- a/lib_lc3plus/sns_compute_scf.c +++ b/lib_lc3plus/sns_compute_scf.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/sns_interpolate_scf.c b/lib_lc3plus/sns_interpolate_scf.c index 98b54909b7..15ae55c12a 100644 --- a/lib_lc3plus/sns_interpolate_scf.c +++ b/lib_lc3plus/sns_interpolate_scf.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/sns_quantize_scf.c b/lib_lc3plus/sns_quantize_scf.c index e3fa34d832..96d8cdb4b6 100644 --- a/lib_lc3plus/sns_quantize_scf.c +++ b/lib_lc3plus/sns_quantize_scf.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -507,17 +506,7 @@ void process_snsQuantizesScf_Dec(LC3_INT* scf_idx, LC3_FLOAT* scf_q) /* Gain */ /* Add stage 1 and stage 2 */ -#ifdef CR9_SIMPLIFY_LOOP for (i = 0; i < M; i++) { scf_q[i] += st2_vector_idct[i] * sns_dec_gains[submode][scf_idx[3]]; } -#else - for (i = 0; i < M; i++) { - st2_vector_idct[i] = st2_vector_idct[i] * sns_dec_gains[submode][scf_idx[3]]; - } - - for (i = 0; i < M; i++) { - scf_q[i] = scf_q[i] + st2_vector_idct[i]; - } -#endif } diff --git a/lib_lc3plus/structs.h b/lib_lc3plus/structs.h index 59425744ed..357531c3e8 100644 --- a/lib_lc3plus/structs.h +++ b/lib_lc3plus/structs.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef STRUCTS_H #define STRUCTS_H @@ -157,9 +156,7 @@ typedef struct { LC3_INT32 PhECU_num_plocs; HANDLE_IIS_FFT handle_fft_phaseecu; HANDLE_IIS_FFT handle_ifft_phaseecu; -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT16 PhECU_nonpure_tone_flag; /* BASOP Word16 PhECU_nonpure_tone_flag*/ -#endif } PlcPhEcuSetup; @@ -187,11 +184,7 @@ typedef struct { LC3_FLOAT scf_q_old_old[M]; PlcPhEcuSetup PlcPhEcuSetup; -#ifdef CR8_A_PLC_FADEOUT_TUNING LC3_INT16 longterm_counter_plcTdc; -#ifndef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER - LC3_INT16 longterm_counter_plcPhaseEcu; -#endif LC3_INT16 longterm_counter_plcNsAdv; LC3_INT16 longterm_analysis_counter_max; /* Maximum longterm frames number */ LC3_INT16 longterm_analysis_counter_max_bytebuffer; /* Same as above but reduced for circular bit-buffer */ @@ -202,7 +195,6 @@ typedef struct { LC3_INT16 overall_counter; LC3_INT8 longterm_counter_byte_position; LC3_INT8 longterm_counter_bit_position; -#endif } PlcAdvSetup; #endif diff --git a/lib_lc3plus/tns_coder.c b/lib_lc3plus/tns_coder.c index 6870ba1e14..9e3c3f6f20 100644 --- a/lib_lc3plus/tns_coder.c +++ b/lib_lc3plus/tns_coder.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" @@ -193,12 +192,10 @@ void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, L maxOrder = 4; nSubdivisions = 2.0; break; -#ifdef CR8_G_ADD_75MS case 75: maxOrder = 8; nSubdivisions = 3; break; -#endif case 100: maxOrder = 8; nSubdivisions = 3.0; @@ -235,7 +232,6 @@ void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, L subdiv_startfreq = floor(subdiv_len * (sub - 1)) + startfreq[f] - 1; subdiv_stopfreq = floor(subdiv_len * sub) + startfreq[f] - 1; -#ifdef CR8_G_ADD_75MS if (fs == 32000 && frame_dms == 75) { if (subdiv_startfreq == 83) @@ -258,7 +254,6 @@ void processTnsCoder_fl(LC3_FLOAT* x, LC3_INT bw_cutoff_idx, LC3_INT bw_fcbin, L subdiv_stopfreq = 159; } } -#endif sum = 0; for (i = subdiv_startfreq; i < subdiv_stopfreq; i++) { diff --git a/lib_lc3plus/tns_decoder.c b/lib_lc3plus/tns_decoder.c index dbdadaeaff..05f8036fc4 100644 --- a/lib_lc3plus/tns_decoder.c +++ b/lib_lc3plus/tns_decoder.c @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #include "options.h" #include "wmc_auto.h" diff --git a/lib_lc3plus/util.h b/lib_lc3plus/util.h index 069e893714..410b7db44b 100644 --- a/lib_lc3plus/util.h +++ b/lib_lc3plus/util.h @@ -1,12 +1,11 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.3 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * * estoppel or otherwise. * ******************************************************************************/ - #ifndef UTIL_H #define UTIL_H diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index f914815f02..ea2a893d19 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -2,39 +2,64 @@ # This script shall only be used by automated continuous integration systems -scriptdir=$(dirname "$0") -pushd "$scriptdir" || exit 1 +printf "Cleaning old version of LC3plus\n" +rm -rf lib_lc3plus -# Download and unzip LC3plus code -rm -rf ETSI_Release -curl -o ./lc3plus_sources.zip https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.04.01_60/ts_103634v010401p0.zip -unzip lc3plus_sources.zip -d . - -# Modify LC3plus code to be compatible with IVAS tools (e.g. WMC tool) -git apply --ignore-whitespace lc3plus.patch -sed -i 's/ \({\) \(mdct_apply(.*);\) /\n\1\n \2\n/' ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft.c -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/codec_exe.c +printf "Downloading LC3plus code\n" +if false; then + # Waiting for official ETSI release. + # TODO: add new URL, remove `if false` when package goes public + curl -o ./lc3plus_sources.zip NEW_URL_HERE + unzip lc3plus_sources.zip -d . + rm lc3plus_sources.zip + cp -r "ETSI_Release//src/floating_point" lib_lc3plus + rm -r ETSI_Release +else + # Temp solution for downloading WIP ETSI package + # LC3_ETSI_REPO_URL must be define before running the script + git clone "$LC3_ETSI_REPO_URL" + cp -r lc3_etsi_release/src/floating_point lib_lc3plus + rm -rf lc3_etsi_release +fi # Remove unneeded files -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/makefile -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywaveout_c.h -rm ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c -rm -r ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc +printf "Removing unneeded files\n" +rm lib_lc3plus/codec_exe.c # Only used for executable +rm lib_lc3plus/makefile # Build handled at IVAS level +rm -r lib_lc3plus/msvc # Build handled at IVAS level +rm lib_lc3plus/plc_noise_substitution0.c # Empty file +rm lib_lc3plus/tinywavein_c.h # Only used for executable +rm lib_lc3plus/tinywaveout_c.h # Only used for executable # Limit file permissions -find ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point -type f -exec chmod -x {} \; - -# Move to output dir -rm -rf ../../lib_lc3plus -mkdir ../../lib_lc3plus -mv ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/* ../../lib_lc3plus +printf "Limiting file permissions\n" +find lib_lc3plus -type f -print0 | \ +xargs -0 -I {} \ +chmod -x {} -# Create additional files -printf "DisableFormat: true\nSortIncludes: Never\n" > ../../lib_lc3plus/.clang-format +# include options.h in all C files +printf "Including options.h and wmc_auto.h in C files\n" +find lib_lc3plus -name '*.[ch]' -type f -print0 | \ +xargs -0 -I {} \ +sed -i ' +# range: from 1st line to first match +1,/^#include/ { + # insert lines before first match + /^#include/ i\ +#include "options.h"\ +#include "wmc_auto.h" +} +' {} -# Clean up -rm -rf lc3plus_sources.zip ETSI_Release +# Remove whitespace from preprocessor commands +printf "Removing whitespace from preprocessor commands\n" +find lib_lc3plus -name '*.[ch]' -type f -print0 | \ +xargs -0 -I {} \ +sed -i 's/^#[[:space:]]\+/#/' {} -popd || exit +# Add .clang-format file to lib_lc3plus to disable formatting there +printf "Disabling clang-format in lib_lc3plus directory\n" +printf ' +DisableFormat: true +SortIncludes: Never +' >> lib_lc3plus/.clang-format diff --git a/scripts/lc3plus_lib_setup/lc3plus.patch b/scripts/lc3plus_lib_setup/lc3plus.patch deleted file mode 100644 index 14b81a3972..0000000000 --- a/scripts/lc3plus_lib_setup/lc3plus.patch +++ /dev/null @@ -1,1474 +0,0 @@ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/adjust_global_gain.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processAdjustGlobalGain_fl(LC3_INT* gg_idx, LC3_INT gg_idx_min, LC3_INT gg_idx_off, LC3_FLOAT* gain, LC3_INT target, LC3_INT nBits, LC3_INT* gainChange, LC3_INT fs_idx -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/al_fec_fl.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "stdint.h" - #include - #include -@@ -1010,8 +1011,8 @@ - LC3_UINT8 blacklist[FEC_N_MODES]; - LC3_INT32 rop; - -- rop = 0; - void (*syndr_calc[3])(LC3_UINT8 *, LC3_UINT8 *, LC3_INT32); -+ rop = 0; - - /* initialization */ - blacklist[0] = 0; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/apply_global_gain.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processApplyGlobalGain_fl(LC3_FLOAT x[], LC3_INT xLen, LC3_INT global_gain_idx, LC3_INT global_gain_off) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ari_codec.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void ac_shift_fl(Encoder_State_fl* st); -@@ -620,7 +621,7 @@ - - if (st.pc_c_bp_side != 0) - { -- nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOG2(mask_side)); -+ nbits_side = total_bits - 8 * (st.pc_b_left) + 8 * (st.pc_bytes - bp_side) - (8 - LC3_LOGTWO(mask_side)); - } - } - -@@ -891,7 +892,7 @@ - { - LC3_INT bits = 0, mask = 0, val = 0, over1 = 0, high = 0, over2 = 0, c = 0, b = 0; - -- bits = 24 - floor(LC3_LOG2(st->range)); -+ bits = 24 - floor(LC3_LOGTWO(st->range)); - mask = ((LC3_INT)pow(2, 24) - 1) >> bits; - val = st->low + mask; - over1 = val >> 24; -@@ -1078,8 +1079,8 @@ - } - - /* Residual bits */ -- nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOG2(*(st.mask_side))); -- nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOG2(st.range)); -+ nbits_side = total_bits - (8 * (*(st.bp_side) + 1) + 8 - LC3_LOGTWO(*(st.mask_side))); -+ nbits_ari = (st.bp + 1) * 8 + 25 - floor(LC3_LOGTWO(st.range)); - - if (st.cache >= 0) { - nbits_ari = nbits_ari + 8; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/attack_detector.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void attack_detector_fl(LC3_FLOAT* in, LC3_INT frame_size, LC3_INT fs, LC3_INT* lastAttackPosition, LC3_FLOAT* accNrg, LC3_INT* attackFlag, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/constants.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - /* DCT */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/cutoff_bandwidth.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void process_cutoff_bandwidth(LC3_FLOAT *d_fl, LC3_INT len, LC3_INT bw_bin) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dct4.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void dct2_init(Dct2* dct, int length) -@@ -27,11 +28,11 @@ - - void dct2_apply(Dct2* dct, const LC3_FLOAT* input, LC3_FLOAT* output) - { -- assert(input != output); - Complex tmp1[MAX_LEN]; - Complex tmp2[MAX_LEN]; - int i = 0; - const int len = dct->length; -+ assert(input != output); - - for (i = 0; i < len / 2; i++) { - tmp1[i] = cmplx(input[i * 2], 0); -@@ -49,8 +50,8 @@ - - void dct4_init(Dct4* dct, int length) - { -- assert(length <= MAX_LEN); - int i = 0; -+ assert(length <= MAX_LEN); - dct->length = length; - dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); - dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); -@@ -73,12 +74,12 @@ - - void dct4_apply(Dct4* dct, const LC3_FLOAT* input, LC3_FLOAT* output) - { -- assert(input != output); - Complex tmp2[MAX_LEN / 2]; - int i = 0; - Complex* tmp1 = (Complex*)output; - const int len = dct->length; - const LC3_FLOAT norm = (LC3_FLOAT)1.0 / LC3_SQRT((LC3_FLOAT)(len >> 1)); -+ assert(input != output); - - for (i = 0; i < len / 2; i++) { - tmp1[i] = cmul(cmplx(input[i * 2], input[len - i * 2 - 1]), dct->twid1[i]); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_entropy.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void read_bit_fl(LC3_UINT8* ptr, LC3_INT* mask_side, LC3_INT* bp_side, LC3_INT* bit); -@@ -53,7 +54,7 @@ - LC3_INT nbbytes = nbbits >> 3; - LC3_INT lastnz; - LC3_INT bw_cutoff_idx; -- LC3_INT nbits = ceil(LC3_LOG2(L_spec / 2)); -+ LC3_INT nbits = ceil(LC3_LOGTWO(L_spec / 2)); - - if (nbits > nbbits) - { -@@ -173,7 +174,7 @@ - } - - /* Last non-zero tuple */ -- read_uint_fl(ceil(LC3_LOG2(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz); -+ read_uint_fl(ceil(LC3_LOGTWO(N / 2)), ptr, &mask_side_local, &bp_side_local, lastnz); - *lastnz = (*lastnz + 1) * 2; - - if (*lastnz > N) { -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/dec_lc3_fl.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -@@ -53,8 +54,8 @@ - - if (decoder->rframe == 1 && zero_frame == 0 && bfi != 1) - { -- bfi = 2; - LC3_INT32 max_bw_stopband = BW_cutoff_bin_all[bw_cutoff_idx]; -+ bfi = 2; - switch (decoder->frame_dms) - { - # ifdef ENABLE_025_DMS_MODE -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/defines.h 2023-06-29 12:58:27 -@@ -24,13 +24,13 @@ - typedef uint32_t LC3_UINT32; - - /* Release defines */ --#define ENABLE_2_5MS_MODE -+// #define ENABLE_2_5MS_MODE - #define ENABLE_5MS_MODE - #define ENABLE_10_MS_MODE - #define ENABLE_ADVANCED_PLC_FL - #define ENABLE_ADVANCED_PLC_FL_DEFAULT - #define ENABLE_BW_CONTROLLER --#define ENABLE_HR_MODE_FL -+//#define ENABLE_HR_MODE_FL - #define ENABLE_PADDING - #define ENABLE_RFRAME_FL - #define ENABLE_PLC -@@ -49,8 +49,8 @@ - /* Precision Defines */ - #define LC3_FABS(x) (fabsf(x)) - #define LC3_POW(x, y) (powf(x, y)) --#define LC3_LOG10(x) (log10f(x)) --#define LC3_LOG2(x) (log2f(x)) -+#define LC3_LOGTEN(x) (log10f(x)) -+#define LC3_LOGTWO(x) (log2f(x)) - # define LC3_COS(x) (cos(x)) - # define LC3_SIN(x) (sin(x)) - #define LC3_SQRT(x) (sqrtf(x)) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/detect_cutoff_warped.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processDetectCutoffWarped_fl(LC3_FLOAT* d2, LC3_INT fs_idx, LC3_INT frame_dms, LC3_INT* bw_idx) -@@ -68,7 +69,7 @@ - dist = bw_dist[counter]; - - for (i = stop; i >= stop - dist; i--) { -- e_diff = 10.0 * LC3_LOG10(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOG10(d2[i + 1] + FLT_EPSILON); -+ e_diff = 10.0 * LC3_LOGTEN(d2[i - dist + 1] + FLT_EPSILON) - 10.0 * LC3_LOGTEN(d2[i + 1] + FLT_EPSILON); - - if (e_diff > thr) { - brickwall = 1; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_entropy.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processEncoderEntropy_fl(LC3_UINT8* bytes, LC3_INT* bp_side, LC3_INT* mask_side, LC3_INT numbytes, LC3_INT bw_cutoff_bits, -@@ -33,11 +34,11 @@ - - /* Last non zero touple */ - if (bfi_ext == 1) { -- write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOG2(N >> 1))); -+ write_uint_backward_fl(ptr, bp_side, mask_side, lastnzTrigger[fs_idx], ceil(LC3_LOGTWO(N >> 1))); - } - else - { -- write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOG2(N / 2))); -+ write_uint_backward_fl(ptr, bp_side, mask_side, lastnz / 2 - 1, ceil(LC3_LOGTWO(N / 2))); - } - - /* LSB mode bit */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/enc_lc3_fl.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void Enc_LC3PLUS_Channel_fl(LC3PLUS_Enc* encoder, int channel, int32_t* s_in, uint8_t* bytes, int bps -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/estimate_global_gain.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -@@ -60,8 +61,8 @@ - } else { - g_min = x_max / (32767 - 0.375); - } -- /* Prevent positive rounding errors from LC3_LOG10 function */ -- ind_min = 28.0 * LC3_LOG10(g_min); -+ /* Prevent positive rounding errors from LC3_LOGTEN function */ -+ ind_min = 28.0 * LC3_LOGTEN(g_min); - - ind_min = ceil(ind_min + LC3_FABS(ind_min) * LC3_EPS); - -@@ -76,7 +77,7 @@ - tmp += x[i + 1] * x[i + 1]; - tmp += x[i + 2] * x[i + 2]; - tmp += x[i + 3] * x[i + 3]; -- en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOG10(tmp + reg_val)); -+ en[j] = (28.0 / 20.0) * (7 + 10.0 * LC3_LOGTEN(tmp + reg_val)); - j++; - } - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/cfft.c 2023-06-29 12:58:27 -@@ -8,7 +8,7 @@ - ******************************************************************************/ - - -- -+#include "options.h" - #include "cfft.h" - #include "iisfft.h" /* for M_PIl */ - #include /* for abs() */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.c 2023-06-29 12:58:27 -@@ -8,14 +8,15 @@ - ******************************************************************************/ - - -+#include "options.h" - #include - #include --#include "iis_fft.h" - #include - #include - #include --#include "../structs.h" -+#include - -+#include "iis_fft.h" - /**************************************************************************************************/ - - /* AFFT uses two fft implementations -@@ -24,9 +25,6 @@ - fast lengths, check the fft_n function. - */ - --#include --#include "cfft.h" --#include "iisfft.h" - - #define FFT_COMPLEX 1 - #define FFT_REAL 2 -@@ -122,12 +120,13 @@ - - IIS_FFT_ERROR LC3_IIS_FFT_Apply_CFFT(HANDLE_IIS_FFT handle, const Complex* input, Complex* output) - { -+ LC3_FLOAT* dummy; - if (!handle) - return IIS_FFT_INTERNAL_ERROR; - - /* check for inplace operation */ - memmove(output, input, sizeof(*input) * handle->len); -- LC3_FLOAT* dummy = (LC3_FLOAT*)output; -+ dummy = (LC3_FLOAT*)output; - if (handle->cfft.len > 0) { - LC3_cfft_apply(&handle->cfft, dummy, dummy + 1, 2); - } else { -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iis_fft.h 2023-06-29 12:58:27 -@@ -12,6 +12,7 @@ - #define IIS_FFT_H - - #include "../structs.h" -+#include "../defines.h" - #include "cfft.h" - - #ifdef __cplusplus -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - - #include - #include /* for mmove */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/fft/iisfft.h 2023-06-29 12:58:27 -@@ -11,6 +11,7 @@ - #ifndef IISFFT_H - #define IISFFT_H - -+#include "../defines.h" - - #ifndef M_PIl - #define M_PIl 3.1415926535897932384626433832795029L /* pi */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/imdct.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - /* Function expects already flipped window */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "lc3.h" - #include "defines.h" - #include "functions.h" -@@ -48,8 +49,9 @@ - case 44100: return 1; - case 48000: return 1; - case 96000: return 1; -- default: return 0; -+ default: break; - } -+ return 0; - } - - static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) -@@ -58,8 +60,9 @@ - { - case LC3PLUS_PLC_ADVANCED: /* fallthru */ - return 1; -- default: return 0; -+ default: break; - } -+ return 0; - } - - static int lc3plus_frame_size_supported(float frame_ms) -@@ -69,8 +72,9 @@ - case 25: /* fallthru */ - case 50: /* fallthru */ - case 100: return 1; -- default: return 0; -+ default: break; - } -+ return 0; - } - - static int null_in_list(void **list, int n) -@@ -97,13 +101,14 @@ - /* encoder functions *********************************************************/ - LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channels, int hrmode, int32_t lfe_channel_array[]) - { -+ int ch = 0; -+ - RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); - RETURN_IF((uintptr_t)encoder % 4 != 0, LC3PLUS_ALIGN_ERROR); - RETURN_IF(!lc3plus_samplerate_supported(samplerate), LC3PLUS_SAMPLERATE_ERROR); - RETURN_IF(!lc3plus_channels_supported(channels), LC3PLUS_CHANNELS_ERROR); - RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); - -- int ch = 0; - for (ch = 0; ch < channels; ch++) - { - RETURN_IF(!lc3_enc_supported_lfe() && lfe_channel_array[ch], LC3PLUS_LFE_MODE_NOT_SUPPORTED); -@@ -142,6 +147,7 @@ - int lc3plus_enc_get_real_bitrate(const LC3PLUS_Enc *encoder) - { - int ch = 0, totalBytes = 0; -+ int bitrate; - RETURN_IF(encoder == NULL, 0); - RETURN_IF(!encoder->lc3_br_set, LC3PLUS_BITRATE_UNSET_ERROR); - -@@ -150,7 +156,7 @@ - totalBytes += encoder->channel_setup[ch]->targetBytes; - } - -- int bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms; -+ bitrate = (totalBytes * 80000.0 + encoder->frame_dms - 1) / encoder->frame_dms; - - if (encoder->fs_in == 44100) - { -@@ -191,11 +197,13 @@ - - LC3PLUS_Error lc3plus_enc_set_bandwidth(LC3PLUS_Enc *encoder, int bandwidth) - { -+ LC3_INT effective_fs; -+ - RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); - #ifdef ENABLE_HR_MODE_FL_FLAG - RETURN_IF(encoder->hrmode == 1, LC3PLUS_HRMODE_BW_ERROR); - #endif -- LC3_INT effective_fs = encoder->fs_in; -+ effective_fs = encoder->fs_in; - if (encoder->bandwidth != bandwidth) { - if (encoder->fs_in > 40000) { - effective_fs = 40000; -@@ -338,9 +346,9 @@ - - LC3PLUS_Error lc3plus_free_encoder_structs(LC3PLUS_Enc* encoder) - { -+ int ch = 0; - RETURN_IF(!encoder, LC3PLUS_NULL_ERROR); - -- int ch = 0; - for (ch = 0; ch < encoder->channels; ch++) { - mdct_free(&encoder->channel_setup[ch]->mdctStruct); - dct2_free(&encoder->channel_setup[ch]->dct2StructSNS); -@@ -351,9 +359,9 @@ - - LC3PLUS_Error lc3plus_free_decoder_structs(LC3PLUS_Dec* decoder) - { -+ int ch = 0; - RETURN_IF(!decoder, LC3PLUS_NULL_ERROR); - -- int ch = 0; - for (ch = 0; ch < decoder->channels; ch++) { - dct4_free(&decoder->channel_setup[ch]->dct4structImdct); - real_fft_free(&decoder->channel_setup[ch]->PlcAdvSetup->PlcPhEcuSetup.PhEcu_Fft); -@@ -378,11 +386,14 @@ - - LC3PLUS_Error lc3plus_enc_set_ep_mode(LC3PLUS_Enc *encoder, LC3PLUS_EpMode epmode) - { -+ LC3PLUS_EpMode oldEpmode; -+ LC3PLUS_Error error; -+ - RETURN_IF(encoder == NULL, LC3PLUS_NULL_ERROR); - RETURN_IF((unsigned)epmode > LC3PLUS_EP_HIGH, LC3PLUS_EPMODE_ERROR); -- LC3PLUS_EpMode oldEpmode = encoder->epmode; -+ oldEpmode = encoder->epmode; - encoder->epmode = epmode; -- LC3PLUS_Error error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK; -+ error = encoder->lc3_br_set ? update_enc_bitrate(encoder, encoder->bitrate) : LC3PLUS_OK; - if (error != LC3PLUS_OK) - { - encoder->epmode = oldEpmode; // preserve old epmode in case of failure -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/lc3plus_fft.c 2023-06-29 12:58:27 -@@ -0,0 +1,99 @@ -+/****************************************************************************** -+* ETSI TS 103 634 V1.4.1 * -+* Low Complexity Communication Codec Plus (LC3plus) * -+* * -+* Copyright licence is solely granted through ETSI Intellectual Property * -+* Rights Policy, 3rd April 2019. No patent licence is granted by implication, * -+* estoppel or otherwise. * -+******************************************************************************/ -+ -+ -+#include "options.h" -+#include "functions.h" -+#include "fft/iis_fft.c" -+#include "fft/iisfft.c" -+#include "fft/cfft.c" -+ -+void fft_init(Fft* fft, int length) -+{ -+ HANDLE_IIS_FFT handle = NULL; -+ IIS_FFT_ERROR error = 0; -+ assert(length % 2 == 0); -+ -+ fft->length = length; -+ -+ error = LC3_IIS_CFFT_Create(&handle, length, IIS_FFT_FWD); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ fft->handle = handle; -+} -+ -+void fft_free(Fft* fft) -+{ -+ IIS_FFT_ERROR error = 0; -+ -+ if (fft) { -+ error = LC3_IIS_CFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ memset(fft, 0, sizeof(*fft)); -+ } -+} -+ -+void real_fft_free(Fft* fft) -+{ -+ IIS_FFT_ERROR error = 0; -+ -+ if (fft) { -+ error = LC3_IIS_RFFT_Destroy((HANDLE_IIS_FFT *) &fft->handle); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ memset(fft, 0, sizeof(*fft)); -+ } -+} -+ -+void real_fft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) -+{ -+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -+ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ -+ -+ fft->length = length; -+ -+ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_FWD); -+ assert(error == IIS_FFT_NO_ERROR); -+ fft->handle = *handle; -+} -+ -+ -+void real_ifft_init(Fft* fft, LC3_INT32 length, HANDLE_IIS_FFT *handle) -+{ -+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -+ assert(length % 4 == 0); /* due to current limitation of core complex FFTs*/ -+ -+ fft->length = length; -+ -+ error = LC3_IIS_RFFT_Create(handle, length, IIS_FFT_BWD); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+ fft->handle = *handle; -+} -+ -+void fft_apply(Fft* fft, const Complex* input, Complex* output) -+{ -+ IIS_FFT_ERROR error = 0; -+ error = LC3_IIS_FFT_Apply_CFFT(fft->handle, input, output); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+} -+ -+ -+void real_fft_apply(Fft* fft, const LC3_FLOAT* input, LC3_FLOAT* output) -+{ -+ IIS_FFT_ERROR error = IIS_FFT_NO_ERROR; -+ -+ UNUSED(error); -+ -+ error = LC3_IIS_FFT_Apply_RFFT(fft->handle, input, output); -+ -+ assert(error == IIS_FFT_NO_ERROR); -+} -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_coder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static LC3_INT searchMaxIndice(LC3_FLOAT* in, LC3_INT len); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/ltpf_decoder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void process_ltpf_decoder_fl(LC3_FLOAT* x, LC3_INT xLen, LC3_FLOAT* y, LC3_INT fs, LC3_FLOAT* mem_old_x, LC3_FLOAT* mem_old_y, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static const LC3_FLOAT* mdct_window(LC3_INT length, LC3_INT frame_dms, LC3_INT hrmode) -@@ -104,6 +105,7 @@ - { - LC3_FLOAT tmp[MAX_LEN * 2] = {0}; - LC3_INT i = 0; -+ LC3_INT hlen; - - move_float(tmp, mdct->mem, mdct->mem_length); - move_float(tmp + mdct->mem_length, input, mdct->length); -@@ -112,7 +114,7 @@ - - mult_vec(tmp, mdct->window, mdct->length * 2); - -- LC3_INT hlen = mdct->length / 2; -+ hlen = mdct->length / 2; - for (i = 0; i < hlen; i++) { - output[i] = -tmp[hlen * 3 - i - 1] - tmp[hlen * 3 + i]; - output[hlen + i] = tmp[i] - tmp[hlen * 2 - i - 1]; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/mdct_shaping.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processMdctShaping_fl(LC3_FLOAT x[], LC3_FLOAT scf[], const LC3_INT bands_offset[], LC3_INT fdns_npts) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 1970-01-01 01:00:00 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/msvc/.gitignore 2023-06-29 12:58:27 -@@ -0,0 +1 @@ -+Win32/ -\ No newline at end of file -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/near_nyquist_detector.c 2023-06-29 12:58:35 -@@ -8,15 +8,16 @@ - ******************************************************************************/ - - #include "functions.h" -+#include "options.h" - - - void processNearNyquistdetector_fl(LC3_INT16* near_nyquist_flag, const LC3_INT fs_idx, const LC3_INT near_nyquist_index, - const LC3_INT bands_number, const LC3_FLOAT* ener) - { - *near_nyquist_flag = 0; -- -+ - if (fs_idx < 4) -- { -+ { - LC3_INT i = 0; - LC3_FLOAT ener_low = FLT_EPSILON, ener_high = 0; - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_factor.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processNoiseFactor_fl(LC3_INT* fac_ns_idx, LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gg, LC3_INT BW_cutoff_idx, LC3_INT frame_dms, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/noise_filling.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processNoiseFilling_fl(LC3_FLOAT xq[], LC3_INT nfseed, LC3_INT fac_ns_idx, LC3_INT bw_stopband, LC3_INT frame_dms, LC3_FLOAT fac_ns_pc, LC3_INT spec_inv_idx) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/olpa.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void filter_olpa(LC3_FLOAT* in, LC3_FLOAT* out, const LC3_FLOAT* buf, LC3_FLOAT len_buf, LC3_INT len_input); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_apply.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_classify.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_main.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/pc_update.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/per_band_energy.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processPerBandEnergy_fl(LC3_INT bands_number, const LC3_INT* acc_coeff_per_band, LC3_INT16 hrmode, LC3_INT16 frame_dms, LC3_FLOAT* d2, LC3_FLOAT* d) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_classify.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_compute_stab_fac.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_damping_scrambling.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_main.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processPlcMain_fl(LC3_FLOAT *q_d_fl_c, LC3_FLOAT *syntM_fl_c, LC3PLUS_Dec* decoder, DecSetup* h_DecSetup, LC3_INT bfi, -@@ -56,6 +57,8 @@ - { - case 2: - { -+ LC3_FLOAT pitch_fl_c; -+ - assert(decoder->fs_idx == floor(decoder->fs / 10000)); - // phaseECU supports only 10ms framing - assert(PlcSetup->nbLostCmpt != 0 || decoder->frame_dms == 100); -@@ -69,7 +72,7 @@ - } - - /* call phaseEcu */ -- LC3_FLOAT pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */ -+ pitch_fl_c = (LC3_FLOAT)ltpf_pitch_int + (LC3_FLOAT)ltpf_pitch_fr / 4.0; /* use non-rounded pitch indeces */ - - - if (prev_bfi_plc2 == 0) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_noise_substitution0.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_f0_refine_first.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_fec_hq.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_hq_ecu.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_lf_peak_analysis.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_rec_frame.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_setf0hz.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_spec_ana.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -@@ -135,13 +136,13 @@ - - if (max_xfp_abs >= 0.5) - { -- PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOG2(32768 / 2 / 2 / max_xfp_abs)); -+ PLC2_Q_flt = (LC3_FLOAT)LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / max_xfp_abs)); - Q_scale_flt = LC3_POW(2.0, PLC2_Q_flt) / fx_fft_scale / fft_fs_scale; /* basop way using xfp scale */ - - /* C-Float additional safety limit/verification of the integer xfp based scaling using the available C-float Xabs max value inp_high as well */ - { - LC3_FLOAT tmp_scale; -- tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOG2(32768 / 2 / 2 / inp_high))); -+ tmp_scale = LC3_POW(2.0, LC3_FLOOR(LC3_LOGTWO(32768 / 2 / 2 / inp_high))); - if (Q_scale_flt > tmp_scale) { - Q_scale_flt = tmp_scale; - } -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_subst_spec.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - #include "constants.h" -@@ -30,6 +31,7 @@ - LC3_INT32 segmentLen, e; - LC3_FLOAT Xph; - LC3_FLOAT seed_local; -+ LC3_INT32 binCounter, subInd; - - UNUSED(corr_phase_dbg); - UNUSED(X_i_new_re_dbg); -@@ -49,8 +51,8 @@ - - - // EVOLVE PHASE ----------------- -- LC3_INT32 binCounter = 1; -- LC3_INT32 subInd = 0; -+ binCounter = 1; -+ subInd = 0; - - one_peak_flag_mask = -1; - if (n_plocs < 3 && n_plocs > 0) { -@@ -219,9 +221,10 @@ - } - - static LC3_INT32 own_rand(LC3_INT32 seed) { -- assert(seed <= 32767 && seed >= -32768); -- LC3_INT32 retSeed = (13849 + (seed + 32768) * 31821) & 65535; -- retSeed -= 32768; -+ LC3_INT32 retSeed; -+ assert(seed <= 32767 && seed >= -32768); -+ retSeed = (13849 + (seed + 32768) * 31821) & 65535; -+ retSeed -= 32768; - assert(retSeed <= 32767 && retSeed >= -32768); - return retSeed; - } -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_per_band_gain.c 2023-06-29 12:58:35 -@@ -6,13 +6,14 @@ - * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * - * estoppel or otherwise. * - ******************************************************************************/ -- - -+ -+#include "options.h" - #include "defines.h" - #include "functions.h" - - --void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) -+void plc_phEcu_tba_per_band_gain(LC3_INT32 n_grp, LC3_FLOAT *gr_pow_left, LC3_FLOAT *gr_pow_right, LC3_FLOAT *trans, LC3_FLOAT *grp_pow_change) - { - LC3_INT32 i; - -@@ -34,10 +35,10 @@ - trans[i] = 1.0; /* 0/0 no transient , no power change */ - } - } -- grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOG10(trans[i]); -+ grp_pow_change[i] = (LC3_FLOAT) 10.0 * LC3_LOGTEN(trans[i]); - - } - -- return; -+ return; - } - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_spect_Xavg.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_tba_trans_dect_gains.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "defines.h" - #include "functions.h" - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_phecu_trans_burst_ana_sub.c 2023-06-29 12:58:35 -@@ -6,16 +6,17 @@ - * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * - * estoppel or otherwise. * - ******************************************************************************/ -- - -+ -+#include "options.h" - #include "defines.h" - #include "functions.h" - - --void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, -- LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, -+void plc_phEcu_trans_burst_ana_sub(LC3_INT32 fs_idx, LC3_INT32 burst_len, LC3_INT32 n_grp, LC3_FLOAT *oold_spect_shape, -+ LC3_FLOAT *oold_EwPtr, LC3_FLOAT *old_spect_shape, - LC3_FLOAT *old_EwPtr, LC3_FLOAT *stPhECU_beta_mute, -- LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg) -+ LC3_FLOAT *stPhECU_mag_chg_1st, LC3_FLOAT *stPhECU_Xavg, LC3_FLOAT *alpha, LC3_FLOAT *beta, LC3_FLOAT *mag_chg, LC3_INT32 *tr_dec_dbg, LC3_FLOAT *gpc_dbg) - { - LC3_FLOAT gr_pow_left[MAX_LGW]; - LC3_FLOAT gr_pow_right[MAX_LGW]; -@@ -27,7 +28,7 @@ - - LC3_INT32 attDegreeFrames; - LC3_FLOAT thresh_dbg; -- -+ - UNUSED(tr_dec_dbg); - UNUSED(gpc_dbg); - -@@ -39,7 +40,7 @@ - - } - -- -+ - plc_phEcu_tba_trans_dect_gains(burst_len, n_grp, grp_pow_change, stPhECU_beta_mute, stPhECU_mag_chg_1st, alpha, beta, mag_chg, ph_dith, tr_dec, att_val, &attDegreeFrames, &thresh_dbg); - - return; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - /***************************************************************************\ - * contents/description: Main function for Time domain concealment - \***************************************************************************/ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_tdc_tdac.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/plc_update.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - #include "functions.h" -+#include "options.h" - - - void processPlcUpdate_fl(PlcAdvSetup *PlcAdvSetup, LC3_INT32 frame_length, LC3_FLOAT *syntM, LC3_FLOAT *scf_q, -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/quantize_spec.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static LC3_INT sign(LC3_FLOAT x); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/reorder_bitstream.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/resamp12k8.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void process_resamp12k8_fl(LC3_FLOAT x[], LC3_INT x_len, LC3_FLOAT mem_in[], LC3_INT mem_in_len, LC3_FLOAT mem_50[], LC3_FLOAT mem_out[], -@@ -17,6 +18,8 @@ - - LC3_INT len_12k8 = 0, N12k8 = 0, i = 0, k = 0; - LC3_FLOAT mac = 0, buf_out[120 + MAX_LEN] = {0}, bufdown[128] = {0}, buf[120 + MAX_LEN] = {0}; -+ LC3_INT32 index_int, index_frac, resamp_upfac, resamp_delay, resamp_off_int, resamp_off_frac; -+ LC3_FLOAT u_11, u_21, u_1, u_2; - - const LC3_FLOAT *filter; - const LC3_FLOAT *filt_input, *filt_coeff; -@@ -49,12 +52,12 @@ - - /* Upsampling & Low-pass Filtering & Downsampling */ - -- LC3_INT32 index_int = 1; -- LC3_INT32 index_frac = 0; -- LC3_INT32 resamp_upfac = resamp_params[fs_idx][0]; -- LC3_INT32 resamp_delay = resamp_params[fs_idx][1]; -- LC3_INT32 resamp_off_int = resamp_params[fs_idx][2]; -- LC3_INT32 resamp_off_frac = resamp_params[fs_idx][3]; -+ index_int = 1; -+ index_frac = 0; -+ resamp_upfac = resamp_params[fs_idx][0]; -+ resamp_delay = resamp_params[fs_idx][1]; -+ resamp_off_int = resamp_params[fs_idx][2]; -+ resamp_off_frac = resamp_params[fs_idx][3]; - - k = 0; - for (i = 0; i < N12k8; i++) { -@@ -78,9 +81,8 @@ - - - /* 50Hz High-Pass */ -- LC3_FLOAT u_11 = mem_50[0]; -- LC3_FLOAT u_21 = mem_50[1]; -- LC3_FLOAT u_1, u_2; -+ u_11 = mem_50[0]; -+ u_21 = mem_50[1]; - - for (i = 0; i < len_12k8; i++) { - LC3_FLOAT y1 = (highpass50_filt_b[0] * bufdown[i] + u_11); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_coding.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processResidualCoding_fl(LC3_FLOAT x[], LC3_INT xq[], LC3_FLOAT gain, LC3_INT L_spec, LC3_INT targetBits, LC3_INT nBits, uint8_t* resBits, LC3_INT* numResBits -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/residual_decoding.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processResidualDecoding_fl(LC3_INT* bitsRead, LC3_FLOAT x[], LC3_INT L_spec, uint8_t prm[], LC3_INT resQBits -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_com_lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - #include "functions.h" -+#include "options.h" - - LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len) - { -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_dec_lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "setup_dec_lc3.h" - #include "functions.h" - #include -@@ -32,6 +33,7 @@ - LC3_FLOAT *sine_table1_phecu, *sine_table2_phecu; - HANDLE_IIS_FFT handle_fft_phaseecu; - HANDLE_IIS_FFT handle_ifft_phaseecu; -+ LC3_FLOAT *q_old_res; - - for (ch = 0; ch < channels; ch++) { - DecSetup* setup = balloc(decoder, &size, sizeof(DecSetup)); -@@ -56,7 +58,7 @@ - sine_table1_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); - sine_table2_phecu = balloc(decoder, &size, sizeof(LC3_FLOAT) * (((CODEC_FS(samplerate) * 16) / 1000) / 2 + 1)); - -- LC3_FLOAT *q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); -+ q_old_res = balloc(decoder, &size, sizeof(LC3_FLOAT) * frame_len); - - if (decoder) { - decoder->channel_setup[ch] = setup; -@@ -346,6 +348,7 @@ - LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec* decoder, int ch, int nBytes) - { - int totalBits = 0, bitsTmp = 0, channel_bytes = 0, maxBytes = 0, minBytes = 0; -+ DecSetup* setup; - - if (decoder->hrmode) - { -@@ -375,7 +378,7 @@ - - channel_bytes = nBytes; - -- DecSetup* setup = decoder->channel_setup[ch]; -+ setup = decoder->channel_setup[ch]; - - if (channel_bytes < minBytes || channel_bytes > maxBytes) - { -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/setup_enc_lc3.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "setup_enc_lc3.h" - #include "functions.h" - #include -@@ -33,6 +34,7 @@ - , int32_t lfe_channel_array[] - ) - { -+ int ch = 0; - memset(encoder, 0, lc3plus_enc_get_size(samplerate, channels)); - alloc_encoder(encoder, channels); - -@@ -56,7 +58,6 @@ - encoder->r12k8_mem_in_len = 2 * 8 * encoder->fs / 12800; - encoder->r12k8_mem_out_len = 24; - -- int ch = 0; - for (ch = 0; ch < encoder->channels; ch++) - { - encoder->channel_setup[ch]->lfe = lfe_channel_array[ch] != 0; -@@ -220,6 +221,7 @@ - - if (encoder->hrmode) - { -+#ifdef ENABLE_HR_MODE_FL - switch (encoder->frame_dms) - { - case 25: -@@ -243,6 +245,7 @@ - default: - return LC3PLUS_HRMODE_ERROR; - } -+#endif - } - else - { -@@ -368,7 +371,7 @@ - setup->total_bits = setup->targetBytes << 3; - setup->targetBitsInit = setup->total_bits - encoder->envelope_bits - encoder->global_gain_bits - - encoder->noise_fac_bits - encoder->BW_cutoff_bits - -- ceil(LC3_LOG2(encoder->frame_length / 2)) - 2 - 1; -+ ceil(LC3_LOGTWO(encoder->frame_length / 2)) - 2 - 1; - - if (setup->total_bits > 1280) { - setup->targetBitsInit = setup->targetBitsInit - 1; -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_compute_scf.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processSnsComputeScf_fl(LC3_FLOAT* x, LC3_INT tilt, LC3_INT xLen, LC3_FLOAT* gains, LC3_INT smooth, LC3_FLOAT sns_damping, LC3_FLOAT attdec_damping_factor) -@@ -109,7 +110,7 @@ - - /* Log-domain */ - for (i = 0; i < 64; i++) { -- xl[i] = LC3_LOG2(x[i]) / 2.0; -+ xl[i] = LC3_LOGTWO(x[i]) / 2.0; - } - - /* Downsampling */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_interpolate_scf.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processSnsInterpolateScf_fl(LC3_FLOAT* gains, LC3_INT encoder_side, LC3_INT bands_number, LC3_FLOAT* gains_int) -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/sns_quantize_scf.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void pvq_dec(LC3_INT k, LC3_INT m, LC3_INT LS_ind, LC3_INT MPVQ_ind, LC3_INT* pulses); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tinywavein_c.h 2023-06-29 12:58:27 -@@ -17,6 +17,7 @@ - #include - #include - -+ - #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || defined(__arm__) || \ - defined(__aarch64__) - #define __TWI_LE /* _T_iny _W_ave _I_n _L_ittle _E_ndian */ -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_coder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - static void xcorr(LC3_FLOAT* in, LC3_FLOAT* out, LC3_INT lag, LC3_INT inLen); -diff -Naur ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c ---- ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-02-28 20:25:37 -+++ mod/ETSI_Release/LC3plus_ETSI_src_va15eb59632b_20230228/src/floating_point/tns_decoder.c 2023-06-29 12:58:27 -@@ -8,6 +8,7 @@ - ******************************************************************************/ - - -+#include "options.h" - #include "functions.h" - - void processTnsDecoder_fl(LC3_FLOAT* x, LC3_INT* rc_idx, LC3_INT* order, LC3_INT numfilters, LC3_INT bw_fcbin, LC3_INT N, LC3_INT fs) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 3372471ec1..08c595b35c 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -95,7 +95,8 @@ if [ $INCLUDE_SPLIT -eq 1 ]; then sed '/^#define [[:alnum:]][[:alnum:]_]\+[[:space:]]*$/! d' | sed '/#define DEFINES_H/ d' ) - + + # Filter defines that come from outside of the header lib_lc3plus/defines.h lc3plus_defines_filtered="" while IFS=' \n' read -r line; do -- GitLab From 8664456f3f7d3dcddb9ec9d8d253bd5668336c7d Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 13 May 2024 14:23:31 +0200 Subject: [PATCH 2/2] Delete outdated split_rend_lc3plus_cmdlines.py --- .../lc3plus/split_rend_lc3plus_cmdlines.py | 191 ------------------ 1 file changed, 191 deletions(-) delete mode 100755 scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py diff --git a/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py b/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py deleted file mode 100755 index 033c25bb60..0000000000 --- a/scripts/split_rendering/lc3plus/split_rend_lc3plus_cmdlines.py +++ /dev/null @@ -1,191 +0,0 @@ -""" -Generate command lines for split rendering with LC3plus -""" - -import itertools -import os - -# Paths -ENC_PATH = "./IVAS_cod" -DEC_PATH = "./IVAS_dec" -REND_PATH = "./IVAS_rend" -TEMP_DIR = "tmp" - -# Config values to iterate over -ISM_CONFIGS_NUM_OBJECTS = [1, 2, 3, 4] -IVAS_BITRATES = [128000] -PRE_HEAD_ROT_FILES = [ - "Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv" -] -POST_HEAD_ROT_FILES = [ - "Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv" -] -RENDER_CONFIG_FILES = [ - ####################################################### - # Alternative 2 - LC3plus with CLDFB pose correction - "Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt", - "Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt", - None, # Alternative 2 is the default when no rendering config file is given on command line - ####################################################### - # Alternative 3 - LC3plus with multi-stream (TD) pose correction - "Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt", - "Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt", -] - - -def audio_for_ism(num_objects): - return f"scripts/testv/stv{num_objects}ISM48s.wav" - - -def metadata_for_ism(num_objects): - return f"scripts/testv/stvISM{num_objects}.csv" - - -def basename(file_path): - basename_w_ext = os.path.basename(file_path) - return os.path.splitext(basename_w_ext)[0] - - -# Full chain: IVAS_cod -> IVAS_dec -> IVAS_rend(post) -def full_chain( - num_objects, ivas_bitrate, pre_head_rot_file, render_config_file, post_head_rot_file -): - bs_name = f"{TEMP_DIR}/ism{num_objects}_b{ivas_bitrate}_full_chain.g192" - cod = [ - ENC_PATH, - "-ism", - str(num_objects), - *[metadata_for_ism(i + 1) for i in range(num_objects)], - str(ivas_bitrate), - "48", - audio_for_ism(num_objects), - bs_name, - ] - - render_config_infix = ( - f"##{basename(render_config_file)}" if render_config_file else "" - ) - split_bs_name = bs_name.replace( - ".g192", f"##{basename(pre_head_rot_file)}{render_config_infix}##split.bs" - ) - render_config_args = ( - ["-render_config", render_config_file] if render_config_file else [] - ) - dec = [ - DEC_PATH, - "-T", - pre_head_rot_file, - *render_config_args, - "SPLIT_BINAURAL", - "48", - bs_name, - split_bs_name, - ] - - binaural_output_name = split_bs_name.replace( - ".bs", f"##{basename(post_head_rot_file)}##binaural.wav" - ) - rend = [ - REND_PATH, - "-i", - split_bs_name, - "-if", - "BINAURAL_SPLIT_CODED", - "-of", - "BINAURAL", - "-fs", - "48", - "-tf", - post_head_rot_file, - "-o", - binaural_output_name, - ] - - return [cod, dec, rend] - - -# Renderer chain: IVAS_rend(pre) -> IVAS_rend(post) -def rend_chain(num_objects, pre_head_rot_file, render_config_file, post_head_rot_file): - render_config_infix = ( - f"##{basename(render_config_file)}" if render_config_file else "" - ) - split_bs_name = f"{TEMP_DIR}/ism{num_objects}_rend_chain##{basename(pre_head_rot_file)}{render_config_infix}##split.bs" - render_config_args = ( - ["-render_config", render_config_file] if render_config_file else [] - ) - pre = [ - REND_PATH, - "-i", - audio_for_ism(num_objects), - "-if", - f"ISM{num_objects}", - "-im", - *[metadata_for_ism(i + 1) for i in range(num_objects)], - "-of", - "BINAURAL_SPLIT_CODED", - "-fs", - "48", - *render_config_args, - "-tf", - pre_head_rot_file, - "-o", - split_bs_name, - ] - - binaural_output_name = split_bs_name.replace( - ".bs", f"##{basename(post_head_rot_file)}##binaural.wav" - ) - post = [ - REND_PATH, - "-i", - split_bs_name, - "-if", - "BINAURAL_SPLIT_CODED", - "-of", - "BINAURAL", - "-fs", - "48", - "-tf", - post_head_rot_file, - "-o", - binaural_output_name, - ] - - return [pre, post] - - -def print_command_list(list_of_lists): - for lst in list_of_lists: - print(" ".join(lst)) - print("") # newline - - -def main(): - print("\n##########################################") - print("# Full chain: enc -> dec -> rend(post)") - print("##########################################\n") - for args_full_chain in itertools.product( - # Ordering here must match argument order in function call below! - ISM_CONFIGS_NUM_OBJECTS, - IVAS_BITRATES, - PRE_HEAD_ROT_FILES, - RENDER_CONFIG_FILES, - POST_HEAD_ROT_FILES, - ): - print_command_list(full_chain(*args_full_chain)) - - print("\n##########################################") - print("# Renderer chain: rend(pre) -> rend(post)") - print("##########################################\n") - for args_rend_chain in itertools.product( - # Ordering here must match argument order in function call below! - ISM_CONFIGS_NUM_OBJECTS, - PRE_HEAD_ROT_FILES, - RENDER_CONFIG_FILES, - POST_HEAD_ROT_FILES, - ): - print_command_list(rend_chain(*args_rend_chain)) - - -if __name__ == "__main__": - main() -- GitLab