Commit 6192e903 authored by sagnowski's avatar sagnowski
Browse files

Add a temp fix for MCT

parent d379f848
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2906,8 +2906,10 @@ 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                  */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
    float* signal_out[]                                        /* o  : synthesis @internal_FS                  */
#ifndef FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
    ,const int16_t output_frame                                  /* i  : output frame length per channel         */
#endif
#else
    float signal_out[][L_FRAME48k]                              /* o  : synthesis @internal_FS                  */
#endif
+3 −0
Original line number Diff line number Diff line
@@ -169,6 +169,9 @@
#endif

#define FLOAT_INTERFACE_DEC_REND
#ifdef FLOAT_INTERFACE_DEC_REND
#define FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
#endif

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+5 −3
Original line number Diff line number Diff line
@@ -166,8 +166,10 @@ 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      */
    const int16_t output_frame           /* i  : output frame length per channel                         */
    float* signal_out[]                 /* o  : synthesis @internal_FS      */
#ifndef FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
    ,const int16_t output_frame           /* i  : output frame length per channel                         */
#endif
#else
    float signal_out[][L_FRAME48k]       /* o  : synthesis @internal_FS      */
#endif
@@ -222,7 +224,7 @@ 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
#if defined FLOAT_INTERFACE_DEC_REND && !defined FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
        x[ch][1] = &signal_out[ch][0] + output_frame / 2;
#else
        x[ch][1] = &signal_out[ch][0] + L_FRAME48k / 2;
+24 −5
Original line number Diff line number Diff line
@@ -88,6 +88,16 @@ ivas_error ivas_mct_dec(
    float synth[CPE_CHANNELS][L_FRAME_PLUS];
    int32_t ivas_total_brate;
    ivas_error error;
#ifdef FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
    float *outputAlias[MAX_OUTPUT_CHANNELS];
    float tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* TODO(sgi): Optimize RAM usage */

    for ( int16_t i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
    {
        outputAlias[i] = output[i];
        output[i] = tmp[i];
    }
#endif

    error = IVAS_ERR_OK;

@@ -155,7 +165,7 @@ 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
#if defined FLOAT_INTERFACE_DEC_REND && !defined FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
            /* 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 );
@@ -176,7 +186,7 @@ ivas_error ivas_mct_dec(

    /* MCT core decoder */
    ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output
#ifdef FLOAT_INTERFACE_DEC_REND
#if defined FLOAT_INTERFACE_DEC_REND && !defined FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
                       ,
                       output_frame
#endif
@@ -190,7 +200,7 @@ 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
#if defined FLOAT_INTERFACE_DEC_REND && !defined FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
            /* TODO(sgi): Consult with MCT expert */
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
#else
@@ -215,7 +225,7 @@ 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
#if defined FLOAT_INTERFACE_DEC_REND && !defined FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
                /* TODO(sgi): Consult with MCT expert */
                x_all[n + cpe_id * CPE_CHANNELS][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
#else
@@ -235,7 +245,7 @@ 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
#if defined FLOAT_INTERFACE_DEC_REND && !defined FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
            /* TODO(sgi): Consult with MCT expert */
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][output_frame / 2];
#else
@@ -302,6 +312,15 @@ ivas_error ivas_mct_dec(
    }
#endif

#ifdef FLOAT_INTERFACE_DEC_REND_MCT_TMP_FIX
    /* Revert overwritten pointers in output buffer, copy audio from tmp buffer to output */
    for ( int16_t i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
    {
        output[i] = outputAlias[i];
        mvr2r( tmp[i], output[i], output_frame );
    }
#endif

    pop_wmops();
    return error;
}