diff --git a/apps/renderer.c b/apps/renderer.c index 9fb5337ed8c92ea22dbd501e824a9914a1d45b6a..c4169bb141a343123b87a6e56728025ba81df180 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -63,6 +63,8 @@ #include #ifdef EXT_RENDERER + +#ifndef FIX_236_RENDERER_BUFFERS #ifndef count_malloc #ifdef RAM_COUNTING_TOOL #define count_malloc( n1 ) MALLOC_FCT_CALL( n1 ) @@ -72,8 +74,9 @@ #define count_malloc( n1 ) malloc( n1 ) #define count_calloc( n1, n2 ) calloc( n1, n2 ) #define count_free( ptr ) free( ptr ) -#endif -#endif +#endif /* RAM_COUNTING_TOOL */ +#endif /* count_malloc */ +#endif /* FIX_236_RENDERER_BUFFERS */ #ifndef min #define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) @@ -843,10 +846,18 @@ int main( inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; + +#ifdef FIX_236_RENDERER_BUFFERS + inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) ); + inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); + outInt16Buffer = malloc( outBufferSize * sizeof( int16_t ) ); + outFloatBuffer = malloc( outBufferSize * sizeof( float ) ); +#else inpInt16Buffer = count_malloc( inBufferSize * sizeof( int16_t ) ); inFloatBuffer = count_malloc( inBufferSize * sizeof( float ) ); outInt16Buffer = count_malloc( outBufferSize * sizeof( int16_t ) ); outFloatBuffer = count_malloc( outBufferSize * sizeof( float ) ); +#endif inBuffer.config.numSamplesPerChannel = (int16_t) frameSize_smpls; inBuffer.config.numChannels = (int16_t) totalNumInChannels; @@ -1092,10 +1103,17 @@ int main( #endif /* === Close === */ +#ifdef FIX_236_RENDERER_BUFFERS + free( inpInt16Buffer ); + free( inFloatBuffer ); + free( outInt16Buffer ); + free( outFloatBuffer ); +#else count_free( inpInt16Buffer ); count_free( inFloatBuffer ); count_free( outInt16Buffer ); count_free( outFloatBuffer ); +#endif for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { MasaFileReader_close( &masaReaders[i] ); @@ -1645,7 +1663,11 @@ IsmPositionProvider *IsmPositionProvider_open( IsmPositionProvider *ipp; uint16_t i; +#ifdef FIX_236_RENDERER_BUFFERS + ipp = (IsmPositionProvider *) malloc( sizeof( IsmPositionProvider ) ); +#else ipp = (IsmPositionProvider *) count_malloc( sizeof( IsmPositionProvider ) ); +#endif ipp->frameCounter = 0; ipp->numObjects = 0; @@ -1762,16 +1784,28 @@ void IsmPositionProvider_close( IsmPositionProvider *positionProvider ) if ( positionProvider->positions[i] != NULL ) { +#ifdef FIX_236_RENDERER_BUFFERS + free( positionProvider->positions[i] ); +#else count_free( positionProvider->positions[i] ); +#endif } if ( positionProvider->positionDurations[i] != NULL ) { +#ifdef FIX_236_RENDERER_BUFFERS + free( positionProvider->positionDurations[i] ); +#else count_free( positionProvider->positionDurations[i] ); +#endif } } +#ifdef FIX_236_RENDERER_BUFFERS + free( positionProvider ); +#else count_free( positionProvider ); +#endif return; } @@ -2020,8 +2054,13 @@ static void parseIsm( if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 ) { positionProvider->numPositions[idx] = numberOfObjectPositionsToRead; + #ifdef FIX_236_RENDERER_BUFFERS + positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); + positionProvider->positionDurations[idx] = malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); + #else positionProvider->positions[idx] = count_malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); positionProvider->positionDurations[idx] = count_malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); + #endif for ( i = 0; i < numberOfObjectPositionsToRead; ++i ) { diff --git a/lib_com/options.h b/lib_com/options.h index b5063ecf3954295412f94ce99af490a76d7883cf..c7aec9e46d2ab390ae066bbe5a36344e212fa451 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,6 +175,7 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ #define NTT_REDUC_COMP_POC /* NTT Contribution 10: Complexity reduction of phase spectrum in stereo downmix*/ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ +#define FIX_236_RENDERER_BUFFERS /* Issue 236: improve consitstency between buffers used in lib_rend w.r.t lib_dec and lib_enc */ #define FIX_ITD_CNG /* Eri: Fix for CNG ITD */