Commit f79d86a2 authored by vaclav's avatar vaclav
Browse files

FIX_1320_STACK_CPE_DECODER in mdct_core

parent 82fdad6d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -804,7 +804,11 @@ void ivas_mdct_core_reconstruct(
    int16_t L_frame[CPE_CHANNELS], L_frameTCX[CPE_CHANNELS], nSubframes[CPE_CHANNELS];
    int16_t L_frame_global[CPE_CHANNELS], L_frame_globalTCX[CPE_CHANNELS];
    /* Synth */
#ifdef FIX_1320_STACK_CPE_DECODER
    float synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME32k + L_FRAME32k / 4 + M];
#else
    float synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
#endif
    float *synth;
    float synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
    float *synthFB;
@@ -841,7 +845,11 @@ void ivas_mdct_core_reconstruct(
        synthFB = synth_bufFB + st->hTcxDec->old_synth_lenFB;
        mvr2r( st->hTcxDec->old_synth, synth_buf, st->hTcxDec->old_synth_len );
        mvr2r( st->hTcxDec->old_synthFB, synth_bufFB, st->hTcxDec->old_synth_lenFB );
#ifdef FIX_1320_STACK_CPE_DECODER
        set_zero( synth, L_FRAME32k + L_FRAME32k / 4 + M );
#else
        set_zero( synth, L_FRAME_PLUS + M );
#endif
        set_zero( synthFB, L_FRAME_PLUS + M );

        if ( st->core != ACELP_CORE )
+19 −0
Original line number Diff line number Diff line
@@ -156,7 +156,9 @@ void stereo_mdct_core_dec(
    float *x[CPE_CHANNELS][NB_DIV];

    /*needed to allocate N_MAX to prevent stereo switching crash */
#ifndef FIX_1320_STACK_CPE_DECODER
    float x_0_buf[CPE_CHANNELS][N_MAX];
#endif
    float *x_0[CPE_CHANNELS][NB_DIV];

    /* Concealment */
@@ -178,6 +180,7 @@ void stereo_mdct_core_dec(

    int16_t p_param[CPE_CHANNELS][NB_DIV];
    int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV];

    float signal_outFB_tmp[CPE_CHANNELS][L_FRAME_PLUS];
    float signal_out_tmp[CPE_CHANNELS][L_FRAME_PLUS];
    push_wmops( "stereo_mdct_core_dec" );
@@ -202,9 +205,15 @@ void stereo_mdct_core_dec(
        x[ch][0] = &signal_out_tmp[ch][0];
        x[ch][1] = &signal_out_tmp[ch][0] + L_FRAME_PLUS / 2;

#ifdef FIX_1320_STACK_CPE_DECODER
        set_zero( signal_outFB_tmp[ch], N_MAX ); /* length of N_MAX is needed to prevent stereo switching crash -> reuse buffer signal_outFB_tmp[][] */
        x_0[ch][0] = &signal_outFB_tmp[ch][0];
        x_0[ch][1] = &signal_outFB_tmp[ch][0] + L_FRAME48k / 2;
#else
        set_zero( x_0_buf[ch], N_MAX );
        x_0[ch][0] = &x_0_buf[ch][0];
        x_0[ch][1] = &x_0_buf[ch][0] + L_FRAME48k / 2;
#endif
        nTnsBitsTCX10[ch][0] = 0;
        nTnsBitsTCX10[ch][1] = 0;

@@ -355,6 +364,15 @@ void stereo_mdct_core_dec(
        apply_dmx_weights( hCPE, x, sts[0]->transform_type, sts[1]->transform_type );
    }

#ifdef FIX_1320_STACK_CPE_DECODERaa
    mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k );
    mvr2r( signal_out_tmp[1], signal_out[1], L_FRAME48k );

    ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 );

    mvr2r( signal_outFB_tmp[0], signal_outFB[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX );
    mvr2r( signal_outFB_tmp[1], signal_outFB[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX );
#else
    ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 );

    mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k );
@@ -362,6 +380,7 @@ void stereo_mdct_core_dec(

    mvr2r( signal_outFB_tmp[0], signal_outFB[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX );
    mvr2r( signal_outFB_tmp[1], signal_outFB[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX );
#endif

    pop_wmops();
    return;