From efd560a33cbef5101db99636caaff2ee4b6d2016 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 2 Jun 2025 16:41:48 +0200 Subject: [PATCH 1/2] Update LC3plus version to V1.5.1 --- lib_lc3plus/adjust_global_gain_fx.c | 10 +- lib_lc3plus/al_fec.c | 2 +- lib_lc3plus/apply_global_gain_fx.c | 2 +- lib_lc3plus/attack_detector_fx.c | 2 +- lib_lc3plus/basop_mpy_lc3plus.c | 2 +- lib_lc3plus/basop_mpy_lc3plus.h | 24 +-- lib_lc3plus/basop_util_lc3plus.c | 2 +- lib_lc3plus/basop_util_lc3plus.h | 2 +- lib_lc3plus/constants.c | 81 +------- lib_lc3plus/constants.h | 44 +---- lib_lc3plus/cutoff_bandwidth.c | 2 +- lib_lc3plus/dct2_fx.c | 10 +- lib_lc3plus/dct4_fx.c | 20 +- lib_lc3plus/dec_entropy.c | 2 +- lib_lc3plus/dec_lc3.c | 36 ++-- lib_lc3plus/defines.h | 78 +------- lib_lc3plus/detect_cutoff_warped_fx.c | 4 +- lib_lc3plus/dynmem.c | 2 +- lib_lc3plus/dynmem.h | 2 +- lib_lc3plus/enc_entropy.c | 2 +- lib_lc3plus/enc_lc3.c | 22 +-- lib_lc3plus/estimate_global_gain_fx.c | 4 +- lib_lc3plus/fft_lc3plus.c | 193 ++------------------ lib_lc3plus/functions.h | 56 +----- lib_lc3plus/imdct_fx.c | 6 +- lib_lc3plus/lc3.c | 25 +-- lib_lc3plus/lc3.h | 6 +- lib_lc3plus/levinson_fx.c | 2 +- lib_lc3plus/license.h | 4 +- lib_lc3plus/ltpf_coder_fx.c | 12 +- lib_lc3plus/ltpf_decoder_fx.c | 16 +- lib_lc3plus/makefile | 2 +- lib_lc3plus/mdct_fx.c | 58 +----- lib_lc3plus/mdct_shaping_fx.c | 2 +- lib_lc3plus/near_nyquist_detector_fx.c | 14 +- lib_lc3plus/noise_factor_fx.c | 4 +- lib_lc3plus/noise_filling_fx.c | 4 +- lib_lc3plus/olpa_fx.c | 30 +-- lib_lc3plus/pc_apply_fx.c | 2 +- lib_lc3plus/pc_classify_fx.c | 2 +- lib_lc3plus/pc_main_fx.c | 2 +- lib_lc3plus/pc_update_fx.c | 2 +- lib_lc3plus/per_band_energy_fx.c | 10 +- lib_lc3plus/plc_apply_fx.c | 78 +------- lib_lc3plus/plc_classify_fx.c | 48 +---- lib_lc3plus/plc_damping_scrambling_fx.c | 57 +----- lib_lc3plus/plc_lpc_scaling_fx.c | 2 +- lib_lc3plus/plc_main_fx.c | 18 +- lib_lc3plus/plc_noise_substitution_fx.c | 2 +- lib_lc3plus/plc_phecu_f0_refine_first_fx.c | 2 +- lib_lc3plus/plc_phecu_fec_hq_fx.c | 179 +----------------- lib_lc3plus/plc_phecu_lf_peak_analysis_fx.c | 2 +- lib_lc3plus/plc_phecu_peak_locator_fx.c | 2 +- lib_lc3plus/plc_phecu_setf0hz_fx.c | 2 +- lib_lc3plus/plc_phecu_tools_fx.c | 42 ++--- lib_lc3plus/plc_tdac_fx.c | 2 +- lib_lc3plus/plc_tdc_inverse_odft_fx.c | 2 +- lib_lc3plus/plc_tdc_lagwin_fx.c | 2 +- lib_lc3plus/plc_tdc_main_fx.c | 82 +-------- lib_lc3plus/plc_tdc_pre_emphasis_fx.c | 4 +- lib_lc3plus/plc_update_aft_imdct_fx.c | 72 ++++---- lib_lc3plus/plc_update_fx.c | 98 +++++----- lib_lc3plus/plc_xcorr_fx.c | 2 +- lib_lc3plus/pvq_dec_fx.c | 2 +- lib_lc3plus/pvq_enc_fx.c | 2 +- lib_lc3plus/pvq_index_fx.c | 2 +- lib_lc3plus/quantize_spec_fx.c | 2 +- lib_lc3plus/reorder_bitstream_fx.c | 2 +- lib_lc3plus/resamp12k8_fx.c | 2 +- lib_lc3plus/residual_coding_fx.c | 2 +- lib_lc3plus/residual_decoding_fx.c | 2 +- lib_lc3plus/rom_basop_util_lc3plus.c | 19 +- lib_lc3plus/rom_basop_util_lc3plus.h | 6 +- lib_lc3plus/scale_signal24_fx.c | 2 +- lib_lc3plus/setup_dec_lc3.c | 25 +-- lib_lc3plus/setup_dec_lc3.h | 13 +- lib_lc3plus/setup_enc_lc3.c | 34 +--- lib_lc3plus/setup_enc_lc3.h | 8 +- lib_lc3plus/sns_compute_scf_fx.c | 2 +- lib_lc3plus/sns_interpolate_scf_fx.c | 2 +- lib_lc3plus/sns_quantize_scf_fx.c | 2 +- lib_lc3plus/tinywavein_c.h | 2 +- lib_lc3plus/tinywaveout_c.h | 2 +- lib_lc3plus/tns_coder_fx.c | 6 +- lib_lc3plus/tns_decoder_fx.c | 4 +- 85 files changed, 285 insertions(+), 1363 deletions(-) mode change 100644 => 100755 lib_lc3plus/rom_basop_util_lc3plus.c diff --git a/lib_lc3plus/adjust_global_gain_fx.c b/lib_lc3plus/adjust_global_gain_fx.c index c6067b591..0c3442061 100644 --- a/lib_lc3plus/adjust_global_gain_fx.c +++ b/lib_lc3plus/adjust_global_gain_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -31,11 +31,7 @@ void processAdjustGlobalGain_fx(Word16 *gg_idx, Word16 gg_idx_min, Word16 gg_idx Word16 gg_idx_inc; Word16 gg_idx_inc_max; Word16 gg_idx_inc_s; -# ifdef CR8_G_ADD_75MS Word32 factor; -# else - Word16 factor; -# endif #endif #ifdef DYNMEM_COUNT @@ -73,13 +69,11 @@ void processAdjustGlobalGain_fx(Word16 *gg_idx, Word16 gg_idx_min, Word16 gg_idx factor = 2; move16(); gg_idx_inc_max = 20; move16(); } -#ifdef CR8_G_ADD_75MS ELSE IF (sub(frame_dms, 75) == 0) { factor = 40265318; move16(); // factor = 1.2 * 2^25 gg_idx_inc_max = 12 ; move16(); } -#endif ELSE { factor = 1; move16(); @@ -122,7 +116,6 @@ void processAdjustGlobalGain_fx(Word16 *gg_idx, Word16 gg_idx_min, Word16 gg_idx IF (sub(nBits, target) > 0) { gg_idx_inc = sub(nBits, target); -#ifdef CR8_G_ADD_75MS IF (sub(frame_dms, 75) == 0) { gg_idx_inc = extract_l(L_shr_pos(Mpy_32_16_lc3plus(factor, gg_idx_inc), 10)); // Mpy_32_16_lc3plus(1.2*2^25, gg_idx_inc), 25 - 15) @@ -131,7 +124,6 @@ void processAdjustGlobalGain_fx(Word16 *gg_idx, Word16 gg_idx_min, Word16 gg_idx gg_idx_inc = add(gg_idx_inc, 1); // adding 1 instead of 1.2 } ELSE -#endif { gg_idx_inc = extract_l(L_mult0(gg_idx_inc, factor)); gg_idx_inc = BASOP_Util_Divide1616_Scale_lc3plus(gg_idx_inc, delta, &gg_idx_inc_s); diff --git a/lib_lc3plus/al_fec.c b/lib_lc3plus/al_fec.c index c659a90e0..efd1ed063 100644 --- a/lib_lc3plus/al_fec.c +++ b/lib_lc3plus/al_fec.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/apply_global_gain_fx.c b/lib_lc3plus/apply_global_gain_fx.c index a3299d863..14b75f5c7 100644 --- a/lib_lc3plus/apply_global_gain_fx.c +++ b/lib_lc3plus/apply_global_gain_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/attack_detector_fx.c b/lib_lc3plus/attack_detector_fx.c index 3c62f8494..fad58543b 100644 --- a/lib_lc3plus/attack_detector_fx.c +++ b/lib_lc3plus/attack_detector_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/basop_mpy_lc3plus.c b/lib_lc3plus/basop_mpy_lc3plus.c index 88a6d336b..aa29bf209 100644 --- a/lib_lc3plus/basop_mpy_lc3plus.c +++ b/lib_lc3plus/basop_mpy_lc3plus.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/basop_mpy_lc3plus.h b/lib_lc3plus/basop_mpy_lc3plus.h index 72c7d91bb..a4b505ade 100644 --- a/lib_lc3plus/basop_mpy_lc3plus.h +++ b/lib_lc3plus/basop_mpy_lc3plus.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -49,8 +49,6 @@ Word32 Mpy_32_16_lc3plus(Word32 x, Word16 y); */ Word32 Mpy_32_32_lc3plus(Word32 x, Word32 y); -#ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION - # ifdef ENABLE_HR_MODE # define cplxMpy32_32_32_2(re, im, a, b, c, d) \ do \ @@ -66,26 +64,6 @@ Word32 Mpy_32_32_lc3plus(Word32 x, Word32 y); im = L_add(L_shr_pos(Mpy_32_16_lc3plus(a, d), 1), L_shr_pos(Mpy_32_16_lc3plus(b, c), 1)); \ } while (0) - -#else /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ - -# ifdef ENABLE_HR_MODE -# define cplxMpy32_32_32_2(re, im, a, b, c, d) \ - do \ - { \ - re = L_sub(Mpy_32_32_0(a, c), Mpy_32_32_0(b, d)); \ - im = L_add(Mpy_32_32_0(a, d), Mpy_32_32_0(b, c)); \ - } while (0) -# endif -# define cplxMpy32_32_16_2(re, im, a, b, c, d) \ - do \ - { \ - re = L_sub(L_shr_pos(Mpy_32_16_lc3plus(a, c), 1), L_shr_pos(Mpy_32_16_lc3plus(b, d), 1)); \ - im = L_add(L_shr_pos(Mpy_32_16_lc3plus(a, d), 1), L_shr_pos(Mpy_32_16_lc3plus(b, c), 1)); \ - } while (0) - -#endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ - void cplxMpy_32_16(Word32 *c_Re, Word32 *c_Im, const Word32 a_Re, const Word32 a_Im, const Word16 b_Re, const Word16 b_Im); void cplxMpy_32_32(Word32 *c_Re, Word32 *c_Im, const Word32 a_Re, const Word32 a_Im, const Word32 b_Re, diff --git a/lib_lc3plus/basop_util_lc3plus.c b/lib_lc3plus/basop_util_lc3plus.c index 9f2d6be79..bb2c0413a 100644 --- a/lib_lc3plus/basop_util_lc3plus.c +++ b/lib_lc3plus/basop_util_lc3plus.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/basop_util_lc3plus.h b/lib_lc3plus/basop_util_lc3plus.h index d9abc7f5d..577c65f54 100644 --- a/lib_lc3plus/basop_util_lc3plus.h +++ b/lib_lc3plus/basop_util_lc3plus.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/constants.c b/lib_lc3plus/constants.c index c02cf5c69..e51143e42 100644 --- a/lib_lc3plus/constants.c +++ b/lib_lc3plus/constants.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -13,7 +13,6 @@ #ifdef ENABLE_HR_MODE -#ifdef CR8_G_ADD_75MS const Word32 LowDelayShapes_n960_N480_HRA_7_5ms_IP[720] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 348, 823, 1614, 2855, 4711, @@ -257,7 +256,6 @@ const Word32 LowDelayShapes_n960_N960_HRA_7_5ms_IP[1440] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -#endif /* #ifdef CR8_G_ADD_75MS */ RAM_ALIGN const Word32 LowDelayShapes_n960_N480_HRA_2_5ms_IP[240] = { 214, 1407, 4144, 9592, 19434, 36052, 62711, 103783, 164992, @@ -760,10 +758,8 @@ RAM_ALIGN const Word32 *const LowDelayShapes_n960_HRA_5ms[2] = { LowDelayShapes_ RAM_ALIGN const Word32 *const LowDelayShapes_n960_HRA[2] = { LowDelayShapes_n960_N480_HRA_IP, LowDelayShapes_n960_N960_HRA_IP }; -# ifdef CR8_G_ADD_75MS RAM_ALIGN const Word32 *const LowDelayShapes_n960_HRA_7_5ms[2] = { LowDelayShapes_n960_N480_HRA_7_5ms_IP, LowDelayShapes_n960_N960_HRA_7_5ms_IP }; -# endif #endif /* ENABLE_HR_MODE */ RAM_ALIGN const Word16 pitch_max[5] = {MAX_PITCH_8K, MAX_PITCH_16K, MAX_PITCH_24K, MAX_PITCH_32K, MAX_PITCH_48K}; @@ -1243,11 +1239,9 @@ RAM_ALIGN const Word16 gwlpr_fx[MAX_LGW + 1] = { 81 * QUOT_LPR_LTR, 97 * QUOT_LPR_LTR}; /* frequency group start bins for transient analysis */ -#ifdef CR8_A_PLC_FADEOUT_TUNING /* puretone_ana compressed ATH bandborder weights */ RAM_ALIGN const Word16 scATHFx[MAX_LGW - 2] = { 14924 , 30499 , 31886 , 32767 , 29770 , 25417 , 16384 }; - /* 0.455444335937500 0.930755615234375 0.973083496093750 0.999969482421875 0.908508300781250 0.775665283203125 0.5*/ -#endif + /* 0.455444335937500 0.930755615234375 0.973083496093750 0.999969482421875 0.908508300781250 0.775665283203125 0.5*/ RAM_ALIGN const Word16 e_tot_headroom[5] = {3, 3, 4, 4, 4}; /* smallest head room to use for each fs */ @@ -1265,18 +1259,9 @@ RAM_ALIGN const Word16 POW_ATT_TABLE1[OFF_FRAMES_LIMIT + 1] = { #ifdef PLC2_FADEOUT_IN_MS #if PLC2_FADEOUT_IN_MS == 0 -#ifndef CR8_A_PLC_FADEOUT_TUNING -/*/ default setting only requieres two tables */ -RAM_ALIGN 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 /* PLC2_FADEOUT_IN_MS == 0 */ -#ifdef CR8_A_PLC_FADEOUT_TUNING RAM_ALIGN const Word16 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 */ @@ -1288,7 +1273,6 @@ RAM_ALIGN const Word16 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 RAM_ALIGN const Word16 POW_ATT_TABLE_p3x8_6[OFF_FRAMES_LIMIT + 1] = { 32767, 31656, 30581, 29543, 28540, 27571, 26635, 25731, 12865, 6433, 3216, 1608, 804, 402, 201, 101, @@ -1318,7 +1302,6 @@ RAM_ALIGN const Word16 POW_ATT_TABLE_p4x1_6[OFF_FRAMES_LIMIT + 1] = { 32767, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 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 /* POW_ATT_TABLES now ordered logically based on initial slow muting phase time */ /* POW_ATT_TABLES[ind] is used after teh initial gain==1.0 no energy muting phase */ RAM_ALIGN const Word16 *const POW_ATT_TABLES[1 + 24 / 2] = @@ -1357,26 +1340,6 @@ RAM_ALIGN const Word16 fade_scheme_tab_fx[24 / 2][3] = { /*fade_scheme_tab_fx[ind][1] is burst_att_thresh, the number of non_muted 1.0 gain frames */ /*fade_scheme_tab_fx[ind][2] is beta_mute_thr, the location of the start of final attenuation */ -#else -RAM_ALIGN const Word16 *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 /* PLC2_FADEOUT_IN_MS == 0 */ #else /* PLC2_FADEOUT_IN_MS */ @@ -1826,30 +1789,17 @@ RAM_ALIGN const Word16 spec_shape_headroom[5] = {3, 4, 4, 4, 4}; RAM_ALIGN const Word16 rectLengthTab[NUM_SAMP_FREQ] = {80, 160, 240, 320, 480, 960}; /* 10ms */ RAM_ALIGN const Word16 hamm_len2Tab[5] = {24, 48, 72, 96, 144}; /* 3 ms*/ -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR RAM_ALIGN const Word16 PLC_FADEOUT_TYPE_2_SELECTOR = 10; /* can take values from 0 to 10, default is 10 for longer fadeout*/ -#else -# ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH -RAM_ALIGN const Word16 FADE_OUT_TYPE_2_ALPHA_5MS[30] = { /* 0.5^(nbLostFramesInRow + LC3_ROUND(100.0/frame_dms) - 1) * frame_dms/100.0)*/ - 16384,11585,8192,5792,4096,2896,2048,1448,1024,724,512,362,256,181,128,91,64,45,32,23,16,11,8,6,4,3,2,1,1,1}; -RAM_ALIGN const Word16 FADE_OUT_TYPE_2_ALPHA_2_5MS[60] = { /* 0.5^(nbLostFramesInRow + LC3_ROUND(100.0/frame_dms) - 1) * frame_dms/100.0)*/ - 16384,13777,11585,9742,8192,6889,5793,4871,4096,3444,2896,2435,2048,1722,1448,1218,1024,861,724,609,512,431,362,304,256,215,181,152,128,108,91,76,64,54,45,38,32,27,23,19,16,13,11,10,8,7,6,5,4,3,3,2,2,2,1,1,1,1,1,1}; -# endif -#endif RAM_ALIGN const Word16 NN_thresh = 0x7800; /* 30*2^10 */ RAM_ALIGN const Word16 NN_thresh_exp = -10; /* Tone detector */ -#ifdef CR8_E_TONE_DETECTOR # ifdef ENABLE_HR_MODE RAM_ALIGN const Word32 TD_HR_thresh_10ms = 83402; -# ifdef ENABLE_075_DMS_MODE RAM_ALIGN const Word32 TD_HR_thresh_7_5ms = 743496; -# endif RAM_ALIGN const Word32 TD_HR_thresh_5ms = 382564; RAM_ALIGN const Word32 TD_HR_thresh_2_5ms = 301695; # endif /* ENABLE_HR_MODE */ -#endif /* CR8_E_TONE_DETECTOR */ RAM_ALIGN const Word32 BW_thresh_quiet[4] = {0x14000000, 0xA000000, 0xA000000, 0xA000000}; /* [20,10,10,10]*2^24 */ RAM_ALIGN const Word16 BW_thresh_quiet_exp = 31 - 24; RAM_ALIGN const Word16 BW_thresh_brickwall[4] = { @@ -1900,7 +1850,6 @@ RAM_ALIGN const Word16 *const BW_warp_idx_start_all_2_5ms[MAX_BW_BANDS_NUMBER - RAM_ALIGN const Word16 *const BW_warp_idx_stop_all_2_5ms[MAX_BW_BANDS_NUMBER - 1] = { BW_warp_idx_stop_16k_2_5ms, BW_warp_idx_stop_24k_2_5ms, BW_warp_idx_stop_32k_2_5ms, BW_warp_idx_stop_48k_2_5ms}; -# ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 BW_brickwall_dist_7_5ms[4] = {4, 4, 3, 2}; RAM_ALIGN const Word16 BW_warp_idx_start_16k_7_5ms[4] = {51, 0, 0, 0}; RAM_ALIGN const Word16 BW_warp_idx_stop_16k_7_5ms[4] = {63, 0, 0, 0}; @@ -1914,7 +1863,6 @@ RAM_ALIGN const Word16 *const BW_warp_idx_start_all_7_5ms[] = { BW_warp_idx_start_16k_7_5ms, BW_warp_idx_start_24k_7_5ms, BW_warp_idx_start_32k_7_5ms, BW_warp_idx_start_48k_7_5ms}; RAM_ALIGN const Word16 *const BW_warp_idx_stop_all_7_5ms[] = { 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 #ifdef ENABLE_HR_MODE RAM_ALIGN const Word16 BW_cutoff_bin_all[] = {80, 160, 240, 320, 400, 400}; @@ -1940,7 +1888,6 @@ RAM_ALIGN const Word16 LowDelayShapes_n960_la_zeroes[NUM_SAMP_FREQ] = {30, #endif }; -#ifdef CR8_G_ADD_75MS # ifdef ENABLE_HR_MODE const Word16 LowDelayShapes_n960_len_7_5ms[6] = {106, 212, 318, 424, 636, 1272}; # else @@ -2311,7 +2258,6 @@ const Word16 *const LowDelayShapes_n960_7_5ms[5] = { LowDelayShapes_n960_N60_7_5ms, LowDelayShapes_n960_N120_7_5ms, LowDelayShapes_n960_N180_7_5ms, LowDelayShapes_n960_N240_7_5ms, LowDelayShapes_n960_N360_7_5ms}; # endif -#endif # ifdef ENABLE_HR_MODE # ifdef SUBSET_NB @@ -2973,7 +2919,6 @@ RAM_ALIGN const Word16 *const tns_subdiv_stopfreq_2_5ms[MAX_BW_BANDS_NUMBER] = { tns_subdiv_stopfreq_8k_2_5ms, tns_subdiv_stopfreq_16k_2_5ms, tns_subdiv_stopfreq_24k_2_5ms, tns_subdiv_stopfreq_32k_2_5ms, tns_subdiv_stopfreq_48k_2_5ms}; -#ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 tns_subdiv_startfreq_8k_7_5ms[6] = {9, 26, 43, 0, 0, 0}; RAM_ALIGN const Word16 tns_subdiv_stopfreq_8k_7_5ms[6] = {26, 43, 60, 0, 0, 0}; @@ -3008,7 +2953,6 @@ RAM_ALIGN const Word16 *const tns_subdiv_stopfreq_7_5ms[] = { , tns_subdiv_stopfreq_96k_7_5ms # endif }; -# endif RAM_ALIGN const Word16 Tab_esc_nb[4] = {0 << (NBITS_CONTEXT + NBITS_RATEQ), 1 << (NBITS_CONTEXT + NBITS_RATEQ), 2 << (NBITS_CONTEXT + NBITS_RATEQ), 3 << (NBITS_CONTEXT + NBITS_RATEQ)}; @@ -3902,8 +3846,6 @@ RAM_ALIGN const Word16 *const lpc_lin_pre_emphasis_e_2_5ms[NUM_SAMP_FREQ] = { #endif }; -# ifdef ENABLE_075_DMS_MODE -# ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 lpc_lin_pre_emphasis_60_0_62[60] = { 0x4a26, 0x4be4, 0x4f5d, 0x5490, 0x5b79, 0x6414, 0x6e59, 0x7a43, 0x43e4, 0x4b6f, 0x53bf, 0x5ccc, 0x6690, 0x7106, 0x7c25, 0x43f3, 0x4a1f, 0x5095, 0x574e, 0x5e46, 0x6578, 0x6cdf, 0x7477, 0x7c39, 0x4210, 0x4613, 0x4a24, 0x4e3e, @@ -3986,8 +3928,6 @@ RAM_ALIGN const Word16 *const lpc_lin_pre_emphasis_e_7_5ms[NUM_SAMP_FREQ] = { , lpc_lin_pre_emphasis_80_e_0_92 # endif }; -# endif -# endif #ifdef SUBSET_NB RAM_ALIGN const Word16 lpc_warp_dee_emphasis_16_8000[16] = {0x4000, 0x673f, 0x5348, 0x432d, 0x6c5f, 0x576a, @@ -4116,7 +4056,6 @@ RAM_ALIGN const Word16 bands_offset_96000_2_5ms_HR[50] = { RAM_ALIGN const Word16 *const bands_offset_2_5ms_HR[2] = {bands_offset_48000_2_5ms_HR, bands_offset_96000_2_5ms_HR}; -#ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 bands_offset_48000_7_5ms_HR[65] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 44, 47, 50, 53, 56, 60, 64, 68, 73, 78, 83, 89, 95, 101, 108, @@ -4127,7 +4066,6 @@ RAM_ALIGN const Word16 bands_offset_96000_7_5ms_HR[65] = { 180, 195, 210, 227, 245, 265, 286, 309, 334, 360, 389, 420, 454, 490, 529, 572, 617, 667, 720}; RAM_ALIGN const Word16 *const bands_offset_7_5ms_HR[2] = {bands_offset_48000_7_5ms_HR, bands_offset_96000_7_5ms_HR}; -# endif #endif /* ENABLE_HR_MODE */ #ifdef SUBSET_NB @@ -4340,7 +4278,6 @@ RAM_ALIGN const Word16 *const bands_offset[6] = {bands_offset_8000_lpc_warp, ban bands_offset_24000_lpc_warp, bands_offset_32000_lpc_warp, bands_offset_48000_lpc_warp, NULL}; -#ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 bands_offset_with_one_max_7_5ms[NUM_OFFSETS] = {60, 34, 27, 24, 22 # ifdef ENABLE_HR_MODE , 20, 16 @@ -4351,7 +4288,6 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_7_5ms[NUM_OFFSETS] = {0, 48, 38 , 29, 24 # endif }; -# endif RAM_ALIGN const Word16 bands_offset_with_one_max[NUM_OFFSETS] = {49, 28, 23, 20, 18 # ifdef ENABLE_HR_MODE @@ -4378,13 +4314,11 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_5ms[NUM_OFFSETS] = {39, 42, 34, # endif }; -#ifdef CR8_G_ADD_75MS # ifdef ENABLE_HR_MODE RAM_ALIGN const Word16 bands_number_7_5ms [] = {60, 64, 64, 64, 64, 64}; # else RAM_ALIGN const Word16 bands_number_7_5ms [] = {60, 64, 64, 64, 64}; # endif -#endif #ifdef ENABLE_HR_MODE RAM_ALIGN const Word16 bands_number_5ms[NUM_SAMP_FREQ] = {39, 50, 52, 54, 55, 58}; @@ -4425,7 +4359,6 @@ RAM_ALIGN const Word16 bands_offset_96000_lpc_lin[81] = 0x0348, 0x0354, 0x0360, 0x036c, 0x0378, 0x0384, 0x0390, 0x039c, 0x03a8, 0x03b4, 0x03c0 }; -# ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 bands_offset_96000_lpc_lin_7_5ms[81] = { 0x0000, 0x0009, 0x0012, 0x001b, 0x0024, 0x002d, 0x0036, 0x003f, 0x0048, 0x0051, 0x005a, 0x0063, 0x006c, 0x0075, @@ -4436,7 +4369,6 @@ RAM_ALIGN const Word16 bands_offset_96000_lpc_lin_7_5ms[81] = 0x0276, 0x027f, 0x0288, 0x0291, 0x029a, 0x02a3, 0x02ac, 0x02b5, 0x02be, 0x02c7, 0x02d0 }; # endif -# endif RAM_ALIGN const Word16 *const bands_offset_lin[NUM_SAMP_FREQ] = {bands_offset_8000_lpc_lin, bands_offset_16000_lpc_lin, @@ -4447,7 +4379,6 @@ RAM_ALIGN const Word16 *const bands_offset_lin[NUM_SAMP_FREQ] = {bands_offset_80 # endif }; -# ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 *const bands_offset_lin_7_5ms[NUM_SAMP_FREQ] = {bands_offset_8000_lpc_lin, bands_offset_16000_lpc_lin, bands_offset_24000_lpc_lin, bands_offset_24000_lpc_lin, bands_offset_48000_lpc_lin @@ -4455,7 +4386,6 @@ RAM_ALIGN const Word16 *const bands_offset_lin_7_5ms[NUM_SAMP_FREQ] = {bands_off , bands_offset_96000_lpc_lin_7_5ms # endif }; -# endif RAM_ALIGN const Word16 *const bands_offset_lin_5ms[NUM_SAMP_FREQ] = {bands_offset_8000_lpc_lin, bands_offset_8000_lpc_lin, bands_offset_24000_lpc_lin, bands_offset_16000_lpc_lin, @@ -4483,7 +4413,6 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_lin[NUM_SAMP_FREQ] = {0, 80, 0, # endif }; -# ifdef CR8_G_ADD_75MS RAM_ALIGN const Word16 bands_offset_with_one_max_lin_7_5ms[NUM_SAMP_FREQ] = {60, 0, 0, 0, 0 # ifdef ENABLE_HR_MODE , 0 @@ -4495,7 +4424,6 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_lin_7_5ms[NUM_SAMP_FREQ] = {0, , 0 # endif }; -#endif RAM_ALIGN const Word16 bands_offset_with_one_max_lin_5ms[NUM_SAMP_FREQ] = {40, 80, 0, 0, 0 # ifdef ENABLE_HR_MODE @@ -4517,7 +4445,7 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_lin_2_5ms[NUM_SAMP_FREQ] = {0, , 0 # endif }; -#ifdef CR8_G_ADD_75MS + # ifdef SUBSET_NB RAM_ALIGN const Word16 bands_offset_8000_lpc_warp_7_5ms[61] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, @@ -4566,7 +4494,6 @@ RAM_ALIGN const Word16 bands_offset_48000_lpc_warp_7_5ms[65] = { RAM_ALIGN const Word16 *const bands_offset_7_5ms[5] = { bands_offset_8000_lpc_warp_7_5ms, bands_offset_16000_lpc_warp_7_5ms, bands_offset_24000_lpc_warp_7_5ms, bands_offset_32000_lpc_warp_7_5ms, bands_offset_48000_lpc_warp_7_5ms}; -# endif /* ifdef CR8_G_ADD_75MS */ RAM_ALIGN const Word32 inv_odft_twiddle_80_re[M] = { 0x7ff9af04, 0x7fe6bcb0, 0x7fc72ae2, 0x7f9afcb9, 0x7f62368f, 0x7f1cde01, 0x7ecaf9e5, 0x7e6c9251, @@ -5040,7 +4967,5 @@ RAM_ALIGN const Word16 adjust_global_gain_tables[5][NUM_SAMP_FREQ] = {{80, 230, {1310, 3241, 5268, 7326, 9400}}; # endif -#if defined(CR8_A_PLC_FADEOUT_TUNING) const Word16 plc_fadeout_param_maxlen[4] = {800, 400, 266, 200}; const Word16 plc_fadeout_param_maxbytes[4] = {27, 14, 9, 7}; -#endif diff --git a/lib_lc3plus/constants.h b/lib_lc3plus/constants.h index 8dee7e6eb..3d2a99b0f 100644 --- a/lib_lc3plus/constants.h +++ b/lib_lc3plus/constants.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -59,7 +59,6 @@ extern RAM_ALIGN const Word32 *const LowDelayShapes_n960_2_5ms[6]; extern RAM_ALIGN const Word16 *const LowDelayShapes_n960_2_5ms[6]; # endif -# ifdef CR8_G_ADD_75MS # ifdef ENABLE_HR_MODE extern RAM_ALIGN const Word32 *const LowDelayShapes_n960_7_5ms[5]; # else @@ -72,20 +71,15 @@ extern RAM_ALIGN const Word16 LowDelayShapes_n960_len_7_5ms[6]; extern RAM_ALIGN const Word16 LowDelayShapes_n960_len_7_5ms[5]; # endif extern RAM_ALIGN const Word16 LowDelayShapes_n960_la_zeroes_7_5ms[NUM_SAMP_FREQ]; -# endif extern RAM_ALIGN const Word16 NN_thresh; extern RAM_ALIGN const Word16 NN_thresh_exp; -#ifdef CR8_E_TONE_DETECTOR # ifdef ENABLE_HR_MODE extern RAM_ALIGN const Word32 TD_HR_thresh_10ms; -# ifdef ENABLE_075_DMS_MODE extern RAM_ALIGN const Word32 TD_HR_thresh_7_5ms; -# endif extern RAM_ALIGN const Word32 TD_HR_thresh_5ms; extern RAM_ALIGN const Word32 TD_HR_thresh_2_5ms; # endif /* ENABLE_HR_MODE */ -#endif /* CR8_E_TONE_DETECTOR */ extern RAM_ALIGN const Word32 BW_thresh_quiet[4]; extern RAM_ALIGN const Word16 BW_thresh_quiet_exp; extern RAM_ALIGN const Word16 BW_thresh_brickwall[4]; @@ -108,13 +102,9 @@ extern RAM_ALIGN const Word16 BW_brickwall_dist_2_5ms[4]; extern RAM_ALIGN const Word16 *const BW_warp_idx_start_all_2_5ms[MAX_BW_BANDS_NUMBER - 1]; extern RAM_ALIGN const Word16 *const BW_warp_idx_stop_all_2_5ms[MAX_BW_BANDS_NUMBER - 1]; -#ifdef CR8_G_ADD_75MS -# ifdef ENABLE_075_DMS_MODE extern RAM_ALIGN const Word16 BW_brickwall_dist_7_5ms[4]; extern RAM_ALIGN const Word16 *const BW_warp_idx_start_all_7_5ms[]; extern RAM_ALIGN const Word16 *const BW_warp_idx_stop_all_7_5ms[]; -# endif -#endif extern RAM_ALIGN const Word16 *const tns_subdiv_startfreq[MAX_BW_BANDS_NUMBER]; extern RAM_ALIGN const Word16 *const tns_subdiv_stopfreq[MAX_BW_BANDS_NUMBER]; @@ -137,12 +127,8 @@ extern RAM_ALIGN const Word16 *const tns_subdiv_stopfreq_5ms[MAX_BW_BANDS_NUMBER extern RAM_ALIGN const Word16 *const tns_subdiv_startfreq_2_5ms[MAX_BW_BANDS_NUMBER]; extern RAM_ALIGN const Word16 *const tns_subdiv_stopfreq_2_5ms[MAX_BW_BANDS_NUMBER]; -#ifdef CR8_G_ADD_75MS -# ifdef ENABLE_075_DMS_MODE extern RAM_ALIGN const Word16 *const tns_subdiv_startfreq_7_5ms[]; extern RAM_ALIGN const Word16 *const tns_subdiv_stopfreq_7_5ms[]; -# endif -#endif extern RAM_ALIGN const Word16 Tab_esc_nb[4]; @@ -174,12 +160,8 @@ extern RAM_ALIGN const Word16 *const lpc_lin_pre_emphasis_e_2_5ms[NUM_SAMP_FREQ] extern RAM_ALIGN const Word16 *const lpc_warp_dee_emphasis[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 *const lpc_warp_dee_emphasis_e[NUM_SAMP_FREQ]; -#ifdef CR8_G_ADD_75MS -# ifdef ENABLE_075_DMS_MODE extern RAM_ALIGN const Word16 *const lpc_lin_pre_emphasis_7_5ms[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 *const lpc_lin_pre_emphasis_e_7_5ms[NUM_SAMP_FREQ]; -# endif -#endif extern RAM_ALIGN const Word16 bands_nrg_scale[32]; @@ -202,8 +184,6 @@ extern RAM_ALIGN const Word16 *const bands_offset_2_5ms[6]; extern RAM_ALIGN const Word16 bands_offset_with_one_max_2_5ms[NUM_OFFSETS]; extern RAM_ALIGN const Word16 bands_offset_with_two_max_2_5ms[NUM_OFFSETS]; -#ifdef CR8_G_ADD_75MS -#ifdef ENABLE_075_DMS_MODE extern RAM_ALIGN const Word16 bands_number_7_5ms[]; # ifndef GENERATE_BAND_TABLES extern RAM_ALIGN const Word16 *const bands_offset_7_5ms[5]; @@ -214,8 +194,6 @@ extern RAM_ALIGN const Word16 bands_number_7_5ms_HR[]; extern RAM_ALIGN const Word16 *const bands_offset_7_5ms_HR[2]; # endif # endif -#endif -#endif extern RAM_ALIGN const Word16 pitch_max[5]; extern RAM_ALIGN const Word16 plc_preemph_fac[NUM_SAMP_FREQ]; @@ -237,15 +215,11 @@ extern RAM_ALIGN const Word16 *const bands_offset_lin_2_5ms[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 bands_offset_with_one_max_lin_2_5ms[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 bands_offset_with_two_max_lin_2_5ms[NUM_SAMP_FREQ]; -#ifdef CR8_G_ADD_75MS -# ifdef ENABLE_075_DMS_MODE extern RAM_ALIGN const Word16 bands_offset_with_one_max_7_5ms[NUM_OFFSETS]; extern RAM_ALIGN const Word16 bands_offset_with_two_max_7_5ms[NUM_OFFSETS]; extern RAM_ALIGN const Word16 *const bands_offset_lin_7_5ms[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 bands_offset_with_one_max_lin_7_5ms[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 bands_offset_with_two_max_lin_7_5ms[NUM_SAMP_FREQ]; -# endif -#endif extern RAM_ALIGN const Word32 inv_odft_twiddle_80_re[M]; extern RAM_ALIGN const Word32 inv_odft_twiddle_80_im[M]; @@ -335,21 +309,15 @@ extern RAM_ALIGN const Word16 POW_ATT_TABLE1[]; #if PLC2_FADEOUT_IN_MS == 0 extern RAM_ALIGN const Word16 *const POW_ATT_TABLES[3]; #else -#ifdef CR8_A_PLC_FADEOUT_TUNING extern RAM_ALIGN const Word16 fade_scheme_tab_fx[24 / 2][3]; extern RAM_ALIGN const Word16 *const POW_ATT_TABLES[1+24/2]; -#else -extern RAM_ALIGN const Word16 *const POW_ATT_TABLES[11]; -#endif #endif #else extern RAM_ALIGN const Word16 *const POW_ATT_TABLES[3]; #endif -#ifdef CR8_A_PLC_FADEOUT_TUNING extern RAM_ALIGN const Word16 scATHFx[7]; -#endif extern RAM_ALIGN const Word16 e_tot_headroom[]; extern RAM_ALIGN const Word16 xfp_wE_MDCT2FFTQ11[]; @@ -370,12 +338,6 @@ extern RAM_ALIGN const Word16 spec_shape_headroom[]; extern RAM_ALIGN const Word16 rectLengthTab[NUM_SAMP_FREQ]; extern RAM_ALIGN const Word16 hamm_len2Tab[]; -#ifndef CR10_A_ATTENUATION_CURVE_SELECTOR -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH -extern RAM_ALIGN const Word16 FADE_OUT_TYPE_2_ALPHA_5MS[30]; -extern RAM_ALIGN const Word16 FADE_OUT_TYPE_2_ALPHA_2_5MS[60]; -#endif -#endif extern RAM_ALIGN const Word16 gw_len_inv_shift_fx[]; extern RAM_ALIGN const Word16 gwlpr_fx[]; @@ -391,12 +353,8 @@ extern RAM_ALIGN const Word16 *const w_old[]; extern RAM_ALIGN const Word16 COPY_LEN[]; extern RAM_ALIGN const Word16 OLA_LEN[]; -#if defined(CR8_A_PLC_FADEOUT_TUNING) extern const Word16 plc_fadeout_param_maxlen[4]; extern const Word16 plc_fadeout_param_maxbytes[4]; -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR extern RAM_ALIGN const Word16 PLC_FADEOUT_TYPE_2_SELECTOR; -#endif #endif /* CONSTANTS_H */ diff --git a/lib_lc3plus/cutoff_bandwidth.c b/lib_lc3plus/cutoff_bandwidth.c index 8ab047c81..e00aa7a22 100644 --- a/lib_lc3plus/cutoff_bandwidth.c +++ b/lib_lc3plus/cutoff_bandwidth.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/dct2_fx.c b/lib_lc3plus/dct2_fx.c index c301c2aeb..ec7f09c23 100644 --- a/lib_lc3plus/dct2_fx.c +++ b/lib_lc3plus/dct2_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -128,16 +128,8 @@ void dct32_fx(const Word32 *in, Word32 *out) b2 = L_add(a5, a2); b3 = L_add(a4, a3); b4 = L_sub(a3, a4); -#ifdef CR9_C_FIX_DCT2_OVERFLOW b5 = L_sub_sat(a2, a5); -#else - b5 = L_sub(a2, a5); -#endif -#ifdef CR9_C_FIX_DCT2_OVERFLOW b6 = L_sub_sat(a1, a6); -#else - b6 = L_sub(a1, a6); -#endif b7 = L_sub(a0, a7); b8 = L_sub(in[7], in[8]); b9 = L_sub(in[6], in[9]); diff --git a/lib_lc3plus/dct4_fx.c b/lib_lc3plus/dct4_fx.c index dca4e382c..e3bf78e92 100644 --- a/lib_lc3plus/dct4_fx.c +++ b/lib_lc3plus/dct4_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -14,13 +14,11 @@ void dct_IV(Word32 *pDat, /* i/o: pointer to data buffer */ Word16 *pDat_e, /* i/o: pointer to data exponent */ Word16 L, /* i : length of block */ -#ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION # ifdef ENABLE_HR_MODE Word16 hrmode, /* indicate high precision usage */ # endif -#endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ Word32 *workBuffer) /* : size of L */ - + { Word16 sin_step; Word16 idx; @@ -103,7 +101,6 @@ void dct_IV(Word32 *pDat, /* i/o: pointer to data buffer */ FOR (i = 0; i < M2; i += 2) { #ifdef ENABLE_HR_MODE -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION if (hrmode) { cplxMpy32_32_32_2(accu1, accu2, pDat_1[1], pDat_0[0], twiddle[i].v.re, twiddle[i].v.im); cplxMpy32_32_32_2(accu3, accu4, pDat_1[0], pDat_0[1], twiddle[i + 1].v.re, twiddle[i + 1].v.im); @@ -111,11 +108,6 @@ void dct_IV(Word32 *pDat, /* i/o: pointer to data buffer */ cplxMpy32_32_16_2(accu1, accu2, pDat_1[1], pDat_0[0], round_fx_sat(twiddle[i].v.re), round_fx_sat(twiddle[i].v.im)); cplxMpy32_32_16_2(accu3, accu4, pDat_1[0], pDat_0[1], round_fx_sat(twiddle[i + 1].v.re), round_fx_sat(twiddle[i + 1].v.im)); } -# else /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ - cplxMpy32_32_32_2(accu1, accu2, pDat_1[1], pDat_0[0], twiddle[i].v.re, twiddle[i].v.im); - cplxMpy32_32_32_2(accu3, accu4, pDat_1[0], pDat_0[1], twiddle[i + 1].v.re, twiddle[i + 1].v.im); -# endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ - #else cplxMpy32_32_16_2(accu1, accu2, pDat_1[1], pDat_0[0], twiddle[i].v.re, twiddle[i].v.im); cplxMpy32_32_16_2(accu3, accu4, pDat_1[0], pDat_0[1], twiddle[i + 1].v.re, twiddle[i + 1].v.im); @@ -131,13 +123,11 @@ void dct_IV(Word32 *pDat, /* i/o: pointer to data buffer */ } #ifdef ENABLE_DCTIV_RESCALE -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION - if (hrmode) -# endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ + if (hrmode) { - + scale = s_max(getScaleFactor32_lc3plus(pDat, L), 0); move16(); - + FOR (i = 0; i < L; i++) { pDat[i] = L_shl_pos(pDat[i], scale); move32(); diff --git a/lib_lc3plus/dec_entropy.c b/lib_lc3plus/dec_entropy.c index 572438615..dddbc4851 100644 --- a/lib_lc3plus/dec_entropy.c +++ b/lib_lc3plus/dec_entropy.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/dec_lc3.c b/lib_lc3plus/dec_lc3.c index 1b23927c6..fc01373d5 100644 --- a/lib_lc3plus/dec_lc3.c +++ b/lib_lc3plus/dec_lc3.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -214,21 +214,15 @@ static int Dec_LC3PLUS_Channel(LC3PLUS_Dec *decoder, int channel, int bits_per_s Word16 max_bw_stopband = BW_cutoff_bin_all[BW_cutoff_idx]; SWITCH (decoder->frame_dms) { -#ifdef ENABLE_025_DMS_MODE case 25: max_bw_stopband = shr_pos(max_bw_stopband, 2); BREAK; -#endif -#ifdef ENABLE_050_DMS_MODE case 50: max_bw_stopband = shr_pos(max_bw_stopband, 1); BREAK; -#endif -#ifdef CR8_G_ADD_75MS case 75: max_bw_stopband = add(shr_pos(max_bw_stopband, 2), add(shr_pos(max_bw_stopband, 2), shr_pos(max_bw_stopband, 2))); BREAK; -#endif case 100: BREAK; } @@ -425,12 +419,8 @@ static int Dec_LC3PLUS_Channel(LC3PLUS_Dec *decoder, int channel, int bits_per_s #ifdef ENABLE_HR_MODE , decoder->hrmode #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , h_DecSetup->rel_pitch_change -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR , decoder->alpha_type_2_table -#endif ); #ifdef WMOPS pop_wmops(); @@ -457,9 +447,7 @@ static int Dec_LC3PLUS_Channel(LC3PLUS_Dec *decoder, int channel, int bits_per_s h_DecSetup->ltpf_mem_pitch_int, ltpf_idx[0], q_d_fx, &q_fx_exp, h_DecSetup->q_old_d_fx, &h_DecSetup->q_old_fx_exp, decoder->yLen, h_DecSetup->plcAd->stab_fac, decoder->frame_dms, &h_DecSetup->plcAd->cum_fading_slow, &h_DecSetup->plcAd->cum_fading_fast, spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , h_DecSetup->plcAd->plc_fadeout_type -#endif ); } #ifdef WMOPS @@ -529,9 +517,7 @@ static int Dec_LC3PLUS_Channel(LC3PLUS_Dec *decoder, int channel, int bits_per_s &h_DecSetup->ltpf_mem_active, h_DecSetup->ltpf_scale_fac_idx, bfi, h_DecSetup->concealMethod, h_DecSetup->plc_damping, &h_DecSetup->ltpf_mem_scale_fac_idx, -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH &h_DecSetup->rel_pitch_change, decoder->hrmode, decoder->frame_dms, -#endif currentScratch); #ifdef WMOPS pop_wmops(); @@ -656,7 +642,10 @@ LC3PLUS_Error Dec_LC3PLUS(LC3PLUS_Dec *decoder, UWord8 *input, int num_bytes, vo } bfi = Dec_LC3PLUS_Channel(decoder, ch, bits_per_sample, input, output[ch], bfi, scratch); - input += decoder->channel_setup[ch]->targetBytes; + if (input != NULL) + { + input += decoder->channel_setup[ch]->targetBytes; + } } } else @@ -697,7 +686,10 @@ LC3PLUS_Error Dec_LC3PLUS(LC3PLUS_Dec *decoder, UWord8 *input, int num_bytes, vo channel_bfi = 1; } - input = input + np_zero; + if (input != NULL) + { + input = input + np_zero; + } decoder->n_pc = s_max(decoder->n_pc - (2 * np_zero), 0); if (channel_bfi == 2) @@ -735,7 +727,10 @@ LC3PLUS_Error Dec_LC3PLUS(LC3PLUS_Dec *decoder, UWord8 *input, int num_bytes, vo channel_bfi = Dec_LC3PLUS_Channel(decoder, ch, bits_per_sample, input, output[ch], channel_bfi, scratch); out_bfi |= channel_bfi; - input += fec_num_bytes; + if (input != NULL) + { + input += fec_num_bytes; + } } bfi = out_bfi & 1; @@ -780,7 +775,10 @@ LC3PLUS_Error Dec_LC3PLUS(LC3PLUS_Dec *decoder, UWord8 *input, int num_bytes, vo } bfi = Dec_LC3PLUS_Channel(decoder, ch, bits_per_sample, input, output[ch], bfi, scratch); - input += decoder->channel_setup[ch]->targetBytes; + if (input != NULL) + { + input += decoder->channel_setup[ch]->targetBytes; + } } } diff --git a/lib_lc3plus/defines.h b/lib_lc3plus/defines.h index 2d280620f..1075c9ec8 100644 --- a/lib_lc3plus/defines.h +++ b/lib_lc3plus/defines.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -74,10 +74,6 @@ #define FRAME_MS_BLOCK 25 /* OPTIONS */ -#define ENABLE_2_5MS_MODE -#define ENABLE_5MS_MODE -#define ENABLE_075_DMS_MODE -#define ENABLE_10_MS_MODE #define ENABLE_ADVANCED_PLC #define ENABLE_ADVANCED_PLC_DEFAULT #define ENABLE_BW_CONTROLLER @@ -92,43 +88,11 @@ #define ENABLE_EP_MODE_FLAG #define ENABLE_FRAME_MS_FLAG -#define CR8_A_PLC_FADEOUT_TUNING /* Adapt PLC fadeout to avoid gaps in signal */ -#define CR8_E_TONE_DETECTOR /* Tone detector for hrmode to deactivate TNS - improves SNR and THD+N */ -#define CR8_F_ADAPT_MDCT_DCT_PRECISION -#define CR8_G_ADD_75MS - - -#define CR9_B_FIX_MDCT_OVERFLOW /* Fix overflow */ -#define CR9_C_FIX_DCT2_OVERFLOW /* Fix overflow */ - -#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 -# define CR10_A_ATTENUATION_CURVE_SELECTOR -# ifdef CR10_A_ATTENUATION_CURVE_SELECTOR -# 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 -#define CR9_M_FIX_DIV_ZERO - #ifndef NO_POST_REL_CHANGES /* Post-release non-bitexact changes */ -#define CR11_A_FIX_IN_PLC_LONGTERM_STATISTIC - #endif /* NO_POST_REL_CHANGES Post-release changes */ -#ifdef CR8_A_PLC_FADEOUT_TUNING -# 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 @@ -141,31 +105,8 @@ # 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 6710886 /* 0.2 * 2^25 */ -# define SHIFT1_FADEOUT 25-15 /* 25 - 16 */ -# define FAC2_FADEOUT 50331648 /* 1.5 * 2^25 */ -# define SHIFT2_FADEOUT 25-15 /* 25 - 16 */ -# define FAC3_FADEOUT 58720256 /* 1.75 * 2^25 */ -# define SHIFT3_FADEOUT 25-15 /* 25 - 16 */ -# endif # define PLC_LONGTERM_ANALYSIS_MS 200 /* Nominal analysis window 2000 ms */ # define PLC_LONGTERM_ANALYSIS_STARTUP_FILL (Word16)(0.5*32768.0) /* 16384/32768 == 0.5 required buffer fill amount, set to 0.0 to not require any fill at all */ -#endif /* CR8_A_PLC_FADEOUT_TUNING */ #define REL_PITCH_THRESH 11796 @@ -240,7 +181,6 @@ do not change __forceinline for mex compilation using gcc6.3.0 or larger # define MAX_BR_100DMS_SSWB 314400 /* for 100ms at 24kHz */ # endif -#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) */ @@ -251,7 +191,6 @@ do not change __forceinline for mex compilation using gcc6.3.0 or larger # define NOISEFILLWIDTH_7_5MS 2 # define NOISEFILLSTART_7_5MS 18 -#endif #define PACK_RESBITS @@ -415,12 +354,8 @@ do not change __forceinline for mex compilation using gcc6.3.0 or larger #define LTPF_MEM_Y_LEN (MAX_LEN + CEILING(MAX_PITCH_12K8 * MAX_LEN, 128) + (MAX_LEN / 80)) /* PLC */ -#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 */ - -# ifdef CR8_A_PLC_FADEOUT_TUNING +#define PLC_FADEOUT_TYPE_1_IN_MS 200 +#define PLC_FADEOUT_IN_MS 60 /* fade-out to zero in ms for TD-PLC and NS, minimum value is 20 */ /* table settings */ # define PLC2_FADEOUT_IN_MS_MIN 30 /* table min */ # define PLC2_FADEOUT_IN_MS_MAX 140 /* table max */ @@ -433,11 +368,6 @@ do not change __forceinline for mex compilation using gcc6.3.0 or larger 30..140 will use a separate settings for PLC2 fadeout 30: P800 short fade optimization 120: Mushra optimized fade */ -#else -# define PLC2_FADEOUT_IN_MS 30 /* 0 uses original fixed values for PLC2 - -1 uses PLC_FADEOUT_IN_MS as basis for a PLC2 macro-re-calculation - 30..100 uses separate setting for PLC2 */ -#endif @@ -446,9 +376,7 @@ do not change __forceinline for mex compilation using gcc6.3.0 or larger #define PLC34_ATTEN_FAC_100_FX 0x4000 /* attenuation factor for NS and TDC @ 10 ms (0.5000)*/ #define PLC34_ATTEN_FAC_050_FX 0x5A83 /* attenuation factor for NS and TDC @ 5.0 ms (0.7071)*/ #define PLC34_ATTEN_FAC_025_FX 0x6BA3 /* attenuation factor for NS and TDC @ 2.5 ms (0.8409)*/ -#ifdef CR8_G_ADD_75MS #define PLC34_ATTEN_FAC_075_FX 0x4C1C /* attenuation factor for NS and TDC @ 7.5 ms (0.5946) */ -#endif #define PLC3_HPBLENDTHROTTLE 30 /* higher numbers increase throttled blending from hp filtered to unfiltered uv excitation (0 is no throttle) */ #define MAX_PITCH_8K (CEILING((MAX_PITCH_12K8 * 8000), (12800))) /*NB was a risky MACRO at 0.5 border !!, */ diff --git a/lib_lc3plus/detect_cutoff_warped_fx.c b/lib_lc3plus/detect_cutoff_warped_fx.c index adbf04afa..a329a48f6 100644 --- a/lib_lc3plus/detect_cutoff_warped_fx.c +++ b/lib_lc3plus/detect_cutoff_warped_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -40,13 +40,11 @@ void processDetectCutoffWarped_fx(Word16 *bw_idx, Word32 *d2_fx, Word16 d2_fx_ex warp_idx_stop = BW_warp_idx_stop_all_5ms[fs_idx - 1]; move16(); bw_brickwall_dist = BW_brickwall_dist_5ms; BREAK; -#ifdef CR8_G_ADD_75MS case 75: warp_idx_start = BW_warp_idx_start_all_7_5ms[fs_idx - 1]; move16(); warp_idx_stop = BW_warp_idx_stop_all_7_5ms[fs_idx - 1]; move16(); bw_brickwall_dist = BW_brickwall_dist_7_5ms; BREAK; -#endif default: /* 100 */ warp_idx_start = BW_warp_idx_start_all[fs_idx - 1]; move16(); warp_idx_stop = BW_warp_idx_stop_all[fs_idx - 1]; move16(); diff --git a/lib_lc3plus/dynmem.c b/lib_lc3plus/dynmem.c index 65e157d0a..9756b123b 100644 --- a/lib_lc3plus/dynmem.c +++ b/lib_lc3plus/dynmem.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/dynmem.h b/lib_lc3plus/dynmem.h index e81169a33..b92fcd2a7 100644 --- a/lib_lc3plus/dynmem.h +++ b/lib_lc3plus/dynmem.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/enc_entropy.c b/lib_lc3plus/enc_entropy.c index 35dd8d950..c4930fd16 100644 --- a/lib_lc3plus/enc_entropy.c +++ b/lib_lc3plus/enc_entropy.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/enc_lc3.c b/lib_lc3plus/enc_lc3.c index f2276a2ed..a5b8fabfd 100644 --- a/lib_lc3plus/enc_lc3.c +++ b/lib_lc3plus/enc_lc3.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -56,10 +56,8 @@ static void Enc_LC3PLUS_Channel(LC3PLUS_Enc *encoder, int channel, int bits_per_ h_EncSetup = encoder->channel_setup[channel]; #ifdef ENABLE_HR_MODE -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION hrmode = encoder->hrmode; -# endif -#endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ +#endif #ifdef WMOPS push_wmops("Encoder"); @@ -168,9 +166,7 @@ static void Enc_LC3PLUS_Channel(LC3PLUS_Enc *encoder, int channel, int bits_per_ /* currentScratch Size = 4 * MAX_LEN */ processMdct_fx(s_in_scaled, h_EncSetup->x_exp, encoder->frame_length, #ifdef ENABLE_HR_MODE -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION hrmode, -# endif #endif encoder->W_fx, encoder->W_size, h_EncSetup->stEnc_mdct_mem, encoder->stEnc_mdct_mem_len, d_fx, &d_fx_exp, currentScratch); @@ -208,9 +204,7 @@ static void Enc_LC3PLUS_Channel(LC3PLUS_Enc *encoder, int channel, int bits_per_ /* currentScratch Size = 392 bytes */ process_olpa_fx(&h_EncSetup->olpa_mem_s6k4_exp, h_EncSetup->olpa_mem_s12k8, h_EncSetup->olpa_mem_s6k4, &pitch, s_12k8, s_12k8_len, &normcorr, &h_EncSetup->olpa_mem_pitch, -#ifdef CR9_F_PITCH_WIN_LEN_FIX - &h_EncSetup->pitch_flag, -#endif + &h_EncSetup->pitch_flag, h_EncSetup->resamp_exp, encoder->frame_dms, currentScratch); #ifdef WMOPS pop_wmops(); @@ -224,10 +218,8 @@ static void Enc_LC3PLUS_Channel(LC3PLUS_Enc *encoder, int channel, int bits_per_ h_EncSetup->ltpf_mem_in, encoder->ltpf_mem_in_len, ltpf_idx, s_12k8, s_12k8_len, &h_EncSetup->ltpf_mem_normcorr, &h_EncSetup->ltpf_mem_mem_normcorr, normcorr, &h_EncSetup->ltpf_mem_ltpf_on, &h_EncSetup->ltpf_mem_pitch, h_EncSetup->resamp_exp, - encoder->frame_dms, currentScratch -#ifdef CR9_K_REDUCE_NORM_CORR_TH - ,encoder->hrmode -#endif + encoder->frame_dms, currentScratch, + encoder->hrmode ); #ifdef WMOPS pop_wmops(); @@ -268,12 +260,8 @@ static void Enc_LC3PLUS_Channel(LC3PLUS_Enc *encoder, int channel, int bits_per_ /* Near Nyquist Detector */ processNearNyquistdetector_fx(&encoder->near_nyquist_flag, encoder->fs_idx, encoder->near_nyquist_index, encoder->bands_number, ener_fx, ener_fx_exp -#ifdef CR8_E_TONE_DETECTOR #ifdef ENABLE_HR_MODE , encoder->frame_dms, encoder->hrmode ); -#else - ); -#endif #else ); #endif diff --git a/lib_lc3plus/estimate_global_gain_fx.c b/lib_lc3plus/estimate_global_gain_fx.c index c6d1766b4..8d0c54ded 100644 --- a/lib_lc3plus/estimate_global_gain_fx.c +++ b/lib_lc3plus/estimate_global_gain_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -272,9 +272,7 @@ void processEstimateGlobalGain_fx(Word32 x[], Word16 x_e, Word16 lg, Word16 nbit { case 25: mult_factor = 1311; break; case 50: mult_factor = 655; break; -#ifdef CR8_G_ADD_75MS case 75: mult_factor = 437; break; -#endif case 100: mult_factor = 328; break; } diff --git a/lib_lc3plus/fft_lc3plus.c b/lib_lc3plus/fft_lc3plus.c index 6db6de7bb..e235f7eea 100644 --- a/lib_lc3plus/fft_lc3plus.c +++ b/lib_lc3plus/fft_lc3plus.c @@ -1,12 +1,12 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* 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 "functions.h" #include "rom_basop_util_lc3plus.h" @@ -32,10 +32,8 @@ #define Mpy_32_xx Mpy_32_16_lc3plus #endif -#ifdef CR8_G_ADD_75MS #define SCALEFACTOR6 4 #define C61_32 (0x6ed9eba1) -#endif #define SCALEFACTOR10 5 #define SCALEFACTOR16 5 @@ -59,9 +57,7 @@ #define SCALEFACTOR384 11 #ifdef ENABLE_HR_MODE -#ifdef CR8_G_ADD_75MS #define SCALEFACTOR360 11 -#endif #ifndef ENABLE_FFT_30X16 #define SCALEFACTOR480 10 #else @@ -353,7 +349,6 @@ static void fft5(Word32 *re, Word32 *im, Word16 s) * \return void */ -#ifdef CR8_G_ADD_75MS static void fft6(Word32 *re, Word32 *im, Word16 st) { Dyn_Mem_Deluxe_In(Word32 x0, x1, x2, x3, x4, x5; Word32 r1o, r2o, i1e, i2e, i1o, i2o; Word32 t, s;); @@ -463,7 +458,6 @@ static void fft6(Word32 *re, Word32 *im, Word16 st) Dyn_Mem_Deluxe_Out(); } -#endif /** * \brief Function performs a complex 8-point FFT @@ -1083,9 +1077,7 @@ static void fft15(Word32 *re, Word32 *im, Word16 s) Dyn_Mem_Deluxe_Out(); } - -#ifdef CR8_G_ADD_75MS - + #define STC(x) (x) const Word32 RotVectorReal12[] = { @@ -1104,7 +1096,7 @@ const Word32 RotVectorImag12[] = STC(0x7fffffff), STC(0x00000000), #endif }; - + static void fft12(Word32 *pInput) { Dyn_Mem_Deluxe_In(Word32 aDst[24]; Word32 * pSrc, *pDst; Counter i; Word32 r1, r2, s1, s2, pD; Word32 re, im; @@ -1141,7 +1133,7 @@ static void fft12(Word32 *pInput) pDst[5] = L_sub(s1, r2); pSrc += 2; pDst += 6; - + const Word32 *pVecRe = RotVectorReal12; const Word32 *pVecIm = RotVectorImag12; @@ -1176,7 +1168,7 @@ static void fft12(Word32 *pInput) vre = *pVecRe++; vim = *pVecIm++; cplxMpy_32_32(&pDst[3], &pDst[2], im, re, vre, vim); - + re = L_add(r1, s2); im = L_sub(s1, r2); @@ -1259,161 +1251,6 @@ static void fft12(Word32 *pInput) Dyn_Mem_Deluxe_Out(); } -#else /* CR8_G_ADD_75MS */ - -static void fft12(Word32 *pInput) -{ - Dyn_Mem_Deluxe_In(Word32 aDst[24]; Word32 * pSrc, *pDst; Counter i; Word32 r1, r2, s1, s2, pD; Word32 re, im; - Word16 vre, vim;); - - pSrc = pInput; - move16(); - pDst = aDst; - move16(); - - /* First 3*2 samples are shifted right by 2 before output */ - r1 = L_add(L_shr_pos(pSrc[8], 2), L_shr_pos(pSrc[16], 2)); - r2 = Mpy_32_xx(L_sub(L_shr_pos(pSrc[8], 2), L_shr_pos(pSrc[16], 2)), C31); - pD = L_shr_pos(pSrc[0], 2); - pDst[0] = L_shr_pos(L_add(pD, r1), 1); - r1 = L_sub(pD, L_shr_pos(r1, 1)); - - /* imaginary part */ - s1 = L_add(L_shr_pos(pSrc[9], 2), L_shr_pos(pSrc[17], 2)); - s2 = Mpy_32_xx(L_sub(L_shr_pos(pSrc[9], 2), L_shr_pos(pSrc[17], 2)), C31); - pD = L_shr_pos(pSrc[1], 2); - pDst[1] = L_shr_pos(L_add(pD, s1), 1); - s1 = L_sub(pD, L_shr_pos(s1, 1)); - - r1 = L_shr_pos(r1, 1); - r2 = L_shr_pos(r2, 1); - s1 = L_shr_pos(s1, 1); - s2 = L_shr_pos(s2, 1); - - /* combination */ - pDst[2] = L_sub(r1, s2); - pDst[3] = L_add(s1, r2); - pDst[4] = L_add(r1, s2); - pDst[5] = L_sub(s1, r2); - pSrc += 2; - pDst += 6; - - vre = add(0x6eda, 0); - vim = add(0x4000, 0); - - FOR (i = 0; i < 2; i++) - { - /* sample 0,1 are shifted right by 2 before output */ - /* sample 2,3 4,5 are shifted right by 1 and complex multiplied before output */ - - r1 = L_add(L_shr_pos(pSrc[8], 2), L_shr_pos(pSrc[16], 2)); - r2 = Mpy_32_xx(L_sub(L_shr_pos(pSrc[8], 2), L_shr_pos(pSrc[16], 2)), C31); - pD = L_shr_pos(pSrc[0], 2); - pDst[0] = L_shr_pos(L_add(pD, r1), 1); - r1 = L_sub(pD, L_shr_pos(r1, 1)); - - /* imaginary part */ - s1 = L_add(L_shr_pos(pSrc[9], 2), L_shr_pos(pSrc[17], 2)); - s2 = Mpy_32_xx(L_sub(L_shr_pos(pSrc[9], 2), L_shr_pos(pSrc[17], 2)), C31); - pD = L_shr_pos(pSrc[1], 2); - pDst[1] = L_shr_pos(L_add(pD, s1), 1); - s1 = L_sub(pD, L_shr_pos(s1, 1)); - - r1 = L_shr_pos(r1, 1); - r2 = L_shr_pos(r2, 1); - s1 = L_shr_pos(s1, 1); - s2 = L_shr_pos(s2, 1); - - /* combination */ - re = L_sub(r1, s2); - im = L_add(s1, r2); - cplxMpy_32_16(&pDst[3], &pDst[2], im, re, vre, vim); - re = L_add(r1, s2); - im = L_sub(s1, r2); - vre = add(0x4000, 0); - if (i == 1) - vre = negate(vre); /* 0xC000 */ - if (i == 0) - vim = add(0x6eda, 0); - cplxMpy_32_16(&pDst[5], &pDst[4], im, re, vre, vim); - - pDst += 6; - pSrc += 2; - } - /* sample 0,1 are shifted right by 2 before output */ - /* sample 2,3 is shifted right by 1 and complex multiplied with (0.0,+1.0) */ - /* sample 4,5 is shifted right by 1 and complex multiplied with (-1.0,0.0) */ - r1 = L_add(L_shr_pos(pSrc[8], 2), L_shr_pos(pSrc[16], 2)); - r2 = Mpy_32_xx(L_sub(L_shr_pos(pSrc[8], 2), L_shr_pos(pSrc[16], 2)), C31); - pD = L_shr_pos(pSrc[0], 2); - pDst[0] = L_shr_pos(L_add(pD, r1), 1); - r1 = L_sub(pD, L_shr_pos(r1, 1)); - - /* imaginary part */ - s1 = L_add(L_shr_pos(pSrc[9], 2), L_shr_pos(pSrc[17], 2)); - s2 = Mpy_32_xx(L_sub(L_shr_pos(pSrc[9], 2), L_shr_pos(pSrc[17], 2)), C31); - pD = L_shr_pos(pSrc[1], 2); - pDst[1] = L_shr_pos(L_add(pD, s1), 1); - s1 = L_sub(pD, L_shr_pos(s1, 1)); - - r1 = L_shr_pos(r1, 1); - r2 = L_shr_pos(r2, 1); - s1 = L_shr_pos(s1, 1); - s2 = L_shr_pos(s2, 1); - - /* combination */ - - pDst[2] = L_add(s1, r2); - move32(); - pDst[3] = L_sub(s2, r1); - move32(); - pDst[4] = L_negate(L_add(r1, s2)); - move32(); - pDst[5] = L_sub(r2, s1); - move32(); - /* Perform 3 times the fft of length 4. The input samples are at the address of aDst and the - output samples are at the address of pInput. The input vector for the fft of length 4 is built - of the interleaved samples in aDst, the output samples are stored consecutively at the address - of pInput. - */ - move16(); - move16(); - pSrc = aDst; - pDst = pInput; - FOR (i = 0; i < 3; i++) - { - /* inline FFT4 merged with incoming resorting loop */ - r1 = L_add(L_shr_pos(pSrc[0], 2), L_shr_pos(pSrc[12], 2)); /* Re A + Re B */ - r2 = L_add(L_shr_pos(pSrc[6], 2), L_shr_pos(pSrc[18], 2)); /* Re C + Re D */ - s1 = L_add(L_shr_pos(pSrc[1], 2), L_shr_pos(pSrc[13], 2)); /* Im A + Im B */ - s2 = L_add(L_shr_pos(pSrc[7], 2), L_shr_pos(pSrc[19], 2)); /* Im C + Im D */ - - pDst[0] = L_add(r1, r2); /* Re A' = Re A + Re B + Re C + Re D */ - pDst[1] = L_add(s1, s2); /* Im A' = Im A + Im B + Im C + Im D */ - - re = L_sub(r1, L_shr_pos(pSrc[12], 1)); /* Re A - Re B */ - im = L_sub(s1, L_shr_pos(pSrc[13], 1)); /* Im A - Im B */ - - pDst[12] = L_sub(r1, r2); /* Re C' = Re A + Re B - Re C - Re D */ - pDst[13] = L_sub(s1, s2); /* Im C' = Im A + Im B - Im C - Im D */ - - r2 = L_sub(r2, L_shr_pos(pSrc[18], 1)); /* Re C - Re D */ - s2 = L_sub(s2, L_shr_pos(pSrc[19], 1)); /* Im C - Im D */ - - pDst[6] = L_add(re, s2); /* Re B' = Re A - Re B + Im C - Im D */ - pDst[18] = L_sub(re, s2); /* Re D' = Re A - Re B - Im C + Im D */ - pDst[7] = L_sub(im, r2); /* Im B' = Im A - Im B - Re C + Re D */ - pDst[19] = L_add(im, r2); /* Im D' = Im A - Im B + Re C - Re D */ - - pSrc += 2; - pDst += 2; - } - - Dyn_Mem_Deluxe_Out(); -} - -#endif - /** * \brief Function performs a complex 16-point FFT * The FFT is performed inplace. The result of the FFT @@ -3766,7 +3603,7 @@ static void fftN2(Word32 *re, Word32 *im, { fft15(&x[i * 2 * dim1], &x[i * 2 * dim1 + 1], 2); } - + BREAK; case 16: FOR (i = 0; i < dim2; i++) @@ -3808,7 +3645,7 @@ static void fftN2(Word32 *re, Word32 *im, #endif default: ASSERT(0); } - + #ifdef ENABLE_FFT_RESCALE IF (scale) { @@ -3878,11 +3715,10 @@ static void fftN2(Word32 *re, Word32 *im, im[sx * i + sx * 3 * dim1] = L_add(t03, t07); move32(); } - + BREAK; } -#ifdef CR8_G_ADD_75MS case 6: { Word32 y[2 * 10]; @@ -3926,8 +3762,7 @@ static void fftN2(Word32 *re, Word32 *im, } BREAK; } -#endif - + case 8: { Word32 x00, x01, x02, x03, x04, x05, x06, x07, x08, x09, x10, x11, x12, x13, x14, x15; @@ -4084,7 +3919,7 @@ static void fftN2(Word32 *re, Word32 *im, } BREAK; } - + #if defined(ENABLE_HR_MODE) case 16: { @@ -4093,7 +3928,7 @@ static void fftN2(Word32 *re, Word32 *im, { cplxMpy4_16_1(y[2 * j], y[2 * j + 1], x[2 * 0 + 2 * j * dim1], x[2 * 0 + 2 * j * dim1 + 1]); } - + fft16(&y[0], &y[1], 2); FOR (j = 0; j < dim2; j++) { @@ -4321,19 +4156,17 @@ void BASOP_cfft_lc3plus(Word32 *re, Word32 *im, Word16 length, Word16 s, Word16 move16(); BREAK; #ifdef ENABLE_HR_MODE -#ifdef CR8_G_ADD_75MS case 360: fftN2(re, im, RotVector_720, 30, 12, s, 2, 60, scratch, &fftN2scale); *scale = add(*scale, SCALEFACTOR360); move16(); *scale = sub(*scale, fftN2scale); move16(); BREAK; -#endif case 480: #ifndef ENABLE_FFT_RESCALE #ifndef ENABLE_FFT_30X16 fftN2(re, im, RotVector_960, 60, 8, s, 2, 120, scratch); #else - fftN2(re, im, RotVector_30_16, 30, 16, s, 2, 60, scratch); + fftN2(re, im, RotVector_30_16, 30, 16, s, 2, 60, scratch); #endif *scale = add(*scale, SCALEFACTOR480); move16(); #else diff --git a/lib_lc3plus/functions.h b/lib_lc3plus/functions.h index 940c58da7..1bef16747 100644 --- a/lib_lc3plus/functions.h +++ b/lib_lc3plus/functions.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -118,11 +118,9 @@ void processMdct_fx( Word16 x[], #endif Word16 x_exp, Word16 N, -#ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION # ifdef ENABLE_HR_MODE Word16 hrmode, /* i: indicate high precision */ # endif -#endif #ifdef ENABLE_HR_MODE const Word32 w[], /* i: window coefficients including normalization of sqrt(2/N) and scaled by 2^4 */ #else @@ -165,11 +163,7 @@ void ProcessingIMDCT(Word32 y[], Word16 *y_e, ); #ifdef ENABLE_HR_MODE -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION void dct_IV(Word32 *pDat, Word16 *pDat_e, Word16 L, Word16 hrmode, Word32 *workBuffer); -# else /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ -void dct_IV(Word32 *pDat, Word16 *pDat_e, Word16 L, Word32 *workBuffer); -# endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ #else void dct_IV(Word32 *pDat, Word16 *pDat_e, Word16 L, Word32 *workBuffer); #endif @@ -291,15 +285,11 @@ void processPerBandEnergy_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word32 *d_fx, Wor void processNearNyquistdetector_fx(Word16 *near_nyquist_flag, const Word16 fs_idx, const Word16 near_nyquist_index, const Word16 bands_number, const Word32 *ener_fx, const Word16 ener_fx_exp -#ifdef CR8_E_TONE_DETECTOR #ifdef ENABLE_HR_MODE , Word16 frame_dms , Word16 hrmode); #else ); #endif -#else - ); -#endif void processDetectCutoffWarped_fx(Word16 *bw_idx, Word32 *d2_fx, Word16 d2_fx_exp, Word16 fs_idx, Word16 frame_dms); void process_resamp12k8_fx(Word16 x[], Word16 x_len, Word16 mem_in[], Word16 mem_in_len, Word32 mem_50[], @@ -310,18 +300,14 @@ void process_resamp12k8_fx(Word16 x[], Word16 x_len, Word16 mem_in[], Word16 mem void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[], Word16 *pitch, Word16 *s12k8, Word16 len, Word16 *normcorr, Word16 *mem_pitch, -#ifdef CR9_F_PITCH_WIN_LEN_FIX - Word16 *pitch_flag, -#endif + Word16 *pitch_flag, Word16 s12k8_exp, Word16 frame_dms, Word8 *scratchBuffer); void process_ltpf_coder_fx(Word16 *bits, Word16 ol_pitch, Word16 ltpf_enable, Word16 *old_wsp_exp, Word16 *old_wsp, Word16 old_wsplen, Word16 *param, Word16 *wsp, Word16 len, Word16 *mem_normcorr, Word16 *mem_mem_normcorr, Word16 ol_normcorr, Word16 *mem_ltpf_on, Word16 *mem_ltpf_pitch, Word16 wsp_exp, Word16 frame_dms, Word8 *scratchBuffer -#ifdef CR9_K_REDUCE_NORM_CORR_TH - ,Word16 hrmode -#endif + , Word16 hrmode ); void process_ltpf_decoder_fx(Word16 *x_e, Word16 L_frame, Word16 old_x_len, Word16 fs_idx, Word16 old_y_len, @@ -330,9 +316,7 @@ void process_ltpf_decoder_fx(Word16 *x_e, Word16 L_frame, Word16 old_x_len, Word Word16 *old_gain, Word16 *mem_ltpf_active, Word16 scale_fac_idx, Word16 bfi, Word16 concealMethod, Word16 damping, Word16 *old_scale_fac_idx, -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH Word32 *rel_pitch_change, Word16 hrmode, Word16 frame_dms, -#endif Word8 *scratchBuffer); void attack_detector_fx(LC3PLUS_Enc *enc, EncSetup *setup, Word16 *input, Word16 input_scaling, void *scratch); @@ -386,12 +370,8 @@ void processPLCmain_fx(Word16 plcMeth, Word16 *concealMethod, Word16 *nbLostFram #ifdef ENABLE_HR_MODE , Word16 hrmode #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , Word32 rel_pitch_change -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR , Word16 *alpha_type_2_table -#endif ); void processPLCupdate_fx(AplcSetup *plcAd, Word16 x_fx[], Word16 q_fx_exp, Word16 concealMethod, Word16 frame_length, @@ -423,11 +403,7 @@ void processPLCclassify_fx(Word16 plcMeth, Word16 *concealMethod, Word16 *nbLost ); void processPLCapply_fx( -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 *concealMethod, -#else - Word16 concealMethod, -#endif Word16 nbLostFramesInRow, Word16 bfi, Word16 prev_bfi, Word16 frame_length, Word16 la_zeroes, #ifdef ENABLE_HR_MODE @@ -443,13 +419,8 @@ void processPLCapply_fx( #ifdef ENABLE_HR_MODE , Word16 hrmode #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , Word32 rel_pitch_change - -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR , Word16 *alpha_type_2_table -#endif ); void processPLCNoiseSubstitution_fx(Word32 spec[], Word16 spec_prev[], Word16 L_spec); @@ -458,17 +429,13 @@ void processPLCDampingScrambling_main_fx(Word16 bfi, Word16 concealMethod, Word1 Word16 pitch_present_bfi2, Word32 spec[], Word16 *q_fx_exp, Word16 *q_old_d_fx, Word16 *q_old_fx_exp, Word16 L_spec, Word16 stabFac, Word16 frame_dms, Word16 *cum_fading_slow, Word16 *cum_fading_fast, Word16 spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , UWord8 plc_fadeout_type -#endif ); void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostFramesInRow, Word16 stabFac, Word16 processDampScramb, Word16 *cum_fflcAtten, Word16 pitch_present, Word16 frame_dms, Word16 *cum_fading_slow, Word16 *cum_fading_fast, Word16 *seed, Word16 spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , UWord8 plc_fadeout_type -#endif ); void processLagwin_fx(Word32 r[], const Word32 w[], Word16 m); @@ -500,12 +467,8 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 Word16 *alpha, Word16 max_len_pcm_plc, Word16 harmonicBuf_fx[MAX_PITCH], Word16 synthHist_fx[M], Word16 *const harmonicBuf_Q, Word8 *scratchBuffer -#ifdef CR9_I_INC_TDC_FADEOUT_LEN - ,UWord8 plc_fadeout_type -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR - ,Word16 *alpha_type_2_table -#endif + , UWord8 plc_fadeout_type + , Word16 *alpha_type_2_table ); void processTdac_fx(Word16 *ola_mem, Word16 *ola_mem_exp, const Word16 *synth, const Word16 synth_exp, @@ -568,10 +531,8 @@ void trans_burst_ana_fx(const Word16 *xfp, /* i : Input signal Word16 Q_spec, Word32 L_oold_xfp_w_E_fx, Word16 oold_xfp_w_E_exp_fx, Word16 oold_Ltot_exp_fx, Word16 *oold_grp_shape_fx, Word32 L_old_xfp_w_E_fx, Word16 old_xfp_w_E_exp_fx, Word16 old_Ltot_exp_fx, Word16 *old_grp_shape_fx, -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 fadeout, Word32 *L_Xavg, /* full scale average band amplitudes */ -#endif Word8 *scratchBuffer); void spec_ana_fx(Word16 *xfp, Word16 *, Word32 *, Word16 *, Word16 *, const Word16, const Word16, @@ -579,11 +540,9 @@ void spec_ana_fx(Word16 *xfp, Word16 *, Word32 *, Word16 *, Word16 *, const Word void subst_spec_fx(const Word16 *, const Word32 *, Word16 *, const Word16, Word16 *, const Word16 *, const Word16, const Word16 *, const Word16, Word16 *, const Word16 *, const Word16 *, const Word16 *, const Word16 -#ifdef CR8_A_PLC_FADEOUT_TUNING ,const Word16, Word16*, const Word32 * -#endif ); void rec_frame_fx(Word16 * X, /* i : FFT spectrum */ @@ -631,10 +590,8 @@ void hq_phase_ecu_fx(const Word16 *prevsynth, /* i : buffer of previously synth Word16 *old_grp_shape_fx, Word16 margin_prev_synth, /* i: margin in prev_synth(16ms for first bfi , 3.75 ms for other bfi frames ) , from plcAd.PhECU_margin_xfp */ -#ifdef CR8_A_PLC_FADEOUT_TUNING const Word16 fadeout, /*i: fadeout length indicator */ Word16 *nonpure_tone_flag_ptr, /* i/o : non-pure single tone indicator state */ -#endif Word8 *scratchBuffer /* Size = 2 * MAX_LGW + 8 * MAX_LPROT + 12 * MAX_L_FRAME */ ); @@ -829,9 +786,6 @@ LC3PLUS_Error Dec_LC3PLUS(LC3PLUS_Dec *decoder, UWord8 *input, int input_bytes, void *balloc(void *base, size_t *base_size, size_t size); -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR Word16 type_2_fadeout_fx(Word16 nbLostFramesInRow, Word16 frame_dms); -#endif - #endif diff --git a/lib_lc3plus/imdct_fx.c b/lib_lc3plus/imdct_fx.c index 50ad2b257..8fdf06671 100644 --- a/lib_lc3plus/imdct_fx.c +++ b/lib_lc3plus/imdct_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -88,11 +88,9 @@ void ProcessingIMDCT( case 50: max_bw = MAX_BW >> 1; move16(); BREAK; -#ifdef CR8_G_ADD_75MS case 75: max_bw = (MAX_BW >> 2) * 3; move16(); BREAK; -#endif case 100: max_bw = MAX_BW; move16(); BREAK; @@ -113,9 +111,7 @@ void ProcessingIMDCT( *y_e = sub(*y_e, y_s); #ifdef ENABLE_HR_MODE dct_IV(y, y_e, N, -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION hrmode, -# endif workBuffer); #else dct_IV(y, y_e, N, workBuffer); diff --git a/lib_lc3plus/lc3.c b/lib_lc3plus/lc3.c index 88ccc186e..2d3fbb51e 100644 --- a/lib_lc3plus/lc3.c +++ b/lib_lc3plus/lc3.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -86,8 +86,6 @@ int lc3plus_samplerate_supported(int samplerate) #endif default: return 0; } - assert("should not be reached, added to avoid issues with WMC tool instrumentation"); - return 0; /* should not be reached, added to avoid issues with WMC tool instrumentation */ } static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) @@ -98,8 +96,6 @@ static int lc3plus_plc_mode_supported(LC3PLUS_PlcMode plc_mode) return 1; default: return 0; } - assert("should not be reached, added to avoid issues with WMC tool instrumentation"); - return 0; /* should not be reached, added to avoid issues with WMC tool instrumentation */ } static int lc3plus_frame_size_supported(int frame_dms) @@ -108,15 +104,11 @@ static int lc3plus_frame_size_supported(int frame_dms) { case 25: /* fallthru */ case 50: /* fallthru */ -#ifdef CR8_G_ADD_75MS case 75: /* fallthru */ -#endif case 100: return 1; default: return 0; } - assert("should not be reached, added to avoid issues with WMC tool instrumentation"); - return 0; /* should not be reached, added to avoid issues with WMC tool instrumentation */ } static int null_in_list(void **list, int n) @@ -159,9 +151,12 @@ LC3PLUS_Error lc3plus_enc_init(LC3PLUS_Enc *encoder, int samplerate, int channel RETURN_IF(samplerate==96000 && hrmode == 0, LC3PLUS_HRMODE_ERROR); #endif - 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); + } } #ifdef ENABLE_HR_MODE @@ -417,7 +412,13 @@ int lc3plus_dec_get_delay(const LC3PLUS_Dec *decoder) static LC3PLUS_Error lc3plus_dec(LC3PLUS_Dec *decoder, void *input_bytes, int num_bytes, void **output_samples, int bitdepth, void *scratch, int bfi_ext) { - RETURN_IF(!decoder || !input_bytes || !output_samples || !scratch, LC3PLUS_NULL_ERROR); + if (bfi_ext == 1) + { + RETURN_IF(!decoder || !output_samples || !scratch, LC3PLUS_NULL_ERROR); + } else { + RETURN_IF(!decoder || !input_bytes || !output_samples || !scratch, LC3PLUS_NULL_ERROR); + } + RETURN_IF(null_in_list(output_samples, decoder->channels), LC3PLUS_NULL_ERROR); RETURN_IF(bitdepth != 16 && bitdepth != 24, LC3PLUS_ERROR); return Dec_LC3PLUS(decoder, input_bytes, num_bytes, output_samples, bitdepth, scratch, bfi_ext); diff --git a/lib_lc3plus/lc3.h b/lib_lc3plus/lc3.h index 64d8cc590..bdf3b64d3 100644 --- a/lib_lc3plus/lc3.h +++ b/lib_lc3plus/lc3.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -38,7 +38,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, 3) +#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. */ @@ -199,6 +199,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 @@ -407,6 +408,7 @@ LC3PLUS_Error lc3plus_dec_init(LC3PLUS_Dec *decoder, int samplerate, int channel * lc3plus_dec_get_scratch_size() or at most LC3PLUS_DEC_MAX_SCRATCH_SIZE * bytes. The scratch buffer does not have to persist, so it can be * used for other purposes in between calls. + * \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/levinson_fx.c b/lib_lc3plus/levinson_fx.c index 9003173d0..0aa4b2e2c 100644 --- a/lib_lc3plus/levinson_fx.c +++ b/lib_lc3plus/levinson_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/license.h b/lib_lc3plus/license.h index 22f25e9ff..684166bf4 100644 --- a/lib_lc3plus/license.h +++ b/lib_lc3plus/license.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -11,7 +11,7 @@ static const char *const LICENSE = "*******************************************************************************\n" - "* ETSI TS 103 634 V1.4.5 *\n" + "* ETSI TS 103 634 V1.5.1 *\n" "* Low Complexity Communication Codec Plus (LC3plus) *\n" "* Fixed 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_fx.c b/lib_lc3plus/ltpf_coder_fx.c index d17daa1b9..e5ae9c5f2 100644 --- a/lib_lc3plus/ltpf_coder_fx.c +++ b/lib_lc3plus/ltpf_coder_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -16,9 +16,7 @@ void process_ltpf_coder_fx(Word16 *bits, Word16 ol_pitch, Word16 ltpf_enable, Wo Word16 mem_in_len, Word16 param[], Word16 *xin, Word16 len, Word16 *mem_normcorr, Word16 *mem_mem_normcorr, Word16 ol_normcorr, Word16 *mem_ltpf_on, Word16 *mem_ltpf_pitch, Word16 xin_exp, Word16 frame_dms, Word8 *scratchBuffer -#ifdef CR9_K_REDUCE_NORM_CORR_TH - ,Word16 hrmode -#endif + , Word16 hrmode ) { Word16 pitch_index, scale0, scale1, scale2, *x, x_exp, shift, prod_exp, ltpf_pitch; @@ -80,20 +78,14 @@ void process_ltpf_coder_fx(Word16 *bits, Word16 ol_pitch, Word16 ltpf_enable, Wo *mem_in_exp = x_exp; move16(); } -#ifdef CR9_K_REDUCE_NORM_CORR_TH Word32 normCorrTh = 0; if (hrmode) { normCorrTh = 13107; } else { normCorrTh = 19660; } -#endif -#ifdef CR9_K_REDUCE_NORM_CORR_TH IF (sub(ol_normcorr, normCorrTh) > 0) -#else - IF (sub(ol_normcorr, 19660) > 0) -#endif { /* Autocorrelation Bounds */ min_pitch = sub(ol_pitch, 4); diff --git a/lib_lc3plus/ltpf_decoder_fx.c b/lib_lc3plus/ltpf_decoder_fx.c index 3bc82085e..31da1dbbb 100644 --- a/lib_lc3plus/ltpf_decoder_fx.c +++ b/lib_lc3plus/ltpf_decoder_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -21,28 +21,22 @@ void process_ltpf_decoder_fx(Word16 *x_e, Word16 L_frame, Word16 old_x_len, Word Word16 ltpf_active, Word16 pitch_index, Word16 *old_pitch_int, Word16 *old_pitch_fr, Word16 *old_gain, Word16 *mem_ltpf_active, Word16 scale_fac_idx, Word16 bfi, Word16 concealMethod, - Word16 damping, Word16 *old_scale_fac_idx, -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH + Word16 damping, Word16 *old_scale_fac_idx, Word32 *rel_pitch_change, Word16 hrmode, Word16 frame_dms, -#endif Word8 *scratchBuffer) { Counter i; Word16 gain, s, s0, s1, pitch, pitch_int, pitch_fr, N4, N34; Word16 *x, *y; - Word16 *z; -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH + Word16 *z; Word32 tmp32, pitch_delta; -#endif #ifdef DYNMEM_COUNT Dyn_Mem_In("process_ltpf_decoder_fx", sizeof(struct { Counter i; Word16 gain, s, s0, s1, pitch, pitch_int, pitch_fr, N4, N34; Word16 *x, *y; - Word16 *z; -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH + Word16 *z; Word32 tmp32, pitch_delta; -#endif })); #endif @@ -192,13 +186,11 @@ void process_ltpf_decoder_fx(Word16 *x_e, Word16 L_frame, Word16 old_x_len, Word *old_e = *x_e; move16(); } -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH if (bfi == 0 && sub(hrmode,1) == 0 && (sub(frame_dms,50) == 0 || sub(frame_dms,25) == 0)){ pitch_delta = abs_s(add(sub(*old_pitch_int,pitch_int) , shr_pos(sub(*old_pitch_fr, pitch_fr),2))); //int_old -int_new + (fr_old-fr_new) / 4.0)); tmp32 = BASOP_Util_Divide3216_Scale_lc3plus(pitch_delta, MAX(add(*old_pitch_int, shr_pos(*old_pitch_fr,2)), 1),&s0);// = pitch_delta *2^15 / MAX(pitch_fl_c_old, 1); *rel_pitch_change = L_shl_pos(tmp32,s0+16); } -#endif *old_pitch_int = pitch_int; move16(); *old_pitch_fr = pitch_fr; move16(); diff --git a/lib_lc3plus/makefile b/lib_lc3plus/makefile index d86232d67..ccf8514af 100644 --- a/lib_lc3plus/makefile +++ b/lib_lc3plus/makefile @@ -1,5 +1,5 @@ #****************************************************************************** -# ETSI TS 103 634 V1.4.5 * +# ETSI TS 103 634 V1.5.1 * # Low Complexity Communication Codec Plus (LC3plus) * # * # Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/mdct_fx.c b/lib_lc3plus/mdct_fx.c index 9e9157204..a64f33f56 100644 --- a/lib_lc3plus/mdct_fx.c +++ b/lib_lc3plus/mdct_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -18,11 +18,9 @@ void processMdct_fx( Word16 x[], /* i: time input signal */ #endif Word16 x_exp, Word16 N, /* i: block size N */ -#ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION # ifdef ENABLE_HR_MODE Word16 hrmode, /* i: indicate high precision */ # endif -#endif #ifdef ENABLE_HR_MODE const Word32 w[], /* i: window coefficients including normalization of sqrt(2/N) and scaled by 2^4 */ #else @@ -82,8 +80,6 @@ void processMdct_fx( basop_memmove(mem, &x[N - memLen], memLen * sizeof(Word16)); #endif - -#ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION # ifdef ENABLE_HR_MODE if (hrmode) @@ -103,7 +99,6 @@ void processMdct_fx( y[m - 1 - i] = Mac_32_32_0(Mpy_32_32_0(w[2 * m + i], x[2 * m - memLen + i]), w[4 * m - 1 - i], x[4 * m - memLen - 1 - i]); move32(); } } else { -# ifdef CR9_B_FIX_MDCT_OVERFLOW FOR (i = 0; i < m; i++) { y[m + i] = L_msu0(L_mult0(round_fx_sat(buf[i]), round_fx(w[i])), round_fx_sat(buf[2 * m - 1 - i]), round_fx(w[2 * m - 1 - i])); move32(); @@ -119,23 +114,6 @@ void processMdct_fx( y[m - 1 - i] = L_mac0(L_mult0(round_fx_sat(x[2 * m - memLen + i]), round_fx(w[2 * m + i])), round_fx_sat(x[4 * m - memLen - 1 - i]), round_fx(w[4 * m - 1 - i])); move32(); } -# else /* CR9_B_FIX_MDCT_OVERFLOW */ - FOR (i = 0; i < m; i++) - { - y[m + i] = L_msu0(L_mult0(round_fx(buf[i]), round_fx(w[i])), round_fx(buf[2 * m - 1 - i]), round_fx(w[2 * m - 1 - i])); move32(); - } - - FOR (i = 0; i < z; i++) - { - y[m - 1 - i] = L_mult0(round_fx(x[2 * m - memLen + i]), round_fx(w[2 * m + i])); move32(); - } - - FOR (i = i; i < m; i++) - { - y[m - 1 - i] = L_mac0(L_mult0(round_fx(x[2 * m - memLen + i]), round_fx(w[2 * m + i])), round_fx(x[4 * m - memLen - 1 - i]), - round_fx(w[4 * m - 1 - i])); move32(); - } -# endif /* CR9_B_FIX_MDCT_OVERFLOW */ } # else /* regular resolution only */ @@ -155,38 +133,6 @@ void processMdct_fx( w[4 * m - 1 - i]); move32(); } # endif - -#else /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ - - FOR (i = 0; i < m; i++) - { -# ifdef ENABLE_HR_MODE - y[m + i] = Msu_32_32_0(Mpy_32_32_0(w[i], buf[i]), w[2 * m - 1 - i], buf[2 * m - 1 - i]); move32(); -# else - y[m + i] = L_msu0(L_mult0(buf[i], w[i]), buf[2 * m - 1 - i], w[2 * m - 1 - i]); move32(); -# endif - } - - FOR (i = 0; i < z; i++) - { -# ifdef ENABLE_HR_MODE - y[m - 1 - i] = Mpy_32_32_0(w[2 * m + i], x[2 * m - memLen + i]); move32(); -# else - y[m - 1 - i] = L_mult0(x[2 * m - memLen + i], w[2 * m + i]); move32(); -# endif - } - - FOR (i = i; i < m; i++) - { -# ifdef ENABLE_HR_MODE - y[m - 1 - i] = Mac_32_32_0(Mpy_32_32_0(w[2 * m + i], x[2 * m - memLen + i]), w[4 * m - 1 - i], x[4 * m - memLen - 1 - i]); move32(); -# else - y[m - 1 - i] = L_mac0(L_mult0(x[2 * m - memLen + i], w[2 * m + i]), x[4 * m - memLen - 1 - i], - w[4 * m - 1 - i]); move32(); -# endif - } - -#endif /* CR8_F_ADAPT_MDCT_DCT_PRECISION */ s = s_max(0, getScaleFactor32_lc3plus(y, N)); FOR (i = 0; i < N; i++) @@ -208,9 +154,7 @@ void processMdct_fx( } #ifdef ENABLE_HR_MODE dct_IV(y, y_e, N, -# ifdef CR8_F_ADAPT_MDCT_DCT_PRECISION hrmode, -# endif workBuffer); #else dct_IV(y, y_e, N, workBuffer); diff --git a/lib_lc3plus/mdct_shaping_fx.c b/lib_lc3plus/mdct_shaping_fx.c index 3b36265fd..1637a5275 100644 --- a/lib_lc3plus/mdct_shaping_fx.c +++ b/lib_lc3plus/mdct_shaping_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/near_nyquist_detector_fx.c b/lib_lc3plus/near_nyquist_detector_fx.c index 8ae29cbb8..595ff435c 100644 --- a/lib_lc3plus/near_nyquist_detector_fx.c +++ b/lib_lc3plus/near_nyquist_detector_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -11,21 +11,15 @@ void processNearNyquistdetector_fx(Word16 *near_nyquist_flag, const Word16 fs_idx, const Word16 near_nyquist_index, const Word16 bands_number, const Word32 *ener_fx, const Word16 ener_fx_exp -#ifdef CR8_E_TONE_DETECTOR #ifdef ENABLE_HR_MODE - ,Word16 frame_dms, Word16 hrmode) -#else - ) -#endif + , Word16 frame_dms, Word16 hrmode) #else ) #endif { *near_nyquist_flag = 0; -#ifdef CR8_E_TONE_DETECTOR #ifdef ENABLE_HR_MODE IF (hrmode == 0){ -#endif #endif IF (sub(fs_idx, 4) < 0) { @@ -66,7 +60,6 @@ void processNearNyquistdetector_fx(Word16 *near_nyquist_flag, const Word16 fs_id Dyn_Mem_Deluxe_Out(); } -#ifdef CR8_E_TONE_DETECTOR #ifdef ENABLE_HR_MODE } ELSE // hrmode == 1 @@ -82,11 +75,9 @@ void processNearNyquistdetector_fx(Word16 *near_nyquist_flag, const Word16 fs_id case 50: td_thresh = TD_HR_thresh_5ms; BREAK; - #ifdef ENABLE_075_DMS_MODE case 75: td_thresh = TD_HR_thresh_7_5ms; BREAK; - #endif default: /* 100 */ td_thresh = TD_HR_thresh_10ms; BREAK; @@ -137,5 +128,4 @@ void processNearNyquistdetector_fx(Word16 *near_nyquist_flag, const Word16 fs_id } } #endif // ENABLE_HR_MODE -#endif // CR8_E_TONE_DETECTOR } diff --git a/lib_lc3plus/noise_factor_fx.c b/lib_lc3plus/noise_factor_fx.c index 75ffb5fac..cfc927808 100644 --- a/lib_lc3plus/noise_factor_fx.c +++ b/lib_lc3plus/noise_factor_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -60,13 +60,11 @@ void processNoiseFactor_fx(Word16 *fac_ns_idx, Word16 x_e, Word32 x[], noisefillwidth = NOISEFILLWIDTH_5MS; noisefillstart = NOISEFILLSTART_5MS; BREAK; -#ifdef CR8_G_ADD_75MS case 75: N = add(shr_pos(N, 2), add(shr_pos(N, 2), shr_pos(N, 2))); noisefillwidth = NOISEFILLWIDTH_7_5MS; noisefillstart = NOISEFILLSTART_7_5MS; BREAK; -# endif case 100: noisefillwidth = NOISEFILLWIDTH; noisefillstart = NOISEFILLSTART; diff --git a/lib_lc3plus/noise_filling_fx.c b/lib_lc3plus/noise_filling_fx.c index 9da870553..5b22983d8 100644 --- a/lib_lc3plus/noise_filling_fx.c +++ b/lib_lc3plus/noise_filling_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -56,13 +56,11 @@ void processNoiseFilling_fx(Word32 xq[], Word16 nfseed, Word16 xq_e, Word16 fac_ noisefillwidth = NOISEFILLWIDTH_5MS; noisefillstart = NOISEFILLSTART_5MS; BREAK; -#ifdef CR8_G_ADD_75MS case 75: N = add(shr_pos(N, 2), add(shr_pos(N, 2), shr_pos(N, 2))); noisefillwidth = NOISEFILLWIDTH_7_5MS; noisefillstart = NOISEFILLSTART_7_5MS; BREAK; -#endif default: /* 100 */ noisefillwidth = NOISEFILLWIDTH; noisefillstart = NOISEFILLSTART; diff --git a/lib_lc3plus/olpa_fx.c b/lib_lc3plus/olpa_fx.c index a93a0ba25..53f15ca9b 100644 --- a/lib_lc3plus/olpa_fx.c +++ b/lib_lc3plus/olpa_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -14,9 +14,7 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[], Word16 *pitch, Word16 *s12k8, Word16 len, Word16 *normcorr, Word16 *mem_pitch, -#ifdef CR9_F_PITCH_WIN_LEN_FIX - Word16 *pitch_flag, -#endif + Word16 *pitch_flag, Word16 s12k8_exp, Word16 frame_dms, Word8 *scratchBuffer) { Word32 sum, sum0, sum1, sum2, prod, inv; @@ -54,7 +52,6 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[] len2 = shr(len, 1); acflen = len2; move16(); -#ifdef CR9_F_PITCH_WIN_LEN_FIX SWITCH(frame_dms) { case 50: @@ -67,15 +64,6 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[] acflen = add(acflen, 48); break; } -#endif - -#ifndef CR9_F_PITCH_WIN_LEN_FIX - IF (sub(frame_dms, 25) == 0) - { - mem_in_len = add(mem_in_len, 16); - acflen = add(acflen, 16); - } -#endif s6k4 = mem_s6k4 + mem_in_len; sum = L_mac(L_mac(L_mult(mem_s12k8[0], 4053), mem_s12k8[1], 7712), mem_s12k8[2], 9239); @@ -112,7 +100,7 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[] shift = add(scale0, scale2); *mem_s6k4_exp = s6k4_exp; move16(); } -#ifdef CR9_F_PITCH_WIN_LEN_FIX + SWITCH(frame_dms) { case 50: @@ -123,14 +111,7 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[] s6k4 = s6k4 - 48; break; } -#endif -#ifndef CR9_F_PITCH_WIN_LEN_FIX - if (sub(frame_dms, 25) == 0) - { - s6k4 = s6k4 - 16; - } -#endif Scale_sig(mem_s6k4, mem_in_len, shift); /* Compute autocorrelation */ @@ -246,7 +227,6 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[] } } -#ifdef CR9_F_PITCH_WIN_LEN_FIX SWITCH(frame_dms) { case 50: @@ -270,11 +250,9 @@ void process_olpa_fx(Word16 *mem_s6k4_exp, Word16 mem_s12k8[], Word16 mem_s6k4[] break; default: -#endif + *mem_pitch = *pitch; move16(); -#ifdef CR9_F_PITCH_WIN_LEN_FIX } -#endif /* Update memory */ basop_memmove(mem_s6k4, &mem_s6k4[len2], mem_in_len * sizeof(Word16)); diff --git a/lib_lc3plus/pc_apply_fx.c b/lib_lc3plus/pc_apply_fx.c index 42ddfb243..cac9e1735 100644 --- a/lib_lc3plus/pc_apply_fx.c +++ b/lib_lc3plus/pc_apply_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/pc_classify_fx.c b/lib_lc3plus/pc_classify_fx.c index 28898f963..97d62d9f9 100644 --- a/lib_lc3plus/pc_classify_fx.c +++ b/lib_lc3plus/pc_classify_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/pc_main_fx.c b/lib_lc3plus/pc_main_fx.c index 708f79d74..de598b4d8 100644 --- a/lib_lc3plus/pc_main_fx.c +++ b/lib_lc3plus/pc_main_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/pc_update_fx.c b/lib_lc3plus/pc_update_fx.c index 17b719bcd..e17dc1186 100644 --- a/lib_lc3plus/pc_update_fx.c +++ b/lib_lc3plus/pc_update_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/per_band_energy_fx.c b/lib_lc3plus/per_band_energy_fx.c index 3ba629a83..a8b9bcac9 100644 --- a/lib_lc3plus/per_band_energy_fx.c +++ b/lib_lc3plus/per_band_energy_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -57,7 +57,6 @@ void processPerBandEnergy_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word32 *d_fx, Wor move16(); } BREAK; -#ifdef CR8_G_ADD_75MS case 75: maxBwBin = (maxBwBin >> 2) * 3; move16(); bandsOffsetOne = bands_offset_with_one_max_7_5ms[fs_idx]; @@ -65,7 +64,6 @@ void processPerBandEnergy_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word32 *d_fx, Wor bandsOffsetTwo = bands_offset_with_two_max_7_5ms[fs_idx]; move16(); BREAK; -#endif default: /* 100 */ { bandsOffsetOne = bands_offset_with_one_max[fs_idx]; @@ -78,7 +76,7 @@ void processPerBandEnergy_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word32 *d_fx, Wor IF (sub(linear, 1) == 0) { - + #ifdef ENABLE_HR_MODE if (hrmode) { @@ -100,14 +98,12 @@ void processPerBandEnergy_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word32 *d_fx, Wor bandsOffsetTwo = bands_offset_with_two_max_lin_5ms[fs_idx]; move16(); BREAK; -#ifdef CR8_G_ADD_75MS case 75: bandsOffsetOne = bands_offset_with_one_max_lin_7_5ms[fs_idx]; move16(); bandsOffsetTwo = bands_offset_with_two_max_lin_7_5ms[fs_idx]; move16(); BREAK; -#endif case 100: bandsOffsetOne = bands_offset_with_one_max_lin[fs_idx]; move16(); @@ -230,7 +226,7 @@ void processPerBandEnergy_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word32 *d_fx, Wor /* specify headroom, it can be reduced by one due to use of L_mac0 */ s2 = sub(s1, bands_nrg_scale[nbands]); #endif - + /* calculate energy per band */ nrg = 0; move32(); diff --git a/lib_lc3plus/plc_apply_fx.c b/lib_lc3plus/plc_apply_fx.c index 9430d155e..876e6d04b 100644 --- a/lib_lc3plus/plc_apply_fx.c +++ b/lib_lc3plus/plc_apply_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -12,11 +12,7 @@ #include "functions.h" void processPLCapply_fx( -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 *concealMethod, -#else - Word16 concealMethod, -#endif Word16 nbLostFramesInRow, Word16 bfi, Word16 prev_bfi, Word16 frame_length, Word16 la_zeroes, #ifdef ENABLE_HR_MODE @@ -32,12 +28,8 @@ void processPLCapply_fx( #ifdef ENABLE_HR_MODE , Word16 hrmode #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , Word32 rel_pitch_change -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR , Word16 *alpha_type_2_table -#endif ) { Dyn_Mem_Deluxe_In( @@ -60,15 +52,15 @@ void processPLCapply_fx( Word32 * L_ecu_rec; /* local xtda output is MAX_LEN -> input buffer, as tmp buffer for w32 fft MAX_LPROT */ ); -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 consecutiveLostThreshold = 0; + +#ifndef ENABLE_HR_MODE + UNUSED(rel_pitch_change); #endif -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER Word16 thresh_tdc_cnt; Word16 thresh_ns_cnt; Word16 thresh_tdc_ns_cnt; -#endif band_offsets = NULL; @@ -97,45 +89,34 @@ void processPLCapply_fx( /* Apply/Prepare PLC in bfi-case */ IF (sub(bfi, 1) == 0) { - -#ifdef CR8_A_PLC_FADEOUT_TUNING SWITCH(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 (sub(fs_idx, 2) == 0 || sub(fs_idx, 4) >= 0) { -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER if (sub(plcAd->longterm_counter_plcTdc, thresh_tdc_cnt) < 0){ plcAd->plc_fadeout_type = 1; } @@ -149,42 +130,12 @@ void processPLCapply_fx( plcAd->plc_fadeout_type = 0; } -#else - IF (((sub(plcAd->longterm_counter_plcPhaseEcu, L_shr_pos(Mpy_32_16_lc3plus(FAC1_FADEOUT, plcAd->longterm_counter_plcTdc), SHIFT1_FADEOUT)) < 0) || - (sub(plcAd->longterm_counter_plcPhaseEcu, L_shr_pos(Mpy_32_16_lc3plus(FAC1_FADEOUT, plcAd->longterm_counter_plcNsAdv), SHIFT1_FADEOUT)) < 0)) && - (sub(plcAd->longterm_counter_plcTdc, L_shr_pos(Mpy_32_16_lc3plus(FAC2_FADEOUT, plcAd->longterm_counter_plcNsAdv), SHIFT2_FADEOUT)) < 0)) - { - plcAd->plc_fadeout_type = 0; - } - ELSE - { - IF ((sub(plcAd->longterm_counter_plcPhaseEcu, L_shr_pos(Mpy_32_16_lc3plus(FAC3_FADEOUT, plcAd->longterm_counter_plcTdc), SHIFT3_FADEOUT)) > 0) || - (sub(plcAd->longterm_counter_plcPhaseEcu, L_shr_pos(Mpy_32_16_lc3plus(FAC3_FADEOUT, plcAd->longterm_counter_plcNsAdv), SHIFT3_FADEOUT)) > 0)) - { - plcAd->plc_fadeout_type = 1; - } ELSE { - plcAd->plc_fadeout_type = 0; - } - } -#endif - - env_stab = norm_s(plcAd->longterm_analysis_counter_max); IF(sub(shl_pos(plcAd->overall_counter, env_stab), mult(shl_pos(plcAd->longterm_analysis_counter_max, env_stab), PLC_LONGTERM_ANALYSIS_STARTUP_FILL)) < 0) { plcAd->plc_fadeout_type = 0; } - -#ifndef CR9_H_REMOVE_SWITCH_TO_PLC_NS - IF (sub(nbLostFramesInRow, consecutiveLostThreshold) >= 0 && sub(plcAd->plc_fadeout_type, 1) == 0) - { - IF (sub(*concealMethod, LC3_CON_TEC_TDPLC) == 0) - { - *concealMethod = LC3_CON_TEC_NS_ADV; - } - } -#endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH +#ifdef ENABLE_HR_MODE IF (L_sub(rel_pitch_change,REL_PITCH_THRESH) > 0 && sub(hrmode,1) == 0 && (sub(frame_dms,50) == 0 || sub(frame_dms,25) == 0)){ plcAd->plc_fadeout_type = 2;move16(); } ELSE @@ -196,13 +147,8 @@ void processPLCapply_fx( } ELSE { plcAd->plc_fadeout_type = 0; /*fs_idx == 0,1,3 */ } -#endif /* CR8_A_PLC_FADEOUT_TUNING */ -#ifdef CR8_A_PLC_FADEOUT_TUNING SWITCH (*concealMethod) -#else - SWITCH (concealMethod) -#endif { case LC3_CON_TEC_PHASE_ECU: ASSERT(frame_dms == 100); @@ -281,10 +227,8 @@ void processPLCapply_fx( plcAd->PhECU_L_old_xfp_w_E_fx,plcAd->PhECU_old_xfp_w_E_exp_fx, plcAd->PhECU_old_Ltot_exp_fx, plcAd->PhECU_old_grp_shape_fx, plcAd->PhECU_margin_xfp, -#ifdef CR8_A_PLC_FADEOUT_TUNING plcAd->plc_fadeout_type , /* i : fadeout scheme */ &(plcAd->PhECU_nonpure_tone_flag), /* i/o : non-pure single tone indicator state */ -#endif buffer_phecu); y_e = 18; move16(); /* the fixed exponent (exp) from Lecu_rec from PhaseECU is 18 */ @@ -324,7 +268,6 @@ void processPLCapply_fx( n_bands = 40; move16(); } BREAK; -# ifdef CR8_G_ADD_75MS case 75: band_offsets = bands_offset_lin_7_5ms[fs_idx]; move16(); # ifdef ENABLE_HR_MODE @@ -339,7 +282,6 @@ void processPLCapply_fx( } # endif BREAK; -# endif case 100: band_offsets = bands_offset_lin[fs_idx]; move16(); BREAK; @@ -386,12 +328,8 @@ void processPLCapply_fx( &plcAd->tdc_gain_c, x_fx, &Q_syn, damping, plcAd->max_len_pcm_plc, plcAd->harmonicBuf_fx, plcAd->synthHist_fx, &plcAd->harmonicBuf_Q, scratchBuffer -#ifdef CR9_I_INC_TDC_FADEOUT_LEN , plcAd->plc_fadeout_type -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR , alpha_type_2_table -#endif ); /* exponent of TD-PLC output */ diff --git a/lib_lc3plus/plc_classify_fx.c b/lib_lc3plus/plc_classify_fx.c index cf455e68d..20b7200e0 100644 --- a/lib_lc3plus/plc_classify_fx.c +++ b/lib_lc3plus/plc_classify_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -10,8 +10,6 @@ #include "defines.h" #include "functions.h" -#ifdef CR8_A_PLC_FADEOUT_TUNING - static Word32 change_bit_at_position(Word32 value, Word8 bit_position, UWord8 bit) { Word32 helper_mask = ~L_shl_pos(1, bit_position); @@ -22,11 +20,7 @@ static Word32 change_bit_at_position(Word32 value, Word8 bit_position, UWord8 bi static void update_bit_and_byte_positions(Word16 longterm_analysis_counter_max_bytebuffer, Word8 *byte_position, Word8 *bit_position) { -#ifdef CR11_A_FIX_IN_PLC_LONGTERM_STATISTIC IF (sub(*bit_position, 29) == 0) -#else - IF (sub(*bit_position, 30) == 0) -#endif { *bit_position = 0; move16(); @@ -63,11 +57,7 @@ static void array_insert_and_shift(Word32 *array, UWord8 value, Word16 longterm_ #endif } -#ifdef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER static void array_calculate(Word32 *array_tdc, Word32 *array_ns, int length, Word16 *counter_tdc, Word16 *counter_ns, Word16 longterm_analysis_counter_max) -#else -static void array_calculate(Word32 *array_tdc, Word32 *array_ns, int length, Word16 *counter_tdc, Word16 *counter_ns, Word16 *counter_phecu, Word16 overall_counter, Word16 longterm_analysis_counter_max) -#endif { int i, k; Word32 current_byte_tdc = 0, current_byte_ns = 0; @@ -101,14 +91,10 @@ static void array_calculate(Word32 *array_tdc, Word32 *array_ns, int length, Wor *counter_tdc = counter_loc_tdc; *counter_ns = counter_loc_ns; -#ifndef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER - *counter_phecu = sub(sub(overall_counter, counter_loc_tdc), counter_loc_ns); -#endif #ifdef WMOPS pop_wmops(); #endif } -#endif static Word16 spectral_centroid_fx_lc(Word16 old_scf_q[], const Word16 *band_offsets, Word16 bands_number, Word16 frame_length, Word16 fs_idx, Word8 *scratchBuffer @@ -142,32 +128,19 @@ void processPLCclassify_fx(Word16 plcMeth, Word16 *concealMethod, Word16 *nbLost plcAd->norm_corrQ15_fx = 0; move16(); } -#ifdef CR8_A_PLC_FADEOUT_TUNING /* assert(bfi != 2 && "Error bfi flag value, state of fadeout cntr is affected by PartialConcealment here "); */ /* Save statistics for 24 kHz, 48 kHz and 96 kHz */ IF((sub(bfi, 1) == 0) || (((bfi >= 0) && (sub(bfi, 2) <= 0)) && ((sub(fs_idx, 2) == 0) || (sub(fs_idx, 4) == 0) || (sub(fs_idx, 5) == 0)))) /* note for PC bfi==2 is possible */ -#else - IF (sub(bfi, 1) == 0) -#endif { /* increase counter of lost-frames-in-a-row */ -#ifdef CR8_A_PLC_FADEOUT_TUNING IF (sub(bfi, 1) == 0) { *nbLostFramesInRow = add(*nbLostFramesInRow, 1); *nbLostFramesInRow = s_min(*nbLostFramesInRow, 0x100); } -#else - *nbLostFramesInRow = add(*nbLostFramesInRow, 1); - *nbLostFramesInRow = s_min(*nbLostFramesInRow, 0x100); -#endif -#ifdef CR8_A_PLC_FADEOUT_TUNING /*assert((bfi != 2) && "PartialConcealment checked vs bfi==0 can cause issues "); */ IF ((sub(*nbLostFramesInRow, 1) == 0) || (bfi != 1) ) /* was "|| (bfi==0)" , NB only test bfi vs "1" as bfi can have the states [0(good),1(bad),2(good,partialConcealment) } */ -#else - IF (sub(*nbLostFramesInRow, 1) == 0) -#endif { *concealMethod = plcMeth; move16(); @@ -200,46 +173,29 @@ void processPLCclassify_fx(Word16 plcMeth, Word16 *concealMethod, Word16 *nbLost #endif { *concealMethod = LC3_CON_TEC_PHASE_ECU; move16(); /* Phase ECU 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 = LC3_CON_TEC_NS_ADV; move16(); /* 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 = LC3_CON_TEC_NS_ADV; move16(); /* 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_damping_scrambling_fx.c b/lib_lc3plus/plc_damping_scrambling_fx.c index 4c5641634..ea56ead1d 100644 --- a/lib_lc3plus/plc_damping_scrambling_fx.c +++ b/lib_lc3plus/plc_damping_scrambling_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -15,9 +15,7 @@ void processPLCDampingScrambling_main_fx(Word16 bfi, Word16 concealMethod, Word1 Word16 pitch_present_bfi2, Word32 spec[], Word16 *q_fx_exp, Word16 *q_old_d_fx, Word16 *q_old_fx_exp, Word16 L_spec, Word16 stabFac, Word16 frame_dms, Word16 *cum_fading_slow, Word16 *cum_fading_fast, Word16 spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , UWord8 plc_fadeout_type -#endif ) { Dyn_Mem_Deluxe_In( @@ -33,14 +31,12 @@ void processPLCDampingScrambling_main_fx(Word16 bfi, Word16 concealMethod, Word1 processDampScramb = 1; move16(); } -#ifdef CR8_A_PLC_FADEOUT_TUNING IF (sub(ns_nbLostFramesInRow, 1) == 0) { *cum_fading_slow = 32767; move16(); *cum_fading_fast = 32767; move16(); *cum_fflcAtten = 32767; move16(); } -#endif IF (sub(bfi, 1) == 0) { @@ -48,9 +44,7 @@ void processPLCDampingScrambling_main_fx(Word16 bfi, Word16 concealMethod, Word1 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 */ @@ -59,9 +53,7 @@ void processPLCDampingScrambling_main_fx(Word16 bfi, Word16 concealMethod, Word1 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_fx(q_old_d_fx, q_old_fx_exp, spec, q_fx_exp, L_spec); @@ -73,9 +65,7 @@ void processPLCDampingScrambling_main_fx(Word16 bfi, Word16 concealMethod, Word1 void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostFramesInRow, Word16 stabFac, Word16 processDampScramb, Word16 *cum_fflcAtten, Word16 pitch_present, Word16 frame_dms, Word16 *cum_fading_slow, Word16 *cum_fading_fast, Word16 *seed, Word16 spec_inv_idx -#ifdef CR8_A_PLC_FADEOUT_TUNING , UWord8 plc_fadeout_type -#endif ) { Counter i; @@ -97,15 +87,6 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF #endif /** preparation */ -#ifndef CR8_A_PLC_FADEOUT_TUNING - /* init cummulative damping factors at first loss */ - IF (sub(nbLostFramesInRow, 1) == 0) - { - *cum_fading_slow = 32767; move16(); - *cum_fading_fast = 32767; move16(); - *cum_fflcAtten = 32767; move16(); - } -#endif /* get damping factors */ tmp16 = mult(6554 /*0.2*/, stabFac); @@ -155,8 +136,6 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF fast = shl(fast, tmp16); } BREAK; -#ifdef ENABLE_075_DMS_MODE -# ifdef CR8_G_ADD_75MS case 75: IF (sub(slow, 32767) < 0) { @@ -191,23 +170,16 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF fast = shl(fast, tmp16); } BREAK; -# endif -#endif } -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type == 0) { -#endif *cum_fading_slow = mult_r(*cum_fading_slow, slow); *cum_fading_fast = mult_r(*cum_fading_fast, fast); -#ifdef CR8_A_PLC_FADEOUT_TUNING } -#endif IF ( sub(processDampScramb, 1) == 0 ) { -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type != 0) { Word16 lost_frame_thr1 = 4; @@ -223,13 +195,9 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF lost_frame_thr1 = 8; lost_frame_thr2 = 16; BREAK; -#ifdef ENABLE_075_DMS_MODE -# ifdef CR8_G_ADD_75MS case 75: lost_frame_thr1 = 6; lost_frame_thr2 = 11; -# endif -#endif } IF (sub(nbLostFramesInRow, lost_frame_thr1) < 0) { @@ -247,7 +215,6 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF *cum_fading_slow = mult_r(*cum_fading_slow, cum_fading_slow_local); move16(); cum_fading_slow_local = *cum_fading_slow; move16(); } else { -#endif /** rapid fading for FFLC */ fflcAtten = 32767; move16(); cum_fading_slow_local = *cum_fading_slow; move16(); @@ -267,11 +234,7 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF { case 25: fflcAtten = PLC34_ATTEN_FAC_025_FX; BREAK; case 50: fflcAtten = PLC34_ATTEN_FAC_050_FX; BREAK; -#ifdef ENABLE_075_DMS_MODE -# ifdef CR8_G_ADD_75MS case 75: fflcAtten = PLC34_ATTEN_FAC_075_FX; BREAK; -# endif -#endif case 100: fflcAtten = PLC34_ATTEN_FAC_100_FX; BREAK; } } @@ -296,14 +259,10 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF plc_start_inFrames = (10*PLC4_TRANSIT_START_IN_MS) / 50; move16(); plc_end_inFrames = (10*PLC4_TRANSIT_END_IN_MS) / 50; move16(); BREAK; -#ifdef ENABLE_075_DMS_MODE -# ifdef CR8_G_ADD_75MS case 75: plc_start_inFrames = (10*PLC4_TRANSIT_START_IN_MS) / 75; move16(); plc_end_inFrames = (10*PLC4_TRANSIT_END_IN_MS) / 75; move16(); BREAK; -# endif -#endif default: plc_start_inFrames = (10*PLC4_TRANSIT_START_IN_MS) / 100; move16(); plc_end_inFrames = (10*PLC4_TRANSIT_END_IN_MS) / 100; move16(); @@ -336,9 +295,7 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF /** sign scrambling */ randThreshold = mult(-32768, linFuncStartStop); -#ifdef CR8_A_PLC_FADEOUT_TUNING } -#endif tmp16 = *seed; move16(); FOR (i = spec_inv_idx; i < L_spec; i++) @@ -348,11 +305,7 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF IF (tmp16 < 0) { test(); -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type != 0 || pitch_present == 0 || sub(tmp16, randThreshold) < 0 ) -#else - if (pitch_present == 0 || sub(tmp16, randThreshold) < 0) -#endif { spec[i] = L_negate(spec[i]); } @@ -361,10 +314,8 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF } *seed = tmp16; move16(); -#ifdef CR8_A_PLC_FADEOUT_TUNING if (plc_fadeout_type == 0) { -#endif /** adaptive damping */ tmp16 = mult(18022 /* 10 - 1.2 */, linFuncStartStop); ad_threshFac = add(shr(tmp16, 1), 1228 /* 1.2 >> 1 */); /* exp = 5 */ @@ -390,17 +341,11 @@ void processPLCDampingScrambling_fx(Word32 spec[], Word16 L_spec, Word16 nbLostF mean_nrg = L_shl_sat(L_deposit_l(energThreshold), s3); /* exp = 0 */ fac = mult(sub(cum_fading_slow_local, cum_fading_fast_local), energThreshold); fac = L_shl_sat(L_deposit_l(fac), s3); /* exp = 0 */ -#ifdef CR8_A_PLC_FADEOUT_TUNING } -#endif FOR (i = spec_inv_idx; i < L_spec; i++) { -#ifdef CR8_A_PLC_FADEOUT_TUNING if ( ( plc_fadeout_type != 0 ) || (L_sub(L_abs(spec[i]), mean_nrg) < 0) ) -#else - if (L_sub(L_abs(spec[i]), mean_nrg) < 0) -#endif { spec[i] = Mpy_32_16_lc3plus(spec[i], cum_fading_slow_local); } diff --git a/lib_lc3plus/plc_lpc_scaling_fx.c b/lib_lc3plus/plc_lpc_scaling_fx.c index 85ffbf942..15d753342 100644 --- a/lib_lc3plus/plc_lpc_scaling_fx.c +++ b/lib_lc3plus/plc_lpc_scaling_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_main_fx.c b/lib_lc3plus/plc_main_fx.c index 1948aa23a..87cfb59d4 100644 --- a/lib_lc3plus/plc_main_fx.c +++ b/lib_lc3plus/plc_main_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -25,12 +25,8 @@ void processPLCmain_fx(Word16 plcMeth, Word16 *concealMethod, Word16 *nbLostFram #ifdef ENABLE_HR_MODE , Word16 hrmode #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH - ,Word32 rel_pitch_change -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR - ,Word16 *alpha_type_2_table -#endif + , Word32 rel_pitch_change + , Word16 *alpha_type_2_table ) { IF(sub(bfi, 1) == 0 && plcAd) @@ -47,23 +43,15 @@ void processPLCmain_fx(Word16 plcMeth, Word16 *concealMethod, Word16 *nbLostFram ); processPLCapply_fx( -#ifdef CR8_A_PLC_FADEOUT_TUNING concealMethod, -#else - *concealMethod, -#endif *nbLostFramesInRow, bfi, prev_bfi, frame_length, la_zeroes, w, x_fx, ola_mem, ola_mem_exp, q_old_d_fx, q_old_fx_exp, q_d_fx, q_fx_exp, yLen, fs_idx, damping, old_pitch_int, old_pitch_fr, ns_cum_alpha, ns_seed, frame_dms, plcAd, scratchBuffer #ifdef ENABLE_HR_MODE , hrmode #endif -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH , rel_pitch_change -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR , alpha_type_2_table -#endif ); IF (bfi == 0) diff --git a/lib_lc3plus/plc_noise_substitution_fx.c b/lib_lc3plus/plc_noise_substitution_fx.c index ab618ae7e..0b227edae 100644 --- a/lib_lc3plus/plc_noise_substitution_fx.c +++ b/lib_lc3plus/plc_noise_substitution_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_phecu_f0_refine_first_fx.c b/lib_lc3plus/plc_phecu_f0_refine_first_fx.c index 5c01a0029..5a37b4149 100644 --- a/lib_lc3plus/plc_phecu_f0_refine_first_fx.c +++ b/lib_lc3plus/plc_phecu_f0_refine_first_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_phecu_fec_hq_fx.c b/lib_lc3plus/plc_phecu_fec_hq_fx.c index e73a1faa8..96b450ca8 100644 --- a/lib_lc3plus/plc_phecu_fec_hq_fx.c +++ b/lib_lc3plus/plc_phecu_fec_hq_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -20,72 +20,9 @@ #define MAX_INCREASE_GRPPOW_FX 0 /* max. amplification in case of transients (in dB scale) */ -#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 */ # define SIDE_LIM 12539859L /* 10^ (4.5/20.0) = 2^(a); --> x= 0.747433821 -> Lx_Q24 = round((1L<<(24))*0.747433821)) = 12539859 */ # define LFHF_LIM 16719812L /* 10^ (6.0/20.0) = 2^(b); --> x= 0.996578428 -> Lx_Q24 = round((1L<<(24))*0.996578428)) = 16719812 */ -#endif - -#ifdef CR8_A_PLC_FADEOUT_TUNING -#else - -#if PLC2_FADEOUT_IN_MS == 0 -#define BURST_ATT_THRESH (4) /* speech start attenuate with losses in a row , stable content is +1 */ -#define ATT_PER_FRAME 2 /* ptr to a table , regular voiced attenuation settings table [0.4 dBx16 frames + 6dBx16 frames] 10 ms frame */ -/* #define ATT_PER_FRAME 1 */ /* ptr to a table , regular attenuation settings table [0.3 dBx16 frames + 6dBx16 frames] 10 ms frame */ -#define BETA_MUTE_THR 20 /* time threshold from BFI start to start of beta-noise further energy attenuation, by .5 each frame */ -/* #define OFF_FRAMES_LIMIT 30 in defines.h , table size and complete zero signal after BURST_ATT_THRESH + OFF_FRAMES_LIMIT */ -#endif - -#if PLC2_FADEOUT_IN_MS != 0 /* TD_PLC muting setting */ - /*% burst attenuation scheme is allowed to be indirectly controlled by a setting from TDC-PLC settings ,if negative PLC2_FADEOUT_IN_MS */ - -#if (PLC2_FADEOUT_IN_MS < 0) -#define FADEOUT_IN_MS PLC_FADEOUT_IN_MS /*% use TDC-SETTING as input */ -#else -#define FADEOUT_IN_MS PLC2_FADEOUT_IN_MS /* % use a PLC2 individual settings as basis */ -#endif - - /* %Examples - % FADEOUT_IN_MS ==30 ms --> shortest setting, att per frame idx = 10 for PLC2 - % FADEOUT_IN_MS ==40 ms --> att per frame idx = 8 setting for PLC2 - % FADEOUT_IN_MS ==60 ms --> att per frame idx = 6 setting for PLC2 (3+4) low decay then fast decay - % FADEOUT_IN_MS ==80 ms --> att per frame idx = 4 setting for PLC2 - % FADEOUT_IN_MS ==100 ms --> att per frame idx = 2 longest = near original setting for PLC2 - */ -#define PLC_P800_SPEECH_FADEOUT_IN_FRAMES (FADEOUT_IN_MS/10) -#define PLC2_FADEOUT_IN_FRAMES MIN(OFF_FRAMES_LIMIT,MAX(6, (3*PLC_P800_SPEECH_FADEOUT_IN_FRAMES))) /* help variable */ - -#define BURST_ATT_THRESH_PRE MIN(5,MAX(1,((1*PLC2_FADEOUT_IN_FRAMES)/6))) /* nominal 10-50 ms to start actual muting, will be thresh +1 */ - -#undef ATT_PER_FRAME -#define ATT_PER_FRAME MIN(10, MAX(2, 2*(6-BURST_ATT_THRESH_PRE))) /* we let the BURST_ATT_THRESH_PRE control the initial table selection */ -/* will eventually become ATT_PER_FRAME-1 = */ - /* table ptr 1,2 --> 16 low decay, 16 high decay, "0" */ - /* table ptr 3,4 --> 8 low decay, 24 high decay, "0" */ - /* table ptr 5,6 --> 4 low decay, 28 high decay , "0"*/ - /* table ptr 7,8 --> 2 low decay, 30 high decay, "0"*/ - /* table ptr 9,10 --> 1 low decay, 31 high decay, "0"*/ -#undef BURST_ATT_THRESH -#define BURST_ATT_THRESH MIN(BURST_ATT_THRESH_PRE, 4 ) /* nominal 10-40 ms, of no regular muting , 20-50 ms */ - - /* beta mute starts to become active when the low decay mute has ended */ -#undef BETA_MUTE_THR -#define BETA_MUTE_THR MIN( 4+(OFF_FRAMES_LIMIT/2)+1 , MAX(4, BURST_ATT_THRESH + 1 +(1<<(BURST_ATT_THRESH_PRE-1)))) /* nominal time to start mandatory decrease of Xavg */ - -#if (ATT_PER_FRAME < 2) || (ATT_PER_FRAME > 10) -#pragma message(" ROM table POW_ATT_TABLES needs update to change the ATT_PER FRAME constants supported are (1),2 (3), 4, (5) ,6 dB/frame ") -#endif - -#else -#if ( ATT_PER_FRAME != 2) -#pragma (" ROM table POW_ATT_TABLES needs update to change the ATT_PER FRAME constants supported are (1),2 dB/frame ") -#endif -#endif - - -#endif - #define CMPLMNT_PLOC_SENS_FX 2294 /* (1.0 - p_locator_sens) in Q15 */ #define FEC_HQ_ECU_ROOT2 23170 /*(0x5a83) */ /* sqrt(2) in Q14 */ @@ -117,12 +54,9 @@ static Word16 imax2_jacobsen_mag_fx(const Word16 *y_re, const Word16 *y_im, cons static void fft_spec2_sqrt_approx_fx(const Word16 x[], Word16 xMagSqrt[], const Word16 N); static Word16 sqrtMagnApprox_fx(const Word16 re, const Word16 im); -#ifdef CR8_A_PLC_FADEOUT_TUNING static Word16 plc_phEcu_nonpure_tone_ana_fx(const Word16* plocs, const Word16 n_plocs, const Word16* X, const Word32 *L_Xavg, /* i : Frequency group amp averages for tonal tilt analysis pref. Max upshifted */ const Word16 Lprot, const Word16 fs_idx); -#endif - static void rotate_W16_fx(Word16 re_in, Word16 im_in, Word16 cosFactor, Word16 sinFactor, Word16 *re_out_ptr, Word16 *im_out_ptr) @@ -228,10 +162,8 @@ void trans_burst_ana_fx( Word16 *oold_grp_shape_fx, Word32 L_old_xfp_w_E_fx, Word16 old_xfp_w_E_exp_fx, Word16 old_Ltot_exp_fx, Word16 *old_grp_shape_fx, -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 fadeout, Word32 * L_Xavg, /* full scale band amplitudes */ -#endif Word8 *scratchBuffer /* Size = 4*4 * MAX_LTRANA + (2*4 + 1*2) * MAX_LGW + 8 */ ) { @@ -242,13 +174,8 @@ void trans_burst_ana_fx( Word16 man, expo; Word16 att_always = 0; /* fixed attenuation per frequency group if set to 1 */ Word16 oneOverFrame, roundEstMusContent, tmp16; -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 burst_att_thresh; Word16 att_per_frame; -#else - Word16 burst_att_thresh = BURST_ATT_THRESH; - Word16 att_per_frame = ATT_PER_FRAME; -#endif Word16 * tr_dec; Word32 L_acc; Word16 fs_scale; @@ -266,13 +193,10 @@ void trans_burst_ana_fx( Word32 L_tmp, L_tmp2; Word16 thresh_tr_rise_lin_Q15; Word16 thresh_tr_decay_lin_Q15; -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 beta_mute_thr; Word16 fade_ms_ind; -#endif #ifdef DYNMEM_COUNT -#ifdef CR8_A_PLC_FADEOUT_TUNING Dyn_Mem_In("trans_burst_ana_fx", sizeof(struct { Word16 att_val, attDegreeFrames; @@ -312,40 +236,6 @@ void trans_burst_ana_fx( Word16 beta_mute_thr; Word16 fade_ms_ind; })); -#else - Dyn_Mem_In("trans_burst_ana_fx", sizeof(struct { - - Word16 att_val, attDegreeFrames; - Word32 * pGrPowLeft_L, *pGrPowRight_L; - Word32 * L_gr_pow_left, *L_gr_pow_right; - Word16 Lprot; - Word16 Lgw, i, k, burst_len; - Word16 man, expo; - Word16 att_always; /* fixed attenuation per frequency group if set to 1 */ - Word16 oneOverFrame, roundEstMusContent, tmp16; - - Word16 burst_att_thresh; - Word16 att_per_frame; - - Word16 * tr_dec; - UWord16 lsb; - Word32 L_acc; - Word16 fs_scale; - Word16 scale_sh; - - Word32 L_oold_tmp; - Word32 L_old_tmp; - Word16 fs_idx; - Word16 shift32; - Word16 margin_old; - Word16 margin_oold; - - Word16 Xavg_exp_fx, Xavg_mod_exp_fx; - Word16 tr_rise[MAX_LGW]; - Word16 tr_decay[MAX_LGW]; - })); -#endif - #endif UNUSED(xfp); @@ -381,12 +271,7 @@ void trans_burst_ana_fx( UNUSED(est_stab_content); UNUSED(roundEstMusContent); -#ifndef CR8_A_PLC_FADEOUT_TUNING - burst_att_thresh = add(BURST_ATT_THRESH, 1); /* in Q0 , stable setting */ - att_per_frame = sub(ATT_PER_FRAME, 1); /* in Q0 , stable setting */ -#endif -#ifdef CR8_A_PLC_FADEOUT_TUNING move16(); fade_ms_ind = (PLC2_FADEOUT_IN_MS - PLC2_FADEOUT_IN_MS_MIN) / PLC2_FADEOUT_RES; /* a shorter fading entry in fade_scheme_tab_fx */ test(); @@ -401,17 +286,9 @@ void trans_burst_ana_fx( burst_att_thresh = fade_scheme_tab_fx[fade_ms_ind][1]; /* number of 1.0 frames before muting phase */ /* band gain muting can take place earlier due to a band transient */ beta_mute_thr = fade_scheme_tab_fx[fade_ms_ind][2]; /* faster muting of added noise starts when slow main signal fadeout is over */ -#endif - - - #ifdef PLC_FADEOUT_IN_MS -#ifdef CR8_A_PLC_FADEOUT_TUNING ASSERT(att_per_frame >= 1 && att_per_frame <= 12); /* table based lookup restriction */ -#else - ASSERT(att_per_frame >= 1 && att_per_frame <=10 ); /* table based lookup restriction */ -#endif #else ASSERT(att_per_frame == 1 || att_per_frame == 2); /* table based lookup restriction */ #endif @@ -553,9 +430,7 @@ void trans_burst_ana_fx( { L_acc = L_shr_sat(L_acc, exp_diff); } -#ifdef CR8_A_PLC_FADEOUT_TUNING L_Xavg[k] = L_acc; /* export full 31 bit scale band amplitude */ -#endif Xavg[k] = round_fx_sat(L_acc); /* extract high part */ } /*end of new Xavg_fx calculation */ @@ -656,23 +531,16 @@ void trans_burst_ana_fx( * means only 2 tables of size=(OFF_FRAMES_LIMIT+1) each are required. * To take square root into account, it is divided by 20 instead of 10. */ -#ifdef CR8_A_PLC_FADEOUT_TUNING if (sub(burst_len, beta_mute_thr) > 0) /* beta_mute_thr coincides/close to stronger 6dB muting phase */ { *beta_mute = shr_pos_pos(*beta_mute, 1); } -#endif - FOR(k = 0; k < Lgw; k++) /* Lgw may be shorter than all bands at 48k */ { /* global burst attenuation */ - #if PLC2_FADEOUT_IN_MS != 0 - #ifdef CR8_A_PLC_FADEOUT_TUNING + #if PLC2_FADEOUT_IN_MS != 0 /* att_per_frame idx = "1:12") */ -#else - /* att_per_frame idx = "1:10") */ -#endif att_val = POW_ATT_TABLES[att_per_frame][s_min(OFF_FRAMES_LIMIT, attDegreeFrames)]; move16(); #else /* att_per_frame idx = "1:2") */ @@ -682,12 +550,6 @@ void trans_burst_ana_fx( mag_chg[k] = mult_r(mag_chg_1st[k], att_val); /* Q15 */ -#ifndef CR8_A_PLC_FADEOUT_TUNING - if (sub(burst_len, BETA_MUTE_THR) > 0) /* BETA_MUTE_THR ~= (5+15) coincides/close to stronger 6dB muting phase */ - { - *beta_mute = shr_pos_pos(*beta_mute, 1); - } -#endif alpha[k] = mag_chg[k]; move16(); ASSERT(beta[k] == 0); /* initialization required */ IF(sub(alpha[k], 32766) < 0) @@ -1243,11 +1105,9 @@ static Word16 imax_fx( /* o: The location, relative to the const Word16 *beta, /* i : Magnitude modification factors for fade to average Q15 */ const Word16 *Xavg, /* i : Frequency group averages to fade to Q0 */ const Word16 t_adv /* i : time adjustement excluding time_offs Q0 */ -#ifdef CR8_A_PLC_FADEOUT_TUNING ,const Word16 fadeout, /* need for DC muting */ Word16 * nonpure_tone_flag_ptr, /* i/o : non-pure single tone indicator state */ const Word32 * L_Xavg /* i : Frequency group amp averages for tonal tilt analysis Max upshifted */ -#endif ) { Word16 Xph_short; @@ -1363,7 +1223,6 @@ static Word16 imax_fx( /* o: The location, relative to the } one_peak_flag_mask = (Word16)0xFFFF; move16(); /* all ones mask -> keep */ -#ifdef CR8_A_PLC_FADEOUT_TUNING test(); logic16(); IF((*num_plocs > 0) && sub(*num_plocs, 3) < 0) { @@ -1390,14 +1249,6 @@ static Word16 imax_fx( /* o: The location, relative to the one_peak_flag_mask = (Word16)0xFFFF; move16(); /* all ones mask -> keep */ } } -#else - logic16(); - if ((*num_plocs > 0) && sub(*num_plocs, 3) < 0) - { - one_peak_flag_mask = 0x0000; move16(); /* all zeroes mask -> zero */ - } -#endif - noise_mag_scale_neg = 0; move16(); /* no change of valley noise magnitude */ logic16(); @@ -1412,7 +1263,6 @@ static Word16 imax_fx( /* o: The location, relative to the X[shr_pos(Lprot, 1)] = 0; move16(); /* also reset fs/2 if there are no peaks */ } -#ifdef CR8_A_PLC_FADEOUT_TUNING /* the binary selection of fadeout scheme */ tmp = (PLC2_FADEOUT_IN_MS - PLC2_FADEOUT_IN_MS_MIN) / PLC2_FADEOUT_RES; move16(); if (fadeout != 0) @@ -1421,9 +1271,6 @@ static Word16 imax_fx( /* o: The location, relative to the } IF(sub(tmp2, add(fade_scheme_tab_fx[tmp][1],1) ) > 0) -#else - IF(sub(tmp2, (BURST_ATT_THRESH+1)) > 0) -#endif { /* also start DC scaling attenuation */ X[0] = mult(alpha[0], X[0]); move16(); @@ -2002,10 +1849,8 @@ static Word16 imax_fx( /* o: The location, relative to the Word16 old_Ltot_exp_fx, /*true exp of energy */ Word16 *old_grp_shape_fx, Word16 margin_prevsynth, -#ifdef CR8_A_PLC_FADEOUT_TUNING const Word16 fadeout, - Word16 *nonpure_tone_flag_ptr, /* i/o : non-pure single tone indicator state */ -#endif + Word16 *nonpure_tone_flag_ptr, /* i/o : non-pure single tone indicator state */ Word8 *scratchBuffer /* Size = 2 * MAX_LGW + 8 * MAX_LPROT + 12 * MAX_L_FRAME */ ) { @@ -2017,9 +1862,7 @@ static Word16 imax_fx( /* o: The location, relative to the Word16 prevsynth_man_upshift; Word16 Q_prevsynthMinus1; Word8 *buffer; -# ifdef CR8_A_PLC_FADEOUT_TUNING - Word32 L_Xavg[MAX_LGW]; /* i/o : Frequency group amp averages for tonal tilt analysis Max upshifted */ -# endif + Word32 L_Xavg[MAX_LGW]; /* i/o : Frequency group amp averages for tonal tilt analysis Max upshifted */ #ifdef DYNMEM_COUNT Dyn_Mem_In("hq_phase_ecu_fx", sizeof(struct { Counter i; @@ -2065,9 +1908,7 @@ static Word16 imax_fx( /* o: The location, relative to the IF( prev_bfi == 0 ) /* inside PhECU we can check vs 0 */ { *time_offs = 0; move16(); -#ifdef CR8_A_PLC_FADEOUT_TUNING *nonpure_tone_flag_ptr = -1; move16(); /* flag nonpure tone flag for new analysis */ -#endif /* analysis made outside, up/down scaling here from static RAM to dynamic RAM */ /* prevsynth_in_flt = prev_synth_man*2.^(-15 + exp_old) */ /* X_sav_flt = X_man/2.^(Q_spec) */ @@ -2128,10 +1969,8 @@ static Word16 imax_fx( /* o: The location, relative to the mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, alpha, beta, beta_mute, Xavg, (*Q_spec), L_oold_xfp_w_E_fx, oold_xfp_w_E_exp_fx, oold_Ltot_exp_fx, oold_grp_shape_fx, L_old_xfp_w_E_fx, old_xfp_w_E_exp_fx, old_Ltot_exp_fx, old_grp_shape_fx, -#ifdef CR8_A_PLC_FADEOUT_TUNING fadeout, L_Xavg, /* full scale band amplitudes in first bfi frame */ -#endif buffer); spec_ana_fx(&(xfp[0]), plocs, L_plocsi, num_p, X_sav, output_frame, bwidth_fx, @@ -2172,10 +2011,8 @@ static Word16 imax_fx( /* o: The location, relative to the (0), /* *Q_spec input only used in first bfi frames for burst analysis */ L_oold_xfp_w_E_fx, oold_xfp_w_E_exp_fx, oold_Ltot_exp_fx, oold_grp_shape_fx, L_old_xfp_w_E_fx, old_xfp_w_E_exp_fx, old_Ltot_exp_fx, old_grp_shape_fx, -#ifdef CR8_A_PLC_FADEOUT_TUNING fadeout, NULL, /* full scale band amplitudes , only used in first bfi frame */ -#endif buffer); } /* cpy LPROT Word16 from Static RAM Xsav to working DRAM/scratch buffer X ;*/ @@ -2196,11 +2033,9 @@ static Word16 imax_fx( /* o: The location, relative to the subst_spec_fx(plocs, L_plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed, alpha, beta, Xavg, t_adv -#ifdef CR8_A_PLC_FADEOUT_TUNING ,fadeout, nonpure_tone_flag_ptr, /* i/o : non-pure single tone indicator state */ L_Xavg /*i : only used in first bfi frame */ -#endif ); if (seed_out_fxPtr != NULL) @@ -2876,7 +2711,6 @@ static Word16 imax_fx( /* o: The location, relative to the #endif } -#ifdef CR8_A_PLC_FADEOUT_TUNING static Word16 plc_phEcu_nonpure_tone_ana_fx(const Word16* plocs, const Word16 n_plocs, const Word16* X, /*i: { DC, Re1,Re2 ,.....ReN , Fs/2, ImN... , Im2, Im1} */ @@ -3150,8 +2984,3 @@ static Word16 imax_fx( /* o: The location, relative to the return nonpure_tone_detect; } -#endif /* CR8_A_PLC_FADEOUT_TUNING plc_phecu_non_pure_ana_fx */ - - - - diff --git a/lib_lc3plus/plc_phecu_lf_peak_analysis_fx.c b/lib_lc3plus/plc_phecu_lf_peak_analysis_fx.c index 50b694e5c..b32c61b66 100644 --- a/lib_lc3plus/plc_phecu_lf_peak_analysis_fx.c +++ b/lib_lc3plus/plc_phecu_lf_peak_analysis_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_phecu_peak_locator_fx.c b/lib_lc3plus/plc_phecu_peak_locator_fx.c index 42729e800..ddb348666 100644 --- a/lib_lc3plus/plc_phecu_peak_locator_fx.c +++ b/lib_lc3plus/plc_phecu_peak_locator_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_phecu_setf0hz_fx.c b/lib_lc3plus/plc_phecu_setf0hz_fx.c index 3dd5b1a08..6b2322f00 100644 --- a/lib_lc3plus/plc_phecu_setf0hz_fx.c +++ b/lib_lc3plus/plc_phecu_setf0hz_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_phecu_tools_fx.c b/lib_lc3plus/plc_phecu_tools_fx.c index c78d406a4..c37d6ba32 100644 --- a/lib_lc3plus/plc_phecu_tools_fx.c +++ b/lib_lc3plus/plc_phecu_tools_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -91,7 +91,7 @@ Word16 plc_phEcu_find_ind_fx( /* o : output maximum in const Word16 *inp, /* i : vector */ const Word16 len, /* i : length */ const Word16 val /* i : value to find */ -) +) { Word16 val_ind; Counter pos; @@ -149,18 +149,18 @@ Word32 winEnCalc( /* o: output summed energy Ltot */ const Word16 *win, /* i: left side Window coefficients */ const Word16 rectLength, /* i: Offset in between the 1st and 2nd symmetric halves of the Hamming window */ const Word16 halfLength, /* i: Half of the total length of a complete Hamming window. */ - Word16 *exp /* i/o : i exp of Word16 variable x , o:Lexp of output Word32 sum */ + Word16 *exp /* i/o : i exp of Word16 variable x , o:Lexp of output Word32 sum */ ) { Counter i; - Word32 L_tot; + Word32 L_tot; const Word16 *pX, *pW; Word16 tmp, tmp_RL; #ifdef DYNMEM_COUNT Dyn_Mem_In("PhEcu::GF::winEnCalc", sizeof(struct { Counter i; - Word32 L_tot; + Word32 L_tot; const Word16 *pX, *pW; Word16 tmp, tmp_RL; })); @@ -174,12 +174,12 @@ Word32 winEnCalc( /* o: output summed energy Ltot */ L_tot = INT32_MAX; move32(); /*acc is on negative side , but as all accumulation is positive, we make use of one extra bit */ pX = x; pW = win; - + assert( headroom_shift>=0 ); FOR (i = 0; i < halfLength; i++) /* 1st symmetric half of the Hamming window */ { - tmp = mult(*pX++, *pW++); + tmp = mult(*pX++, *pW++); tmp = shr_pos(tmp, headroom_shift); /* shr may/create bias on the negative side , costly options are shr_r or use msu_r */ L_tot = L_msu0(L_tot, tmp, tmp); /* acc on negative energy side */ } @@ -189,7 +189,7 @@ Word32 winEnCalc( /* o: output summed energy Ltot */ ASSERT(rectLength != 0); FOR (i = 0; i < tmp_RL; i++) /* If rectLength is zero, it's a pure Hamming window; otherwise Hamming-Rectangular. */ - { + { tmp = shr_pos( *pX++, headroom_shift); L_tot = L_msu0(L_tot, tmp, tmp); /* acc on negative side */ } @@ -199,37 +199,37 @@ Word32 winEnCalc( /* o: output summed energy Ltot */ FOR (i = 0; i < tmp_RL; i++) /* 2nd symmetric half of the Hamming window. */ { - tmp = mult(*pX++, *(--pW)); + tmp = mult(*pX++, *(--pW)); tmp = shr_pos(tmp, headroom_shift); L_tot = L_msu0(L_tot, tmp, tmp); } /* Lexp = 2*(incoming_exp + dnshift) + 1 , 2x for square + 1(for msu0 DSP dn shift)*/ - *exp = add(shl_pos(add(*exp, headroom_shift),1),1); + *exp = add(shl_pos(add(*exp, headroom_shift),1),1); /* handle wrap on zero point */ IF( L_tot >= 0 ) { /* L_tot positive --> less than 32 bits needed, */ L_tot = L_add(L_tot,(INT32_MIN+1)); if( L_tot == 0 ) - { + { *exp = LTOT_MIN_EXP; /* WC is actually (-(15+4)*2 + 1 +1 -31) */ ; move16(); - } + } L_tot = L_min(L_tot, -1); /* make sure there is energy for future ratio calculations */ - } - ELSE + } + ELSE { /* L_tot negative --> more than 31 bits needed for sum , scale 32 bit sum within 31 bits and adjust exp */ - + L_tot = L_shr_pos(L_add(L_tot,1),1); /* rnd by adding 1, then use 50% contribution from negative side */ - L_tot = L_add(L_tot, INT32_MIN>>1); /* add 50% contribution from positive side */ - - *exp = add(*exp, 1); move16(); - } + L_tot = L_add(L_tot, INT32_MIN>>1); /* add 50% contribution from positive side */ + + *exp = add(*exp, 1); move16(); + } L_tot = L_max( -(INT32_MAX), L_tot); /* guard against max accumulation on the negative side , should only occur for rectangle windows */ L_tot = L_negate(L_tot); /* no saturation here */ - /* activate when xfp_exp is not used any longer */ + /* activate when xfp_exp is not used any longer */ /* pre-maximize the mantissa for the following steps in burst_ana_dx */ tmp = norm_l(L_tot); L_tot = L_shl(L_tot,tmp); @@ -241,7 +241,7 @@ Word32 winEnCalc( /* o: output summed energy Ltot */ #ifdef DYNMEM_COUNT Dyn_Mem_Out(); #endif - + return L_tot; } diff --git a/lib_lc3plus/plc_tdac_fx.c b/lib_lc3plus/plc_tdac_fx.c index c27cc9e7a..e419abfe6 100644 --- a/lib_lc3plus/plc_tdac_fx.c +++ b/lib_lc3plus/plc_tdac_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_tdc_inverse_odft_fx.c b/lib_lc3plus/plc_tdc_inverse_odft_fx.c index 1e8e3191c..753268489 100644 --- a/lib_lc3plus/plc_tdc_inverse_odft_fx.c +++ b/lib_lc3plus/plc_tdc_inverse_odft_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_tdc_lagwin_fx.c b/lib_lc3plus/plc_tdc_lagwin_fx.c index e5bd94d66..4fb8cd6c5 100644 --- a/lib_lc3plus/plc_tdc_lagwin_fx.c +++ b/lib_lc3plus/plc_tdc_lagwin_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/plc_tdc_main_fx.c b/lib_lc3plus/plc_tdc_main_fx.c index c6558dd1b..4867342cd 100644 --- a/lib_lc3plus/plc_tdc_main_fx.c +++ b/lib_lc3plus/plc_tdc_main_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -26,7 +26,6 @@ static void TDC_LPC_synthesis_fx(const Word16 sh, const Word16 a[], const Word const Word16 m); static void TDC_normalize_energy_fx(Word16 *gain, Word16 *gain_exp, const Word16 *x, const Word16 lg); -#ifdef CR8_G_ADD_75MS const Word16 beforeNextIncArray_fx[4][4] = {{0,0,0,1}, {0,1,0,1}, {0,1,1,1}, @@ -35,11 +34,8 @@ const Word16 nextIncArray_fx[4][4] = {{1,0,0,0}, {1,0,1,0}, {1,0,1,1}, {1,1,1,1}}; -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR static Word16 type_2_alpha_long(Word16 nbLostFramesInRow, Word16 frame_dms); static Word16 powWord16rest(Word16 base, Word16 exp, Word16 rest); -#endif /*****************************************************************************/ @@ -80,12 +76,8 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 Word32 *gain_c_fx, Word16 *synth_fx, Word16 *Q_syn, Word16 *alpha, Word16 max_len_pcm_plc, Word16 harmonicBuf_fx[MAX_PITCH], Word16 synthHist_fx[M], Word16 *const harmonicBuf_Q, Word8 *scratchBuffer -#ifdef CR9_I_INC_TDC_FADEOUT_LEN - ,UWord8 plc_fadeout_type -#endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR - ,Word16 * alpha_type_2_table -#endif + , UWord8 plc_fadeout_type + , Word16 * alpha_type_2_table ) { Counter i; @@ -102,9 +94,7 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 const Word16 *hp_filt_fx, *TDC_high_harm; Word16 alphaPrev_fx; Word16 throttle; -#ifdef CR8_G_ADD_75MS Word16 frame_dms_idx, nbLostFramesInRow_mod; -#endif #ifdef DYNMEM_COUNT Dyn_Mem_In("processTimeDomainConcealment_Apply_fx", sizeof(struct { @@ -126,24 +116,17 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 })); #endif -#ifdef CR9_I_INC_TDC_FADEOUT_LEN Word32 plc_fadeout_len = 0; -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR if (plc_fadeout_type >= 1){ -#else - if (plc_fadeout_type == 1){ -#endif plc_fadeout_len = PLC_FADEOUT_TYPE_1_IN_MS; } else{ plc_fadeout_len = PLC_FADEOUT_IN_MS; } -#endif /* len of output signal */ len = add(frame_length, overlap); -#ifdef CR8_G_ADD_75MS nbLostFramesInRow_mod = sub(nbLostFramesInRow, 1) & 0x0003; frame_dms_idx = mult(frame_dms, 0x051F); @@ -151,30 +134,8 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 frame_dms_idx = sub(frame_dms_idx, 1); beforeNextInc = beforeNextIncArray_fx[frame_dms_idx][nbLostFramesInRow_mod]; move16(); nextInc = nextIncArray_fx [frame_dms_idx][nbLostFramesInRow_mod]; move16(); -#else - nbLostCmpt_loc = nbLostFramesInRow; move16(); - nextInc = 1; move16(); - beforeNextInc = 1; move16(); - SWITCH (frame_dms) - { - case 25: - nbLostCmpt_loc = shr(add(nbLostFramesInRow, 3), 2); - nextInc = (nbLostFramesInRow & 0x0003) == 1; move16(); - beforeNextInc = (nbLostFramesInRow & 0x0003) == 0; move16(); - BREAK; - case 50: - nbLostCmpt_loc = shr(add(nbLostFramesInRow, 1), 1); - nextInc = (nbLostFramesInRow & 0x0001) == 1; move16(); - beforeNextInc = (nbLostFramesInRow & 0x0001) == 0; move16(); - BREAK; - } -#endif -#ifdef CR9_I_INC_TDC_FADEOUT_LEN IF (sub(nbLostCmpt_loc, plc_fadeout_len / 10) > 0) -#else - IF (sub(nbLostCmpt_loc, PLC_FADEOUT_IN_MS / 10) > 0) -#endif { gain_p_fx = 0; move16(); *gain_c_fx = 0; move32(); @@ -297,29 +258,10 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 { alphaPrev_fx = *alpha; move16(); } -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH IF (sub(plc_fadeout_type,2) == 0 ){ -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR *alpha = alpha_type_2_table[nbLostFramesInRow]; -#else - IF (sub(frame_dms,50) == 0){ - IF (sub(nbLostFramesInRow,30) >= 0){ - *alpha = 0; move16(); - } ELSE { - *alpha = FADE_OUT_TYPE_2_ALPHA_5MS[nbLostFramesInRow]; move16(); - } - } - IF (sub(frame_dms,25) == 0){ - IF (sub(nbLostFramesInRow,60) >= 0){ - *alpha = 0; move16(); - } ELSE { - *alpha = FADE_OUT_TYPE_2_ALPHA_2_5MS[nbLostFramesInRow]; move16(); - } - } -#endif } ELSE{ -#endif IF (nextInc != 0) { IF (sub(nbLostCmpt_loc, 1) == 0) @@ -386,14 +328,8 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 SWITCH (frame_dms) { case 25: *alpha = mult(*alpha, PLC34_ATTEN_FAC_025_FX); BREAK; -#ifdef CR9_J_SLOW_TDC_FADEOUT case 50: *alpha = mult(*alpha, PLC34_ATTEN_FAC_025_FX); BREAK; -#else - case 50: *alpha = mult(*alpha, PLC34_ATTEN_FAC_050_FX); BREAK; -#endif -#ifdef CR8_G_ADD_75MS case 75: *alpha = mult(*alpha, PLC34_ATTEN_FAC_075_FX); BREAK; -#endif case 100: *alpha = mult(*alpha, PLC34_ATTEN_FAC_100_FX); BREAK; } } @@ -401,9 +337,7 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 { gain_p_fx = *alpha; move16(); } -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH } -#endif /*---------------------------------------------------------------* * Construct the harmonic part * @@ -500,11 +434,7 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 gain_c_16_fx = extract_h(tmp32); gain_c_16_fx_exp = sub(15, s); -#ifdef CR9_M_FIX_DIV_ZERO gainc_tmp = L_mult (gain_c_16_fx, div_s(*alpha, s_max(alphaPrev_fx, 1))); -#else - gainc_tmp = L_mult (gain_c_16_fx, div_s(*alpha, alphaPrev_fx)); -#endif tmp32 = L_sub (tmp32, gainc_tmp); step_n_fx = round_fx(L_shl(Mpy_32_16_lc3plus(tmp32, ilen), ilen_exp)); @@ -576,11 +506,7 @@ void processTimeDomainConcealment_Apply_fx(const Word16 pitch_int, const Word16 IF (beforeNextInc != 0) { -#ifdef CR9_I_INC_TDC_FADEOUT_LEN IF (sub(nbLostCmpt_loc, plc_fadeout_len / 10) == 0) -#else - IF (sub(nbLostCmpt_loc, PLC_FADEOUT_IN_MS / 10) == 0) -#endif { gain_h_fx = (Word16)0x7FFF; move16(); step_fx = round_fx(L_shl(L_mult(gain_h_fx, ilen), ilen_exp)); @@ -1183,7 +1109,6 @@ static void TDC_normalize_energy_fx(Word16 *gain, Word16 *gain_exp, const Word16 Dyn_Mem_Deluxe_Out(); } -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR static Word16 type_2_alpha_long(Word16 nbLostFramesInRow, Word16 frame_dms) { Word16 n_help; @@ -1254,4 +1179,3 @@ static Word16 powWord16rest(Word16 base, Word16 exp, Word16 rest) { } return (Word16) exp_result; } -#endif diff --git a/lib_lc3plus/plc_tdc_pre_emphasis_fx.c b/lib_lc3plus/plc_tdc_pre_emphasis_fx.c index 3a961acf7..bd587d088 100644 --- a/lib_lc3plus/plc_tdc_pre_emphasis_fx.c +++ b/lib_lc3plus/plc_tdc_pre_emphasis_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -46,12 +46,10 @@ void processPreEmphasis_fx(Word32 *d2_fx, Word16 *d2_fx_exp, Word16 fs_idx, Word pre_emph = lpc_lin_pre_emphasis_5ms[fs_idx]; pre_emph_e = lpc_lin_pre_emphasis_e_5ms[fs_idx]; BREAK; -#ifdef CR8_G_ADD_75MS case 75: pre_emph = lpc_lin_pre_emphasis_7_5ms[fs_idx]; pre_emph_e = lpc_lin_pre_emphasis_e_7_5ms[fs_idx]; BREAK; -#endif } ASSERT(n_bands==20 || n_bands==40 || n_bands==60 || n_bands ==80); diff --git a/lib_lc3plus/plc_update_aft_imdct_fx.c b/lib_lc3plus/plc_update_aft_imdct_fx.c index 9ba483792..e1653f3af 100644 --- a/lib_lc3plus/plc_update_aft_imdct_fx.c +++ b/lib_lc3plus/plc_update_aft_imdct_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -36,12 +36,12 @@ void processPLCUpdateAfterIMDCT_fx(Word16 x_fx[], Word16 q_fx_exp, Word16 concea - + #ifdef WMOPS push_wmops("processPLCUpdateAfterIMDCT "); #endif - - + + if (plcAd) { /* for short NB frames(2.5 ms) TDC-filtering requires more PCM samples than the plc_xcorr function */ @@ -78,7 +78,7 @@ void processPLCUpdateAfterIMDCT_fx(Word16 x_fx[], Word16 q_fx_exp, Word16 concea marginOldFront = getScaleFactor16_0(&(plcAd->x_old_tot_fx[plcAd->max_len_pcm_plc - usedHistlen + pastLen]), frontLen); scale_fac_old = s_min(marginOldFront, marginOldPast); - + frontLen = 0; move16(); logic16(); logic16(); IF(bfi == 1 && *prev_bfi == 0 && sub(concealMethod, LC3_CON_TEC_PHASE_ECU) == 0) @@ -155,7 +155,7 @@ void processPLCUpdateAfterIMDCT_fx(Word16 x_fx[], Word16 q_fx_exp, Word16 concea plcAd->PhECU_short_flag_prev = 0; move16(); /* fullband transient not active */ } } - + /* values may be {0,1,2} */ *prev_prev_bfi = *prev_bfi; move16(); *prev_bfi = bfi; move16(); @@ -233,25 +233,25 @@ static void processPLCcomputeStabFac(Word16 scf_q[], Word16 old_scf_q[], Word16 #endif } -void processPLCUpdateXFP_w_E_hist_fx(Word16 prev_bfi, Word16 bfi, Word16 *xfp_fx, Word16 xfp_exp_fx, Word16 margin_xfp, +void processPLCUpdateXFP_w_E_hist_fx(Word16 prev_bfi, Word16 bfi, Word16 *xfp_fx, Word16 xfp_exp_fx, Word16 margin_xfp, Word16 fs_idx, - Word32 *L_oold_xfp_w_E_fx, Word16 *oold_xfp_w_E_exp_fx, + Word32 *L_oold_xfp_w_E_fx, Word16 *oold_xfp_w_E_exp_fx, Word32 *L_old_xfp_w_E_fx, Word16 *old_xfp_w_E_exp_fx, - - Word16 *oold_Ltot_exp_fx ,Word16 *old_Ltot_exp_fx ) + + Word16 *oold_Ltot_exp_fx ,Word16 *old_Ltot_exp_fx ) { - Word32 L_tot ; + Word32 L_tot ; Word16 dn_scale, exp_shift; Word16 used_xfp_exp_fx; - Word16 exp_out ; + Word16 exp_out ; #ifdef DYNMEM_COUNT - Dyn_Mem_In("PLCUpdateXFP_w_E_hist", sizeof(struct { + Dyn_Mem_In("PLCUpdateXFP_w_E_hist", sizeof(struct { Word32 L_tot; Word16 dn_scale, exp_shift; Word16 used_xfp_exp_fx; - Word16 exp_out; + Word16 exp_out; })); #endif #ifdef WMOPS @@ -263,16 +263,16 @@ void processPLCUpdateXFP_w_E_hist_fx(Word16 prev_bfi, Word16 bfi, Word16 *xfp_fx if (sub(prev_bfi,1) == 0) { - /* only a single historic frame available in the next frame + /* only a single historic frame available in the next frame , force artifical update of oold energy to be the same as old */ *old_xfp_w_E_exp_fx = LTOT_INIT_FLAG ; move16(); } - /* Time shift energy state and xfp exp */ - IF (sub_sat(*old_xfp_w_E_exp_fx, LTOT_INIT_FLAG ) == 0) + /* Time shift energy state and xfp exp */ + IF (sub_sat(*old_xfp_w_E_exp_fx, LTOT_INIT_FLAG ) == 0) { - *L_oold_xfp_w_E_fx = LTOT_MIN_MAN ; move32(); - *oold_xfp_w_E_exp_fx = UNINIT_OR_UNSAFE_OOLD_SENTINEL ; move16(); + *L_oold_xfp_w_E_fx = LTOT_MIN_MAN ; move32(); + *oold_xfp_w_E_exp_fx = UNINIT_OR_UNSAFE_OOLD_SENTINEL ; move16(); } ELSE { @@ -281,10 +281,10 @@ void processPLCUpdateXFP_w_E_hist_fx(Word16 prev_bfi, Word16 bfi, Word16 *xfp_fx } /* Time shift L_tot energy state and L_tot_exp */ - IF (sub_sat(*old_Ltot_exp_fx, LTOT_INIT_FLAG ) == 0) + IF (sub_sat(*old_Ltot_exp_fx, LTOT_INIT_FLAG ) == 0) { - *L_oold_xfp_w_E_fx = LTOT_MIN_MAN ; move32(); - *oold_Ltot_exp_fx = UNINIT_OR_UNSAFE_OOLD_SENTINEL ; move16(); + *L_oold_xfp_w_E_fx = LTOT_MIN_MAN ; move32(); + *oold_Ltot_exp_fx = UNINIT_OR_UNSAFE_OOLD_SENTINEL ; move16(); } ELSE { @@ -292,42 +292,42 @@ void processPLCUpdateXFP_w_E_hist_fx(Word16 prev_bfi, Word16 bfi, Word16 *xfp_fx *oold_Ltot_exp_fx = *old_Ltot_exp_fx; move16(); } - + dn_scale = e_tot_headroom[fs_idx]; /* allowed minimum dn_scale for a max upshifted signal */ - used_xfp_exp_fx = xfp_exp_fx; - + used_xfp_exp_fx = xfp_exp_fx; + IF( margin_xfp > 0 ) /* xfp_fx was normalized on a larger area than 16ms part of pcmBuffer */ - { + { ASSERT(bfi !=1) ; /* if bfi was set the margin_xfp does not reflect the correct 16ms part of pcm_buf hist, prev_synth */ - dn_scale = s_max(0, sub(e_tot_headroom[fs_idx], margin_xfp)); + dn_scale = s_max(0, sub(e_tot_headroom[fs_idx], margin_xfp)); exp_shift = sub(e_tot_headroom[fs_idx], dn_scale); used_xfp_exp_fx = sub(xfp_exp_fx, exp_shift); /* the virtual change of the xfp_buffer due to reduced downscaling in L_tot calc */ } - + /* use semifixed dn_scale as adjusted by margin_xfp in 16 ms region */ exp_out = xfp_exp_fx; move16(); L_tot = winEnCalc(xfp_fx, dn_scale , PhECU_wins[fs_idx][0], rectLengthTab[fs_idx], hamm_len2Tab[fs_idx], &exp_out ); - + *L_old_xfp_w_E_fx = L_tot; move32(); - *old_xfp_w_E_exp_fx = used_xfp_exp_fx ; move16(); + *old_xfp_w_E_exp_fx = used_xfp_exp_fx ; move16(); /* this now needs to be in Q1 , used_fx_exp , (exp_out-1-2*e_tot_headroom[fs_idx])/2 */ - *old_Ltot_exp_fx = exp_out; /* new proper _Ltot value from winEnCalc function */ - + *old_Ltot_exp_fx = exp_out; /* new proper _Ltot value from winEnCalc function */ + /* use true Word32 exponent of L_tot */ + - - /* restart oold and old from same state for init or prevBFI cases */ + /* restart oold and old from same state for init or prevBFI cases */ logic16(); IF (sub_sat(*oold_xfp_w_E_exp_fx, UNINIT_OR_UNSAFE_OOLD_SENTINEL) <= 0 || /* old xfp_Exp */ sub_sat(*oold_Ltot_exp_fx, UNINIT_OR_UNSAFE_OOLD_SENTINEL) <= 0 ) /* new L_tot_exp */ { *L_oold_xfp_w_E_fx = L_tot; move32(); - *oold_xfp_w_E_exp_fx = used_xfp_exp_fx; move16(); - *oold_Ltot_exp_fx = *old_Ltot_exp_fx; /* use Ltot exp value */ + *oold_xfp_w_E_exp_fx = used_xfp_exp_fx; move16(); + *oold_Ltot_exp_fx = *old_Ltot_exp_fx; /* use Ltot exp value */ } } diff --git a/lib_lc3plus/plc_update_fx.c b/lib_lc3plus/plc_update_fx.c index 7abb2b613..ad0fbcf95 100644 --- a/lib_lc3plus/plc_update_fx.c +++ b/lib_lc3plus/plc_update_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -22,10 +22,10 @@ void processPLCupdate_fx(AplcSetup *plcAd, Word16 x_fx[], Word16 q_fx_exp, Word1 scf_q, ns_cum_alpha, plcAd); /* NB *prev_bfi updated here */ IF ( plcAd != 0 ) - { + { /* reuse/inplace the most recent 16 ms of x_old_tot without additional rescaling, keep exponent aligned with tdc pitch buffer to save WMOPS */ - + #ifdef ENABLE_HR_MODE if (hrmode == 0) #endif @@ -57,14 +57,14 @@ void processPLCupdateSpec_fx(Word16 q_old_d_fx[], Word16 *q_old_fx_exp, Word32 q Dyn_Mem_Deluxe_Out(); } -void processPLCspec2shape_fx(Word16 prev_bfi, Word16 bfi, Word16 q_old_d_fx[], Word16 yLen, +void processPLCspec2shape_fx(Word16 prev_bfi, Word16 bfi, Word16 q_old_d_fx[], Word16 yLen, Word16 *stPhECU_oold_grp_shape_fx, Word16 *stPhECU_old_grp_shape_fx) -#define L_GRP_DC 4 +#define L_GRP_DC 4 { - Counter i,l; - Word16 *pX, tmp; + Counter i,l; + Word16 *pX, tmp; Word16 N_grp,l_grp; Word16 man, expo; Word32 L_acc; @@ -72,12 +72,12 @@ void processPLCspec2shape_fx(Word16 prev_bfi, Word16 bfi, Word16 q_old_d_fx[], W Word32 L_grp_shape[MAX_LGW]; Word16 grp_shape[MAX_LGW]; /**/ Word16 fs_idx,local_prev_bfi; - + #ifdef DYNMEM_COUNT Dyn_Mem_In("process_plc_spec_2_shape_fx", sizeof(struct { Counter i,l; - Word16 *pX; + Word16 *pX; Word16 N_grp,l_grp; Word32 L_acc; Word32 L_tot; @@ -95,77 +95,77 @@ void processPLCspec2shape_fx(Word16 prev_bfi, Word16 bfi, Word16 q_old_d_fx[], W N_grp = xavg_N_grp_fx[fs_idx]; move16(); local_prev_bfi = prev_bfi; move16(); - if (sub(local_prev_bfi, 2)==0) + if (sub(local_prev_bfi, 2)==0) { local_prev_bfi = 0; move16(); } - if( stPhECU_oold_grp_shape_fx[0] < 0 ) + if( stPhECU_oold_grp_shape_fx[0] < 0 ) { - local_prev_bfi = 1 ; move16(); /* handle startup in the case 2nd frame is a BFI frame */ + local_prev_bfi = 1 ; move16(); /* handle startup in the case 2nd frame is a BFI frame */ } /* Copy old to oold grp shape */ - FOR( i=0; i < MAX_LGW ; i++) + FOR( i=0; i < MAX_LGW ; i++) { stPhECU_oold_grp_shape_fx[i] = stPhECU_old_grp_shape_fx[i]; move16(); - } - - + } + + /* Accumulate DC bin(s) to total */ - pX = q_old_d_fx; /* ptr setup */ + pX = q_old_d_fx; /* ptr setup */ L_tot = L_deposit_h(0); /* acc on negative side */ - + FOR( i= 0; i < L_GRP_DC; i++) { tmp = shr_pos(*pX++ ,spec_shape_headroom[fs_idx]); /* scale down upscaled MDCT to create some headroom */ - L_tot = L_msu0(L_tot, tmp, tmp); - + L_tot = L_msu0(L_tot, tmp, tmp); + } - + /* Accumulate middle subbands and add to total */ FOR( i=0; i < sub(N_grp,1) ; i++) { - + L_acc = L_deposit_h(0); /* acc on negative side */ l_grp = sub(mdct_grp_bins_fx[i+1], mdct_grp_bins_fx[i]); move16(); - + FOR(l=0;lq_old_res_fx) * MIN(max_len, MAX_BW)); #endif -#ifdef CR8_A_PLC_FADEOUT_TUNING /* longterm_analysis_counter_max = PLC_LONGTERM_ANALYSIS_MS * (100.0f / 25.0f);*/ /* assert(longterm_analysis_counter_max == (PLC_LONGTERM_ANALYSIS_MS * (100 /25))); */ /* test integer division for compatibility */ /* longterm_analysis_counter_max_bytebuffer = floor(longterm_analysis_counter_max / 30.0); */ @@ -94,7 +91,6 @@ int alloc_decoder(LC3PLUS_Dec *decoder, int samplerate, int channels) plc_longterm_advc_tdc = balloc(decoder, &size, sizeof(Word32) * longterm_analysis_counter_max_bytebuffer); plc_longterm_advc_ns = balloc(decoder, &size, sizeof(Word32) * longterm_analysis_counter_max_bytebuffer); -#endif if (decoder) { @@ -125,13 +121,11 @@ int alloc_decoder(LC3PLUS_Dec *decoder, int samplerate, int channels) setup->plcAd->PhECU_X_sav_fx = sharedBuf; /* reuse of lprot(=num_FsByResQ0[fs_idx]) values from this point fwd, i.e beyond the end of q_old_fx */ setup->plcAd->PhECU_plocs = PhECU_plocs; -#ifdef CR8_A_PLC_FADEOUT_TUNING setup->plcAd->longterm_analysis_counter_max = longterm_analysis_counter_max; setup->plcAd->longterm_analysis_counter_max_bytebuffer = longterm_analysis_counter_max_bytebuffer; setup->plcAd->plc_longterm_advc_tdc = plc_longterm_advc_tdc; setup->plcAd->plc_longterm_advc_ns = plc_longterm_advc_ns; -#endif } } @@ -243,9 +237,7 @@ LC3PLUS_Error FillDecSetup(LC3PLUS_Dec *decoder, int samplerate, int channels, L setup->plcAd->PhECU_mag_chg_1st[i] = 32767; } setup->plcAd->PhECU_beta_mute = 16384; -#ifdef CR8_A_PLC_FADEOUT_TUNING setup->plcAd->PhECU_nonpure_tone_flag = -1; -#endif } } @@ -256,12 +248,8 @@ LC3PLUS_Error FillDecSetup(LC3PLUS_Dec *decoder, int samplerate, int channels, L /* set frame config params */ void set_dec_frame_params(LC3PLUS_Dec *decoder) { -# ifdef CR8_G_ADD_75MS Word16 tmp = 0; -# endif -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR Word16 n; -#endif decoder->frame_length = extract_l(L_shr_pos(Mpy_32_16_lc3plus(decoder->fs, 20972), 6)); /* fs * 0.01*2^6 */ @@ -336,7 +324,6 @@ void set_dec_frame_params(LC3PLUS_Dec *decoder) } BREAK; -#ifdef CR8_G_ADD_75MS case 75: tmp = shr_pos(decoder->frame_length, 2); decoder->frame_length = add(tmp, add(tmp, tmp)); @@ -361,7 +348,6 @@ void set_dec_frame_params(LC3PLUS_Dec *decoder) decoder->bands_number = bands_number_7_5ms[decoder->fs_idx]; } BREAK; -# endif case 100: decoder->la_zeroes = LowDelayShapes_n960_la_zeroes[decoder->fs_idx]; @@ -394,22 +380,17 @@ void set_dec_frame_params(LC3PLUS_Dec *decoder) DecSetup *setup = decoder->channel_setup[ch]; if (setup->plcAd != NULL) { /*only set if plcAd was actually allocated */ -#ifdef CR8_A_PLC_FADEOUT_TUNING setup->plcAd->longterm_analysis_counter_max = plc_fadeout_param_maxlen[(decoder->frame_dms / 25) - 1]; setup->plcAd->longterm_analysis_counter_max_bytebuffer = plc_fadeout_param_maxbytes[(decoder->frame_dms / 25) - 1]; - -#endif setup->plcAd->PhECU_frame_ms = (Word16)( decoder->frame_dms * 0.1); /* needed in processPLCupdate_fx(), now set properly set in first frame /second time */ } } } -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR FOR (n=0; n < PLC_FADEOUT_TYPE_1_IN_MS*10/decoder->frame_dms;n++){ decoder->alpha_type_2_table[n] = type_2_fadeout_fx(n, decoder->frame_dms); } -#endif } LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec *decoder, int ch, Word16 nBytes) @@ -434,12 +415,10 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec *decoder, int ch, Word16 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; @@ -488,12 +467,10 @@ LC3PLUS_Error update_dec_bitrate(LC3PLUS_Dec *decoder, int ch, Word16 nBytes) setup->enable_lpc_weighting = setup->total_bits < 240; totalBits = sub(DEPR_i_mult(setup->total_bits, 2), 160); BREAK; -#ifdef CR8_G_ADD_75MS case 75: setup->enable_lpc_weighting = setup->total_bits < 360; totalBits = L_shr(L_mult0(10923, setup->total_bits), 13); BREAK; -# endif case 100: BREAK; } diff --git a/lib_lc3plus/setup_dec_lc3.h b/lib_lc3plus/setup_dec_lc3.h index 3145cd21c..c1c556f5d 100644 --- a/lib_lc3plus/setup_dec_lc3.h +++ b/lib_lc3plus/setup_dec_lc3.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -66,9 +66,7 @@ typedef struct Word16 PhECU_oold_grp_shape_fx[MAX_LGW]; Word16 PhECU_old_grp_shape_fx[MAX_LGW]; Word16 PhECU_margin_xfp; -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 PhECU_nonpure_tone_flag; /* non-pure single tone indicator state */ -#endif Word16 PhECU_mag_chg_1st[MAX_LGW]; Word16 PhECU_Xavg[MAX_LGW]; Word16 old_scf_q[M]; @@ -76,11 +74,7 @@ typedef struct Word16 tdc_A[M + 1]; /* for now 20 ms saved Q14 or ptr to a combined ifft win and MDCT preTDA synthesis window 16 ms */ -#ifdef CR8_A_PLC_FADEOUT_TUNING Word16 longterm_counter_plcTdc; -# ifndef CR9_L_RETRAIN_FADEOUT_TYPE_CLASSIFIER - Word16 longterm_counter_plcPhaseEcu; -# endif Word16 longterm_counter_plcNsAdv; Word16 longterm_analysis_counter_max; /* Maximum longterm frames number */ Word16 longterm_analysis_counter_max_bytebuffer; /* Same as above but reduced for circular bit-buffer */ @@ -90,7 +84,6 @@ typedef struct Word16 overall_counter; Word8 longterm_counter_byte_position; Word8 longterm_counter_bit_position; -#endif } AplcSetup; /* Channel state and bitrate-derived values go in this struct */ @@ -134,9 +127,7 @@ typedef struct Word16 nbLostFramesInRow; Word16 plc_damping; Word16 last_size; -#ifdef CR9_N_SHORT_FADE_FOR_UNSTABLE_PITCH Word32 rel_pitch_change; -#endif } DecSetup; /* Constants and sampling rate derived values go in this struct */ @@ -177,9 +168,7 @@ struct LC3PLUS_Dec Word16 ltpf_mem_y_len; Word16 BW_cutoff_bits; Word16 hrmode; -#ifdef CR10_A_ATTENUATION_CURVE_SELECTOR Word16 alpha_type_2_table[80];/* PLC_FADEOUT_TYPE_1_IN_MS*10/25 */ -#endif }; #endif diff --git a/lib_lc3plus/setup_enc_lc3.c b/lib_lc3plus/setup_enc_lc3.c index 7e20912bb..23cd8e024 100644 --- a/lib_lc3plus/setup_enc_lc3.c +++ b/lib_lc3plus/setup_enc_lc3.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -69,12 +69,14 @@ LC3PLUS_Error FillEncSetup(LC3PLUS_Enc *encoder, int samplerate, int channels encoder->bandwidth = L_shr_pos(encoder->fs, 1); encoder->bandwidth_preset = L_shr_pos(encoder->fs, 1); - 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; + } } - for (ch = 0; ch < encoder->channels; ch++) { encoder->channel_setup[ch]->x_exp = 15; @@ -89,11 +91,7 @@ LC3PLUS_Error FillEncSetup(LC3PLUS_Enc *encoder, int samplerate, int channels /* set frame config params */ void set_enc_frame_params(LC3PLUS_Enc *encoder) { -#ifdef CR8_G_ADD_75MS -# ifdef ENABLE_075_DMS_MODE Word16 tmp; -# endif -#endif encoder->frame_length = extract_l(L_shr_pos(Mpy_32_16_lc3plus(encoder->fs, 20972), 6)); /* fs * 0.01*2^6 */ @@ -169,7 +167,6 @@ void set_enc_frame_params(LC3PLUS_Enc *encoder) encoder->ltpf_mem_in_len = LTPF_MEMIN_LEN; BREAK; -#ifdef CR8_G_ADD_75MS case 75: tmp = shr_pos(encoder->frame_length, 2); encoder->frame_length = add(tmp, add(tmp, tmp)); @@ -203,7 +200,6 @@ void set_enc_frame_params(LC3PLUS_Enc *encoder) encoder->bands_offset = bands_offset_7_5ms[encoder->fs_idx]; } BREAK; -# endif case 100: encoder->la_zeroes = LowDelayShapes_n960_la_zeroes[encoder->fs_idx]; @@ -279,14 +275,12 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc *encoder, int bitrate) 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) @@ -328,7 +322,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; // special value for maxBR @ 7.5ms @@ -347,7 +340,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; @@ -398,7 +390,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; // special value for maxBR @ 7.5ms @@ -417,7 +408,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; @@ -544,11 +534,7 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc *encoder, int bitrate) { case 25: max_bytes = MAX_NBYTES_025; break; case 50: max_bytes = MAX_NBYTES_050; break; -#ifdef ENABLE_075_DMS_MODE -# ifdef CR8_G_ADD_75MS case 75: max_bytes = MAX_NBYTES_075; BREAK; -# endif -#endif case 100: max_bytes = MAX_NBYTES_100; break; } #ifdef ENABLE_HR_MODE @@ -598,12 +584,10 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc *encoder, int bitrate) setup->ltpf_enable = sub(sub(DEPR_i_mult(setup->total_bits, 2), 160), add(560, DEPR_i_mult(80, encoder->fs_idx))) < 0; setup->enable_lpc_weighting = setup->total_bits < 240; BREAK; -#ifdef CR8_G_ADD_75MS case 75: setup->ltpf_enable = sub(L_shr(L_mult0(10923, setup->total_bits), 13), add(560, DEPR_i_mult(80, encoder->fs_idx))) < 0; setup->enable_lpc_weighting = setup->total_bits < 360; BREAK; -# endif case 100: setup->enable_lpc_weighting = setup->total_bits < 480; setup->ltpf_enable = sub(setup->total_bits, add(560, DEPR_i_mult(80, encoder->fs_idx))) < 0; @@ -675,12 +659,10 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc *encoder, int bitrate) { encoder->sns_damping = SNS_DAMPING_HRMODE_UB_10MS; } -#ifdef CR8_G_ADD_75MS IF ((encoder->frame_dms == 75) & (setup->total_bits > 3300)) { encoder->sns_damping = SNS_DAMPING_HRMODE_UB_7_5MS; } -#endif IF ((encoder->frame_dms == 50) & (setup->total_bits > 2300)) { encoder->sns_damping = SNS_DAMPING_HRMODE_UB_5MS; @@ -703,12 +685,10 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc *encoder, int bitrate) { setup->regBits += 2; } -#ifdef CR8_G_ADD_75MS if (encoder->frame_dms == 75) { setup->regBits +=1; } -#endif if (encoder->frame_dms == 25) { setup->regBits -= 6; @@ -724,12 +704,10 @@ LC3PLUS_Error update_enc_bitrate(LC3PLUS_Enc *encoder, int bitrate) { setup->regBits += 0; } -#ifdef CR8_G_ADD_75MS if (encoder->frame_dms == 75) { setup->regBits +=2; } -#endif if (encoder->frame_dms == 100) { setup->regBits += 5; diff --git a/lib_lc3plus/setup_enc_lc3.h b/lib_lc3plus/setup_enc_lc3.h index 34e26a59d..c9a1076a3 100644 --- a/lib_lc3plus/setup_enc_lc3.h +++ b/lib_lc3plus/setup_enc_lc3.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -33,9 +33,7 @@ typedef struct Word16 targetBitsQuant; Word16 olpa_mem_s6k4_exp; Word16 olpa_mem_pitch; -#ifdef CR9_F_PITCH_WIN_LEN_FIX Word16 pitch_flag; -#endif Word16 ltpf_mem_in_exp; Word16 ltpf_mem_normcorr; Word16 ltpf_mem_mem_normcorr; @@ -63,11 +61,7 @@ typedef struct Word16 r12k8_mem_in[60]; #endif Word32 r12k8_mem_50[2]; -#ifdef CR8_G_ADD_75MS Word16 r12k8_mem_out[44]; -#else - Word16 r12k8_mem_out[24]; -#endif Word16 olpa_mem_s12k8[3]; Word16 olpa_mem_s6k4[LEN_6K4 + MAX_PITCH_6K4 + 16]; Word16 ltpf_mem_in[LTPF_MEMIN_LEN + LEN_12K8 + 1]; diff --git a/lib_lc3plus/sns_compute_scf_fx.c b/lib_lc3plus/sns_compute_scf_fx.c index d56a1a7f8..cc3338b77 100644 --- a/lib_lc3plus/sns_compute_scf_fx.c +++ b/lib_lc3plus/sns_compute_scf_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/sns_interpolate_scf_fx.c b/lib_lc3plus/sns_interpolate_scf_fx.c index e71825d07..65e4b1c16 100644 --- a/lib_lc3plus/sns_interpolate_scf_fx.c +++ b/lib_lc3plus/sns_interpolate_scf_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/sns_quantize_scf_fx.c b/lib_lc3plus/sns_quantize_scf_fx.c index f1f0ba423..baa33a1c1 100644 --- a/lib_lc3plus/sns_quantize_scf_fx.c +++ b/lib_lc3plus/sns_quantize_scf_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/tinywavein_c.h b/lib_lc3plus/tinywavein_c.h index 32789e314..ff7e17ca4 100644 --- a/lib_lc3plus/tinywavein_c.h +++ b/lib_lc3plus/tinywavein_c.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/tinywaveout_c.h b/lib_lc3plus/tinywaveout_c.h index 672254270..2f64a659f 100644 --- a/lib_lc3plus/tinywaveout_c.h +++ b/lib_lc3plus/tinywaveout_c.h @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * diff --git a/lib_lc3plus/tns_coder_fx.c b/lib_lc3plus/tns_coder_fx.c index 640e246cc..738f4e95b 100644 --- a/lib_lc3plus/tns_coder_fx.c +++ b/lib_lc3plus/tns_coder_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -111,7 +111,6 @@ void processTnsCoder_fx(Word16 *bits, Word16 indexes[], Word32 x[], Word16 BW_cu xLen = shr_pos(xLen, 1); maxOrder = 4; BREAK; -#ifdef CR8_G_ADD_75MS case 75: startfreq[0] = 9; move16(); @@ -123,7 +122,6 @@ void processTnsCoder_fx(Word16 *bits, Word16 indexes[], Word32 x[], Word16 BW_cu xLen = add(tmp, add(tmp, tmp)); maxOrder = 8; BREAK; -#endif default: /* 100 */ startfreq[0] = 12; move16(); @@ -197,9 +195,7 @@ void processTnsCoder_fx(Word16 *bits, Word16 indexes[], Word32 x[], Word16 BW_cu { case 25: facs_e = add(facs_e, 1); BREAK; case 50: facs_e = add(facs_e, 1); BREAK; -#ifdef CR8_G_ADD_75MS case 75: BREAK; -#endif case 100: BREAK; } diff --git a/lib_lc3plus/tns_decoder_fx.c b/lib_lc3plus/tns_decoder_fx.c index b138c4510..aad24424c 100644 --- a/lib_lc3plus/tns_decoder_fx.c +++ b/lib_lc3plus/tns_decoder_fx.c @@ -1,5 +1,5 @@ /****************************************************************************** -* ETSI TS 103 634 V1.4.5 * +* ETSI TS 103 634 V1.5.1 * * Low Complexity Communication Codec Plus (LC3plus) * * * * Copyright licence is solely granted through ETSI Intellectual Property * @@ -53,12 +53,10 @@ void processTnsDecoder_fx(Word16 rc_idx[], Word32 x[], Word16 xLen, Word16 order startfreq[0] = 6; move16(); BW_stopband = shr_pos(BW_stopband, 1); BREAK; -#ifdef CR8_G_ADD_75MS case 75: startfreq[0] = 9; move16(); BW_stopband = add(shr_pos(BW_stopband, 2), add(shr_pos(BW_stopband, 2), shr_pos(BW_stopband, 2))); BREAK; -#endif case 100: startfreq[0] = 12; BREAK; } -- GitLab From 7531ee1e5c97942d1ede94e5206a9241071882ac Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 6 Aug 2025 15:45:40 +0200 Subject: [PATCH 2/2] remove whitespace from preprocessor macros (again) --- lib_lc3plus/basop_mpy_lc3plus.h | 4 +-- lib_lc3plus/constants.c | 16 +++++----- lib_lc3plus/constants.h | 10 +++--- lib_lc3plus/dct4_fx.c | 4 +-- lib_lc3plus/defines.h | 46 ++++++++++++++-------------- lib_lc3plus/functions.h | 4 +-- lib_lc3plus/mdct_fx.c | 6 ++-- lib_lc3plus/plc_phecu_fec_hq_fx.c | 6 ++-- lib_lc3plus/rom_basop_util_lc3plus.c | 8 ++--- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib_lc3plus/basop_mpy_lc3plus.h b/lib_lc3plus/basop_mpy_lc3plus.h index 88be545f9..055a27fd1 100644 --- a/lib_lc3plus/basop_mpy_lc3plus.h +++ b/lib_lc3plus/basop_mpy_lc3plus.h @@ -49,8 +49,8 @@ Word32 Mpy_32_16_lc3plus(Word32 x, Word16 y); */ Word32 Mpy_32_32_lc3plus(Word32 x, Word32 y); -# ifdef ENABLE_HR_MODE -# define cplxMpy32_32_32_2(re, im, a, b, c, d) \ +#ifdef ENABLE_HR_MODE +#define cplxMpy32_32_32_2(re, im, a, b, c, d) \ do \ { \ re = L_sub(Mpy_32_32_0(a, c), Mpy_32_32_0(b, d)); \ diff --git a/lib_lc3plus/constants.c b/lib_lc3plus/constants.c index 1b21baac1..9f1992bf7 100644 --- a/lib_lc3plus/constants.c +++ b/lib_lc3plus/constants.c @@ -1794,12 +1794,12 @@ RAM_ALIGN const Word16 PLC_FADEOUT_TYPE_2_SELECTOR = 10; /* can take values from RAM_ALIGN const Word16 NN_thresh = 0x7800; /* 30*2^10 */ RAM_ALIGN const Word16 NN_thresh_exp = -10; /* Tone detector */ -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE RAM_ALIGN const Word32 TD_HR_thresh_10ms = 83402; RAM_ALIGN const Word32 TD_HR_thresh_7_5ms = 743496; RAM_ALIGN const Word32 TD_HR_thresh_5ms = 382564; RAM_ALIGN const Word32 TD_HR_thresh_2_5ms = 301695; -# endif /* ENABLE_HR_MODE */ +#endif /* ENABLE_HR_MODE */ RAM_ALIGN const Word32 BW_thresh_quiet[4] = {0x14000000, 0xA000000, 0xA000000, 0xA000000}; /* [20,10,10,10]*2^24 */ RAM_ALIGN const Word16 BW_thresh_quiet_exp = 31 - 24; RAM_ALIGN const Word16 BW_thresh_brickwall[4] = { @@ -1888,7 +1888,7 @@ RAM_ALIGN const Word16 LowDelayShapes_n960_la_zeroes[NUM_SAMP_FREQ] = {30, #endif }; -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE const Word16 LowDelayShapes_n960_len_7_5ms[6] = {106, 212, 318, 424, 636, 1272}; #else const Word16 LowDelayShapes_n960_len_7_5ms[5] = {106, 212, 318, 424, 636}; @@ -2257,7 +2257,7 @@ RAM_ALIGN const Word16 LowDelayShapes_n960_N360_7_5ms[636] = { const Word16 *const LowDelayShapes_n960_7_5ms[5] = { LowDelayShapes_n960_N60_7_5ms, LowDelayShapes_n960_N120_7_5ms, LowDelayShapes_n960_N180_7_5ms, LowDelayShapes_n960_N240_7_5ms, LowDelayShapes_n960_N360_7_5ms}; -# endif +#endif #ifdef ENABLE_HR_MODE #ifdef SUBSET_NB @@ -4314,11 +4314,11 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_5ms[NUM_OFFSETS] = {39, 42, 34, #endif }; -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE RAM_ALIGN const Word16 bands_number_7_5ms [] = {60, 64, 64, 64, 64, 64}; #else RAM_ALIGN const Word16 bands_number_7_5ms [] = {60, 64, 64, 64, 64}; -# endif +#endif #ifdef ENABLE_HR_MODE RAM_ALIGN const Word16 bands_number_5ms[NUM_SAMP_FREQ] = {39, 50, 52, 54, 55, 58}; @@ -4368,7 +4368,7 @@ RAM_ALIGN const Word16 bands_offset_96000_lpc_lin_7_5ms[81] = 0x01f8, 0x0201, 0x020a, 0x0213, 0x021c, 0x0225, 0x022e, 0x0237, 0x0240, 0x0249, 0x0252, 0x025b, 0x0264, 0x026d, 0x0276, 0x027f, 0x0288, 0x0291, 0x029a, 0x02a3, 0x02ac, 0x02b5, 0x02be, 0x02c7, 0x02d0 }; -# endif +#endif RAM_ALIGN const Word16 *const bands_offset_lin[NUM_SAMP_FREQ] = {bands_offset_8000_lpc_lin, bands_offset_16000_lpc_lin, @@ -4446,7 +4446,7 @@ RAM_ALIGN const Word16 bands_offset_with_two_max_lin_2_5ms[NUM_SAMP_FREQ] = {0, #endif }; -# ifdef SUBSET_NB +#ifdef SUBSET_NB RAM_ALIGN const Word16 bands_offset_8000_lpc_warp_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, diff --git a/lib_lc3plus/constants.h b/lib_lc3plus/constants.h index 628e06c45..a367939a9 100644 --- a/lib_lc3plus/constants.h +++ b/lib_lc3plus/constants.h @@ -59,7 +59,7 @@ extern RAM_ALIGN const Word32 *const LowDelayShapes_n960_2_5ms[6]; extern RAM_ALIGN const Word16 *const LowDelayShapes_n960_2_5ms[6]; #endif -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE extern RAM_ALIGN const Word32 *const LowDelayShapes_n960_7_5ms[5]; #else extern RAM_ALIGN const Word16 *const LowDelayShapes_n960_7_5ms[5]; @@ -74,12 +74,12 @@ extern RAM_ALIGN const Word16 LowDelayShapes_n960_la_zeroes_7_5ms[NUM_SAMP_FREQ] extern RAM_ALIGN const Word16 NN_thresh; extern RAM_ALIGN const Word16 NN_thresh_exp; -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE extern RAM_ALIGN const Word32 TD_HR_thresh_10ms; extern RAM_ALIGN const Word32 TD_HR_thresh_7_5ms; extern RAM_ALIGN const Word32 TD_HR_thresh_5ms; extern RAM_ALIGN const Word32 TD_HR_thresh_2_5ms; -# endif /* ENABLE_HR_MODE */ +#endif /* ENABLE_HR_MODE */ extern RAM_ALIGN const Word32 BW_thresh_quiet[4]; extern RAM_ALIGN const Word16 BW_thresh_quiet_exp; extern RAM_ALIGN const Word16 BW_thresh_brickwall[4]; @@ -192,8 +192,8 @@ extern RAM_ALIGN const Word16 *const bands_offset_7_5ms[5]; extern RAM_ALIGN const Word16 bands_number_7_5ms_HR[]; #ifndef GENERATE_BAND_TABLES extern RAM_ALIGN const Word16 *const bands_offset_7_5ms_HR[2]; -# endif -# endif +#endif +#endif extern RAM_ALIGN const Word16 pitch_max[5]; extern RAM_ALIGN const Word16 plc_preemph_fac[NUM_SAMP_FREQ]; diff --git a/lib_lc3plus/dct4_fx.c b/lib_lc3plus/dct4_fx.c index e3bf78e92..0e5957c86 100644 --- a/lib_lc3plus/dct4_fx.c +++ b/lib_lc3plus/dct4_fx.c @@ -14,9 +14,9 @@ void dct_IV(Word32 *pDat, /* i/o: pointer to data buffer */ Word16 *pDat_e, /* i/o: pointer to data exponent */ Word16 L, /* i : length of block */ -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE Word16 hrmode, /* indicate high precision usage */ -# endif +#endif Word32 *workBuffer) /* : size of L */ { diff --git a/lib_lc3plus/defines.h b/lib_lc3plus/defines.h index 7f3f0d1e7..f21d5cf37 100644 --- a/lib_lc3plus/defines.h +++ b/lib_lc3plus/defines.h @@ -93,20 +93,20 @@ #endif /* NO_POST_REL_CHANGES Post-release changes */ -# define THRESH_100_DMS_TDC_CNT 9 -# define THRESH_100_DMS_NS_CNT 7 -# define THRESH_100_DMS_TDC_NS_CNT 73 -# define THRESH_075_DMS_TDC_CNT 7 -# define THRESH_075_DMS_NS_CNT 7 -# define THRESH_075_DMS_TDC_NS_CNT 87 -# define THRESH_050_DMS_TDC_CNT 22 -# define THRESH_050_DMS_NS_CNT 15 -# define THRESH_050_DMS_TDC_NS_CNT 141 -# define THRESH_025_DMS_TDC_CNT 20 -# define THRESH_025_DMS_NS_CNT 21 -# define THRESH_025_DMS_TDC_NS_CNT 278 -# define PLC_LONGTERM_ANALYSIS_MS 200 /* Nominal analysis window 2000 ms */ -# define PLC_LONGTERM_ANALYSIS_STARTUP_FILL (Word16)(0.5*32768.0) /* 16384/32768 == 0.5 required buffer fill amount, set to 0.0 to not require any fill at all */ +#define THRESH_100_DMS_TDC_CNT 9 +#define THRESH_100_DMS_NS_CNT 7 +#define THRESH_100_DMS_TDC_NS_CNT 73 +#define THRESH_075_DMS_TDC_CNT 7 +#define THRESH_075_DMS_NS_CNT 7 +#define THRESH_075_DMS_TDC_NS_CNT 87 +#define THRESH_050_DMS_TDC_CNT 22 +#define THRESH_050_DMS_NS_CNT 15 +#define THRESH_050_DMS_TDC_NS_CNT 141 +#define THRESH_025_DMS_TDC_CNT 20 +#define THRESH_025_DMS_NS_CNT 21 +#define THRESH_025_DMS_TDC_NS_CNT 278 +#define PLC_LONGTERM_ANALYSIS_MS 200 /* Nominal analysis window 2000 ms */ +#define PLC_LONGTERM_ANALYSIS_STARTUP_FILL (Word16)(0.5*32768.0) /* 16384/32768 == 0.5 required buffer fill amount, set to 0.0 to not require any fill at all */ #define REL_PITCH_THRESH 11796 @@ -181,16 +181,16 @@ do not change __forceinline for mex compilation using gcc6.3.0 or larger #define MAX_BR_100DMS_SSWB 314400 /* for 100ms at 24kHz */ #endif -# 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) */ -# define MAX_BR_075DMS 426667 /* ceil(400 * 800 * 100/ 75) */ -# 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) */ +#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) */ +#define MAX_BR_075DMS 426667 /* ceil(400 * 800 * 100/ 75) */ +#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) */ -# define NOISEFILLWIDTH_7_5MS 2 -# define NOISEFILLSTART_7_5MS 18 +#define NOISEFILLWIDTH_7_5MS 2 +#define NOISEFILLSTART_7_5MS 18 #define PACK_RESBITS diff --git a/lib_lc3plus/functions.h b/lib_lc3plus/functions.h index 25a21163c..b557ca38f 100644 --- a/lib_lc3plus/functions.h +++ b/lib_lc3plus/functions.h @@ -118,9 +118,9 @@ void processMdct_fx( Word16 x[], #endif Word16 x_exp, Word16 N, -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE Word16 hrmode, /* i: indicate high precision */ -# endif +#endif #ifdef ENABLE_HR_MODE const Word32 w[], /* i: window coefficients including normalization of sqrt(2/N) and scaled by 2^4 */ #else diff --git a/lib_lc3plus/mdct_fx.c b/lib_lc3plus/mdct_fx.c index c3f48c6dd..1953b6d68 100644 --- a/lib_lc3plus/mdct_fx.c +++ b/lib_lc3plus/mdct_fx.c @@ -18,9 +18,9 @@ void processMdct_fx( Word16 x[], /* i: time input signal */ #endif Word16 x_exp, Word16 N, /* i: block size N */ -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE Word16 hrmode, /* i: indicate high precision */ -# endif +#endif #ifdef ENABLE_HR_MODE const Word32 w[], /* i: window coefficients including normalization of sqrt(2/N) and scaled by 2^4 */ #else @@ -132,7 +132,7 @@ void processMdct_fx( y[m - 1 - i] = L_mac0(L_mult0(x[2 * m - memLen + i], w[2 * m + i]), x[4 * m - memLen - 1 - i], w[4 * m - 1 - i]); move32(); } -# endif +#endif s = s_max(0, getScaleFactor32_lc3plus(y, N)); FOR (i = 0; i < N; i++) diff --git a/lib_lc3plus/plc_phecu_fec_hq_fx.c b/lib_lc3plus/plc_phecu_fec_hq_fx.c index 96b450ca8..5686920de 100644 --- a/lib_lc3plus/plc_phecu_fec_hq_fx.c +++ b/lib_lc3plus/plc_phecu_fec_hq_fx.c @@ -20,9 +20,9 @@ #define MAX_INCREASE_GRPPOW_FX 0 /* max. amplification in case of transients (in dB scale) */ -# 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 */ -# define SIDE_LIM 12539859L /* 10^ (4.5/20.0) = 2^(a); --> x= 0.747433821 -> Lx_Q24 = round((1L<<(24))*0.747433821)) = 12539859 */ -# define LFHF_LIM 16719812L /* 10^ (6.0/20.0) = 2^(b); --> x= 0.996578428 -> Lx_Q24 = round((1L<<(24))*0.996578428)) = 16719812 */ +#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 */ +#define SIDE_LIM 12539859L /* 10^ (4.5/20.0) = 2^(a); --> x= 0.747433821 -> Lx_Q24 = round((1L<<(24))*0.747433821)) = 12539859 */ +#define LFHF_LIM 16719812L /* 10^ (6.0/20.0) = 2^(b); --> x= 0.996578428 -> Lx_Q24 = round((1L<<(24))*0.996578428)) = 16719812 */ #define CMPLMNT_PLOC_SENS_FX 2294 /* (1.0 - p_locator_sens) in Q15 */ #define FEC_HQ_ECU_ROOT2 23170 /*(0x5a83) */ /* sqrt(2) in Q14 */ diff --git a/lib_lc3plus/rom_basop_util_lc3plus.c b/lib_lc3plus/rom_basop_util_lc3plus.c index 4a9400b4f..6e53895e1 100755 --- a/lib_lc3plus/rom_basop_util_lc3plus.c +++ b/lib_lc3plus/rom_basop_util_lc3plus.c @@ -354,7 +354,7 @@ const PWord16 SineTable320[] = { }; -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE const PWord32 SineTable720[] = { STCP(0x7fffffff, 0x00000000), STCP(0x7fffec08, 0x00477d17), STCP(0x7fffb025, 0x008efa17), @@ -1072,7 +1072,7 @@ const PWord16 SineWindow480[240] = { WTCP(0x5b3f42ae, 0x59c42381), WTCP(0x5af3eee6, 0x5a107561), WTCP(0x5aa85b48, 0x5a5c880a), }; -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE const PWord32 SineWindow720[360] = { WTCP(0x7ffffb01, 0x0023be8d), WTCP(0x7fffd314, 0x006b3b9b), WTCP(0x7fff833a, 0x00b2b888), WTCP(0x7fff0b72, 0x00fa353e), WTCP(0x7ffe6bbe, 0x0141b1a5), WTCP(0x7ffda41c, 0x01892da8), @@ -1358,7 +1358,7 @@ const PWord32 SineWindow960[480] = { WTCP(0x5b520da0, 0x59b1052e), WTCP(0x5b2c73ba, 0x59d73de2), WTCP(0x5b06c9d6, 0x59fd66d3), WTCP(0x5ae10ff8, 0x5a237ff9), WTCP(0x5abb4628, 0x5a49894f), WTCP(0x5a956c6d, 0x5a6f82cd), }; -# endif +#endif // fs 48 32 24 16 8 // ms +-------------------- @@ -1772,7 +1772,7 @@ const Word16 RotVector_480[2 * (480 - 30)] = { SHC(0x00000000), SHC(0x7fffffff), SHC(0x18f8b83c), SHC(0x7d8a5f40), SHC(0x30fbc54d), SHC(0x7641af3d), SHC(0x471cece7), SHC(0x6a6d98a4), SHC(0x5a82799a), SHC(0x5a82799a), SHC(0x6a6d98a4), SHC(0x471cece7)}; -# ifdef ENABLE_HR_MODE +#ifdef ENABLE_HR_MODE const Word32 RotVector_720[2 * (720 - 30)] = { SHC(0x7fffffff), SHC(0x00000000), SHC(0x7ffb0260), SHC(0xfdc41e9b), SHC(0x7fec09e3), SHC(0xfb8869ce), SHC(0x7fd317b4), SHC(0xf94d0e2e), SHC(0x7fb02dc6), SHC(0xf7123849), SHC(0x7f834ed0), SHC(0xf4d814a4), -- GitLab