Commit c80134e3 authored by sagnowski's avatar sagnowski
Browse files

Fix buffer problems in MCT

parent b06c4637
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2906,7 +2906,8 @@ void ivas_mct_core_dec(
    CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS],                        /* i/o: CPE decoder structure                   */
    const int16_t nCPE,                                         /* i  : number of CPEs                          */
#ifdef FLOAT_INTERFACE_DEC_REND
    float* signal_out[]                                         /* o  : synthesis @internal_FS                  */
    float* signal_out[],                                        /* o  : synthesis @internal_FS                  */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
#else
    float signal_out[][L_FRAME48k]                              /* o  : synthesis @internal_FS                  */
#endif
+6 −1
Original line number Diff line number Diff line
@@ -166,7 +166,8 @@ void ivas_mct_core_dec(
    CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure       */
    const int16_t nCPE,                  /* i  : number of CPEs              */
#ifdef FLOAT_INTERFACE_DEC_REND
    float* signal_out[]                  /* o  : synthesis @internal_FS      */
    float* signal_out[],                 /* o  : synthesis @internal_FS      */
    const int16_t output_frame           /* i  : output frame length per channel                         */
#else
    float signal_out[][L_FRAME48k]       /* o  : synthesis @internal_FS      */
#endif
@@ -221,7 +222,11 @@ void ivas_mct_core_dec(
        /* Initialization or re-configuration of Stereo TCX */
        sts[ch]->enablePlcWaveadjust = 0;
        x[ch][0] = &signal_out[ch][0];
#ifdef FLOAT_INTERFACE_DEC_REND
        x[ch][1] = &signal_out[ch][0] + output_frame / 2;
#else
        x[ch][1] = &signal_out[ch][0] + L_FRAME48k / 2;
#endif
    }

    /*--------------------------------------------------------------------------------*
+28 −1
Original line number Diff line number Diff line
@@ -155,9 +155,16 @@ ivas_error ivas_mct_dec(
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
            x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0];
#ifdef FLOAT_INTERFACE_DEC_REND
            /* TODO(sgi): Consult with MCT expert */
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
            set_zero( x[n][0], output_frame / 2 );
            set_zero( x[n][1], output_frame / 2 );
#else
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
            set_zero( x[n][0], L_FRAME48k / 2 );
            set_zero( x[n][1], L_FRAME48k / 2 );
#endif
        }

        ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], hMCT->LFE_off, nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id],
@@ -168,7 +175,12 @@ ivas_error ivas_mct_dec(
    }

    /* MCT core decoder */
    ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output );
    ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output
#ifdef FLOAT_INTERFACE_DEC_REND
                       ,
                       output_frame
#endif
    );

    /* MCT reconstruction and CoreCoder updates */
    for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ )
@@ -178,7 +190,12 @@ ivas_error ivas_mct_dec(
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
            x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0];
#ifdef FLOAT_INTERFACE_DEC_REND
            /* TODO(sgi): Consult with MCT expert */
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
#else
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
#endif
        }

        ivas_mdct_core_tns_ns( hCPE, hMCT->LFE_off, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 );
@@ -198,7 +215,12 @@ ivas_error ivas_mct_dec(
            for ( n = 0; n < CPE_CHANNELS; n++ )
            {
                x_all[n + cpe_id * CPE_CHANNELS][0] = &output[n + cpe_id * CPE_CHANNELS][0];
#ifdef FLOAT_INTERFACE_DEC_REND
                /* TODO(sgi): Consult with MCT expert */
                x_all[n + cpe_id * CPE_CHANNELS][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
#else
                x_all[n + cpe_id * CPE_CHANNELS][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
#endif
            }
        }

@@ -213,7 +235,12 @@ ivas_error ivas_mct_dec(
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
            x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0];
#ifdef FLOAT_INTERFACE_DEC_REND
            /* TODO(sgi): Consult with MCT expert */
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
#else
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
#endif
        }

        ivas_mdct_core_reconstruct( hCPE, x, synth, hMCT->LFE_off, fUseTns[cpe_id], 1 );