Commit bc5009c7 authored by vaclav's avatar vaclav
Browse files

updates to separate BE and non-BE changes

parent 1fbc5486
Loading
Loading
Loading
Loading
Loading
+29 −21
Original line number Diff line number Diff line
@@ -76,14 +76,9 @@ ivas_error ivas_core_dec_fx(
    set16_fx( tmp_buffer_fx, 0, L_FRAME48k );

    Word16 tmps, incr;
#define FIX_1320_STACK_CPE_DECODER_CHECK_BE
#ifdef FIX_1320_STACK_CPE_DECODER
    Word16 flag_bwe_bws;
#ifdef FIX_1320_STACK_CPE_DECODER_CHECK_BE
    Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET];
#else
    Word16 flag_bwe_bws, flaf_swb_tbe;
    Word32 *bwe_exc_extended_fx[CPE_CHANNELS] = { NULL, NULL };
#endif
#else
    Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET];
#endif
@@ -302,9 +297,7 @@ ivas_error ivas_core_dec_fx(
        set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k );
        set16_fx( hb_synth_16_fx[n], 0, L_FRAME48k );
#ifdef FIX_1320_STACK_CPE_DECODER
#ifndef FIX_1320_STACK_CPE_DECODER_CHECK_BE
        bwe_exc_extended_fx[n] = hb_synth_32_fx[n]; /* note: reuse the buffer */
#endif
#endif

        /*------------------------------------------------------------------*
@@ -988,6 +981,24 @@ ivas_error ivas_core_dec_fx(
        Word16 Q_input, Q_hb_synth_fx, Q_synth_fx;
        Word16 Q_syn_hb, sf;

#ifdef FIX_1320_STACK_CPE_DECODER
        flaf_swb_tbe = 0;
        move16();
        test();
        test();
        test();
        test();
        test();
        test();
        test();
        test();
        if ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) )
        {
            flaf_swb_tbe = 1;
            move16();
        }
#endif

        sf = getScaleFactor32( output_32_fx[n], L_FRAME48k );

        Q_input = 0;
@@ -1012,7 +1023,6 @@ ivas_error ivas_core_dec_fx(
        IF( EQ_16( st->extl, WB_TBE ) )
        {
            /* WB TBE decoder */

            ivas_wb_tbe_dec_fx( st, st->coder_type, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], hb_synth_16_fx[n], &Q_hb_synth_fx );
        }
        ELSE IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( n, 1 ) && !tdm_LRTD_flag && NE_16( st->extl, -1 ) && st->bws_cnt == 0 && st->extl_brate == 0 )
@@ -1026,19 +1036,13 @@ ivas_error ivas_core_dec_fx(
        }

        /* Memories  Re-Scaling */
#ifndef FIX_1320_STACK_CPE_DECODER_CHECK_BE
#ifdef FIX_1320_STACK_CPE_DECODER
        test();
        test();
        IF( EQ_16( st->extl, WB_TBE ) || ( ( EQ_16( st->extl, WB_BWE ) && st->bws_cnt == 0 ) ) )
        IF( !flaf_swb_tbe )
        {
#endif
#endif
            Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11
#ifndef FIX_1320_STACK_CPE_DECODER_CHECK_BE
#ifdef FIX_1320_STACK_CPE_DECODER
        }
#endif
#endif
        Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) );    // Q11    // Q_input can get value <= -5
        Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], output_frame, sub( Q11, Q_synth_fx ) ); // Q11
@@ -1061,6 +1065,7 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
        test();
        flag_bwe_bws = ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && st->bfi == 0 );
        move16();
#endif
@@ -1068,7 +1073,11 @@ ivas_error ivas_core_dec_fx(
        Q_white_exc = 0;
        move16();

#ifndef FIX_1320_STACK_CPE_DECODER
#ifdef FIX_1320_STACK_CPE_DECODER
        test();
        test();
        IF( flaf_swb_tbe )
#else
        test();
        test();
        test();
@@ -1076,7 +1085,6 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
#endif
        test();
        test();
        test();
@@ -1088,6 +1096,7 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        IF( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) )
#endif
        {
            /* SWB TBE decoder */
            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 );
@@ -1109,7 +1118,7 @@ ivas_error ivas_core_dec_fx(
            }
        }
#ifdef FIX_1320_STACK_CPE_DECODER
        ELSE IF( st->extl == SWB_BWE || st->extl == FB_BWE || flag_bwe_bws )
        ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || flag_bwe_bws )
#else
        ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) )
#endif
@@ -1126,11 +1135,10 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
        IF( ( st->core == ACELP_CORE && ( st->extl == -1 || st->extl == SWB_CNG ) ) && flag_bwe_bws == 0 )
        IF( ( st->core == ACELP_CORE && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) ) ) && flag_bwe_bws == 0 )
        {
            set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k );
        }

#endif

        /*---------------------------------------------------------------------*