From f3ec8ef67be2153e44330b31d596986bfbe4f518 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 9 Aug 2024 21:10:27 +0530 Subject: [PATCH] Fixes for some high MLD cases [x] ltv-MASA 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, MONO out - MLD reduced [x] stv-OMASA 1Dir2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, HOA3 out - MLD reduced from 11.2 to 7.9 --- lib_com/ivas_dirac_com.c | 2 +- lib_dec/core_switching_dec_fx.c | 8 +++++++- lib_dec/ivas_stereo_switching_dec.c | 2 +- lib_rend/lib_rend.c | 4 ++-- lib_rend/lib_rend.h | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index adfe5b666..c810923c1 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -2218,7 +2218,7 @@ static UWord16 deindex_sph_idx_general_fx( IF( GE_32( *theta_dec_fx, 90 << Q22 ) ) { - *theta_dec_fx = 90 << 22 * sign_theta; + *theta_dec_fx = ( 90 << 22 ) * sign_theta; move32(); *phi_dec_fx = 0; move32(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 85a301239..383b3ca87 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1694,6 +1694,13 @@ ivas_error core_switching_post_dec_ivas_fx( } /* delay HQ synthesis to synchronize with ACELP synthesis */ /* rescaling to the min exp of the 2 */ + if ( hHQ_core->Q_old_postdec ) + { + Scale_sig( st_fx->delay_buf_out_fx, delay_comp, negate( hHQ_core->Q_old_postdec ) ); + } + + hHQ_core->Q_old_postdec = 0; + move16(); Qtmp = s_min( *Qsynth, hHQ_core->Q_old_postdec ); Scale_sig( synth, output_frame, sub( Qtmp, *Qsynth ) ); *Qsynth = Qtmp; @@ -1816,7 +1823,6 @@ ivas_error core_switching_post_dec_ivas_fx( L_tmp2 = L_mac0( L_tmp2, div_s( sub( tmpDelta, i ), tmpDelta ), tmp ); L_tmp2 = L_shl( L_tmp2, 1 ); synth[i + delay_comp] = round_fx( L_add( L_tmp, L_tmp2 ) ); - move16(); } test(); test(); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 82b3b0a66..1e3198b0e 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -3222,7 +3222,7 @@ void stereo_switching_dec( // fix need to do correctly set32_fx( sts[1]->old_pitch_buf_fx, L_deposit_h( L_SUBFR ), 2 * NB_SUBFR16k ); - sts[1]->old_fpitchFB = 2 * L_SUBFR; + sts[1]->old_fpitchFB = L_deposit_h( 2 * L_SUBFR ); move32(); /* reset CLDFB memories */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 606f003ca..55dfd9808 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -10148,7 +10148,7 @@ static void renderIsmToMasa( FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { - input_e[i] = sub( 31, add( getScaleFactor32( tmpRendBuffer_fx[i], L_FRAME48k ), 8 ) ); + input_e[i] = sub( 31, add( getScaleFactor32( tmpRendBuffer_fx[i], L_FRAME48k ), *outAudio.pq_fact ) ); move16(); } @@ -10167,7 +10167,7 @@ static void renderIsmToMasa( { FOR( j = 0; j < L_FRAME48k; j++ ) { - tmpRendBuffer_fx[i][j] = L_shr( tmpRendBuffer_fx[i][j], add( sub( max_e, sub( 31, Q8 ) ), guard_bits ) ); + tmpRendBuffer_fx[i][j] = L_shr( tmpRendBuffer_fx[i][j], add( sub( max_e, sub( 31, *outAudio.pq_fact ) ), guard_bits ) ); move32(); } } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 12ec67502..beb2af289 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -83,7 +83,7 @@ typedef struct Word16 q_factor; Word16 *pq_fact; Word32 *data_fx; - Word16 Q_data; + // Word16 Q_data; } IVAS_REND_AudioBuffer; #endif -- GitLab