Loading lib_com/options.h +3 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -157,6 +157,8 @@ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ #define SRAM_REDUCTION_BINRENDERER /* reduction of static RAM usage in fastconv binaural renderer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif lib_dec/ivas_binauralRenderer.c +167 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,89 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } #ifdef SRAM_REDUCTION_BINRENDERER /* allocate memory for filter states */ if ( ( hBinRenConvModule->filterTapsLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsLeftImag = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightImag = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( int16_t i = 0; i < hBinRenderer->conv_band; i++ ) { if ( ( hBinRenConvModule->filterTapsLeftReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsLeftImag[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightImag[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } } if ( ( hBinRenConvModule->filterStatesLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( int16_t i = 0; i < hBinRenderer->conv_band; i++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( int16_t j = 0; j < hBinRenderer->nInChannels; j++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal[i][j] = (float *) count_malloc( hBinRenConvModule->numTaps * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag[i][j] = (float *) count_malloc( hBinRenConvModule->numTaps * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } } } #endif /* set memories */ for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) Loading Loading @@ -560,6 +643,86 @@ ivas_error ivas_binRenderer_open( return error; } #ifdef SRAM_REDUCTION_BINRENDERER /*------------------------------------------------------------------------- * ivas_binRenderer_convModuleClose() * * Close convolution module handle of fastconv binaural renderer *------------------------------------------------------------------------*/ static void ivas_binRenderer_convModuleClose( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { int16_t i, j; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; if ( hBinRenConvModule == NULL ) { return; } for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ ) { count_free( (float **) hBinRenConvModule->filterTapsLeftReal[i] ); hBinRenConvModule->filterTapsLeftReal[i] = NULL; count_free( (float **) hBinRenConvModule->filterTapsLeftImag[i] ); hBinRenConvModule->filterTapsLeftImag[i] = NULL; count_free( (float **) hBinRenConvModule->filterTapsRightReal[i] ); hBinRenConvModule->filterTapsRightReal[i] = NULL; count_free( (float **) hBinRenConvModule->filterTapsRightImag[i] ); hBinRenConvModule->filterTapsRightImag[i] = NULL; } count_free( (float *) hBinRenConvModule->filterTapsLeftReal ); hBinRenConvModule->filterTapsLeftReal = NULL; count_free( (float *) hBinRenConvModule->filterTapsLeftImag ); hBinRenConvModule->filterTapsLeftImag = NULL; count_free( (float *) hBinRenConvModule->filterTapsRightReal ); hBinRenConvModule->filterTapsRightReal = NULL; count_free( (float *) hBinRenConvModule->filterTapsRightImag ); hBinRenConvModule->filterTapsRightImag = NULL; for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ ) { for ( j = 0; j < ( *hBinRenderer )->nInChannels; j++ ) { count_free( hBinRenConvModule->filterStatesLeftReal[i][j] ); hBinRenConvModule->filterStatesLeftReal[i][j] = NULL; count_free( hBinRenConvModule->filterStatesLeftImag[i][j] ); hBinRenConvModule->filterStatesLeftImag[i][j] = NULL; } count_free( hBinRenConvModule->filterStatesLeftReal[i] ); hBinRenConvModule->filterStatesLeftReal[i] = NULL; count_free( hBinRenConvModule->filterStatesLeftImag[i] ); hBinRenConvModule->filterStatesLeftImag[i] = NULL; } count_free( hBinRenConvModule->filterStatesLeftReal ); hBinRenConvModule->filterStatesLeftReal = NULL; count_free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; count_free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; return; } #endif /*------------------------------------------------------------------------- * ivas_binRenderer_close() Loading @@ -578,8 +741,12 @@ void ivas_binRenderer_close( if ( ( *hBinRenderer )->hBinRenConvModule != NULL ) { #ifdef SRAM_REDUCTION_BINRENDERER ivas_binRenderer_convModuleClose( hBinRenderer ); #else count_free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; #endif } if ( ( *hBinRenderer )->hReverb != NULL ) Loading lib_dec/ivas_stat_dec.h +12 −0 Original line number Diff line number Diff line Loading @@ -1303,13 +1303,25 @@ typedef struct ivas_dirac_dec_binaural_data_structure typedef struct ivas_binaural_rendering_conv_module_struct { #ifdef SRAM_REDUCTION_BINRENDERER const float ***filterTapsLeftReal; const float ***filterTapsLeftImag; const float ***filterTapsRightReal; const float ***filterTapsRightImag; #else const float *filterTapsLeftReal[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; const float *filterTapsLeftImag[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; const float *filterTapsRightReal[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; const float *filterTapsRightImag[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; #endif #ifdef SRAM_REDUCTION_BINRENDERER float ***filterStatesLeftReal; float ***filterStatesLeftImag; #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; Loading Loading
lib_com/options.h +3 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -157,6 +157,8 @@ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ #define SRAM_REDUCTION_BINRENDERER /* reduction of static RAM usage in fastconv binaural renderer */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif
lib_dec/ivas_binauralRenderer.c +167 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,89 @@ static ivas_error ivas_binRenderer_convModuleOpen( } } #ifdef SRAM_REDUCTION_BINRENDERER /* allocate memory for filter states */ if ( ( hBinRenConvModule->filterTapsLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsLeftImag = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightImag = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( int16_t i = 0; i < hBinRenderer->conv_band; i++ ) { if ( ( hBinRenConvModule->filterTapsLeftReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsLeftImag[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterTapsRightImag[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } } if ( ( hBinRenConvModule->filterStatesLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( int16_t i = 0; i < hBinRenderer->conv_band; i++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } for ( int16_t j = 0; j < hBinRenderer->nInChannels; j++ ) { if ( ( hBinRenConvModule->filterStatesLeftReal[i][j] = (float *) count_malloc( hBinRenConvModule->numTaps * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } if ( ( hBinRenConvModule->filterStatesLeftImag[i][j] = (float *) count_malloc( hBinRenConvModule->numTaps * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) ); } } } #endif /* set memories */ for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) Loading Loading @@ -560,6 +643,86 @@ ivas_error ivas_binRenderer_open( return error; } #ifdef SRAM_REDUCTION_BINRENDERER /*------------------------------------------------------------------------- * ivas_binRenderer_convModuleClose() * * Close convolution module handle of fastconv binaural renderer *------------------------------------------------------------------------*/ static void ivas_binRenderer_convModuleClose( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { int16_t i, j; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; if ( hBinRenConvModule == NULL ) { return; } for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ ) { count_free( (float **) hBinRenConvModule->filterTapsLeftReal[i] ); hBinRenConvModule->filterTapsLeftReal[i] = NULL; count_free( (float **) hBinRenConvModule->filterTapsLeftImag[i] ); hBinRenConvModule->filterTapsLeftImag[i] = NULL; count_free( (float **) hBinRenConvModule->filterTapsRightReal[i] ); hBinRenConvModule->filterTapsRightReal[i] = NULL; count_free( (float **) hBinRenConvModule->filterTapsRightImag[i] ); hBinRenConvModule->filterTapsRightImag[i] = NULL; } count_free( (float *) hBinRenConvModule->filterTapsLeftReal ); hBinRenConvModule->filterTapsLeftReal = NULL; count_free( (float *) hBinRenConvModule->filterTapsLeftImag ); hBinRenConvModule->filterTapsLeftImag = NULL; count_free( (float *) hBinRenConvModule->filterTapsRightReal ); hBinRenConvModule->filterTapsRightReal = NULL; count_free( (float *) hBinRenConvModule->filterTapsRightImag ); hBinRenConvModule->filterTapsRightImag = NULL; for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ ) { for ( j = 0; j < ( *hBinRenderer )->nInChannels; j++ ) { count_free( hBinRenConvModule->filterStatesLeftReal[i][j] ); hBinRenConvModule->filterStatesLeftReal[i][j] = NULL; count_free( hBinRenConvModule->filterStatesLeftImag[i][j] ); hBinRenConvModule->filterStatesLeftImag[i][j] = NULL; } count_free( hBinRenConvModule->filterStatesLeftReal[i] ); hBinRenConvModule->filterStatesLeftReal[i] = NULL; count_free( hBinRenConvModule->filterStatesLeftImag[i] ); hBinRenConvModule->filterStatesLeftImag[i] = NULL; } count_free( hBinRenConvModule->filterStatesLeftReal ); hBinRenConvModule->filterStatesLeftReal = NULL; count_free( hBinRenConvModule->filterStatesLeftImag ); hBinRenConvModule->filterStatesLeftImag = NULL; count_free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; return; } #endif /*------------------------------------------------------------------------- * ivas_binRenderer_close() Loading @@ -578,8 +741,12 @@ void ivas_binRenderer_close( if ( ( *hBinRenderer )->hBinRenConvModule != NULL ) { #ifdef SRAM_REDUCTION_BINRENDERER ivas_binRenderer_convModuleClose( hBinRenderer ); #else count_free( ( *hBinRenderer )->hBinRenConvModule ); ( *hBinRenderer )->hBinRenConvModule = NULL; #endif } if ( ( *hBinRenderer )->hReverb != NULL ) Loading
lib_dec/ivas_stat_dec.h +12 −0 Original line number Diff line number Diff line Loading @@ -1303,13 +1303,25 @@ typedef struct ivas_dirac_dec_binaural_data_structure typedef struct ivas_binaural_rendering_conv_module_struct { #ifdef SRAM_REDUCTION_BINRENDERER const float ***filterTapsLeftReal; const float ***filterTapsLeftImag; const float ***filterTapsRightReal; const float ***filterTapsRightImag; #else const float *filterTapsLeftReal[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; const float *filterTapsLeftImag[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; const float *filterTapsRightReal[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; const float *filterTapsRightImag[CLDFB_NO_CHANNELS_MAX][MAX_OUTPUT_CHANNELS]; #endif #ifdef SRAM_REDUCTION_BINRENDERER float ***filterStatesLeftReal; float ***filterStatesLeftImag; #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; Loading