Loading lib_dec/ivas_binauralRenderer.c +152 −18 Original line number Diff line number Diff line Loading @@ -187,16 +187,80 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #ifdef SRAM_REDUCTION_BINRENDERER for ( int16_t i = 0; i < BINAURAL_CONVBANDS; i++ ) /* allocate memory for filter states */ if ( ( hBinRenConvModule->filterTapsLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { for ( int16_t j = 0; j < MAX_OUTPUT_CHANNELS; j++ ) 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( sizeof( float ) * hBinRenConvModule->numTaps ) ) == NULL ) 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( sizeof( float ) * hBinRenConvModule->numTaps ) ) == NULL ) 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" ) ); } Loading @@ -204,6 +268,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #endif /* set memories */ for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) Loading Loading @@ -578,41 +643,110 @@ ivas_error ivas_binRenderer_open( return error; } #ifdef SRAM_REDUCTION_BINRENDERER /*------------------------------------------------------------------------- * ivas_binRenderer_close() * ivas_binRenderer_convModuleClose() * * Close fastconv binaural renderer memories * Close convolution module handle of fastconv binaural renderer *------------------------------------------------------------------------*/ void ivas_binRenderer_close( static void ivas_binRenderer_convModuleClose( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { if ( hBinRenderer == NULL || *hBinRenderer == NULL ) int16_t i, j; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; if ( hBinRenConvModule == NULL ) { return; } if ( ( *hBinRenderer )->hBinRenConvModule != NULL ) for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ ) { count_free( (float **) hBinRenConvModule->filterTapsLeftReal[i] ); hBinRenConvModule->filterTapsLeftReal[i] = NULL; #ifdef SRAM_REDUCTION_BINRENDERER for ( int16_t i = 0; i < BINAURAL_CONVBANDS; i++ ) 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 ( int16_t j = 0; j < MAX_OUTPUT_CHANNELS; j++ ) for ( j = 0; j < ( *hBinRenderer )->nInChannels; j++ ) { count_free( ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftReal[i][j] ); ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftReal[i][j] = NULL; count_free( hBinRenConvModule->filterStatesLeftReal[i][j] ); hBinRenConvModule->filterStatesLeftReal[i][j] = NULL; count_free( hBinRenConvModule->filterStatesLeftImag[i][j] ); hBinRenConvModule->filterStatesLeftImag[i][j] = NULL; } count_free( ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftImag[i][j] ); ( *hBinRenderer )->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() * * Close fastconv binaural renderer memories *------------------------------------------------------------------------*/ void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { if ( hBinRenderer == NULL || *hBinRenderer == NULL ) { return; } 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 +9 −2 Original line number Diff line number Diff line Loading @@ -1303,14 +1303,21 @@ 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[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS]; float *filterStatesLeftImag[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS]; 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]; Loading Loading
lib_dec/ivas_binauralRenderer.c +152 −18 Original line number Diff line number Diff line Loading @@ -187,16 +187,80 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #ifdef SRAM_REDUCTION_BINRENDERER for ( int16_t i = 0; i < BINAURAL_CONVBANDS; i++ ) /* allocate memory for filter states */ if ( ( hBinRenConvModule->filterTapsLeftReal = (float ***) count_malloc( hBinRenderer->conv_band * sizeof( float ) ) ) == NULL ) { for ( int16_t j = 0; j < MAX_OUTPUT_CHANNELS; j++ ) 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( sizeof( float ) * hBinRenConvModule->numTaps ) ) == NULL ) 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( sizeof( float ) * hBinRenConvModule->numTaps ) ) == NULL ) 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" ) ); } Loading @@ -204,6 +268,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( } #endif /* set memories */ for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) Loading Loading @@ -578,41 +643,110 @@ ivas_error ivas_binRenderer_open( return error; } #ifdef SRAM_REDUCTION_BINRENDERER /*------------------------------------------------------------------------- * ivas_binRenderer_close() * ivas_binRenderer_convModuleClose() * * Close fastconv binaural renderer memories * Close convolution module handle of fastconv binaural renderer *------------------------------------------------------------------------*/ void ivas_binRenderer_close( static void ivas_binRenderer_convModuleClose( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { if ( hBinRenderer == NULL || *hBinRenderer == NULL ) int16_t i, j; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule; if ( hBinRenConvModule == NULL ) { return; } if ( ( *hBinRenderer )->hBinRenConvModule != NULL ) for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ ) { count_free( (float **) hBinRenConvModule->filterTapsLeftReal[i] ); hBinRenConvModule->filterTapsLeftReal[i] = NULL; #ifdef SRAM_REDUCTION_BINRENDERER for ( int16_t i = 0; i < BINAURAL_CONVBANDS; i++ ) 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 ( int16_t j = 0; j < MAX_OUTPUT_CHANNELS; j++ ) for ( j = 0; j < ( *hBinRenderer )->nInChannels; j++ ) { count_free( ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftReal[i][j] ); ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftReal[i][j] = NULL; count_free( hBinRenConvModule->filterStatesLeftReal[i][j] ); hBinRenConvModule->filterStatesLeftReal[i][j] = NULL; count_free( hBinRenConvModule->filterStatesLeftImag[i][j] ); hBinRenConvModule->filterStatesLeftImag[i][j] = NULL; } count_free( ( *hBinRenderer )->hBinRenConvModule->filterStatesLeftImag[i][j] ); ( *hBinRenderer )->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() * * Close fastconv binaural renderer memories *------------------------------------------------------------------------*/ void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { if ( hBinRenderer == NULL || *hBinRenderer == NULL ) { return; } 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 +9 −2 Original line number Diff line number Diff line Loading @@ -1303,14 +1303,21 @@ 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[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS]; float *filterStatesLeftImag[BINAURAL_CONVBANDS][MAX_OUTPUT_CHANNELS]; 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]; Loading