Commit b6f90083 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'cng_bug_fix_mld_improvements' into 'main'

Bug fix and Optimization related changes to stereo_dft_generate_comfort_noise, MLD improvements

See merge request !527
parents b00f01f1 9991d3ee
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2771,8 +2771,8 @@ void GenTransition_fixed(
    const int16_t element_mode, /* i  : element mode                            */
    const int16_t L_frame,      /* i  : ACELP frame length                      */
    const int16_t rf_flag,      /* i  : RF flag                                 */
    const int32_t total_brate   /* i  : total bitrate                           */
);
    const int32_t total_brate,  /* i  : total bitrate                           */
    const Word16 prev_Qx );
void GenTransition_WB(
    TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle                      */
+3 −3
Original line number Diff line number Diff line
@@ -913,7 +913,7 @@ ivas_error ivas_core_dec_fx(
            test();
            IF( ( EQ_16( st->bwidth, SWB ) || EQ_16( st->bwidth, FB ) ) && ( EQ_16( st->last_extl, SWB_TBE ) || EQ_16( st->last_extl, FB_TBE ) ) )
            {
                GenTransition_fixed( st->hBWE_TD, hb_synth_32_fx[n], output_Fs, st->element_mode, st->L_frame, st->rf_flag, st->total_brate );
                GenTransition_fixed( st->hBWE_TD, hb_synth_32_fx[n], output_Fs, st->element_mode, st->L_frame, st->rf_flag, st->total_brate, st->prev_Qx );
            }
            ELSE IF( EQ_16( st->bwidth, WB ) && EQ_16( st->last_extl, WB_TBE ) )
            {
@@ -1142,7 +1142,7 @@ ivas_error ivas_core_dec_fx(
            move16();

            ivas_swb_tbe_dec_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc );

            Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->syn_overlap_fx, st->hBWE_TD->syn_overlap_fx_32, L_SHB_LAHEAD, sub( Q11, st->prev_Q_bwe_syn2 ) );
            Copy_Scale_sig_32_16( st->hBWE_TD->old_tbe_synth_fx_32, st->hBWE_TD->old_tbe_synth_fx, L_SHB_TRANSITION_LENGTH, sub( st->prev_Qx, Q11 ) );

            IF( GT_16( Q_white_exc, 31 ) )
@@ -1238,7 +1238,7 @@ ivas_error ivas_core_dec_fx(
#endif
            Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, -( Q8 - st->prev_Q_bwe_syn ) );
            Scale_sig32( st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, -( st->prev_Q_bwe_syn2 - Q11 ) );
            Copy_Scale_sig_16_32( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -( st->prev_Q_bwe_syn2 - Q11 ) );
            Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -( st->prev_Q_bwe_syn2 - Q11 ) );
        }

        /*-------------------------------------------------------------------*
+8 −6
Original line number Diff line number Diff line
@@ -1057,21 +1057,23 @@ static void stereo_dft_generate_comfort_noise_fx(
            E0 = W_shl( E0, E0_e );
            E0_e = add( sub( st->hFdCngDec->bandNoiseShape_exp, E0_e ), 32 );
            E1_e = W_norm( E1 );
            E1 = W_shl( E0, E1_e );
            E1 = W_shl( E1, E1_e );
            E1_e = sub( 63, add( E1_e, add( shl( q_cngNoiseLevel_upd, 1 ), 1 ) ) );

            IF( BASOP_Util_Cmp_Mant32Exp( W_extract_h( E0 ), E0_e, W_extract_h( E1 ), E1_e ) < 0 )
            {
                tmp_16 = BASOP_Util_Divide3232_Scale( W_extract_h( E0 ), W_extract_h( E1 ), &q_div );
                q_div = add( q_div, sub( E0_e, E1_e ) );
                tmp_16 = Sqrt16( tmp_16, &q_div );
            IF( BASOP_Util_Cmp_Mant32Exp( tmp_16, add( 16, q_div ), MAX_32, 0 ) < 0 )
            {
                tmp_16 = shl( tmp_16, q_div );
                hStereoCng->xfade_length = sub( MAX_XFADE_FX, extract_l( L_shr( imult3216( MAX_XFADE_FX, tmp_16 ), Q15 ) ) );
                move16();
            }
            ELSE
            {
                tmp_16 = Inv16( tmp_16, &q_div );
                tmp_16 = BASOP_Util_Divide3232_Scale( W_extract_h( E1 ), W_extract_h( E0 ), &q_div );
                q_div = add( q_div, sub( E1_e, E0_e ) );
                tmp_16 = Sqrt16( tmp_16, &q_div );
                tmp_16 = shl( tmp_16, q_div );
                hStereoCng->xfade_length = sub( MAX_XFADE_FX, extract_l( L_shr( imult3216( MAX_XFADE_FX, tmp_16 ), Q15 ) ) );
                move16();
+4 −4
Original line number Diff line number Diff line
@@ -2660,7 +2660,7 @@ void ivas_swb_tbe_dec_fx(

    /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */
    GenSHBSynth_fx_32( shaped_shb_excitation_fx_32, error_fx, hBWE_TD->genSHBsynth_Hilbert_Mem_fx, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->L_frame, &( hBWE_TD->syn_dm_phase ) );

    Copy_Scale_sig_32_16( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, 2 * ALLPASSSECTIONS_STEEP, -( Q11 - Q_bwe_exc ) );
    Copy32( error_fx + L_FRAME32k - L_SHB_TRANSITION_LENGTH, hBWE_TD->old_tbe_synth_fx_32, L_SHB_TRANSITION_LENGTH );

    /* resample SHB synthesis (if needed) and scale down */
@@ -4566,8 +4566,8 @@ void GenTransition_fixed(
    const Word16 element_mode, /* i  : element mode                         */
    const Word16 L_frame,      /* i  : ACELP frame length                   */
    const Word16 rf_flag,      /* i  : RF flag                              */
    const Word32 total_brate   /* i  : total bitrate                        */
)
    const Word32 total_brate,  /* i  : total bitrate                        */
    const Word16 prev_Qx )
{
    Word16 i, length;

@@ -4615,7 +4615,7 @@ void GenTransition_fixed(
    /* fill transition signal with mirrored HB synth from previous frame to fully fill delay alignment buffer gap */
    FOR( ; i < length; i++ )
    {
        outputHB_fx[i] = hBWE_TD->old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i];
        outputHB_fx[i] = L_shl( hBWE_TD->old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i], sub( Q11, prev_Qx ) );
        move32();
    }