Commit c819a768 authored by vaclav's avatar vaclav
Browse files

memory saving in evs_dec_main()

parent 85a15d4d
Loading
Loading
Loading
Loading
+34 −5
Original line number Diff line number Diff line
@@ -1147,7 +1147,7 @@ ivas_error IVAS_DEC_GetSamples(
                nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels;
#endif

                /* IVAS renderer  */
                /* Feed decoded transport channels samples to the renderer */
                if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK )
                {
                    return error;
@@ -1166,7 +1166,6 @@ ivas_error IVAS_DEC_GetSamples(

            /* render IVAS frames directly to the output buffer */
            nSamplesToRender = nSamplesAsked - nSamplesRendered;

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK )
#else
@@ -1507,7 +1506,7 @@ static ivas_error IVAS_DEC_GetTcSamples(
/*---------------------------------------------------------------------*
 * IVAS_DEC_Rendered_FeedTcSamples( )
 *
 * Main function to decode to PCM data of the transport channels
 * Feed decoded transport channels samples to the renderer
 *---------------------------------------------------------------------*/

static ivas_error IVAS_DEC_RendererFeedTcSamples(
@@ -1536,7 +1535,7 @@ static ivas_error IVAS_DEC_RendererFeedTcSamples(
/*---------------------------------------------------------------------*
 * IVAS_DEC_GetRenderedSamples( )
 *
 * Main function to render the transport channels to PCM output datat
 * Main function to render the transport channels to PCM output data
 *---------------------------------------------------------------------*/

static ivas_error IVAS_DEC_GetRenderedSamples(
@@ -2801,7 +2800,6 @@ ivas_error IVAS_DEC_Flush(
    nSamplesToRender = (uint16_t) *nSamplesFlushed;

    /* render IVAS frames  */

#ifdef SPLIT_REND_WITH_HEAD_ROT
    error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf );
#else
@@ -3359,7 +3357,9 @@ static ivas_error evs_dec_main(
    int16_t *pcmBuf )
{
    DEC_CORE_HANDLE *hCoreCoder;
#ifndef NONBE_UNIFIED_DECODING_PATHS_FIX
    float output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN][L_FRAME48k];
#endif
    float mixer_left, mixer_rigth;
    float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN];
    int16_t ch;
@@ -3372,7 +3372,11 @@ static ivas_error evs_dec_main(

    for ( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ )
    {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
        p_output[ch] = st_ivas->p_output_f[ch];
#else
        p_output[ch] = output[ch];
#endif
    }

    /* run the main EVS decoding routine */
@@ -3380,14 +3384,22 @@ static ivas_error evs_dec_main(
    {
        if ( hCoreCoder[0]->Opt_AMR_WB )
        {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
            if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0] ) ) != IVAS_ERR_OK )
#else
            if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0] ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
        }
        else
        {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK )
#else
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -3397,21 +3409,33 @@ static ivas_error evs_dec_main(
    {
        if ( hCoreCoder[0]->bfi == 0 )
        {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK )
#else
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
        }
        else if ( hCoreCoder[0]->bfi == 2 )
        {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK )
#else
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
        }
        else
        {
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK )
#else
            if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -3424,8 +3448,13 @@ static ivas_error evs_dec_main(
    {
        mixer_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f;
        mixer_rigth = 1.f - mixer_left;
#ifdef NONBE_UNIFIED_DECODING_PATHS_FIX
        v_multc( p_output[0], mixer_rigth, p_output[1], nOutSamples );
        v_multc( p_output[0], mixer_left, p_output[0], nOutSamples );
#else
        v_multc( output[0], mixer_rigth, output[1], nOutSamples );
        v_multc( output[0], mixer_left, output[0], nOutSamples );
#endif
    }

#ifndef NONBE_UNIFIED_DECODING_PATHS