Commit 2980ce8a authored by vaclav's avatar vaclav
Browse files

more savings for BINAURAL_ROOM output

parent 97438534
Loading
Loading
Loading
Loading
+36 −31
Original line number Diff line number Diff line
@@ -208,24 +208,24 @@ static ivas_error ivas_binRenderer_convModuleOpen(
        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++ )
    for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
    {
        if ( ( hBinRenConvModule->filterTapsLeftReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL )
        if ( ( hBinRenConvModule->filterTapsLeftReal[bandIdx] = (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 )
        if ( ( hBinRenConvModule->filterTapsLeftImag[bandIdx] = (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 )
        if ( ( hBinRenConvModule->filterTapsRightReal[bandIdx] = (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 )
        if ( ( hBinRenConvModule->filterTapsRightImag[bandIdx] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
        }
@@ -241,26 +241,26 @@ static ivas_error ivas_binRenderer_convModuleOpen(
        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++ )
    for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
    {
        if ( ( hBinRenConvModule->filterStatesLeftReal[i] = (float **) count_malloc( hBinRenderer->nInChannels * sizeof( float ) ) ) == NULL )
        if ( ( hBinRenConvModule->filterStatesLeftReal[bandIdx] = (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 )
        if ( ( hBinRenConvModule->filterStatesLeftImag[bandIdx] = (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++ )
        for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
        {
            if ( ( hBinRenConvModule->filterStatesLeftReal[i][j] = (float *) count_malloc( hBinRenConvModule->numTaps * sizeof( float ) ) ) == NULL )
            if ( ( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = (float *) count_malloc( hBinRenConvModule->numTapsArray[bandIdx] * 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 )
            if ( ( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = (float *) count_malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( float ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
            }
@@ -308,8 +308,13 @@ static ivas_error ivas_binRenderer_convModuleOpen(
            if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && hRenderConfig->roomAcoustics.use_brir )
            {
                /* set the memories to zero */
#ifdef SRAM_REDUCTION_BINRENDERER
                set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] );
                set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTapsArray[bandIdx] );
#else
                set_zero( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx], hBinRenConvModule->numTaps );
                set_zero( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx], hBinRenConvModule->numTaps );
#endif

                if ( isLoudspeaker )
                {
@@ -654,7 +659,7 @@ static void ivas_binRenderer_convModuleClose(
    BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: fastconv binaural renderer handle    */
)
{
    int16_t i, j;
    int16_t bandIdx, chIdx;
    BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule;

    hBinRenConvModule = ( *hBinRenderer )->hBinRenConvModule;
@@ -664,19 +669,19 @@ static void ivas_binRenderer_convModuleClose(
        return;
    }

    for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ )
    for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ )
    {
        count_free( hBinRenConvModule->filterTapsLeftReal[i] );
        hBinRenConvModule->filterTapsLeftReal[i] = NULL;
        count_free( hBinRenConvModule->filterTapsLeftReal[bandIdx] );
        hBinRenConvModule->filterTapsLeftReal[bandIdx] = NULL;

        count_free( hBinRenConvModule->filterTapsLeftImag[i] );
        hBinRenConvModule->filterTapsLeftImag[i] = NULL;
        count_free( hBinRenConvModule->filterTapsLeftImag[bandIdx] );
        hBinRenConvModule->filterTapsLeftImag[bandIdx] = NULL;

        count_free( hBinRenConvModule->filterTapsRightReal[i] );
        hBinRenConvModule->filterTapsRightReal[i] = NULL;
        count_free( hBinRenConvModule->filterTapsRightReal[bandIdx] );
        hBinRenConvModule->filterTapsRightReal[bandIdx] = NULL;

        count_free( hBinRenConvModule->filterTapsRightImag[i] );
        hBinRenConvModule->filterTapsRightImag[i] = NULL;
        count_free( hBinRenConvModule->filterTapsRightImag[bandIdx] );
        hBinRenConvModule->filterTapsRightImag[bandIdx] = NULL;
    }

    count_free( hBinRenConvModule->filterTapsLeftReal );
@@ -692,22 +697,22 @@ static void ivas_binRenderer_convModuleClose(
    hBinRenConvModule->filterTapsRightImag = NULL;


    for ( i = 0; i < ( *hBinRenderer )->conv_band; i++ )
    for ( bandIdx = 0; bandIdx < ( *hBinRenderer )->conv_band; bandIdx++ )
    {
        for ( j = 0; j < ( *hBinRenderer )->nInChannels; j++ )
        for ( chIdx = 0; chIdx < ( *hBinRenderer )->nInChannels; chIdx++ )
        {
            count_free( hBinRenConvModule->filterStatesLeftReal[i][j] );
            hBinRenConvModule->filterStatesLeftReal[i][j] = NULL;
            count_free( hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] );
            hBinRenConvModule->filterStatesLeftReal[bandIdx][chIdx] = NULL;

            count_free( hBinRenConvModule->filterStatesLeftImag[i][j] );
            hBinRenConvModule->filterStatesLeftImag[i][j] = NULL;
            count_free( hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] );
            hBinRenConvModule->filterStatesLeftImag[bandIdx][chIdx] = NULL;
        }

        count_free( hBinRenConvModule->filterStatesLeftReal[i] );
        hBinRenConvModule->filterStatesLeftReal[i] = NULL;
        count_free( hBinRenConvModule->filterStatesLeftReal[bandIdx] );
        hBinRenConvModule->filterStatesLeftReal[bandIdx] = NULL;

        count_free( hBinRenConvModule->filterStatesLeftImag[i] );
        hBinRenConvModule->filterStatesLeftImag[i] = NULL;
        count_free( hBinRenConvModule->filterStatesLeftImag[bandIdx] );
        hBinRenConvModule->filterStatesLeftImag[bandIdx] = NULL;
    }

    count_free( hBinRenConvModule->filterStatesLeftReal );