Commit 6f39834e authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Scaling/BASOP updates to fix high MLD cases

parent cc43b322
Loading
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -3127,10 +3127,7 @@ void GenShapedSHBExcitation_ivas_fx(
#else
            L_tmp4 = L_shl( L_deposit_l( White_exc16k[k] ), tmp );
#endif
            IF( excNoisyEnv[k] != 0 )
            {
            L_tmp4 = L_mult( shr( excNoisyEnv[k], sub( Q_excTmp2, *Q_bwe_exc ) ), White_exc16k[k] ); /* (Q_bwe_exc)  +5 +1*/
            }
            White_exc16k_32[k] = L_tmp4;
            move32();
            L_tmp = L_max( L_tmp, L_abs( White_exc16k_32[k] ) );
+12 −9
Original line number Diff line number Diff line
@@ -4155,6 +4155,7 @@ static void ivas_fec_ecu_dft_fx(
    *exp = add( tmp, add( 2, norm_s( *Nfft ) ) );
    move16();
    Copy_Scale_sig_16_32( Tfr16, Tfr32, *Nfft, *exp ); /*Qin+exp; */
    *exp = s_min( *exp, 15 );

    DoRTFTn_fx( Tfr32, Tfi32, *Nfft );
    N_LP = shr( *Nfft, 1 );
@@ -4617,7 +4618,8 @@ static void ivas_fec_noise_filling_fx(
    const Word16 HqVoicing,
    Word16 *gapsynth_fx,       /*Qsynth */
    const Word16 element_mode, /* i  : IVAS element mode                          */
    const Word16 *old_out )
    const Word16 *old_out,
    const Word16 Q_old_out )
{

    Word16 Rnd_N_noise;
@@ -4760,7 +4762,7 @@ static void ivas_fec_noise_filling_fx(
        q2 = round_fx( L_sub( 2147483647, L_tmp ) );          /*Q15 */
        q1 = round_fx( L_tmp );                               /*Q15 */
        L_tmp = L_mult( ( *pt1 ), q1 );                       /*Qsynth+16 */
        L_tmp = L_mac( L_tmp, ( *pt6++ ), q2 );      /*Qsynth+16 */
        L_tmp = L_mac( L_tmp, shr( *pt6++, Q_old_out ), q2 ); /*Qsynth+16 */
        ( *pt1++ ) = round_fx( L_tmp );                       /*Qsynth */
        move16();
    }
@@ -4965,7 +4967,8 @@ static void ivas_fec_alg_fx(
    const Word16 HqVoicing,
    Word16 *gapsynth,          /*Qin */
    const Word16 element_mode, /* i  : IVAS element mode                          */
    const Word16 *old_out )
    const Word16 *old_out,
    const Word16 Q_old_out )
{
    Word16 Nfft;
    Word32 sum_Tf_abs;
@@ -4980,7 +4983,7 @@ static void ivas_fec_alg_fx(

    sinusoidal_synthesis_fx( Tfr, Tfi, Tf_abs, N, output_frame, decimatefactor, Nfft, sum_Tf_abs, synthesis, HqVoicing, exp );

    ivas_fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth, element_mode, old_out );
    ivas_fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth, element_mode, old_out, Q_old_out );

    n = R1_48 - R2_48;
    move16();
@@ -5456,7 +5459,7 @@ void ivas_hq_ecu_fx(
    IF( ( ( st_fx->element_mode == EVS_MONO ) && evs_mode_selection ) ||
        ( ( st_fx->element_mode != EVS_MONO ) && evs_mode_selection && ivas_mode_selection ) )
    {
        ivas_fec_alg_fx( fec_alg_input, prevsynth_LP, &st_fx->hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, st_fx->element_mode, st_fx->hHQ_core->old_out_fx );
        ivas_fec_alg_fx( fec_alg_input, prevsynth_LP, &st_fx->hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, st_fx->element_mode, st_fx->hHQ_core->old_out_fx, st_fx->hHQ_core->Q_old_wtda );
        *last_fec = 1;
        move16();
        *ph_ecu_active = 0;
+1 −1
Original line number Diff line number Diff line
@@ -845,7 +845,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx(
    st_fx->cldfbSyn->Q_cldfb_state = sub( st_fx->cldfbSyn->Q_cldfb_state, 1 );
    Copy_Scale_sig_32_16( synth32, synth_out, L_FRAME48k, -5 );

    Scale_sig( synth_out, L_FRAME48k, negate( st_fx->Q_syn ) );
    // Scale_sig( synth_out, L_FRAME48k, negate( st_fx->Q_syn ) );

    cldfb_restore_memory_ivas_fx( st_fx->cldfbSyn );

+2 −0
Original line number Diff line number Diff line
@@ -2057,6 +2057,8 @@ ivas_error core_switching_post_dec_ivas_fx(
    {
        /* memory update needed for DFT stereo -> TD stereo switching, scaling synth to Q0 */
        Copy_Scale_sig( synth + sub( output_frame, delay_comp ), st_fx->delay_buf_out_fx, delay_comp, negate( *Qsynth ) );
        hHQ_core->Q_old_postdec = 0;
        move16();
    }

    /* reset SWB BWE buffers */
+7 −2
Original line number Diff line number Diff line
@@ -3824,7 +3824,12 @@ void decoder_tcx_ivas_fx(
    }

    /* Scaling down buffers for decoder_tcx_imdct_fx*/
    Scale_sig( st->hTcxDec->syn_Overl, 320, -1 );    // Scaling to Q_syn
    Scale_sig( st->hTcxDec->syn_Overl_TDACFB, L_FRAME_MAX / 2, 1 );                          // Scaling to Q_syn
    Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, 1 );                             // Scaling to Q_syn
    Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, negate( st->hHQ_core->Q_old_out ) );    // Scaling to Q_syn
    Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, negate( st->hHQ_core->Q_old_out ) ); // Scaling to Q_syn
    st->hHQ_core->Q_old_out = 0;

    Scale_sig( st->hTcxDec->old_syn_Overl, 320, 1 ); // Scaling to Q_syn
    Copy_Scale_sig_16_32_no_sat( st->old_Aq_12_8_fx, st->old_Aq_12_8_fx_32, M + 1, ( sub( 28, ( sub( 15, norm_s( sub( st->old_Aq_12_8_fx[0], 1 ) ) ) ) ) ) );

@@ -3837,7 +3842,7 @@ void decoder_tcx_ivas_fx(
    /* Scaling up again */
    Scale_sig( synth_fx, L_frame_glob, negate( st->Q_syn ) );
    Scale_sig( synthFB_fx, L_frameTCX_glob, negate( st->Q_syn ) );
    Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, 1 );
    // Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, 1 );
    st->hHQ_core->Q_old_wtda = st->Q_syn;
    // Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( sub( st->hHQ_core->Q_old_wtda, st->Q_syn ) ) );
    st->hHQ_core->Q_old_wtda_LB = st->Q_syn;
Loading