From 0c59e09c226466dd7c2ce45b3e212d13db454b98 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:10:55 +0200 Subject: [PATCH 01/49] Accept SIMPLIFY_CORE_ENC --- lib_com/ivas_prot_fx.h | 15 -- lib_com/options.h | 1 - lib_enc/hq_core_enc_fx.c | 6 - lib_enc/ivas_core_enc_fx.c | 267 ------------------------- lib_enc/ivas_core_pre_proc_fx.c | 6 - lib_enc/ivas_stereo_mdct_core_enc_fx.c | 15 -- lib_enc/ivas_tcx_core_enc_fx.c | 15 -- lib_enc/prot_fx_enc.h | 4 - 8 files changed, 329 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 910e872b2..f1c673750 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2782,34 +2782,23 @@ void InternalTCXDecoder_fx( void stereo_tcx_core_enc( Encoder_State *st, /* i/o: encoder state structure */ -#ifdef SIMPLIFY_CORE_ENC Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz */ Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz */ -#else - const Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz */ - const Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz */ -#endif const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes,Q12*/ Word16 lsp_new_fx[], /* i : LSPs at the end of the frame, Q15 */ Word16 lsp_mid_fx[], /* i : LSPs in the middle of the frame, Q15 */ Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ const Word16 last_element_mode, /* i : last element mode, Q0 */ const Word16 vad_hover_flag, /* i : VAD hangover flag, Q0 */ -#ifdef SIMPLIFY_CORE_ENC const Word16 Q_new_orig /* i : Scaling factor of new_samples_xx[] */ -#else - Word16 Q_new -#endif ); -#ifdef SIMPLIFY_CORE_ENC void stereo_tcx_enc_scale_buffers( Encoder_State *st, /* i/o: encoder state structure */ const Word16 n_channels, /* i : number of core channels */ const Word16 Q_spec_old /* i : Q of old spectrum */ ); -#endif Word16 transient_analysis_ivas_fx( TRAN_DET_HANDLE hTranDet, /* i : handle transient detection */ const Word16 cor_map_LT[], /* i : LT correlation map Q_cor_map = Qx */ @@ -5746,11 +5735,7 @@ void pre_proc_ivas_fx( const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* i : energy buffer e_enerBuffer */ -#ifdef SIMPLIFY_CORE_ENC Word16 e_enerBuffer, /* i : Q value of energy buffer */ -#else - const Word16 e_enerBuffer, /* i : Q value of energy buffer */ -#endif Word16 fft_buff_fx[2 * L_FFT], /* i : FFT buffer Qx*/ const Word16 cor_map_sum_fx, /* i : speech/music clasif. parameter Q8*/ Word16 *Q_new /* i/o: Q factor of speech buffers */ diff --git a/lib_com/options.h b/lib_com/options.h index cd569d12b..ea3bcaa6a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define SIMPLIFY_CORE_ENC /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 9b7978255..426a8f2bf 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -71,11 +71,7 @@ void HQ_core_enc_init_fx( void hq_core_enc_fx( Encoder_State *st, /* i/o: encoder state structure */ -#ifdef SIMPLIFY_CORE_ENC Word16 *audio_fx, /* i : input audio signal Q0*/ -#else - const Word16 *audio_fx, /* i : input audio signal Q0*/ -#endif const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ @@ -127,7 +123,6 @@ void hq_core_enc_fx( st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; move16(); -#ifdef SIMPLIFY_CORE_ENC /*-------------------------------------------------------------------------- * Scaling of buffers *--------------------------------------------------------------------------*/ @@ -145,7 +140,6 @@ void hq_core_enc_fx( move16(); } -#endif /*-------------------------------------------------------------------------- * Preprocessing in the first HQ frame after ACELP frame * Find the number of bits for PVQ coding diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index b734fce52..550e7656c 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -111,11 +111,7 @@ ivas_error ivas_core_enc_fx( Word16 diff_nBits; ivas_error error; Word16 max_num_indices_BWE; -#ifdef SIMPLIFY_CORE_ENC Word16 i, shift; -#else - Word16 i, shift, Q_min; -#endif FOR( i = 0; i < CPE_CHANNELS; i++ ) { @@ -209,22 +205,6 @@ ivas_error ivas_core_enc_fx( * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ -#ifndef SIMPLIFY_CORE_ENC - IF( st->cldfbAnaEnc ) - { - Word16 tmp_shift = L_norm_arr( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels ); - tmp_shift = sub( tmp_shift, 5 ); - IF( tmp_shift < 0 ) - { - scale_sig32( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels, tmp_shift ); /* enerBuffer_fx_exp[n] - tmp_shift */ - enerBuffer_fx_exp[n] = sub( enerBuffer_fx_exp[n], tmp_shift ); - move16(); - } - } - - Scale_sig( fft_buff_fx[n], ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum - // fft_buff_fx_exp = add(fft_buff_fx_exp,1); -#endif FOR( i = 0; i < st->nb_subfr; i++ ) { Scale_sig( &Aw_fx[n][i * ( M + 1 )], M + 1, sub( norm_s( Aw_fx[n][i * ( M + 1 )] ), 2 ) ); // scaling to Q12 @@ -331,89 +311,12 @@ ivas_error ivas_core_enc_fx( IF( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { /* TCX core encoder */ -#ifdef SIMPLIFY_CORE_ENC - stereo_tcx_core_enc( st, old_inp_12k8_fx[n] + L_INP_MEM, old_inp_16k_fx[n] + L_INP_MEM, Aw_fx[n], lsp_new_fx[n], lsp_mid_fx[n], pitch_buf_fx[n], last_element_mode, vad_hover_flag[0], Q_new[n] ); -#else - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - Word16 Q_spec_old, L_spec; - -#ifdef NONBE_FIX_ISSUE_2206 - Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( negate( 1 ), st->hTcxEnc->q_Txnq ) ); /* Q(-1) */ - st->hTcxEnc->q_Txnq = -Q1; - move16(); - - Q_spec_old = hTcxEnc->spectrum_long_e; - move16(); - - /* TCX core encoder */ stereo_tcx_core_enc( st, old_inp_12k8_fx[n] + L_INP_MEM, old_inp_16k_fx[n] + L_INP_MEM, Aw_fx[n], lsp_new_fx[n], lsp_mid_fx[n], pitch_buf_fx[n], last_element_mode, vad_hover_flag[0], Q_new[n] ); -#else - Scale_sig( old_inp_12k8_fx[n], L_INP_12k8, sub( Q1, Q_new[n] ) ); // Q0 - Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q1, Q_new[n] ) ); // Q0 - - Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( negate( 1 ), st->hTcxEnc->q_Txnq ) ); /* Q(-1) */ - st->hTcxEnc->q_Txnq = -Q1; - move16(); - Q_spec_old = st->hTcxEnc->spectrum_long_e; - move16(); - - /* TCX core encoder */ - stereo_tcx_core_enc( st, old_inp_12k8_fx[n] + L_INP_MEM, old_inp_16k_fx[n] + L_INP_MEM, Aw_fx[n], lsp_new_fx[n], lsp_mid_fx[n], pitch_buf_fx[n], last_element_mode, vad_hover_flag[0], 0 ); - - Scale_sig( old_inp_12k8_fx[n], L_INP_12k8, sub( Q_new[n], Q1 ) ); // Q_new[n] - 1 - Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q_new[n], Q1 ) ); // Q_new[n] - 1 - - Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( st->hTcxEnc->Q_old_out ) ); // scaling back to Q0 - st->hTcxEnc->Q_old_out = 0; - move16(); -#endif - - IF( EQ_16( hTcxEnc->tcxMode, TCX_20 ) ) - { - L_spec = st->hTcxCfg->tcx_coded_lines; - move16(); - Word16 e_max = s_max( hTcxEnc->spectrum_e[0], Q_spec_old ); - e_max = sub( e_max, L_norm_arr( hTcxEnc->spectrum_long_fx, N_MAX ) ); - scale_sig32( hTcxEnc->spectrum_fx[0], L_spec, sub( hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) - scale_sig32( hTcxEnc->spectrum_long_fx + L_spec, sub( N_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max) - - hTcxEnc->spectrum_long_e = e_max; - move16(); - } - ELSE - { - Word16 e_max = s_max( Q_spec_old, s_max( hTcxEnc->spectrum_e[0], hTcxEnc->spectrum_e[1] ) ); - e_max = sub( e_max, L_norm_arr( hTcxEnc->spectrum_long_fx, N_MAX ) ); - L_spec = shr( st->hTcxCfg->tcx_coded_lines, 1 ); - scale_sig32( hTcxEnc->spectrum_fx[0], L_spec, sub( hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) - scale_sig32( hTcxEnc->spectrum_fx[1], L_spec, sub( hTcxEnc->spectrum_e[1], e_max ) ); // exp(e_max) - scale_sig32( hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max) - scale_sig32( hTcxEnc->spectrum_fx[1] + L_spec, sub( N_MAX - N_TCX10_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max) - - hTcxEnc->spectrum_long_e = s_max( Q_spec_old, s_max( hTcxEnc->spectrum_e[0], hTcxEnc->spectrum_e[1] ) ); - move16(); - } - hTcxEnc->spectrum_e[0] = hTcxEnc->spectrum_long_e; - move16(); - hTcxEnc->spectrum_e[1] = hTcxEnc->spectrum_long_e; - move16(); -#endif } IF( EQ_16( st->core, HQ_CORE ) ) { /* HQ core encoder */ -#ifndef SIMPLIFY_CORE_ENC - Scale_sig( st->input_fx, input_frame, negate( st->q_inp ) ); // Q0 - st->q_inp = 0; - move16(); - Scale_sig( st->old_input_signal_fx, input_frame, negate( st->q_old_inp ) ); // Q0 - st->q_old_inp = 0; - move16(); - Scale_sig( st->hTcxEnc->Txnq, L_FRAME32k / 2 + 64, sub( 0, st->hTcxEnc->q_Txnq ) ); // Q0 - st->hTcxEnc->q_Txnq = 0; - move16(); -#endif hq_core_enc_fx( st, st->input_fx, input_frame, NORMAL_HQ_CORE, Voicing_flag[n], vad_hover_flag[0] ); } @@ -442,32 +345,12 @@ ivas_error ivas_core_enc_fx( { Word16 mdst_spectrum_e[CPE_CHANNELS][NB_DIV]; Word16 orig_spectrum_e[CPE_CHANNELS][NB_DIV]; -#ifdef SIMPLIFY_CORE_ENC Word16 Q_spec_old[CPE_CHANNELS]; -#else - Word16 pitch_buf_fx_new[CPE_CHANNELS][NB_SUBFR16k]; /* Q6 */ - FOR( n = 0; n < n_CoreChannels; n++ ) - { - st = sts[n]; -#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q1, Q_new[n] ) ); // Q0 -#endif -#ifndef NONBE_FIX_ISSUE_2518 - IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) - { - st->hTcxEnc->exp_buf_speech_ltp = st->exp_buf_speech_enc; - move16(); - } -#endif - } - Word16 Q_spec_old[2], L_spec; -#endif Q_spec_old[0] = hCPE->hCoreCoder[0]->hTcxEnc->spectrum_long_e; move16(); Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e; move16(); -#ifdef SIMPLIFY_CORE_ENC #ifndef NONBE_FIX_ISSUE_2206 ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); @@ -479,47 +362,16 @@ ivas_error ivas_core_enc_fx( ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); #endif -#endif -#else -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); -#else - ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); -#endif #endif FOR( i = 0; i < CPE_CHANNELS; i++ ) { -#ifndef SIMPLIFY_CORE_ENC - st = sts[i]; - Word16 nSubframes = NB_DIV; - move16(); -#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q_new[i], Q1 ) ); // Q_new[n] - 1 -#endif - if ( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) ) - { - nSubframes = 1; - move16(); - } -#endif hMCT->q_mdst_spectrum_long_fx[cpe_id][i][0] = sub( Q31, mdst_spectrum_e[i][0] ); move16(); -#ifdef SIMPLIFY_CORE_ENC IF( NE_16( sts[i]->hTcxEnc->tcxMode, TCX_20 ) ) -#else - IF( EQ_16( nSubframes, NB_DIV ) ) -#endif { hMCT->q_mdst_spectrum_long_fx[cpe_id][i][1] = sub( Q31, mdst_spectrum_e[i][1] ); move16(); -#ifndef SIMPLIFY_CORE_ENC - } - IF( EQ_16( nSubframes, NB_DIV ) ) - { -#endif Word16 max_e = s_max( orig_spectrum_e[i][0], orig_spectrum_e[i][1] ); scale_sig32( hMCT->p_orig_spectrum_long_fx[cpe_id][i], N_TCX10_MAX, sub( orig_spectrum_e[i][0], max_e ) ); // exp(max_e) scale_sig32( hMCT->p_orig_spectrum_long_fx[cpe_id][i] + N_TCX10_MAX, N_TCX10_MAX, sub( orig_spectrum_e[i][1], max_e ) ); // exp(max_e) @@ -532,134 +384,15 @@ ivas_error ivas_core_enc_fx( move16(); } -#ifdef SIMPLIFY_CORE_ENC stereo_tcx_enc_scale_buffers( sts[i], CPE_CHANNELS, Q_spec_old[i] ); -#else - IF( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) ) - { - Word16 e_max = s_max( st->hTcxEnc->spectrum_e[0], Q_spec_old[i] ); - e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) ); - L_spec = st->hTcxEnc->L_frameTCX; - move16(); - scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_long_fx + L_spec, sub( N_MAX, L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max) - - st->hTcxEnc->spectrum_long_e = e_max; - move16(); - } - ELSE - { - Word16 e_max = s_max( s_max( st->hTcxEnc->spectrum_e[0], st->hTcxEnc->spectrum_e[1] ), Q_spec_old[i] ); - e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) ); - L_spec = shr( st->hTcxEnc->L_frameTCX, 1 ); - scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_fx[1], L_spec, sub( st->hTcxEnc->spectrum_e[1], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_fx[1] + L_spec, sub( ( N_MAX - N_TCX10_MAX ), L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max) - - st->hTcxEnc->spectrum_long_e = e_max; - move16(); - } - - st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_long_e; - move16(); - st->hTcxEnc->spectrum_e[1] = st->hTcxEnc->spectrum_long_e; - move16(); -#endif } } ELSE { -#ifdef SIMPLIFY_CORE_ENC #if !defined( NONBE_FIX_ISSUE_2206 ) || defined( NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 ) stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx ); #else stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx ); -#endif -#else - FOR( i = 0; i < CPE_CHANNELS; i++ ) - { - st = sts[i]; -#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q1, Q_new[i] ) ); // Q0 -#endif - -#ifndef NONBE_FIX_ISSUE_2518 - test(); - IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) - { - st->hTcxEnc->exp_buf_speech_ltp = st->exp_buf_speech_enc; - move16(); - } -#endif - shift = norm_arr( st->input_fx, input_frame ); -#ifdef NONBE_FIX_ISSUE_2206 - Q_min = add( st->q_inp, shift ); -#else - Q_min = s_max( -2, add( st->q_inp, shift ) ); -#endif - scale_sig( st->input_fx, input_frame, sub( Q_min, st->q_inp ) ); - st->q_inp = Q_min; - move16(); - - shift = norm_arr( st->input_fx - input_frame, input_frame ); -#ifdef NONBE_FIX_ISSUE_2206 - Q_min = add( st->q_old_inp, shift ); -#else - Q_min = s_max( -2, add( st->q_old_inp, shift ) ); -#endif - scale_sig( st->input_fx - input_frame, input_frame, sub( Q_min, st->q_old_inp ) ); - st->q_old_inp = Q_min; - move16(); - } - - Word16 Q_spec_old[2], L_spec; - Q_spec_old[0] = hCPE->hCoreCoder[0]->hTcxEnc->spectrum_long_e; - move16(); - Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e; - move16(); - -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx ); -#else - stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx ); -#endif - - FOR( i = 0; i < CPE_CHANNELS; i++ ) - { -#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q_new[i], Q1 ) ); // Q_new[n] - 1 -#endif - st = sts[i]; - IF( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) ) - { - L_spec = st->hTcxEnc->L_frameTCX; - move16(); - Word16 e_max = s_max( st->hTcxEnc->spectrum_e[0], Q_spec_old[i] ); - e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) ); - scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_long_fx + L_spec, sub( N_MAX, L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max) - st->hTcxEnc->spectrum_long_e = e_max; - move16(); - } - ELSE - { - L_spec = shr( st->hTcxEnc->L_frameTCX, 1 ); - Word16 e_max = s_max( s_max( st->hTcxEnc->spectrum_e[1], st->hTcxEnc->spectrum_e[0] ), Q_spec_old[i] ); - e_max = sub( e_max, L_norm_arr( st->hTcxEnc->spectrum_long_fx, N_MAX ) ); - scale_sig32( st->hTcxEnc->spectrum_fx[0], L_spec, sub( st->hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_fx[1], L_spec, sub( st->hTcxEnc->spectrum_e[1], e_max ) ); // exp(e_max) - scale_sig32( st->hTcxEnc->spectrum_fx[1] + L_spec, sub( ( N_MAX - N_TCX10_MAX ), L_spec ), sub( Q_spec_old[i], e_max ) ); // exp(e_max) - st->hTcxEnc->spectrum_long_e = e_max; - move16(); - } - - st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_long_e; - move16(); - st->hTcxEnc->spectrum_e[1] = st->hTcxEnc->spectrum_long_e; - move16(); - } #endif } } diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index f315da04b..c51d269f8 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -81,11 +81,7 @@ void pre_proc_ivas_fx( const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* i : energy buffer e_enerBuffer */ -#ifdef SIMPLIFY_CORE_ENC Word16 e_enerBuffer, /* i : Q value of energy buffer */ -#else - const Word16 e_enerBuffer, /* i : Q value of energy buffer */ -#endif Word16 fft_buff_fx[2 * L_FFT], /* i : FFT buffer Qx*/ const Word16 cor_map_sum_fx, /* i : speech/music clasif. parameter Q8*/ Word16 *Q_new /* i/o: Q factor of speech buffers */ @@ -98,7 +94,6 @@ void pre_proc_ivas_fx( push_wmops( "pre_proc" ); -#ifdef SIMPLIFY_CORE_ENC /*----------------------------------------------------------------* * Scaling of buffers *----------------------------------------------------------------*/ @@ -117,7 +112,6 @@ void pre_proc_ivas_fx( Scale_sig( fft_buff_fx, ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum // fft_buff_fx_exp = add(fft_buff_fx_exp,1); -#endif /*----------------------------------------------------------------* * Initialization diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index f1de85142..288b5c25b 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -201,7 +201,6 @@ void stereo_mdct_core_enc_fx( signal_bits = hBstr->nb_bits_tot; move16(); -#ifdef SIMPLIFY_CORE_ENC Word16 shift, Q_min, Q_spec_old[2]; Word16 input_frame = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); // Q0 @@ -239,7 +238,6 @@ void stereo_mdct_core_enc_fx( Q_spec_old[1] = sts[1]->hTcxEnc->spectrum_long_e; move16(); -#endif /*--------------------------------------------------------------* * Initialization *---------------------------------------------------------------*/ @@ -288,14 +286,8 @@ void stereo_mdct_core_enc_fx( move16(); } -#ifdef SIMPLIFY_CORE_ENC Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, input_frame ) ) ), s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ) ) ) ); -#else - Word16 len = extract_l( Mpy_32_32( sts[0]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ); - Word16 q_com = s_min( s_min( add( sts[0]->q_inp, getScaleFactor16( sts[0]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[0]->q_old_inp, getScaleFactor16( sts[0]->old_input_signal_fx, len ) ) ), - s_min( add( sts[1]->q_inp, getScaleFactor16( sts[1]->input_fx, add( len, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ) ), add( sts[1]->q_old_inp, getScaleFactor16( sts[1]->old_input_signal_fx, len ) ) ) ); -#endif q_com = sub( q_com, Q1 ); FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -320,13 +312,8 @@ void stereo_mdct_core_enc_fx( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; move16(); -#ifdef SIMPLIFY_CORE_ENC scale_sig( sts[ch]->input_fx, add( input_frame, NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* q_com */ scale_sig( sts[ch]->old_input_signal_fx, input_frame, sub( q_com, sts[ch]->q_old_inp ) ); /* q_com */ -#else - scale_sig( sts[ch]->input_fx, add( extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sub( q_com, sts[ch]->q_inp ) ); /* q_com */ - scale_sig( sts[ch]->old_input_signal_fx, extract_l( Mpy_32_32( sts[ch]->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), sub( q_com, sts[ch]->q_old_inp ) ); /* q_com */ -#endif sts[ch]->q_old_inp = q_com; move16(); sts[ch]->q_inp = q_com; @@ -772,7 +759,6 @@ void stereo_mdct_core_enc_fx( ivas_mdct_quant_coder_fx( hCPE, tnsBits, tnsSize, p_param, 0 ); -#ifdef SIMPLIFY_CORE_ENC /*--------------------------------------------------------------------------------* * Scaling of buffers *--------------------------------------------------------------------------------*/ @@ -782,7 +768,6 @@ void stereo_mdct_core_enc_fx( stereo_tcx_enc_scale_buffers( sts[i], CPE_CHANNELS, Q_spec_old[i] ); } -#endif pop_wmops(); return; diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 65f097eaa..f89e1c7b8 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -152,24 +152,15 @@ void stereo_tcx_init_enc_fx( void stereo_tcx_core_enc( Encoder_State *st, /* i/o: encoder state structure */ -#ifdef SIMPLIFY_CORE_ENC Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz Q_new -1 */ Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz Q_new -1 */ -#else - const Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz Q_new*/ - const Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz Q_new*/ -#endif const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes, Q12 */ Word16 lsp_new_fx[], /* i : LSPs at the end of the frame, Q15 */ Word16 lsp_mid_fx[], /* i : LSPs in the middle of the frame, Q15 */ Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ const Word16 last_element_mode, /* i : last element mode, Q0 */ const Word16 vad_hover_flag, /* i : VAD hangover flag, Q0 */ -#ifdef SIMPLIFY_CORE_ENC const Word16 Q_new_orig /* i : Scaling factor of new_samples_xx[] */ -#else - Word16 Q_new -#endif ) { TCX_ENC_HANDLE hTcxEnc; @@ -238,7 +229,6 @@ void stereo_tcx_core_enc( hTcxEnc = st->hTcxEnc; Word16 Q_exc; -#ifdef SIMPLIFY_CORE_ENC Word16 Q_spec_old, Q_new; /*--------------------------------------------------------------------------------* @@ -254,7 +244,6 @@ void stereo_tcx_core_enc( Q_spec_old = st->hTcxEnc->spectrum_long_e; move16(); -#endif /*--------------------------------------------------------------* * Configuration of TCX *---------------------------------------------------------------*/ @@ -764,7 +753,6 @@ void stereo_tcx_core_enc( #endif } -#ifdef SIMPLIFY_CORE_ENC /*--------------------------------------------------------------------------------* * Scaling of buffers *--------------------------------------------------------------------------------*/ @@ -784,12 +772,10 @@ void stereo_tcx_core_enc( #endif stereo_tcx_enc_scale_buffers( st, 1, Q_spec_old ); -#endif pop_wmops(); return; } -#ifdef SIMPLIFY_CORE_ENC /*-------------------------------------------------------------------* * stereo_tcx_enc_scale_buffers() @@ -847,7 +833,6 @@ void stereo_tcx_enc_scale_buffers( return; } -#endif /*-------------------------------------------------------------------* * ivas_acelp_tcx20_switching() diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 046f15211..fadd16a62 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -220,11 +220,7 @@ void fine_gain_quant_fx( void hq_core_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef SIMPLIFY_CORE_ENC Word16 *audio, /* i : i audio signal Q0*/ -#else - const Word16 *audio, /* i : i audio signal Q0*/ -#endif const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ -- GitLab From 6e69ac15d2a061cfbb37afef0d589469478eaa1a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:10:57 +0200 Subject: [PATCH 02/49] Accept FIX_2402_SIMPLIFY_ARI_CODEC --- lib_com/ari_fx.c | 20 ----- lib_com/options.h | 1 - lib_com/prot_fx.h | 6 -- lib_dec/ari_dec_fx.c | 184 ------------------------------------------- 4 files changed, 211 deletions(-) diff --git a/lib_com/ari_fx.c b/lib_com/ari_fx.c index 32bb550b2..d36526b2f 100644 --- a/lib_com/ari_fx.c +++ b/lib_com/ari_fx.c @@ -9,26 +9,6 @@ #include "cnst.h" -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC -/** - * \brief 31x16 Bit multiply (x*y) - * - * \param[i] xh high part, bit [30..15] - * \param[i] xl low part, 15 LSBits - * \param[i] y - * - * \return x*y - */ -Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ) -{ - Word32 z; - - z = L_shl( L_mult0( xh, y ), 15 ); - z = L_mac0( z, xl, y ); - - return z; -} -#endif /*--------------------------------------------------------------- Ari 14 bits common routines diff --git a/lib_com/options.h b/lib_com/options.h index ea3bcaa6a..d42329344 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ #define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c434a6fc1..c8b184fe8 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5050,12 +5050,6 @@ Word16 IGFCommonFuncsIGFGetCFTables_fx( const Word16 **cf_off_se11 /* o : offsets for CF tables above */ ); -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC -Word32 L_multi31x16_X2( - Word16 xh, - Word16 xl, - Word16 y ); -#endif #ifndef FIX_2402_INLINE_FCT_ARI_CODEC Word32 mul_sbc_14bits( diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 99d33cc59..683e9d253 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -13,7 +13,6 @@ * Ari decode 14 bits routines -------------------------------------------------------------*/ -#ifdef FIX_2402_SIMPLIFY_ARI_CODEC static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq ) { /* WMOPS counting is done using L_sub, similar to other MSU operations */ @@ -21,15 +20,10 @@ static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq ) /* Note: No overflow or saturation feature required. */ return L_sub( cum, range * cum_freq ); } -#endif Word32 ari_decode_overflow_fx( Tastat *s ) { -#ifdef FIX_2402_SIMPLIFY_ARI_CODEC return ( L_sub( s->high, s->low ) <= 0 ); -#else - return ( L_sub( L_sub( s->high, 1 ), s->low ) <= 0 ); -#endif } /** @@ -92,10 +86,6 @@ static Word16 ari_lookup_s17_fx( ) { const UWord16 *p; -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - Word32 tmp; - Word16 range_l, range_h; -#endif p = cum_freq; @@ -104,42 +94,6 @@ static Word16 ari_lookup_s17_fx( /* tmp_p = p+8; if (tmp_p[0]*range>cum) p = tmp_p; */ /* max value in p[x] is 16384 => 14 bits */ -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - range_l = extract_l( L_and( range, 0x7FFF ) ); - range_h = extract_l( L_shr( range, 15 ) ); - - tmp = L_multi31x16_X2( range_h, range_l, p[8] ); - IF( GT_32( tmp, cum ) ) - { - p = p + 8; - } - - tmp = L_multi31x16_X2( range_h, range_l, p[4] ); - IF( GT_32( tmp, cum ) ) - { - p = p + 4; - } - - - tmp = L_multi31x16_X2( range_h, range_l, p[2] ); - IF( GT_32( tmp, cum ) ) - { - p = p + 2; - } - - tmp = L_multi31x16_X2( range_h, range_l, p[1] ); - IF( GT_32( tmp, cum ) ) - { - p = p + 1; - - tmp = L_multi31x16_X2( range_h, range_l, p[1] ); - test(); - IF( EQ_32( (Word32) ( &cum_freq[15] - p ), 0 ) && ( GT_32( tmp, cum ) ) ) - { - p = p + 1; - } - } -#else if ( L_msui_32_16( cum, range, p[8] ) < 0 ) { p = p + 8; @@ -165,7 +119,6 @@ static Word16 ari_lookup_s17_fx( move16(); } } -#endif /* return extract_l(L_shr(L_sub((Word32)p,(Word32)cum_freq),1)); */ L_sub( 0, 0 ); @@ -179,99 +132,6 @@ static Word16 ari_lookup_s27_fx( UWord16 const *cum_freq /* Q0 */ ) { -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - Word32 tmp; - Word16 range_l, range_h; - Word16 il, ih, im; - - /* Note: For each indirect addressing p[i], we assume a tmp pointer init followed by a costfree reading the value */ - /* If the value multiplied by range is greater than cum, the pointer p is set to the tmp pointer */ - /* tmp_p = p+8; if (tmp_p[0]*range>cum) p = tmp_p; */ - - /* max value in p[x] is 16384 => 14 bits */ - range_l = extract_l( L_and( range, 0x7FFF ) ); - range_h = extract_l( L_shr( range, 15 ) ); - - /* begin change when compared with ari_decode_14bits_s17_ext_fx, - starting with line: tmp = L_multi31x16_X2(range_h, range_l, p[8]); */ - il = 0; - move16(); - ih = 27; - move16(); - - /* do a five step binary search, using the interval [il, ih) */ - im = 13; - move16(); /* (il + ih) >> 1 */ - tmp = L_multi31x16_X2( range_h, range_l, cum_freq[im] ); - tmp = L_sub( tmp, cum ); - if ( ( tmp > 0 ) ) - { - il = im; - move16(); - } - if ( ( tmp <= 0 ) ) - { - ih = im; - move16(); - } - - im = shr( add( il, ih ), 1 ); - tmp = L_multi31x16_X2( range_h, range_l, cum_freq[im] ); - tmp = L_sub( tmp, cum ); - if ( tmp > 0 ) - { - il = im; - move16(); - } - if ( tmp <= 0 ) - { - ih = im; - move16(); - } - - im = shr( add( il, ih ), 1 ); - tmp = L_multi31x16_X2( range_h, range_l, cum_freq[im] ); - tmp = L_sub( tmp, cum ); - if ( tmp > 0 ) - { - il = im; - move16(); - } - if ( tmp <= 0 ) - { - ih = im; - move16(); - } - - im = shr( add( il, ih ), 1 ); - tmp = L_multi31x16_X2( range_h, range_l, cum_freq[im] ); - tmp = L_sub( tmp, cum ); - if ( tmp > 0 ) - { - il = im; - move16(); - } - if ( tmp <= 0 ) - { - ih = im; - move16(); - } - - IF( GT_16( sub( ih, il ), 1 ) ) /* if the interval has more than one symbol */ - { - /* here, only ih == il + 2 is possible, which means two symbols in the interval */ - im = add( il, 1 ); /* (il + ih) >> 1 */ - tmp = L_multi31x16_X2( range_h, range_l, cum_freq[im] ); - tmp = L_sub( tmp, cum ); - if ( tmp > 0 ) - { - il = im; - move16(); - } - } - - return il; -#else const UWord16 *p = cum_freq; @@ -305,7 +165,6 @@ static Word16 ari_lookup_s27_fx( L_sub( 0, 0 ); L_shr( 0, 0 ); /* pointer subtraction */ return extract_l( p - cum_freq ); -#endif } static Word16 ari_lookup_bit_fx( @@ -319,26 +178,10 @@ static Word16 ari_lookup_bit_fx( (void) cum_freq; -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - range = L_shl( range, 13 ); /* L_multi31x16_X2(range_h, range_l, 8192) */ - cum = L_sub( range, cum ); - - if ( cum > 0 ) - { - symbol = 1; - move16(); - } - if ( cum <= 0 ) - { - symbol = 0; - move16(); - } -#else if ( L_msui_32_16( cum, range, 8192 ) < 0 ) { symbol = add( symbol, 1 ); /* symbol = 1 */ } -#endif return symbol; } @@ -366,15 +209,7 @@ static Word16 ari_decode_14bits_ext_fx( range = L_sub( high, low ); cum = L_add( L_shl( L_sub( value, low ), stat_bitsnew ), sub( shl( 1, stat_bitsnew ), 1 ) ); -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - if ( cum < 0 ) - { - cum = 0x7fffffff; - move32(); - } -#else assert( cum >= 0 ); -#endif symbol = lookup_fn( cum, range, cum_freq ); @@ -446,9 +281,6 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { Word32 cum, range; Word16 symbol; -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - Word16 range_h, range_l; -#endif Word16 pows[12]; /* "base" to the power of 2, 4, 8,... 2^12 */ Word16 lowlim, highlim, testval; Word16 k; @@ -456,10 +288,6 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) range = L_sub( s->high, s->low ); cum = L_add( L_shl( L_sub( s->value, s->low ), stat_bitsnew ), ( ( 1 << stat_bitsnew ) - 1 ) ); -#ifndef FIX_2402_SIMPLIFY_ARI_CODEC - range_h = extract_l( L_shr( range, 15 ) ); - range_l = extract_l( L_and( range, 0x7FFF ) ); -#endif symbol = 0; move16(); @@ -468,11 +296,7 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) move16(); /* search for the interval where "cum" fits */ -#ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, lowlim ) < 0 ) /* below pow-1 */ -#else - IF( GT_32( L_multi31x16_X2( range_h, range_l, lowlim ), cum ) ) /* below pow-1 */ -#endif { pows[0] = base; move16(); @@ -487,11 +311,7 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) move16(); testval = mult_r( pows[k], base ); -#ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, shr( testval, 1 ) ) >= 0 ) -#else - IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) /* found! big range is [lowlim,testval], (now narrow it down) */ -#endif { lowlim = testval; move16(); @@ -507,11 +327,7 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { testval = mult_r( highlim, pows[k + 1] ); -#ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, shr( testval, 1 ) ) >= 0 ) -#else - IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) -#endif { lowlim = testval; move16(); -- GitLab From 4bfdfbf449760ae5e5133b08579b8386ee1863e3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:10:59 +0200 Subject: [PATCH 03/49] Accept FIX_2402_REPL_EVS_ARI_CODEC_ENC --- lib_com/options.h | 1 - lib_com/prot_fx.h | 16 -- lib_enc/ACcontextMapping_enc_fx.c | 12 -- lib_enc/ari_enc_fx.c | 328 ------------------------------ lib_enc/arith_coder_enc_fx.c | 8 - lib_enc/igf_scf_enc_fx.c | 88 -------- lib_enc/ivas_entropy_coder_fx.c | 4 - lib_enc/ivas_lfe_enc_fx.c | 4 - lib_enc/prot_fx_enc.h | 68 ------- lib_enc/stat_enc.h | 10 - 10 files changed, 539 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d42329344..2596a6cc9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ #define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ #define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c8b184fe8..22f121f11 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8491,11 +8491,7 @@ void con_tcx_fx( const Word16 *A_cng /* i : CNG LP filter coefficients */ ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_start_encoding_14bits_fx( -#else -void ari_start_encoding_14bits_ivas_fx( -#endif Tastat *s ); #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN void tcx_scalar_quantization_ivas_fx( @@ -9486,11 +9482,7 @@ void IGFSaveSpectrumForITF_ivas_fx( const Word32 *pITFSpectrum, /* i : MDCT spectrum */ Word16 exp_pITFSpectrum ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_ext_fx( -#else -Word16 ari_encode_14bits_ext_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s, @@ -9498,11 +9490,7 @@ Word16 ari_encode_14bits_ext_ivas_fx( UWord16 const *cum_freq /* Q0 */ ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_sign_fx( -#else -Word16 ari_encode_14bits_sign_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Word32 bits, /* Q0 */ @@ -9510,11 +9498,7 @@ Word16 ari_encode_14bits_sign_ivas_fx( Word16 sign /* Q0 */ ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_done_encoding_14bits_fx( -#else -Word16 ari_done_encoding_14bits_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s ); diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 46d941a8d..d367372f7 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -41,11 +41,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( CONTEXT_HM_CONFIG *hm_cfg ) { Word16 ptr[BITBUFSIZE]; -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Tastat as, as_overflow; -#else - TastatEnc as, as_overflow; -#endif Word16 bp, bp_overflow; Word16 a1, b1, a1_i, b1_i, k; Word16 t, pki, lev1; @@ -244,11 +240,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( bp = ari_encode_14bits_ext_fx( ptr, bp, &as, add( a1, shl( b1, A_THRES_SHIFT ) ), ari_pk_s17_LC_ext[pki] ); /* Q0 */ /* Check bit budget */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC IF( GT_16( add( add( add( bp, extract_l( as.bits_to_follow ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) -#else - IF( GT_16( add( add( add( bp, extract_l( as.value ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) -#endif { ari_copy_states_fx( &as_overflow, &as ); bp = bp_overflow; /* Q0 */ @@ -278,11 +270,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( move16(); bp = ari_encode_14bits_ext_fx( ptr, bp, &as, 0, ari_pk_s17_LC_ext[pki] ); /* Q0 */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC IF( GT_16( add( add( add( bp, extract_l( as.bits_to_follow ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) -#else - IF( GT_16( add( add( add( bp, extract_l( as.value ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) -#endif { ari_copy_states_fx( &as_overflow, &as ); bp = bp_overflow; /* Q0 */ diff --git a/lib_enc/ari_enc_fx.c b/lib_enc/ari_enc_fx.c index 2dfac3de9..37a38cf46 100644 --- a/lib_enc/ari_enc_fx.c +++ b/lib_enc/ari_enc_fx.c @@ -15,7 +15,6 @@ * forward declarations *-------------------------------------------------------------*/ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC static Word16 ari_encode_14bits_high_low_fx( Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ @@ -24,7 +23,6 @@ static Word16 ari_encode_14bits_high_low_fx( Word32 high, /* Q0 */ Word32 low /* Q0 */ ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*--------------------------------------------------------------- @@ -36,21 +34,6 @@ static Word16 ari_encode_14bits_high_low_fx( * \return none *-------------------------------------------------------------*/ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -void ari_copy_states_fx( - TastatEnc *source, - TastatEnc *dest ) -{ - dest->low = source->low; - move32(); - dest->high = source->high; - move32(); - dest->value = source->value; - move16(); - - return; -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*--------------------------------------------------------------- @@ -62,11 +45,7 @@ void ari_copy_states_fx( * \return none *-------------------------------------------------------------*/ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_copy_states_fx( -#else -void ari_copy_states_ivas_fx( -#endif Tastat *source, Tastat *dest ) { @@ -96,19 +75,6 @@ void ari_copy_states_ivas_fx( * \return none *-------------------------------------------------------------*/ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -void ari_start_encoding_14bits_fx( - TastatEnc *s ) -{ - s->low = L_deposit_l( 0 ); - s->high = ari_q4new + 1; - move32(); - s->value = 0; - move16(); - - return; -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*--------------------------------------------------------------- * Ari encoder 14 bits routines @@ -146,23 +112,6 @@ Word16 ari_put_bit_plus_follow( * * \return bit consumption * ------------------------------------------------------------ - */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_done_encoding_14bits_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - TastatEnc *s ) -{ - Word16 bit; - - bit = 0; - move16(); - if ( GE_32( s->low, ari_q1new ) ) - { - bit = s_xor( bit, 1 ); - } - return ari_put_bit_plus_follow( ptr, bp, add( s->value, 1 ), bit ); -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*--------------------------------------------------------------- *ari_encode_14bits_ext_fx() @@ -178,99 +127,7 @@ Word16 ari_done_encoding_14bits_fx( * * \return bit consumption * ------------------------------------------------------------ - */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_14bits_ext_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - TastatEnc *s, - Word32 symbol, /* Q0 */ - UWord16 const *cum_freq /* Q0 */ -) -{ - Word32 low; - Word32 high; - Word32 range; - Word16 bits_to_follow; - Word16 i; - UWord16 temp; - Word32 L_temp1, L_temp2; - - high = L_add( s->high, 0 ); - low = L_add( s->low, 0 ); - range = L_sub( high, low ); /* Q0 */ - - L_temp1 = L_shl( range, 15 - stat_bitsnew /*both are constants*/ ); - Mpy_32_16_ss( L_temp1, cum_freq[symbol + 1], &L_temp2, &temp ); - if ( symbol != 0 ) /* when symbol is 0, range remains unchanged */ - { - Mpy_32_16_ss( L_temp1, cum_freq[symbol], &range, &temp ); - } - high = L_add( low, range ); /* Q0 */ - low = L_add( low, L_temp2 ); /* Q0 */ - - bits_to_follow = s->value; /* Q0 */ - move16(); - - FOR( i = 0; i < 0x7FFF; i++ ) - { - IF( LE_32( high, ari_q2new ) ) - { - bp = ari_put_bit_plus_follow( ptr, bp, bits_to_follow, 0 ); /* Q0 */ - bits_to_follow = 0; - move16(); - } - ELSE IF( GE_32( low, ari_q2new ) ) - { - bp = ari_put_bit_plus_follow( ptr, bp, bits_to_follow, 1 ); /* Q0 */ - bits_to_follow = 0; - move16(); - low = L_sub( low, ari_q2new ); /* Q0 */ - high = L_sub( high, ari_q2new ); /* Subtract offset to top. Q0*/ - } - ELSE - { - test(); - IF( GE_32( low, ari_q1new ) && LE_32( high, ari_q3new ) ) - { - /* Output an opposite bit */ - /* later if in middle half. */ - bits_to_follow = add( bits_to_follow, 1 ); /* Q0 */ - low = L_sub( low, ari_q1new ); /* Subtract offset to middle Q0*/ - high = L_sub( high, ari_q1new ); /* Q0 */ - } - ELSE - { - BREAK; /* Otherwise exit loop. */ - } - } - low = L_add( low, low ); /* Q0 */ - high = L_add( high, high ); /* Scale up code range. Q0*/ - } - - s->low = low; /* Q0 */ - move32(); - s->high = high; /* Q0 */ - move32(); - s->value = bits_to_follow; /* Q0 */ - move16(); - return bp; -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ - -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -/*------------------------------------------------------------------------ - * Function: ari_encode_overflow_fx() - * - * - *-------------------------------------------------------------------------*/ - -Word16 ari_encode_overflow_fx( - TastatEnc *s ) -{ - return L_sub( L_sub( s->high, 1 ), s->low ) <= 0; -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*------------------------------------------------------------------------ * Function: ari_encode_overflow_fx() @@ -278,86 +135,12 @@ Word16 ari_encode_overflow_fx( * *-------------------------------------------------------------------------*/ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_overflow_fx( -#else -Word16 ari_encode_overflow_ivas_fx( -#endif Tastat *s ) { return L_sub( L_sub( s->high, 0 ), s->low ) <= 0; } -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -/*------------------------------------------------------------------------ - * Function: ari_encode_14bits_high_low() - * - * - *-------------------------------------------------------------------------*/ - -static Word16 ari_encode_14bits_high_low( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s, - Word32 high, /* Q0 */ - Word32 low /* Q0 */ -) -{ - Word16 bits_to_follow, tmp; - - bits_to_follow = s->value; - move16(); - - /* while there are more than 16 bits left */ - tmp = sub( 16, bits ); /* Q0 */ - WHILE( add( add( bp, bits_to_follow ), tmp ) < 0 ) - { - IF( LE_32( high, ari_q2new ) ) - { - bp = ari_put_bit_plus_follow( ptr, bp, bits_to_follow, 0 ); /* Q0 */ - bits_to_follow = 0; - move16(); - } - ELSE IF( GE_32( low, ari_q2new ) ) - { - bp = ari_put_bit_plus_follow( ptr, bp, bits_to_follow, 1 ); /* Q0 */ - bits_to_follow = 0; - move16(); - low = L_sub( low, ari_q2new ); /* Q0 */ - high = L_sub( high, ari_q2new ); /* Subtract offset to top. Q0*/ - } - ELSE - { - test(); - IF( GE_32( low, ari_q1new ) && LE_32( high, ari_q3new ) ) - { - /* Output an opposite bit */ - /* later if in middle half. */ - bits_to_follow = add( bits_to_follow, 1 ); /* Q0 */ - low = L_sub( low, ari_q1new ); /* Subtract offset to middle Q0*/ - high = L_sub( high, ari_q1new ); /* Q0 */ - } - ELSE - { - BREAK; /* Otherwise exit loop. */ - } - } - - low = L_add( low, low ); /* Q0 */ - high = L_add( high, high ); /* Scale up code range. Q0*/ - } - - s->low = low; /* Q0 */ - move32(); - s->high = high; /* Q0 */ - move32(); - s->value = bits_to_follow; /* Q0 */ - move16(); - - return bp; -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*------------------------------------------------------------------------ @@ -366,34 +149,7 @@ static Word16 ari_encode_14bits_high_low( * Encode an cumulative frequency interval. *-------------------------------------------------------------------------*/ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_14bits_range_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s, - Word16 cum_freq_low, /* Q0 */ - Word16 cum_freq_high /* Q0 */ -) -{ - Word32 low, high, range; - - range = L_sub( s->high, s->low ); /* Q0 */ - - high = L_add( s->low, mul_sbc_14bits( range, cum_freq_high ) ); /* Q0 */ - low = L_add( s->low, mul_sbc_14bits( range, cum_freq_low ) ); /* Q0 */ - - return ari_encode_14bits_high_low( ptr, bp, bits, s, high, low ); -} - -/*------------------------------------------------------------------------ - * Function: ari_encode_14bits_range_ivas_fx - * - * Encode an cumulative frequency interval. - *-------------------------------------------------------------------------*/ -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_range_fx( Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ @@ -412,7 +168,6 @@ Word16 ari_encode_14bits_range_fx( return ari_encode_14bits_high_low_fx( ptr, bp, bits, s, high, low ); } -#endif /*------------------------------------------------------------------------ * Function: ari_encode_14bits_sign_fx @@ -420,35 +175,6 @@ Word16 ari_encode_14bits_range_fx( * Encode a sign with equal probabilities. *-------------------------------------------------------------------------*/ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_14bits_sign_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s, - Word16 sign /* Q0 */ -) -{ - Word32 low, high, range; - Word32 L_tmp; - - high = L_add( s->high, 0 ); - low = L_add( s->low, 0 ); - range = L_sub( high, low ); /* Q0 */ - - L_tmp = L_shr( range, 1 ); - if ( sign != 0 ) - { - high = L_add( low, L_tmp ); /* Q0 */ - } - if ( sign == 0 ) - { - low = L_add( low, L_tmp ); /* Q0 */ - } - - return ari_encode_14bits_high_low( ptr, bp, bits, s, high, low ); -} -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ /*------------------------------------------------------------------------ @@ -457,43 +183,6 @@ Word16 ari_encode_14bits_sign_fx( * Finish up encoding in CBR mode. *-------------------------------------------------------------------------*/ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_done_cbr_encoding_14bits_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s ) -{ - Word16 high, tmp, k; - - tmp = sub( bits, 16 ); /* Q0 */ - WHILE( GT_16( sub( tmp, bp ), s->value ) ) - { - bp = ari_encode_14bits_sign_fx( ptr, bp, bits, s, 0 ); /* Q0 */ - } - - high = extract_l( L_sub( s->high, 1 ) ); /* Q0 */ - - bp = ari_put_bit_plus_follow( ptr, bp, s->value, lshr( high, 15 ) ); /* Q0 */ - high = lshl( high, 1 ); - - tmp = s_min( 15, sub( bits, bp ) ); - FOR( k = 0; k < tmp; ++k ) - { - ptr[bp++] = lshr( high, 15 ); /* Q0 */ - move16(); - high = lshl( high, 1 ); - } - - return bp; -} - -/*------------------------------------------------------------------------ - * Function: ari_done_cbr_encoding_14bits_ivas_fx - * - * Finish up encoding in CBR mode. - *-------------------------------------------------------------------------*/ -#else Word16 ari_done_cbr_encoding_14bits_fx( Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ @@ -522,13 +211,8 @@ Word16 ari_done_cbr_encoding_14bits_fx( return bp; } -#endif -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_start_encoding_14bits_fx( -#else -void ari_start_encoding_14bits_ivas_fx( -#endif Tastat *s ) { /* : addressing is made with walking pointer s */ @@ -549,11 +233,7 @@ void ari_start_encoding_14bits_ivas_fx( * Finish ArCo encoding *-------------------------------------------------------------*/ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_done_encoding_14bits_fx( -#else -Word16 ari_done_encoding_14bits_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s ) @@ -577,11 +257,7 @@ Word16 ari_done_encoding_14bits_ivas_fx( * *-------------------------------------------------------------*/ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_ext_fx( -#else -Word16 ari_encode_14bits_ext_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s, @@ -735,11 +411,7 @@ static Word16 ari_encode_14bits_high_low_fx( * Encode a sign with equal probabilities. *-------------------------------------------------------------------------*/ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_sign_fx( -#else -Word16 ari_encode_14bits_sign_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Word32 bits, /* Q0 */ diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 40c0ba7ff..f61345df5 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -529,11 +529,7 @@ static Word16 tcx_arith_encode( Word16 prm[] /* o : bit-stream Q0 */ ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Tastat as, as_lastgood; -#else - TastatEnc as, as_lastgood; -#endif Word16 bp, bp_lastgood; Word16 k; Word16 kEncoded; @@ -650,11 +646,7 @@ static Word16 tcx_arith_encode( IF( EQ_16( kEncoded, sub( L_frame, 1 ) ) ) /* RESQ bits possibly available */ { /* Limit target bits to actually needed bits */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC target_bits = add( add( bp, 16 ), extract_l( as.bits_to_follow ) ); -#else - target_bits = add( add( bp, 16 ), extract_l( as.value ) ); -#endif } return ari_done_cbr_encoding_14bits_fx( prm, bp, target_bits, &as ); diff --git a/lib_enc/igf_scf_enc_fx.c b/lib_enc/igf_scf_enc_fx.c index 9f55aafd4..2514a76e4 100644 --- a/lib_enc/igf_scf_enc_fx.c +++ b/lib_enc/igf_scf_enc_fx.c @@ -129,11 +129,7 @@ static void arith_encode_bits( FOR( i = nBits - 1; i >= 0; --i ) /* nBits > 0 */ { bit = s_and( shr( x, i ), 1 ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_sign_fx( ptr, hPrivateData->ptrBitIndex, MAX16B /* disable the bit count limitation */, &hPrivateData->acState_ivas_fx, bit ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_sign_fx( ptr, hPrivateData->ptrBitIndex, MAX16B /* disable the bit count limitation */, &hPrivateData->acState_fx, bit ); -#endif move16(); } } @@ -142,11 +138,7 @@ static void arith_encode_bits( FOR( i = nBits - 1; i >= 0; --i ) /* nBits > 0 */ { bit = s_and( shr( x, i ), 1 ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_sign_fx( ptr, hPrivateData->ptrBitIndex, MAX16B /* disable the bit count limitation */, &hPrivateData->acState, bit ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_sign_ivas_fx( ptr, hPrivateData->ptrBitIndex, MAX16B /* disable the bit count limitation */, &hPrivateData->acState, bit ); -#endif move16(); } } @@ -177,35 +169,19 @@ static void arith_encode_residual( /* encode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ IF( EQ_16( element_mode, EVS_MONO ) ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState_ivas_fx, x, cumulativeFrequencyTable ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState_fx, - x, - cumulativeFrequencyTable ); -#endif } ELSE { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState, x, cumulativeFrequencyTable ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_ivas_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState, - x, - cumulativeFrequencyTable ); -#endif } move16(); @@ -218,35 +194,19 @@ static void arith_encode_residual( extra = sub( IGF_MIN_ENC_SEPARATE - 1, x ); IF( EQ_16( element_mode, EVS_MONO ) ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState_ivas_fx, 0, cumulativeFrequencyTable ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState_fx, - 0, - cumulativeFrequencyTable ); -#endif } ELSE { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState, 0, cumulativeFrequencyTable ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_ivas_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState, - 0, - cumulativeFrequencyTable ); -#endif } move16(); @@ -258,35 +218,19 @@ static void arith_encode_residual( IF( EQ_16( element_mode, EVS_MONO ) ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState_ivas_fx, IGF_SYMBOLS_IN_TABLE - 1, cumulativeFrequencyTable ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState_fx, - IGF_SYMBOLS_IN_TABLE - 1, - cumulativeFrequencyTable ); -#endif } ELSE { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState, IGF_SYMBOLS_IN_TABLE - 1, cumulativeFrequencyTable ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_ivas_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState, - IGF_SYMBOLS_IN_TABLE - 1, - cumulativeFrequencyTable ); -#endif } move16(); } @@ -363,35 +307,19 @@ static void encode_sfe_vector( /* encode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ IF( EQ_16( element_mode, EVS_MONO ) ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState_ivas_fx, shr( x[f], 2 ), (const UWord16 *) hPrivateData->cf_se00 ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState_fx, - shr( x[f], 2 ), - (const UWord16 *) hPrivateData->cf_se00 ); -#endif } ELSE { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPrivateData->ptrBitIndex = ari_encode_14bits_ext_fx( ptr, hPrivateData->ptrBitIndex, &hPrivateData->acState, shr( x[f], 2 ), (const UWord16 *) hPrivateData->cf_se00 ); -#else - hPrivateData->ptrBitIndex = ari_encode_14bits_ext_ivas_fx( ptr, - hPrivateData->ptrBitIndex, - &hPrivateData->acState, - shr( x[f], 2 ), - (const UWord16 *) hPrivateData->cf_se00 ); -#endif } move16(); arith_encode_bits( hPrivateData, ptr, x[f] & 3, 2, element_mode ); /* LSBs as 2 bit raw */ @@ -481,19 +409,11 @@ Word16 IGFSCFEncoderEncode_fx( /* start AC encoding */ IF( EQ_16( element_mode, EVS_MONO ) ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC ari_start_encoding_14bits_fx( &hPublicData->acState_ivas_fx ); -#else - ari_start_encoding_14bits_fx( &hPublicData->acState_fx ); -#endif } ELSE { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC ari_start_encoding_14bits_fx( &hPublicData->acState ); -#else - ari_start_encoding_14bits_ivas_fx( &hPublicData->acState ); -#endif } /* check if coder needs a reset and do it if necessary */ @@ -508,19 +428,11 @@ Word16 IGFSCFEncoderEncode_fx( /* finish AC encoding */ IF( EQ_16( element_mode, EVS_MONO ) ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPublicData->ptrBitIndex = ari_done_encoding_14bits_fx( ptr, hPublicData->ptrBitIndex, &hPublicData->acState_ivas_fx ); -#else - hPublicData->ptrBitIndex = ari_done_encoding_14bits_fx( ptr, hPublicData->ptrBitIndex, &hPublicData->acState_fx ); -#endif } ELSE { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC hPublicData->ptrBitIndex = ari_done_encoding_14bits_fx( ptr, hPublicData->ptrBitIndex, &hPublicData->acState ); -#else - hPublicData->ptrBitIndex = ari_done_encoding_14bits_ivas_fx( ptr, hPublicData->ptrBitIndex, &hPublicData->acState ); -#endif } hPublicData->bitCount = add( hPublicData->bitCount, hPublicData->ptrBitIndex ); move16(); diff --git a/lib_enc/ivas_entropy_coder_fx.c b/lib_enc/ivas_entropy_coder_fx.c index 9a560e30f..7fb8950ee 100644 --- a/lib_enc/ivas_entropy_coder_fx.c +++ b/lib_enc/ivas_entropy_coder_fx.c @@ -173,11 +173,7 @@ static Word16 ivas_arith_encode_array_fx( pCum_freq = pArith->cum_freq[0]; /* Q0 */ } -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC ari_start_encoding_14bits_fx( &as ); -#else - ari_start_encoding_14bits_ivas_fx( &as ); -#endif FOR( i = 0; i < in_len; i++ ) { diff --git a/lib_enc/ivas_lfe_enc_fx.c b/lib_enc/ivas_lfe_enc_fx.c index 8d3ef73f9..0aeb61077 100644 --- a/lib_enc/ivas_lfe_enc_fx.c +++ b/lib_enc/ivas_lfe_enc_fx.c @@ -66,11 +66,7 @@ static void ivas_lfe_arith_coding_fx( { max_value = ivas_lfe_num_ele_in_coder_models[quant_strategy][i]; move16(); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC ari_start_encoding_14bits_fx( &as ); -#else - ari_start_encoding_14bits_ivas_fx( &as ); -#endif offset = imult1616( 4, i ); FOR( index = 0; index < num_ele_per_grp; index++ ) diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index fadd16a62..d444de43b 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1416,34 +1416,12 @@ void encode_acelp_gains_fx( Word16 noisy_speech_flag /* (i) : noisy speech flag */ ); -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -void ari_start_encoding_14bits_fx( - TastatEnc *s ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -void ari_copy_states_fx( - TastatEnc *source, - TastatEnc *dest ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_copy_states_fx( -#else -void ari_copy_states_ivas_fx( -#endif Tastat *source, Tastat *dest ); -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_14bits_ext_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - TastatEnc *s, - Word32 symbol, /* Q0 */ - UWord16 const *cum_freq /* Q0 */ -); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ Word16 ari_put_bit_plus_follow( Word16 ptr[], /* o : bit-stream Q0*/ @@ -1452,12 +1430,6 @@ Word16 ari_put_bit_plus_follow( Word16 bit /* i : bit to send Q0*/ ); -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_done_encoding_14bits_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - TastatEnc *s ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ void reset_rf_indices_fx( Encoder_State *st /* i : state structure - contains partial RF indices */ @@ -1784,30 +1756,11 @@ void find_wsp_fx( const Word16 nb_subfr /* i : number of subframes */ ); -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_overflow_fx( - TastatEnc *s ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_overflow_fx( -#else -Word16 ari_encode_overflow_ivas_fx( -#endif Tastat *s ); -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_14bits_range_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s, - Word16 cum_freq_low, /* Q0 */ - Word16 cum_freq_high /* Q0 */ -); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_range_fx( Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ @@ -1816,31 +1769,10 @@ Word16 ari_encode_14bits_range_fx( Word16 cum_freq_low, /* Q0 */ Word16 cum_freq_high /* Q0 */ ); -#endif -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_encode_14bits_sign_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s, - Word16 sign /* Q0 */ -); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -Word16 ari_done_cbr_encoding_14bits_fx( - Word16 *ptr, /* Q0 */ - Word16 bp, /* Q0 */ - Word16 bits, /* Q0 */ - TastatEnc *s ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_ENC */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_done_cbr_encoding_14bits_fx( -#else -Word16 ari_done_cbr_encoding_14bits_ivas_fx( -#endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Word16 bits, /* Q0 */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 1723edb3f..c375f9dd8 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -76,13 +76,6 @@ typedef struct Word32 s32Mantissa; } T_VAD_EXP; -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC -typedef struct -{ - Word32 low, high; - Word16 value; -} TastatEnc; -#endif /*----------------------------------------------------------------------------------* * Bitstream structure *----------------------------------------------------------------------------------*/ @@ -455,9 +448,6 @@ typedef struct igfscfenc_public_data_struct const UWord16 *cf_se11; const Word16 *cf_off_se11; Tastat acState; -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_ENC - TastatEnc acState_fx; -#endif Tastat acState_ivas_fx; } IGFSCFENC_INSTANCE, *IGFSCFENC_INSTANCE_HANDLE; -- GitLab From f4b3cc16eee7b35d27b2e69f2ee7047b47d0cf5c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:02 +0200 Subject: [PATCH 04/49] Accept FIX_BASOP_2551_HARM_SCALAR_QUAN --- lib_com/options.h | 1 - lib_com/prot_fx.h | 13 --- lib_enc/cod_tcx_fx.c | 42 ------- lib_enc/ivas_stereo_mdct_stereo_enc_fx.c | 4 - lib_enc/prot_fx_enc.h | 12 -- lib_enc/tcx_utils_enc_fx.c | 140 ----------------------- 6 files changed, 212 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2596a6cc9..a8c8fb89e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ #define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ #define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ #define FIX_BASOP_2095_REMOVE_TABLES_PT01 /* FhG: BASOP issue 2095: remove unused tables, part 01 */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 22f121f11..3a7c272c0 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8493,18 +8493,6 @@ void con_tcx_fx( void ari_start_encoding_14bits_fx( Tastat *s ); -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN -void tcx_scalar_quantization_ivas_fx( - Word32 *x, /* i: input coefficients */ - Word16 x_e, /* i: exponent */ - Word16 *xq, /* o: quantized coefficients */ - Word16 L_frame, /* i: frame length */ - Word16 gain, /* i: quantization gain */ - Word16 gain_e, /* i: quantization gain exponent */ - Word16 offset, /* i: rounding offset (deadzone) */ - Word8 const *memQuantZeros_fx, /* i: coefficients to be set to 0 */ - const Word16 alfe_flag ); -#else void tcx_scalar_quantization_fx( Word32 *x, /* i: input coefficients */ Word16 x_e, /* i: exponent */ @@ -8516,7 +8504,6 @@ void tcx_scalar_quantization_fx( Word8 const *memQuantZeros_fx, /* i: coefficients to be set to 0 */ const Word16 alfe_flag, const Word16 element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index d043aeb49..440ce6a87 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1438,15 +1438,6 @@ void QuantizeSpectrum_fx( &sqGain_e, EVS_MONO ); -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_fx( OriginalSpectrum, OriginalSpectrum_e, - sqQ, - L_spec, - sqGain, sqGain_e, - hTcxCfg->sq_rounding, - hTcxEnc->memQuantZeros, - tcxonly ); -#else tcx_scalar_quantization_fx( OriginalSpectrum, OriginalSpectrum_e, sqQ, L_spec, @@ -1455,7 +1446,6 @@ void QuantizeSpectrum_fx( hTcxEnc->memQuantZeros, tcxonly, st->element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN /* Estimate original bitrate */ @@ -1544,15 +1534,6 @@ void QuantizeSpectrum_fx( EVS_MONO ); /* Quantize spectrum */ -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_fx( spectrum, *spectrum_e, - sqQ, - L_spec, - sqGain, sqGain_e, - hTcxCfg->sq_rounding, - hTcxEnc->memQuantZeros, - tcxonly ); -#else tcx_scalar_quantization_fx( spectrum, *spectrum_e, sqQ, L_spec, @@ -1561,7 +1542,6 @@ void QuantizeSpectrum_fx( hTcxEnc->memQuantZeros, tcxonly, st->element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN /* Estimate bitrate */ stop = 0; @@ -1752,15 +1732,6 @@ void QuantizeSpectrum_fx( { sqGain = tmp1; sqGain_e = s; -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_fx( spectrum, *spectrum_e, - sqQ, - L_spec, - sqGain, sqGain_e, - hTcxCfg->sq_rounding, - hTcxEnc->memQuantZeros, - tcxonly ); -#else tcx_scalar_quantization_fx( spectrum, *spectrum_e, sqQ, L_spec, @@ -1770,7 +1741,6 @@ void QuantizeSpectrum_fx( tcxonly, st->element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN move16(); @@ -3076,11 +3046,7 @@ void QuantizeTCXSpectrum_fx( /* Quantize original spectrum */ sqGain_fx = SQ_gain_fx( spectrum_fx, *spectrum_e, ( mult( hTcxEnc->tcx_target_bits_fac, shl( sqTargetBits, 1 ) ) ), L_spec, &sqGain_e, 1 /*signal non-EVS*/ ); -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly ); -#else tcx_scalar_quantization_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly, st->element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN /* Estimate original bitrate */ stop = 0; move16(); @@ -3171,11 +3137,7 @@ void QuantizeTCXSpectrum_fx( sqGain_fx = SQ_gain_fx( spectrum_fx, *spectrum_e, shl( mult( hTcxEnc->tcx_target_bits_fac, sqTargetBits ), 1 ), L_spec, &sqGain_e, 1 /*signal non-EVS*/ ); } /* Quantize spectrum */ -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly ); -#else tcx_scalar_quantization_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly, st->element_mode ); -#endif /* Estimate bitrate */ stop = 0; move16(); @@ -3440,11 +3402,7 @@ void QuantizeTCXSpectrum_fx( move16(); sqGain_e = 1; move16(); -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_ivas_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly ); -#else tcx_scalar_quantization_fx( spectrum_fx, *spectrum_e, sqQ, L_spec, sqGain_fx, sqGain_e, st->hTcxCfg->sq_rounding, hTcxEnc->memQuantZeros, st->tcxonly, st->element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN stop = 1; IF( st->element_mode > EVS_MONO ) diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index 13be061f8..4ef324129 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -969,12 +969,8 @@ static Word16 QuantSpecEstimateBits_fx( Word16 stop, sqBits, nEncoded; Word16 lastnz; -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tcx_scalar_quantization_ivas_fx( spec_fx, spec_e, sqQ, length, G_fx, G_e, 16384 /*Q15*/, NULL, 1 ); -#else // This flag could potentially be anything except EVS_MONO. In case of future errors consider passing down the flag from higher function calls. tcx_scalar_quantization_fx( spec_fx, spec_e, sqQ, length, G_fx, G_e, 16384 /*Q15*/, NULL, 1, IVAS_SCE ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN stop = 0; move16(); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index d444de43b..1e2bb4e36 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1082,18 +1082,6 @@ Word16 SQ_gain_estimate_fx( Word16 *gain_e /* o : SQ gain exponent */ ); -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN -void tcx_scalar_quantization_fx( - Word32 *x, /* i : i coefficients */ - Word16 x_e, /* i : exponent */ - Word16 *xq, /* o : quantized coefficients */ - Word16 L_frame, /* i : frame length */ - Word16 gain, /* i : quantization gain */ - Word16 gain_e, /* i : quantization gain exponent */ - Word16 offset, /* i : rounding offset (deadzone) */ - Word8 const *memQuantZeros, /* i : coefficients to be set to 0 */ - const Word16 alfe_flag ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN Word16 tcx_scalar_quantization_rateloop_fx( diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 757cfeb8f..5ee4a8914 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -1146,94 +1146,7 @@ Word16 SQ_gain_estimate_fx( return tmp16; } -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN -void tcx_scalar_quantization_fx( - Word32 *x, /* i : input coefficients */ - Word16 x_e, /* i : exponent */ - Word16 *xq, /* o : quantized coefficients */ - Word16 L_frame, /* i : frame length */ - Word16 gain, /* i : quantization gain */ - Word16 gain_e, /* i : quantization gain exponent */ - Word16 offset, /* i : rounding offset (deadzone) */ - Word8 const *memQuantZeros_fx, /* i : coefficients to be set to 0 */ - const Word16 alfe_flag ) -{ - Word16 i, tmp16, s; - Word32 tmp32, offs32; - - /* common exponent for x and gain for comparison */ - tmp16 = sub( gain_e, x_e ); - tmp32 = L_shl( L_deposit_h( gain ), s_max( -31, s_min( tmp16, 0 ) ) ); - tmp16 = negate( s_max( tmp16, 0 ) ); - - i = sub( L_frame, 1 ); - - test(); - WHILE( ( memQuantZeros_fx[i] != 0 ) && ( LT_32( L_abs( L_shl( x[i], tmp16 ) ), tmp32 ) ) ) - { - test(); - xq[i] = 0; - move16(); - i = sub( i, 1 ); - } - - /* invert gain */ - gain = Inv16( gain, &gain_e ); - - s = sub( add( x_e, gain_e ), 15 ); - - /*It should almost never happen and if so the quantization will be discarded later on (saturation of gain Quantizer).*/ - IF( GT_16( s, 31 ) ) - { - /* Limit the inverse gain to maximal possible value=sqrtL_spec/NORM_MDCT_FACTOR)*/ - gain = 22435; /*sqrt(1200/NORM_MDCT_FACTOR) in 2Q13*/ - gain_e = 2; - move16(); - move16(); - - s = sub( add( x_e, gain_e ), 15 ); - } - - /* substract 0x8000 to affect the mac_r in the following loop - so it acts like extract_h. the 0x4000 will be multiplied by 2 - by the mac_r to get to 0x8000 and disable the round. */ - offset = sub( offset, 0x4000 ); - - FOR( ; i >= 0; i-- ) - { - offs32 = Mpy_32_16_1( L_abs( x[i] ), gain ); /* multiply */ - offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ - tmp16 = mac_r_sat( offs32, offset, 1 ); /* add offset and truncate */ - IF( x[i] < 0 ) - { - tmp16 = negate( tmp16 ); /* restore sign */ - } - xq[i] = tmp16; - move16(); - } - - IF( alfe_flag == 0 ) - { - AdaptLowFreqEmph_fx( x, x_e, xq, gain, gain_e, 0, NULL, NULL, L_frame ); - } - - return; -} -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN - -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN -void tcx_scalar_quantization_ivas_fx( - Word32 *x, /* i : input coefficients exponent = x_e */ - Word16 x_e, /* i : exponent */ - Word16 *xq, /* o : quantized coefficients */ - Word16 L_frame, /* i : frame length */ - Word16 gain, /* i : quantization gain exponent = gain_e */ - Word16 gain_e, /* i : quantization gain exponent */ - Word16 offset, /* i : rounding offset (deadzone) */ - Word8 const *memQuantZeros_fx, /* i : coefficients to be set to 0 */ - const Word16 alfe_flag ) -#else void tcx_scalar_quantization_fx( Word32 *x, /* i : input coefficients exponent = x_e */ Word16 x_e, /* i : exponent */ @@ -1245,7 +1158,6 @@ void tcx_scalar_quantization_fx( Word8 const *memQuantZeros_fx, /* i : coefficients to be set to 0 */ const Word16 alfe_flag, const Word16 element_mode ) -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN { Word16 i, tmp16, s; Word32 tmp32, offs32; @@ -1254,12 +1166,8 @@ void tcx_scalar_quantization_fx( /* common exponent for x and gain for comparison */ tmp16 = sub( gain_e, x_e ); -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - tmp32 = L_shl_sat( L_deposit_h( gain ), tmp16 ); // exp:x_e -#else tmp32 = L_shl( L_deposit_h( gain ), s_max( -31, s_min( tmp16, 0 ) ) ); tmp16 = negate( s_max( tmp16, 0 ) ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN i = sub( L_frame, 1 ); IF( memQuantZeros_fx != NULL ) @@ -1290,35 +1198,12 @@ void tcx_scalar_quantization_fx( s = sub( add( x_e, gain_e ), 15 ); } -#ifdef FIX_BASOP_2551_HARM_SCALAR_QUAN if ( EQ_16( element_mode, EVS_MONO ) ) { offset = sub( offset, 0x4000 ); } -#endif // FIX_BASOP_2551_HARM_SCALAR_QUAN -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - FOR( ; i >= 0; i-- ) - { - offs32 = Mpy_32_16_1( x[i], gain ); - offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ - - offs32_1 = L_add_sat( offs32, offset_Q16 ); /*15Q16 */ - tmp16 = extract_h( offs32_1 ); - IF( x[i] < 0 ) - { - offs32 = L_sub_sat( offs32, offset_Q16 ); /*15Q16 */ - tmp16 = extract_h( offs32 ); - if ( L_mac_sat( offs32, tmp16, -ONE_IN_Q15 ) > 0 ) - { - tmp16 = add( tmp16, 1 ); - } - } - xq[i] = tmp16; - move16(); - } -#else IF( EQ_16( element_mode, EVS_MONO ) ) { FOR( ; i >= 0; i-- ) @@ -1360,7 +1245,6 @@ void tcx_scalar_quantization_fx( move16(); } } -#endif IF( alfe_flag == 0 ) { @@ -1682,18 +1566,7 @@ Word16 tcx_scalar_quantization_rateloop_fx( } /* Quantize spectrum */ -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - IF( EQ_16( element_mode, EVS_MONO ) ) - { - tcx_scalar_quantization_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly ); - } - ELSE - { - tcx_scalar_quantization_ivas_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly ); - } -#else tcx_scalar_quantization_fx( x, x_e, xq, L_frame, sqGain, sqGain_e, offset, memQuantZeros_fx, tcxonly, element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN /* Estimate bitrate */ stopFlag = 1; move16(); @@ -1744,20 +1617,7 @@ Word16 tcx_scalar_quantization_rateloop_fx( IF( GE_16( tcxRateLoopOpt, 1 ) ) { -#ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN - - IF( EQ_16( element_mode, EVS_MONO ) ) - { - tcx_scalar_quantization_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly ); - } - ELSE - { - tcx_scalar_quantization_ivas_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly ); - } - -#else tcx_scalar_quantization_fx( x, x_e, xq, L_frame, *gain, *gain_e, offset, memQuantZeros_fx, tcxonly, element_mode ); -#endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN /* Output */ -- GitLab From 25e9bebef3af2b8395f7d7155ed40498b514fffa Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:04 +0200 Subject: [PATCH 05/49] Accept HARMONIZE_2564_GetEnergyCldfb --- lib_com/cldfb_evs_fx.c | 12 --- lib_com/cldfb_fx.c | 179 ----------------------------------------- lib_com/options.h | 1 - lib_com/prot_fx.h | 4 - 4 files changed, 196 deletions(-) diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index 2d611b27e..f654083b3 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -1216,12 +1216,8 @@ void analysisCldfbEncoder_fx( &enerScale.lb_scale16 ); /* get the energy */ -#ifdef HARMONIZE_2564_GetEnergyCldfb GetEnergyCldfb( EVS_MONO, -#else - GetEnergyCldfb( -#endif &st_fx->energyCoreLookahead_Fx, &st_fx->sf_energyCoreLookahead_Fx, num_slots, @@ -1240,12 +1236,8 @@ void analysisCldfbEncoder_fx( } -#ifdef HARMONIZE_2564_GetEnergyCldfb void GetEnergyCldfb( Word16 element_mode, /*!< i: | Is IVAS or EVS? */ -#else -void GetEnergyCldfb( -#endif Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) | pointer to the result in the core look-ahead slot */ Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot */ const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */ @@ -1320,15 +1312,11 @@ void GetEnergyCldfb( move16(); energyValuesSum[j] = L_shr_r( energyValuesSum[j], 1 ); move32(); -#ifdef HARMONIZE_2564_GetEnergyCldfb nrg = L_shr_r( nrg, 1 ); if ( EQ_16( element_mode, EVS_MONO ) ) { -#endif nrg = L_shr_r( energyValues[k][j], 1 ); -#ifdef HARMONIZE_2564_GetEnergyCldfb } -#endif } energyValuesSum[j] = L_add( energyValuesSum[j], nrg ); move32(); diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 6126a6ee2..93c7cea0b 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -55,21 +55,6 @@ static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs ); -#ifndef HARMONIZE_2564_GetEnergyCldfb -static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) | pointer to the result in the core look-ahead slot */ - Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot */ - const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */ - Word16 **realValues, /*!< i: Q(sf_Values) | the real part of the CLDFB subsamples */ - Word16 **imagValues, /*!< i: Q(sf_Values) | the imaginary part of the CLDFB subsamples */ - Word16 sf_Values, /*!< i: scalefactor of the CLDFB subcamples - apply as a negated Exponent */ - Word16 numberBands, /*!< i: Q0 | number of CLDFB bands */ - Word16 numberCols, /*!< i: Q0 | number of CLDFB subsamples */ - Word32 *energyHF, /*!< o: Q31 | pointer to HF energy */ - Word16 *energyHF_Exp, /*!< o: pointer to exponent of HF energy */ - Word32 *energyValuesSum, /*!< o: Q(2*sf_Values-4) | pointer to sum array of energy values, not initialized*/ - Word16 *energyValuesSum_Exp, /*!< o: pointer to exponents of energyValuesSum, not initialized */ - TEC_ENC_HANDLE hTecEnc ); -#endif /*-------------------------------------------------------------------* * cldfbAnalysis_ivas() @@ -1456,166 +1441,6 @@ void resampleCldfb_ivas_fx( return; } -#ifndef HARMONIZE_2564_GetEnergyCldfb -static void GetEnergyCldfb_ivas_fx( - Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) | pointer to the result in the core look-ahead slot */ - Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot */ - const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */ - Word16 **realValues, /*!< i: Q(sf_Values) | the real part of the CLDFB subsamples */ - Word16 **imagValues, /*!< i: Q(sf_Values) | the imaginary part of the CLDFB subsamples */ - Word16 sf_Values, /*!< i: scalefactor of the CLDFB subcamples - apply as a negated Exponent */ - Word16 numberBands, /*!< i: Q0 | number of CLDFB bands */ - Word16 numberCols, /*!< i: Q0 | number of CLDFB subsamples */ - Word32 *energyHF, /*!< o: Q31 | pointer to HF energy */ - Word16 *energyHF_Exp, /*!< o: pointer to exponent of HF energy */ - Word32 *energyValuesSum, /*!< o: Q(2*sf_Values-4) | pointer to sum array of energy values, not initialized*/ - Word16 *energyValuesSum_Exp, /*!< o: pointer to exponents of energyValuesSum, not initialized */ - TEC_ENC_HANDLE hTecEnc ) -{ - Word16 j; - Word16 k; - Word16 s; - Word16 sm; - Word32 nrg; - Word16 numberColsL; - Word16 numberBandsM; - Word16 numberBandsM20; - Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX]; - // Word16 freqTable[2] = {20, 40}; - - FOR( k = 0; k < numberCols; k++ ) - { - FOR( j = 0; j < numberBands; j++ ) - { - nrg = L_mult0( realValues[k][j], realValues[k][j] ); // Q(2*sf_Values) - nrg = L_mac0( nrg, imagValues[k][j], imagValues[k][j] ); // Q(2*sf_Values) - - energyValues[k][j] = nrg; - move32(); - } - } - - IF( GE_16( numberBands, freqTable[1] ) && hTecEnc != NULL ) - { - Word32 *tempEnergyValuesArry[CLDFB_NO_COL_MAX]; - Word16 ScaleX2; - assert( numberCols == CLDFB_NO_COL_MAX ); - FOR( j = 0; j < numberCols; j++ ) - { - tempEnergyValuesArry[j] = &energyValues[j][0]; - } - - ScaleX2 = shl( sf_Values, 1 ); - calcHiEnvLoBuff_Fix( - numberCols, - freqTable, - 1, - tempEnergyValuesArry, - hTecEnc->loBuffer, - hTecEnc->hiTempEnv, - ScaleX2 ); - } - - FOR( j = 0; j < numberBands; j++ ) - { - energyValuesSum[j] = 0; - move32(); - energyValuesSumE[j] = 31; - move16(); - FOR( k = 0; k < CLDFB_NO_COL_MAX; k++ ) - { - nrg = L_shr_r( energyValues[k][j], sub( energyValuesSumE[j], 31 ) ); // Q(2*sf_Values - (energyValuesSumE[j]-31)) - IF( LT_32( L_sub( maxWord32, nrg ), energyValuesSum[j] ) ) - { - energyValuesSumE[j] = add( energyValuesSumE[j], 1 ); - move16(); - energyValuesSum[j] = L_shr_r( energyValuesSum[j], 1 ); - move32(); - nrg = L_shr_r( nrg, 1 ); - } - energyValuesSum[j] = L_add( energyValuesSum[j], nrg ); - move32(); - } - test(); - if ( j == 0 || GT_16( energyValuesSumE[j], *energyValuesSum_Exp ) ) - { - *energyValuesSum_Exp = energyValuesSumE[j]; - move16(); - } - } - FOR( j = 0; j < numberBands; j++ ) - { - energyValuesSum[j] = L_shr_r( energyValuesSum[j], sub( *energyValuesSum_Exp, energyValuesSumE[j] ) ); // Q(energyValuesSum_Exp - (2*sf_Values)) - move32(); - } - *energyValuesSum_Exp = sub( *energyValuesSum_Exp, shl( sf_Values, 1 ) ); - move16(); - - IF( GT_16( numberBands, 20 ) ) - { - numberBandsM = s_min( numberBands, 40 ); - numberBandsM20 = sub( numberBandsM, 20 ); - - numberColsL = sub( numberCols, numLookahead ); - - /* sum up CLDFB energy above 8 kHz */ - s = BASOP_util_norm_s_bands2shift( i_mult( numberColsL, numberBandsM20 ) ); - s = sub( s, 4 ); - nrg = 0; - move32(); - FOR( k = 0; k < numberColsL; k++ ) - { - FOR( j = 20; j < numberBandsM; j++ ) - { - nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); - } - } - - s = sub( sub( shl( sf_Values, 1 ), 1 ), s ); - sm = sub( s_min( s, *sf_energyLookahead ), 1 ); - - *energyHF = L_add( L_shr( nrg, limitScale32( sub( s, sm ) ) ), - L_shr( *energyLookahead, sub( *sf_energyLookahead, sm ) ) ); // Q(31-(-nm)) - move32(); - - *energyHF_Exp = negate( sm ); - move16(); - - /* process look-ahead region */ - s = BASOP_util_norm_s_bands2shift( i_mult( numLookahead, numberBandsM20 ) ); - s = sub( s, 2 ); - nrg = 0; - move32(); - FOR( k = numberColsL; k < numberCols; k++ ) - { - FOR( j = 20; j < numberBandsM; j++ ) - { - nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) ); - } - } - - s = sub( shl( sf_Values, 1 ), s ); - sm = sub( s_min( s, 44 ), 1 ); - BASOP_SATURATE_WARNING_OFF_EVS - /* nrg + 6.1e-5f => value 0x40000000, scale 44 */ - *energyLookahead = L_add_sat( L_shr_sat( nrg, sub( s, sm ) ), - L_shr_sat( 0x40000000, s_max( -31, s_min( 31, sub( 44, sm ) ) ) ) ); - move32(); - BASOP_SATURATE_WARNING_ON_EVS - *sf_energyLookahead = sm; - move16(); - - return; - } - - - *energyHF = 0x40000000; - move32(); - *energyHF_Exp = 17; - move16(); -} -#endif void analysisCldfbEncoder_ivas_fx( @@ -1677,11 +1502,7 @@ void analysisCldfbEncoder_ivas_fx( move16(); AnalysisPostSpectrumScaling_Fx( st->cldfbAnaEnc, ppBuf_Real, ppBuf_Imag, ppBuf_Real16, ppBuf_Imag16, &enerScale.lb_scale16 ); -#ifdef HARMONIZE_2564_GetEnergyCldfb GetEnergyCldfb( st->element_mode, &st->energyCoreLookahead_Fx, &st->sf_energyCoreLookahead_Fx, 1, ppBuf_Real16, ppBuf_Imag16, enerScale.lb_scale16, st->cldfbAnaEnc->no_channels, st->cldfbAnaEnc->no_col, &st->currEnergyHF_fx, &st->currEnergyHF_e_fx, ppBuf_Ener, enerBuffSum_exp, st->hTECEnc ); -#else - GetEnergyCldfb_ivas_fx( &st->energyCoreLookahead_Fx, &st->sf_energyCoreLookahead_Fx, 1, ppBuf_Real16, ppBuf_Imag16, enerScale.lb_scale16, st->cldfbAnaEnc->no_channels, st->cldfbAnaEnc->no_col, &st->currEnergyHF_fx, &st->currEnergyHF_e_fx, ppBuf_Ener, enerBuffSum_exp, st->hTECEnc ); -#endif return; } diff --git a/lib_com/options.h b/lib_com/options.h index a8c8fb89e..f815566c4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2564_GetEnergyCldfb /* FhG: harmonize GetEnergyCldfb derivates for evs/ivas */ #define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ #define FIX_BASOP_2095_REMOVE_TABLES_PT01 /* FhG: BASOP issue 2095: remove unused tables, part 01 */ #define FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 /* FhG: part 2 of basop issue 2346: Review potentially duplicated IGF functions */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 3a7c272c0..4af8795b1 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4104,12 +4104,8 @@ void analysisCldfbEncoder_fx( Word16 *enerBuffSum_exp, CLDFB_SCALE_FACTOR *scale ); -#ifdef HARMONIZE_2564_GetEnergyCldfb void GetEnergyCldfb( Word16 element_mode, /*!< i: | Is IVAS or EVS? */ -#else -void GetEnergyCldfb( -#endif Word32 *energyLookahead, /*!< o: Q31 | pointer to the result in the core look-ahead slot */ Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot - apply as negative exponent*/ const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */ -- GitLab From 3a5f23d8209665556fc45e439f34065b85c8faf6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:06 +0200 Subject: [PATCH 06/49] Accept FIX_BASOP_2555_FRAMELEN_CALC --- lib_com/options.h | 1 - lib_dec/ivas_mdct_core_dec_fx.c | 31 ------------------------------- 2 files changed, 32 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f815566c4..389a2f3bf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ #define FIX_BASOP_2095_REMOVE_TABLES_PT01 /* FhG: BASOP issue 2095: remove unused tables, part 01 */ #define FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 /* FhG: part 2 of basop issue 2346: Review potentially duplicated IGF functions */ #define FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC /* Eri: BASOP issue 2563: Crash in hq_generic decoding. EVS code --> solve with _sat operator */ diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 1bcd79b3b..da6301e2c 100755 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1513,11 +1513,7 @@ void ivas_mdct_core_tns_ns_fx( Word16 left_rect[CPE_CHANNELS]; Word16 L_spec[CPE_CHANNELS]; Word32 sns_int_scf_fx[FDNS_NPTS]; -#ifdef FIX_BASOP_2555_FRAMELEN_CALC Word16 length; -#else - Word16 exp, length; -#endif /* Initializations */ sts = hCPE->hCoreCoder; @@ -1532,7 +1528,6 @@ void ivas_mdct_core_tns_ns_fx( FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; -#ifdef FIX_BASOP_2555_FRAMELEN_CALC IF( EQ_16( st->core, TCX_20_CORE ) ) { nSubframes[ch] = 1; @@ -1559,32 +1554,6 @@ void ivas_mdct_core_tns_ns_fx( move16(); move16(); } -#else - IF( EQ_16( st->core, TCX_20_CORE ) ) - { - nSubframes[ch] = 1; - } - ELSE - { - nSubframes[ch] = NB_DIV; - } - move16(); - - L_frame_global[ch] = BASOP_Util_Divide3216_Scale( st->L_frame, nSubframes[ch], &exp ); - move16(); - L_frame_global[ch] = shl( L_frame_global[ch], add( exp, 1 ) ); - move16(); - - L_frameTCX_glob[ch] = BASOP_Util_Divide3216_Scale( st->hTcxDec->L_frameTCX, nSubframes[ch], &exp ); - move16(); - L_frameTCX_glob[ch] = shl( L_frameTCX_glob[ch], add( exp, 1 ) ); - move16(); - - L_spec[ch] = BASOP_Util_Divide3216_Scale( st->hTcxCfg->tcx_coded_lines, nSubframes[ch], &exp ); - move16(); - L_spec[ch] = shl( L_spec[ch], add( exp, 1 ) ); - move16(); -#endif test(); test(); -- GitLab From bfadc8f17c4ae78b7f7efdd35b6354e7100dd4ff Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:08 +0200 Subject: [PATCH 07/49] Accept FIX_BASOP_2095_REMOVE_TABLES_PT01 --- lib_com/ivas_rom_com.h | 3 - lib_com/ivas_rom_com_fx.c | 176 ---------------- lib_com/options.h | 1 - lib_com/rom_com.h | 6 - lib_com/rom_com_fx.c | 414 -------------------------------------- 5 files changed, 600 deletions(-) diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 90de10fd0..12e4306d6 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -338,9 +338,6 @@ extern const Word32 ls_azimuth_CICP16_fx[9]; extern const Word32 ls_elevation_CICP16_fx[9]; extern const Word32 ls_azimuth_CICP19_fx[11]; extern const Word32 ls_elevation_CICP19_fx[11]; -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -extern const Word16 pow_10_q11[128]; -#endif extern const Word32 pow_10_q23[14]; extern const Word16 ivas_sin_az_fx[361]; extern const Word16 ivas_sine_panning_tbl_fx[601]; diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index f8ef32ed0..095d2b77f 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -82,173 +82,6 @@ const Word16 dft_band_res_cod[3][4] = {0,5,6,7} }; -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -// Q31 -const Word32 dft_res_gains_q_Q31[][2] = -{ - /* quantization points for joint quantization of prediction gain and residual energy */ - - /* column 1 (|ILD| = 0): */ - {0, 0 }, - {0, 251216928 }, - {0, 487459456 }, - {0, 731632640 }, - {0, 997611392 }, - {0, 1299397248 }, - {0, 1666984192 }, - {0, 2147483647 }, - - /* column 2 (|ILD| = 2): */ - {246151024, 0 }, - {249475328, 247871152 }, - {258660112, 480729248 }, - {274304544, 720918848 }, - {298427200, 981720000 }, - {334663840, 1276185088 }, - {391374592, 1632160640 }, - {485919712, 2091786496 }, - - /* column 3 (|ILD| = 4): */ - {485919712, 0 }, - {492224736, 238188144 }, - {509610752, 461283776 }, - {539117184, 690072384 }, - {584326016, 936189056 }, - {651608832, 1210182144 }, - {755411712, 1534299776 }, - {924504576, 1938292992 }, - - /* column 4 (|ILD| = 6): */ - {713563712, 0 }, - {722237376, 223142880 }, - {746085184, 431184640 }, - {786311872, 642617280 }, - {847364864, 866812416 }, - {936938496, 1111020032 }, - {1072199936, 1390431232 }, - {1285225984, 1720430720 }, - - /* column 5 (|ILD| = 8): */ - {924504576, 0 }, - {934784576, 204139792 }, - {962942400, 393358880 }, - {1010083968, 583482048 }, - {1080789888, 781462848 }, - {1182728704, 991308544 }, - {1332741248, 1221608960 }, - {1559902080, 1475937536 }, - - /* column 6 (|ILD| = 10): */ - {1115604864, 0 }, - {1126709504, 182744416 }, - {1156997632, 351025536 }, - {1207276672, 517958016 }, - {1281710592, 688294272 }, - {1387005952, 863412992 }, - {1537761536, 1046870336 }, - {1757032448, 1234717184 }, - - /* column 7 (|ILD| = 13): */ - {1361843968, 0 }, - {1372924928, 149366080 }, - {1402942464, 285507936 }, - {1452130560, 417893888 }, - {1523515136, 548787328 }, - {1621670144, 677135936 }, - {1756740352, 802203264 }, - {1942499840, 915633344 }, - - /* column 8 (|ILD| = 16): */ - {1559902080, 0 }, - {1569913600, 117815248 }, - {1596862336, 224162928 }, - {1640492800, 325650848 }, - {1702660352, 423060736 }, - {1785997696, 514412544 }, - {1896788608, 597466432 }, - {2042241920, 664027712 }, - - /* column 9 (|ILD| = 19): */ - {1714196608, 0 }, - {1722634112, 90359672 }, - {1745223424, 171238192 }, - {1781415040, 247171072 }, - {1832190080, 318199104 }, - {1898830848, 382271424 }, - {1984989952, 437025792 }, - {2094086528, 475912448 }, - - /* column 10 (|ILD| = 22): */ - {1831427712, 0 }, - {1838194432, 67828272 }, - {1856228992, 128123168 }, - {1884882944, 183977072 }, - {1924581248, 235132272 }, - {1975822336, 279821408 }, - {2040659200, 316058048 }, - {2120554240, 339023232 }, - - /* column 11 (|ILD| = 25): */ - {1918819584, 0 }, - {1924055168, 50102940 }, - {1937964416, 94399088 }, - {1959916032, 135003712 }, - {1990038784, 171579648 }, - {2028424960, 202728896 }, - {2076217216, 226931040 }, - {2133943808, 240762976 }, - - /* column 12 (|ILD| = 30): */ - {2015827840, 0 }, - {2019068416, 29502130 }, - {2027636864, 55420112 }, - {2041056512, 78889960 }, - {2059271424, 99626064 }, - {2082150784, 116769424 }, - {2110128128, 129415952 }, - {2143192960, 135682304 }, - - /* column 13 (|ILD| = 35): */ - {2072441984, 0 }, - {2074364032, 17033840 }, - {2079438464, 31939524 }, - {2087347712, 45337676 }, - {2098012032, 57039312 }, - {2111296384, 66537632 }, - {2127368192, 73321536 }, - {2146126464, 76351632 }, - - /* column 14 (|ILD| = 40): */ - {2104959232, 0 }, - {2106073728, 9723806 }, - {2109011456, 18212808 }, - {2113579136, 25810606 }, - {2119712384, 32401234 }, - {2127314432, 37692632 }, - {2136458496, 41399188 }, - {2147054208, 42945376 }, - - /* column 15 (|ILD| = 45): */ - {2123466240, 0 }, - {2124103936, 5514738 }, - {2125783296, 10322954 }, - {2128390400, 14615774 }, - {2131882240, 18322330 }, - {2136200832, 21283710 }, - {2141376256, 23332410 }, - {2147348352, 24150602 }, - - /* column 16 (|ILD| = 50): */ - {2133943808, 0 }, - {2134306688, 3115998 }, - {2135260160, 5830418 }, - {2136737664, 8250632 }, - {2138715520, 10335839 }, - {2141157120, 11995844 }, - {2144077696, 13136157 }, - {2147440640, 13580687 } -}; -#endif /* tables for adaptive Golomb-Rice coding of DFT stereo parameters */ const Word16 dft_code_itd[] = @@ -3403,15 +3236,6 @@ const Word32 ls_azimuth_CICP19_fx[11] = { 125829120, -125829120, 0, 566231040, - /* Q22 */ const Word32 ls_elevation_CICP19_fx[11] = { 0, 0, 0, 0, 0, 0, 0, 146800640, 146800640, 146800640, 146800640 }; -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -const Word16 pow_10_q11[128] = { - 2048, 2085, 2123, 2161, 2200, 2240, 2281, 2322, 2364, 2407, 2451, 2496, 2541, 2587, 2634, 2682, 2731, 2780, 2831, 2882, 2934, 2988, 3042, 3097, 3153, 3211, 3269, - 3328, 3389, 3450, 3513, 3576, 3641, 3708, 3775, 3843, 3913, 3984, 4056, 4130, 4205, 4281, 4359, 4438, 4519, 4601, 4684, 4769, 4856, 4944, 5034, 5125, 5218, 5313, - 5410, 5508, 5608, 5710, 5813, 5919, 6026, 6136, 6247, 6360, 6476, 6593, 6713, 6835, 6959, 7085, 7214, 7345, 7478, 7614, 7752, 7893, 8036, 8182, 8331, 8482, 8636, - 8793, 8952, 9115, 9280, 9449, 9620, 9795, 9973, 10154, 10338, 10526, 10717, 10911, 11109, 11311, 11516, 11725, 11938, 12155, 12375, 12600, 12829, 13062, 13299, - 13540, 13786, 14036, 14291, 14550, 14815, 15084, 15357, 15636, 15920, 16209, 16503, 16803, 17108, 17418, 17734, 18056, 18384, 18718, 19058, 19404, 19756, 20114 -}; -#endif // Q12 const Word16 icbwe_gsMapping_tbl_fx[16] = { -8192, -5527, -3935, -2907, -2289, -1824, -1404, -1035, -692, -404, -286, -204, -81, 0, 163, 327 diff --git a/lib_com/options.h b/lib_com/options.h index 389a2f3bf..fd4e04e5d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2095_REMOVE_TABLES_PT01 /* FhG: BASOP issue 2095: remove unused tables, part 01 */ #define FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 /* FhG: part 2 of basop issue 2346: Review potentially duplicated IGF functions */ #define FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC /* Eri: BASOP issue 2563: Crash in hq_generic decoding. EVS code --> solve with _sat operator */ #define FIX_2095_REMOVE_UNUSED_ISAR_TABLES /* Dolby: remove unused ISAR */ diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 9a2caa064..09f7de4ff 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1136,9 +1136,6 @@ extern const Word32 rot_vec_syn_re_L60_fx[30]; // Q31 extern const Word32 rot_vec_syn_im_L60_fx[30]; // Q31 extern const Word16 bpf_weights_16_Fx[16]; // Q15 -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -extern const Word16 bpf_weights_16_ivas_fx[16]; // Q15 -#endif extern const Word32 bpf_weights_16_ivas_fx_32[16]; // Q30 extern const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG]; // Q6 @@ -1606,8 +1603,5 @@ extern const Word32 rot_vec_ana_re_L60_fx[30]; // Q29 extern const Word32 rot_vec_ana_im_L60_fx[30]; // Q29 extern const Word16 LP_assym_window_fx[]; /* Assymetric window for LP analysis @12.8kHz (Q15) */ -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -extern const Word16 LP_assym_window_16k_fx[]; /* Assymetric window for LP analysis @16kHz (Q15) */ -#endif #endif diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c index d2f077a3e..ff8bd7417 100644 --- a/lib_com/rom_com_fx.c +++ b/lib_com/rom_com_fx.c @@ -6822,15 +6822,6 @@ const Word16 bpf_weights_16_Fx[16] = 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/ }; -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -const Word16 bpf_weights_16_ivas_fx[16] = -{ - 32767/*0.999969f Q15*/, 23022/*0.702561f Q15*/, 6843/*0.208838f Q15*/, 51/*0.001553f Q15*/, - 58/*0.001777f Q15*/, 45/*0.001370f Q15*/, 30/*0.000926f Q15*/, 18/*0.000554f Q15*/, - 9/*0.000270f Q15*/, 3/*0.000080f Q15*/, 1/*0.000030f Q15*/, 3/*0.000082f Q15*/, - 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/ -}; -#endif const Word32 bpf_weights_16_ivas_fx_32[16] = { 1073784774/*1.000040f Q30*/, 754369130/*0.702561f Q30*/, 224238095/*0.208838f Q30*/, 1667521/*0.001553f Q30*/, @@ -36533,411 +36524,6 @@ const Word16 LP_assym_window_fx[L_LP] = { 0x0b0f, 0x0ad8, 0x0aa8, 0x0a82, 0x0a64, 0x0a4e, 0x0a41, 0x0a3d }; -#ifndef FIX_BASOP_2095_REMOVE_TABLES_PT01 -/* LP analysis window (length of the window is 25ms which is 400 samples at 16kHz (Q15) */ -const Word16 LP_assym_window_16k_fx[L_LP_16k] = { - 0x0a3d, - 0x0a3e, - 0x0a42, - 0x0a49, - 0x0a53, - 0x0a5f, - 0x0a6e, - 0x0a7f, - 0x0a93, - 0x0aaa, - 0x0ac4, - 0x0ae0, - 0x0aff, - 0x0b21, - 0x0b45, - 0x0b6c, - 0x0b96, - 0x0bc2, - 0x0bf1, - 0x0c23, - 0x0c57, - 0x0c8e, - 0x0cc7, - 0x0d03, - 0x0d41, - 0x0d82, - 0x0dc6, - 0x0e0c, - 0x0e55, - 0x0ea0, - 0x0eee, - 0x0f3e, - 0x0f91, - 0x0fe6, - 0x103e, - 0x1098, - 0x10f4, - 0x1153, - 0x11b4, - 0x1218, - 0x127e, - 0x12e6, - 0x1351, - 0x13be, - 0x142d, - 0x149e, - 0x1512, - 0x1588, - 0x1600, - 0x167a, - 0x16f6, - 0x1774, - 0x17f5, - 0x1878, - 0x18fc, - 0x1983, - 0x1a0c, - 0x1a96, - 0x1b23, - 0x1bb1, - 0x1c42, - 0x1cd4, - 0x1d68, - 0x1dfe, - 0x1e96, - 0x1f30, - 0x1fcb, - 0x2068, - 0x2107, - 0x21a7, - 0x2249, - 0x22ed, - 0x2392, - 0x2439, - 0x24e1, - 0x258b, - 0x2636, - 0x26e2, - 0x2790, - 0x2840, - 0x28f0, - 0x29a2, - 0x2a56, - 0x2b0a, - 0x2bc0, - 0x2c77, - 0x2d2e, - 0x2de7, - 0x2ea2, - 0x2f5d, - 0x3019, - 0x30d6, - 0x3194, - 0x3253, - 0x3313, - 0x33d3, - 0x3495, - 0x3557, - 0x361a, - 0x36dd, - 0x37a2, - 0x3867, - 0x392c, - 0x39f2, - 0x3ab9, - 0x3b80, - 0x3c47, - 0x3d0f, - 0x3dd7, - 0x3ea0, - 0x3f68, - 0x4032, - 0x40fb, - 0x41c4, - 0x428e, - 0x4358, - 0x4422, - 0x44ec, - 0x45b6, - 0x4680, - 0x4749, - 0x4813, - 0x48dd, - 0x49a6, - 0x4a6f, - 0x4b38, - 0x4c01, - 0x4cca, - 0x4d92, - 0x4e59, - 0x4f20, - 0x4fe7, - 0x50ad, - 0x5173, - 0x5238, - 0x52fd, - 0x53c1, - 0x5484, - 0x5547, - 0x5608, - 0x56c9, - 0x578a, - 0x5849, - 0x5908, - 0x59c5, - 0x5a82, - 0x5b3d, - 0x5bf8, - 0x5cb2, - 0x5d6a, - 0x5e21, - 0x5ed8, - 0x5f8d, - 0x6041, - 0x60f3, - 0x61a5, - 0x6255, - 0x6303, - 0x63b0, - 0x645c, - 0x6507, - 0x65b0, - 0x6657, - 0x66fd, - 0x67a2, - 0x6844, - 0x68e6, - 0x6985, - 0x6a23, - 0x6abf, - 0x6b5a, - 0x6bf2, - 0x6c89, - 0x6d1e, - 0x6db2, - 0x6e43, - 0x6ed2, - 0x6f60, - 0x6fec, - 0x7075, - 0x70fd, - 0x7183, - 0x7206, - 0x7288, - 0x7307, - 0x7385, - 0x7400, - 0x7479, - 0x74f0, - 0x7565, - 0x75d7, - 0x7648, - 0x76b6, - 0x7721, - 0x778b, - 0x77f2, - 0x7857, - 0x78b9, - 0x7919, - 0x7977, - 0x79d2, - 0x7a2b, - 0x7a81, - 0x7ad5, - 0x7b27, - 0x7b76, - 0x7bc2, - 0x7c0c, - 0x7c54, - 0x7c98, - 0x7cdb, - 0x7d1b, - 0x7d58, - 0x7d93, - 0x7dcb, - 0x7e00, - 0x7e33, - 0x7e63, - 0x7e91, - 0x7ebc, - 0x7ee4, - 0x7f0a, - 0x7f2d, - 0x7f4d, - 0x7f6b, - 0x7f86, - 0x7f9e, - 0x7fb3, - 0x7fc6, - 0x7fd7, - 0x7fe4, - 0x7fef, - 0x7ff7, - 0x7ffc, - 0x7fff, - 0x7fff, - 0x7ff9, - 0x7fee, - 0x7fde, - 0x7fc8, - 0x7fac, - 0x7f8c, - 0x7f65, - 0x7f39, - 0x7f08, - 0x7ed1, - 0x7e95, - 0x7e54, - 0x7e0d, - 0x7dc1, - 0x7d70, - 0x7d19, - 0x7cbd, - 0x7c5c, - 0x7bf6, - 0x7b8b, - 0x7b1b, - 0x7aa5, - 0x7a2b, - 0x79ab, - 0x7927, - 0x789e, - 0x7810, - 0x777d, - 0x76e6, - 0x764a, - 0x75a9, - 0x7504, - 0x745a, - 0x73ac, - 0x72fa, - 0x7243, - 0x7188, - 0x70c9, - 0x7006, - 0x6f3f, - 0x6e74, - 0x6da5, - 0x6cd2, - 0x6bfc, - 0x6b22, - 0x6a44, - 0x6963, - 0x687f, - 0x6797, - 0x66ac, - 0x65be, - 0x64cd, - 0x63d9, - 0x62e2, - 0x61e8, - 0x60ec, - 0x5fed, - 0x5eeb, - 0x5de7, - 0x5ce1, - 0x5bd8, - 0x5ace, - 0x59c1, - 0x58b3, - 0x57a2, - 0x5690, - 0x557c, - 0x5467, - 0x5350, - 0x5238, - 0x511f, - 0x5005, - 0x4ee9, - 0x4dcd, - 0x4cb0, - 0x4b92, - 0x4a74, - 0x4955, - 0x4836, - 0x4716, - 0x45f6, - 0x44d6, - 0x43b6, - 0x4297, - 0x4177, - 0x4058, - 0x3f39, - 0x3e1b, - 0x3cfe, - 0x3be1, - 0x3ac5, - 0x39aa, - 0x3891, - 0x3778, - 0x3661, - 0x354b, - 0x3436, - 0x3323, - 0x3212, - 0x3102, - 0x2ff5, - 0x2ee9, - 0x2de0, - 0x2cd8, - 0x2bd3, - 0x2ad0, - 0x29d0, - 0x28d2, - 0x27d7, - 0x26df, - 0x25e9, - 0x24f7, - 0x2407, - 0x231a, - 0x2231, - 0x214b, - 0x2068, - 0x1f89, - 0x1ead, - 0x1dd5, - 0x1d00, - 0x1c2f, - 0x1b62, - 0x1a99, - 0x19d4, - 0x1913, - 0x1856, - 0x179d, - 0x16e9, - 0x1638, - 0x158d, - 0x14e5, - 0x1442, - 0x13a4, - 0x130a, - 0x1275, - 0x11e5, - 0x1159, - 0x10d3, - 0x1051, - 0x0fd4, - 0x0f5c, - 0x0ee9, - 0x0e7b, - 0x0e12, - 0x0daf, - 0x0d50, - 0x0cf7, - 0x0ca3, - 0x0c55, - 0x0c0b, - 0x0bc7, - 0x0b88, - 0x0b4f, - 0x0b1b, - 0x0aed, - 0x0ac3, - 0x0aa0, - 0x0a82, - 0x0a69, - 0x0a56, - 0x0a48, - 0x0a40, - 0x0a3d, -}; -#endif /* 4-bit/3-bit TD SWB BWE differential LSF scalar quantizer tables */ /*Q15*/ -- GitLab From 5703b94230cdca81ea45b6796641ae24f962b1b2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:11 +0200 Subject: [PATCH 08/49] Accept FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 --- lib_com/options.h | 1 - lib_enc/igf_enc_fx.c | 245 ------------------------------------------- 2 files changed, 246 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fd4e04e5d..8f56700af 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 /* FhG: part 2 of basop issue 2346: Review potentially duplicated IGF functions */ #define FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC /* Eri: BASOP issue 2563: Crash in hq_generic decoding. EVS code --> solve with _sat operator */ #define FIX_2095_REMOVE_UNUSED_ISAR_TABLES /* Dolby: remove unused ISAR */ #define FIX_BASOP_2560_STEREO_DFT_DEC_RESET /* FhG: BASOP issue 2560: align reset of hStereoDft->res_gains_ind_fx[][] between BASOP and float */ diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index 845994f0b..5211c2b40 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -65,188 +65,6 @@ static void IGF_write_bits( return; } -#ifndef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 -/**********************************************************************/ /* - envelope estimation - **************************************************************************/ - -static void IGF_CalculateEnvelope( - const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */ - Word32 *pMDCTSpectrum, /**< in: Q31 | MDCT spectrum */ - Word16 MDCTSpectrum_e, /**< in: | exponent of MDCT spectrum */ - Word32 *pPowerSpectrum, /**< in: Q31 | MDCT^2 + MDST^2 spectrum, or estimate */ - Word16 PowerSpectrum_e, /**< in: | exponent of MDCT^2 + MDST^2 spectrum, or estimate */ - const Word16 igfGridIdx /**< in: Q0 | IGF grid index */ - -) -{ - IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData; - H_IGF_GRID hGrid; - Word16 *swb_offset; - Word16 sfb; /* this is the actual scalefactor band */ - Word16 width; /* this is width in subbands of the actual scalefactor band */ - Word16 tile_idx; - Word16 strt_cpy; - Word16 gain; /* the gain which has to be applied to the source tile to get the destination energy */ - Word16 gain_exp; - Word16 tb; - Word16 zeroNrg; /* Q0 | flag indicating if the signal contains almost no energy */ - Word32 sfbEnergyR[IGF_MAX_SFB]; - Word16 sfbEnergyR_exp[IGF_MAX_SFB]; - Word32 sfbEnergyC[IGF_MAX_SFB]; /* the energy of the destination region of the tile */ - Word16 sfbEnergyC_exp[IGF_MAX_SFB]; - Word32 sfbEnergyTileR[IGF_MAX_SFB]; - Word16 sfbEnergyTileR_exp[IGF_MAX_SFB]; - Word32 sfbEnergyTileC[IGF_MAX_SFB]; /* the energy of the destination region of the tile */ - Word16 sfbEnergyTileC_exp[IGF_MAX_SFB]; - Word32 LFMDCTSpectrum[N_MAX]; - Word16 LFMDCTSpectrum_exp; - Word32 LFPowerSpectrum[N_MAX]; - Word16 tmp; - Word16 tmp_exp; - Word32 L_tmp; - Word16 shift; - - /* initialize variables */ - Copy32( pMDCTSpectrum + IGF_START_MN, hInstance->spec_be_igf, hInstance->infoStopLine - IGF_START_MN ); - hPrivateData = &hInstance->igfData; - hGrid = &hPrivateData->igfInfo.grid[igfGridIdx]; - swb_offset = hGrid->swb_offset; - move16(); - hInstance->spec_be_igf_e = MDCTSpectrum_e; - move16(); - zeroNrg = 0; - move16(); - - IF( pPowerSpectrum != NULL ) - { - FOR( tile_idx = 0; tile_idx < hGrid->nTiles; tile_idx++ ) - { - strt_cpy = hGrid->sbWrap[tile_idx]; - move16(); - FOR( sfb = hGrid->sfbWrap[tile_idx]; sfb < hGrid->sfbWrap[tile_idx + 1]; sfb++ ) - { - FOR( tb = swb_offset[sfb]; tb < swb_offset[sfb + 1]; tb++ ) - { - LFMDCTSpectrum[tb] = pMDCTSpectrum[strt_cpy]; - move32(); - LFPowerSpectrum[tb] = pPowerSpectrum[strt_cpy]; - move32(); - strt_cpy = add( strt_cpy, 1 ); - } - } - } - - IGFCommonFuncsCalcSfbEnergyPowerSpec( hGrid->startSfb, hGrid->stopSfb, hGrid->swb_offset, pPowerSpectrum, &PowerSpectrum_e, sfbEnergyC, sfbEnergyC_exp ); - - IGFCommonFuncsCalcSfbEnergyPowerSpec( hGrid->startSfb, hGrid->stopSfb, hGrid->swb_offset, LFPowerSpectrum, &PowerSpectrum_e, sfbEnergyTileC, sfbEnergyTileC_exp ); - - IGFCommonFuncsMDCTSquareSpec( hGrid->startLine, hGrid->stopLine, LFMDCTSpectrum, MDCTSpectrum_e, LFMDCTSpectrum, &LFMDCTSpectrum_exp, 0, EVS_MONO ); - - IGFCommonFuncsCalcSfbEnergyPowerSpec( hGrid->startSfb, hGrid->stopSfb, hGrid->swb_offset, LFMDCTSpectrum, &LFMDCTSpectrum_exp, sfbEnergyTileR, sfbEnergyTileR_exp ); - } - ELSE - { - IGFCommonFuncsMDCTSquareSpec( hGrid->startLine, hGrid->stopLine, pMDCTSpectrum, MDCTSpectrum_e, LFMDCTSpectrum, &LFMDCTSpectrum_exp, 0, EVS_MONO ); - - IGFCommonFuncsCalcSfbEnergyPowerSpec( hGrid->startSfb, hGrid->stopSfb, hGrid->swb_offset, LFMDCTSpectrum, &LFMDCTSpectrum_exp, sfbEnergyR, sfbEnergyR_exp ); - } - - FOR( tile_idx = 0; tile_idx < hGrid->nTiles; tile_idx++ ) - { - - FOR( sfb = hGrid->sfbWrap[tile_idx]; sfb < hGrid->sfbWrap[tile_idx + 1]; sfb++ ) - { - width = sub( swb_offset[sfb + 1], swb_offset[sfb] ); - L_tmp = 0; - move16(); - gain_exp = 0; - move16(); - - IF( pPowerSpectrum ) - { - IF( sfbEnergyTileR[sfb] == 0 ) - { - sfbEnergyTileR[sfb] = 0x00010000; - move32(); - sfbEnergyTileR_exp[sfb] = 0; - move16(); - zeroNrg = 1; - move16(); - } - IF( sfbEnergyTileC[sfb] == 0 ) - { - sfbEnergyTileC[sfb] = 0x00010000; - move32(); - sfbEnergyTileC_exp[sfb] = 0; - move16(); - zeroNrg = 1; - move16(); - } - IF( sfbEnergyC[sfb] == 0 ) - { - sfbEnergyC[sfb] = 0x00010000; - move32(); - sfbEnergyC_exp[sfb] = 0; - move16(); - zeroNrg = 1; - move16(); - } - - BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyTileR[sfb] ), sfbEnergyTileR_exp[sfb], width, 15, &gain, &gain_exp ); - BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyC[sfb] ), sfbEnergyC_exp[sfb], round_fx_sat( sfbEnergyTileC[sfb] ), sfbEnergyTileC_exp[sfb], &tmp, &tmp_exp ); - L_tmp = L_mult( gain, tmp ); - gain_exp = add( gain_exp, tmp_exp ); - } - ELSE - { - IF( sfbEnergyR[sfb] == 0 ) - { - sfbEnergyR[sfb] = 0x00010000; - move32(); - sfbEnergyR_exp[sfb] = 0; - move16(); - zeroNrg = 1; - move16(); - } - BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyR[sfb] ), sfbEnergyR_exp[sfb], width, 15, &gain, &gain_exp ); - L_tmp = L_deposit_h( gain ); - } - - /* gain = 0.5f + (float)((2.885390081777927f * log(gain) + 16.f)); */ - L_tmp = BASOP_Util_Log2( L_tmp ); - L_tmp = L_add( L_tmp, L_deposit_h( shl( gain_exp, 15 - 6 ) ) ); - shift = norm_l( L_tmp ); - gain = round_fx_sat( L_shl( L_tmp, shift ) ); - gain_exp = sub( 7, shift ); - gain_exp = BASOP_Util_Add_MantExp( gain, gain_exp, 32767 /*16 Q11*/, 4, &gain ); - gain_exp = BASOP_Util_Add_MantExp( gain, gain_exp, 0x4000, 0, &gain ); - gain = shr( gain, s_min( sub( 15, gain_exp ), 15 ) ); - - if ( gain > 91 ) - { - gain = s_min( gain, 91 ); /* 13+15+63, see arithocde encode residual */ - } - if ( gain < 0 ) - { - gain = s_max( gain, 0 ); - } - - /* set gain to zero if the signal contains too less energy */ - if ( zeroNrg != 0 ) - { - gain = 0; - move16(); - } - - hPrivateData->igfScfQuantized[sfb] = gain; - move16(); - } - } - - return; -} -#endif /*-------------------------------------------------------------------* @@ -2011,11 +1829,7 @@ static Word32 IGF_getTNR_ivas_fx( * envelope estimation *-------------------------------------------------------------------*/ -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 static void IGF_CalculateEnvelope_fx( -#else -static void IGF_CalculateEnvelope_ivas_fx( -#endif const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ Word32 *pMDCTSpectrum_fx, /* i : MDCT spectrum */ Word16 e_mdct, /* i : exp of MDCT spectrum */ @@ -2062,25 +1876,21 @@ static void IGF_CalculateEnvelope_ivas_fx( Word16 crest_exp; /*Stores the exponent of the result(return value)*/ Word16 sfm_exp; /*stores exponent for ouput from sfm*/ Word16 tmp_e; -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 Word32 LFMDCTSpectrum[N_MAX]; Word16 sfbEnergyTileR16; Word16 sfbEnergyR16; Word16 gain16; /* the EVS gain which has to be applied to the source tile to get the destination energy */ Word16 zeroNrg; /* flag indicating if the signal contains almost no energy */ -#endif hPrivateData = &hIGFEnc->igfData; hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx]; swb_offset = hGrid->swb_offset; -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 zeroNrg = 0; sfbEnergyTileR16 = 0; temp = 0; move16(); move16(); move16(); -#endif IF( element_mode > EVS_MONO ) { @@ -2114,7 +1924,6 @@ static void IGF_CalculateEnvelope_ivas_fx( } } } -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 ELSE { Copy32( pMDCTSpectrum_fx + IGF_START_MN, hIGFEnc->spec_be_igf, hIGFEnc->infoStopLine - IGF_START_MN ); @@ -2137,13 +1946,8 @@ static void IGF_CalculateEnvelope_ivas_fx( } } } -#endif -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( pPowerSpectrum_fx && ( element_mode > EVS_MONO ) ) -#else - IF( pPowerSpectrum_fx ) -#endif { FOR( sb = hGrid->sbWrap[0]; sb < swb_offset[hGrid->sfbWrap[hGrid->nTiles]]; sb++ ) { @@ -2185,10 +1989,8 @@ static void IGF_CalculateEnvelope_ivas_fx( { tmp = strt_cpy; move16(); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode > EVS_MONO ) { -#endif FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ ) { Word16 shift = norm_l( pPowerSpectrum_fx[sb] ); @@ -2207,7 +2009,6 @@ static void IGF_CalculateEnvelope_ivas_fx( sfbEnergyTileR = L_deposit_h( BASOP_Util_Divide3232_Scale( sfbEnergyTileR, width, &tmp_e ) ); sfbEnergyTileR_e = add( sub( sfbEnergyTileR_e, Q31 ), tmp_e ); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 } ELSE { @@ -2248,7 +2049,6 @@ static void IGF_CalculateEnvelope_ivas_fx( strt_cpy += swb_offset[sfb + 1] - swb_offset[sfb]; } -#endif IF( sfbEnergyTileR == 0 ) { @@ -2259,37 +2059,24 @@ static void IGF_CalculateEnvelope_ivas_fx( } IF( sfbEnergyC == 0 ) { -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 sfbEnergyC = ( element_mode > EVS_MONO ) ? EPSILON_FX : 0x00010000; -#else - sfbEnergyC = EPSILON_FX; -#endif sfbEnergyC_e = 0; move32(); move16(); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode == EVS_MONO ) { zeroNrg = 1; move16(); } -#endif } IF( sfbEnergyTileC == 0 ) { -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 sfbEnergyTileC = ( element_mode > EVS_MONO ) ? EPSILON_FX : 0x00010000; -#else - sfbEnergyTileC = EPSILON_FX; -#endif sfbEnergyTileC_e = 0; -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode > EVS_MONO ) { -#endif temp = BASOP_Util_Divide3232_Scale( sfbEnergyC, sfbEnergyTileC, &tmp_e ); tmp_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) ); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 } ELSE { @@ -2297,40 +2084,31 @@ static void IGF_CalculateEnvelope_ivas_fx( zeroNrg = 1; move16(); } -#endif move32(); move16(); } ELSE { /*gain = (float) ( sfbEnergyTileR * ( sfbEnergyC / sfbEnergyTileC ) );*/ -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode > EVS_MONO ) { -#endif temp = BASOP_Util_Divide3232_Scale( sfbEnergyC, sfbEnergyTileC, &tmp_e ); tmp_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) ); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 } ELSE { BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyC ), sfbEnergyC_e, round_fx_sat( sfbEnergyTileC ), sfbEnergyTileC_e, &tmp, &tmp_e ); } -#endif } -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode > EVS_MONO ) { -#endif gain = Mult_32_16( sfbEnergyTileR, temp ); // gain_e -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 } ELSE { gain = L_mult( sfbEnergyTileR16, tmp ); // gain_e } -#endif gain_e = add( tmp_e, sfbEnergyTileR_e ); IF( element_mode > EVS_MONO ) @@ -2647,10 +2425,8 @@ static void IGF_CalculateEnvelope_ivas_fx( } ELSE { -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode > EVS_MONO ) { -#endif tmp_e = e_mdct; move16(); sfbEnergyR = add_sat( EPSILON_FX, BASOP_Util_Divide3216_Scale( sum2_32_fx( pMDCTSpectrum_fx + swb_offset[sfb], width, &tmp_e ) /*exp: tmp_e*/, width, &sfbEnergyR_e ) ); // sfbEnergyR_e @@ -2680,7 +2456,6 @@ static void IGF_CalculateEnvelope_ivas_fx( move16(); move16(); move16(); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 } ELSE { @@ -2713,21 +2488,14 @@ static void IGF_CalculateEnvelope_ivas_fx( BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyR ), sfbEnergyR_e, width, 15, &sfbEnergyR16, &gain_e ); gain = L_deposit_h( sfbEnergyR16 ); } -#endif } -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IF( element_mode > EVS_MONO ) { -#endif gain = Mult_32_16( gain, att ); // gain_e gain_e = add( gain_e, 0 ); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 /*gain=0.5f+log2f(gain)*2+16 because 2.885390081777927f=2*1/loge(2) so 2*1/loge(2)*loge(x) can be written as 2*log2(x)*/ -#else - /*gain=0.5f+log2f(gain)*2+16 becuase 2.885390081777927f=2*1/loge(2) so 2*1/loge(2)*loge(x) can be written as 2*log2(x)*/ -#endif gain = L_add( ONE_IN_Q22, L_add( L_add( L_shr( BASOP_Util_Log2( gain ), 1 ), L_shl( gain_e, Q24 ) ), L_shl( 16, Q23 ) ) ); /*Q23*/ test(); test(); @@ -2747,7 +2515,6 @@ static void IGF_CalculateEnvelope_ivas_fx( move16(); hPrivateData->igfScfQuantized[sfb] = extract_l( L_shr( gain, Q23 ) ); /*Q0*/ move16(); -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 } ELSE { @@ -2781,7 +2548,6 @@ static void IGF_CalculateEnvelope_ivas_fx( hPrivateData->igfScfQuantized[sfb] = gain16; move16(); } -#endif } } @@ -3553,18 +3319,7 @@ void IGFEncApplyMono_fx( calculate_hangover_attenuation_gain_fx( st, &att_fx, vad_hover_flag ); } -#ifdef FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 IGF_CalculateEnvelope_fx( st->hIGFEnc, pMDCTSpectrum_fx, e_mdct, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, st->element_mode, att_fx ); -#else - IF( EQ_16( st->element_mode, EVS_MONO ) ) - { - IGF_CalculateEnvelope( st->hIGFEnc, pMDCTSpectrum_fx, e_mdct, pPowerSpectrumParameter_fx, *e_ps, igfGridIdx ); - } - ELSE - { - IGF_CalculateEnvelope_ivas_fx( st->hIGFEnc, pMDCTSpectrum_fx, e_mdct, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, st->element_mode, att_fx ); - } -#endif IF( isTCX20 ) { -- GitLab From efb90fa1849311546724e79a8d001e4dfeb25859 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:13 +0200 Subject: [PATCH 09/49] Accept FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC --- lib_com/options.h | 1 - lib_com/swb_bwe_com_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8f56700af..5870bed4d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC /* Eri: BASOP issue 2563: Crash in hq_generic decoding. EVS code --> solve with _sat operator */ #define FIX_2095_REMOVE_UNUSED_ISAR_TABLES /* Dolby: remove unused ISAR */ #define FIX_BASOP_2560_STEREO_DFT_DEC_RESET /* FhG: BASOP issue 2560: align reset of hStereoDft->res_gains_ind_fx[][] between BASOP and float */ #define HARMONIZE_2539_cng_energy /* FhG: basop issue 2539: harmonize cng_energy with its ivas derivate */ diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 434dd6a80..67727f073 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -2748,11 +2748,7 @@ void hq_generic_decoding_fx( tmp1_fx = extract_h( L_shl( L_tmp1, exp1 ) ); tmp2_fx = extract_h( L_shl( L_tmp2, exp2 ) ); tmp3_fx = div_s( tmp2_fx, tmp1_fx ); /*15 + exp2 + 15 - (exp1 + 15) */ -#ifdef FIX_BASOP_2563_CRASH_HQ_GENERIC_DEC tmp3_fx = shr_sat( tmp3_fx, add( 5, sub( exp2, exp1 ) ) ); /*10 */ -#else - tmp3_fx = shr( tmp3_fx, add( 5, sub( exp2, exp1 ) ) ); /*10 */ -#endif if ( LT_16( tmp3_fx, 307 /*0.3 in Q10 */ ) ) { -- GitLab From cd7b676e278700662c65365785e356f4215f45b5 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:15 +0200 Subject: [PATCH 10/49] Accept FIX_2095_REMOVE_UNUSED_ISAR_TABLES --- lib_com/options.h | 1 - lib_dec/ivas_rom_dec.h | 3 - lib_dec/ivas_rom_dec_fx.c | 84 -- lib_isar/isar_rom_lcld_tables.c | 1448 +++---------------------------- lib_isar/isar_rom_lcld_tables.h | 11 - 5 files changed, 133 insertions(+), 1414 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5870bed4d..6f8ca9946 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_2095_REMOVE_UNUSED_ISAR_TABLES /* Dolby: remove unused ISAR */ #define FIX_BASOP_2560_STEREO_DFT_DEC_RESET /* FhG: BASOP issue 2560: align reset of hStereoDft->res_gains_ind_fx[][] between BASOP and float */ #define HARMONIZE_2539_cng_energy /* FhG: basop issue 2539: harmonize cng_energy with its ivas derivate */ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA,FhG: float issues 1585,1593: alternative fix memory leaks with format switching */ diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index f79e95cef..a48c94435 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -96,8 +96,5 @@ extern const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS]; extern const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df0; extern const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -extern const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_dt; -#endif #endif /* IVAS_ROM_DEC_H */ diff --git a/lib_dec/ivas_rom_dec_fx.c b/lib_dec/ivas_rom_dec_fx.c index 0f1b4108a..0f7904ca0 100644 --- a/lib_dec/ivas_rom_dec_fx.c +++ b/lib_dec/ivas_rom_dec_fx.c @@ -476,76 +476,6 @@ static const Word16 huff_nodes_alpha_1D_DF[64][2] = { -2, -62 } }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -/* Alpha Fine Huffman table dt */ -static const Word16 huff_nodes_alpha_1D_DT[64][2] = -{ - { -33, 1 }, - { -34, 2 }, - { -32, 3 }, - { 5, 4 }, - { -31, -35 }, - { 7, 6 }, - { -36, 8 }, - { -30, 9 }, - { 11, 10 }, - { -29, -37 }, - { 13, 12 }, - { 15, 14 }, - { -28, -38 }, - { 17, 16 }, - { -27, -39 }, - { 19, 18 }, - { -40, 20 }, - { -26, 21 }, - { 23, 22 }, - { -25, -41 }, - { 25, 24 }, - { -24, -42 }, - { 27, 26 }, - { -23, -43 }, - { 29, 28 }, - { -22, -44 }, - { 31, 30 }, - { -45, 32 }, - { -21, 33 }, - { -20, 34 }, - { -46, 35 }, - { -47, 36 }, - { -19, 37 }, - { -48, 38 }, - { -18, 39 }, - { 41, 40 }, - { -17, -49 }, - { 43, 42 }, - { -50, 44 }, - { -16, 45 }, - { 47, 46 }, - { -51, 48 }, - { -15, 49 }, - { 51, 50 }, - { -52, -65 }, - { -1, -14 }, - { 53, 52 }, - { -53, 54 }, - { -13, 55 }, - { 57, 56 }, - { -12, 58 }, - { -54, 59 }, - { 61, 60 }, - { -11, -55 }, - { -56, 62 }, - { -10, 63 }, - { -9, -57 }, - { -5, -6 }, - { -58, -61 }, - { -7, -59 }, - { -8, -62 }, - { -4, -60 }, - { -3, -64 }, - { -2, -63 } -}; -#endif /* Beta Fine Huffman table df0 */ static const Word16 huff_nodes_first_band_beta[8][2] = @@ -559,13 +489,6 @@ static const Word16 huff_nodes_beta_1D_DF[16][2] = { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { 9, 8 }, { -5, -13 }, { 11, 10 }, { -4, -14 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -/* Beta Fine Huffman table dt */ -static const Word16 huff_nodes_beta_1D_DT[16][2] = -{ - { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { -13, 8 }, { -5, 9 }, { -14, 10 }, { -4, 11 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } -}; -#endif const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df0 = { @@ -579,12 +502,5 @@ const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_df = huff_nodes_beta_1D_DF }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const HUFF_NODE_TABLE ivas_mc_paramupmix_huff_nodes_dt = -{ - huff_nodes_alpha_1D_DT, - huff_nodes_beta_1D_DT -}; -#endif /* clang-format on */ diff --git a/lib_isar/isar_rom_lcld_tables.c b/lib_isar/isar_rom_lcld_tables.c index 287d3f70c..78dcd9077 100644 --- a/lib_isar/isar_rom_lcld_tables.c +++ b/lib_isar/isar_rom_lcld_tables.c @@ -294,42 +294,6 @@ const Word32 c_aiQuantMaxValues_fx[ALLOC_TABLE_SIZE] = { 377487360, }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_aiQuantMaxValues[ALLOC_TABLE_SIZE] = { - 0, - 3, - 3, - 4, - 5, - 5, - 6, - 7, - 8, - 9, - 12, - 13, - 16, - 17, - 19, - 23, - 26, - 26, - 27, - 28, - 31, - 36, - 38, - 45, - 54, - 64, - 76, - 90, - 108, - 128, - 152, - 180, -}; -#endif const Word32 c_aiHuffmanDim_fx[ALLOC_TABLE_SIZE] = { 2, @@ -471,42 +435,6 @@ const Word32 c_aiHuffmanMod[ALLOC_TABLE_SIZE] = { 1, }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_aiHuffmanSize[ALLOC_TABLE_SIZE] = { - 1, - 16, - 16, - 25, - 36, - 36, - 49, - 64, - 81, - 100, - 169, - 196, - 289, - 324, - 400, - 576, - 729, - 729, - 28, - 29, - 32, - 37, - 39, - 46, - 55, - 65, - 77, - 91, - 109, - 129, - 153, - 181, -}; -#endif const UWord32 c_aaiRMSEnvHuffEnc[64][2] = { { 0x0014, 0x0000 }, @@ -19213,1246 +19141,142 @@ const Word16 c_aiLogAddTable_fx[LOG_ADD_TABLE_LENGTH] = { 0x00, }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_aiLogAddTable[LOG_ADD_TABLE_LENGTH] = { - 0x40, - 0x40, - 0x3F, - 0x3F, - 0x3E, - 0x3E, - 0x3D, - 0x3D, - 0x3C, - 0x3C, - 0x3B, - 0x3B, - 0x3A, - 0x3A, - 0x39, - 0x39, - 0x38, - 0x38, - 0x37, - 0x37, - 0x37, - 0x36, - 0x36, - 0x35, - 0x35, - 0x34, - 0x34, - 0x33, - 0x33, - 0x33, - 0x32, - 0x32, - 0x31, - 0x31, - 0x31, - 0x30, - 0x30, - 0x2F, - 0x2F, - 0x2F, - 0x2E, - 0x2E, - 0x2D, - 0x2D, - 0x2D, - 0x2C, - 0x2C, - 0x2B, - 0x2B, - 0x2B, - 0x2A, - 0x2A, - 0x2A, - 0x29, - 0x29, - 0x29, - 0x28, - 0x28, - 0x27, - 0x27, - 0x27, - 0x26, - 0x26, - 0x26, - 0x25, - 0x25, - 0x25, - 0x24, - 0x24, - 0x24, - 0x23, - 0x23, - 0x23, - 0x23, - 0x22, - 0x22, - 0x22, - 0x21, - 0x21, - 0x21, - 0x20, - 0x20, - 0x20, - 0x20, - 0x1F, - 0x1F, - 0x1F, - 0x1E, - 0x1E, - 0x1E, - 0x1E, - 0x1D, - 0x1D, - 0x1D, - 0x1C, - 0x1C, - 0x1C, - 0x1C, - 0x1B, - 0x1B, - 0x1B, - 0x1B, - 0x1A, - 0x1A, - 0x1A, - 0x1A, - 0x19, - 0x19, - 0x19, - 0x19, - 0x18, - 0x18, - 0x18, - 0x18, - 0x18, - 0x17, - 0x17, - 0x17, - 0x17, - 0x16, - 0x16, - 0x16, - 0x16, - 0x16, - 0x15, - 0x15, - 0x15, - 0x15, - 0x15, - 0x14, - 0x14, - 0x14, - 0x14, - 0x14, - 0x13, - 0x13, - 0x13, - 0x13, - 0x13, - 0x13, - 0x12, - 0x12, - 0x12, - 0x12, - 0x12, - 0x11, - 0x11, - 0x11, - 0x11, - 0x11, - 0x11, - 0x10, - 0x10, - 0x10, - 0x10, - 0x10, - 0x10, - 0x0F, - 0x0F, - 0x0F, - 0x0F, - 0x0F, - 0x0F, - 0x0F, - 0x0E, - 0x0E, - 0x0E, - 0x0E, - 0x0E, - 0x0E, - 0x0E, - 0x0D, - 0x0D, - 0x0D, - 0x0D, - 0x0D, - 0x0D, - 0x0D, - 0x0D, - 0x0C, - 0x0C, - 0x0C, - 0x0C, - 0x0C, - 0x0C, - 0x0C, - 0x0C, - 0x0B, - 0x0B, - 0x0B, - 0x0B, - 0x0B, - 0x0B, - 0x0B, - 0x0B, - 0x0B, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x0A, - 0x09, - 0x09, - 0x09, - 0x09, - 0x09, - 0x09, - 0x09, - 0x09, - 0x09, - 0x09, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x08, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x07, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x06, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x05, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x04, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x03, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x02, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; -#endif - -const Word16 c_aiBandwidthAdjust48_fx[MAX_BANDS_48] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 64, - 64, - 64, - 64, - 64, - 101, - 101, - 128, - 165, - 165, - 180, - 213, -}; - -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_aiBandwidthAdjust48[MAX_BANDS_48] = { - - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 64, - 64, - 64, - 64, - 64, - 101, - 101, - 128, - 165, - 165, - 180, - 213, -}; -#endif - -const Word16 c_aiAbsoluteThresh48_fx[MAX_BANDS_48] = { - -1787, - -1787, - -1787, - -1787, - -1787, - -1787, - -1787, - -1787, - -1782, - -1761, - -1737, - -1679, - -1638, - -1613, - -1590, - -1568, - -1516, - -1459, - -1395, - -1289, - -671, - -409, - -401, -}; - -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_aiAbsoluteThresh48[MAX_BANDS_48] = { - -1787, - -1787, - -1787, - -1787, - -1787, - -1787, - -1787, - -1787, - -1782, - -1761, - -1737, - -1679, - -1638, - -1613, - -1590, - -1568, - -1516, - -1459, - -1395, - -1289, - -671, - -409, - -401, -}; -#endif - -#if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4 -const Word32 c_aiDefaultTheta48[MAX_BANDS_48] = { - 7, - 7, - 6, - 5, - 5, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, -}; -#elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8 -const Word16 c_aiDefaultTheta48_fx[MAX_BANDS_48] = { - - 112, - 112, - 96, - 80, - 80, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, -}; -#endif -const Word32 c_aiDefaultTheta48[MAX_BANDS_48] = { - - 112, - 112, - 96, - 80, - 80, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, -}; -const Word16 c_aaiSpreadFunction48_fx[MAX_BANDS_48 * MAX_BANDS_48] = { - 0, - -1561, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -289, - -4, - -1234, - -2295, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -569, - -229, - -8, - -905, - -1705, - -2324, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -789, - -445, - -173, - -16, - -656, - -1271, - -1765, - -2172, - -2520, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -961, - -616, - -340, - -136, - -28, - -488, - -976, - -1382, - -1729, - -2032, - -2305, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -1088, - -743, - -465, - -257, - -148, - -31, - -371, - -769, - -1114, - -1417, - -1689, - -2054, - -2483, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -1198, - -852, - -574, - -364, - -209, - -148, - -42, - -300, - -635, - -936, - -1207, - -1572, - -2000, - -2376, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -1293, - -948, - -669, - -458, - -301, - -183, - -145, - -56, - -258, - -547, - -816, - -1179, - -1606, - -1982, - -2311, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -1375, - -1029, - -750, - -539, - -381, - -260, - -180, - -142, - -68, - -231, - -487, - -846, - -1272, - -1647, - -1976, - -2261, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -1444, - -1099, - -820, - -608, - -449, - -328, - -233, - -194, - -138, - -77, - -213, - -555, - -978, - -1352, - -1681, - -1966, - -2268, - -2552, - -2552, - -2552, - -2552, - -2552, - -2552, - -1501, - -1155, - -876, - -665, - -505, - -383, - -287, - -210, - -193, - -130, - -79, - -298, - -711, - -1083, - -1411, - -1696, - -1997, - -2288, - -2550, - -2552, - -2552, - -2552, - -2552, - -1567, - -1221, - -942, - -730, - -570, - -448, - -351, - -272, - -206, - -189, - -151, - -72, - -349, - -713, - -1039, - -1324, - -1625, - -1915, - -2177, - -2448, - -2552, - -2552, - -2552, - -1650, - -1304, - -1025, - -813, - -653, - -530, - -432, - -352, - -285, - -227, - -177, - -163, - -69, - -297, - -613, - -895, - -1195, - -1485, - -1746, - -2017, - -2238, - -2401, - -2545, - -1727, - -1381, - -1102, - -890, - -730, - -607, - -509, - -428, - -360, - -301, - -249, - -180, - -153, - -72, - -257, - -527, - -824, - -1112, - -1373, - -1643, - -1865, - -2028, - -2171, - -1798, - -1452, - -1173, - -960, - -800, - -677, - -579, - -498, - -430, - -370, - -317, - -246, - -192, - -145, - -76, - -224, - -505, - -790, - -1050, - -1320, - -1540, - -1703, - -1847, - -1860, - -1514, - -1234, - -1022, - -862, - -738, - -640, - -559, - -490, - -430, - -377, - -306, - -224, - -197, - -136, - -81, - -242, - -515, - -771, - -1040, - -1260, - -1422, - -1566, - -1923, - -1577, - -1297, - -1085, - -925, - -801, - -703, - -621, - -553, - -492, - -439, - -367, - -284, - -213, - -198, - -144, - -83, - -235, - -479, - -744, - -963, - -1125, - -1268, - -1986, - -1640, - -1360, - -1148, - -988, - -864, - -766, - -684, - -615, - -555, - -501, - -429, - -345, - -273, - -211, - -204, - -146, - -89, - -216, - -465, - -680, - -841, - -984, - -2043, - -1697, - -1417, - -1205, - -1044, - -921, - -822, - -741, - -672, - -611, - -557, - -485, + +const Word16 c_aiBandwidthAdjust48_fx[MAX_BANDS_48] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 64, + 64, + 64, + 64, + 64, + 101, + 101, + 128, + 165, + 165, + 180, + 213, +}; + + +const Word16 c_aiAbsoluteThresh48_fx[MAX_BANDS_48] = { + -1787, + -1787, + -1787, + -1787, + -1787, + -1787, + -1787, + -1787, + -1782, + -1761, + -1737, + -1679, + -1638, + -1613, + -1590, + -1568, + -1516, + -1459, + -1395, + -1289, + -671, + -409, -401, - -328, - -264, - -211, - -205, - -140, - -93, - -227, - -430, - -588, - -729, - -2104, - -1758, - -1479, - -1266, - -1106, - -982, - -884, - -802, - -733, - -673, - -619, - -546, - -461, - -388, - -324, - -269, - -212, - -211, - -151, - -100, - -195, - -336, - -472, - -2163, - -1817, - -1537, - -1324, - -1164, - -1040, - -942, - -860, - -791, - -731, - -676, - -604, - -519, - -445, - -380, - -325, - -268, - -226, - -219, - -147, - -114, - -167, - -280, - -2203, - -1857, - -1577, - -1365, - -1205, - -1081, - -982, - -901, - -831, - -771, - -717, - -644, - -559, - -485, - -420, - -364, - -306, - -252, - -239, - -206, - -132, - -122, - -163, - -2224, - -1878, - -1598, - -1386, - -1225, - -1102, - -1003, - -921, - -852, - -792, - -737, - -665, - -580, - -505, - -441, - -385, - -326, - -271, - -222, - -224, - -176, - -121, - -114, }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48] = { + +#if PERCEPTUAL_MODEL_SLGAIN_SHIFT == 4 +const Word32 c_aiDefaultTheta48[MAX_BANDS_48] = { + 7, + 7, + 6, + 5, + 5, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, +}; +#elif PERCEPTUAL_MODEL_SLGAIN_SHIFT == 8 +const Word16 c_aiDefaultTheta48_fx[MAX_BANDS_48] = { + + 112, + 112, + 96, + 80, + 80, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, +}; +#endif +const Word32 c_aiDefaultTheta48[MAX_BANDS_48] = { + + 112, + 112, + 96, + 80, + 80, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, + 64, +}; +const Word16 c_aaiSpreadFunction48_fx[MAX_BANDS_48 * MAX_BANDS_48] = { 0, -1561, -2552, @@ -20984,7 +19808,6 @@ const Word32 c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48] = { -114, }; -#endif const Word32 c_pfMagLUT[8] = /* Q31 */ { 0, 394599072, 775760576, 1130504448, 1446750336, 1713728896, 1922348544, 2065504896 @@ -21008,8 +19831,3 @@ const Word32 c_pfP2RImagLUT[32] = /* Q31 */ { 821806080, 418953248 }; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -const Word32 c_pfWindowLUT[LCLD_PRED_WIN_LEN] = /* Q31 */ { - 190779840, 338280192, 610825408, 966922816, 1352359680, 1708457216, 1981002240, 2128502656, 2128502528, 1981002240, 1708456960, 1352359808, 966922624, 610825152, 338280192, 190779776 -}; -#endif diff --git a/lib_isar/isar_rom_lcld_tables.h b/lib_isar/isar_rom_lcld_tables.h index 278ca2d74..ca8cebdfe 100644 --- a/lib_isar/isar_rom_lcld_tables.h +++ b/lib_isar/isar_rom_lcld_tables.h @@ -130,14 +130,6 @@ extern const Word16 c_aiDefaultTheta48_fx[MAX_BANDS_48]; extern const Word16 c_aaiSpreadFunction48_fx[MAX_BANDS_48 * MAX_BANDS_48]; extern const Word32 c_aiDefaultTheta48[MAX_BANDS_48]; -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -extern const Word32 c_aiQuantMaxValues[ALLOC_TABLE_SIZE]; -extern const Word32 c_aiLogAddTable[LOG_ADD_TABLE_LENGTH]; -extern const Word32 c_aiHuffmanSize[ALLOC_TABLE_SIZE]; -extern const Word32 c_aiBandwidthAdjust48[MAX_BANDS_48]; -extern const Word32 c_aiAbsoluteThresh48[MAX_BANDS_48]; -extern const Word32 c_aaiSpreadFunction48[MAX_BANDS_48 * MAX_BANDS_48]; -#endif #define PRED_QUNAT_FILTER_MAG_BITS ( 3 ) #define PRED_QUANT_FILTER_PHASE_BITS ( 5 ) @@ -238,8 +230,5 @@ extern const UWord32 c_aaiRMSEnvHuffDec[13][HUFF_DEC_TABLE_SIZE]; extern const Word32 c_pfMagLUT[8]; /* Q31 */ extern const Word32 c_pfP2RRealLUT[32]; /* Q31 */ extern const Word32 c_pfP2RImagLUT[32]; /* Q31 */ -#ifndef FIX_2095_REMOVE_UNUSED_ISAR_TABLES -extern const Word32 c_pfWindowLUT[LCLD_PRED_WIN_LEN]; /* Q31 */ -#endif #endif /* ISAR_ROM_LCLD_TABLES_H_ */ -- GitLab From 5c5db5397f30d20a96dce4fe2c523782aa91f613 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:17 +0200 Subject: [PATCH 11/49] Accept FIX_BASOP_2560_STEREO_DFT_DEC_RESET --- lib_com/options.h | 1 - lib_dec/ivas_stereo_dft_dec_fx.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6f8ca9946..21311db4b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2560_STEREO_DFT_DEC_RESET /* FhG: BASOP issue 2560: align reset of hStereoDft->res_gains_ind_fx[][] between BASOP and float */ #define HARMONIZE_2539_cng_energy /* FhG: basop issue 2539: harmonize cng_energy with its ivas derivate */ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA,FhG: float issues 1585,1593: alternative fix memory leaks with format switching */ #define FIX_BASOP_2573_RF_MODE_UPDATE /* FhG: BASOP issue 2573: remove duplicated update of rf_mode parameters from evs_enc_fx(); was already done in updt_enc_common_fx() */ diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 60bab87f0..59307c38d 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -115,21 +115,13 @@ void stereo_dft_dec_reset_fx( set16_fx( hStereoDft->res_pred_index_previous, 0, STEREO_DFT_BAND_MAX ); -#ifdef FIX_BASOP_2560_STEREO_DFT_DEC_RESET FOR( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) -#else - FOR( i = 0; i < STEREO_DFT_BAND_MAX * 2; i++ ) -#endif { hStereoDft->res_gains_ind_fx[0][i] = 1006632960; /* 15.0f in Q26 */ move32(); } -#ifdef FIX_BASOP_2560_STEREO_DFT_DEC_RESET set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX ); -#else - set32_fx( hStereoDft->res_gains_ind_fx[1], 0, STEREO_DFT_BAND_MAX * 2 ); -#endif /*residual coding*/ set16_fx( hStereoDft->res_cod_mode, hStereoDft->hConfig->res_cod_mode, STEREO_DFT_DEC_DFT_NB ); -- GitLab From 1b79fe9923a4f9872746e3b49487dcf438bda2cf Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:19 +0200 Subject: [PATCH 12/49] Accept HARMONIZE_2539_cng_energy --- lib_com/options.h | 1 - lib_enc/acelp_core_enc_fx.c | 4 -- lib_enc/fd_cng_enc_fx.c | 127 ------------------------------------ lib_enc/prot_fx_enc.h | 11 ---- 4 files changed, 143 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 21311db4b..bb36753d1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2539_cng_energy /* FhG: basop issue 2539: harmonize cng_energy with its ivas derivate */ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA,FhG: float issues 1585,1593: alternative fix memory leaks with format switching */ #define FIX_BASOP_2573_RF_MODE_UPDATE /* FhG: BASOP issue 2573: remove duplicated update of rf_mode parameters from evs_enc_fx(); was already done in updt_enc_common_fx() */ #define FIX_2570_BUF_OVFL /* Orange: basop issue 2570: global-buffer-overflow in lib_rend/ivas_objectRenderer_sources_fx.c */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 5f38e5bd3..6c3353867 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -437,11 +437,7 @@ ivas_error acelp_core_enc_fx( { IF( st->hTdCngEnc != NULL ) { -#ifdef HARMONIZE_2539_cng_energy enr = cng_energy_fx( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att_fx, exc_fx, st->L_frame, Q_new ); /* Q8 */ -#else - enr = cng_energy_ivas_fx( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att_fx, exc_fx, st->L_frame, Q_new ); /* Q8 */ -#endif /* calculate the energy quantization index */ enr_index = add( enr, 512 /* Q8(2.0) */ ); /* enr + 2.0 */ diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 0c0b95ab9..d954a658a 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1163,103 +1163,6 @@ void generate_comfort_noise_enc_fx( return; } -#ifndef HARMONIZE_2539_cng_energy -/*-------------------------------------------------------------------* - * cng_energy_fx() - * - * - *-------------------------------------------------------------------*/ - -/*! r: CNG energy */ -Word16 cng_energy_fx( - const Word16 element_mode, /* i : element mode Q0*/ - const Word16 bwidth, /* i : audio bandwidh Q0*/ - const Word16 CNG_mode, /* i : mode for DTX configuration Q0*/ - const Word16 CNG_att, /* i : attenuation factor for CNG Q7*/ - const Word16 *exc, /* i : input signal Q_new*/ - const Word16 len, /* i : vector length Q0*/ - const Word16 Q_new /* i : Input scaling */ -) -{ - Word16 i, maxv, scale; - Word16 hi, lo, enr, tmp16, att; - const Word16 *pt_res; - Word32 L_ener, L_tmp; - - maxv = 0; - move16(); - FOR( i = 0; i < len; i++ ) - { - maxv = s_max( maxv, abs_s( exc[i] ) ); - } - scale = norm_s( maxv ); - pt_res = exc; - L_ener = L_deposit_l( 1 ); - IF( EQ_16( len, L_FRAME ) ) - { - FOR( i = 0; i < 128; i++ ) - { - tmp16 = shl( *pt_res, scale ); - L_tmp = L_mult0( tmp16, tmp16 ); - pt_res++; - tmp16 = shl( *pt_res, scale ); - L_tmp = L_mac0_sat( L_tmp, tmp16, tmp16 ); /* 2*(Q_new+scale) */ - pt_res++; - L_ener = L_add( L_ener, L_shr( L_tmp, 7 ) ); /* 2*(Q_new+scale)+1, divide by L_frame done here */ - } - } - ELSE /* L_FRAME16k */ - { - FOR( i = 0; i < 160; i++ ) - { - tmp16 = shl( *pt_res, scale ); - L_tmp = L_mult0( tmp16, tmp16 ); - pt_res++; - tmp16 = shl( *pt_res, scale ); - L_tmp = L_mac0_sat( L_tmp, tmp16, tmp16 ); /* 2*(Q_new+scale) */ - pt_res++; - L_ener = L_add( L_ener, L_shr( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* 2*(Q_new+scale)+15+1-16+1, divide by L_frame done here */ - } - } - - hi = norm_l( L_ener ); - lo = Log2_norm_lc( L_shl( L_ener, hi ) ); - hi = sub( 30, add( hi, shl( add( Q_new, scale ), 1 ) ) ); /* log2 exp in Q2*(Q_new+scale) */ - L_tmp = L_Comp( hi, lo ); /* Q16 */ - enr = round_fx( L_shl( L_tmp, 8 ) ); /* Q8 (16+8-16) */ - - /* decrease the energy in case of WB input */ - test(); - IF( EQ_16( element_mode, IVAS_CPE_DFT ) || EQ_16( element_mode, IVAS_CPE_TD ) ) - { - (void) CNG_att; - } - ELSE IF( NE_16( bwidth, NB ) ) - { - IF( EQ_16( bwidth, WB ) ) - { - IF( CNG_mode >= 0 ) - { - /* Bitrate adapted attenuation */ - att = ENR_ATT_fx[CNG_mode]; - } - ELSE - { - /* Use least attenuation for higher bitrates */ - att = ENR_ATT_fx[4]; - } - } - ELSE - { - att = 384; - move16(); /*Q8*/ - } - enr = sub( enr, att ); - } - - return enr; -} -#endif /*-------------------------------------------------------------------* * cng_energy_ivas_fx() @@ -1268,11 +1171,7 @@ Word16 cng_energy_fx( *-------------------------------------------------------------------*/ /*! r: CNG energy */ -#ifdef HARMONIZE_2539_cng_energy Word16 cng_energy_fx( -#else -Word16 cng_energy_ivas_fx( -#endif const Word16 element_mode, /* i : element mode Q0*/ const Word16 bwidth, /* i : audio bandwidh Q0*/ const Word16 CNG_mode, /* i : mode for DTX configuration Q0*/ @@ -1286,13 +1185,11 @@ Word16 cng_energy_ivas_fx( Word16 hi, lo, enr, tmp16, att; const Word16 *pt_res; Word32 L_ener, L_tmp; -#ifdef HARMONIZE_2539_cng_energy Word64 W_ener = W_shr( W_deposit32_h( 1 ), 1 ); if ( EQ_16( element_mode, EVS_MONO ) ) { W_ener = W_neg( W_ener ); } -#endif maxv = 0; move16(); @@ -1304,7 +1201,6 @@ Word16 cng_energy_ivas_fx( pt_res = exc; L_ener = L_deposit_l( 1 ); -#ifdef HARMONIZE_2539_cng_energy Word16 scale_tmp; Word32 scale_tmp32; @@ -1317,13 +1213,11 @@ Word16 cng_energy_ivas_fx( move16(); scale_tmp32 = L_shr( 0x40000000, 7 - 1 ); } -#endif IF( EQ_16( len, L_FRAME ) ) { FOR( i = 0; i < 128; i++ ) { -#ifdef HARMONIZE_2539_cng_energy tmp16 = shl( *pt_res, scale_tmp ); L_tmp = L_mult0( tmp16, tmp16 ); pt_res++; @@ -1331,22 +1225,12 @@ Word16 cng_energy_ivas_fx( L_tmp = L_mac0_sat( L_tmp, tmp16, tmp16 ); pt_res++; W_ener = W_msu0_32_32( W_ener, L_tmp, scale_tmp32 ); /* 2*(Q_new+scale)+1, divide by L_frame done here */ -#else - tmp16 = shl( *pt_res, sub( scale, 4 ) ); // Q_new + scale - 4 - L_tmp = L_mult0( tmp16, tmp16 ); - pt_res++; - tmp16 = shl( *pt_res, sub( scale, 4 ) ); // Q_new + scale - 4 - L_tmp = L_mac0( L_tmp, tmp16, tmp16 ); /* 2*(Q_new+scale) + 7 */ - pt_res++; - L_ener = L_add( L_ener, L_tmp ); /* 2*(Q_new+scale)+1, divide by L_frame done here */ -#endif } } ELSE /* L_FRAME16k */ { FOR( i = 0; i < 160; i++ ) { -#ifdef HARMONIZE_2539_cng_energy tmp16 = shl( *pt_res, scale_tmp ); L_tmp = L_mult0( tmp16, tmp16 ); pt_res++; @@ -1354,18 +1238,8 @@ Word16 cng_energy_ivas_fx( L_tmp = L_mac0_sat( L_tmp, tmp16, tmp16 ); pt_res++; W_ener = W_msu0_32_32( W_ener, Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), scale_tmp32 ); /* 2*(Q_new+scale)+15+1-16+1, divide by L_frame done here */ -#else - tmp16 = shl( *pt_res, sub( scale, 4 ) ); // Q_new + scale - 4 - L_tmp = L_mult( tmp16, tmp16 ); - pt_res++; - tmp16 = shl( *pt_res, sub( scale, 4 ) ); // Q_new + scale - 4 - L_tmp = L_mac( L_tmp, tmp16, tmp16 ); /* 2*(Q_new+scale) - 7 */ - pt_res++; - L_ener = L_add( L_ener, Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ) ); /* 2*(Q_new+scale)+15+1-16+1, divide by L_frame done here */ -#endif } } -#ifdef HARMONIZE_2539_cng_energy L_ener = L_shl( W_extract_h( W_ener ), 1 ); if ( EQ_16( element_mode, EVS_MONO ) ) { @@ -1376,7 +1250,6 @@ Word16 cng_energy_ivas_fx( { L_ener = L_shl( L_ener, 1 ); } -#endif hi = norm_l( L_ener ); lo = Log2_norm_lc( L_shl( L_ener, hi ) ); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 1e2bb4e36..3f34628c5 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -3794,17 +3794,6 @@ void writeLPCparam_fx( const Word16 no_param_lpc, /* i : number of LPC parameters */ Word16 *nbits_lpc /* o : LPC bits written */ ); -#ifndef HARMONIZE_2539_cng_energy -Word16 cng_energy_ivas_fx( - const Word16 element_mode, /* i : element mode */ - const Word16 bwidth, /* i : audio bandwidh */ - const Word16 CNG_mode, /* i : mode for DTX configuration */ - const Word16 CNG_att, /* i : attenuation factor for CNG Q7 */ - const Word16 *exc, /* i : input signal */ - const Word16 len, /* i : vector length */ - const Word16 Q_new /* i : Input scaling */ -); -#endif void SynthesisSTFT_enc_ivas_fx( Word32 *fftBuffer, /* i : pointer to FFT bins */ -- GitLab From 88de59117e454800b6b21084e2de2ea5132ffdee Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:22 +0200 Subject: [PATCH 13/49] Accept FIX_1585_ASAN_FORMAT_SW_ALT --- lib_com/options.h | 1 - lib_dec/ivas_corecoder_dec_reconfig_fx.c | 61 ------------------------ lib_dec/ivas_init_dec_fx.c | 31 ------------ lib_dec/ivas_stat_dec.h | 4 -- 4 files changed, 97 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bb36753d1..869e2c588 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_1585_ASAN_FORMAT_SW_ALT /* VA,FhG: float issues 1585,1593: alternative fix memory leaks with format switching */ #define FIX_BASOP_2573_RF_MODE_UPDATE /* FhG: BASOP issue 2573: remove duplicated update of rf_mode parameters from evs_enc_fx(); was already done in updt_enc_common_fx() */ #define FIX_2570_BUF_OVFL /* Orange: basop issue 2570: global-buffer-overflow in lib_rend/ivas_objectRenderer_sources_fx.c */ #define FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT /* Dolby: float issue 1550: Wrong render framesize printout */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 670f559d2..15bc729b5 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -477,9 +477,6 @@ ivas_error ivas_hp20_dec_reconfig_fx( ) { Word16 i, nchan_hp20; -#ifndef FIX_1585_ASAN_FORMAT_SW_ALT - Word32 **old_mem_hp20_out_fx; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -493,7 +490,6 @@ ivas_error ivas_hp20_dec_reconfig_fx( IF( GT_16( nchan_hp20, nchan_hp20_old ) ) { -#ifdef FIX_1585_ASAN_FORMAT_SW_ALT /* create additional hp20 memories */ FOR( i = nchan_hp20_old; i < nchan_hp20; i++ ) { @@ -504,72 +500,15 @@ ivas_error ivas_hp20_dec_reconfig_fx( set32_fx( st_ivas->mem_hp20_out_fx[i], 0, L_HP20_MEM + 2 ); } -#else - /* save old mem_hp_20 pointer */ - old_mem_hp20_out_fx = st_ivas->mem_hp20_out_fx; - st_ivas->mem_hp20_out_fx = NULL; - - IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( nchan_hp20 * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - FOR( i = 0; i < nchan_hp20_old; i++ ) - { - st_ivas->mem_hp20_out_fx[i] = old_mem_hp20_out_fx[i]; - move32(); - old_mem_hp20_out_fx[i] = NULL; - } - /* create additional hp20 memories */ - FOR( ; i < nchan_hp20; i++ ) - { - IF( ( st_ivas->mem_hp20_out_fx[i] = (Word32 *) malloc( ( L_HP20_MEM + 2 ) * sizeof( Word32 ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set32_fx( st_ivas->mem_hp20_out_fx[i], 0, L_HP20_MEM + 2 ); - } - - free( old_mem_hp20_out_fx ); - old_mem_hp20_out_fx = NULL; -#endif } ELSE IF( LT_16( nchan_hp20, nchan_hp20_old ) ) { -#ifdef FIX_1585_ASAN_FORMAT_SW_ALT /* remove superfluous hp20 memories */ FOR( i = nchan_hp20; i < nchan_hp20_old; i++ ) { free( st_ivas->mem_hp20_out_fx[i] ); st_ivas->mem_hp20_out_fx[i] = NULL; } -#else - /* save old mem_hp_20 pointer */ - old_mem_hp20_out_fx = st_ivas->mem_hp20_out_fx; - st_ivas->mem_hp20_out_fx = NULL; - - IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( nchan_hp20 * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - FOR( i = 0; i < nchan_hp20; i++ ) - { - st_ivas->mem_hp20_out_fx[i] = old_mem_hp20_out_fx[i]; - move32(); - old_mem_hp20_out_fx[i] = NULL; - } - /* remove superfluous hp20 memories */ - FOR( ; i < nchan_hp20_old; i++ ) - { - free( old_mem_hp20_out_fx[i] ); - old_mem_hp20_out_fx[i] = NULL; - } - - free( old_mem_hp20_out_fx ); - old_mem_hp20_out_fx = NULL; -#endif } return error; diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index b203370c8..e610c160a 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -2743,19 +2743,6 @@ ivas_error ivas_init_decoder_fx( /* set number of output channels used for synthesis/decoding */ n = getNumChanSynthesis( st_ivas ); -#ifndef FIX_1585_ASAN_FORMAT_SW_ALT - IF( n > 0 ) - { - IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( n * sizeof( Word32 * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } - ELSE - { - st_ivas->mem_hp20_out_fx = NULL; - } -#endif FOR( i = 0; i < n; i++ ) { IF( ( st_ivas->mem_hp20_out_fx[i] = (Word32 *) malloc( ( L_HP20_MEM + 2 ) * sizeof( Word32 ) ) ) == NULL ) @@ -3384,9 +3371,6 @@ void ivas_initialize_handles_dec( st_ivas->bit_stream = NULL; #ifdef FIX_FMSW_DEC } -#endif -#ifndef FIX_1585_ASAN_FORMAT_SW_ALT - st_ivas->mem_hp20_out_fx = NULL; #endif st_ivas->hLimiter = NULL; @@ -3461,9 +3445,7 @@ void ivas_initialize_handles_dec( FOR( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { st_ivas->p_output_fx[i] = NULL; -#ifdef FIX_1585_ASAN_FORMAT_SW_ALT st_ivas->mem_hp20_out_fx[i] = NULL; -#endif } return; @@ -3534,7 +3516,6 @@ void ivas_destroy_dec_fx( } /* HP20 filter handles */ -#ifdef FIX_1585_ASAN_FORMAT_SW_ALT FOR( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { IF( st_ivas->mem_hp20_out_fx[i] != NULL ) @@ -3543,18 +3524,6 @@ void ivas_destroy_dec_fx( st_ivas->mem_hp20_out_fx[i] = NULL; } } -#else - IF( st_ivas->mem_hp20_out_fx != NULL ) - { - FOR( i = 0; i < getNumChanSynthesis( st_ivas ); i++ ) - { - free( st_ivas->mem_hp20_out_fx[i] ); - st_ivas->mem_hp20_out_fx[i] = NULL; - } - free( st_ivas->mem_hp20_out_fx ); - st_ivas->mem_hp20_out_fx = NULL; - } -#endif /* ISM metadata handles */ ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 8a1444278..8e504f77c 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1114,11 +1114,7 @@ typedef struct Decoder_Struct UWord16 *bit_stream; /* Pointer to bitstream buffer */ Word16 writeFECoffset; /* parameter for debugging JBM stuff */ -#ifdef FIX_1585_ASAN_FORMAT_SW_ALT Word32 *mem_hp20_out_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* output signals HP filter memories */ -#else - Word32 **mem_hp20_out_fx; /* output signals HP filter memories */ -#endif IVAS_LIMITER_HANDLE hLimiter; /* Limiter handle */ /* core-decoder modules */ -- GitLab From df1432b02aae1963698643ab9a5126a7bcbf138c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:24 +0200 Subject: [PATCH 14/49] Accept FIX_BASOP_2573_RF_MODE_UPDATE --- lib_com/options.h | 1 - lib_enc/evs_enc_fx.c | 27 --------------------------- 2 files changed, 28 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 869e2c588..1857a1358 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_BASOP_2573_RF_MODE_UPDATE /* FhG: BASOP issue 2573: remove duplicated update of rf_mode parameters from evs_enc_fx(); was already done in updt_enc_common_fx() */ #define FIX_2570_BUF_OVFL /* Orange: basop issue 2570: global-buffer-overflow in lib_rend/ivas_objectRenderer_sources_fx.c */ #define FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT /* Dolby: float issue 1550: Wrong render framesize printout */ #define HARMONIZE_2553_TonalConceal_Apply /* FhG: Harmonize TonalMDCTConceal_Apply with its ivas derivate */ diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index c7f04a06d..7b6c6ddd3 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -76,16 +76,10 @@ ivas_error evs_enc_fx( Word16 pitch_orig[3]; /* original open-loop pitch values that might be altered in core_acelp_tcx20_switching_fx() within MODE2 */ #endif ivas_error error; -#ifndef FIX_BASOP_2573_RF_MODE_UPDATE - SC_VBR_ENC_HANDLE hSC_VBR = st->hSC_VBR; -#endif TD_CNG_ENC_HANDLE hTdCngEnc = st->hTdCngEnc; LPD_state_HANDLE hLPDmem = st->hLPDmem; TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; BSTR_ENC_HANDLE hBstr = st->hBstr; -#ifndef FIX_BASOP_2573_RF_MODE_UPDATE - RF_ENC_HANDLE hRF = st->hRF; -#endif error = IVAS_ERR_OK; @@ -585,27 +579,6 @@ ivas_error evs_enc_fx( move16(); } -#ifndef FIX_BASOP_2573_RF_MODE_UPDATE - IF( EQ_16( st->rf_mode, 1 ) ) - { - IF( EQ_16( hRF->rf_frame_type, RF_NELP ) ) - { - hSC_VBR->last_nelp_mode = 1; - } - ELSE - { - hSC_VBR->last_nelp_mode = 0; - } - } - - /* RF mode updates */ - st->rf_mode_last = st->rf_mode; - IF( EQ_16( st->Opt_RF_ON, 1 ) ) - { - st->L_frame = L_FRAME; - st->rf_mode = 1; - } -#endif #ifdef DEBUG_MODE_INFO dbgwrite( &st->codec_mode, sizeof( short ), 1, input_frame, "res/codec" ); dbgwrite( &st->core, sizeof( short ), 1, input_frame, "res/core" ); -- GitLab From e4123e028bb3597ab9383e2e59538156f90fe4e8 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:26 +0200 Subject: [PATCH 15/49] Accept FIX_2570_BUF_OVFL --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer_sources_fx.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1857a1358..9e2fcf634 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_2570_BUF_OVFL /* Orange: basop issue 2570: global-buffer-overflow in lib_rend/ivas_objectRenderer_sources_fx.c */ #define FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT /* Dolby: float issue 1550: Wrong render framesize printout */ #define HARMONIZE_2553_TonalConceal_Apply /* FhG: Harmonize TonalMDCTConceal_Apply with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_Init /* FhG: Harmonize TonalMDCTConceal_Init with its ivas derivate */ diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index e18fd7291..14f2e3a8b 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -332,9 +332,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( #ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW Word16 pan; #endif -#ifdef FIX_2570_BUF_OVFL Word32 wrapped_angle; -#endif #ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 pos_q; Word32 Src_p_tmp[3]; @@ -491,7 +489,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( set32_fx( hrf_right, 0, *filterlength ); #ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW #ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION -#ifdef FIX_2570_BUF_OVFL IF( LT_32( L_add( ONE_IN_Q25, SrcSpatial_p->Pos_p_fx[1] ), 0 ) ) { wrapped_angle = L_negate( L_add( ONE_IN_Q26, SrcSpatial_p->Pos_p_fx[1] ) ); @@ -506,9 +503,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( move32(); } pan = add( extract_h( L_shr( wrapped_angle, sub( SrcSpatial_p->q_Pos_p, Q21 ) ) ), 32 ); -#else - pan = add( extract_h( L_shr( SrcSpatial_p->Pos_p_fx[1], sub( SrcSpatial_p->q_Pos_p, Q21 ) ) ), 32 ); -#endif #else pan = add( mult_r( extract_h( SrcSpatial_p->Pos_p_fx[1] ), 2048 ), 32 ); #endif -- GitLab From 5d57d684fede009eb55bea661d100c72d674aaf3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:28 +0200 Subject: [PATCH 16/49] Accept FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT --- apps/decoder.c | 13 ------------- lib_com/options.h | 1 - 2 files changed, 14 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 06cbf172c..f7ccdb257 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -464,17 +464,6 @@ int main( } } -#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT - /*-----------------------------------------------------------------* - * Print config information - *-----------------------------------------------------------------*/ - - if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } -#endif /*-------------------------------------------------------------------* * Load renderer configuration from file @@ -668,7 +657,6 @@ int main( hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; } -#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT /*-----------------------------------------------------------------* * Print config information *-----------------------------------------------------------------*/ @@ -678,7 +666,6 @@ int main( fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#endif /*------------------------------------------------------------------------------------------* * Allocate output data buffer diff --git a/lib_com/options.h b/lib_com/options.h index 9e2fcf634..8adb87deb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT /* Dolby: float issue 1550: Wrong render framesize printout */ #define HARMONIZE_2553_TonalConceal_Apply /* FhG: Harmonize TonalMDCTConceal_Apply with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_Init /* FhG: Harmonize TonalMDCTConceal_Init with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_SaveFreqSignal /* FhG: Harmonize TonalConceal_SaveFreqSignal with its ivas derivate */ -- GitLab From 138cd28e2a163305f2870ef741a26ebbb01e794e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:30 +0200 Subject: [PATCH 17/49] Accept HARMONIZE_2553_TonalConceal_Apply --- lib_com/options.h | 1 - lib_com/prot_fx.h | 11 --- lib_dec/dec_tcx_fx.c | 8 -- lib_dec/ivas_mdct_core_dec_fx.c | 4 - lib_dec/tonalMDCTconcealment_fx.c | 125 ------------------------------ 5 files changed, 149 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8adb87deb..8a1878c50 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2553_TonalConceal_Apply /* FhG: Harmonize TonalMDCTConceal_Apply with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_Init /* FhG: Harmonize TonalMDCTConceal_Init with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_SaveFreqSignal /* FhG: Harmonize TonalConceal_SaveFreqSignal with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_SaveTimeSignal /* FhG: Harmonize TonalConceal_SaveTimeSignal with its ivas derivate */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 4af8795b1..dbc486b6c 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5604,21 +5604,10 @@ void TonalMDCTConceal_UpdateState_fx( const Word16 badBlock, const Word8 tonalConcealmentActive ); -#ifndef HARMONIZE_2553_TonalConceal_Apply -void TonalMDCTConceal_Apply_fx( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - Word32 *mdctSpectrum, /*IN/OUT*/ - Word16 *mdctSpectrum_exp /*IN */ -); -#endif -#ifdef HARMONIZE_2553_TonalConceal_Apply void TonalMDCTConceal_Apply_fx( Word16 element_mode, -#else -void TonalMDCTConceal_Apply_ivas_fx( -#endif const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, /*IN/OUT*/ Word16 mdctSpectrum_exp, /*IN */ diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index dc3696f8b..acafb1666 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -973,11 +973,7 @@ void decoder_tcx_fx( test(); IF( bfi && st->tonal_mdct_plc_active ) { -#ifdef HARMONIZE_2553_TonalConceal_Apply TonalMDCTConceal_Apply_fx( st->element_mode, st->hTonalMDCTConc, x, x_e, NULL ); -#else - TonalMDCTConceal_Apply_fx( st->hTonalMDCTConc, x, &x_e ); -#endif } tmp32 = L_deposit_h( 0 ); @@ -5212,11 +5208,7 @@ void decoder_tcx_noiseshaping_igf_fx( test(); IF( bfi && st->tonal_mdct_plc_active && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifdef HARMONIZE_2553_TonalConceal_Apply TonalMDCTConceal_Apply_fx( st->element_mode, st->hTonalMDCTConc, x_fx, *x_e, st->hTcxCfg->psychParamsCurrent ); -#else - TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx, *x_e, st->hTcxCfg->psychParamsCurrent ); -#endif /* If exponent has been updated after TonalMDCTConceal_Apply, then shift the spectrum to common exponent. */ } diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index da6301e2c..ae66a26dc 100755 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1724,11 +1724,7 @@ void ivas_mdct_core_tns_ns_fx( { st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e = s_max( st->hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, st->hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i] ); } -#ifdef HARMONIZE_2553_TonalConceal_Apply TonalMDCTConceal_Apply_fx( st->element_mode, st->hTonalMDCTConc, x_fx[ch][0], x_e, st->hTcxCfg->psychParamsCurrent ); -#else - TonalMDCTConceal_Apply_ivas_fx( st->hTonalMDCTConc, x_fx[ch][0], x_e, st->hTcxCfg->psychParamsCurrent ); -#endif } test(); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 763cc3c4f..454cafe0d 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -2523,112 +2523,16 @@ void TonalMDCTConceal_InsertNoise_fx( return; } -#ifndef HARMONIZE_2553_TonalConceal_Apply -void TonalMDCTConceal_Apply_fx( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - Word32 *mdctSpectrum, // Q31-*mdctSpectrum_exp /*IN/OUT*/ - Word16 *mdctSpectrum_exp /*IN */ -) -{ - Word16 i, l, exp; - Word16 *phaseDiff, *pCurrentPhase; - Word32 phaseToAdd, currentPhase; - Word32 powerSpectrum[L_FRAME_MAX]; - Word16 nSamples; - - - IF( s_and( hTonalMDCTConc->lastBlockData.blockIsValid, hTonalMDCTConc->secondLastBlockData.blockIsValid ) ) - { - assert( hTonalMDCTConc->pTCI->numIndexes > 0 ); - - nSamples = hTonalMDCTConc->nNonZeroSamples; - move16(); - assert( hTonalMDCTConc->pTCI->upperIndex[hTonalMDCTConc->pTCI->numIndexes - 1] < nSamples ); - - { - - mdct_shaping_16( hTonalMDCTConc->secondLastPowerSpectrum, hTonalMDCTConc->nSamplesCore, nSamples, - hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->secondLastBlockData.scaleFactors_exp, - hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, powerSpectrum ); - } - phaseDiff = hTonalMDCTConc->pTCI->phaseDiff; /* if multiple frame loss occurs use the phase from the last frame and continue rotating */ - pCurrentPhase = hTonalMDCTConc->pTCI->phase_currentFramePredicted; - - exp = sub( *mdctSpectrum_exp, add( add( hTonalMDCTConc->secondLastPowerSpectrum_exp, add( hTonalMDCTConc->secondLastBlockData.gain_tcx_exp, 1 ) ), hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e ) ); - - IF( !hTonalMDCTConc->lastBlockData.blockIsConcealed ) - { - if ( hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive != 0 ) - { - hTonalMDCTConc->nFramesLost = add( hTonalMDCTConc->nFramesLost, 2 ); /*Q1*/ - move16(); - } - if ( hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive == 0 ) - { - hTonalMDCTConc->nFramesLost = 3; /*Q1*/ - move16(); - } - } - /* for each index group */ - FOR( i = 0; i < hTonalMDCTConc->pTCI->numIndexes; i++ ) - { - /*phaseToAdd = hTonalMDCTConc->nFramesLost*phaseDiff[i]; */ - phaseToAdd = L_mult0( hTonalMDCTConc->nFramesLost, phaseDiff[i] ); /*Q1*3Q12=2Q13*/ - /* Move phaseToAdd to range -PI..PI */ - - WHILE( GT_32( phaseToAdd, 25736l /*EVS_PI Q13*/ ) ) - { - phaseToAdd = L_sub( phaseToAdd, 51472l /*2*EVS_PI Q13*/ ); - } - WHILE( LT_32( phaseToAdd, -25736l /*-EVS_PI Q13*/ ) ) - { - phaseToAdd = L_add( phaseToAdd, 51472l /*2*EVS_PI Q13*/ ); - } - FOR( l = hTonalMDCTConc->pTCI->lowerIndex[i]; l <= hTonalMDCTConc->pTCI->upperIndex[i]; l++ ) - { - /* *pCurrentPhase and phaseToAdd are in range -PI..PI */ - currentPhase = L_mac0( phaseToAdd, ( *pCurrentPhase++ ), 1 ); /*2Q13+2Q13=3Q13*/ - - if ( GT_32( currentPhase, 25736l /*EVS_PI Q13*/ ) ) - { - currentPhase = L_sub( currentPhase, 51472l /*2*EVS_PI Q13*/ ); - } - if ( LT_32( currentPhase, -25736l /*-EVS_PI Q13*/ ) ) - { - currentPhase = L_add( currentPhase, 51472l /*2*EVS_PI Q13*/ ); - } - /* getCosWord16 returns 1Q14*/ - mdctSpectrum[l] = Mpy_32_16_1( powerSpectrum[l], getCosWord16( extract_l( currentPhase ) ) ); - move32(); - mdctSpectrum[l] = L_shr( mdctSpectrum[l], exp ); - move32(); - } - } - } - - hTonalMDCTConc->nFramesLost = add( hTonalMDCTConc->nFramesLost, 2 ); /*Q1*/ - move16(); - - return; -} -#endif - -#ifdef HARMONIZE_2553_TonalConceal_Apply void TonalMDCTConceal_Apply_fx( Word16 element_mode, -#else -void TonalMDCTConceal_Apply_ivas_fx( -#endif const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, // Q31-*mdctSpectrum_exp /*IN/OUT*/ Word16 mdctSpectrum_exp, /*IN */ const PsychoacousticParameters *psychParamsCurrent ) { -#ifdef HARMONIZE_2553_TonalConceal_Apply Word16 exp; -#endif Word16 i, l; Word16 *phaseDiff, *pCurrentPhase; Word32 phaseToAdd; @@ -2638,16 +2542,7 @@ void TonalMDCTConceal_Apply_ivas_fx( Word16 nSamples; Word16 nBands; -#ifndef HARMONIZE_2553_TonalConceal_Apply - Word16 *tmp_secondLastPowerSpectrum = hTonalMDCTConc->secondLastPowerSpectrum; - Word16 tmp_secondLastPowerSpectrum_exp = hTonalMDCTConc->secondLastPowerSpectrum_exp; - move16(); - - Word16 max_nSamples = s_max( hTonalMDCTConc->nNonZeroSamples, hTonalMDCTConc->nSamplesCore ); - -#else IF( GT_16( element_mode, EVS_MONO ) ) -#endif { // To avoid garbage values set32_fx( powerSpectrum, 0, L_FRAME_MAX ); @@ -2666,24 +2561,14 @@ void TonalMDCTConceal_Apply_ivas_fx( nSamples = hTonalMDCTConc->nNonZeroSamples; move16(); assert( hTonalMDCTConc->pTCI->upperIndex[hTonalMDCTConc->pTCI->numIndexes - 1] < nSamples ); -#ifdef HARMONIZE_2553_TonalConceal_Apply IF( GT_16( element_mode, EVS_MONO ) ) -#endif { FOR( i = 0; i < nSamples; i++ ) { -#ifdef HARMONIZE_2553_TonalConceal_Apply powerSpectrum[i] = L_deposit_h( hTonalMDCTConc->secondLastPowerSpectrum[i] ); // Q31 - secondLastPowerSpectrum_exp -#else - powerSpectrum[i] = L_deposit_h( tmp_secondLastPowerSpectrum[i] ); // Q31 - secondLastPowerSpectrum_exp -#endif move16(); } -#ifdef HARMONIZE_2553_TonalConceal_Apply powerSpectrum_exp = hTonalMDCTConc->secondLastPowerSpectrum_exp; -#else - powerSpectrum_exp = tmp_secondLastPowerSpectrum_exp; -#endif move16(); Word16 exp1 = powerSpectrum_exp; @@ -2739,11 +2624,7 @@ void TonalMDCTConceal_Apply_ivas_fx( exp_right = add( exp_right, hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[nBands - 1] ); Word16 max_e = s_max( exp_right, exp_left ); -#ifdef HARMONIZE_2553_TonalConceal_Apply FOR( Word16 c = 0; c < s_max( hTonalMDCTConc->nNonZeroSamples, hTonalMDCTConc->nSamplesCore ); c++ ) -#else - FOR( Word16 c = 0; c < max_nSamples; c++ ) -#endif { test(); test(); @@ -2763,7 +2644,6 @@ void TonalMDCTConceal_Apply_ivas_fx( powerSpectrum_exp = max_e; move16(); } -#ifdef HARMONIZE_2553_TonalConceal_Apply ELSE { @@ -2775,7 +2655,6 @@ void TonalMDCTConceal_Apply_ivas_fx( powerSpectrum_exp = add( add( hTonalMDCTConc->secondLastPowerSpectrum_exp, hTonalMDCTConc->secondLastBlockData.gain_tcx_exp ), hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e ); } exp = sub( mdctSpectrum_exp, add( powerSpectrum_exp, 1 ) ); -#endif phaseDiff = hTonalMDCTConc->pTCI->phaseDiff; /* if multiple frame loss occurs use the phase from the last frame and continue rotating */ pCurrentPhase = hTonalMDCTConc->pTCI->phase_currentFramePredicted; @@ -2824,12 +2703,8 @@ void TonalMDCTConceal_Apply_ivas_fx( /* getCosWord16 returns 1Q14*/ mdctSpectrum[l] = Mpy_32_16_1( powerSpectrum[l], getCosWord16( extract_l( currentPhase ) ) ); move32(); -#ifdef HARMONIZE_2553_TonalConceal_Apply mdctSpectrum[l] = L_shr( mdctSpectrum[l], exp ); move32(); -#else - mdctSpectrum[l] = L_shr( mdctSpectrum[l], sub( mdctSpectrum_exp, add( powerSpectrum_exp, 1 ) ) ); -#endif } } } -- GitLab From b71985573e50a01b4ddab7f55e1487157b3ace6d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:33 +0200 Subject: [PATCH 18/49] Accept HARMONIZE_2553_TonalConceal_Init --- lib_com/options.h | 1 - lib_com/prot_fx.h | 13 --- lib_dec/core_dec_init_fx.c | 8 -- lib_dec/tonalMDCTconcealment_fx.c | 131 ------------------------------ 4 files changed, 153 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8a1878c50..f0d31531e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2553_TonalConceal_Init /* FhG: Harmonize TonalMDCTConceal_Init with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_SaveFreqSignal /* FhG: Harmonize TonalConceal_SaveFreqSignal with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_SaveTimeSignal /* FhG: Harmonize TonalConceal_SaveTimeSignal with its ivas derivate */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index dbc486b6c..714cf995b 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5546,22 +5546,9 @@ void RefineTonalComponents_fx( const Word16 element_mode, const PsychoacousticParameters *psychParamsCurrent ); -#ifndef HARMONIZE_2553_TonalConceal_Init -ivas_error TonalMDCTConceal_Init_fx( - TonalMDCTConcealPtr self, - const Word16 nSamples, - const Word16 nSamplesCore, - const Word16 nScaleFactors, - TCX_CONFIG_HANDLE hTcxCfg /* TCX config */ -); -#endif -#ifdef HARMONIZE_2553_TonalConceal_Init ivas_error TonalMDCTConceal_Init_fx( Word16 element_mode, -#else -ivas_error TonalMDCTConceal_Init_ivas_fx( -#endif TonalMDCTConcealPtr hTonalMDCTConc, const UWord16 nSamples, const UWord16 nSamplesCore, diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 96815e715..8d73f7f3f 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -907,11 +907,7 @@ void open_decoder_LPD_fx( st->hTonalMDCTConc->lastBlockData.nSamples = 0; move16(); -#ifdef HARMONIZE_2553_TonalConceal_Init TonalMDCTConceal_Init_fx( EVS_MONO, st->hTonalMDCTConc, hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); -#else - TonalMDCTConceal_Init_fx( st->hTonalMDCTConc, hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); -#endif } st->last_tns_active = 0; move16(); @@ -1966,11 +1962,7 @@ void open_decoder_LPD_ivas_fx( move16(); st->hTonalMDCTConc->lastBlockData.nSamples = 0; move16(); -#ifdef HARMONIZE_2553_TonalConceal_Init TonalMDCTConceal_Init_fx( 1 /*signal non-EVS*/, st->hTonalMDCTConc, st->hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); -#else - TonalMDCTConceal_Init_ivas_fx( st->hTonalMDCTConc, st->hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); -#endif } st->last_tns_active = 0; diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 454cafe0d..5d0cebb57 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -34,98 +34,10 @@ static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, Word /*-------------- public functions -------------------- */ /*******************************************************/ -#ifndef HARMONIZE_2553_TonalConceal_Init -ivas_error TonalMDCTConceal_Init_fx( - TonalMDCTConcealPtr hTonalMDCTConc, - const Word16 nSamples, - const Word16 nSamplesCore, - const Word16 nScaleFactors, - TCX_CONFIG_HANDLE hTcxCfg /* TCX config */ -) -{ - test(); - IF( GT_16( nSamples, L_FRAME_MAX ) || GT_16( nScaleFactors, FDNS_NPTS ) ) - { - assert( nSamples <= L_FRAME_MAX ); - assert( nScaleFactors <= FDNS_NPTS ); - return ( IVAS_ERROR( IVAS_ERR_INTERNAL, "TonalMDCT FEC: Number of samples larger than max. block size\n" ) ); - } - assert( ( hTonalMDCTConc->nScaleFactors == nScaleFactors ) || ( hTonalMDCTConc->nSamples != nSamples ) ); /* If nSamples doesn't change then also nScaleFactors must stay the same */ - - hTonalMDCTConc->tcx_cfg = hTcxCfg; - - hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; - move16(); - hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; - move16(); - hTonalMDCTConc->secondLastPowerSpectrum = hTonalMDCTConc->secondLastBlockData.spectralData; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[1]; - move16(); - hTonalMDCTConc->lastBlockData.blockIsValid = 0; - move16(); - hTonalMDCTConc->secondLastBlockData.blockIsValid = 0; - move16(); - hTonalMDCTConc->nSamples = 0; - move16(); - hTonalMDCTConc->nScaleFactors = 0; - move16(); - - hTonalMDCTConc->lastBlockData.blockIsConcealed = 0; - move16(); - hTonalMDCTConc->secondLastBlockData.blockIsConcealed = 0; - move16(); - - hTonalMDCTConc->pTCI = (TonalComponentsInfo *) hTonalMDCTConc->timeDataBuffer; - move16(); - - hTonalMDCTConc->lastPitchLag = L_deposit_l( 0 ); - - IF( NE_16( hTonalMDCTConc->nSamples, nSamples ) ) - { - hTonalMDCTConc->secondLastBlockData.blockIsValid = 0; - move16(); - hTonalMDCTConc->lastBlockData.blockIsValid = 0; - move16(); - } - - hTonalMDCTConc->nSamples = nSamples; - move16(); - hTonalMDCTConc->nSamplesCore = nSamplesCore; - move16(); - - hTonalMDCTConc->nScaleFactors = nScaleFactors; - move16(); - /* Offset the pointer to the end of buffer, so that pTCI is not destroyed when - new time samples are stored in lastPcmOut */ - move16(); - move16(); - /* just the second half of the second last pcm output is needed */ - hTonalMDCTConc->secondLastPcmOut = &hTonalMDCTConc->timeDataBuffer[sub( ( 3 * L_FRAME_MAX ) / 2, 3 * ( s_min( L_FRAME_MAX, nSamples ) ) / 2 )]; - hTonalMDCTConc->lastPcmOut = &hTonalMDCTConc->timeDataBuffer[sub( ( 3 * L_FRAME_MAX ) / 2, s_min( L_FRAME_MAX, nSamples ) )]; - - /* If the second last frame was lost, we reuse saved TonalComponentsInfo and don't update pcm buffers */ - assert( sizeof( *hTonalMDCTConc->pTCI ) <= ( hTonalMDCTConc->lastPcmOut - hTonalMDCTConc->timeDataBuffer ) * sizeof( hTonalMDCTConc->timeDataBuffer[0] ) ); - - return IVAS_ERR_OK; -} -#endif - - -#ifdef HARMONIZE_2553_TonalConceal_Init ivas_error TonalMDCTConceal_Init_fx( Word16 element_mode, -#else -ivas_error TonalMDCTConceal_Init_ivas_fx( -#endif TonalMDCTConcealPtr hTonalMDCTConc, const UWord16 nSamples, const UWord16 nSamplesCore, @@ -143,7 +55,6 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->tcx_cfg = hTcxCfg; hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; -#ifdef HARMONIZE_2553_TonalConceal_Init IF( GT_16( element_mode, EVS_MONO ) ) { set16_fx( hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX ); @@ -175,24 +86,6 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; move16(); } -#else - - set16_fx( hTonalMDCTConc->lastBlockData.spectralData, 0, L_FRAME_MAX ); - move16(); - hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; - set16_fx( hTonalMDCTConc->secondLastBlockData.spectralData, 0, L_FRAME_MAX ); - move16(); - hTonalMDCTConc->secondLastPowerSpectrum = hTonalMDCTConc->secondLastBlockData.spectralData; - move16(); - hTonalMDCTConc->secondLastPowerSpectrum_exp = hTonalMDCTConc->secondLastBlockData.spectralData_exp; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; - set16_fx( hTonalMDCTConc->lastBlockData.scaleFactors, 0, FDNS_NPTS ); - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; - set16_fx( hTonalMDCTConc->secondLastBlockData.scaleFactors, 0, FDNS_NPTS ); - move16(); -#endif hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; move16(); hTonalMDCTConc->secondLastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[1]; @@ -229,7 +122,6 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( move16(); hTonalMDCTConc->nScaleFactors = nScaleFactors; move16(); -#ifdef HARMONIZE_2553_TonalConceal_Init IF( GT_16( element_mode, EVS_MONO ) ) { set32_fx( hTonalMDCTConc->scaleFactorsBackground_fx, 0, FDNS_NPTS ); @@ -250,36 +142,13 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->faded_signal_nrg_exp = 0; move16(); } -#else - - set32_fx( hTonalMDCTConc->scaleFactorsBackground_fx, 0, FDNS_NPTS ); - hTonalMDCTConc->scf_fadeout = 16384 /*1.000000 Q14*/; - PsychoacousticParameters_Init_fx( INT_FS_16k, L_FRAME16k, 64, 1, 1, &hTonalMDCTConc->psychParamsTCX20 ); - PsychoacousticParameters_Init_fx( INT_FS_16k, L_FRAME16k / 2, 64, 0, 1, &hTonalMDCTConc->psychParamsTCX10 ); - hTonalMDCTConc->psychParams = NULL; - - hTonalMDCTConc->last_block_nrg = 0; - move16(); - hTonalMDCTConc->last_block_nrg_exp = 0; - move16(); - hTonalMDCTConc->curr_noise_nrg = 0; - move16(); - hTonalMDCTConc->curr_noise_nrg_exp = 0; - move16(); - hTonalMDCTConc->faded_signal_nrg = 0; - move16(); - hTonalMDCTConc->faded_signal_nrg_exp = 0; - move16(); -#endif /* Offset the pointer to the end of buffer, so that pTCI is not destroyed when new time samples are stored in lastPcmOut */ move16(); move16(); /* just the second half of the second last pcm output is needed */ -#ifdef HARMONIZE_2553_TonalConceal_Init IF( GT_16( element_mode, EVS_MONO ) ) -#endif { set16_fx( hTonalMDCTConc->timeDataBuffer, 0, ( 3 * L_FRAME_MAX ) / 2 ); } -- GitLab From d5bb4e38f2e4093242cd925833cf9dda756b49eb Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:35 +0200 Subject: [PATCH 19/49] Accept HARMONIZE_2553_TonalConceal_SaveFreqSignal --- lib_com/options.h | 1 - lib_com/prot_fx.h | 15 --- lib_dec/dec_tcx_fx.c | 8 -- lib_dec/ivas_mdct_core_dec_fx.c | 4 - lib_dec/ivas_stereo_mdct_core_dec_fx.c | 4 - lib_dec/tonalMDCTconcealment_fx.c | 172 ------------------------- 6 files changed, 204 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f0d31531e..01d27c2a3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2553_TonalConceal_SaveFreqSignal /* FhG: Harmonize TonalConceal_SaveFreqSignal with its ivas derivate */ #define HARMONIZE_2553_TonalConceal_SaveTimeSignal /* FhG: Harmonize TonalConceal_SaveTimeSignal with its ivas derivate */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 714cf995b..15801efc1 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5556,24 +5556,9 @@ ivas_error TonalMDCTConceal_Init_fx( TCX_CONFIG_HANDLE hTcxCfg ); /* Must be called only when a good frame is recieved - concealment is inactive */ -#ifndef HARMONIZE_2553_TonalConceal_SaveFreqSignal -void TonalMDCTConceal_SaveFreqSignal_fx( - TonalMDCTConcealPtr self, - const Word32 *mdctSpectrum, - const Word16 mdctSpectrum_exp, - Word16 nNewSamples, - Word16 nNewSamplesCore, - const Word16 *scaleFactors, - const Word16 *scaleFactors_exp, - const Word16 gain_tcx_exp ); -#endif -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal void TonalMDCTConceal_SaveFreqSignal_fx( Word16 element_mode, -#else -void TonalMDCTConceal_SaveFreqSignal_ivas_fx( -#endif TonalMDCTConcealPtr hTonalMDCTConc, const Word32 *mdctSpectrum, const Word16 mdctSpectrum_exp, diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index acafb1666..db29982a5 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -814,11 +814,7 @@ void decoder_tcx_fx( IF( bfi == 0 ) { -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal TonalMDCTConceal_SaveFreqSignal_fx( st->element_mode, st->hTonalMDCTConc, x, x_e, L_frameTCX, L_frame, gainlpc2, gainlpc2_e, gain_tcx_e, 0 ); -#else - TonalMDCTConceal_SaveFreqSignal_fx( st->hTonalMDCTConc, x, x_e, L_frameTCX, L_frame, gainlpc2, gainlpc2_e, gain_tcx_e ); -#endif } ELSE { @@ -4883,11 +4879,7 @@ void decoder_tcx_noisefilling_fx( test(); IF( bfi == 0 && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal TonalMDCTConceal_SaveFreqSignal_fx( st->element_mode, st->hTonalMDCTConc, x, *x_e, L_frameTCX, L_frame, gainlpc2, gainlpc2_e, gain_tcx_e, infoIGFStartLine ); -#else - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x, *x_e, L_frameTCX, L_frame, gainlpc2, gainlpc2_e, gain_tcx_e, infoIGFStartLine ); -#endif } ELSE IF( bfi ) { diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index ae66a26dc..e0a6a5bae 100755 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1593,11 +1593,7 @@ void ivas_mdct_core_tns_ns_fx( scf_e[ind] = sub( 15, q_shift ); move16(); } -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal TonalMDCTConceal_SaveFreqSignal_fx( st->element_mode, st->hTonalMDCTConc, x_fx[ch][k], x_e, L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline_fx( st, L_frame[ch], L_frameTCX[ch] ) ); -#else - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], x_e, L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline_fx( st, L_frame[ch], L_frameTCX[ch] ) ); -#endif } } ELSE diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 00a4e2b33..c64baefe6 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -418,11 +418,7 @@ void stereo_mdct_core_dec_fx( } Word16 s = getScaleFactor32( x_fx[ch][k], L_frameTCX[ch] ); Scale_sig32( x_fx[ch][k], L_frameTCX[ch], s ); /* exp(x_e + 31 - s) */ -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal TonalMDCTConceal_SaveFreqSignal_fx( 1 /*signal non-EVS*/, st->hTonalMDCTConc, x_fx[ch][k], sub( x_e[ch][k], s ), L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline_fx( st, L_frame[ch], L_frameTCX[ch] ) ); -#else - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx[ch][k], sub( x_e[ch][k], s ), L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline_fx( st, L_frame[ch], L_frameTCX[ch] ) ); -#endif Scale_sig32( x_fx[ch][k], L_frameTCX[ch], negate( s ) ); /* exp(x_e) */ } } diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 5d0cebb57..d5233a84e 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -161,144 +161,9 @@ ivas_error TonalMDCTConceal_Init_fx( return IVAS_ERR_OK; } -#ifndef HARMONIZE_2553_TonalConceal_SaveFreqSignal -void TonalMDCTConceal_SaveFreqSignal_fx( - TonalMDCTConcealPtr hTonalMDCTConc, - const Word32 *mdctSpectrum, // Q31-mdctSpectrum_exp - const Word16 mdctSpectrum_exp, - Word16 nNewSamples, // Q0 - Word16 nNewSamplesCore, // Q0 - const Word16 *scaleFactors, // Q31-scaleFactors_exp - const Word16 *scaleFactors_exp, - const Word16 gain_tcx_exp ) -{ - Word16 *temp; - Word16 nOldSamples, tmp_exp, s, i, max_exp; - - assert( nNewSamples > 0 && nNewSamples <= 2 * L_FRAME_MAX ); - - /* Avoid overwriting hTonalMDCTConc->secondLastPowerSpectrum stored in spectralData, - because it is needed if the second last and the current frame are lost - and concealed using the Tonal MDCT PLC */ - test(); - IF( !hTonalMDCTConc->lastBlockData.tonalConcealmentActive || NE_16( hTonalMDCTConc->lastBlockData.nSamples, nNewSamples ) ) - { - IF( LE_16( nNewSamples, L_FRAME_MAX ) ) - { - /* Shift the buffers */ - temp = hTonalMDCTConc->secondLastBlockData.spectralData; /* Save the pointer */ - move16(); - hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->lastBlockData.spectralData; - move16(); - hTonalMDCTConc->lastBlockData.spectralData = temp; - move16(); - - tmp_exp = hTonalMDCTConc->secondLastBlockData.spectralData_exp; /* Save the pointer */ - move16(); - hTonalMDCTConc->secondLastBlockData.spectralData_exp = hTonalMDCTConc->lastBlockData.spectralData_exp; - move16(); - hTonalMDCTConc->lastBlockData.spectralData_exp = tmp_exp; - move16(); - - tmp_exp = hTonalMDCTConc->secondLastBlockData.gain_tcx_exp; /* Save the pointer */ - move16(); - hTonalMDCTConc->secondLastBlockData.gain_tcx_exp = hTonalMDCTConc->lastBlockData.gain_tcx_exp; - move16(); - hTonalMDCTConc->lastBlockData.gain_tcx_exp = tmp_exp; - move16(); - - tmp_exp = hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e; /* Save the pointer */ - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e = hTonalMDCTConc->lastBlockData.scaleFactors_max_e; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors_max_e = tmp_exp; - move16(); - - temp = hTonalMDCTConc->secondLastBlockData.scaleFactors; - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->lastBlockData.scaleFactors; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors = temp; - move16(); - - temp = hTonalMDCTConc->secondLastBlockData.scaleFactors_exp; - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors_exp = hTonalMDCTConc->lastBlockData.scaleFactors_exp; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors_exp = temp; - move16(); - } - ELSE - { - hTonalMDCTConc->lastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[0]; - move16(); - hTonalMDCTConc->secondLastBlockData.spectralData = hTonalMDCTConc->spectralDataBuffers[1]; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[0]; - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors = hTonalMDCTConc->scaleFactorsBuffers[1]; - move16(); - hTonalMDCTConc->lastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[0]; - move16(); - hTonalMDCTConc->secondLastBlockData.scaleFactors_exp = hTonalMDCTConc->scaleFactorsBuffers_exp[1]; - move16(); - } - - nOldSamples = hTonalMDCTConc->lastBlockData.nSamples; - move16(); - hTonalMDCTConc->lastBlockData.nSamples = nNewSamples; - move16(); - hTonalMDCTConc->secondLastBlockData.nSamples = nOldSamples; - move16(); - - nOldSamples = hTonalMDCTConc->lastBlockData.nSamplesCore; - move16(); - hTonalMDCTConc->lastBlockData.nSamplesCore = nNewSamplesCore; - move16(); - hTonalMDCTConc->secondLastBlockData.nSamplesCore = nOldSamples; - move16(); - } - - test(); - IF( ( nNewSamples > 0 ) && ( LE_16( nNewSamples, 2 * L_FRAME_MAX ) ) ) - { - /* Store new data */ - s = getScaleFactor32( mdctSpectrum, nNewSamples ); - - /*Copy(scaleFactors_exp, hTonalMDCTConc->lastBlockData.scaleFactors_exp, hTonalMDCTConc->nScaleFactors);*/ - max_exp = 0; - FOR( i = 0; i < hTonalMDCTConc->nScaleFactors; i++ ) - { - hTonalMDCTConc->lastBlockData.scaleFactors_exp[i] = scaleFactors_exp[i]; - move16(); - max_exp = s_max( max_exp, scaleFactors_exp[i] ); - } - - /*s = sub(s, max_exp);*/ - hTonalMDCTConc->lastBlockData.scaleFactors_max_e = max_exp; - - FOR( i = 0; i < nNewSamples; i++ ) - { - hTonalMDCTConc->lastBlockData.spectralData[i] = extract_h( L_shl( mdctSpectrum[i], s ) ); // Q31-(mdctSpectrum_exp-s) - move16(); - } - hTonalMDCTConc->lastBlockData.spectralData_exp = sub( mdctSpectrum_exp, s ); - move16(); - hTonalMDCTConc->lastBlockData.gain_tcx_exp = gain_tcx_exp; - Copy( scaleFactors, hTonalMDCTConc->lastBlockData.scaleFactors, hTonalMDCTConc->nScaleFactors ); - } - - return; -} -#endif - -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal void TonalMDCTConceal_SaveFreqSignal_fx( Word16 element_mode, -#else -void TonalMDCTConceal_SaveFreqSignal_ivas_fx( -#endif TonalMDCTConcealPtr hTonalMDCTConc, const Word32 *mdctSpectrum, // Q31-mdctSpectrum_exp const Word16 mdctSpectrum_exp, // Q0 @@ -399,7 +264,6 @@ void TonalMDCTConceal_SaveFreqSignal_ivas_fx( IF( ( nNewSamples > 0 ) && ( LE_16( nNewSamples, 2 * L_FRAME_MAX ) ) ) { /* Store new data */ -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal IF( GT_16( element_mode, EVS_MONO ) ) { Word64 W_tmp = 0; @@ -414,21 +278,6 @@ void TonalMDCTConceal_SaveFreqSignal_ivas_fx( hTonalMDCTConc->last_block_nrg_exp = add( sub( shl( mdctSpectrum_exp, 1 ), s ), 31 ); move16(); } -#else - Word64 W_tmp = 0; - move64(); - FOR( i = 0; i < infoIGFStartLine; i++ ) - { - W_tmp = W_mac_32_16( W_tmp, Mpy_32_32( mdctSpectrum[i], mdctSpectrum[i] ), 1 ); // exp: mdctSpectrum_exp + mdctSpectrum_exp - 1 - } - s = W_norm( W_tmp ); - hTonalMDCTConc->last_block_nrg = W_extract_h( W_shl( W_tmp, s ) ); // exp:add( sub( shl( mdctSpectrum_exp, 1 ), s ), 31 ) - move32(); - hTonalMDCTConc->last_block_nrg_exp = add( sub( shl( mdctSpectrum_exp, 1 ), s ), 31 ); - move16(); - - /* Store new data */ -#endif s = getScaleFactor32( mdctSpectrum, nNewSamples ); max_exp = 0; @@ -443,7 +292,6 @@ void TonalMDCTConceal_SaveFreqSignal_ivas_fx( /*s = sub(s, max_exp);*/ hTonalMDCTConc->lastBlockData.scaleFactors_max_e = max_exp; move16(); -#ifdef HARMONIZE_2553_TonalConceal_SaveFreqSignal IF( EQ_16( element_mode, EVS_MONO ) ) { FOR( i = 0; i < nNewSamples; i++ ) @@ -473,26 +321,6 @@ void TonalMDCTConceal_SaveFreqSignal_ivas_fx( } } } -#else - FOR( i = 0; i < nNewSamples; i++ ) - { - Word16 tmp = 0; - if ( mdctSpectrum[i] != 0 ) - { - tmp = 1; - move16(); - } - hTonalMDCTConc->lastBlockData.spectralData[i] = extract_h( L_shl( mdctSpectrum[i], s ) ); // 31 - mdctSpectrum_exp +s -16 = 15-(mdctSpectrum_exp -s) - move16(); - - test(); - if ( hTonalMDCTConc->lastBlockData.spectralData[i] == 0 && EQ_16( tmp, 1 ) ) - { - hTonalMDCTConc->lastBlockData.spectralData[i] = 1; - move16(); - } - } -#endif hTonalMDCTConc->lastBlockData.spectralData_exp = sub( mdctSpectrum_exp, s ); move16(); -- GitLab From 63d803d86a93210d79376d255e7db550a9f50ddd Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:37 +0200 Subject: [PATCH 20/49] Accept HARMONIZE_2553_TonalConceal_SaveTimeSignal --- lib_com/options.h | 1 - lib_com/prot_fx.h | 10 ---------- lib_dec/dec_LPD_fx.c | 4 ---- lib_dec/ivas_mdct_core_dec_fx.c | 4 ---- lib_dec/ivas_tcx_core_dec_fx.c | 4 ---- lib_dec/tonalMDCTconcealment_fx.c | 29 ----------------------------- 6 files changed, 52 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 01d27c2a3..ceac8f9a8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,6 @@ #define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ -#define HARMONIZE_2553_TonalConceal_SaveTimeSignal /* FhG: Harmonize TonalConceal_SaveTimeSignal with its ivas derivate */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 15801efc1..dd89aa091 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5609,19 +5609,9 @@ void TonalMDCTConceal_InsertNoise_fx( Word16 crossfadeGain, const Word16 crossOverFreq ); -#ifndef HARMONIZE_2553_TonalConceal_SaveTimeSignal -void TonalMDCTConceal_SaveTimeSignal_fx( - TonalMDCTConcealPtr hTonalMDCTConc, - Word16 *timeSignal, - Word16 nNewSamples ); -#endif -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal void TonalMDCTConceal_SaveTimeSignal_fx( Word16 element_mode, -#else -void TonalMDCTConceal_SaveTimeSignal_ivas_fx( -#endif TonalMDCTConcealPtr hTonalMDCTConc, Word16 *timeSignal, // q_timeSignal Word16 q_timeSignal, diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 6293b10c4..671d20d5c 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -768,11 +768,7 @@ void decoder_LPD_fx( IF( !bfi ) { -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal TonalMDCTConceal_SaveTimeSignal_fx( st->element_mode, st->hTonalMDCTConc, synthFB, 0, L_frameTCX ); -#else - TonalMDCTConceal_SaveTimeSignal_fx( st->hTonalMDCTConc, synthFB, L_frameTCX ); -#endif } decoder_tcx_post_fx( st, synth, synthFB, Aq, bfi ); IF( EQ_16( st->core, TCX_20_CORE ) ) diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index e0a6a5bae..2b25c2984 100755 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1257,11 +1257,7 @@ void ivas_mdct_core_reconstruct_fx( test(); IF( ( bfi == 0 ) && st->hTonalMDCTConc != NULL ) { -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal TonalMDCTConceal_SaveTimeSignal_fx( st->element_mode, st->hTonalMDCTConc, synthFB_fx, q_winFB, L_frameTCX[ch] ); -#else - TonalMDCTConceal_SaveTimeSignal_ivas_fx( st->hTonalMDCTConc, synthFB_fx, q_winFB, L_frameTCX[ch] ); -#endif } decoder_tcx_post_ivas_fx( st, synth_fx, synthFB_fx, q_winFB, NULL, bfi, MCT_flag ); diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 486896dc0..3e848fcd8 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -631,11 +631,7 @@ void stereo_tcx_core_dec_fx( { IF( !bfi && st->hTonalMDCTConc != NULL ) { -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal TonalMDCTConceal_SaveTimeSignal_fx( st->element_mode, st->hTonalMDCTConc, synthFB_fx, st->Q_syn, hTcxDec->L_frameTCX ); -#else - TonalMDCTConceal_SaveTimeSignal_ivas_fx( st->hTonalMDCTConc, synthFB_fx, st->Q_syn, hTcxDec->L_frameTCX ); -#endif } decoder_tcx_post_ivas_fx( st, synth_fx, synthFB_fx, st->Q_syn, Aq_fx, bfi, 0 ); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index d5233a84e..b58c0fe82 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -2412,35 +2412,10 @@ void TonalMDCTConceal_Apply_fx( return; } -#ifndef HARMONIZE_2553_TonalConceal_SaveTimeSignal -void TonalMDCTConceal_SaveTimeSignal_fx( - TonalMDCTConcealPtr hTonalMDCTConc, - Word16 *timeSignal, // Qx - Word16 nNewSamples -) -{ - IF( EQ_16( nNewSamples, hTonalMDCTConc->nSamples ) ) - { - assert( nNewSamples <= L_FRAME_MAX ); - IF( !hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) - { - Copy( hTonalMDCTConc->lastPcmOut + hTonalMDCTConc->nSamples / 2, hTonalMDCTConc->secondLastPcmOut, hTonalMDCTConc->nSamples / 2 ); - } - Copy( timeSignal, hTonalMDCTConc->lastPcmOut, hTonalMDCTConc->nSamples ); - } - - return; -} -#endif - -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal void TonalMDCTConceal_SaveTimeSignal_fx( Word16 element_mode, -#else -void TonalMDCTConceal_SaveTimeSignal_ivas_fx( -#endif TonalMDCTConcealPtr hTonalMDCTConc, Word16 *timeSignal, // q_timeSignal Word16 q_timeSignal, @@ -2454,9 +2429,7 @@ void TonalMDCTConceal_SaveTimeSignal_ivas_fx( Word16 exp, len; len = shr( hTonalMDCTConc->nSamples, 1 ); Copy( hTonalMDCTConc->lastPcmOut + len, hTonalMDCTConc->secondLastPcmOut, len ); -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal IF( GT_16( element_mode, EVS_MONO ) ) -#endif { exp = sub( q_timeSignal, hTonalMDCTConc->q_lastPcmOut ); IF( exp != 0 ) @@ -2466,9 +2439,7 @@ void TonalMDCTConceal_SaveTimeSignal_ivas_fx( } } Copy( timeSignal, hTonalMDCTConc->lastPcmOut, hTonalMDCTConc->nSamples ); -#ifdef HARMONIZE_2553_TonalConceal_SaveTimeSignal IF( GT_16( element_mode, EVS_MONO ) ) -#endif { hTonalMDCTConc->q_lastPcmOut = q_timeSignal; move16(); -- GitLab From 0e508bf37384305cd9b94d64bb7b814a1dba4416 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:38 +0200 Subject: [PATCH 21/49] Accept FIX_2500_RENDCONF_REFACTOR --- apps/decoder.c | 36 ---------- apps/renderer.c | 34 --------- lib_com/options.h | 1 - lib_util/render_config_reader.c | 124 -------------------------------- lib_util/render_config_reader.h | 4 -- 5 files changed, 199 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index f7ccdb257..110500290 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -498,13 +498,11 @@ int main( goto cleanup; } -#ifdef FIX_2500_RENDCONF_REFACTOR if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) { fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); goto cleanup; } -#endif aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) @@ -584,27 +582,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_2500_RENDCONF_REFACTOR if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); goto cleanup; } -#else - if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) - { - if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Invalid reverberation configuration parameters\n\n" ); - goto cleanup; - } - } - else - { - fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); - goto cleanup; - } -#endif } /* ISAR frame size is set from command line, not renderer config file. @@ -2126,13 +2108,11 @@ static ivas_error decodeG192( goto cleanup; } -#ifdef FIX_2500_RENDCONF_REFACTOR if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) { fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); goto cleanup; } -#endif } for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -2295,27 +2275,11 @@ static ivas_error decodeG192( arg.aeSequence.selected = 0; } arg.aeSequence.frameCounter = 0; -#ifdef FIX_2500_RENDCONF_REFACTOR if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); goto cleanup; } -#else - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) - { - if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" ); - goto cleanup; - } - } - else - { - fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); - goto cleanup; - } -#endif if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); diff --git a/apps/renderer.c b/apps/renderer.c index 8c48c97c6..c24586532 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1246,13 +1246,11 @@ int main( fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath ); goto cleanup; } -#ifdef FIX_2500_RENDCONF_REFACTOR if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) { fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); goto cleanup; } -#endif if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] ); @@ -1266,27 +1264,11 @@ int main( if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID; -#ifdef FIX_2500_RENDCONF_REFACTOR if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID ); goto cleanup; } -#else - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) - { - if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nInvalid room acoustics configuration parameters\n\n" ); - goto cleanup; - } - } - else - { - fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); - goto cleanup; - } -#endif } /* ISAR frame size is set from command line, not renderer config file. @@ -1731,27 +1713,11 @@ int main( args.aeSequence.selected = 0; } args.aeSequence.frameCounter = 0; -#ifdef FIX_2500_RENDCONF_REFACTOR if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] ); goto cleanup; } -#else - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) - { - if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Invalid acoustic environment configuration parameters\n\n" ); - goto cleanup; - } - } - else - { - fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] ); - goto cleanup; - } -#endif if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) ); diff --git a/lib_com/options.h b/lib_com/options.h index ceac8f9a8..cf5fe1f62 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,7 +98,6 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.251 V3.0 */ -#define FIX_2500_RENDCONF_REFACTOR /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ #define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 0101924f5..8f7399850 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1284,7 +1284,6 @@ static int32_t errorHandler( * * Verifies if the configuration parameters lie within acceptable limits *------------------------------------------------------------------------------------------*/ -#ifdef FIX_2500_RENDCONF_REFACTOR ivas_error RenderConfigReader_checkValues( RenderConfigReader *pRenderConfigReader /* i/o: Renderer configuration reader */ ) @@ -1432,93 +1431,6 @@ ivas_error RenderConfigReader_checkValues( return IVAS_ERR_OK; } -#else -ivas_error RenderConfigReader_checkValues( - IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ -) -{ - int16_t band_idx, tab_value_err_count; - IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoom_acoustics; - pRoom_acoustics = &hRenderConfig->roomAcoustics; - tab_value_err_count = 0; - int16_t wall_idx; - - /* Verify the number of frequency bands in the config input data */ - if ( ( pRoom_acoustics->nBands > N_BANDS_MAX ) || ( pRoom_acoustics->nBands < N_BANDS_MIN ) ) - { - return IVAS_ERR_WRONG_PARAMS; - } - /* Verify data per band in the acoustic properties table */ - for ( band_idx = 0; band_idx < pRoom_acoustics->nBands; band_idx++ ) - { - /* Verify if the frequencies are in the ascending order (required for interpolation) */ - if ( band_idx != 0 ) - { - if ( pRoom_acoustics->pFc_input_fx[band_idx] <= pRoom_acoustics->pFc_input_fx[band_idx - 1] ) - { - tab_value_err_count++; - } - } - - /* Replace zero DSR values with very small positive values, to avoid issues with coloration filter design */ - if ( pRoom_acoustics->pAcoustic_dsr_fx[band_idx] == 0 ) - { - pRoom_acoustics->pAcoustic_dsr_fx[band_idx] = ACOUSTIC_DSR_EPSILON_FX; - } - } - - if ( tab_value_err_count != 0 ) - { - return IVAS_ERR_WRONG_PARAMS; - } - - - if ( pRoom_acoustics->use_er == 1 ) - { - /* Room dimensions */ - if ( pRoom_acoustics->dimensions.x_fx < ER_MIN_ROOM_DIMENSION_FX ) - { - pRoom_acoustics->dimensions.x_fx = ER_MIN_ROOM_DIMENSION_FX; - } - if ( pRoom_acoustics->dimensions.x_fx > ER_MAX_ROOM_DIMENSION_FX ) - { - pRoom_acoustics->dimensions.x_fx = ER_MAX_ROOM_DIMENSION_FX; - } - if ( pRoom_acoustics->dimensions.y_fx < ER_MIN_ROOM_DIMENSION_FX ) - { - pRoom_acoustics->dimensions.y_fx = ER_MIN_ROOM_DIMENSION_FX; - } - if ( pRoom_acoustics->dimensions.y_fx > ER_MAX_ROOM_DIMENSION_FX ) - { - pRoom_acoustics->dimensions.y_fx = ER_MAX_ROOM_DIMENSION_FX; - } - if ( pRoom_acoustics->dimensions.z_fx < ER_MIN_ROOM_DIMENSION_FX ) - { - pRoom_acoustics->dimensions.z_fx = ER_MIN_ROOM_DIMENSION_FX; - } - if ( pRoom_acoustics->dimensions.z_fx > ER_MAX_ROOM_DIMENSION_FX ) - { - pRoom_acoustics->dimensions.z_fx = ER_MAX_ROOM_DIMENSION_FX; - } - - /* Abs Coeff */ - for ( wall_idx = 0; wall_idx < IVAS_ROOM_ABS_COEFF; wall_idx++ ) - { - if ( pRoom_acoustics->AbsCoeff_fx[wall_idx] < ER_MIN_ABS_COEFF_FX ) - { - pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MIN_ABS_COEFF_FX; - } - if ( pRoom_acoustics->AbsCoeff_fx[wall_idx] > ER_MAX_ABS_COEFF_FX ) - { - pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MAX_ABS_COEFF_FX; - } - } - } - - - return IVAS_ERR_OK; -} -#endif /*------------------------------------------------------------------------------------------* * RenderConfigReader_open() @@ -3127,26 +3039,8 @@ ivas_error RenderConfigReader_getAcousticEnvironment( #endif pAcEnv->nBands = (int16_t) pRenderConfigReader->pAE[n].pFG->nrBands; pAcEnv->inputPreDelay_fx = (Word32) ( pRenderConfigReader->pAE[n].preDelay * ONE_IN_Q27 ); -#ifndef FIX_2500_RENDCONF_REFACTOR - if ( pRenderConfigReader->pAE[n].preDelay > INPUTPREDELAY_MAX || - pRenderConfigReader->pAE[n].preDelay < INPUTPREDELAY_MIN ) - { - return IVAS_ERR_INVALID_RENDER_CONFIG; - } -#endif for ( m = 0; m < pAcEnv->nBands; m++ ) { -#ifndef FIX_2500_RENDCONF_REFACTOR - if ( pRenderConfigReader->pAE[n].pFG->pFc[m] > FC_INPUT_MAX || - pRenderConfigReader->pAE[n].pFG->pFc[m] < FC_INPUT_MIN || - pRenderConfigReader->pAE[n].pRT60[m] > ACOUSTIC_RT60_MAX || - pRenderConfigReader->pAE[n].pRT60[m] < ACOUSTIC_RT60_MIN || - pRenderConfigReader->pAE[n].pDSR[m] > ACOUSTIC_DSR_MAX || - pRenderConfigReader->pAE[n].pDSR[m] < ACOUSTIC_DSR_MIN ) - { - return IVAS_ERR_INVALID_RENDER_CONFIG; - } -#endif pAcEnv->pFc_input_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pFG->pFc[m] * ONE_IN_Q16 ); pAcEnv->pAcoustic_rt60_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pRT60[m] * ONE_IN_Q26 ); @@ -3282,15 +3176,6 @@ ivas_error RenderConfigReader_getDirectivity( /* Convert to Word16 */ FOR( n = 0; n < 4; n++ ) { -#ifndef FIX_2500_RENDCONF_REFACTOR -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION - /* Verify range of directivity patterns */ - /* Range needs to be checked before converting to fixed point -- different from float */ - directivity[n * 3] = max( 0.0f, min( 360.0f, directivity[n * 3] ) ); - directivity[n * 3 + 1] = max( 0.0f, min( 360.0f, directivity[n * 3 + 1] ) ); - directivity[n * 3 + 2] = max( 0.0f, min( 1.0f, directivity[n * 3 + 2] ) ); -#endif -#endif directivity_fx[n * 3] = (Word16) ( directivity[n * 3] * ( 1u << 6 ) ); directivity_fx[n * 3 + 1] = (Word16) ( directivity[n * 3 + 1] * ( 1u << 6 ) ); @@ -3330,15 +3215,6 @@ ivas_error RenderConfigReader_getDistanceAttenuation( /* Convert to Word32 */ #ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION -#ifndef FIX_2500_RENDCONF_REFACTOR - /* Range needs to be checked before converting to fixed point -- different from float */ - /* Verify range of distance attenuation parameters: refDist: 0.0 <= distAtt[1] <= 6.3 */ - /* maxDist: distAtt[1] <= distAtt[0] <= 63.0 */ - /* rollOffFactor: 0 <= distAtt[2] <= 4.0 */ - distAtt[1] = min( max( 0, distAtt[1] ), DIST_ATT_MAX_REFDIST ); - distAtt[0] = min( max( distAtt[1], distAtt[0] ), DIST_ATT_MAX_MAXDIST ); - distAtt[2] = min( max( 0.0f, distAtt[2] ), DIST_ATT_MAX_ROLLOFF ); -#endif distAtt_fx[0] = (Word32) ( distAtt[0] * ( 1u << 25 ) ); distAtt_fx[1] = (Word32) ( distAtt[1] * ( 1u << 28 ) ); distAtt_fx[2] = (Word32) ( distAtt[2] * ( 1u << 28 ) ); diff --git a/lib_util/render_config_reader.h b/lib_util/render_config_reader.h index 54180eabb..35bcc981a 100644 --- a/lib_util/render_config_reader.h +++ b/lib_util/render_config_reader.h @@ -79,11 +79,7 @@ ivas_error RenderConfigReader_getDistanceAttenuation( ); /* Verifies configuration parameters */ ivas_error RenderConfigReader_checkValues( -#ifdef FIX_2500_RENDCONF_REFACTOR RenderConfigReader *pRenderConfigReader /* i/o: Renderer configuration reader */ -#else - IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ -#endif ); /* Reads a configuration */ -- GitLab From aee191177081e8c9d368f77e3592e9ab66cbc9cf Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:41 +0200 Subject: [PATCH 22/49] Accept FIX_BASOP_2023_TDREND_DISTATT_PRECISION --- apps/decoder.c | 4 -- lib_com/common_api_types.h | 10 ---- lib_com/ivas_cnst.h | 2 - lib_com/ivas_prot_fx.h | 4 -- lib_com/options.h | 2 - lib_dec/ivas_objectRenderer_internal_fx.c | 10 ---- lib_rend/ivas_objectRenderer_fx.c | 55 ------------------- lib_rend/ivas_objectRenderer_mix_fx.c | 14 ----- lib_rend/ivas_objectRenderer_sources_fx.c | 66 ----------------------- lib_rend/ivas_objectRenderer_vec_fx.c | 10 ---- lib_rend/ivas_render_config_fx.c | 9 ---- lib_rend/ivas_stat_rend.h | 10 ---- lib_util/float_to_fix_ops.c | 4 -- lib_util/float_to_fix_ops.h | 2 - lib_util/render_config_reader.c | 12 ----- lib_util/rotation_file_reader.c | 14 ----- 16 files changed, 228 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 110500290..8bc03bcd6 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1658,11 +1658,7 @@ static void resetHeadRotation( pPos[i].x_fx = 0; pPos[i].y_fx = 0; pPos[i].z_fx = 0; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION pPos[i].q_fact = 31; -#else - pPos[i].q_fact = 25; -#endif } return; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 3b366fb4c..67204e73d 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -63,10 +63,8 @@ #define IVAS_ER_LIST_HEIGHT 1.6f #define IVAS_ER_LIST_HEIGHT_FX 6710886 /* 1.6f in Q.22 */ #define IVAS_DEFAULT_AEID 65535 -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION #define IVAS_LISTENER_POSITION_MAX 327.67f #define IVAS_LISTENER_POSITION_MAX_Q22 1374347592 /* 327.67 in Q22 */ -#endif /* JBM constants for adaptive-playout */ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ @@ -164,11 +162,7 @@ typedef struct float x, y, z; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word32 x_fx, y_fx, z_fx; /* q_fact, q_fact, q_fact */ -#else - Word32 x_fx, y_fx, z_fx; -#endif Word16 q_fact; } IVAS_VECTOR3; @@ -359,11 +353,7 @@ typedef struct _IVAS_RENDER_CONFIG float directivity[IVAS_MAX_NUM_OBJECTS * 3]; Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3]; // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15} float distAtt[3]; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word32 distAtt_fx[3]; /* {Q25, Q28, Q28} */ -#else - Word32 distAtt_fx[3]; /* {Q27, Q30, Q30} */ -#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9c6c82507..057265f6f 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1588,11 +1588,9 @@ typedef enum #define RESAMPLE_FACTOR_16_48_FX ( 5461 ) // Q14 #define RESAMPLE_FACTOR_32_48_FX ( 10922 ) // Q14 -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION #define DIST_ATT_DEFAULT_MAXDIST_Q25 528482304 /* Q25 */ /* Default maxDist based on maximum radius in encoded metadata (2^ISM_RADIUS_NBITS-1)*0.25 */ #define DIST_ATT_DEFAULT_REFDIST_Q28 ONE_IN_Q28 /* Q28 */ /* Default refDist 1.0 in Q28 */ #define DIST_ATT_DEFAULT_ROLLOFF_Q28 ONE_IN_Q28 /* Q28 */ /* Default rolloffFactor 1.0 in Q28 */ -#endif /* ----- Enums - TD Renderer ----- */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index f1c673750..b76bcd313 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1928,12 +1928,8 @@ ivas_error TDREND_MIX_LIST_SetOrient_fx( void TDREND_MIX_LIST_SetPos_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION const Word32 *Pos_p, /* i : Listener's position */ const Word16 Pos_q /* i : Listener's position Q */ -#else - const Word32 *Pos_p /* i : Listener's position */ -#endif ); ivas_error TDREND_Update_listener_orientation_fx( diff --git a/lib_com/options.h b/lib_com/options.h index cf5fe1f62..ee42629bb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,8 +98,6 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.251 V3.0 */ -#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ -#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX /* Eri: Bug discovered in cleanup of basop issue 2023 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 8806a6aef..0f6055bed 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -264,16 +264,6 @@ ivas_error ivas_td_binaural_renderer_sf_fx( enableCombinedOrientation = st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx]; move16(); -#ifndef FIX_BASOP_2023_TDREND_DISTATT_PRECISION - /* Shifting x_fx, y_fx, z_fx to the same Q-factor as Listener_p->Pos_q (usually Q25) */ - Word16 pos_q = st_ivas->hBinRendererTd->Listener_p->Pos_q; - move16(); - tmp_vector_fx->x_fx = L_shr( tmp_vector_fx->x_fx, sub( tmp_vector_fx->q_fact, pos_q ) ); - tmp_vector_fx->y_fx = L_shr( tmp_vector_fx->y_fx, sub( tmp_vector_fx->q_fact, pos_q ) ); - tmp_vector_fx->z_fx = L_shr( tmp_vector_fx->z_fx, sub( tmp_vector_fx->q_fact, pos_q ) ); - tmp_vector_fx->q_fact = pos_q; - move16(); -#endif } ELSE { diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 5266824fe..cff5ff172 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -202,21 +202,12 @@ ivas_error ivas_td_binaural_open_unwrap_fx( DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 move16(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION DistAtten.MaxDist_fx = DIST_ATT_DEFAULT_MAXDIST_Q25; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/ move32(); DistAtten.RefDist_fx = DIST_ATT_DEFAULT_REFDIST_Q28; // Q28 move32(); DistAtten.RollOffFactor_fx = DIST_ATT_DEFAULT_ROLLOFF_Q28; // Q28 move32(); -#else - DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ - move32(); - DistAtten.RefDist_fx = ONE_IN_Q30; // Q30 - move32(); - DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30 - move32(); -#endif // TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; IF( NE_32( ( error = TDREND_MIX_SRC_SetPos_fx( pBinRendTd, nS, Pos_fx ) ), IVAS_ERR_OK ) ) @@ -271,21 +262,12 @@ ivas_error ivas_td_binaural_open_unwrap_fx( { DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 move16(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION DistAtten.MaxDist_fx = DIST_ATT_DEFAULT_MAXDIST_Q25; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/ move32(); DistAtten.RefDist_fx = DIST_ATT_DEFAULT_REFDIST_Q28; // Q28 move32(); DistAtten.RollOffFactor_fx = DIST_ATT_DEFAULT_ROLLOFF_Q28; // Q28 move32(); -#else - DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ - move32(); - DistAtten.RefDist_fx = ONE_IN_Q30; // Q30 - move32(); - DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30 - move32(); -#endif } ELSE { @@ -738,9 +720,7 @@ ivas_error TDREND_Update_listener_orientation_fx( Word32 Rmat_fx[3][3]; Word16 orient_q, headPosition_q; Word32 Pos_p_fx[3]; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 Pos_q; -#endif ivas_error error; IF( headRotEnabled ) @@ -779,9 +759,7 @@ ivas_error TDREND_Update_listener_orientation_fx( Pos_p_fx[0] = ( *Pos_fx ).x_fx; // Q Pos_fx->q_fact Pos_p_fx[1] = ( *Pos_fx ).y_fx; // Q Pos_fx->q_fact Pos_p_fx[2] = ( *Pos_fx ).z_fx; // Q Pos_fx->q_fact -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Pos_q = ( *Pos_fx ).q_fact; -#endif } ELSE { @@ -789,16 +767,12 @@ ivas_error TDREND_Update_listener_orientation_fx( Pos_p_fx[0] = 0; Pos_p_fx[1] = 0; Pos_p_fx[2] = 0; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Pos_q = Q31; -#endif } move32(); move32(); move32(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION move16(); -#endif } ELSE { @@ -827,18 +801,12 @@ ivas_error TDREND_Update_listener_orientation_fx( move32(); Pos_p_fx[2] = 0; move32(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Pos_q = Q31; move16(); -#endif } /* Set the listener position and orientation:*/ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION TDREND_MIX_LIST_SetPos_fx( hBinRendererTd, Pos_p_fx, Pos_q ); -#else - TDREND_MIX_LIST_SetPos_fx( hBinRendererTd, Pos_p_fx ); -#endif error = TDREND_MIX_LIST_SetOrient_fx( hBinRendererTd, FrontVec_fx, UpVec_fx, orient_q ); @@ -1021,49 +989,26 @@ ivas_error ivas_td_binaural_renderer_ext_fx( { Word16 idx = subframe_idx; move16(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 pos_q = Q31; -#else - Word16 pos_q = Q25; -#endif move16(); test(); IF( *hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->listenerPos != NULL ) { -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION #ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX ( *hCombinedOrientationData )->listenerPos[idx].q_fact = pos_q; #else pos_q = ( *hCombinedOrientationData )->listenerPos[idx].q_fact; #endif move16(); -#else - ( *hCombinedOrientationData )->listenerPos[idx].x_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].x_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) ); - move32(); - ( *hCombinedOrientationData )->listenerPos[idx].y_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].y_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) ); - move32(); - ( *hCombinedOrientationData )->listenerPos[idx].z_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].z_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) ); - move32(); - ( *hCombinedOrientationData )->listenerPos[idx].q_fact = pos_q; - move16(); -#endif } FOR( Word16 i = 0; i < 3; i++ ) { pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = L_shr( pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], sub( pTDRend->hBinRendererTd->Listener_p->Pos_q, pos_q ) ); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION - move32(); -#else - pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; move32(); - move16(); -#endif } -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; move16(); -#endif } IF( NE_32( ( error = ivas_td_binaural_renderer_unwrap_fx( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData, diff --git a/lib_rend/ivas_objectRenderer_mix_fx.c b/lib_rend/ivas_objectRenderer_mix_fx.c index 088d6bda3..a162c2ae0 100644 --- a/lib_rend/ivas_objectRenderer_mix_fx.c +++ b/lib_rend/ivas_objectRenderer_mix_fx.c @@ -55,12 +55,8 @@ static ivas_error DefaultBSplineModel_fx( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, void TDREND_MIX_LIST_SetPos_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION const Word32 *Pos_p, /* i : Listener's position */ const Word16 Pos_q /* i : Listener's position Q */ -#else - const Word32 *Pos_p /* i : Listener's position */ // Q Pos_fx->q_fact -#endif ) { TDREND_MIX_Listener_t *Listener_p; @@ -68,19 +64,13 @@ void TDREND_MIX_LIST_SetPos_fx( Listener_p = hBinRendererTd->Listener_p; test(); test(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION test(); IF( NE_32( Pos_p[0], Listener_p->Pos_fx[0] ) || NE_32( Pos_p[1], Listener_p->Pos_fx[1] ) || NE_32( Pos_p[2], Listener_p->Pos_fx[2] ) || NE_16( Pos_q, Listener_p->Pos_q ) ) -#else - IF( NE_32( Pos_p[0], Listener_p->Pos_fx[0] ) || NE_32( Pos_p[1], Listener_p->Pos_fx[1] ) || NE_32( Pos_p[2], Listener_p->Pos_fx[2] ) ) -#endif { /* Set position */ Copy32( Pos_p, Listener_p->Pos_fx, 3 ); // Q Pos_fx->q_fact -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Listener_p->Pos_q = Pos_q; move16(); -#endif /* Set pose update flag */ Listener_p->PoseUpdated = TRUE; @@ -212,11 +202,7 @@ ivas_error TDREND_MIX_Init_fx( } /* Init virtual and rendering listeners for spatial mixers */ TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Pos_fx, 0, 0, 0 ); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION hBinRendererTd->Listener_p->Pos_q = Q31; -#else - hBinRendererTd->Listener_p->Pos_q = Q25; -#endif move16(); TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Vel_fx, 0, 0, 0 ); TDREND_SPATIAL_VecInit_fx( hBinRendererTd->Listener_p->Front_fx, 0, 0, -ONE_IN_Q30 ); diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index 14f2e3a8b..de17d46b6 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -319,9 +319,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( Word32 ListRelPos[3]; Word32 ListRelDist; Word32 ListRelPosAbs[3]; /* Relative position, ignoring orientation of listener */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 ListRelPosAbs_e; -#endif Word32 Azim, Elev; Word32 hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word32 hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; @@ -333,11 +331,9 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( Word16 pan; #endif Word32 wrapped_angle; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 pos_q; Word32 Src_p_tmp[3]; Word32 Listener_p_tmp[3]; -#endif /* Evaluate the HR filters from the source and listener positions and orientations */ Listener_p = hBinRendererTd->Listener_p; @@ -349,17 +345,12 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( { /* Absolute position */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Align to smallest common Q-factor */ pos_q = s_min( SrcSpatial_p->q_Pos_p, Listener_p->Pos_q ); Copy_Scale_sig32( SrcSpatial_p->Pos_p_fx, Src_p_tmp, 3, sub( pos_q, SrcSpatial_p->q_Pos_p ) ); Copy_Scale_sig32( Listener_p->Pos_fx, Listener_p_tmp, 3, sub( pos_q, Listener_p->Pos_q ) ); TDREND_SPATIAL_VecMapToNewCoordSystem_fx( Src_p_tmp, Listener_p_tmp, Listener_p->Front_fx, Listener_p->Up_fx, Listener_p->Right_fx, ListRelPos, ListRelPosAbs ); ListRelPos_e = sub( 32, pos_q ); // output q of above function is pos_q + Q30 - 31. so exp will be 62 - pos_q - 30 = 32 - pos_q -#else - TDREND_SPATIAL_VecMapToNewCoordSystem_fx( SrcSpatial_p->Pos_p_fx, Listener_p->Pos_fx, Listener_p->Front_fx, Listener_p->Up_fx, Listener_p->Right_fx, ListRelPos, ListRelPosAbs ); - ListRelPos_e = 7; // output q of above function is Q25 + Q30 - 31. so exp will be 62 - Q25 - Q30. -#endif move16(); ListRelDist = TDREND_SPATIAL_VecNorm_fx( ListRelPos, ListRelPos_e, &ListRelDist_e ); @@ -399,12 +390,8 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( move16(); IF( SrcSpatial_p->DirAttenEnabled ) { -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION ListRelPosAbs_e = sub( 31, pos_q ); *SrcRend_p->DirGain_p_fx = TDREND_SRC_SPATIAL_GetDirGain_fx( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p_fx, ListRelPosAbs, ListRelPosAbs_e ); -#else - *SrcRend_p->DirGain_p_fx = TDREND_SRC_SPATIAL_GetDirGain_fx( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p_fx, ListRelPosAbs, 6 ); -#endif } /* Distance gain */ @@ -488,7 +475,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( set32_fx( hrf_left, 0, *filterlength ); set32_fx( hrf_right, 0, *filterlength ); #ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION IF( LT_32( L_add( ONE_IN_Q25, SrcSpatial_p->Pos_p_fx[1] ), 0 ) ) { wrapped_angle = L_negate( L_add( ONE_IN_Q26, SrcSpatial_p->Pos_p_fx[1] ) ); @@ -503,17 +489,10 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( move32(); } pan = add( extract_h( L_shr( wrapped_angle, sub( SrcSpatial_p->q_Pos_p, Q21 ) ) ), 32 ); -#else - pan = add( mult_r( extract_h( SrcSpatial_p->Pos_p_fx[1] ), 2048 ), 32 ); -#endif hrf_left[0] = L_shl_r( cos_table_129[64 - pan], 10 ); hrf_right[0] = L_shl_r( cos_table_129[pan], 10 ); #else -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION hrf_left[0] = L_shr( L_add( L_shl( SrcSpatial_p->Pos_p_fx[1], sub( Q25, SrcSpatial_p->q_Pos_p ) ), ONE_IN_Q25 ), 1 ); // Q25 -#else - hrf_left[0] = L_shr( L_add( SrcSpatial_p->Pos_p_fx[1], ONE_IN_Q25 ), 1 ); // Q25 -#endif move32(); hrf_right[0] = L_sub( ONE_IN_Q25, hrf_left[0] ); // Q25 move32(); @@ -685,21 +664,12 @@ static void TDREND_SRC_SPATIAL_Init_fx( move16(); SrcSpatial_p->DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0 move16(); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION SrcSpatial_p->DistAtten.RefDist_fx = DIST_ATT_DEFAULT_REFDIST_Q28; // Q28 move32(); SrcSpatial_p->DistAtten.MaxDist_fx = DIST_ATT_DEFAULT_MAXDIST_Q25; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/ move32(); SrcSpatial_p->DistAtten.RollOffFactor_fx = DIST_ATT_DEFAULT_ROLLOFF_Q28; // Q28 move16(); -#else - SrcSpatial_p->DistAtten.RefDist_fx = ONE_IN_Q30; // Q30 - move32(); - SrcSpatial_p->DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ - move32(); - SrcSpatial_p->DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30 - move16(); -#endif return; } @@ -891,70 +861,34 @@ static Word16 TDREND_SRC_SPATIAL_GetDistGain_fx( { case TDREND_DIST_ATTEN_MODEL_INV_DIST: /* DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor ); */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 3) */ tmp32 = L_deposit_h( tmp16 ); /* tmp32 is Q(31 - Dist_s + Dist2_e - 3) */ /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 3) = Dist_s - Dist2_e + 3, RollOffFactor_fx exponent: 31 - 28 = 3 */ tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 3 ), DistAtten_p->RollOffFactor_fx, 3, &tmp_e ); /* Q(31 - tmp_e) */ -#else - tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 1) */ - tmp32 = L_deposit_h( tmp16 ); /* tmp32 is Q(31 - Dist_s + Dist2_e - 1) */ - /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 30 = 1 */ - tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 1, &tmp_e ); /* Q(31 - tmp_e) */ -#endif BREAK; case TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED: -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION flag = BASOP_Util_Cmp_Mant32Exp( Dist2_fx, Dist2_e, DistAtten_p->RefDist_fx, 3 ); -#else - flag = BASOP_Util_Cmp_Mant32Exp( Dist2_fx, Dist2_e, DistAtten_p->RefDist_fx, 1 ); -#endif IF( flag < 0 ) { -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Dist2_fx = DistAtten_p->RefDist_fx; // Q28 move32(); Dist2_e = 3; move16(); -#else - Dist2_fx = DistAtten_p->RefDist_fx; // Q30 - move32(); - Dist2_e = 1; - move16(); -#endif } -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION flag = BASOP_Util_Cmp_Mant32Exp( Dist2_fx, Dist2_e, DistAtten_p->MaxDist_fx, 6 /*Q25*/ ); -#else - flag = BASOP_Util_Cmp_Mant32Exp( Dist2_fx, Dist2_e, DistAtten_p->MaxDist_fx, 4 ); -#endif IF( flag > 0 ) { -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Dist2_fx = DistAtten_p->MaxDist_fx; // Q25 move32(); Dist2_e = 6; move16(); -#else - Dist2_fx = DistAtten_p->MaxDist_fx; // Q27 - move32(); - Dist2_e = 4; - move16(); -#endif } /* DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor ); */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 3) */ tmp32 = L_deposit_h( tmp16 ); /* tmp32 is Q(31 - Dist_s + Dist2_e - 3) */ /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 3) = Dist_s - Dist2_e + 3, RollOffFactor_fx exponent: 31 - 28 = 3 */ tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 3 ), DistAtten_p->RollOffFactor_fx, 3, &tmp_e ); /* Q(31 - tmp_e) */ -#else - tmp16 = BASOP_Util_Divide3232_Scale( DistAtten_p->RefDist_fx, Dist2_fx, &Dist_s ); /* tmp16 is Q(15 - Dist_s + Dist2_e - 1) */ - tmp32 = L_deposit_h( tmp16 ); /* tmp32 is Q(31 - Dist_s + Dist2_e - 1) */ - /* tmp32 exponent: 31 - (31 - Dist_s + Dist2_e - 1) = Dist_s - Dist2_e + 1, RollOffFactor_fx exponent: 31 - 30 = 1 */ - tmp32 = BASOP_Util_fPow( tmp32, add( sub( Dist_s, Dist2_e ), 1 ), DistAtten_p->RollOffFactor_fx, 1, &tmp_e ); /* Q(31 - tmp_e) */ -#endif BREAK; } diff --git a/lib_rend/ivas_objectRenderer_vec_fx.c b/lib_rend/ivas_objectRenderer_vec_fx.c index 995e6b787..7c56a840a 100644 --- a/lib_rend/ivas_objectRenderer_vec_fx.c +++ b/lib_rend/ivas_objectRenderer_vec_fx.c @@ -77,17 +77,12 @@ Word32 TDREND_SPATIAL_VecNorm_fx( { Word32 tmp; Word16 tmp_e; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word32 tmp_Vec[3]; /* Create 1-bit headroom */ Copy_Scale_sig32( Vec_p, tmp_Vec, 3, -1 ); tmp = L_add( L_add( Mpy_32_32( tmp_Vec[0], Vec_p[0] ), Mpy_32_32( tmp_Vec[1], Vec_p[1] ) ), Mpy_32_32( tmp_Vec[2], Vec_p[2] ) ); tmp_e = add( shl( in_exp, 1 ), 1 ); // 2 * in_exp + 1 -#else - tmp = L_add( L_add( Mpy_32_32( Vec_p[0], Vec_p[0] ), Mpy_32_32( Vec_p[1], Vec_p[1] ) ), Mpy_32_32( Vec_p[2], Vec_p[2] ) ); - tmp_e = shl( in_exp, 1 ); // 2 * in_exp -#endif tmp = Sqrt32( tmp, &tmp_e ); *out_exp = tmp_e; move16(); @@ -104,17 +99,12 @@ void TDREND_SPATIAL_VecNormalize_fx( Word32 scaler_fx; Word32 sqrd_sum; Word16 exp, shift; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word32 tmp_Vec[3]; /* Create 1-bit headroom */ Copy_Scale_sig32( Vec_p_fx, tmp_Vec, 3, -1 ); sqrd_sum = L_add( Mpy_32_32( tmp_Vec[0], Vec_p_fx[0] ), L_add( Mpy_32_32( tmp_Vec[1], Vec_p_fx[1] ), Mpy_32_32( tmp_Vec[2], Vec_p_fx[2] ) ) ); exp = add( shl( sub( 31, q ), 1 ), 1 ); -#else - sqrd_sum = L_add( Mpy_32_32( Vec_p_fx[0], Vec_p_fx[0] ), L_add( Mpy_32_32( Vec_p_fx[1], Vec_p_fx[1] ), Mpy_32_32( Vec_p_fx[2], Vec_p_fx[2] ) ) ); - exp = shl( sub( 31, q ), 1 ); -#endif scaler_fx = ISqrt32( sqrd_sum, &exp ); VecNorm_p_fx[0] = Mpy_32_32( scaler_fx, Vec_p_fx[0] ); // Q: ( q + ( 31 - exp ) ) - 31 diff --git a/lib_rend/ivas_render_config_fx.c b/lib_rend/ivas_render_config_fx.c index efd794501..0cc4fa48c 100644 --- a/lib_rend/ivas_render_config_fx.c +++ b/lib_rend/ivas_render_config_fx.c @@ -152,21 +152,12 @@ ivas_error ivas_render_config_init_from_rom_fx( ( *hRenderConfig )->directivity_fx[add( i_mult( i, 3 ), 2 )] = 32767 /*1.0f in Q15*/; /* Back attenuation */ move16(); } -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION ( *hRenderConfig )->distAtt_fx[0] = DIST_ATT_DEFAULT_MAXDIST_Q25; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/ /* Default max dist */ move32(); ( *hRenderConfig )->distAtt_fx[1] = DIST_ATT_DEFAULT_REFDIST_Q28; // Q28 /* Default ref dist */ move32(); ( *hRenderConfig )->distAtt_fx[2] = DIST_ATT_DEFAULT_ROLLOFF_Q28; // Q28 /* Default rolloff factor */ move32(); -#else - ( *hRenderConfig )->distAtt_fx[0] = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ /* Default max dist */ - move32(); - ( *hRenderConfig )->distAtt_fx[1] = ONE_IN_Q30; // Q30 /* Default ref dist */ - move32(); - ( *hRenderConfig )->distAtt_fx[2] = ONE_IN_Q30; // Q30 /* Default rolloff factor */ - move32(); -#endif ( *hRenderConfig )->split_rend_config.splitRendBitRate = ISAR_MAX_SPLIT_REND_BITRATE; move32(); ( *hRenderConfig )->split_rend_config.dof = 3; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d785ed933..85434651c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1186,15 +1186,9 @@ typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct typedef struct { TDREND_DistAttenModel_t DistAttenModel; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word32 RefDist_fx; /* Q28 */ Word32 MaxDist_fx; /* Q25 */ Word32 RollOffFactor_fx; /* Q28 */ -#else - Word32 RefDist_fx; /* Q30 */ - Word32 MaxDist_fx; /* Q27 */ - Word32 RollOffFactor_fx; /* Q30 */ -#endif } TDREND_DistAtten_t; @@ -1232,11 +1226,7 @@ typedef struct { Word16 Updated; TDREND_PosType_t PosType; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word32 Pos_p_fx[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; // Q q_Pos_p -#else - Word32 Pos_p_fx[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; // Q25 -#endif Word16 q_Pos_p; Word32 Front_p_fx[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; // Q30 Word16 DirAttenEnabled; diff --git a/lib_util/float_to_fix_ops.c b/lib_util/float_to_fix_ops.c index 5da59c51e..34c5f3a67 100644 --- a/lib_util/float_to_fix_ops.c +++ b/lib_util/float_to_fix_ops.c @@ -3,9 +3,7 @@ #include "float_to_fix_ops.h" #include #include -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION #include -#endif #define Q15 15 #define Q31 31 @@ -131,7 +129,6 @@ Word32 floatToFixed_32( } -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 float_to_fix_find_q( const float val ) { @@ -149,4 +146,3 @@ Word16 float_to_fix_find_q( /* Subtract bias of 127 (from floating point format), add 1 and subtract result from 31 to get Q */ return (Word16) ( 31 - ( biased_exp - 127 + 1 ) ); } -#endif diff --git a/lib_util/float_to_fix_ops.h b/lib_util/float_to_fix_ops.h index 8559a872b..be23e5a16 100644 --- a/lib_util/float_to_fix_ops.h +++ b/lib_util/float_to_fix_ops.h @@ -16,8 +16,6 @@ float fixedToFloat( const Word32 i, const Word16 Q ); float fix16_to_float( const Word16 number, const Word16 Q ); -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION Word16 float_to_fix_find_q( const float val ); -#endif #endif /* FLOAT_TO_FIX_OPS_H */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 8f7399850..3d95f6e11 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -81,7 +81,6 @@ #define IVAS_ER_LIST_ORIGIN_X_FX 0 #define IVAS_ER_LIST_ORIGIN_Y_FX 0 -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION #define DIST_ATT_MIN_MAXDIST 0.0f #define DIST_ATT_MIN_REFDIST 0.0f #define DIST_ATT_MIN_ROLLOFF 0.0f @@ -95,7 +94,6 @@ #define DIRECTIVITY_MAX_ANGLE 360.0f #define DIRECTIVITY_MIN_ATT_FAC 0.0f #define DIRECTIVITY_MAX_ATT_FAC 1.0f -#endif #ifndef min #define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) @@ -168,11 +166,7 @@ struct RenderConfigReader AcousticEnv *pAE; /* Acoustic environments */ uint32_t nDP; /* Number of directivity patterns */ DirectrivityPat *pDP; /* Directivity Pattern */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION float distAtt[3]; /* [MaxDist Q25, RefDist Q28, Rolloff Q28] */ -#else - float distAtt[3]; /* [MaxDist Q30, RefDist Q30, Rolloff Q30] */ -#endif }; @@ -3214,15 +3208,9 @@ ivas_error RenderConfigReader_getDistanceAttenuation( } /* Convert to Word32 */ -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION distAtt_fx[0] = (Word32) ( distAtt[0] * ( 1u << 25 ) ); distAtt_fx[1] = (Word32) ( distAtt[1] * ( 1u << 28 ) ); distAtt_fx[2] = (Word32) ( distAtt[2] * ( 1u << 28 ) ); -#else - distAtt_fx[0] = (Word32) ( distAtt[0] * ( 1u << 27 ) ); - distAtt_fx[1] = (Word32) ( distAtt[1] * ( 1u << 30 ) ); - distAtt_fx[2] = (Word32) ( distAtt[2] * ( 1u << 30 ) ); -#endif return IVAS_ERR_OK; } diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index 1701f285b..8ee59902c 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -42,7 +42,6 @@ #define Q29 29 #define Q31 31 -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION #ifndef min #define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) #endif @@ -50,7 +49,6 @@ #ifndef max #define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) #endif -#endif struct RotFileReader @@ -116,9 +114,7 @@ ivas_error HeadRotationFileReading( { float w, x, y, z; float posx, posy, posz; -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION float maxAbsPos; -#endif int32_t read_values; posx = 0.0f; @@ -159,7 +155,6 @@ ivas_error HeadRotationFileReading( if ( pPos != NULL ) { -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION posx = min( max( -IVAS_LISTENER_POSITION_MAX, posx ), IVAS_LISTENER_POSITION_MAX ); posy = min( max( -IVAS_LISTENER_POSITION_MAX, posy ), IVAS_LISTENER_POSITION_MAX ); posz = min( max( -IVAS_LISTENER_POSITION_MAX, posz ), IVAS_LISTENER_POSITION_MAX ); @@ -170,15 +165,6 @@ ivas_error HeadRotationFileReading( pPos->x_fx = floatToFixed_32( posx, pPos->q_fact ); pPos->y_fx = floatToFixed_32( posy, pPos->q_fact ); pPos->z_fx = floatToFixed_32( posz, pPos->q_fact ); -#else - pPos->x = posx; - pPos->y = posy; - pPos->z = posz; - pPos->x_fx = floatToFixed_32( posx, Q25 ); - pPos->y_fx = floatToFixed_32( posy, Q25 ); - pPos->z_fx = floatToFixed_32( posz, Q25 ); - pPos->q_fact = Q25; -#endif } return IVAS_ERR_OK; -- GitLab From 09edd649588a01d6c57ba81e8b086def845ba375 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:43 +0200 Subject: [PATCH 23/49] Accept FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX --- lib_rend/ivas_objectRenderer_fx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index cff5ff172..797d7bcf1 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -995,11 +995,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( test(); IF( *hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->listenerPos != NULL ) { -#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX ( *hCombinedOrientationData )->listenerPos[idx].q_fact = pos_q; -#else - pos_q = ( *hCombinedOrientationData )->listenerPos[idx].q_fact; -#endif move16(); } FOR( Word16 i = 0; i < 3; i++ ) -- GitLab From 7547df03d4e6ba40b0f5749254dfa11bcc6f20fe Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:45 +0200 Subject: [PATCH 24/49] Accept FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW --- apps/renderer.c | 6 ---- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_svd_dec_fx.c | 3 -- lib_rend/ivas_objectRenderer_sources_fx.c | 11 ------ lib_rend/lib_rend_fx.c | 41 ----------------------- 6 files changed, 64 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index c24586532..7b52ad0b6 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3169,11 +3169,7 @@ static void IsmPositionProvider_getNextFrame( } -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Wrap azimuth to lie within (0, 360] range */ -#else - /* Wrap azimuth to lie within (-180, 180] range */ -#endif while ( LT_32( objectMetadataBuffer->positions[objIdx].azimuth_fx, 0 ) ) { @@ -3184,13 +3180,11 @@ static void IsmPositionProvider_getNextFrame( objectMetadataBuffer->positions[objIdx].azimuth_fx = L_sub( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 ); } -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW IF( objectMetadataBuffer->positions[objIdx].non_diegetic_flag && objectMetadataBuffer->positions[objIdx].azimuth_fx >= DEG_180_IN_Q22 ) { /* Wrap azimuth to lie within [-180, 180) range for non-diegetic panning */ objectMetadataBuffer->positions[objIdx].azimuth_fx = L_sub( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 ); } -#endif /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].elevation_fx = L_min( L_max( objectMetadataBuffer->positions[objIdx].elevation_fx, -DEG_90_IN_Q22 ), DEG_90_IN_Q22 ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 057265f6f..9f74fbce5 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1951,9 +1951,7 @@ typedef enum #define ONE_IN_Q31 0x7fffffff #define ONE_IN_Q45 (Word64)0x200000000000 #define ONE_IN_Q62 (Word64)0x4000000000000000 -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW #define MINUS_ONE_IN_Q31 ( -2147483647 - 1 ) /* same as (Word32)0x80000000 */ -#endif #define MAX_WORD16 32767 diff --git a/lib_com/options.h b/lib_com/options.h index ee42629bb..5967c8d27 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,7 +99,6 @@ /* any switch which is non-be wrt. TS 26.251 V3.0 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */ #define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ #define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */ diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c index 775cbcfeb..4764b46e2 100755 --- a/lib_dec/ivas_svd_dec_fx.c +++ b/lib_dec/ivas_svd_dec_fx.c @@ -49,9 +49,6 @@ #define SVD_ZERO_FLUSH_THRESHOLD_FX ( 0 ) #define CONVERGENCE_FACTOR_FX 214748 /* factor for SVD convergence (as per latest float code: 1.0e-04f) */ -#ifndef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW -#define MINUS_ONE_IN_Q31 ( -2147483647 - 1 ) -#endif /*-----------------------------------------------------------------------* * Local function prototypes diff --git a/lib_rend/ivas_objectRenderer_sources_fx.c b/lib_rend/ivas_objectRenderer_sources_fx.c index de17d46b6..176b9b67d 100644 --- a/lib_rend/ivas_objectRenderer_sources_fx.c +++ b/lib_rend/ivas_objectRenderer_sources_fx.c @@ -36,9 +36,7 @@ #include "ivas_prot_rend_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW #include "rom_com.h" -#endif /*---------------------------------------------------------------------* * Local function prototypes @@ -327,9 +325,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( Word32 azim_delta; Word32 elev_delta; Word16 ListRelPos_e, ListRelDist_e; -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW Word16 pan; -#endif Word32 wrapped_angle; Word16 pos_q; Word32 Src_p_tmp[3]; @@ -474,7 +470,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( move32(); set32_fx( hrf_left, 0, *filterlength ); set32_fx( hrf_right, 0, *filterlength ); -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW IF( LT_32( L_add( ONE_IN_Q25, SrcSpatial_p->Pos_p_fx[1] ), 0 ) ) { wrapped_angle = L_negate( L_add( ONE_IN_Q26, SrcSpatial_p->Pos_p_fx[1] ) ); @@ -491,12 +486,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx( pan = add( extract_h( L_shr( wrapped_angle, sub( SrcSpatial_p->q_Pos_p, Q21 ) ) ), 32 ); hrf_left[0] = L_shl_r( cos_table_129[64 - pan], 10 ); hrf_right[0] = L_shl_r( cos_table_129[pan], 10 ); -#else - hrf_left[0] = L_shr( L_add( L_shl( SrcSpatial_p->Pos_p_fx[1], sub( Q25, SrcSpatial_p->q_Pos_p ) ), ONE_IN_Q25 ), 1 ); // Q25 - move32(); - hrf_right[0] = L_sub( ONE_IN_Q25, hrf_left[0] ); // Q25 - move32(); -#endif hrf_left_e = 6; move16(); diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index b9d6a93af..d47c1aeba 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -47,9 +47,7 @@ #include "ivas_rom_com.h" #include "ivas_rom_rend.h" #include "wmc_auto.h" -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW #include "rom_com.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -2627,9 +2625,7 @@ static ivas_error updateMcPanGainsForMcOut( const AUDIO_CONFIG outConfig ) { ivas_error error; -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW Word16 pan; -#endif /* "if" conditions below realize the following mapping: @@ -2658,7 +2654,6 @@ static ivas_error updateMcPanGainsForMcOut( { -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW IF( EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ) { inputMc->panGains_fx[0][0] = ONE_IN_Q31; @@ -2675,19 +2670,6 @@ static ivas_error updateMcPanGainsForMcOut( inputMc->panGains_fx[0][0] = L_deposit_h( cos_table_129[64 - pan] ); inputMc->panGains_fx[0][1] = L_deposit_h( cos_table_129[pan] ); } -#else - IF( EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ) - { - inputMc->panGains_fx[0][0] = ONE_IN_Q31; - } - ELSE - { - inputMc->panGains_fx[0][0] = L_add( L_shr( inputMc->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 /* 0.5f in Q31 */ ); /* Q31 */ - } - move32(); - inputMc->panGains_fx[0][1] = L_sub( ONE_IN_Q31, inputMc->panGains_fx[0][0] ); - move32(); -#endif error = IVAS_ERR_OK; move32(); } @@ -2879,14 +2861,11 @@ static ivas_error updateMcPanGainsForAmbiOut( static ivas_error updateMcPanGainsForBinauralOut( input_mc *inputMc ) { -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW Word16 pan; -#endif setZeroPanMatrix_fx( inputMc->panGains_fx ); IF( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) { -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW IF( EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ) { inputMc->panGains_fx[0][0] = ONE_IN_Q31; @@ -2903,19 +2882,6 @@ static ivas_error updateMcPanGainsForBinauralOut( inputMc->panGains_fx[0][0] = L_deposit_h( cos_table_129[64 - pan] ); inputMc->panGains_fx[0][1] = L_deposit_h( cos_table_129[pan] ); } -#else - IF( EQ_32( inputMc->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ) - { - inputMc->panGains_fx[0][0] = ONE_IN_Q31; - } - ELSE - { - inputMc->panGains_fx[0][0] = L_add( L_shr( inputMc->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 /* 0.5f in Q31 */ ); /* Q31 */ - } - move32(); - inputMc->panGains_fx[0][1] = L_sub( ONE_IN_Q31, inputMc->panGains_fx[0][0] ); - move32(); -#endif } ELSE { @@ -6999,9 +6965,7 @@ static ivas_error renderIsmToMc( Word8 position_changed; pan_vector_fx currentPanGains_fx; /* Q31 */ ivas_error error; -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW Word16 pan; -#endif push_wmops( "renderIsmToMc" ); @@ -7021,7 +6985,6 @@ static ivas_error renderIsmToMc( { IF( ismInput->nonDiegeticPan ) { -#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW IF( EQ_32( ismInput->nonDiegeticPanGain_fx, ONE_IN_Q31 ) ) { currentPanGains_fx[0] = ONE_IN_Q31; @@ -7039,10 +7002,6 @@ static ivas_error renderIsmToMc( currentPanGains_fx[0] = L_deposit_h( cos_table_129[64 - pan] ); currentPanGains_fx[1] = L_deposit_h( cos_table_129[pan] ); } -#else - currentPanGains_fx[0] = L_add( L_shr( ismInput->nonDiegeticPanGain_fx, 1 ), ONE_IN_Q30 ); /* Q31 */ - currentPanGains_fx[1] = L_sub( ONE_IN_Q31, currentPanGains_fx[0] ); /* Q31 */ -#endif ismInput->prev_pan_gains_fx[0] = currentPanGains_fx[0]; /* Q31 */ ismInput->prev_pan_gains_fx[1] = currentPanGains_fx[1]; /* Q31 */ move32(); -- GitLab From 16bcecd7132e61b8f76f46d8a5b9c2fdfd37cd62 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:48 +0200 Subject: [PATCH 25/49] Accept FIX_1452_DEFAULT_REVERB --- apps/renderer.c | 2 -- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_rend/ivas_render_config_fx.c | 48 -------------------------------- lib_rend/ivas_rom_rend_fx.c | 20 ------------- lib_rend/lib_rend_fx.c | 8 ------ lib_util/render_config_reader.c | 4 --- 7 files changed, 85 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 7b52ad0b6..e5214ac96 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1174,7 +1174,6 @@ int main( fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); goto cleanup; } -#ifdef FIX_1452_DEFAULT_REVERB if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { @@ -1220,7 +1219,6 @@ int main( goto cleanup; } } -#endif if ( args.renderConfigFilePath[0] != '\0' ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9f74fbce5..0fd59b66a 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1648,7 +1648,6 @@ typedef enum #define IVAS_REVERB_DEFAULT_M_N_BANDS 31 #define IVAS_REVERB_DEFAULT_S_N_BANDS 60 -#ifdef FIX_1452_DEFAULT_REVERB #define IVAS_REVERB_DEFAULT_S_ACOUSTIC_PRE_DELAY_FX 2013266 /* 0.015f in Q27 */ #define IVAS_REVERB_DEFAULT_S_INPUT_PRE_DELAY_FX 2684355 /* 0.02f in Q27 */ @@ -1657,7 +1656,6 @@ typedef enum #define IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX 2181038 /* 0.01625f in Q27 */ #define IVAS_REVERB_DEFAULT_L_INPUT_PRE_DELAY_FX 13421773 /* 0.1f in Q27 */ -#endif #define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) #define LR_IAC_LENGTH_NR_FC_16KHZ ( RV_LENGTH_NR_FC_16KHZ ) diff --git a/lib_com/options.h b/lib_com/options.h index 5967c8d27..6ddf1a98f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,7 +99,6 @@ /* any switch which is non-be wrt. TS 26.251 V3.0 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_1452_DEFAULT_REVERB /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ #define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */ #define FIX_FMSW_DEC /* float issue 1542: fix JBM issue in format switching */ diff --git a/lib_rend/ivas_render_config_fx.c b/lib_rend/ivas_render_config_fx.c index 0cc4fa48c..cdda8541d 100644 --- a/lib_rend/ivas_render_config_fx.c +++ b/lib_rend/ivas_render_config_fx.c @@ -35,9 +35,7 @@ #include "prot_fx.h" #include "ivas_prot_rend_fx.h" #include "ivas_rom_rend.h" -#ifdef FIX_1452_DEFAULT_REVERB #include "ivas_cnst.h" -#endif #include "ivas_rom_TdBinauralRenderer.h" #include "wmc_auto.h" @@ -45,16 +43,6 @@ * Local constants *-----------------------------------------------------------------------*/ -#ifndef FIX_1452_DEFAULT_REVERB -#define IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX 2147484 // 0.016 -#define IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX 13421773 // 0.1 - -#define IVAS_REVERB_DEFAULT_S_PRE_DELAY_FX 1677722 // 0.0125f -#define IVAS_REVERB_DEFAULT_S_INPUT_DELAY_FX 0 // 0.0f - -#define IVAS_REVERB_DEFAULT_M_PRE_DELAY_FX 1677722 // 0.0125f -#define IVAS_REVERB_DEFAULT_M_INPUT_DELAY_FX 0 // 0.0f -#endif #define IVAS_REVERB_DEFAULT_USE_ER 0 @@ -122,17 +110,10 @@ ivas_error ivas_render_config_init_from_rom_fx( move16(); ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS; move16(); -#ifdef FIX_1452_DEFAULT_REVERB ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX; move32(); ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_PRE_DELAY_FX; move32(); -#else - ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX; - move32(); - ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX; - move32(); -#endif ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; move16(); set32_fx( &( *hRenderConfig )->roomAcoustics.pFc_input_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); @@ -194,30 +175,19 @@ ivas_error ivas_render_config_change_defaults( IVAS_DefaultReverbSize defaultReverbSize /* i: Reverb default size */ ) { -#ifdef FIX_1452_DEFAULT_REVERB hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; move16(); -#endif SWITCH( defaultReverbSize ) { case DEFAULT_REVERB_SMALL: hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_S_N_BANDS; move16(); -#ifdef FIX_1452_DEFAULT_REVERB hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_S_ACOUSTIC_PRE_DELAY_FX; move32(); hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_S_INPUT_PRE_DELAY_FX; move32(); -#else - hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_S_PRE_DELAY_FX; - move32(); - hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_S_INPUT_DELAY_FX; - move32(); - hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; - move16(); -#endif set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX ); @@ -229,19 +199,10 @@ ivas_error ivas_render_config_change_defaults( case DEFAULT_REVERB_MEDIUM: hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_M_N_BANDS; move16(); -#ifdef FIX_1452_DEFAULT_REVERB hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_M_ACOUSTIC_PRE_DELAY_FX; move32(); hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_M_INPUT_PRE_DELAY_FX; move32(); -#else - hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_M_PRE_DELAY_FX; - move32(); - hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_M_INPUT_DELAY_FX; - move32(); - hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; - move16(); -#endif set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX ); @@ -253,19 +214,10 @@ ivas_error ivas_render_config_change_defaults( case DEFAULT_REVERB_LARGE: hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS; move16(); -#ifdef FIX_1452_DEFAULT_REVERB hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX; move32(); hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_PRE_DELAY_FX; move32(); -#else - hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX; - move32(); - hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX; - move32(); - hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; - move16(); -#endif set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX ); set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX ); diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index cd57355f5..5fbdfb0f9 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -270,21 +270,12 @@ const Word32 ivas_reverb_default_small_RT60_fx[IVAS_REVERB_DEFAULT_S_N_BANDS] = const Word32 ivas_reverb_default_small_DSR_fx[IVAS_REVERB_DEFAULT_S_N_BANDS] = { -#ifdef FIX_1452_DEFAULT_REVERB 7492, 3154, 2033, 1848, 2280, 2721, 2988, 3693, 4165, 4276, 3797, 3273, 2676, 2205, 1756, 1386, 1142, 932, 832, 952, 1084, 1320, 1508, 1675, 1659, 1610, 1475, 1263, 1118, 981, 876, 769, 666, 612, 535, 467, 429, 379, 351, 321, 296, 273, 250, 226, 203, 180, 160, 149, 141, 133, 129, 123, 118, 115, 111, 110, 107, 106, 106, 105 -#else - 16773, 7628, 5046, 4620, 5666, 6853, 7771, 9876, 11530, 12337, - 11421, 10287, 8791, 7565, 6305, 5215, 4504, 3860, 3627, 4363, - 5246, 6739, 8151, 9611, 10088, 10416, 10154, 9187, 8628, 8012, - 7491, 6931, 6320, 6074, 5589, 5145, 4977, 4646, 4558, 4411, - 4331, 4253, 4147, 4018, 3821, 3629, 3428, 3361, 3361, 3361, - 3361, 3361, 3361, 3361, 3361, 3361, 3361, 3361, 3361, 3361 -#endif }; const Word32 ivas_reverb_default_medium_fc_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = @@ -313,7 +304,6 @@ const Word32 ivas_reverb_default_medium_RT60_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = const Word32 ivas_reverb_default_medium_DSR_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = { -#ifdef FIX_1452_DEFAULT_REVERB 5324, 5580, 5917, 6365, 6903, 7617, 8575, 9732, 11218, 13358, 15873, 14689, @@ -322,16 +312,6 @@ const Word32 ivas_reverb_default_medium_DSR_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = 5367, 6294, 8399, 8798, 5894, 2958, 2403, 3968, 1999, 840, 433 -#else - 15978, 16341, 16813, 17430, - 18156, 19101, 20335, 21788, - 23603, 26145, 29050, 27037, - 24421, 20999, 16973, 12614, - 10726, 8506, 8047, 8659, - 10526, 12575, 17260, 19074, - 13653, 7464, 6609, 12688, - 7607, 3835, 2373 -#endif }; const Word32 ivas_reverb_default_large_fc_fx[IVAS_REVERB_DEFAULT_L_N_BANDS] /*Q16*/ = diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index d47c1aeba..23058f300 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -5550,10 +5550,8 @@ ivas_error IVAS_REND_FeedRenderConfig( hRenderConfig->roomAcoustics.aeID = renderConfig.roomAcoustics.aeID; move16(); -#ifdef FIX_1452_DEFAULT_REVERB hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_UNSET; move32(); -#endif hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; move16(); hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; @@ -6093,13 +6091,7 @@ ivas_error IVAS_REND_SetReverbRoomSize( BREAK; case IVAS_ROOM_SIZE_AUTO: default: -#ifdef FIX_1452_DEFAULT_REVERB assert( 0 && "Room size is not set" ); -#else - hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_UNSET; - move32(); - BREAK; /* will be setup in IVAS_REND_AddInput() */ -#endif } IF( hIvasRend->hRendererConfig != NULL ) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 3d95f6e11..60630b853 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2410,9 +2410,7 @@ ivas_error RenderConfigReader_read( aeHasERsize = aeHasERabs = FALSE; params_idx = 0; pValue = (char *) calloc( strlen( pParams ), sizeof( char ) ); -#ifdef FIX_1452_DEFAULT_REVERB hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX; -#endif while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 ) { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); @@ -3028,9 +3026,7 @@ ivas_error RenderConfigReader_getAcousticEnvironment( { if ( id == pRenderConfigReader->pAE[n].id ) { -#ifdef FIX_1452_DEFAULT_REVERB pAcEnv->aeID = (UWord16) pRenderConfigReader->pAE[n].id; -#endif pAcEnv->nBands = (int16_t) pRenderConfigReader->pAE[n].pFG->nrBands; pAcEnv->inputPreDelay_fx = (Word32) ( pRenderConfigReader->pAE[n].preDelay * ONE_IN_Q27 ); for ( m = 0; m < pAcEnv->nBands; m++ ) -- GitLab From 186bdf69d87387cdf54d2e2a6f7d2b2e5850f569 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:50 +0200 Subject: [PATCH 26/49] Accept FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN --- lib_com/options.h | 1 - lib_enc/tcx_utils_enc_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6ddf1a98f..767953574 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */ #define FIX_FMSW_DEC /* float issue 1542: fix JBM issue in format switching */ #define FIX_FMSW_DEC_2 /* float issue 1575: fix crash for format switching when bitsream starts with EVS */ #define FIX_BASOP_2562_HQ_PREECHO_SAT /* Eri/Orange: Basop issue 2562: Add saturation to L_add in preecho calculations */ diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 5ee4a8914..82ff1cb61 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3002,7 +3002,6 @@ void ProcessIGF_fx( } test(); -#ifdef FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN IF( EQ_16( st->element_mode, EVS_MONO ) ) { // this is a bug in the EVS legacy code, the IVAS branch is correct - don't fix for now, to keep EVS bit-exact @@ -3012,9 +3011,6 @@ void ProcessIGF_fx( { tns_predictionGain = L_deposit_h( hIGFEnc->tns_predictionGain ); } -#else - tns_predictionGain = L_deposit_l( hIGFEnc->tns_predictionGain ); -#endif IF( LT_32( tns_predictionGain, ONE_POINT_ONE_FIVE_Q23 ) && LT_16( predictionGain, ONE_POINT_ONE_FIVE_Q7 ) ) { hIGFEnc->flatteningTrigger = 1; -- GitLab From b848ed39ef1d442f364a27f3547becd4ce412bd2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:52 +0200 Subject: [PATCH 27/49] Accept FIX_FMSW_DEC --- apps/decoder.c | 184 ------------------------------------- apps/encoder.c | 15 --- lib_com/ivas_prot_fx.h | 9 -- lib_com/options.h | 2 - lib_dec/ivas_init_dec_fx.c | 51 ---------- lib_dec/lib_dec.h | 2 - lib_dec/lib_dec_fx.c | 75 --------------- lib_util/ivas_rtp_api.h | 2 - lib_util/ivas_rtp_file.c | 15 --- 9 files changed, 355 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 8bc03bcd6..b0c834e7e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -164,16 +164,9 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif -#ifdef FIX_FMSW_DEC static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); -#else -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); -#endif static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); -#ifndef FIX_FMSW_DEC -static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ); -#endif /*------------------------------------------------------------------------------------------* @@ -673,11 +666,7 @@ int main( if ( arg.voipMode ) { -#ifdef FIX_FMSW_DEC error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf ); -#else - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &renderConfig, &hIvasDec, pcmBuf ); -#endif } else { @@ -2316,34 +2305,11 @@ static ivas_error decodeG192( if ( restartNeeded ) { -#ifdef FIX_FMSW_DEC if ( ( error = IVAS_DEC_Restart( hIvasDec, IVAS_DEC_MODE_IVAS ) ) != IVAS_ERR_OK ) /* note: only switching within IVAS formats is supported in G.192 */ { fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#else - IVAS_DEC_BS_FORMAT tempFormat; - if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); - goto cleanup; - } - IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; - error = restartDecoder( - &hIvasDec, - codecMode, - &arg, - NULL, /* ToDo : Provide rendererConfig */ - NULL /* ToDo : Provide LS Custom Data */ - ); - if ( error != IVAS_ERR_OK ) - { - fprintf( stderr, "\nFailed to restart decoder\n" ); - goto cleanup; - } - *phIvasDec = hIvasDec; /* Update for main()' s free */ -#endif } #endif @@ -2823,9 +2789,6 @@ static ivas_error decodeVoIP( Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, -#ifndef FIX_FMSW_DEC - IVAS_RENDER_CONFIG_DATA *renderConfig, -#endif IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ) { @@ -3023,29 +2986,12 @@ static ivas_error decodeVoIP( /* restart decoder in case of format switching */ if ( ivasRtp.restartNeeded ) { -#ifdef FIX_FMSW_DEC arg.decMode = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; if ( ( error = IVAS_DEC_Restart( hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) /* note: switching between EVS and IVAS is supported in RTP */ { fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#else - IVAS_DEC_MODE newDecModeInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; - if ( ( error = restartDecoder( - &hIvasDec, - newDecModeInPacket, - &arg, - renderConfig, - NULL /* ToDo : Provide LS Custom Data */ - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newDecModeInPacket ); - goto cleanup; - } - - *phIvasDec = hIvasDec; /* Update for main()' s free */ -#endif ivasRtp.restartNeeded = false; bitstreamReadDone = false; parametersAvailableForEditing = false; @@ -3277,35 +3223,11 @@ static ivas_error decodeVoIP( if ( restartNeeded ) { -#ifdef FIX_FMSW_DEC if ( ( error = IVAS_DEC_Restart( hIvasDec, IVAS_DEC_MODE_IVAS ) ) != IVAS_ERR_OK ) /* note: only switching within IVAS formats is supported in non-RTP VoIP */ { fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#else - IVAS_DEC_BS_FORMAT tempBsFormat; - if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempBsFormat ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); - goto cleanup; - } - - IVAS_DEC_MODE newDecModeInPacket = ( tempBsFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; - if ( ( error = restartDecoder( - &hIvasDec, - newDecModeInPacket, - &arg, - NULL, /* ToDo : Provide rendererConfig */ - NULL /* ToDo : Provide LS Custom Data */ - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nFailed to restart decoder\n" ); - goto cleanup; - } - - *phIvasDec = hIvasDec; /* Update for main()' s free */ -#endif bitstreamReadDone = false; parametersAvailableForEditing = false; } @@ -3998,110 +3920,4 @@ static ivas_error load_hrtf_from_file( return IVAS_ERR_OK; } -#ifndef FIX_FMSW_DEC -/*---------------------------------------------------------------------* - * restartDecoder() - * - * Restart decoder in case of IVAS format switching - *---------------------------------------------------------------------*/ - -static ivas_error restartDecoder( - IVAS_DEC_HANDLE *phIvasDec, - const IVAS_DEC_MODE decMode, - DecArguments *arg, - IVAS_RENDER_CONFIG_DATA *renderConfig, - IVAS_CUSTOM_LS_DATA *hLsCustomData ) -{ - ivas_error error = IVAS_ERR_OK; - IVAS_DEC_HANDLE hIvasDec; - - if ( phIvasDec == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - if ( NULL != *phIvasDec ) - { - IVAS_DEC_Close( phIvasDec ); - } - - if ( ( error = IVAS_DEC_Open( phIvasDec, decMode ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - arg->decMode = decMode; - - hIvasDec = *phIvasDec; - - uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : IVAS_DEFAULT_AEID; - - IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; - - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->render_num_subframes, arg->customLsOutputEnabled, arg->hrtfReaderEnabled, - arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->roomSize, arg->non_diegetic_pan_enabled, - arg->non_diegetic_pan_gain_fx, arg->dpidEnabled, aeID, arg->objEditEnabled, arg->delayCompensationEnabled ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg->render_num_subframes ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( arg->voipMode ) - { - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg->inputFormat ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - /* ISAR frame size is set from command line, not renderer config file. - * This will be ignored if output format is not split rendering. */ - if ( renderConfig != NULL ) - { - renderConfig->split_rend_config.isar_frame_size_ms = (int16_t) arg->render_num_subframes * 5; - } - - if ( arg->renderConfigEnabled && renderConfig != NULL ) - { - if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, *renderConfig ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - if ( arg->customLsOutputEnabled && hLsCustomData != NULL ) - { - if ( ( error = IVAS_DEC_FeedCustomLsData( hIvasDec, *hLsCustomData ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedCustomLsData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - return IVAS_ERR_OK; - -cleanup: - IVAS_DEC_Close( phIvasDec ); - - return error; -} -#endif #undef WMC_TOOL_SKIP diff --git a/apps/encoder.c b/apps/encoder.c index b3a359304..ee36bd580 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -363,7 +363,6 @@ int main( } } -#ifdef FIX_FMSW_DEC /*------------------------------------------------------------------------------------------* * Open remote requests file for rtp packing (E-bytes) *------------------------------------------------------------------------------------------*/ @@ -383,7 +382,6 @@ int main( goto cleanup; } } -#endif /*------------------------------------------------------------------------------------------* * Handle Channel-aware mode @@ -678,19 +676,6 @@ int main( } } -#ifndef FIX_FMSW_DEC - /*------------------------------------------------------------------------------------------* - * Open remote requests file for rtp packing (E-bytes) - *------------------------------------------------------------------------------------------*/ - if ( arg.requestsFileName != NULL ) - { - if ( ( error = RequestsFileReader_open( arg.requestsFileName, &requestsFileReader ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: Can't open requests file %s \n\n", arg.requestsFileName ); - goto cleanup; - } - } -#endif /*------------------------------------------------------------------------------------------* * Run the encoder *------------------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index b76bcd313..8c7a31bc1 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2062,11 +2062,7 @@ void destroy_core_dec_fx( ); void ivas_destroy_dec_fx( -#ifdef FIX_FMSW_DEC Decoder_Struct **st_ivas /* i/o: IVAS decoder structure */ -#else - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#endif ); ivas_error ivas_ism_dec_config_fx( @@ -3731,11 +3727,6 @@ Word16 getNumChanSynthesis( Decoder_Struct *st_ivas /* i : IVAS decoder structure */ ); -#ifndef FIX_FMSW_DEC -void ivas_destroy_dec_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif ivas_error ivas_core_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 767953574..f9a6d8217 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,8 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_FMSW_DEC /* float issue 1542: fix JBM issue in format switching */ -#define FIX_FMSW_DEC_2 /* float issue 1575: fix crash for format switching when bitsream starts with EVS */ #define FIX_BASOP_2562_HQ_PREECHO_SAT /* Eri/Orange: Basop issue 2562: Add saturation to L_add in preecho calculations */ #define FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD /* BASOP issue 2561: fix diffs in stereo_dft_enc_compute_itd() between float and BASOP */ #define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index e610c160a..4550af715 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1572,12 +1572,8 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Custom loudspeaker layout handle *--------------------------------------------------------------------*/ -#ifdef FIX_FMSW_DEC test(); IF( st_ivas->hDecoderConfig->Opt_LsCustom && st_ivas->hLsSetupCustom == NULL ) -#else - IF( st_ivas->hDecoderConfig->Opt_LsCustom ) -#endif { IF( EQ_32( ( error = ivas_ls_custom_open_fx( &( st_ivas->hLsSetupCustom ) ) ), IVAS_ERR_OK ) ) { @@ -1594,12 +1590,8 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Head-Tracking handle *--------------------------------------------------------------------*/ -#ifdef FIX_FMSW_DEC test(); IF( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData == NULL ) -#else - IF( st_ivas->hDecoderConfig->Opt_Headrotation ) -#endif { IF( NE_32( ( error = ivas_headTrack_open_fx( &( st_ivas->hHeadTrackData ) ) ), IVAS_ERR_OK ) ) { @@ -1616,12 +1608,8 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize external orientation handle *--------------------------------------------------------------------*/ -#ifdef FIX_FMSW_DEC test(); IF( st_ivas->hDecoderConfig->Opt_ExternalOrientation && st_ivas->hExtOrientationData == NULL ) -#else - IF( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) -#endif { IF( NE_32( ( error = ivas_external_orientation_open_fx( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_num_subframes ) ), IVAS_ERR_OK ) ) { @@ -1634,12 +1622,8 @@ ivas_error ivas_init_decoder_front( *--------------------------------------------------------------------*/ test(); -#ifdef FIX_FMSW_DEC test(); IF( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData == NULL ) -#else - IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) -#endif { IF( NE_32( ( error = ivas_combined_orientation_open_fx( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_num_subframes ) ), IVAS_ERR_OK ) ) { @@ -1657,15 +1641,10 @@ ivas_error ivas_init_decoder_front( test(); test(); test(); -#ifdef FIX_FMSW_DEC test(); IF( ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) ) && st_ivas->hRenderConfig == NULL ) -#else - IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || - ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) ) -#endif { IF( NE_32( ( error = ivas_render_config_open_fx( &( st_ivas->hRenderConfig ) ) ), IVAS_ERR_OK ) ) { @@ -3364,14 +3343,10 @@ void ivas_initialize_handles_dec( st_ivas->hCPE[i] = NULL; } -#ifdef FIX_FMSW_DEC IF( !st_ivas->restartNeeded ) { -#endif st_ivas->bit_stream = NULL; -#ifdef FIX_FMSW_DEC } -#endif st_ivas->hLimiter = NULL; /* ISM metadata handles */ @@ -3415,10 +3390,8 @@ void ivas_initialize_handles_dec( st_ivas->hMasaIsmData = NULL; st_ivas->hSbaIsmData = NULL; -#ifdef FIX_FMSW_DEC IF( !st_ivas->restartNeeded ) { -#endif st_ivas->hHeadTrackData = NULL; st_ivas->hHrtfTD = NULL; st_ivas->hLsSetupCustom = NULL; @@ -3428,9 +3401,7 @@ void ivas_initialize_handles_dec( st_ivas->acousticEnvironmentsCount = 0; move16(); st_ivas->pAcousticEnvironments = NULL; -#ifdef FIX_FMSW_DEC } -#endif st_ivas->hSplitBinRend = NULL; FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) @@ -3459,17 +3430,11 @@ void ivas_initialize_handles_dec( *-------------------------------------------------------------------------*/ void ivas_destroy_dec_fx( -#ifdef FIX_FMSW_DEC Decoder_Struct **st_ivas_out /* i/o: IVAS decoder handle */ -#else - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -#endif ) { Word16 i; -#ifdef FIX_FMSW_DEC Decoder_Struct *st_ivas = *st_ivas_out; -#endif /* CLDFB handles */ FOR( i = 0; i < MAX_INTERN_CHANNELS; i++ ) @@ -3599,18 +3564,14 @@ void ivas_destroy_dec_fx( ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion ); /* Custom LS configuration handle */ -#ifdef FIX_FMSW_DEC IF( !st_ivas->restartNeeded ) { -#endif IF( st_ivas->hLsSetupCustom != NULL ) { free( st_ivas->hLsSetupCustom ); st_ivas->hLsSetupCustom = NULL; } -#ifdef FIX_FMSW_DEC } -#endif /* Mono downmix structure */ ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); @@ -3646,13 +3607,11 @@ void ivas_destroy_dec_fx( /* HRTF statistics */ ivas_HRTF_statistics_binary_close_fx( &st_ivas->hHrtfStatistics ); -#ifdef FIX_FMSW_DEC /* Limiter struct */ ivas_limiter_close_fx( &( st_ivas->hLimiter ) ); IF( !st_ivas->restartNeeded ) { -#endif /* Config. Renderer */ ivas_render_config_close_fx( &( st_ivas->hRenderConfig ) ); @@ -3663,17 +3622,12 @@ void ivas_destroy_dec_fx( st_ivas->pAcousticEnvironments = NULL; } -#ifndef FIX_FMSW_DEC - /* Limiter struct */ - ivas_limiter_close_fx( &( st_ivas->hLimiter ) ); -#endif /* Decoder configuration structure */ IF( st_ivas->hDecoderConfig != NULL ) { free( st_ivas->hDecoderConfig ); st_ivas->hDecoderConfig = NULL; } -#ifdef FIX_FMSW_DEC } ELSE { @@ -3687,7 +3641,6 @@ void ivas_destroy_dec_fx( move16(); move16(); } -#endif /* TC buffer structure */ ivas_dec_tc_buffer_close_fx( &st_ivas->hTcBuffer ); @@ -3705,15 +3658,11 @@ void ivas_destroy_dec_fx( } /* main IVAS handle */ -#ifdef FIX_FMSW_DEC if ( !st_ivas->restartNeeded ) { free( *st_ivas_out ); *st_ivas_out = NULL; } -#else - free( st_ivas ); -#endif return; } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 89d2e967c..1598ec37c 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -128,13 +128,11 @@ ivas_error IVAS_DEC_Configure( const bool delayCompensationEnabled /* i : enable delay compensation */ ); -#ifdef FIX_FMSW_DEC ivas_error IVAS_DEC_Restart( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ ); -#endif void IVAS_DEC_Close( IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */ ); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 0c64e46ef..baece45db 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -128,7 +128,6 @@ static Word16 ivas_dec_split_rend_cldfb_in( const RENDERER_TYPE renderer_type ); static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesRendered ); -#ifdef FIX_FMSW_DEC /*---------------------------------------------------------------------* * ivas_dec_handle_init() @@ -216,7 +215,6 @@ static ivas_error ivas_dec_handle_init( return IVAS_ERR_WRONG_PARAMS; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_Open() @@ -238,13 +236,11 @@ ivas_error IVAS_DEC_Open( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_FMSW_DEC if ( *phIvasDec != NULL ) { return IVAS_ERR_WRONG_PARAMS; } -#endif /*-----------------------------------------------------------------* * Allocate and initialize IVAS application decoder handle *-----------------------------------------------------------------*/ @@ -325,79 +321,16 @@ ivas_error IVAS_DEC_Open( st_ivas = hIvasDec->st_ivas; -#ifdef FIX_FMSW_DEC st_ivas->restartNeeded = 0; move16(); -#endif /* initialize Decoder Config. handle */ init_decoder_config( hIvasDec->st_ivas->hDecoderConfig ); -#ifdef FIX_FMSW_DEC /* Set IVAS decoder handles to NULL + set high-level parameters */ return ivas_dec_handle_init( st_ivas, mode, &( hIvasDec->hasDecodedFirstGoodFrame ) ); -#else - /* initialize pointers to handles to NULL */ - ivas_initialize_handles_dec( st_ivas ); - - st_ivas->restartNeeded = 0; - move16(); - - /* set high-level parameters */ - st_ivas->codec_mode = 0; /* unknown before first frame */ - st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID; - st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID; - st_ivas->writeFECoffset = 0; - st_ivas->sba_analysis_order = 0; /* not really used in EVS mode, but initialize here to fix MSAN complaint */ - move16(); - move16(); - move16(); - move16(); - move16(); - - IF( EQ_16( mode, IVAS_DEC_MODE_EVS ) ) - { - st_ivas->element_mode_init = EVS_MONO; - st_ivas->ivas_format = MONO_FORMAT; - hIvasDec->hasDecodedFirstGoodFrame = true; /* Functionality to suppress output for initial lost frames is disabled in EVS operation */ - move16(); - move16(); - move16(); - - return IVAS_ERR_OK; - } - ELSE IF( EQ_16( mode, IVAS_DEC_MODE_IVAS ) ) - { - st_ivas->element_mode_init = -1; - st_ivas->ivas_format = UNDEFINED_FORMAT; - st_ivas->renderer_type = RENDERER_DISABLE; - st_ivas->ini_frame = 0; - st_ivas->ini_active_frame = 0; - - st_ivas->ism_mode = ISM_MODE_NONE; - st_ivas->mc_mode = MC_MODE_NONE; - - st_ivas->sba_order = 0; - st_ivas->sba_planar = 0; - - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - - return IVAS_ERR_OK; - } - - return IVAS_ERR_WRONG_PARAMS; -#endif } -#ifdef FIX_FMSW_DEC /*---------------------------------------------------------------------* * IVAS_DEC_Restart() @@ -465,7 +398,6 @@ ivas_error IVAS_DEC_Restart( return ivas_dec_handle_init( hIvasDec->st_ivas, mode, &( hIvasDec->hasDecodedFirstGoodFrame ) ); } -#endif /*-------------------------------------------------------------------------* * isar_set_split_rend_setup() @@ -587,12 +519,7 @@ void IVAS_DEC_Close( ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend ); /* destroy IVAS decoder handles */ -#ifdef FIX_FMSW_DEC ivas_destroy_dec_fx( &( *phIvasDec )->st_ivas ); -#else - ivas_destroy_dec_fx( ( *phIvasDec )->st_ivas ); - ( *phIvasDec )->st_ivas = NULL; -#endif } apa_exit( &( *phIvasDec )->hTimeScaler ); @@ -5829,10 +5756,8 @@ static ivas_error evs_dec_main_fx( st_ivas->BER_detect = hCoreCoder[0]->BER_detect; move16(); -#ifdef FIX_FMSW_DEC st_ivas->last_ivas_format = MONO_FORMAT; move16(); -#endif /*if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO )*/ { diff --git a/lib_util/ivas_rtp_api.h b/lib_util/ivas_rtp_api.h index 038680c1b..3fd41cdad 100644 --- a/lib_util/ivas_rtp_api.h +++ b/lib_util/ivas_rtp_api.h @@ -82,9 +82,7 @@ /* IVAS Codec Types */ typedef enum { -#ifdef FIX_FMSW_DEC IVAS_RTP_UNDEF = -1, /* undefined = Codec Type not set yet */ -#endif IVAS_RTP_EVS, /* EVS */ IVAS_RTP_IVAS /* IVAS */ } IVAS_RTP_CODEC; diff --git a/lib_util/ivas_rtp_file.c b/lib_util/ivas_rtp_file.c index 4e0feaeea..34a7507eb 100644 --- a/lib_util/ivas_rtp_file.c +++ b/lib_util/ivas_rtp_file.c @@ -934,9 +934,7 @@ ivas_error IVAS_RTP_READER_Init( rtp->unpackCfg.maxFramesPerPacket = IVAS_MAX_FRAMES_PER_RTP_PACKET; rtp->rtpPacket.buffer = rtp->packet; rtp->rtpPacket.capacity = sizeof( rtp->packet ); -#ifdef FIX_FMSW_DEC rtp->codecId = IVAS_RTP_UNDEF; -#endif error = IVAS_RTP_UNPACK_Open( &rtp->hUnpack, &rtp->unpackCfg ); if ( error == IVAS_ERR_OK ) @@ -1124,7 +1122,6 @@ ivas_error IVAS_RTP_ReadNextFrame( } else { -#ifdef FIX_FMSW_DEC if ( rtp->codecId != IVAS_RTP_UNDEF && rtp->codecId != codecId ) { rtp->restartNeeded = true; @@ -1133,18 +1130,6 @@ ivas_error IVAS_RTP_ReadNextFrame( ( rtp->codecId == IVAS_RTP_EVS ) ? "EVS" : "IVAS", ( codecId == IVAS_RTP_EVS ) ? "EVS" : "IVAS" ); } -#else - - rtp->restartNeeded = ( rtp->codecId != codecId ) || - ( codecId == IVAS_RTP_EVS && ( rtp->isAMRWB_IOmode != isAMRWB_IOmode ) ); - - if ( rtp->restartNeeded ) - { - fprintf( stdout, "\nRTP packet codec changed %s -> %s\n", - ( rtp->codecId == IVAS_RTP_EVS ) ? ( rtp->isAMRWB_IOmode ? "AMRWB_IO" : "EVS" ) : "IVAS", - ( codecId == IVAS_RTP_EVS ) ? ( isAMRWB_IOmode ? "AMRWB_IO" : "EVS" ) : "IVAS" ); - } -#endif rtp->codecId = codecId; rtp->isAMRWB_IOmode = isAMRWB_IOmode; -- GitLab From ee8879f3d3a52b72b908f4418c40a5350093b913 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:54 +0200 Subject: [PATCH 28/49] Accept FIX_FMSW_DEC_2 --- apps/decoder.c | 2 -- lib_dec/lib_dec_fx.c | 8 -------- 2 files changed, 10 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index b0c834e7e..2588e8d3c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2945,14 +2945,12 @@ static ivas_error decodeVoIP( /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ rtpTimeStamp = rtpTimeStamp / 16; -#ifdef FIX_FMSW_DEC_2 arg.decMode = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; if ( ( error = IVAS_DEC_Restart( hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) /* note: when the RTP bitstream starts with EVS, do the restart */ { fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#endif } if ( error != IVAS_ERR_OK ) { diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index baece45db..41e5e5990 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -165,7 +165,6 @@ static ivas_error ivas_dec_handle_init( move16(); move16(); -#ifdef FIX_FMSW_DEC_2 st_ivas->last_ivas_format = UNDEFINED_FORMAT; st_ivas->nSCE = 0; st_ivas->nCPE = 0; @@ -173,7 +172,6 @@ static ivas_error ivas_dec_handle_init( move16(); move16(); -#endif IF( EQ_16( mode, IVAS_DEC_MODE_EVS ) ) { st_ivas->element_mode_init = EVS_MONO; @@ -355,19 +353,14 @@ ivas_error IVAS_DEC_Restart( { return IVAS_ERR_OK; } -#ifdef FIX_FMSW_DEC_2 ELSE { /* switching between EVS and IVAS signaled in RTP */ hIvasDec->st_ivas->restartNeeded = 1; move16(); } -#else - return IVAS_ERR_WRONG_PARAMS; -#endif } -#ifdef FIX_FMSW_DEC_2 IF( NE_16( hIvasDec->mode, mode ) ) /* handle switching between EVS and IVAS */ { /* initialize JBM */ @@ -384,7 +377,6 @@ ivas_error IVAS_DEC_Restart( move16(); } -#endif hIvasDec->mode = mode; move16(); -- GitLab From 654c7edb489a722a1b17f8973ea1b2fffaa51932 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:57 +0200 Subject: [PATCH 29/49] Accept FIX_BASOP_2562_HQ_PREECHO_SAT --- lib_com/options.h | 1 - lib_com/trans_inv_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f9a6d8217..dc9227a7f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_BASOP_2562_HQ_PREECHO_SAT /* Eri/Orange: Basop issue 2562: Add saturation to L_add in preecho calculations */ #define FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD /* BASOP issue 2561: fix diffs in stereo_dft_enc_compute_itd() between float and BASOP */ #define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ #define NONBE_FIX_ISSUE_2518 /* FhG: Fix issue 2518, noise during ACELP switching from 16KHz to 12k8Hz by improving Q_new calculation. */ diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index 405dd1914..04296decc 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -746,11 +746,7 @@ void preecho_sb_fx( } } -#ifdef FIX_BASOP_2562_HQ_PREECHO_SAT tmp_fxL1 = L_add_sat( eshbmean2_fx, es_mdct_hb_fx[ind3] ); /*2*(q_sig16)*/ -#else - tmp_fxL1 = L_add( eshbmean2_fx, es_mdct_hb_fx[ind3] ); /*2*(q_sig16)*/ -#endif Mpy_32_16_ss( tmp_fxL1, 4369, &eshbmean3_fx, &tmp_u16 ); /*10922 : 1/3*/ tmp_fxL1 = L_sub( es_mdct_hb_fx[ind3], es_mdct_hb_fx[ind5] ); /*2*(q_sig16)*/ -- GitLab From c66787dd221083a7b4290e9d8ed0eb402f44e005 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:11:59 +0200 Subject: [PATCH 30/49] Accept FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD --- lib_com/options.h | 1 - lib_enc/ivas_stereo_dft_enc_itd_fx.c | 9 --------- 2 files changed, 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index dc9227a7f..9647e4971 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD /* BASOP issue 2561: fix diffs in stereo_dft_enc_compute_itd() between float and BASOP */ #define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ #define NONBE_FIX_ISSUE_2518 /* FhG: Fix issue 2518, noise during ACELP switching from 16KHz to 12k8Hz by improving Q_new calculation. */ #define NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX /* FhG: Fix issue 2518, fix wrong amplitude because of saturation of x_tran in transf_cdbk_enc_fx() for transient signals. */ diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index 850b40f61..ce73301b7 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -1492,13 +1492,8 @@ void stereo_dft_enc_compute_itd_fx( L_temp2_e = sub( 31, q_temp ); L_temp = Mpy_32_32( L_temp, L_temp2 ); L_temp_e = add( L_temp_e, L_temp2_e ); -#ifdef FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD sfm_R = BASOP_Util_Divide3232_Scale_newton( L_temp, sum_abs_R, &sfm_R_e ); sfm_R_e = add( sfm_R_e, sub( L_temp_e, sum_abs_R_e ) ); -#else - sfm_R = BASOP_Util_Divide3232_Scale_newton( L_temp, sum_abs_R, &sfm_L_e ); - sfm_R_e = add( sfm_L_e, sub( L_temp_e, sum_abs_R_e ) ); -#endif // sfm_R = L_shl_r( sfm_R, sfm_R_e ); // Q31 sfm_R = L_shl_sat( sfm_R, sfm_R_e ); // Q31 } @@ -1691,11 +1686,7 @@ void stereo_dft_enc_compute_itd_fx( hStereoDft->currentNumUpdates = add( hStereoDft->currentNumUpdates, 1 ); move16(); -#ifdef FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD FOR( i = 1; i < NFFT / 2; i++ ) -#else - FOR( i = 1; i < NFFT / 4; i++ ) -#endif { /* Low pass filter cross L/R power spectrum */ // hStereoDft->xspec_smooth[2 * i] = ( 1.f - cng_xcorr_filt ) * hStereoDft->xspec_smooth[2 * i] + cng_xcorr_filt * xcorr[2 * i]; -- GitLab From d75018af8e22e2c5829c4834cbe0b9a1d1969028 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:01 +0200 Subject: [PATCH 31/49] Accept FIX_BASOP_2517_CLICK_IN_OMASA_LTV --- lib_com/options.h | 1 - lib_enc/acelp_core_enc_fx.c | 4 ---- lib_enc/ivas_core_pre_proc_front_fx.c | 4 ---- 3 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9647e4971..4e7719d54 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_BASOP_2517_CLICK_IN_OMASA_LTV /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */ #define NONBE_FIX_ISSUE_2518 /* FhG: Fix issue 2518, noise during ACELP switching from 16KHz to 12k8Hz by improving Q_new calculation. */ #define NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX /* FhG: Fix issue 2518, fix wrong amplitude because of saturation of x_tran in transf_cdbk_enc_fx() for transient signals. */ #define NONBE_FIX_ISSUE_2569 /* FhG: Fix issue 2569, overflow of mem_preemph16k_fx in LTV test. */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 6c3353867..11cffe5d9 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -669,7 +669,6 @@ ivas_error acelp_core_enc_fx( * Calculation of LP residual (filtering through A[z] filter) *---------------------------------------------------------------*/ -#ifdef FIX_BASOP_2517_CLICK_IN_OMASA_LTV Word16 scf = sub( norm_arr( inp - M, add( st->L_frame, M ) ), 2 ); test(); IF( NE_16( st->element_mode, EVS_MONO ) && GT_16( scf, 0 ) ) @@ -683,9 +682,6 @@ ivas_error acelp_core_enc_fx( { calc_residu_fx( st, inp, res_fx, Aq ); } -#else - calc_residu_fx( st, inp, res_fx, Aq ); -#endif calculate_hangover_attenuation_gain_fx( st, &att_fx, vad_hover_flag ); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 92f753704..8dfd5c9b9 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1193,7 +1193,6 @@ void pre_proc_front_ivas_fx( move16(); } -#ifdef FIX_BASOP_2517_CLICK_IN_OMASA_LTV Word16 inp_local[L_INP_12k8]; Word16 Q_local; Word16 offset = (Word16) ( inp_12k8_fx - old_inp_12k8_fx ); @@ -1210,9 +1209,6 @@ void pre_proc_front_ivas_fx( { analy_lp_fx( inp_12k8_fx, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, INT_FS_12k8, element_mode, i, *Q_new, Q_r ); } -#else - analy_lp_fx( inp_12k8_fx, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, INT_FS_12k8, element_mode, i, *Q_new, Q_r ); -#endif FOR( Word16 idx = 0; idx < M + 1; idx++ ) { -- GitLab From 20537e32f3bc36d5b8649404d6a34dc2a0e30731 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:03 +0200 Subject: [PATCH 32/49] Accept NONBE_FIX_ISSUE_2518 --- lib_com/options.h | 2 - lib_enc/acelp_core_enc_fx.c | 14 ----- lib_enc/core_enc_init_fx.c | 17 ------ lib_enc/core_enc_switch_fx.c | 17 ------ lib_enc/init_enc_fx.c | 9 ---- lib_enc/ivas_core_pre_proc_front_fx.c | 74 --------------------------- lib_enc/ivas_core_pre_proc_fx.c | 49 ------------------ lib_enc/stat_enc.h | 3 -- lib_enc/updt_enc_fx.c | 5 -- 9 files changed, 190 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4e7719d54..55e9cef26 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,8 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define NONBE_FIX_ISSUE_2518 /* FhG: Fix issue 2518, noise during ACELP switching from 16KHz to 12k8Hz by improving Q_new calculation. */ -#define NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX /* FhG: Fix issue 2518, fix wrong amplitude because of saturation of x_tran in transf_cdbk_enc_fx() for transient signals. */ #define NONBE_FIX_ISSUE_2569 /* FhG: Fix issue 2569, overflow of mem_preemph16k_fx in LTV test. */ #define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 11cffe5d9..8d9bf9f1f 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -117,9 +117,7 @@ ivas_error acelp_core_enc_fx( move16(); hLPDmem->q_mem_syn = sub( Q_new, 1 ); move16(); -#ifdef NONBE_FIX_ISSUE_2518 st->mem_deemp_preQ_fx = shl_sat( st->mem_deemp_preQ_fx, sub( Q_new, st->prev_Q_new ) ); -#endif } Scale_sig32( st->Bin_E_old_fx, L_FFT / 2, sub( add( Q_new, Q_SCALE - 2 ), st->q_Bin_E_old ) ); // Q_new + Q_scale - 2 @@ -968,18 +966,6 @@ ivas_error acelp_core_enc_fx( * Updates *-----------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2518 - IF( st->element_mode > EVS_MONO ) - { - if ( st->hBWE_TD != NULL ) - { - st->Q_exc = Q_new; - move16(); - } - hLPDmem->q_lpd_old_exc = Q_new; - move16(); - } -#endif updt_enc_fx( st, old_exc_fx, pitch_buf, Es_pred_fx, Aq, lsf_new_fx, lsp_new, old_bwe_exc_fx ); diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 7efe8a9ff..8a8794b6d 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -28,11 +28,7 @@ static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const static void init_core_sig_ana_ivas_fx( Encoder_State *st ); static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); -#ifdef NONBE_FIX_ISSUE_2518 static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ); -#else -static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ); -#endif /*-----------------------------------------------------------------------* * init_coder_ace_plus_fx() @@ -1089,11 +1085,7 @@ void init_coder_ace_plus_ivas_fx( /* Initialize ACELP */ -#ifdef NONBE_FIX_ISSUE_2518 init_acelp_ivas_fx( st, L_frame_old, last_total_brate ); -#else - init_acelp_ivas_fx( st, L_frame_old, 0, last_total_brate ); -#endif if ( st->ini_frame == 0 ) { @@ -1546,11 +1538,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) * * *-----------------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2518 static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ) -#else -static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ) -#endif { Word16 mem_syn_r_size_old; Word16 mem_syn_r_size_new; @@ -1733,13 +1721,8 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh move16(); Copy( hLPDmem->mem_syn2, tmp_buf + 1, M ); deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp ); -#ifdef NONBE_FIX_ISSUE_2518 Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 ); hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp ); -#else - Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); - hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp ); -#endif move16(); } } diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 3bea33c12..edb002aaa 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -386,24 +386,7 @@ void core_coder_mode_switch_ivas_fx( move32(); st->currEnergyHF_e_fx = 0; move16(); -#ifndef NONBE_FIX_ISSUE_2518 - Word16 shift = getScaleFactor16( st->old_inp_16k_fx, L_INP_MEM ); - Scale_sig( st->old_inp_16k_fx, L_INP_MEM, shift ); - st->exp_old_inp_16k = sub( st->exp_old_inp_16k, shift ); - move16(); - shift = getScaleFactor16( st->old_inp_12k8_fx, L_INP_MEM ); - Scale_sig( st->old_inp_12k8_fx, L_INP_MEM, shift ); - st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); - move16(); -#endif init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag ); -#ifndef NONBE_FIX_ISSUE_2518 - if ( st->hLPDmem != NULL ) - { - st->hLPDmem->q_lpd_old_exc = st->prev_Q_new; - move16(); - } -#endif } test(); diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 52fb9b625..3a9b98980 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -249,13 +249,11 @@ ivas_error init_encoder_fx( st->prev_Q_new = 0; move16(); -#ifdef NONBE_FIX_ISSUE_2518 if ( st->element_mode > EVS_MONO ) { st->prev_Q_new = Q15; move16(); } -#endif IF( EQ_32( st->input_Fs, 8000 ) ) { @@ -1151,13 +1149,6 @@ ivas_error init_encoder_fx( init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); } -#ifndef NONBE_FIX_ISSUE_2518 - IF( st->hLPDmem != NULL ) - { - st->hLPDmem->q_lpd_old_exc = st->prev_Q_new; - move16(); - } -#endif /*-----------------------------------------------------------------* * FD-CNG encoder diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 8dfd5c9b9..be48aa037 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -211,15 +211,9 @@ void pre_proc_front_ivas_fx( Word16 sf_energySum[CLDFB_NO_CHANNELS_MAX]; Word16 Q_inp_const = -1; move16(); -#ifdef NONBE_FIX_ISSUE_2518 Word16 preemp_len; Word16 *preemp_start_idx = NULL; Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k /* = max( L_FRAME16k + STEREO_DFT_OVL_16k, L_FRAME16k + L_FILT16k + lMemRecalc_16k ) */]; -#else - Word16 headroom, preemp_len, inp_max; - Word16 *preemp_start_idx = NULL; - Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k /* = max( L_FRAME16k + STEREO_DFT_OVL_16k, L_FRAME16k + L_FILT16k + lMemRecalc_16k ) */], max_32; -#endif push_wmops( "pre_proc_front" ); /*------------------------------------------------------------------* @@ -578,15 +572,9 @@ void pre_proc_front_ivas_fx( #endif } #ifdef NONBE_FIX_ISSUE_2206 -#ifdef NONBE_FIX_ISSUE_2518 st->q_mem_decim_fx = add( st->q_inp, norm_arr( st->mem_decim_fx_q_inp, 2 * L_FILT_MAX ) ); move16(); Copy_Scale_sig_nosat( st->mem_decim_fx_q_inp, st->mem_decim_fx, 2 * L_FILT_MAX, sub( st->q_mem_decim_fx, st->q_inp ) ); -#else - Copy( st->mem_decim_fx_q_inp, st->mem_decim_fx, 2 * L_FILT_MAX ); - st->q_mem_decim_fx = st->q_inp; - move16(); -#endif Word16 q_buf_speech_enc; @@ -639,20 +627,6 @@ void pre_proc_front_ivas_fx( * Perform fixed preemphasis (12.8 kHz signal) through 1 - g*z^-1 *-----------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2518 -#ifdef NONBE_FIX_ISSUE_2206 - headroom = 0; - move16(); - if ( NE_32( input_Fs, st->sr_core ) ) - { - /* Increase headroom because of modify_Fs_fx() in ivas_core_pre_proc */ - headroom = add( headroom, 1 ); - } -#else - headroom = 2; - move16(); -#endif -#endif preemp_len = 0; move16(); @@ -748,7 +722,6 @@ void pre_proc_front_ivas_fx( move16(); st->mem_preemph_q = st->q_inp; move16(); -#ifdef NONBE_FIX_ISSUE_2518 Word16 shift = L_norm_arr( sig_out, preemp_len ); shift = s_min( shift, norm_arr( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ) ) ); shift = add( shift, st->q_inp ); @@ -770,54 +743,7 @@ void pre_proc_front_ivas_fx( *Q_new = s_min( shift, Q_MAX ); move16(); -#else - maximum_abs_32_fx( sig_out, preemp_len, &max_32 ); - inp_max = s_max( extract_h( max_32 ), 1 ); - Word16 shift = add( sub( norm_s( inp_max ), headroom ), st->q_inp ); -#ifdef NONBE_FIX_ISSUE_2206 - shift = s_min( shift, add( norm_arr( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ) ), st->q_inp ) ); - *Q_new = s_min( shift, Q_MAX ); - move16(); -#else - shift = s_max( shift, 0 ); - shift = s_min( shift, Q_MAX ); - minimum_fx( st->Q_max, L_Q_MEM, &Q_min ); - *Q_new = s_min( shift, Q_min ); - move16(); -#ifdef NONBE_FIX_ISSUE_2206 - IF( shr( inp_max, sub( st->q_inp, -1 ) ) == 0 ) -#else - IF( inp_max == 0 ) -#endif - { - IF( NE_16( st->last_coder_type, UNVOICED ) ) - { - *Q_new = s_min( *Q_new, 1 ); - move16(); - } - } - - FOR( i = L_Q_MEM - 1; i > 0; i-- ) - { - st->Q_max[i] = st->Q_max[i - 1]; - move16(); - } - st->Q_max[i] = shift; - move16(); -#endif -#endif - -#ifndef NONBE_FIX_ISSUE_2518 -#ifdef NONBE_FIX_ISSUE_2206 - /* Avoid saturation of resampling decimation buffer inside ivas_compute_core_buffers_fx(). */ - *Q_new = s_min( *Q_new, st->q_mem_decim16k_fx ); - /* Limit Q_new here to st->q_inp because inside ivas_compute_core_buffers_fx() st->input is rescaled to Q_new */ - *Q_new = s_min( *Q_new, st->q_inp ); -#endif - *Q_new = add( *Q_new, Q_inp_const ); - move16(); -#endif Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, sub( add( *Q_new, 1 ), st->q_inp ) ); /* Q_new */ Scale_sig( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ), sub( *Q_new, st->q_inp ) ); /* Q_new */ #ifdef NONBE_FIX_ISSUE_2206 diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index c51d269f8..822dfeee9 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -825,15 +825,9 @@ void ivas_compute_core_buffers_fx( #else Word16 i, shift, Q_min; #endif -#ifdef NONBE_FIX_ISSUE_2518 Word16 preemp_len; Word16 *preemp_start_idx = NULL; Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k + L_FILT16k]; -#else - Word16 preemp_len, inp_max; - Word16 *preemp_start_idx = NULL; - Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k + L_FILT16k], max_32; -#endif #ifdef NONBE_FIX_ISSUE_2206 assert( Q_old_inp_16k == ( *Q_new - 1 ) ); @@ -1325,7 +1319,6 @@ void ivas_compute_core_buffers_fx( preemp_len = L_FRAME16k + L_FILT16k; move16(); } -#ifdef NONBE_FIX_ISSUE_2518 shift = L_norm_arr( sig_out, preemp_len ); shift = s_min( shift, norm_arr( old_inp_16k_fx, (Word16) ( preemp_start_idx - old_inp_16k_fx ) ) ); shift = add( shift, Q_old_inp_16k ); @@ -1343,48 +1336,6 @@ void ivas_compute_core_buffers_fx( } *Q_new = s_min( shift, Q_MAX ); move16(); -#else - maximum_abs_32_fx( sig_out, preemp_len, &max_32 ); - inp_max = s_max( extract_h( max_32 ), 1 ); - -#ifdef NONBE_FIX_ISSUE_2206 - shift = add( norm_s( inp_max ), Q_old_inp_16k ); - shift = s_min( shift, add( norm_arr( old_inp_16k_fx, (Word16) ( preemp_start_idx - old_inp_16k_fx ) ), Q_old_inp_16k ) ); -#else - shift = sub( norm_s( inp_max ), 1 /* headroom */ ); -#endif - -#ifdef NONBE_FIX_ISSUE_2206 - *Q_new = s_min( shift, Q_MAX ); - move16(); -#else - shift = s_max( shift, 0 ); - shift = s_min( shift, Q_MAX ); - minimum_fx( st->Q_max_16k, L_Q_MEM, &Q_min ); - *Q_new = s_min( shift, Q_min ); - move16(); -#ifdef NONBE_FIX_ISSUE_2206 - IF( shr( inp_max, sub( Q_old_inp_16k, -1 ) ) == 0 ) -#else - IF( inp_max == 0 ) -#endif - { - IF( NE_16( st->last_coder_type, UNVOICED ) ) - { - *Q_new = s_min( *Q_new, 1 ); - move16(); - } - } - - FOR( i = L_Q_MEM - 1; i > 0; i-- ) - { - st->Q_max_16k[i] = st->Q_max_16k[i - 1]; - move16(); - } - st->Q_max_16k[i] = shift; - move16(); -#endif -#endif #ifndef NONBE_FIX_ISSUE_2206 Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, add( *Q_new, 1 ) ); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index c375f9dd8..865550aad 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1776,9 +1776,6 @@ typedef struct enc_core_structure * Fixed point only variables *----------------------------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2518 - Word16 Q_exc; -#endif Word16 Q_stat_noise_ge; Word16 Q_stat_noise; Word16 Q_syn2; diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c index bc48bfb7b..a203f2981 100644 --- a/lib_enc/updt_enc_fx.c +++ b/lib_enc/updt_enc_fx.c @@ -34,7 +34,6 @@ void updt_enc_fx( GSC_ENC_HANDLE hGSCEnc = st->hGSCEnc; TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; -#ifdef NONBE_FIX_ISSUE_2518 /* update old excitation buffer */ IF( st->element_mode > EVS_MONO ) { @@ -74,10 +73,6 @@ void updt_enc_fx( { Copy( &old_exc[st->L_frame], hLPDmem->old_exc, L_EXC_MEM ); } -#else - /* update old excitation buffer */ - Copy( &old_exc[st->L_frame], hLPDmem->old_exc, L_EXC_MEM ); -#endif test(); test(); IF( !st->Opt_AMR_WB && st->hBWE_TD != NULL ) -- GitLab From db2682d5b044165f08b32bd44a2dbb577e6dfd91 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:05 +0200 Subject: [PATCH 33/49] Accept NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX --- lib_enc/enc_higher_acelp_fx.c | 42 ----------------------------------- 1 file changed, 42 deletions(-) diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 9d74cedc9..c4c372d14 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -301,7 +301,6 @@ void transf_cdbk_enc_fx( * DCT transform *--------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX Word16 q_x_tran; IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { @@ -314,13 +313,6 @@ void transf_cdbk_enc_fx( q_x_tran = s_min( Q_AVQ_OUT_DEC, norm_arr( x_norm, Nsv * WIDTH_BAND ) ); Copy_Scale_sig_nosat( x_norm, x_tran, Nsv * WIDTH_BAND, q_x_tran ); } -#else - FOR( i = 0; i < Nsv * WIDTH_BAND; i++ ) - { - x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC ); - move16(); - } -#endif test(); test(); @@ -336,13 +328,8 @@ void transf_cdbk_enc_fx( edct2_fx( L_SUBFR, 1, x_tran, out32, &Qdct, ip_edct2_64, w_edct2_64_fx ); /*qdct = sub(Q_AVQ_OUT_DEC,qdct+Q_AVQ_OUT_DEC);*/ Qdct = negate( Qdct ); -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX Copy_Scale_sig_32_16( out32, code_preQ, L_SUBFR, Qdct ); /* Output in q_x_tran */ /*qdct = q_x_tran;*/ -#else - Copy_Scale_sig_32_16( out32, code_preQ, L_SUBFR, Qdct ); /* Output in Q_AVQ_OUT_DEC */ - /*qdct = Q_AVQ_OUT_DEC;*/ -#endif } /*--------------------------------------------------------------* @@ -368,27 +355,18 @@ void transf_cdbk_enc_fx( test(); IF( GT_16( st_fx->element_mode, EVS_MONO ) && NE_16( st_fx->coder_type, INACTIVE ) && GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && !harm_flag_acelp && code_preQ[0] != 0 ) { -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX IF( GT_16( abs_s( st_fx->last_code_preq ), shl_sat( abs_s( code_preQ[0] ), sub( Q_AVQ_OUT_DEC + 4, q_x_tran ) ) ) ) -#else - IF( GT_16( abs_s( st_fx->last_code_preq ), shl_sat( abs_s( code_preQ[0] ), 4 ) ) ) -#endif { st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 4 ); move16(); } -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX ELSE IF( GT_16( abs_s( st_fx->last_code_preq ), shl_sat( abs_s( code_preQ[0] ), sub( Q_AVQ_OUT_DEC + 3, q_x_tran ) ) ) ) -#else - ELSE IF( GT_16( abs_s( st_fx->last_code_preq ), shl_sat( abs_s( code_preQ[0] ), 3 ) ) ) -#endif { st_fx->mem_preemp_preQ_fx = shr( st_fx->mem_preemp_preQ_fx, 3 ); move16(); } } -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX st_fx->last_code_preq = shl_sat( code_preQ[L_SUBFR - 1], sub( 1, q_x_tran ) ); // Q0 ? Q1 move16(); @@ -397,12 +375,6 @@ void transf_cdbk_enc_fx( preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &( st_fx->mem_preemp_preQ_fx ) ); st_fx->mem_preemp_preQ_fx = shl_sat( st_fx->mem_preemp_preQ_fx, sub( Q_AVQ_OUT_DEC, q_x_tran ) ); move16(); -#else - st_fx->last_code_preq = shr( code_preQ[L_SUBFR - 1], 9 ); // Q0 - move16(); - - preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &( st_fx->mem_preemp_preQ_fx ) ); -#endif /*--------------------------------------------------------------* * For inactive segments @@ -415,36 +387,22 @@ void transf_cdbk_enc_fx( IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { /*ftemp = fcode_preQ[0] *fh1[L_SUBFR-1];*/ -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX Ltmp = L_mult( code_preQ[0], h1[L_SUBFR - 1] ); /*1+14+shift + q_x_tran */ -#else - Ltmp = L_mult( code_preQ[0], h1[L_SUBFR - 1] ); /*1+14+shift + Q_AVQ_OUT */ -#endif FOR( i = 1; i < L_SUBFR; i++ ) { /*ftemp += fcode_preQ[i] * fh1[L_SUBFR-1-i];*/ Ltmp = L_mac( Ltmp, code_preQ[i], h1[L_SUBFR - 1 - i] ); } /*fxn[L_SUBFR-1] -= *fgain_preQ * ftemp;*/ -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX Ltmp = L_shr( Mult_32_16( Ltmp, *gain_preQ ), sub( add( q_x_tran, 2 ), Q_new ) ); /* (2 + 1 + 14 +shift+Q_AVQ_OUT)-(Q_AVQ_OUT+2-Q_new) = 15 + Q_new + shift */ -#else - Ltmp = L_shr( Mult_32_16( Ltmp, *gain_preQ ), sub( add( Q_AVQ_OUT_DEC, 2 ), Q_new ) ); /* (2 + 1 + 14 +shift+Q_AVQ_OUT)-(Q_AVQ_OUT+2-Q_new) = 15 + Q_new + shift */ -#endif xn[L_SUBFR - 1] = round_fx( L_sub( L_mult( xn[L_SUBFR - 1], 32767 ), Ltmp ) ); /* -> Q_new + shift -1 */ } ELSE { conv_fx( code_preQ, h1, x_tran, L_SUBFR ); -#ifdef NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX updt_tar_HR_fx( cn, cn, code_preQ, *gain_preQ, sub( Q_new, add( -15 + 2, q_x_tran ) ), L_SUBFR ); updt_tar_HR_fx( xn, xn, x_tran, *gain_preQ, sub( Q_new, add( -15 + 2, q_x_tran ) ), L_SUBFR ); -#else - updt_tar_HR_fx( cn, cn, code_preQ, *gain_preQ, sub( Q_new, add( -15 + 2, Q_AVQ_OUT_DEC ) ), L_SUBFR ); - - updt_tar_HR_fx( xn, xn, x_tran, *gain_preQ, sub( Q_new, add( -15 + 2, Q_AVQ_OUT_DEC ) ), L_SUBFR ); -#endif *gain_pit = corr_xy1_fx( xn, y1, g_corr, L_SUBFR, 0, &Overflow ); /* Q14 */ move16(); /* clip gain if necessary to avoid problems at decoder */ -- GitLab From 9037cc597e8147c2f4f0153444d307731f42156c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:07 +0200 Subject: [PATCH 34/49] Accept NONBE_FIX_ISSUE_2569 --- lib_com/options.h | 1 - lib_enc/ivas_core_pre_proc_front_fx.c | 2 -- lib_enc/ivas_core_pre_proc_fx.c | 12 ------------ lib_enc/updt_enc_fx.c | 4 ---- 4 files changed, 19 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 55e9cef26..3372b1928 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define NONBE_FIX_ISSUE_2569 /* FhG: Fix issue 2569, overflow of mem_preemph16k_fx in LTV test. */ #define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ #define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index be48aa037..b90cdacc8 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -728,9 +728,7 @@ void pre_proc_front_ivas_fx( /* Avoid saturation of resampling/delay decimation buffer. */ shift = s_min( shift, st->q_mem_decim16k_fx ); -#ifdef NONBE_FIX_ISSUE_2569 shift = s_min( shift, add( -1, norm_arr( &st->mem_preemph16k_fx, 1 ) ) ); -#endif /* Limit Q_new here to st->q_inp because inside ivas_compute_core_buffers_fx() st->input is rescaled to Q_new */ shift = s_min( shift, st->q_inp ); diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 822dfeee9..a3799d14b 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -700,11 +700,7 @@ void pre_proc_ivas_fx( #ifdef NONBE_FIX_ISSUE_2206 // L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320 ); tmp = add( norm_arr( wsp_fx, L_FRAME + L_LOOK_12k8 ), sub( Q15, e_old_wsp ) ); -#ifdef NONBE_FIX_ISSUE_2569 tmp = s_min( tmp, add( norm_arr( &st->mem_wsp_enc, 1 ), sub( Q15, st->exp_buf_wspeech_enc ) ) ); -#else - tmp = s_min( tmp, add( norm_s( st->mem_wsp_enc ), sub( Q15, st->exp_buf_wspeech_enc ) ) ); -#endif tmp = s_min( tmp, add( norm_arr( st->buf_wspeech_enc, (Word16) ( st->wspeech_enc - st->buf_wspeech_enc ) ), sub( Q15, st->exp_buf_wspeech_enc ) ) ); tmp = s_min( tmp, add( norm_arr( st->wspeech_enc + L_FRAME + L_LOOK_12k8, /* L_NEXT_MAX_16k + */ 320 ), sub( Q15, st->exp_buf_wspeech_enc ) ) ); tmp = s_min( Q15, tmp ); @@ -1263,7 +1259,6 @@ void ivas_compute_core_buffers_fx( IF( EQ_16( st->L_frame, L_FRAME16k ) ) { #ifdef NONBE_FIX_ISSUE_2206 -#ifdef NONBE_FIX_ISSUE_2569 Word16 buf_speech_enc_q; buf_speech_enc_q = s_min( sub( Q15, st->exp_buf_speech_enc ), Q_old_inp_16k ); @@ -1273,9 +1268,6 @@ void ivas_compute_core_buffers_fx( scale_sig( st->buf_speech_enc + L_FRAME16k + L_FRAME16k, L_PAST_MAX_32k + L_NEXT_MAX_32k, sub( buf_speech_enc_q, sub( Q15, st->exp_buf_speech_enc ) ) ); st->exp_buf_speech_enc = sub( Q15, buf_speech_enc_q ); move16(); -#else - Copy_Scale_sig_nosat( new_inp_16k_fx - lMemRecalc_16k, st->buf_speech_enc + sub( L_FRAME16k - L_FILT16k, lMemRecalc_16k ), add( lMemRecalc_16k, L_FRAME16k + L_FILT16k ), sub( sub( Q15, st->exp_buf_speech_enc ), Q_old_inp_16k ) ); /* Q_new - 1 */ -#endif #else Copy( new_inp_16k_fx - lMemRecalc_16k, st->buf_speech_enc + sub( L_FRAME16k - L_FILT16k, lMemRecalc_16k ), add( lMemRecalc_16k, L_FRAME16k + L_FILT16k ) ); /* Q_new - 1 */ #endif @@ -1323,10 +1315,6 @@ void ivas_compute_core_buffers_fx( shift = s_min( shift, norm_arr( old_inp_16k_fx, (Word16) ( preemp_start_idx - old_inp_16k_fx ) ) ); shift = add( shift, Q_old_inp_16k ); -#ifndef NONBE_FIX_ISSUE_2569 - /* Avoid saturation of resampling/delay decimation buffer. */ - shift = s_min( shift, add( st->q_mem_decim16k_fx, 1 ) ); -#endif IF( st->hLPDmem != NULL ) { diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c index a203f2981..b1d4db1c6 100644 --- a/lib_enc/updt_enc_fx.c +++ b/lib_enc/updt_enc_fx.c @@ -54,11 +54,7 @@ void updt_enc_fx( tmp = s_min( tmp, norm_arr( hLPDmem->mem_syn2, M ) ); tmp = s_min( tmp, norm_arr( hLPDmem->mem_syn3, M ) ); tmp = s_min( tmp, norm_arr( hLPDmem->mem_syn_r, L_SYN_MEM ) ); -#ifdef NONBE_FIX_ISSUE_2569 tmp = s_min( tmp, norm_arr( &hLPDmem->mem_w0, 1 ) ); -#else - tmp = s_min( tmp, norm_s( hLPDmem->mem_w0 ) ); -#endif tmp = s_min( tmp, sub( 15, hLPDmem->q_mem_syn ) ); scale_sig( hLPDmem->mem_syn, M, tmp ); scale_sig( hLPDmem->mem_syn1_fx, M, tmp ); -- GitLab From b2ceb7b68ce8306dca716b459d54660c7dd63831 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:10 +0200 Subject: [PATCH 35/49] Accept FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET --- lib_com/options.h | 1 - lib_dec/ivas_stereo_switching_dec_fx.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3372b1928..706411126 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ #define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ #define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index f0684a3f4..77e1ed56b 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -82,10 +82,8 @@ static ivas_error allocate_CoreCoder_TCX_fx( st->hTcxDec->q_old_synth = 0; move16(); set16_fx( st->hTcxDec->synth_history_fx, 0, L_PROT48k + L_FRAME48k ); -#ifdef FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET st->hTcxDec->q_synth_history_fx = 0; move16(); -#endif } IF( st->hTcxCfg == NULL ) -- GitLab From 5e0081932472366c5261090c4a562607474b589a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:12 +0200 Subject: [PATCH 36/49] Accept FIX_FLOAT_1578_OMASA_REND_SPIKES --- lib_com/ivas_cnst.h | 4 - lib_com/options.h | 1 - lib_dec/ivas_dirac_dec_fx.c | 4 - lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 2 - lib_rend/ivas_dirac_rend_fx.c | 147 ------------------ lib_rend/ivas_prot_rend_fx.h | 4 - lib_rend/ivas_stat_rend.h | 2 - lib_rend/lib_rend_fx.c | 4 - 8 files changed, 168 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0fd59b66a..c1d22b029 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1256,12 +1256,8 @@ typedef enum { MASA_STEREO_NOT_DEFINED, MASA_STEREO_SPACED_MICS, -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES MASA_STEREO_DOWNMIX, MASA_DUAL_MONO -#else - MASA_STEREO_DOWNMIX -#endif } MASA_TRANSPORT_SIGNAL_TYPE; typedef enum diff --git a/lib_com/options.h b/lib_com/options.h index 706411126..b0d729239 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ #define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ #define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ #define FIX_BASOP_2571_MASA_EXT_RENDER_FIXES /* Nokia: BASOP issue 2571: Fix MASA EXT DirAC renderer by unifying it with decoder */ diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 23e90009b..ecde2403f 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -364,11 +364,7 @@ static ivas_error ivas_dirac_rend_config_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect, ivas_total_brate ); -#else - ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect ); -#endif } ELSE { diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 0a6afb017..97891f518 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -3001,14 +3001,12 @@ void ivas_dirac_dec_compute_directional_responses_fx( move32(); } } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES ELSE IF( EQ_16( transport_signal_type, MASA_DUAL_MONO ) ) { direct_response_fx[0] = ONE_IN_Q29; /*q29*/ move32(); /* direct_response[1] is not adjusted for dual mono input */ } -#endif ELSE { set32_fx( direct_response_fx, ONE_IN_Q29, hDirACRend->num_protos_ambi ); /*q29*/ diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 1bb65d4a7..47e5b1709 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -41,7 +41,6 @@ #include "ivas_prot_fx.h" #include "ivas_rom_binaural_crend_head.h" -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ @@ -49,7 +48,6 @@ /* Constants for MASA dual mono detection */ #define MASA_DUAL_MONO_TAU1_FX 33554432 /* Q31, float 0.01562500000000000f, which is 2^-6, which is about -18 dB */ #define MASA_DUAL_MONO_TAU2_FX 16384 /* Q31, float 0.00000762939453125f, which is 2^-17, which is about -51 dB */ -#endif /*------------------------------------------------------------------------- * ivas_dirac_allocate_parameters() @@ -1730,16 +1728,11 @@ void protoSignalComputation2_fx( Word16 q_sum_total_ratio = 0; move16(); Word32 a_fx, b_fx, a2_fx, b2_fx; -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES Word16 interpolatorSpaced_fx, interpolatorDmx_fx, interpolatorDualMono_fx; Word32 tempSpaced_fx, tempDmx_fx, tempDualMono_fx; Word64 inst_diff_bb_power_64fx; Word16 inst_diff_bb_power_norm; Word16 max_band_diff_ene; -#else - Word16 interpolatorSpaced_fx, interpolatorDmx_fx; - Word32 tempSpaced_fx, tempDmx_fx; -#endif Word16 q_shift, min_q_shift[2], exp, q_temp[2]; Word32 temp; Word64 W_tmp1, W_tmp2, W_tmp3; @@ -1760,7 +1753,6 @@ void protoSignalComputation2_fx( move16(); interpolatorDmx_fx = MAX16B; move16(); -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES interpolatorDualMono_fx = 0; move16(); @@ -1770,7 +1762,6 @@ void protoSignalComputation2_fx( { max_band_diff_ene = s_min( stereo_type_detect->max_band_diff_ene, num_freq_bands ); /* Local version for correct maximum */ } -#endif /* Calculate the max shift possible for the buffers RealBuffer_fx and ImagBuffer_fx */ FOR( l = 0; l < 2; l++ ) @@ -1943,7 +1934,6 @@ void protoSignalComputation2_fx( total_hi_power_fx = 0; move32(); -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES inst_diff_bb_power_64fx = 0; move64(); @@ -1957,7 +1947,6 @@ void protoSignalComputation2_fx( stereo_type_detect->q_inst_total_bb_power_fx = Q31; move16(); -#endif dipole_freq_range[0] = stereo_type_detect->dipole_freq_range[0]; move16(); dipole_freq_range[1] = stereo_type_detect->dipole_freq_range[1]; @@ -1978,12 +1967,9 @@ void protoSignalComputation2_fx( /* interpolatorSpaced = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); */ interpolatorSpaced_fx = i_mult_sat( stereo_type_detect->interpolator, 2048 /* 1 / MASA_STEREO_INTERPOLATION_SLOTS in Q15 */ ); /* Q15 */ interpolatorDmx_fx = sub( MAX16B, interpolatorSpaced_fx ); /* Q15 */ -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES interpolatorDualMono_fx = interpolatorDmx_fx; move16(); -#endif } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES ELSE IF( EQ_16( stereo_type_detect->type_change_direction, MASA_DUAL_MONO ) ) { /* interpolatorDualMono = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); */ @@ -1992,16 +1978,13 @@ void protoSignalComputation2_fx( interpolatorSpaced_fx = interpolatorDmx_fx; move16(); } -#endif ELSE { /* interpolatorDmx = ( (float) ( stereo_type_detect->interpolator ) ) / ( (float) MASA_STEREO_INTERPOLATION_SLOTS ); */ interpolatorDmx_fx = i_mult_sat( stereo_type_detect->interpolator, 2048 /* 1 / MASA_STEREO_INTERPOLATION_SLOTS in Q15 */ ); /* Q15 */ interpolatorSpaced_fx = sub( MAX16B, interpolatorDmx_fx ); /* Q15 */ -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES interpolatorDualMono_fx = interpolatorSpaced_fx; move16(); -#endif } } @@ -2142,7 +2125,6 @@ void protoSignalComputation2_fx( q_sum_total_ratio = s_max( q_sum_total_ratio, exp_sum_total_ratio_fx[l] ); } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES RealSubtract_fx = L_sub( re1, re2 ); // q_cldfb+min_q_shift ImagSubtract_fx = L_sub( im1, im2 ); // q_cldfb+min_q_shift @@ -2179,80 +2161,12 @@ void protoSignalComputation2_fx( } } } -#else - IF( l == 0 ) - { - RealSubtract_fx = L_sub( re1, re2 ); // q_cldfb+min_q_shift - ImagSubtract_fx = L_sub( im1, im2 ); // q_cldfb+min_q_shift - - temp = Madd_32_32( Mpy_32_32( RealSubtract_fx, RealSubtract_fx ), ImagSubtract_fx, ImagSubtract_fx ); // 2*(q_cldfb+min_q_shift)-31 - assert( qidx == 0 ); - IF( LT_16( q_temp[qidx], stereo_type_detect->q_subtract_power_y ) ) - { - stereo_type_detect->subtract_power_y_fx = L_add( L_shr( stereo_type_detect->subtract_power_y_fx, sub( stereo_type_detect->q_subtract_power_y, q_temp[qidx] ) ), temp ); // q_temp - move32(); - stereo_type_detect->q_subtract_power_y = q_temp[qidx]; - move16(); - } - ELSE - { - stereo_type_detect->subtract_power_y_fx = L_add( stereo_type_detect->subtract_power_y_fx, L_shr( temp, sub( q_temp[qidx], stereo_type_detect->q_subtract_power_y ) ) ); // stereo_type_detect->q_subtract_power_y - move32(); - } - } -#endif /* Compute protos (and their power) for direct sound rendering */ /* W prototype */ IF( stereo_type_detect->interpolator > 0 ) { -#ifndef FIX_FLOAT_1578_OMASA_REND_SPIKES - IF( L_or( LT_16( l, sub( dipole_freq_range[1], 1 ) ), GE_16( l, MASA_SUM_PROTO_START_BIN ) ) ) - { - Real_aux_fx = Madd_32_16( Mpy_32_16_1( Real_aux_fx, shr( interpolatorSpaced_fx, 1 ) ), Real_aux_fx, interpolatorDmx_fx ); // q_cldfb+min_q_shift - Imag_aux_fx = Madd_32_16( Mpy_32_16_1( Imag_aux_fx, shr( interpolatorSpaced_fx, 1 ) ), Imag_aux_fx, interpolatorDmx_fx ); // q_cldfb+min_q_shift - - temp = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift) -31 - IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) - { - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp - move32(); - } - ELSE - { - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth - move32(); - } - - p_proto_buffer_fx[2 * l] = Real_aux_fx; // q_cldfb+min_q_shift - move32(); - p_proto_buffer_fx[2 * l + 1] = Imag_aux_fx; // q_cldfb+min_q_shift - move32(); - } - ELSE - { - tempSpaced_fx = Madd_32_32( Mpy_32_32( re1, re1 ), im1, im1 ); // 2*(q_cldfb+min_q_shift)-31 - tempDmx_fx = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift)-31 - - temp = Madd_32_16( Mpy_32_16_1( tempSpaced_fx, interpolatorSpaced_fx ), tempDmx_fx, interpolatorDmx_fx ); // 2*(q_cldfb+min_q_shift)-31 - IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) - { - proto_power_smooth_fx[l] = L_add( L_shr( proto_power_smooth_fx[l], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp - move32(); - } - ELSE - { - proto_power_smooth_fx[l] = L_add( proto_power_smooth_fx[l], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth - move32(); - } - - p_proto_buffer_fx[2 * l] = Madd_32_16( Mpy_32_16_1( re1, interpolatorSpaced_fx ), Real_aux_fx, interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - p_proto_buffer_fx[2 * l + 1] = Madd_32_16( Mpy_32_16_1( im1, interpolatorSpaced_fx ), Imag_aux_fx, interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - } -#else test(); test(); test(); @@ -2383,7 +2297,6 @@ void protoSignalComputation2_fx( p_proto_buffer_fx[2 * l + 1] = Imag_aux_fx; // q_cldfb+min_q_shift move32(); } -#endif } ELSE IF( EQ_16( stereo_type_detect->masa_stereo_type, MASA_STEREO_SPACED_MICS ) ) { @@ -2429,7 +2342,6 @@ void protoSignalComputation2_fx( move32(); } } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES ELSE IF( EQ_16( stereo_type_detect->masa_stereo_type, MASA_DUAL_MONO ) ) { Real_aux_fx = L_shr( Real_aux_fx, 1 ); // q_cldfb+min_q_shift @@ -2452,9 +2364,6 @@ void protoSignalComputation2_fx( move32(); } ELSE /* MASA_STEREO_DOWNMIX */ -#else - ELSE -#endif { temp = Madd_32_32( Mpy_32_32( Real_aux_fx, Real_aux_fx ), Imag_aux_fx, Imag_aux_fx ); // 2*(q_cldfb+min_q_shift)-31 IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) @@ -2477,41 +2386,6 @@ void protoSignalComputation2_fx( /* Y prototype */ IF( stereo_type_detect->interpolator > 0 ) { -#ifndef FIX_FLOAT_1578_OMASA_REND_SPIKES - IF( LT_16( l, dipole_freq_range[0] ) ) - { - p_proto_buffer_fx[2 * ( num_freq_bands + l )] = Madd_32_16( Mpy_32_16_1( p_proto_buffer_fx[2 * l], interpolatorSpaced_fx ), L_sub( re1, re2 ), interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] = Madd_32_16( Mpy_32_16_1( p_proto_buffer_fx[2 * l + 1], interpolatorSpaced_fx ), L_sub( im1, im2 ), interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - } - ELSE IF( LT_16( l, dipole_freq_range[1] ) ) - { - p_proto_buffer_fx[2 * ( num_freq_bands + l )] = Madd_32_16( Mpy_32_16_1( L_sub( im1, im2 ), interpolatorSpaced_fx ), L_sub( re1, re2 ), interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] = Madd_32_16( Mpy_32_16_1( -L_sub( re1, re2 ), interpolatorSpaced_fx ), L_sub( im1, im2 ), interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - } - ELSE - { - p_proto_buffer_fx[2 * ( num_freq_bands + l )] = Madd_32_16( Mpy_32_16_1( p_proto_buffer_fx[2 * l], interpolatorSpaced_fx ), L_sub( re1, re2 ), interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] = Madd_32_16( Mpy_32_16_1( p_proto_buffer_fx[2 * l + 1], interpolatorSpaced_fx ), L_sub( im1, im2 ), interpolatorDmx_fx ); // q_cldfb+min_q_shift - move32(); - } - - temp = Madd_32_32( Mpy_32_32( p_proto_buffer_fx[2 * ( num_freq_bands + l )], p_proto_buffer_fx[2 * ( num_freq_bands + l )] ), p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1], p_proto_buffer_fx[2 * ( num_freq_bands + l ) + 1] ); // 2*(q_cldfb+min_q_shift)-31 - IF( LT_16( q_temp[qidx], q_proto_power_smooth[qidx] ) ) - { - proto_power_smooth_fx[l + num_freq_bands] = L_add( L_shr( proto_power_smooth_fx[l + num_freq_bands], sub( q_proto_power_smooth[qidx], q_temp[qidx] ) ), temp ); // q_temp - move32(); - } - ELSE - { - proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth - move32(); - } -#else test(); test(); test(); @@ -2587,7 +2461,6 @@ void protoSignalComputation2_fx( proto_power_smooth_fx[l + num_freq_bands] = L_add( proto_power_smooth_fx[l + num_freq_bands], L_shr( temp, sub( q_temp[qidx], q_proto_power_smooth[qidx] ) ) ); // q_proto_power_smooth move32(); } -#endif } ELSE IF( EQ_16( stereo_type_detect->masa_stereo_type, MASA_STEREO_SPACED_MICS ) ) { @@ -2629,7 +2502,6 @@ void protoSignalComputation2_fx( move32(); } } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES ELSE IF( EQ_16( stereo_type_detect->masa_stereo_type, MASA_DUAL_MONO ) ) { /* proto = W */ @@ -2641,9 +2513,6 @@ void protoSignalComputation2_fx( move32(); } ELSE /* MASA_STEREO_DOWNMIX */ -#else - ELSE -#endif { p_proto_buffer_fx[2 * ( num_freq_bands + l )] = L_sub( re1, re2 ); // q_cldfb+min_q_shift move32(); @@ -2818,14 +2687,12 @@ void protoSignalComputation2_fx( stereo_type_detect->min_sum_total_ratio_db_fx = min_sum_total_ratio_db_fx; // Q21 move32(); -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES /* Convert inst_diff to Word32 */ inst_diff_bb_power_norm = W_norm( inst_diff_bb_power_64fx ); stereo_type_detect->inst_diff_bb_power_fx = W_extract_h( W_shl( inst_diff_bb_power_64fx, inst_diff_bb_power_norm ) ); move32(); stereo_type_detect->q_inst_diff_bb_power_fx = add( shl( add( q_cldfb, s_min( min_q_shift[0], min_q_shift[1] ) ), 1 ), sub( inst_diff_bb_power_norm, 32 ) ); move16(); -#endif ivas_masa_stereotype_detection_fx( stereo_type_detect ); } @@ -3394,12 +3261,8 @@ void computeDirectionAngles_fx( *------------------------------------------------------------------------*/ void ivas_masa_init_stereotype_detection_fx( -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES MASA_STEREO_TYPE_DETECT *stereo_type_detect, Word32 ivas_total_brate_fx ) -#else - MASA_STEREO_TYPE_DETECT *stereo_type_detect ) -#endif { stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; move32(); @@ -3471,7 +3334,6 @@ void ivas_masa_init_stereotype_detection_fx( move32(); stereo_type_detect->subtract_target_ratio_db_fx = 0; move32(); -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES stereo_type_detect->inst_diff_bb_power_fx = 0; move32(); @@ -3489,7 +3351,6 @@ void ivas_masa_init_stereotype_detection_fx( stereo_type_detect->max_band_diff_ene = 18; move16(); } -#endif return; } @@ -3518,12 +3379,10 @@ void ivas_masa_stereotype_detection_fx( Word32 lr_total_bb_temp_fx; Word32 lr_total_hi_temp_fx; Word32 temp; -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES Word16 change_to_dual_mono_selection; Word32 diffPerSum_fx; /* Q31 */ Word16 scale; Word32 tau; /* Q31 */ -#endif lr_total_bb_ratio_db_fx = stereo_type_detect->lr_total_bb_ratio_db_fx; // q21 move32(); @@ -3534,7 +3393,6 @@ void ivas_masa_stereotype_detection_fx( subtract_target_ratio_db_fx = stereo_type_detect->subtract_target_ratio_db_fx; // q21 move32(); -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES /* Determine if broadband energy and ratio between difference broadband energy and broadband energy indicate * that the signal type is dual mono */ change_to_dual_mono_selection = 0; @@ -3560,7 +3418,6 @@ void ivas_masa_stereotype_detection_fx( } } -#endif /* Determine if the determined features match the spaced mic type */ change_to_spaced_selection = 0; move16(); @@ -3637,16 +3494,12 @@ void ivas_masa_stereotype_detection_fx( } ELSE { -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES IF( EQ_16( change_to_dual_mono_selection, 1 ) ) { stereo_type_detect->masa_stereo_type = MASA_DUAL_MONO; move32(); } ELSE IF( EQ_16( change_to_spaced_selection, 1 ) ) -#else - IF( EQ_16( change_to_spaced_selection, 1 ) ) -#endif { stereo_type_detect->masa_stereo_type = MASA_STEREO_SPACED_MICS; move32(); diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 2650e6180..a0c7ddd5a 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -357,12 +357,8 @@ void computeDirectionAngles_fx( ); void ivas_masa_init_stereotype_detection_fx( -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES MASA_STEREO_TYPE_DETECT *stereo_type_detect, Word32 ivas_total_brate_fx -#else - MASA_STEREO_TYPE_DETECT *stereo_type_detect -#endif ); void ivas_masa_stereotype_detection_fx( diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 85434651c..aa224aee1 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -384,14 +384,12 @@ typedef struct Word32 min_sum_total_ratio_db_fx; /* Q21 */ Word32 subtract_target_ratio_db_fx; /* Q21 */ -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES Word32 inst_diff_bb_power_fx; /* Q(q_inst_diff_bb_power_fx) */ Word16 q_inst_diff_bb_power_fx; Word32 inst_total_bb_power_fx; /* Q(q_inst_total_bb_power_fx) */ Word16 q_inst_total_bb_power_fx; Word16 max_band_diff_ene; -#endif Word16 counter; Word16 interpolator; diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 23058f300..032050b0e 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -10551,11 +10551,7 @@ static ivas_error ivas_masa_ext_rend_dirac_rend_init( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } -#ifdef FIX_FLOAT_1578_OMASA_REND_SPIKES ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect, IVAS_512k ); /* Use 512k to get correct path */ -#else - ivas_masa_init_stereotype_detection_fx( hDirACRend->masa_stereo_type_detect ); -#endif } ELSE { -- GitLab From 1841d3491d819c7dc72845fe6c17a8726e7dd3e2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:14 +0200 Subject: [PATCH 37/49] Accept FIX_1521_SBA_LOUDNESS_STEREO --- lib_com/options.h | 1 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 10 ---------- lib_rend/ivas_allrad_dec_fx.c | 7 ------- 3 files changed, 18 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b0d729239..8a45c70b2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ #define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ #define FIX_BASOP_2571_MASA_EXT_RENDER_FIXES /* Nokia: BASOP issue 2571: Fix MASA EXT DirAC renderer by unifying it with decoder */ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 1e39811e2..c49bb795d 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1519,14 +1519,8 @@ void ivas_sba_dirac_stereo_dec_fx( synchro_synthesis_fx( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/, q_dft[0] ); /* output scaling */ -#ifdef FIX_1521_SBA_LOUDNESS_STEREO IF( !sba_mono_flag ) -#else - test(); - IF( !sba_mono_flag && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) ) -#endif { -#ifdef FIX_1521_SBA_LOUDNESS_STEREO test(); IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) ) { @@ -1542,10 +1536,6 @@ void ivas_sba_dirac_stereo_dec_fx( v_multc_fx( output[0], INV_SQRT2_FX, output[0], output_frame ); v_multc_fx( output[1], INV_SQRT2_FX, output[1], output_frame ); } -#else - v_shr( output[0], 1, output[0], output_frame ); /*0.5f*/ - v_shr( output[1], 1, output[1], output_frame ); /*0.5f*/ -#endif } /* delay HB synth */ diff --git a/lib_rend/ivas_allrad_dec_fx.c b/lib_rend/ivas_allrad_dec_fx.c index 56b9bd7e9..43f673961 100644 --- a/lib_rend/ivas_allrad_dec_fx.c +++ b/lib_rend/ivas_allrad_dec_fx.c @@ -98,17 +98,10 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( } ELSE IF( EQ_32( hOutSetup.output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { -#ifdef FIX_1521_SBA_LOUDNESS_STEREO ( *hoa_dec_mtx )[0] = INV_SQRT2_FX >> 2; ( *hoa_dec_mtx )[1] = INV_SQRT2_FX >> 2; ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = INV_SQRT2_FX >> 2; ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -( INV_SQRT2_FX >> 2 ); -#else - ( *hoa_dec_mtx )[0] = ONE_IN_Q28; // 0.5f in Q29 - ( *hoa_dec_mtx )[1] = ONE_IN_Q28; // 0.5f in Q29 - ( *hoa_dec_mtx )[SBA_NHARM_HOA3] = ONE_IN_Q28; // 0.5f in Q29 - ( *hoa_dec_mtx )[SBA_NHARM_HOA3 + 1] = -ONE_IN_Q28; // 0.5f in Q29 -#endif move32(); move32(); move32(); -- GitLab From 3f3e94bfe020c3de14976f1b776d281dc88afc15 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:16 +0200 Subject: [PATCH 38/49] Accept FIX_1559 --- lib_com/fd_cng_com_fx.c | 2 -- lib_com/options.h | 1 - lib_dec/fd_cng_dec_fx.c | 6 ------ 3 files changed, 9 deletions(-) diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 9b13274d8..77b9d418f 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -112,10 +112,8 @@ void initFdCngCom( move16(); hFdCngCom->stopFFTbin = 0; move16(); -#ifdef FIX_1559 hFdCngCom->nFFTpart = 0; move16(); -#endif hFdCngCom->frameSize = 0; move16(); hFdCngCom->fftlen = 0; diff --git a/lib_com/options.h b/lib_com/options.h index 8a45c70b2..a848ca71e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ #define FIX_BASOP_2571_MASA_EXT_RENDER_FIXES /* Nokia: BASOP issue 2571: Fix MASA EXT DirAC renderer by unifying it with decoder */ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 3aa0562c3..dc24fc6f9 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -3923,9 +3923,7 @@ void configureFdCngDec_fx( { Word16 j, stopBandFR; HANDLE_FD_CNG_COM hsCom = hFdCngDec->hFdCngCom; -#ifdef FIX_1559 Word16 nFFTpart_prev; -#endif hsCom->CngBandwidth = bwidth; /*Q0*/ move16(); @@ -4060,10 +4058,8 @@ void configureFdCngDec_fx( hsCom->stopBand = add( hsCom->FdCngSetup.sidPartitions[( hsCom->FdCngSetup.numPartitions - 1 )], 1 ); /*Q0*/ initPartitions( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_norm, &hsCom->psize_norm_exp, hsCom->psize_inv, 0 ); -#ifdef FIX_1559 nFFTpart_prev = hsCom->nFFTpart; move16(); -#endif IF( EQ_16( hsCom->stopFFTbin, 160 ) ) { hsCom->nFFTpart = 17; @@ -4089,7 +4085,6 @@ void configureFdCngDec_fx( move16(); } -#ifdef FIX_1559 /* In case of going from a lower number of partitions to a higher number, initialize the higher ines which might be zero and/or outdated with the highest partitions value this avoids almost-zero values to linger around and causing signal bursts after switching to higher bitrate. @@ -4102,7 +4097,6 @@ void configureFdCngDec_fx( move16(); } } -#endif stopBandFR = 40; //(Word16)floor(1000.f /*Hz*/ / 25.f /*Hz/Bin*/); move16(); -- GitLab From f92737e4bb40252551d82f8226b155493dd8606a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:18 +0200 Subject: [PATCH 39/49] Accept FIX_BASOP_2571_MASA_EXT_RENDER_FIXES --- lib_com/options.h | 1 - lib_rend/ivas_dirac_rend_fx.c | 30 ---- lib_rend/lib_rend_fx.c | 255 ---------------------------------- 3 files changed, 286 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a848ca71e..bc189aaa5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_BASOP_2571_MASA_EXT_RENDER_FIXES /* Nokia: BASOP issue 2571: Fix MASA EXT DirAC renderer by unifying it with decoder */ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index 47e5b1709..82e23fce0 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -3896,13 +3896,11 @@ static void ivas_masa_ext_dirac_render_sf_fx( Word32 dirEne_fx; Word32 surCohEner_fx; move16(); -#ifdef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES Word16 tmp1; Word16 size; Word16 shift; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; -#endif FOR( Word16 ii = 0; ii < MAX_OUTPUT_CHANNELS; ii++ ) { @@ -3957,7 +3955,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); } -#ifdef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { IF( hDirACRend->masa_stereo_type_detect ) @@ -4071,7 +4068,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( } } -#endif /* Subframe loop */ slot_idx_start = hSpatParamRendCom->slots_rendered; move16(); @@ -4083,10 +4079,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( md_idx = hSpatParamRendCom->render_to_md_map[subframe_idx]; move16(); -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES - DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); -#endif /* copy parameters into local buffers*/ @@ -4623,33 +4615,13 @@ static void ivas_masa_ext_dirac_render_sf_fx( } ELSE { -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES - IF( hDirACRend->proto_signal_decorr_on ) - { - Word16 new_proto_diffuse_buffer_f_q = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len ); - Word16 new_proto_direct_buffer_f_q = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len ); - - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, new_proto_diffuse_buffer_f_q ); // hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q + new_proto_diffuse_buffer_f_q - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len, new_proto_direct_buffer_f_q ); // hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q + new_proto_direct_buffer_f_q - hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q = add( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, new_proto_direct_buffer_f_q ); - move16(); - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = add( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, new_proto_diffuse_buffer_f_q ); - move16(); - } - -#endif Word16 reference_power_temp_q = getScaleFactor32( DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len ); scale_sig32( DirAC_mem.reference_power_fx, DirAC_mem.reference_power_len, reference_power_temp_q ); /*DirAC_mem.reference_power_q + reference_power_temp_q*/ DirAC_mem.reference_power_q[0] = add( DirAC_mem.reference_power_q[0], reference_power_temp_q ); DirAC_mem.reference_power_q[1] = add( DirAC_mem.reference_power_q[1], reference_power_temp_q ); move16(); -#ifdef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0]; DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1]; -#else - DirAC_mem.reference_power_smooth_q[0] = add( DirAC_mem.reference_power_q[0], reference_power_temp_q ); - DirAC_mem.reference_power_smooth_q[1] = add( DirAC_mem.reference_power_q[1], reference_power_temp_q ); -#endif move16(); Word16 q_cy_auto_diff_smooth = getScaleFactor32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_len ); @@ -4757,7 +4729,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( DirAC_mem.reference_power_smooth_q[1] = s_min( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q[1], DirAC_mem.reference_power_q[1] ); move16(); -#ifdef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES IF( NE_16( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, Q26 ) ) { Scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, @@ -4777,7 +4748,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( move16(); } -#endif ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, hSpatParamRendCom, diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 032050b0e..e1c8ec96f 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -242,10 +242,6 @@ struct IVAS_REND static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig, const RENDER_CONFIG_DATA *hRendCfg, hrtf_handles *hHrtfs ); static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ); -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES - -static void intermidiate_ext_dirac_render( MASA_EXT_REND_HANDLE hMasaExtRend, Word16 to_fix ); -#endif static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, Word32 Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const Word16 low_res_pre_rend_rot, const Word16 num_subframes, const Word16 Q_in ); static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, Word32 out[][L_FRAME48k], const Word16 *pq_fact ); @@ -9330,16 +9326,6 @@ static ivas_error renderInputMasa( case RENDERER_DIRAC: copyMasaMetadataToDiracRenderer_fx( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES - intermidiate_ext_dirac_render( masaInput->hMasaExtRend, 1 ); -#endif -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES - FOR( ch = 0; ch < masaInput->hMasaExtRend->hDirACRend->hOutSetup.nchan_out_woLFE + masaInput->hMasaExtRend->hDirACRend->hOutSetup.num_lfe; ch++ ) - { - masaInput->hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state = Q11; - move16(); - } -#endif FOR( ch = 0; ch < inAudio.config.numChannels; ch++ ) { Scale_sig32( tmpBuffer_buff_fx[ch], inAudio.config.numSamplesPerChannel, sub( Q11, *outAudio.pq_fact ) ); /* Q11 */ @@ -9359,9 +9345,6 @@ static ivas_error renderInputMasa( move16(); } -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES - intermidiate_ext_dirac_render( masaInput->hMasaExtRend, 0 ); -#endif BREAK; case RENDERER_STEREO_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC: @@ -11283,244 +11266,6 @@ static void freeMasaExtRenderer( return; } -#ifndef FIX_BASOP_2571_MASA_EXT_RENDER_FIXES -static void intermidiate_ext_dirac_render( - MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ - Word16 to_fix ) -{ - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; - DIRAC_DEC_STACK_MEM DirAC_mem; - Word16 ch; - DIRAC_REND_HANDLE hDirACRend; - Word16 subframe_idx; - Word16 slot_idx; - Word16 nchan_transport; - Word16 tmp; - - hDirACRend = hMasaExtRend->hDirACRend; - hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; - nchan_transport = hMasaExtRend->nchan_input; - DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - - h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); - - subframe_idx = hSpatParamRendCom->subframes_rendered; - move16(); - - DirAC_mem = hDirACRend->stack_mem; - - IF( to_fix ) - { - DirAC_mem.reference_power_smooth_q[0] = DirAC_mem.reference_power_q[0] = Q31; - DirAC_mem.reference_power_smooth_q[1] = DirAC_mem.reference_power_q[1] = Q31; - move16(); - move16(); - move16(); - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.direct_responses_fx, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ), sub( Q30, hDirACRend->h_output_synthesis_psd_state.direct_responses_q ) ); /* Q30 */ - hDirACRend->h_output_synthesis_psd_state.direct_responses_q = Q30; - move16(); - } - - IF( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx ) - { - Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth + shift) */ - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, shift ); - move16(); - } - IF( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx ) - { - Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev + shift) */ - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, shift ); - move16(); - } - - IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx ) - { - Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth + shift) */ - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, shift ); - move16(); - } - - IF( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx ) - { - tmp = L_norm_arr( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len ); - scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len, tmp ); /* Q(h_dirac_output_synthesis_state->q_cy_auto_diff_smooth + tmp) */ - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, tmp ); - move16(); - } - - IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx ) - { - tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev + tmp) */ - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, tmp ); - move16(); - } - - scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_len, sub( Q26, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q ) ); /* Q26 */ - hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = Q26; - move16(); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_len, sub( Q26, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q ) ); /* Q26 */ - hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; - move16(); - IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx ) - { - Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev + shift) */ - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, shift ); - move16(); - } - - IF( EQ_16( hDirACRend->proto_signal_decorr_on, 1 ) ) - { - tmp = L_norm_arr( hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_fx, hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_len ); - scale_sig32( hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_fx, hDirACRend->h_freq_domain_decorr_ap_state->decorr_buffer_len, tmp ); /* Q(hDirACRend->h_freq_domain_decorr_ap_state->q_decorr_buffer + tmp) */ - hDirACRend->h_freq_domain_decorr_ap_state->q_decorr_buffer = add( hDirACRend->h_freq_domain_decorr_ap_state->q_decorr_buffer, tmp ); - move16(); - } - - IF( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx ) - { - Word16 shift, norm1, norm2; - Word32 tmp1, tmp2; - maximum_abs_32_fx( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, &tmp2 ); - maximum_abs_32_fx( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, &tmp1 ); - - IF( tmp1 == 0 ) - { - norm1 = 31; - move16(); - } - ELSE - { - norm1 = norm_l( tmp1 ); - } - - IF( tmp2 == 0 ) - { - norm2 = 31; - move16(); - } - ELSE - { - norm2 = norm_l( tmp2 ); - } - - shift = s_min( norm1, norm2 ); - - Word16 hr_exp = sub( 31, shift ); - - Scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len, sub( sub( 31, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q ), hr_exp ) ); /* Q(31 - hr_exp) */ - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = sub( 31, hr_exp ); - move16(); - } - - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - /* CLDFB Analysis*/ - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - hMasaExtRend->cldfbAnaRend[ch]->Q_cldfb_state = Q11; - move16(); - } - } - - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx ) - { - tmp = 0; - move16(); - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ); - } - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx, s_min( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[0], tmp ); - move16(); - tmp = 0; - move16(); - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); - } - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx + slot_idx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q + tmp) */ - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], tmp ); - move16(); - tmp = 0; - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); - } - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); - move16(); - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); - } - FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) - { - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ - } - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); - move16(); - } - - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx != NULL && GT_16( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, 0 ) ) - { - - tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q + tmp) */ - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, tmp ); - move16(); - } - - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != NULL && GT_16( hDirACRend->h_output_synthesis_psd_params.max_band_decorr, 0 ) ) - { - tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); - scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q + tmp) */ - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = add( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, tmp ); - move16(); - } - } - ELSE - { - FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[hSpatParamRendCom->subframes_rendered]; slot_idx++ ) - { - /* CLDFB Analysis*/ - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - scale_sig32( hMasaExtRend->cldfbAnaRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbAnaRend[ch]->cldfb_size, sub( Q11, hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state ) ); /* Q11 */ - hMasaExtRend->cldfbAnaRend[ch]->Q_cldfb_state = Q11; - move16(); - } - } - - FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; ch++ ) - { - scale_sig32( hMasaExtRend->cldfbSynRend[ch]->cldfb_state_fx, hMasaExtRend->cldfbSynRend[ch]->cldfb_size, sub( Q11, hMasaExtRend->cldfbSynRend[0]->Q_cldfb_state ) ); /* Q11 */ - hMasaExtRend->cldfbSynRend[ch]->Q_cldfb_state = Q11; - move16(); - } - } - - return; -} -#endif static ivas_error printConfigInfo_rend( IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ -- GitLab From 0c970c8fc44bb83b94e8af5a08df5925be821f50 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:20 +0200 Subject: [PATCH 40/49] Accept NONBE_FIX_2575 --- lib_com/options.h | 1 - lib_dec/acelp_core_dec_fx.c | 15 ------------ lib_dec/ivas_stereo_cng_dec_fx.c | 42 -------------------------------- 3 files changed, 58 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bc189aaa5..dda3900c4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index d371353f0..f0d79382c 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -686,21 +686,6 @@ ivas_error acelp_core_dec_fx( move32(); } -#ifndef NONBE_FIX_2575 - ApplyFdCng_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); - - Word16 new_sidNoiseEstExp = 31 - Q4; - move16(); - Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, new_sidNoiseEstExp ) ); // Q(31-sidNoiseEstExp) - Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, new_sidNoiseEstExp ) ); // Q(31-sidNoiseEstExp) - st->hFdCngDec->hFdCngCom->sidNoiseEstExp = new_sidNoiseEstExp; - move16(); - Word16 new_cngNoiseLevelExp = 31 - Q4; - move16(); - Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, new_cngNoiseLevelExp ) ); // Q(31-cngNoiseLevelExp) - st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = new_cngNoiseLevelExp; - move16(); -#endif test(); ApplyFdCng_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( EQ_16( st->coder_type, AUDIO ) && !st->GSC_noisy_speech ) ); diff --git a/lib_dec/ivas_stereo_cng_dec_fx.c b/lib_dec/ivas_stereo_cng_dec_fx.c index 8abc4700c..c7b506d4d 100644 --- a/lib_dec/ivas_stereo_cng_dec_fx.c +++ b/lib_dec/ivas_stereo_cng_dec_fx.c @@ -118,11 +118,7 @@ static void stereo_dft_generate_comfort_noise_fx( Word16 trigo_step; Word32 tmp32_1, tmp32_2; Word16 q_div, q_sqrt1, q_sqrt2, q_sqrt, sqrt_res; -#ifdef NONBE_FIX_2575 Word16 q_shift; -#else - Word16 q_shift, q_shift_1, q_shift_2, min_q; -#endif Word16 tmp16, tmp_p, tmp_s; hFdCngCom = st->hFdCngDec->hFdCngCom; @@ -798,37 +794,18 @@ static void stereo_dft_generate_comfort_noise_fx( IF( ( chan == 0 ) && LE_32( st->core_brate, SID_2k40 ) ) { /* update smoothed periodogram used by stereo CNA in SID and NO_DATA frames from cngNoiseLevel_flt */ -#ifdef NONBE_FIX_2575 Word16 smoothed_psd_exp[L_FRAME16k], smoothed_psd_exp_max = MIN_16; move16(); -#else - q_shift_1 = L_norm_arr( st->hFdCngDec->smoothed_psd_fx, L_FRAME16k ); - q_shift_2 = L_norm_arr( hFdCngCom->cngNoiseLevel, FFTCLDFBLEN ); - - min_q = sub( s_min( add( q_shift_1, sub( Q31, st->hFdCngDec->smoothed_psd_exp ) ), add( q_shift_2, sub( Q31, hFdCngCom->cngNoiseLevelExp ) ) ), 1 /* Guard bit */ ); - - scale_sig32( st->hFdCngDec->smoothed_psd_fx, L_FRAME16k, sub( min_q, sub( Q31, st->hFdCngDec->smoothed_psd_exp ) ) ); /* Q31 - st->hFdCngDec->smoothed_psd_exp */ - st->hFdCngDec->smoothed_psd_exp = sub( Q31, min_q ); - move16(); - scale_sig32( hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( min_q, sub( Q31, hFdCngCom->cngNoiseLevelExp ) ) ); /* Q31 - hFdCngCom->cngNoiseLevelExp */ - hFdCngCom->cngNoiseLevelExp = st->hFdCngDec->smoothed_psd_exp; - move16(); -#endif FOR( i = hFdCngCom->startBand; i < hFdCngCom->stopFFTbin; i++ ) { -#ifdef NONBE_FIX_2575 Word16 ftmp_exp; ftmp = hFdCngCom->cngNoiseLevel[i - hFdCngCom->startBand]; move32(); ftmp_exp = hFdCngCom->cngNoiseLevelExp; move16(); -#else - ftmp = hFdCngCom->cngNoiseLevel[i - hFdCngCom->startBand]; - move32(); -#endif IF( !st->hFdCngDec->first_cna_noise_updated ) { /* very first update */ @@ -841,28 +818,15 @@ static void stereo_dft_generate_comfort_noise_fx( move16(); test(); -#ifdef NONBE_FIX_2575 IF( ( st->hFdCngDec->smoothed_psd_fx[i] > 0 ) && EQ_16( BASOP_Util_Cmp_Mant32Exp( Mpy_32_16_1( ftmp, (Word16) 0x3333 ), ftmp_exp, st->hFdCngDec->smoothed_psd_fx[i], st->hFdCngDec->smoothed_psd_exp ), 1 ) ) -#else - IF( ( st->hFdCngDec->smoothed_psd_fx[i] > 0 ) && GT_32( Mpy_32_16_1( ftmp, (Word16) 0x3333 ), st->hFdCngDec->smoothed_psd_fx[i] ) ) -#endif { /* prevent abrupt upward update steps */ -#ifdef NONBE_FIX_2575 ftmp = L_add( L_shr( st->hFdCngDec->smoothed_psd_fx[i], 2 - 1 ), L_shr( st->hFdCngDec->smoothed_psd_fx[i], 2 + 1 ) ); /* ftmp_exp */ move16(); ftmp_exp = add( st->hFdCngDec->smoothed_psd_exp, 2 ); move16(); -#else - ftmp = L_add( L_shl( st->hFdCngDec->smoothed_psd_fx[i], 1 ), L_shr( st->hFdCngDec->smoothed_psd_fx[i], 1 ) ); /* st->hFdCngDec->smoothed_psd_exp */ - move16(); -#endif } -#ifdef NONBE_FIX_2575 ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( ftmp, ftmp_exp, st->hFdCngDec->smoothed_psd_fx[i], st->hFdCngDec->smoothed_psd_exp ), -1 ) ) -#else - ELSE IF( LT_32( ftmp, st->hFdCngDec->smoothed_psd_fx[i] ) ) -#endif { /* faster downward updates */ alpha = (Word16) ( 0x599A ); @@ -871,16 +835,11 @@ static void stereo_dft_generate_comfort_noise_fx( } /* smoothing */ -#ifdef NONBE_FIX_2575 st->hFdCngDec->smoothed_psd_fx[i] = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( st->hFdCngDec->smoothed_psd_fx[i], alpha ), st->hFdCngDec->smoothed_psd_exp, Mpy_32_16_1( ftmp, sub( MAX_16, alpha ) ), ftmp_exp, &smoothed_psd_exp[i] ); /* smoothed_psd_exp[i] */ smoothed_psd_exp_max = s_max( smoothed_psd_exp_max, smoothed_psd_exp[i] ); -#else - st->hFdCngDec->smoothed_psd_fx[i] = L_add( Mpy_32_16_1( st->hFdCngDec->smoothed_psd_fx[i], alpha ), Mpy_32_16_1( ftmp, sub( MAX_16, alpha ) ) ); /* st->hFdCngDec->smoothed_psd_exp */ -#endif move32(); } -#ifdef NONBE_FIX_2575 /* Find common exponent for smoothed_psd_fx[] */ FOR( i = hFdCngCom->startBand; i < hFdCngCom->stopFFTbin; i++ ) { @@ -888,7 +847,6 @@ static void stereo_dft_generate_comfort_noise_fx( } st->hFdCngDec->smoothed_psd_exp = smoothed_psd_exp_max; move16(); -#endif /* update msNoiseEst in SID and NO_DATA frames */ bandcombinepow( &st->hFdCngDec->smoothed_psd_fx[hFdCngCom->startBand], st->hFdCngDec->smoothed_psd_exp, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), st->hFdCngDec->part_shaping, st->hFdCngDec->nFFTpart_shaping, st->hFdCngDec->psize_inv_shaping, st->hFdCngDec->msNoiseEst, &st->hFdCngDec->msNoiseEst_exp ); -- GitLab From 8c59963844efb5f62ad6b6c8cccce706aeeb6ea9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:22 +0200 Subject: [PATCH 41/49] Accept FIX_2584_TD_SM_ISSUE --- lib_com/options.h | 1 - lib_enc/ivas_stereo_td_analysis_fx.c | 23 ----------------------- 2 files changed, 24 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index dda3900c4..12e968231 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ #define FIX_NONBE_2579_INCORRECT_LAG_CALCULATION /* Dolby: fix 2579: Incorrect lag calculation */ diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 980b86ecd..9ef7b08ab 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -975,11 +975,7 @@ static Word16 Get_dt_lt_ener_fx( test(); IF( GE_16( *tdm_hyst_cnt, 2 ) && EQ_16( tmp_SM_flag, 1 ) && ( GT_16( sts[0]->tdm_pc, PC_LIMIT ) || GT_16( sts[1]->tdm_pc, PC_LIMIT ) ) ) { -#ifndef FIX_2584_TD_SM_ISSUE - tdm_hyst_cnt++; -#else *tdm_hyst_cnt = add( *tdm_hyst_cnt, 1 ); -#endif *tdm_NOOP_SM_flag_loc = tmp_SM_flag; move16(); *tdm_hyst_cnt = 0; @@ -988,11 +984,7 @@ static Word16 Get_dt_lt_ener_fx( ELSE IF( GE_16( *tdm_hyst_cnt, 20 ) && tmp_SM_flag == 0 && ( GT_16( sts[0]->tdm_pc, PC_LIMIT ) || GT_16( sts[1]->tdm_pc, PC_LIMIT ) ) && ( LE_32( *tdm_LT_es_em, ONE_IN_Q20 /* 0.5f in Q21 */ ) || LT_32( es_em_fx, -20971520 /* -10.0f in Q21 */ ) ) ) { -#ifndef FIX_2584_TD_SM_ISSUE - tdm_hyst_cnt++; -#else *tdm_hyst_cnt = add( *tdm_hyst_cnt, 1 ); -#endif *tdm_NOOP_SM_flag_loc = tmp_SM_flag; move16(); *tdm_hyst_cnt = 0; @@ -1585,24 +1577,14 @@ static Word16 stereo_tdm_ener_analysis_SM_fx( test(); test(); test(); -#ifndef FIX_2584_TD_SM_ISSUE - IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 - Q24 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN_FX_Q20 ) ) || - ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 - Q24 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN_FX_Q20 ) ) ) /* Q20 */ -#else IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 - Q16 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN_FX_Q20 ) ) || ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 - Q16 ), RMS_MIN_FX_Q20 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q19 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN_FX_Q20 ) ) ) /* Q20 */ -#endif { test(); test(); test(); -#ifndef FIX_2584_TD_SM_ISSUE - IF( ( LT_16( sts[0]->old_corr_fx, CORR_THRES_FX_Q15 ) && LT_16( sts[1]->old_corr_fx, CORR_THRES_FX_Q15 ) ) || - ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) ) ) -#else IF( ( LT_16( sts[0]->old_corr_fx, CORR_THRES_FX_Q15 ) && LT_16( sts[1]->old_corr_fx, CORR_THRES_FX_Q15 ) ) || ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) ) ) -#endif { side_can_change = 1; move16(); @@ -1612,13 +1594,8 @@ static Word16 stereo_tdm_ener_analysis_SM_fx( test(); test(); test(); -#ifndef FIX_2584_TD_SM_ISSUE - IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN2_FX_Q21 ) ) || - ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q24 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q24 ), RMS_MIN2_FX_Q21 ) ) ) /* Q21 */ -#else IF( ( LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN2_FX_Q21 ) ) || ( LE_32( L_shl( hStereoTD->tdm_lt_rms_R_SM_fx, Q21 - Q16 ), RMS_MIN2_FX_Q21 ) && LE_32( L_shl( hStereoTD->tdm_lt_rms_L_SM_fx, Q20 /* adjusted for 2 in RHS */ - Q16 ), RMS_MIN2_FX_Q21 ) ) ) /* Q21 */ -#endif { test(); test(); -- GitLab From c30dab5279f87cb2aa706ab42b7d846eec77d1d2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:24 +0200 Subject: [PATCH 42/49] Accept FIX_2556_ALIGN_CONDITIONS --- lib_com/options.h | 1 - lib_dec/FEC_scale_syn_fx.c | 4 ---- lib_dec/core_switching_dec_fx.c | 4 ---- lib_dec/dec_uv_fx.c | 2 -- lib_enc/ivas_stereo_td_analysis_fx.c | 4 ---- lib_enc/ivas_stereo_td_enc_fx.c | 4 ---- 6 files changed, 19 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 12e968231..a4cfe48c2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,7 +100,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ #define FIX_NONBE_2579_INCORRECT_LAG_CALCULATION /* Dolby: fix 2579: Incorrect lag calculation */ diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index fc9b1bc4b..1f70a9bc1 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -265,11 +265,7 @@ void FEC_scale_syn_fx( ener_max = *lp_ener_FEC_max; /*Q0*/ move32(); test(); -#ifdef FIX_2556_ALIGN_CONDITIONS if ( ( LE_16( clas, VOICED_TRANSITION ) && element_mode > EVS_MONO ) || EQ_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) -#else - if ( EQ_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) -#endif { ener_max = *lp_ener_FEC_av; /*Q0*/ move32(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 913611eae..805226dae 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1838,11 +1838,7 @@ ivas_error core_switching_pre_dec_fx( { hHQ_core->pastpre = sub( hHQ_core->pastpre, 1 ); move16(); -#ifdef FIX_2556_ALIGN_CONDITIONS IF( hHQ_core->pastpre <= 0 ) -#else - IF( hHQ_core->pastpre < 0 ) -#endif { reset_preecho_dec_fx( hHQ_core ); } diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index 3bdb5e106..3ae142064 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -182,9 +182,7 @@ void decod_unvoiced_fx( } voice_factors_fx[tmp_idx] = 0; move16(); -#ifdef FIX_2556_ALIGN_CONDITIONS IF( st_fx->hBWE_TD != NULL ) -#endif { interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR ); } diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 9ef7b08ab..19dbdd93e 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -242,11 +242,7 @@ Word16 stereo_tdm_ener_analysis_fx( { test(); test(); -#ifdef FIX_2556_ALIGN_CONDITIONS if ( ( EQ_16( hCPE->hStereoClassif->lrtd_mode, 1 ) || EQ_16( hCPE->hStereoTD->prev_fr_LRTD_TD_dec, 1 ) ) && ( LT_32( L_add( L_sub( hCPE->element_brate, 50 * FRAMES_PER_SEC ), L_add( hCPE->brate_surplus, hCPE->brate_surplus ) ), IVAS_BRATE_OMASA_STEREO_SW_THR ) ) ) -#else - if ( ( EQ_16( hCPE->hStereoClassif->lrtd_mode, 1 ) || EQ_16( hCPE->hStereoTD->prev_fr_LRTD_TD_dec, 1 ) ) && ( LE_32( L_add( L_sub( hCPE->element_brate, 50 * FRAMES_PER_SEC ), L_add( hCPE->brate_surplus, hCPE->brate_surplus ) ), IVAS_BRATE_OMASA_STEREO_SW_THR ) ) ) -#endif { hStereoTD->prev_fr_LRTD_TD_dec = 0; move16(); diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index dd817a415..699b64cd4 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -641,11 +641,7 @@ void tdm_configure_enc_fx( test(); IF( EQ_16( sts[0]->coder_type, GENERIC ) && EQ_16( loc_coder_tyape_raw0, UNVOICED ) ) { -#ifdef FIX_2556_ALIGN_CONDITIONS if ( LE_32( sts[0]->total_brate, MAX_UNVOICED_BRATE ) ) -#else - if ( LT_32( sts[0]->total_brate, MAX_UNVOICED_BRATE ) ) -#endif { sts[0]->coder_type = UNVOICED; move16(); -- GitLab From e8f1b4cbc4a719c1ef0f5ad066a42207b9ce8bb0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:27 +0200 Subject: [PATCH 43/49] Accept FIX_NONBE_2579_INCORRECT_LAG_CALCULATION --- lib_com/options.h | 1 - lib_enc/ivas_stereo_ica_enc_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a4cfe48c2..3dec28ed5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,7 +101,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ -#define FIX_NONBE_2579_INCORRECT_LAG_CALCULATION /* Dolby: fix 2579: Incorrect lag calculation */ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ /* The changes for F0+thdModification are mainly for IVAS better float compatibility, */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 4fa3a8d7d..a4f9ea786 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -2331,11 +2331,7 @@ static void unclr_calc_corr_features_fx( move32(); /* L/R correlation values (zero lag, maximum) */ -#ifndef FIX_NONBE_2579_INCORRECT_LAG_CALCULATION - corrLagMax = maximum_l( corrEst, sub( lagSearchRange[1], add( lagSearchRange[0], 1 ) ), &corrEstMax ); -#else corrLagMax = maximum_l( corrEst, add( sub( lagSearchRange[1], lagSearchRange[0] ), 1 ), &corrEstMax ); -#endif d_corrLagMax = sub( corrLagMax, hStereoClassif->unclr_corrLagMax_prev ); hStereoClassif->unclr_fv_fx[E_d_corrLagMax] = L_shl( d_corrLagMax, 15 ); -- GitLab From a761cf34bb1b42b8da801587eec82143255c1496 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:29 +0200 Subject: [PATCH 44/49] Accept FIX_ISSUE_1966_PHASE_DIFF --- lib_com/options.h | 1 - lib_dec/tonalMDCTconcealment_fx.c | 27 --------------------------- 2 files changed, 28 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3dec28ed5..f91155100 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,7 +105,6 @@ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ /* The changes for F0+thdModification are mainly for IVAS better float compatibility, */ /* for EVS_MONO, all is kept BE. */ -#define FIX_ISSUE_1966_PHASE_DIFF /* FhG: Basop issue 1966: shift phase range to [-2PI..+2PI[, handle 4 quadrants */ #define FIX_ISSUE_1966_F0_32BIT /* FhG: Basop issue 1966: use 32-bit variables for F0 and thresholdModification */ #define FIX_BASOP_2519_TCA_LA_ZERO_EXP /* FhG: BASOP #2519: Exclude zero samples from exp_com calculation in tcaTargetCh_LA_fx */ #define FIX_BASOP_2519_ICBWE_DEC_Q_TRACK /* FhG: BASOP #2519: Track Q-format of dec_2over3_mem_fx across frames in stereo_icBWE_preproc_fx */ diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index b58c0fe82..3d13f51d2 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -23,11 +23,7 @@ static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const Word16 typ static void CalcPowerSpec( const Word32 *mdctSpec, const Word16 mdctSpec_exp, const Word32 *mdstSpec, const Word16 mdstSpec_exp, const Word16 nSamples, const Word16 floorPowerSpectrum, Word32 *powerSpec, Word16 *powerSpec_exp ); static void CalcPowerSpecAndDetectTonalComponents_fx( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDST[], Word16 secondLastMDST_exp, Word32 secondLastMDCT[], Word16 secondLastMDCT_exp, Word32 const pitchLag, const PsychoacousticParameters *psychParamsCurrent, Word16 element_mode ); static void FindPhases( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 secondLastMDCT[], Word32 secondLastMDST[], Word16 diff_exp ); -#ifdef FIX_ISSUE_1966_PHASE_DIFF static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 powerSpectrum[], const Word16 element_mode ); -#else -static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, Word32 powerSpectrum[] ); -#endif /*******************************************************/ @@ -423,10 +419,8 @@ static void FindPhases( static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, /* i : Pointer to internal structure */ Word32 powerSpectrum[] /* i : Power spectrum data Qx */ -#ifdef FIX_ISSUE_1966_PHASE_DIFF , const Word16 element_mode /* i : EVS_MONO or anything else */ -#endif ) { Word16 i, k; @@ -457,7 +451,6 @@ static void FindPhaseDifferences( phaseDiff[i] = 0; /*(float)tan(0.0f*EVS_PI/bandwidth);*/ move16(); -#ifdef FIX_ISSUE_1966_PHASE_DIFF /* Note: This version is closer to the float reference, except */ /* for the phase range. It is here [-2PI..+2PI[, while */ /* in float it is [0..4PI[. */ @@ -487,14 +480,6 @@ static void FindPhaseDifferences( move16(); } } -#else - if ( s_and( k, 1 ) != 0 ) - { - phaseDiff[i] = -12868 /*-EVS_PI 3Q12*/; - move16(); - } - -#endif } ELSE { @@ -503,7 +488,6 @@ static void FindPhaseDifferences( phaseDiff[i] = 12868 /*EVS_PI 3Q12*/; /*(float)tan(2.0f*PI/bandwidth);*/ move16(); -#ifdef FIX_ISSUE_1966_PHASE_DIFF IF( EQ_16( element_mode, EVS_MONO ) ) { if ( s_and( k, 1 ) != 0 ) @@ -530,13 +514,6 @@ static void FindPhaseDifferences( move16(); } } -#else - if ( s_and( k, 1 ) != 0 ) - { - phaseDiff[i] = 0 /*0 Q13*/; /*2Q13*/ - move16(); - } -#endif } ELSE { @@ -688,11 +665,7 @@ static void CalcPowerSpecAndDetectTonalComponents_fx( floorPowerSpectrum, psychParamsCurrent, element_mode ); FindPhases( hTonalMDCTConc, secondLastMDCT, secondLastMDST, sub( secondLastMDST_exp, secondLastMDCT_exp ) ); -#ifdef FIX_ISSUE_1966_PHASE_DIFF FindPhaseDifferences( hTonalMDCTConc, powerSpectrum, element_mode ); -#else - FindPhaseDifferences( hTonalMDCTConc, powerSpectrum ); -#endif IF( hTonalMDCTConc->pTCI->numIndexes > 0 ) { -- GitLab From d95d702d448d7dc957b73c953f9707f784ac0ed1 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:31 +0200 Subject: [PATCH 45/49] Accept FIX_ISSUE_1966_F0_32BIT --- lib_com/options.h | 1 - lib_dec/TonalComponentDetection_fx.c | 175 --------------------------- 2 files changed, 176 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f91155100..534594dc4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,7 +105,6 @@ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ /* The changes for F0+thdModification are mainly for IVAS better float compatibility, */ /* for EVS_MONO, all is kept BE. */ -#define FIX_ISSUE_1966_F0_32BIT /* FhG: Basop issue 1966: use 32-bit variables for F0 and thresholdModification */ #define FIX_BASOP_2519_TCA_LA_ZERO_EXP /* FhG: BASOP #2519: Exclude zero samples from exp_com calculation in tcaTargetCh_LA_fx */ #define FIX_BASOP_2519_ICBWE_DEC_Q_TRACK /* FhG: BASOP #2519: Track Q-format of dec_2over3_mem_fx across frames in stereo_icBWE_preproc_fx */ #define FIX_BASOP_2592_OVERFLOW /* FhG: BASOP #2592: fix overflow in GetF0() */ diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 900a09825..3a0c3ad38 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -25,7 +25,6 @@ static void calcPseudoSpec( const Word32 *mdctSpec, const Word16 mdctSpec_exp, const Word16 nSamples, Word16 floorPowerSpectrum, Word32 *powerSpec, Word16 *powerSpec_exp ); static void getEnvelope( const Word16 nSamples, const Word32 *powerSpec, Word16 F0, Word32 *envelope, Word32 *smoothedSpectrum ); static void findStrongestHarmonics( const Word16 nSamples, const Word32 *powerSpectrum, const Word16 F0, const Word16 nTotalHarmonics, Word16 *pHarmonicIndexes, Word16 *pnHarmonics ); -#ifdef FIX_ISSUE_1966_F0_32BIT static void GetF0( Word16 const nSamples, Word16 const nSamplesCore, Word32 const *const powerSpectrum, Word32 const pitchLag, Word16 *const pOrigF0, Word32 *const pOrigF0_32, Word16 *const pF0, Word32 *const pF0_32, const Word16 element_mode ); static void CorrectF0( const Word16 *pHarmonicIndexes, const Word16 nHarmonics, Word16 *pF0, Word32 *pF0_32, const Word16 element_mode ); static void findCandidates( const Word16 nSamples, const Word32 *MDCTSpectrum, const Word16 MDCTSpectrum_exp, Word16 *thresholdModificationNew, Word32 *thresholdModificationNew32, Word16 floorPowerSpectrum, const Word16 element_mode ); @@ -33,15 +32,6 @@ static void modifyThreshold( Word16 i, Word16 F0, Word32 F0_32, Word16 threshold static void modifyThresholds( Word16 F0, Word32 F0_32, Word16 origF0, Word32 origF0_32, Word16 *thresholdModification, Word32 *thresholdModification32, const Word16 element_mode ); static void RefineThresholdsUsingPitch_fx( const Word16 nSamples, const Word16 nSamplesCore, const Word32 powerSpectrum[], const Word32 lastPitchLag, const Word32 currentPitchLag, Word16 *pF0, Word32 *pF0_32, Word16 *thresholdModification, Word32 *thresholdModification32, const Word16 element_mode ); static void findTonalComponents_fx( Word16 *indexOfTonalPeak, Word16 *lowerIndex, Word16 *upperIndex, Word16 *numIndexes, Word16 nSamples, const Word32 *powerSpectrum, const Word16 powerSpectrum_e, Word16 F0, Word16 *thresholdModification, Word32 *thresholdModification32, const Word16 element_mode ); -#else -static void GetF0( Word16 const nSamples, Word16 const nSamplesCore, Word32 const *const powerSpectrum, Word32 const pitchLag, Word16 *const pOrigF0, Word16 *const pF0 ); -static void CorrectF0( const Word16 *pHarmonicIndexes, const Word16 nHarmonics, Word16 *pF0 ); -static void findCandidates( const Word16 nSamples, const Word32 *MDCTSpectrum, const Word16 MDCTSpectrum_exp, Word16 *thresholdModificationNew, Word16 floorPowerSpectrum ); -static void modifyThreshold( Word16 i, Word16 F0, Word16 threshold, Word16 *thresholdModification ); -static void modifyThresholds( Word16 F0, Word16 origF0, Word16 *thresholdModification ); -static void RefineThresholdsUsingPitch_fx( const Word16 nSamples, const Word16 nSamplesCore, const Word32 powerSpectrum[], const Word32 lastPitchLag, const Word32 currentPitchLag, Word16 *pF0, Word16 *thresholdModification ); -static void findTonalComponents_fx( Word16 *indexOfTonalPeak, Word16 *lowerIndex, Word16 *upperIndex, Word16 *numIndexes, Word16 nSamples, const Word32 *powerSpectrum, const Word16 powerSpectrum_e, Word16 F0, Word16 *thresholdModification, const Word16 element_mode ); -#endif /*-------------------------------------------------------------------* @@ -75,10 +65,8 @@ void DetectTonalComponents_fx( ) { Word16 F0; -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 F0_32; Word32 thresholdModification32[L_FRAME_MAX]; -#endif Word16 thresholdModification[L_FRAME_MAX], lastMDCTSpect_exp; Word32 pScaledMdctSpectrum[L_FRAME_MAX]; Word16 nBands; @@ -140,7 +128,6 @@ void DetectTonalComponents_fx( scale_sig32( pScaledMdctSpectrum, nSamples, -1 ); /*q_pScaledMdctSpectrum - 1*/ } -#ifdef FIX_ISSUE_1966_F0_32BIT /* Find peak candidates in the last frame. */ findCandidates( nSamples, pScaledMdctSpectrum, lastMDCTSpect_exp, thresholdModification, thresholdModification32, floorPowerSpectrum, element_mode ); @@ -155,17 +142,6 @@ void DetectTonalComponents_fx( } findTonalComponents_fx( indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, secondLastPowerSpectrum_e, F0, thresholdModification, thresholdModification32, element_mode ); -#else - /* Find peak candidates in the last frame. */ - findCandidates( nSamples, pScaledMdctSpectrum, lastMDCTSpect_exp, thresholdModification, floorPowerSpectrum ); - - /* Refine peak candidates using the pitch information */ - RefineThresholdsUsingPitch_fx( nSamples, nSamplesCore, secondLastPowerSpectrum, lastPitchLag, currentPitchLag, &F0, thresholdModification ); - - /* Find peaks in the second last frame */ - findTonalComponents_fx( indexOfTonalPeak, lowerIndex, upperIndex, pNumIndexes, nSamples, secondLastPowerSpectrum, secondLastPowerSpectrum_e, - F0, thresholdModification, element_mode ); -#endif return; } @@ -431,15 +407,11 @@ static void GetF0( /*i - Qx */ /*is justed handed over and given back*/ Word32 /*int*/ const pitchLag, /*i - Q16*/ Word16 /*short*/ *const pOrigF0, /*o - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 *const pOrigF0_32, /*o - Q10+16*/ -#endif Word16 /*short*/ *const pF0 /*o - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT , Word32 *const pF0_32, /*o - Q10+16*/ const Word16 element_mode /*i EVS_MONO or anything else */ -#endif ) { Word16 /*short*/ tmpPitchLag; @@ -459,7 +431,6 @@ static void GetF0( = round_fx( L_shl( pitchLag, 4 ) ); /*no division by 2, will be done in following division - furthermore, do a leftshift before rounding, to preserve more accuracy - will be accommodated also in following division*/ -#ifdef FIX_ISSUE_1966_F0_32BIT IF( element_mode == EVS_MONO ) { /**pF0 = nSamplesCore/tmpPitchLag;*/ @@ -483,14 +454,6 @@ static void GetF0( *pOrigF0_32 = *pF0_32; /*Q26*/ move32(); } -#else - /**pF0 = nSamplesCore/tmpPitchLag;*/ - BASOP_Util_Divide_MantExp( nSamplesCore, 0, tmpPitchLag, -( 1 /*division by 2*/ + 4 /*accommodate accuracy-prevention-leftshift*/ ), pF0, &tmp ); /*pF0 is Q15*/ - *pF0 = shr_sat( *pF0, sub( 5, tmp ) ); /*Q10 without scalingfactor*/ - move16(); - *pOrigF0 = *pF0; /*Q10*/ - move16(); -#endif tmp = 2 * LAST_HARMONIC_POS_TO_CHECK; if ( LT_16( nSamples, 2 * LAST_HARMONIC_POS_TO_CHECK ) ) @@ -499,7 +462,6 @@ static void GetF0( tmp = nSamples; } -#ifdef FIX_ISSUE_1966_F0_32BIT IF( element_mode == EVS_MONO ) { BASOP_Util_Divide_MantExp( tmp, 15, *pF0, 5, &nTotalHarmonics, &tmp ); @@ -517,17 +479,9 @@ static void GetF0( findStrongestHarmonics( nSamples, powerSpectrum, extract_h( *pF0_32 ), nTotalHarmonics, rgiStrongHarmonics, &nStrongHarmonics ); CorrectF0( rgiStrongHarmonics, nStrongHarmonics, NULL, pF0_32, element_mode ); } -#else - BASOP_Util_Divide_MantExp( tmp, 15, *pF0, 5, &nTotalHarmonics, &tmp ); - nTotalHarmonics = shl( nTotalHarmonics, sub( tmp, 15 ) ); - /* Get in rgiStrongHarmonics all i for which i*F0 are the strongest harmonics */ - findStrongestHarmonics( nSamples, powerSpectrum, *pF0, nTotalHarmonics, rgiStrongHarmonics, &nStrongHarmonics ); - CorrectF0( rgiStrongHarmonics, nStrongHarmonics, pF0 ); -#endif } ELSE { -#ifdef FIX_ISSUE_1966_F0_32BIT IF( element_mode == EVS_MONO ) { move16(); @@ -542,12 +496,6 @@ static void GetF0( *pF0_32 = 0; *pOrigF0_32 = 0; } -#else - move16(); - move16(); - *pF0 = 0; - *pOrigF0 = 0; -#endif } return; @@ -644,18 +592,14 @@ static void CorrectF0( const Word16 /*short*/ *pHarmonicIndexes, /*I - Q0 */ const Word16 /*short*/ nHarmonics, /*I - Q0 */ Word16 /*short*/ *pF0 /*I/O - Q10 range: {0}, [4..18) */ -#ifdef FIX_ISSUE_1966_F0_32BIT , Word32 /*long*/ *pF0_32, /*I/O - Q10+16 range: {0}, [4..18), NULL for EVS_MONO */ const Word16 element_mode /*I EVS_MONO or anything else */ -#endif ) { Word16 /*short*/ i; Word16 /*short*/ F0 = 0; /* init for windows compiler only */ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 /*long*/ F0_32 = 0; /* unused in EVS_MONO */ -#endif Word16 /*short*/ diff[MAX_PEAKS_FROM_PITCH - 1], sortedDiff[MAX_PEAKS_FROM_PITCH - 1]; /*Q0*/ Word16 /*short*/ iMostCommonDiff, nMostCommonDiff, nSameDiff, iMult; /*Q0*/ @@ -670,7 +614,6 @@ static void CorrectF0( move16(); } -#ifdef FIX_ISSUE_1966_F0_32BIT /* i = MAX_PEAKS_FROM_PITCH - 1 (9) now */ IF( element_mode == EVS_MONO ) { @@ -694,17 +637,6 @@ static void CorrectF0( move16(); } } -#else - F0 = *pF0; /*Q10*/ - move16(); - test(); - if ( F0 == 0 || nHarmonics == 0 ) - { - i = 0; /* skip processing */ - move16(); - } - -#endif IF( i != 0 ) /* skip processing, if F0=0 or nHarmonics=0 */ { @@ -809,7 +741,6 @@ static void CorrectF0( IF( LE_16( iMult, 3 ) ) { -#ifdef FIX_ISSUE_1966_F0_32BIT /* Use iMostCommonDiff, because the lowest pHarmonicIndexes[i] (which is equal to iMult) may not correspond to the new F0, but to it's multiple */ IF( element_mode == EVS_MONO ) { @@ -819,13 +750,9 @@ static void CorrectF0( { F0_32 = L_shl_sat( Mpy_32_16_1( F0_32 /*Q10+16*/, iMostCommonDiff /*Q0*/ ), 15 ); /*Q10+16*/ } -#else - F0 = round_fx_sat( L_shl_sat( L_mult( iMostCommonDiff /*Q0*/, F0 /*Q10*/ ), 15 ) ); /*Q10*/ -#endif } ELSE { -#ifdef FIX_ISSUE_1966_F0_32BIT IF( element_mode == EVS_MONO ) { F0 = 0; @@ -836,10 +763,6 @@ static void CorrectF0( F0_32 = 0; move32(); } -#else - F0 = 0; - move16(); -#endif } } /* Otherwise if there are at least 3 distances between peaks with length 1 and if the 1st harmonic is in pHarmonicIndexes then keep the original F0 */ @@ -850,7 +773,6 @@ static void CorrectF0( if ( ( GT_16( iMostCommonDiff, 1 ) ) || ( LT_16( nMostCommonDiff, 3 ) ) ) { /* Not enough peaks at the same distance => don't use the pitch. */ -#ifdef FIX_ISSUE_1966_F0_32BIT IF( element_mode == EVS_MONO ) { F0 = 0; @@ -861,13 +783,8 @@ static void CorrectF0( F0_32 = 0; move32(); } -#else - F0 = 0; - move16(); -#endif } } -#ifdef FIX_ISSUE_1966_F0_32BIT IF( element_mode == EVS_MONO ) { *pF0 = F0; @@ -878,10 +795,6 @@ static void CorrectF0( *pF0_32 = F0_32; move32(); } -#else - *pF0 = F0; - move16(); -#endif } return; } @@ -890,19 +803,13 @@ static void CorrectF0( static void modifyThreshold( Word16 /*short*/ i, /*I - Q0 */ Word16 /*short*/ F0, /*I - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 F0_32, /*I - Q26*/ -#endif Word16 /*short*/ threshold, /*I - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 threshold_32, /*I - Q26*/ -#endif Word16 * /*short*/ thresholdModification /*I - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT , Word32 * /*long*/ thresholdModification32, /*I - Q26*/ const Word16 element_mode /*I/O - Q10*/ -#endif ) { Word32 harmonic; @@ -910,7 +817,6 @@ static void modifyThreshold( Word16 k /*Q0*/; Word16 twoTimesFract /*Q10*/; -#ifdef FIX_ISSUE_1966_F0_32BIT IF( EQ_16( element_mode, EVS_MONO ) ) { harmonic = L_mult( shl( i, 5 ), F0 ); /*Q0 * Q10 = 15Q16*/ @@ -940,44 +846,24 @@ static void modifyThreshold( move32(); thresholdModification32[k + 1] = L_add( threshold_32 /*Q10+16*/, L_sub( 2048 << 16 /*2 in Q10+16*/, L_twoTimesFract /*Q10*/ ) /*Q10*/ ); /*Q10*/ } -#else - harmonic = L_mult( shl( i, 5 ), F0 ); /*Q0 * Q10 = 15Q16*/ - k = extract_h( harmonic ); /*Q0*/ - fractional = lshr( extract_l( harmonic ), 1 ); /* Fractional part of the i*F0 */ /*Q15*/ - twoTimesFract = mult( 2048 /*2 in Q10*/, fractional /*Q15*/ ); /*Q10*/ /* threshold if the center of the peek is between k-1 and k, threshold+2 if the center of the peek is between k and k+1 */ - - move16(); - thresholdModification[k] = threshold; - move16(); - thresholdModification[k - 1] = add( threshold /*Q10*/, twoTimesFract /*Q10*/ ); /*Q10*/ - move16(); - thresholdModification[k + 1] = add( threshold /*Q10*/, sub( 2048 /*2 in Q10*/, twoTimesFract /*Q10*/ ) /*Q10*/ ); /*Q10*/ -#endif return; } static void modifyThresholds( Word16 /*short*/ F0, /*I - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 F0_32, /*I - Q26*/ -#endif Word16 /*short*/ origF0, /*I - Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 origF0_32, /*I - Q26*/ -#endif Word16 * /*short*/ thresholdModification /*Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT , Word32 * /*long*/ thresholdModification32, /*Q26*/ const Word16 element_mode /*I EVS_MONO or anything else */ -#endif ) { Word16 /*int*/ i, /*int*/ nHarmonics; Word16 tmp, tmpM, tmpE; -#ifdef FIX_ISSUE_1966_F0_32BIT /* Note: in case besides EVS_MONO, we set the 16-bit variables */ /* accordingly and control further processing with those. */ IF( element_mode != EVS_MONO ) @@ -985,7 +871,6 @@ static void modifyThresholds( origF0 = extract_h( origF0_32 ); F0 = extract_h( F0_32 ); } -#endif IF( origF0 > 0 ) { @@ -995,14 +880,10 @@ static void modifyThresholds( FOR( i = 1; i <= nHarmonics; i++ ) { -#ifdef FIX_ISSUE_1966_F0_32BIT modifyThreshold( i, origF0, origF0_32, 717 /*0.7f in Q10*/, 46976205 /*0.7f in Q10+16*/, thresholdModification, thresholdModification32, element_mode ); -#else - modifyThreshold( i, origF0, 717 /*0.7f in Q10*/, thresholdModification ); -#endif } } IF( F0 > 0 ) @@ -1015,25 +896,17 @@ static void modifyThresholds( FOR( i = tmp; i > 0; i-- ) { -#ifdef FIX_ISSUE_1966_F0_32BIT modifyThreshold( i, origF0, origF0_32, 358 /*0.35f in Q10*/, 23488102 /*0.35 in Q10+16*/, thresholdModification, thresholdModification32, element_mode ); -#else - modifyThreshold( i, origF0, 358 /*0.35f in Q10*/, thresholdModification ); -#endif } FOR( i = 1; i <= nHarmonics; i++ ) { -#ifdef FIX_ISSUE_1966_F0_32BIT modifyThreshold( i, F0, F0_32, 358 /*0.35f Q10*/, 23488102 /*0.35 in Q10+16*/, thresholdModification, thresholdModification32, element_mode ); -#else - modifyThreshold( i, F0, 358 /*0.35f Q10*/, thresholdModification ); -#endif } } } @@ -1047,13 +920,9 @@ static void findCandidates( const Word32 *MDCTSpectrum, /* i : MDCT spectrum */ const Word16 MDCTSpectrum_exp, /* i : exponent of MDCT spectrum */ Word16 *thresholdModificationNew, /* o : threshold modification Q10 */ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 *thresholdModificationNew32, /* o : threshold modification Q10+Q16 */ Word16 floorPowerSpectrum, /* i : lower limit for powerspectrum bins Q0*/ const Word16 element_mode /* i : EVS_MONO or anything else */ -#else - Word16 floorPowerSpectrum /* i : lower limit for powerspectrum bins Q0*/ -#endif ) { Word32 powerSpectrum[L_FRAME_MAX]; @@ -1067,7 +936,6 @@ static void findCandidates( calcPseudoSpec( MDCTSpectrum, MDCTSpectrum_exp, nSamples, floorPowerSpectrum, powerSpectrum, &powerSpectrum_exp ); getEnvelope( nSamples, powerSpectrum, 0, envelope, smoothedSpectrum ); -#ifdef FIX_ISSUE_1966_F0_32BIT IF( EQ_16( element_mode, EVS_MONO ) ) { set16_fx( thresholdModificationNew, UNREACHABLE_THRESHOLD, nSamples ); /*Q10*/ @@ -1076,9 +944,6 @@ static void findCandidates( { set32_fx( thresholdModificationNew32, ( UNREACHABLE_THRESHOLD ) << 16, nSamples ); /*Q10+Q16*/ } -#else - set16_fx( thresholdModificationNew, UNREACHABLE_THRESHOLD, nSamples ); /*Q10*/ -#endif k = GROUP_LENGTH / 2; move16(); @@ -1168,7 +1033,6 @@ static void findCandidates( /* Modify thresholds for the following frame */ tmp_loop3 = add( k, 2 ); -#ifdef FIX_ISSUE_1966_F0_32BIT IF( EQ_16( element_mode, EVS_MONO ) ) { FOR( j = sub( k, 1 ); j < tmp_loop3; j++ ) @@ -1197,19 +1061,6 @@ static void findCandidates( } } } -#else - FOR( j = sub( k, 1 ); j < tmp_loop3; j++ ) - { - thresholdModificationNew[j] = BIG_THRESHOLD; /*Q10*/ - move16(); - - if ( GT_32( smoothedSpectrum[j], envelope[j] ) ) - { - thresholdModificationNew[j] = SMALL_THRESHOLD; /*Q10*/ - move16(); - } - } -#endif /* Jump to the next foot of the peak. */ k = upperIdx; move16(); @@ -1232,9 +1083,7 @@ static void findTonalComponents_fx( const Word16 powerSpectrum_e, Word16 F0, /* IN Q10*/ Word16 *thresholdModification, /* IN Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 *thresholdModification32, /* IN Q10+Q16, unused in EVS_MONO */ -#endif const Word16 element_mode ) /* IN, EVS_MONO or anything else */ { Word32 envelope[L_FRAME_MAX]; /*powerSpec_exp + LEVEL_EXP*/ @@ -1266,7 +1115,6 @@ static void findTonalComponents_fx( } ELSE { -#ifdef FIX_ISSUE_1966_F0_32BIT /* Note: This is the key code for the issue 1966. With 32-bit thresholds, the comparison */ /* powerSpectrum[k] > envelope[k]*thresholdModification[k] is closer to float and the */ /* variable numIndexes becomes a bit higher compared to (rounded) 16-bit thresholds. */ @@ -1289,13 +1137,6 @@ static void findTonalComponents_fx( mult_exp = sub( Q31, sub( add( sub( Q31, add( powerSpectrum_e, LEVEL_EXP ) ), add( 10 + 16, lshift ) ), 31 ) ); } flag = BASOP_Util_Cmp_Mant32Exp( smoothedSpectrum[k], ( powerSpectrum_e + LEVEL_EXP ), mult_32, mult_exp ); -#else - Word64 mult_64 = W_mult_32_16( envelope[k], thresholdModification[k] ); // (Q31-(powerSpectrum_e+LEVEL_EXP))+1+10 - Word16 lshift = W_norm( mult_64 ); - Word32 mult_32 = W_extract_h( W_shl( mult_64, lshift ) ); //(Q31-(powerSpectrum_e+LEVEL_EXP) + lshift )+11 -32 - Word16 mult_exp = sub( Q31, sub( add( sub( Q31, add( powerSpectrum_e, LEVEL_EXP ) ), add( 10, lshift ) ), 31 ) ); - flag = BASOP_Util_Cmp_Mant32Exp( smoothedSpectrum[k], ( powerSpectrum_e + LEVEL_EXP ), mult_32, mult_exp ); -#endif } /* There is 3 bits headroom in envelope and max of thresholdModification is 16384, so shifting left for 4 would produce overflow only when the result is anyhow close to 1 */ @@ -1431,22 +1272,16 @@ static void RefineThresholdsUsingPitch_fx( const Word32 lastPitchLag, /*Qx*/ const Word32 currentPitchLag, /*Qx*/ Word16 *pF0, /*Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 *pF0_32, /*Q10+Q16, NULL in EVS_MONO mode */ -#endif Word16 *thresholdModification /*Q10*/ -#ifdef FIX_ISSUE_1966_F0_32BIT , Word32 *thresholdModification32, /*Q10+Q16, NULL in EVS_MONO mode */ const Word16 element_mode /*Q0 EVS_MONO or anything else */ -#endif ) { Word16 pitchIsStable; Word16 origF0; -#ifdef FIX_ISSUE_1966_F0_32BIT Word32 origF0_32; /* unused in EVS_MONO mode */ -#endif Word32 L_tmp; /*pitchIsStable = (fabs(lastPitchLag-currentPitchLag) < 0.25f);*/ @@ -1461,7 +1296,6 @@ static void RefineThresholdsUsingPitch_fx( IF( pitchIsStable ) { -#ifdef FIX_ISSUE_1966_F0_32BIT GetF0( nSamples, nSamplesCore, powerSpectrum, lastPitchLag, &origF0, &origF0_32, pF0, pF0_32, element_mode ); @@ -1475,14 +1309,9 @@ static void RefineThresholdsUsingPitch_fx( modifyThresholds( 0, *pF0_32, 0, origF0_32, thresholdModification, thresholdModification32, element_mode ); } -#else - GetF0( nSamples, nSamplesCore, powerSpectrum, lastPitchLag, &origF0, pF0 ); - modifyThresholds( *pF0, origF0, thresholdModification ); -#endif } ELSE { -#ifdef FIX_ISSUE_1966_F0_32BIT IF( EQ_16( element_mode, EVS_MONO ) ) { *pF0 = 0; @@ -1493,10 +1322,6 @@ static void RefineThresholdsUsingPitch_fx( *pF0_32 = 0; move32(); } -#else - *pF0 = 0; - move16(); -#endif } return; -- GitLab From 6fce347c8069fe6fde47547ecf62de7844bd3f64 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:33 +0200 Subject: [PATCH 46/49] Accept FIX_BASOP_2519_TCA_LA_ZERO_EXP --- lib_com/options.h | 1 - lib_enc/ivas_stereo_ica_enc_fx.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 534594dc4..6f7c2f440 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,7 +105,6 @@ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ /* The changes for F0+thdModification are mainly for IVAS better float compatibility, */ /* for EVS_MONO, all is kept BE. */ -#define FIX_BASOP_2519_TCA_LA_ZERO_EXP /* FhG: BASOP #2519: Exclude zero samples from exp_com calculation in tcaTargetCh_LA_fx */ #define FIX_BASOP_2519_ICBWE_DEC_Q_TRACK /* FhG: BASOP #2519: Track Q-format of dec_2over3_mem_fx across frames in stereo_icBWE_preproc_fx */ #define FIX_BASOP_2592_OVERFLOW /* FhG: BASOP #2592: fix overflow in GetF0() */ #define FIX_BASOP_2591_EDGE_DETECT_COMP /* FhG: BASOP #2591: Wrong comparison in edge_detect_fx() */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index a4f9ea786..f981a2957 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -171,14 +171,10 @@ static void tcaTargetCh_LA_fx( move32(); target_exp_temp[i + currentNCShift] = temp; move16(); -#ifdef FIX_BASOP_2519_TCA_LA_ZERO_EXP IF( NE_32( target[i + currentNCShift], 0 ) ) { exp_com = s_max( exp_com, temp ); } -#else - exp_com = s_max( exp_com, temp ); -#endif } FOR( ; i < input_frame; i++ ) @@ -187,14 +183,10 @@ static void tcaTargetCh_LA_fx( move32(); target_exp_temp[i + currentNCShift] = add( gAdj_exp, ref_exp ); move16(); -#ifdef FIX_BASOP_2519_TCA_LA_ZERO_EXP IF( NE_32( target[i + currentNCShift], 0 ) ) { exp_com = s_max( exp_com, target_exp_temp[i + currentNCShift] ); } -#else - exp_com = s_max( exp_com, target_exp_temp[i + currentNCShift] ); -#endif } FOR( i = 0; i < input_frame + currentNCShift; i++ ) -- GitLab From b078c597ea76e479b7bad9d22b4bb7e1d062d746 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:12:36 +0200 Subject: [PATCH 47/49] Accept FIX_BASOP_2519_ICBWE_DEC_Q_TRACK --- lib_com/options.h | 1 - lib_enc/ivas_stat_enc.h | 5 ----- lib_enc/ivas_stereo_icbwe_enc_fx.c | 12 ------------ 3 files changed, 18 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6f7c2f440..1cea4e850 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,7 +105,6 @@ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ /* The changes for F0+thdModification are mainly for IVAS better float compatibility, */ /* for EVS_MONO, all is kept BE. */ -#define FIX_BASOP_2519_ICBWE_DEC_Q_TRACK /* FhG: BASOP #2519: Track Q-format of dec_2over3_mem_fx across frames in stereo_icBWE_preproc_fx */ #define FIX_BASOP_2592_OVERFLOW /* FhG: BASOP #2592: fix overflow in GetF0() */ #define FIX_BASOP_2591_EDGE_DETECT_COMP /* FhG: BASOP #2591: Wrong comparison in edge_detect_fx() */ #define FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT /* Dolby: fix 2580: use dynamic length denominator for average energy in unclr_calc_corr_features_fx() */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 237a1d1a0..b4d79b867 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -511,14 +511,9 @@ typedef struct stereo_icbwe_enc_data_structure Word32 prevRefEner_fx; // Q31 Word32 prevNonRefEner_fx; // Q31 Word32 memGsEnerMap_fx[2]; // Q31 -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK Word16 dec_2over3_mem_fx[L_FILT_2OVER3]; // Q -> q_dec_2over3_mem_fx Word16 dec_2over3_mem_lp_fx[L_FILT_2OVER3_LP]; // Q -> q_dec_2over3_mem_fx Word16 q_dec_2over3_mem_fx; // current Q of dec_2over3_mem_fx and dec_2over3_mem_lp_fx -#else - Word16 dec_2over3_mem_fx[L_FILT_2OVER3]; // Q -> q_dataChan_fx - Word16 dec_2over3_mem_lp_fx[L_FILT_2OVER3_LP]; // Q -> q_dataChan_fx -#endif Word16 icbwe_inp_mem_fx[CPE_CHANNELS][NS2SA( 48000, L_MEM_RECALC_TBE_NS )]; // Q -> q_dataChan_fx Word16 *dataChan_fx[CPE_CHANNELS]; Word16 q_dataChan_fx; diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 72b0ec333..91b6c24a6 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -1146,10 +1146,8 @@ void stereo_icBWE_init_enc_fx( set16_fx( hStereoICBWE->dec_2over3_mem_fx, 0, L_FILT_2OVER3 ); set16_fx( hStereoICBWE->dec_2over3_mem_lp_fx, 0, L_FILT_2OVER3_LP ); -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK hStereoICBWE->q_dec_2over3_mem_fx = 0; move16(); -#endif set16_fx( hStereoICBWE->memHPF_fx, 0, 8 ); /* BWE ref channel */ @@ -1282,10 +1280,8 @@ void stereo_icBWE_preproc_fx( { set16_fx( hStereoICBWE->dec_2over3_mem_fx, 0, L_FILT_2OVER3 ); set16_fx( hStereoICBWE->dec_2over3_mem_lp_fx, 0, L_FILT_2OVER3_LP ); -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK hStereoICBWE->q_dec_2over3_mem_fx = 0; move16(); -#endif set16_fx( hStereoICBWE->mem_decim_shb_ch0_fx, 0, ( 2 * L_FILT_MAX ) ); set16_fx( shb_speech_nonref_fx, 0, L_FRAME16k ); set16_fx( hStereoICBWE->memHPF_fx, 0, 8 ); @@ -1306,7 +1302,6 @@ void stereo_icBWE_preproc_fx( i = 2 * L_FILT48k + L_FILT_2OVER3; move16(); -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK IF( NE_16( hStereoICBWE->q_dec_2over3_mem_fx, hStereoICBWE->q_dataChan_fx ) ) { Word16 scf = sub( hStereoICBWE->q_dataChan_fx, hStereoICBWE->q_dec_2over3_mem_fx ); @@ -1315,7 +1310,6 @@ void stereo_icBWE_preproc_fx( hStereoICBWE->q_dec_2over3_mem_fx = hStereoICBWE->q_dataChan_fx; move16(); } -#endif decimate_2_over_3_allpass_fx( temp_in_fx + sub( input_frame, i ), i, temp_inp_fx + mult( sub( input_frame, i ), 21845 /* 2/3 Q15*/ ), hStereoICBWE->dec_2over3_mem_fx, allpass_poles_3_ov_2, decimate_3_ov_2_lowpass_num_fx, decimate_3_ov_2_lowpass_den_fx, hStereoICBWE->dec_2over3_mem_lp_fx ); } /* flip the spectrum */ @@ -1337,7 +1331,6 @@ void stereo_icBWE_preproc_fx( move16(); /* IVAS-219: the same filter memories are used for both channels; the continuity is thus lost; shouldn't the memories be separated? */ -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK IF( NE_16( hStereoICBWE->q_dec_2over3_mem_fx, hStereoICBWE->q_dataChan_fx ) ) { Word16 scf = sub( hStereoICBWE->q_dataChan_fx, hStereoICBWE->q_dec_2over3_mem_fx ); @@ -1346,7 +1339,6 @@ void stereo_icBWE_preproc_fx( hStereoICBWE->q_dec_2over3_mem_fx = hStereoICBWE->q_dataChan_fx; move16(); } -#endif decimate_2_over_3_allpass_fx( temp_in_fx + sub( input_frame, i ), i, temp_inp_fx + mult( sub( input_frame, i ), 21845 /* 2/3 Q15*/ ), hStereoICBWE->dec_2over3_mem_fx, allpass_poles_3_ov_2, decimate_3_ov_2_lowpass_num_fx, decimate_3_ov_2_lowpass_den_fx, hStereoICBWE->dec_2over3_mem_lp_fx ); } @@ -1383,10 +1375,8 @@ void stereo_icBWE_preproc_fx( set16_fx( hStereoICBWE->dec_2over3_mem_fx, 0, L_FILT_2OVER3 ); set16_fx( hStereoICBWE->dec_2over3_mem_lp_fx, 0, L_FILT_2OVER3_LP ); -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK hStereoICBWE->q_dec_2over3_mem_fx = 0; move16(); -#endif set16_fx( hStereoICBWE->mem_decim_shb_ch0_fx, 0, ( 2 * L_FILT_MAX ) ); set16_fx( shb_speech_nonref_fx, 0, L_FRAME16k ); set16_fx( hStereoICBWE->memHPF_fx, 0, 8 ); @@ -1430,7 +1420,6 @@ void stereo_icBWE_preproc_fx( Copy( temp_inp_fx, temp_in_fx, L_FRAME48k ); /* q_dataChan_fx */ set16_fx( temp_inp_fx, 0, L_FRAME48k ); -#ifdef FIX_BASOP_2519_ICBWE_DEC_Q_TRACK IF( NE_16( hStereoICBWE->q_dec_2over3_mem_fx, hStereoICBWE->q_dataChan_fx ) ) { Word16 scf = sub( hStereoICBWE->q_dataChan_fx, hStereoICBWE->q_dec_2over3_mem_fx ); @@ -1439,7 +1428,6 @@ void stereo_icBWE_preproc_fx( hStereoICBWE->q_dec_2over3_mem_fx = hStereoICBWE->q_dataChan_fx; move16(); } -#endif decimate_2_over_3_allpass_fx( temp_in_fx, L_FRAME48k, temp_inp_fx, hStereoICBWE->dec_2over3_mem_fx, allpass_poles_3_ov_2, decimate_3_ov_2_lowpass_num_fx, decimate_3_ov_2_lowpass_den_fx, hStereoICBWE->dec_2over3_mem_lp_fx ); } -- GitLab From fe7ffd5f78556ce4e6e16de0c03b996569fa2cd6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 15:14:58 +0200 Subject: [PATCH 48/49] cleanup: remove comment from removed switches --- lib_com/options.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1cea4e850..27e64a41c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,10 +101,6 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ - -/* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ -/* The changes for F0+thdModification are mainly for IVAS better float compatibility, */ -/* for EVS_MONO, all is kept BE. */ #define FIX_BASOP_2592_OVERFLOW /* FhG: BASOP #2592: fix overflow in GetF0() */ #define FIX_BASOP_2591_EDGE_DETECT_COMP /* FhG: BASOP #2591: Wrong comparison in edge_detect_fx() */ #define FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT /* Dolby: fix 2580: use dynamic length denominator for average energy in unclr_calc_corr_features_fx() */ -- GitLab From 87165a688f465cb8469152c0ab0d99126504c30b Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 20 May 2026 16:04:06 +0200 Subject: [PATCH 49/49] cleanup: apply clang-format --- lib_com/ari_fx.c | 1 - lib_com/cldfb_evs_fx.c | 2 +- lib_com/cldfb_fx.c | 1 - lib_com/common_api_types.h | 4 +-- lib_com/prot_fx.h | 3 +- lib_com/rom_com.h | 2 +- lib_com/swb_bwe_com_fx.c | 2 +- lib_com/trans_inv_fx.c | 2 +- lib_dec/TonalComponentDetection_fx.c | 40 +++++++++++------------ lib_dec/ivas_objectRenderer_internal_fx.c | 1 - lib_dec/lib_dec_fx.c | 1 - lib_dec/tonalMDCTconcealment_fx.c | 2 -- lib_enc/ari_enc_fx.c | 3 -- lib_enc/cod_tcx_fx.c | 1 - lib_enc/enc_higher_acelp_fx.c | 2 +- lib_enc/hq_core_enc_fx.c | 4 +-- lib_enc/igf_enc_fx.c | 1 - lib_enc/ivas_core_pre_proc_fx.c | 8 ++--- lib_enc/ivas_stat_enc.h | 12 +++---- lib_enc/ivas_tcx_core_enc_fx.c | 8 ++--- lib_enc/prot_fx_enc.h | 7 ++-- lib_isar/isar_rom_lcld_tables.c | 1 - lib_rend/ivas_objectRenderer_mix_fx.c | 4 +-- lib_util/ivas_rtp_api.h | 4 +-- lib_util/render_config_reader.c | 2 +- 25 files changed, 51 insertions(+), 67 deletions(-) diff --git a/lib_com/ari_fx.c b/lib_com/ari_fx.c index d36526b2f..9d1a93c65 100644 --- a/lib_com/ari_fx.c +++ b/lib_com/ari_fx.c @@ -9,7 +9,6 @@ #include "cnst.h" - /*--------------------------------------------------------------- Ari 14 bits common routines -------------------------------------------------------------*/ diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c index f654083b3..b2c15eb21 100644 --- a/lib_com/cldfb_evs_fx.c +++ b/lib_com/cldfb_evs_fx.c @@ -1237,7 +1237,7 @@ void analysisCldfbEncoder_fx( void GetEnergyCldfb( - Word16 element_mode, /*!< i: | Is IVAS or EVS? */ + Word16 element_mode, /*!< i: | Is IVAS or EVS? */ Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) | pointer to the result in the core look-ahead slot */ Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot */ const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */ diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c index 93c7cea0b..48228d893 100644 --- a/lib_com/cldfb_fx.c +++ b/lib_com/cldfb_fx.c @@ -1442,7 +1442,6 @@ void resampleCldfb_ivas_fx( } - void analysisCldfbEncoder_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ Word32 *timeIn, /*q11*/ diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 67204e73d..6c8e84da8 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -63,8 +63,8 @@ #define IVAS_ER_LIST_HEIGHT 1.6f #define IVAS_ER_LIST_HEIGHT_FX 6710886 /* 1.6f in Q.22 */ #define IVAS_DEFAULT_AEID 65535 -#define IVAS_LISTENER_POSITION_MAX 327.67f -#define IVAS_LISTENER_POSITION_MAX_Q22 1374347592 /* 327.67 in Q22 */ +#define IVAS_LISTENER_POSITION_MAX 327.67f +#define IVAS_LISTENER_POSITION_MAX_Q22 1374347592 /* 327.67 in Q22 */ /* JBM constants for adaptive-playout */ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index dd89aa091..196a37583 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4105,7 +4105,7 @@ void analysisCldfbEncoder_fx( CLDFB_SCALE_FACTOR *scale ); void GetEnergyCldfb( - Word16 element_mode, /*!< i: | Is IVAS or EVS? */ + Word16 element_mode, /*!< i: | Is IVAS or EVS? */ Word32 *energyLookahead, /*!< o: Q31 | pointer to the result in the core look-ahead slot */ Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot - apply as negative exponent*/ const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */ @@ -5577,7 +5577,6 @@ void TonalMDCTConceal_UpdateState_fx( const Word8 tonalConcealmentActive ); - void TonalMDCTConceal_Apply_fx( Word16 element_mode, const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 09f7de4ff..1fe78dd9b 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1135,7 +1135,7 @@ extern const Word32 rot_vec_syn_im_L40_fx[20]; // Q31 extern const Word32 rot_vec_syn_re_L60_fx[30]; // Q31 extern const Word32 rot_vec_syn_im_L60_fx[30]; // Q31 -extern const Word16 bpf_weights_16_Fx[16]; // Q15 +extern const Word16 bpf_weights_16_Fx[16]; // Q15 extern const Word32 bpf_weights_16_ivas_fx_32[16]; // Q30 extern const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG]; // Q6 diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 67727f073..a77f6a24a 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -2747,7 +2747,7 @@ void hq_generic_decoding_fx( exp2 = sub( norm_l( L_tmp2 ), 1 ); tmp1_fx = extract_h( L_shl( L_tmp1, exp1 ) ); tmp2_fx = extract_h( L_shl( L_tmp2, exp2 ) ); - tmp3_fx = div_s( tmp2_fx, tmp1_fx ); /*15 + exp2 + 15 - (exp1 + 15) */ + tmp3_fx = div_s( tmp2_fx, tmp1_fx ); /*15 + exp2 + 15 - (exp1 + 15) */ tmp3_fx = shr_sat( tmp3_fx, add( 5, sub( exp2, exp1 ) ) ); /*10 */ if ( LT_16( tmp3_fx, 307 /*0.3 in Q10 */ ) ) diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index 04296decc..0ef6f08fe 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -747,7 +747,7 @@ void preecho_sb_fx( } tmp_fxL1 = L_add_sat( eshbmean2_fx, es_mdct_hb_fx[ind3] ); /*2*(q_sig16)*/ - Mpy_32_16_ss( tmp_fxL1, 4369, &eshbmean3_fx, &tmp_u16 ); /*10922 : 1/3*/ + Mpy_32_16_ss( tmp_fxL1, 4369, &eshbmean3_fx, &tmp_u16 ); /*10922 : 1/3*/ tmp_fxL1 = L_sub( es_mdct_hb_fx[ind3], es_mdct_hb_fx[ind5] ); /*2*(q_sig16)*/ IF( LT_32( tmp_fxL1, eshbmean3_fx ) ) diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 3a0c3ad38..bc9c4c0c7 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -407,8 +407,8 @@ static void GetF0( /*i - Qx */ /*is justed handed over and given back*/ Word32 /*int*/ const pitchLag, /*i - Q16*/ Word16 /*short*/ *const pOrigF0, /*o - Q10*/ - Word32 *const pOrigF0_32, /*o - Q10+16*/ - Word16 /*short*/ *const pF0 /*o - Q10*/ + Word32 *const pOrigF0_32, /*o - Q10+16*/ + Word16 /*short*/ *const pF0 /*o - Q10*/ , Word32 *const pF0_32, /*o - Q10+16*/ const Word16 element_mode /*i EVS_MONO or anything else */ @@ -598,7 +598,7 @@ static void CorrectF0( ) { Word16 /*short*/ i; - Word16 /*short*/ F0 = 0; /* init for windows compiler only */ + Word16 /*short*/ F0 = 0; /* init for windows compiler only */ Word32 /*long*/ F0_32 = 0; /* unused in EVS_MONO */ Word16 /*short*/ diff[MAX_PEAKS_FROM_PITCH - 1], sortedDiff[MAX_PEAKS_FROM_PITCH - 1]; /*Q0*/ @@ -801,11 +801,11 @@ static void CorrectF0( static void modifyThreshold( - Word16 /*short*/ i, /*I - Q0 */ - Word16 /*short*/ F0, /*I - Q10*/ - Word32 F0_32, /*I - Q26*/ - Word16 /*short*/ threshold, /*I - Q10*/ - Word32 threshold_32, /*I - Q26*/ + Word16 /*short*/ i, /*I - Q0 */ + Word16 /*short*/ F0, /*I - Q10*/ + Word32 F0_32, /*I - Q26*/ + Word16 /*short*/ threshold, /*I - Q10*/ + Word32 threshold_32, /*I - Q26*/ Word16 * /*short*/ thresholdModification /*I - Q10*/ , Word32 * /*long*/ thresholdModification32, /*I - Q26*/ @@ -851,10 +851,10 @@ static void modifyThreshold( static void modifyThresholds( - Word16 /*short*/ F0, /*I - Q10*/ - Word32 F0_32, /*I - Q26*/ - Word16 /*short*/ origF0, /*I - Q10*/ - Word32 origF0_32, /*I - Q26*/ + Word16 /*short*/ F0, /*I - Q10*/ + Word32 F0_32, /*I - Q26*/ + Word16 /*short*/ origF0, /*I - Q10*/ + Word32 origF0_32, /*I - Q26*/ Word16 * /*short*/ thresholdModification /*Q10*/ , Word32 * /*long*/ thresholdModification32, /*Q26*/ @@ -916,10 +916,10 @@ static void modifyThresholds( static void findCandidates( - const Word16 nSamples, /* i : frame size */ - const Word32 *MDCTSpectrum, /* i : MDCT spectrum */ - const Word16 MDCTSpectrum_exp, /* i : exponent of MDCT spectrum */ - Word16 *thresholdModificationNew, /* o : threshold modification Q10 */ + const Word16 nSamples, /* i : frame size */ + const Word32 *MDCTSpectrum, /* i : MDCT spectrum */ + const Word16 MDCTSpectrum_exp, /* i : exponent of MDCT spectrum */ + Word16 *thresholdModificationNew, /* o : threshold modification Q10 */ Word32 *thresholdModificationNew32, /* o : threshold modification Q10+Q16 */ Word16 floorPowerSpectrum, /* i : lower limit for powerspectrum bins Q0*/ const Word16 element_mode /* i : EVS_MONO or anything else */ @@ -1081,10 +1081,10 @@ static void findTonalComponents_fx( Word16 nSamples, /* IN Q0*/ const Word32 *powerSpectrum, /* IN Q31-powerSpectrum_e*/ const Word16 powerSpectrum_e, - Word16 F0, /* IN Q10*/ - Word16 *thresholdModification, /* IN Q10*/ + Word16 F0, /* IN Q10*/ + Word16 *thresholdModification, /* IN Q10*/ Word32 *thresholdModification32, /* IN Q10+Q16, unused in EVS_MONO */ - const Word16 element_mode ) /* IN, EVS_MONO or anything else */ + const Word16 element_mode ) /* IN, EVS_MONO or anything else */ { Word32 envelope[L_FRAME_MAX]; /*powerSpec_exp + LEVEL_EXP*/ Word32 smoothedSpectrum[L_FRAME_MAX]; /*powerSpec_exp + LEVEL_EXP*/ @@ -1272,7 +1272,7 @@ static void RefineThresholdsUsingPitch_fx( const Word32 lastPitchLag, /*Qx*/ const Word32 currentPitchLag, /*Qx*/ Word16 *pF0, /*Q10*/ - Word32 *pF0_32, /*Q10+Q16, NULL in EVS_MONO mode */ + Word32 *pF0_32, /*Q10+Q16, NULL in EVS_MONO mode */ Word16 *thresholdModification /*Q10*/ , Word32 *thresholdModification32, /*Q10+Q16, NULL in EVS_MONO mode */ diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 0f6055bed..05788a5c5 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -263,7 +263,6 @@ ivas_error ivas_td_binaural_renderer_sf_fx( tmp_vector_fx = &st_ivas->hCombinedOrientationData->listenerPos[st_ivas->hCombinedOrientationData->subframe_idx]; enableCombinedOrientation = st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx]; move16(); - } ELSE { diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 41e5e5990..770f94acb 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -128,7 +128,6 @@ static Word16 ivas_dec_split_rend_cldfb_in( const RENDERER_TYPE renderer_type ); static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesRendered ); - /*---------------------------------------------------------------------* * ivas_dec_handle_init() * diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 3d13f51d2..25fb8be67 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -31,7 +31,6 @@ static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, Word /*******************************************************/ - ivas_error TonalMDCTConceal_Init_fx( Word16 element_mode, TonalMDCTConcealPtr hTonalMDCTConc, @@ -2386,7 +2385,6 @@ void TonalMDCTConceal_Apply_fx( } - void TonalMDCTConceal_SaveTimeSignal_fx( Word16 element_mode, TonalMDCTConcealPtr hTonalMDCTConc, diff --git a/lib_enc/ari_enc_fx.c b/lib_enc/ari_enc_fx.c index 37a38cf46..23e422e6b 100644 --- a/lib_enc/ari_enc_fx.c +++ b/lib_enc/ari_enc_fx.c @@ -35,7 +35,6 @@ static Word16 ari_encode_14bits_high_low_fx( *-------------------------------------------------------------*/ - /*--------------------------------------------------------------- * ari_copy_states_ivas_fx() * @@ -142,7 +141,6 @@ Word16 ari_encode_overflow_fx( } - /*------------------------------------------------------------------------ * Function: ari_encode_14bits_range_fx * @@ -176,7 +174,6 @@ Word16 ari_encode_14bits_range_fx( *-------------------------------------------------------------------------*/ - /*------------------------------------------------------------------------ * Function: ari_done_cbr_encoding_14bits_fx * diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 440ce6a87..8b1875207 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -1742,7 +1742,6 @@ void QuantizeSpectrum_fx( st->element_mode ); - move16(); stop = 1; diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index c4c372d14..f17d16671 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -395,7 +395,7 @@ void transf_cdbk_enc_fx( } /*fxn[L_SUBFR-1] -= *fgain_preQ * ftemp;*/ Ltmp = L_shr( Mult_32_16( Ltmp, *gain_preQ ), sub( add( q_x_tran, 2 ), Q_new ) ); /* (2 + 1 + 14 +shift+Q_AVQ_OUT)-(Q_AVQ_OUT+2-Q_new) = 15 + Q_new + shift */ - xn[L_SUBFR - 1] = round_fx( L_sub( L_mult( xn[L_SUBFR - 1], 32767 ), Ltmp ) ); /* -> Q_new + shift -1 */ + xn[L_SUBFR - 1] = round_fx( L_sub( L_mult( xn[L_SUBFR - 1], 32767 ), Ltmp ) ); /* -> Q_new + shift -1 */ } ELSE { diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 426a8f2bf..b21c74f11 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -70,8 +70,8 @@ void HQ_core_enc_init_fx( *--------------------------------------------------------------------------*/ void hq_core_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 *audio_fx, /* i : input audio signal Q0*/ + Encoder_State *st, /* i/o: encoder state structure */ + Word16 *audio_fx, /* i : input audio signal Q0*/ const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index 5211c2b40..27c3a7f2f 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -66,7 +66,6 @@ static void IGF_write_bits( } - /*-------------------------------------------------------------------* * IGF_WriteEnvelope() * diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index a3799d14b..cbb28d43c 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -81,10 +81,10 @@ void pre_proc_ivas_fx( const Word16 vad_hover_flag, /* i : VAD hangover flag Q0*/ const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/ Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* i : energy buffer e_enerBuffer */ - Word16 e_enerBuffer, /* i : Q value of energy buffer */ - Word16 fft_buff_fx[2 * L_FFT], /* i : FFT buffer Qx*/ - const Word16 cor_map_sum_fx, /* i : speech/music clasif. parameter Q8*/ - Word16 *Q_new /* i/o: Q factor of speech buffers */ + Word16 e_enerBuffer, /* i : Q value of energy buffer */ + Word16 fft_buff_fx[2 * L_FFT], /* i : FFT buffer Qx*/ + const Word16 cor_map_sum_fx, /* i : speech/music clasif. parameter Q8*/ + Word16 *Q_new /* i/o: Q factor of speech buffers */ ) { Word16 L_look, element_mode, lMemRecalc_12k8; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index b4d79b867..ac59949d6 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -508,12 +508,12 @@ typedef struct stereo_icbwe_enc_data_structure Word32 memShbSpecMapping_fx; Word32 memShbSpecXcorr_fx[6]; Word32 prevgsMapping_fx; - Word32 prevRefEner_fx; // Q31 - Word32 prevNonRefEner_fx; // Q31 - Word32 memGsEnerMap_fx[2]; // Q31 - Word16 dec_2over3_mem_fx[L_FILT_2OVER3]; // Q -> q_dec_2over3_mem_fx - Word16 dec_2over3_mem_lp_fx[L_FILT_2OVER3_LP]; // Q -> q_dec_2over3_mem_fx - Word16 q_dec_2over3_mem_fx; // current Q of dec_2over3_mem_fx and dec_2over3_mem_lp_fx + Word32 prevRefEner_fx; // Q31 + Word32 prevNonRefEner_fx; // Q31 + Word32 memGsEnerMap_fx[2]; // Q31 + Word16 dec_2over3_mem_fx[L_FILT_2OVER3]; // Q -> q_dec_2over3_mem_fx + Word16 dec_2over3_mem_lp_fx[L_FILT_2OVER3_LP]; // Q -> q_dec_2over3_mem_fx + Word16 q_dec_2over3_mem_fx; // current Q of dec_2over3_mem_fx and dec_2over3_mem_lp_fx Word16 icbwe_inp_mem_fx[CPE_CHANNELS][NS2SA( 48000, L_MEM_RECALC_TBE_NS )]; // Q -> q_dataChan_fx Word16 *dataChan_fx[CPE_CHANNELS]; Word16 q_dataChan_fx; diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index f89e1c7b8..74326d7dd 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -151,16 +151,16 @@ void stereo_tcx_init_enc_fx( *-------------------------------------------------------------------*/ void stereo_tcx_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz Q_new -1 */ - Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz Q_new -1 */ + Encoder_State *st, /* i/o: encoder state structure */ + Word16 new_samples_12k8[], /* i : buffer of input signal @12.8 kHz Q_new -1 */ + Word16 new_samples_16k[], /* i : buffer of input signal @16 kHz Q_new -1 */ const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes, Q12 */ Word16 lsp_new_fx[], /* i : LSPs at the end of the frame, Q15 */ Word16 lsp_mid_fx[], /* i : LSPs in the middle of the frame, Q15 */ Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ const Word16 last_element_mode, /* i : last element mode, Q0 */ const Word16 vad_hover_flag, /* i : VAD hangover flag, Q0 */ - const Word16 Q_new_orig /* i : Scaling factor of new_samples_xx[] */ + const Word16 Q_new_orig /* i : Scaling factor of new_samples_xx[] */ ) { TCX_ENC_HANDLE hTcxEnc; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 3f34628c5..675710bcb 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -219,8 +219,8 @@ void fine_gain_quant_fx( ); void hq_core_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - Word16 *audio, /* i : i audio signal Q0*/ + Encoder_State *st_fx, /* i/o: encoder state structure */ + Word16 *audio, /* i : i audio signal Q0*/ const Word16 input_frame_orig, /* i : frame length Q0*/ const Word16 hq_core_type, /* i : HQ core type Q0*/ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/ @@ -1083,7 +1083,6 @@ Word16 SQ_gain_estimate_fx( ); - Word16 tcx_scalar_quantization_rateloop_fx( Word32 *x, /* i : input coefficients Q = 31 - x_e*/ Word16 x_e, /* i : exponent Q0*/ @@ -1405,7 +1404,6 @@ void encode_acelp_gains_fx( ); - void ari_copy_states_fx( Tastat *source, Tastat *dest ); @@ -1759,7 +1757,6 @@ Word16 ari_encode_14bits_range_fx( ); - Word16 ari_done_cbr_encoding_14bits_fx( Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ diff --git a/lib_isar/isar_rom_lcld_tables.c b/lib_isar/isar_rom_lcld_tables.c index 78dcd9077..51d0ca842 100644 --- a/lib_isar/isar_rom_lcld_tables.c +++ b/lib_isar/isar_rom_lcld_tables.c @@ -19830,4 +19830,3 @@ const Word32 c_pfP2RImagLUT[32] = /* Q31 */ { 2147483647, 2106220288, 1984016128, 1785567232, 1518500224, 1193077888, 821806080, 418953248 }; - diff --git a/lib_rend/ivas_objectRenderer_mix_fx.c b/lib_rend/ivas_objectRenderer_mix_fx.c index a162c2ae0..432ae5491 100644 --- a/lib_rend/ivas_objectRenderer_mix_fx.c +++ b/lib_rend/ivas_objectRenderer_mix_fx.c @@ -55,8 +55,8 @@ static ivas_error DefaultBSplineModel_fx( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, void TDREND_MIX_LIST_SetPos_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const Word32 *Pos_p, /* i : Listener's position */ - const Word16 Pos_q /* i : Listener's position Q */ + const Word32 *Pos_p, /* i : Listener's position */ + const Word16 Pos_q /* i : Listener's position Q */ ) { TDREND_MIX_Listener_t *Listener_p; diff --git a/lib_util/ivas_rtp_api.h b/lib_util/ivas_rtp_api.h index 3fd41cdad..121067bf1 100644 --- a/lib_util/ivas_rtp_api.h +++ b/lib_util/ivas_rtp_api.h @@ -83,8 +83,8 @@ typedef enum { IVAS_RTP_UNDEF = -1, /* undefined = Codec Type not set yet */ - IVAS_RTP_EVS, /* EVS */ - IVAS_RTP_IVAS /* IVAS */ + IVAS_RTP_EVS, /* EVS */ + IVAS_RTP_IVAS /* IVAS */ } IVAS_RTP_CODEC; /* IVAS Bandwidth Requests */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 60630b853..aaa256741 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -166,7 +166,7 @@ struct RenderConfigReader AcousticEnv *pAE; /* Acoustic environments */ uint32_t nDP; /* Number of directivity patterns */ DirectrivityPat *pDP; /* Directivity Pattern */ - float distAtt[3]; /* [MaxDist Q25, RefDist Q28, Rolloff Q28] */ + float distAtt[3]; /* [MaxDist Q25, RefDist Q28, Rolloff Q28] */ }; -- GitLab