Commit 64965494 authored by vaclav's avatar vaclav
Browse files

reduction of static RAM usage in fastconv binaural renderer; under SRAM_REDUCTION_BINRENDERER

parent ce3c4d6d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@

#ifdef DEBUGGING

/*#define MEM_COUNT_DETAILS*/                   /* RAM counting tool: print per sub-structure details */
#define MEM_COUNT_DETAILS                   /* RAM counting tool: print per sub-structure details */

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
@@ -156,6 +156,8 @@
#define DRAM_REDUCTION_MCT_IGF                          /* Issue 121: reduce dynamic RAM consumption in MCT IGF */


#define SRAM_REDUCTION_BINRENDERER                      /* reduction of static RAM usage in fastconv binaural renderer */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+33 −0
Original line number Diff line number Diff line
@@ -186,6 +186,24 @@ static ivas_error ivas_binRenderer_convModuleOpen(
        }
    }

#ifdef SRAM_REDUCTION_BINRENDERER
    for ( int16_t i = 0; i < BINAURAL_CONVBANDS; i++ )
    {
        for ( int16_t j = 0; j < MAX_OUTPUT_CHANNELS; j++ )
        {
            if ( ( hBinRenConvModule->filterStatesLeftReal[i][j] = (float *) count_malloc( sizeof( float ) * hBinRenConvModule->numTaps ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
            }

            if ( ( hBinRenConvModule->filterStatesLeftImag[i][j] = (float *) count_malloc( sizeof( float ) * hBinRenConvModule->numTaps ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
            }
        }
    }
#endif

    for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
    {
        for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
@@ -578,6 +596,21 @@ void ivas_binRenderer_close(

    if ( ( *hBinRenderer )->hBinRenConvModule != NULL )
    {

#ifdef SRAM_REDUCTION_BINRENDERER
        for ( int16_t i = 0; i < BINAURAL_CONVBANDS; i++ )
        {
            for ( int16_t j = 0; j < MAX_OUTPUT_CHANNELS; j++ )
            {
                count_free( ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftReal[i][j] );
                ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftReal[i][j] = NULL;

                count_free( ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftImag[i][j] );
                ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftImag[i][j] = NULL;
            }
        }
#endif

        count_free( ( *hBinRenderer )->hBinRenConvModule );
        ( *hBinRenderer )->hBinRenConvModule = NULL;
    }
+5 −0
Original line number Diff line number Diff line
@@ -1308,8 +1308,13 @@ typedef struct ivas_binaural_rendering_conv_module_struct
    const float *filterTapsRightReal[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS];
    const float *filterTapsRightImag[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS];

#ifdef SRAM_REDUCTION_BINRENDERER
    float *filterStatesLeftReal[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS];
    float *filterStatesLeftImag[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS];
#else
    float filterStatesLeftReal[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS][BINAURAL_NTAPS_MAX];
    float filterStatesLeftImag[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS][BINAURAL_NTAPS_MAX];
#endif

    int16_t numTapsArray[BINAURAL_CONVBANDS];
    int16_t numTaps;