Commit 30924148 authored by vaclav's avatar vaclav
Browse files

fix

parent d49a54e0
Loading
Loading
Loading
Loading
Loading
+18 −45
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ ivas_error ivas_core_dec_fx(
    Decoder_State **sts, *st;
    STEREO_ICBWE_DEC_HANDLE hStereoICBWE;
    STEREO_TD_DEC_DATA_HANDLE hStereoTD;
    STEREO_CNG_DEC_HANDLE hStereoCng;
    Word16 sharpFlag[CPE_CHANNELS];
    Word16 tmp_buffer_fx[L_FRAME48k];
    set16_fx( tmp_buffer_fx, 0, L_FRAME48k );
@@ -146,6 +147,7 @@ ivas_error ivas_core_dec_fx(
        last_element_mode = IVAS_SCE;
        move16();
        hStereoTD = NULL;
        hStereoCng = NULL;
        p_output_mem_fx = NULL;
        nchan_out = 1;
        move16();
@@ -170,6 +172,7 @@ ivas_error ivas_core_dec_fx(
        move16();
        hStereoICBWE = hCPE->hStereoICBWE;
        hStereoTD = hCPE->hStereoTD;
        hStereoCng = hCPE->hStereoCng;
        p_output_mem_fx = hCPE->output_mem_fx[1];

        nchan_out = hCPE->nchan_out;
@@ -242,8 +245,6 @@ ivas_error ivas_core_dec_fx(
        move16();
        st->GSC_IVAS_mode = 0;
        move16();
        st->element_brate = element_brate;
        move32();
        st->use_partial_copy = 0;
        move16();
        st->rf_flag = 0;
@@ -345,8 +346,7 @@ ivas_error ivas_core_dec_fx(

    /* MDCT stereo -> DFT stereo switching */
    test();
    test();
    IF( hCPE != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) )
    IF( EQ_16( last_element_mode, IVAS_CPE_MDCT ) && EQ_16( sts[0]->element_mode, IVAS_CPE_DFT ) )
    {
        Word16 ovl, fade_len;
        IF( NE_16( sts[0]->L_frame, sts[0]->last_L_frame ) )
@@ -370,9 +370,9 @@ ivas_error ivas_core_dec_fx(
    }

    test();
    if ( hCPE != NULL && hCPE->hStereoCng != NULL )
    if ( hStereoCng != NULL )
    {
        hCPE->hStereoCng->flag_cna_fade = 0;
        hStereoCng->flag_cna_fade = 0;
        move16();
    }

@@ -413,7 +413,7 @@ ivas_error ivas_core_dec_fx(
    test();
    IF( hCPE != NULL && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->brate_surplus > 0 )
    {
        ivas_combined_format_brate_sanity_fx( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps );
        ivas_combined_format_brate_sanity_fx( element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps );
    }

    /*------------------------------------------------------------------*
@@ -534,20 +534,11 @@ ivas_error ivas_core_dec_fx(
                Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, add( M, 1 ), sub( norm_s( sub( st->hFdCngDec->hFdCngCom->A_cng[0], 1 ) ), 3 ) ); // Qx
            }

            IF( hCPE == NULL )
            {
                IF( NE_32( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, NULL, read_sid_info ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
            }
            ELSE
            {
                IF( NE_32( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE->hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
            }

#ifdef FIX_ISSUE_1237
            Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, st->Q_syn2 ) ); // Q_syn2->Q11
#else
@@ -594,7 +585,6 @@ ivas_error ivas_core_dec_fx(
        IF( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
        {
            Word16 Qsyn_temp;
            STEREO_CNG_DEC_HANDLE hStereoCng;
            IVAS_FORMAT ivas_format;

            Qsyn_temp = st->Q_syn;
@@ -620,14 +610,6 @@ ivas_error ivas_core_dec_fx(
            st->hHQ_core->Q_old_wtda = 0;
            move16();

            IF( hCPE == NULL )
            {
                hStereoCng = NULL;
            }
            ELSE
            {
                hStereoCng = hCPE->hStereoCng;
            }
            IF( st_ivas == NULL )
            {
                ivas_format = 0;
@@ -784,7 +766,7 @@ ivas_error ivas_core_dec_fx(
            sts[0] = hCPE->hCoreCoder[0];
            sts[1] = hCPE->hCoreCoder[1];

            IF( LE_32( hCPE->last_element_brate, IVAS_SID_5k2 ) )
            IF( LE_32( last_element_brate, IVAS_SID_5k2 ) )
            {
                sts[0]->hHQ_core->exp_old_out = sub( 15, sts[0]->hHQ_core->Q_old_wtda );
                move16();
@@ -793,7 +775,7 @@ ivas_error ivas_core_dec_fx(
            }
            updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx );

            IF( LE_32( hCPE->last_element_brate, IVAS_SID_5k2 ) )
            IF( LE_32( last_element_brate, IVAS_SID_5k2 ) )
            {
                sts[0]->hHQ_core->Q_old_wtda = sub( 15, sts[0]->hHQ_core->exp_old_out );
                move16();
@@ -836,7 +818,7 @@ ivas_error ivas_core_dec_fx(
     *---------------------------------------------------------------------*/

    test();
    IF( EQ_16( sts[0]->element_mode, IVAS_CPE_TD ) && hCPE->hStereoCng != NULL )
    IF( EQ_16( sts[0]->element_mode, IVAS_CPE_TD ) && hStereoCng != NULL )
    {
        /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */
        Word16 Q_c_PS_LT, Q_output;
@@ -846,13 +828,13 @@ ivas_error ivas_core_dec_fx(
        move16();
        Q_output = 11;
        move16();
        c_PS_LT_fx = L_deposit_h( hCPE->hStereoCng->c_PS_LT_fx );
        c_PS_LT_fx = L_deposit_h( hStereoCng->c_PS_LT_fx );
        Q_c_PS_LT = Q31;
        move16();

        stereo_cng_compute_PScorr_fx( output_32_fx[0], output_32_fx[1], &Q_output, &c_PS_LT_fx, Q_c_PS_LT, sts[0]->L_frame, sts[1]->L_frame );

        hCPE->hStereoCng->c_PS_LT_fx = extract_h( c_PS_LT_fx );
        hStereoCng->c_PS_LT_fx = extract_h( c_PS_LT_fx );
    }

    /*---------------------------------------------------------------------*
@@ -976,16 +958,7 @@ ivas_error ivas_core_dec_fx(
            ivas_format = UNDEFINED_FORMAT;
            move32();
        }
        IF( hCPE != NULL )
        {
            last_element_mode = hCPE->last_element_mode;
            move16();
        }
        ELSE
        {
            last_element_mode = IVAS_SCE;
            move16();
        }

        IF( NE_32( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, ivas_format, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode, &Q_synth ) ), IVAS_ERR_OK ) )
        {
            return error;
@@ -1011,7 +984,7 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
        IF( n == 0 && EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( EQ_16( nchan_out, 1 ) || ( hCPE != NULL && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) ) )
        IF( n == 0 && EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( EQ_16( nchan_out, 1 ) || EQ_16( last_element_mode, IVAS_CPE_DFT ) ) )
        {
            Copy( sts[0]->previoussynth_fx, sts[1]->previoussynth_fx, st->hTcxDec->L_frameTCX );
        }
@@ -1588,7 +1561,7 @@ ivas_error ivas_core_dec_fx(
            Word16 q;
            q = 11;
            move16();
            IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) )
            IF( EQ_16( last_element_mode, IVAS_CPE_MDCT ) )
            {
                stereo_mdct2dft_update_fx( hCPE, output_32_fx[0], synth_32_fx[0] );
            }
+2 −2
Original line number Diff line number Diff line
@@ -5017,7 +5017,7 @@ void GenTransition_WB_fx(
    /* cross fade of overlap snippet and mirrored HB synth from previous frame */
    FOR( i = 0; i < L_SHB_LAHEAD; i++ )
    {
        L_tmp = L_mult( window_shb_fx[i], hBWE_TD->old_hb_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i] );
        L_tmp = L_mult( window_shb_fx[i], hBWE_TD->old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i] );
        output[i] = mac_r( L_tmp, window_shb_fx[L_SHB_LAHEAD - 1 - i], speech_buf_16k2[i] );
        move16();
        output[i] = mult_r( output[i], 21299 );
@@ -5027,7 +5027,7 @@ void GenTransition_WB_fx(
    /* fill transition signal with mirrored HB synth from previous frame to fully fill delay alignment buffer gap */
    FOR( ; i < length; i++ )
    {
        output[i] = mult_r( hBWE_TD->old_hb_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i], 21299 );
        output[i] = mult_r( hBWE_TD->old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i], 21299 );
        move16();
    }