Loading lib_com/ivas_prot.h +13 −2 Original line number Diff line number Diff line Loading @@ -3240,12 +3240,23 @@ void ivas_dirac_dec_binaural( const int16_t nchan_transport /* i : number of transport channels */ ); #ifdef SRAM_REDUCTION_BINRENDERER_ROOM ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame /* i : number of CLDFB slots per frame, i.e., reverberator block size */ const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type /* i : renderer type */ ); #else ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame /* i : number of CLDFB slots per frame */ ); #endif void ivas_binaural_reverb_close( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ); Loading lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ #define DRAM_REDUCTION_MCT_IGF /* Issue 121: reduce dynamic RAM consumption in MCT IGF */ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ #define SRAM_REDUCTION_BINRENDERER /* Issue 145: reduction of static RAM usage in fastconv binaural renderer */ #define SRAM_REDUCTION_BINRENDERER_ROOM /* Issue 145: reduction of static RAM usage in fastconv binaural room renderer */ /* ################## End DEVELOPMENT switches ######################### */ Loading lib_dec/ivas_binauralRenderer.c +14 −0 Original line number Diff line number Diff line Loading @@ -378,6 +378,9 @@ static void ivas_binaural_obtain_DMX( { int16_t chIdx, bandIdx, k; #ifdef SRAM_REDUCTION_BINRENDERER_ROOM // ToDo: hBinRenderer->ivas_format is never set to ISM_FORMAT -> TBV #endif if ( hBinRenderer->ivas_format == MC_FORMAT || hBinRenderer->ivas_format == ISM_FORMAT ) { /* Obtain the downmix */ Loading Loading @@ -493,8 +496,10 @@ ivas_error ivas_binRenderer_open( { BINAURAL_RENDERER_HANDLE hBinRenderer; int16_t convBand, chIdx, k; #ifndef SRAM_REDUCTION_BINRENDERER_ROOM float t60[CLDFB_NO_CHANNELS_MAX]; float ene[CLDFB_NO_CHANNELS_MAX]; #endif ivas_error error; error = IVAS_ERR_OK; Loading Loading @@ -588,10 +593,17 @@ ivas_error ivas_binRenderer_open( /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { #ifdef SRAM_REDUCTION_BINRENDERER_ROOM if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV_ROOM ) ) != IVAS_ERR_OK ) { return error; } #else if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots ) ) != IVAS_ERR_OK ) { return error; } if ( !st_ivas->hRenderConfig->roomAcoustics.override ) { ivas_binaural_reverb_setReverbTimes( hBinRenderer->hReverb, st_ivas->hDecoderConfig->output_Fs, fastconvReverberationTimes, fastconvReverberationEneCorrections ); Loading @@ -605,6 +617,8 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hReverb->useBinauralCoherence = 1; #endif /* initialize the dmx matrix */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { Loading lib_dec/ivas_binaural_reverb.c +144 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ #include "ivas_prot.h" #include "prot.h" #include "ivas_rom_com.h" #ifdef SRAM_REDUCTION_BINRENDERER_ROOM #include "ivas_rom_binauralRenderer.h" #endif #ifdef DEBUGGING #include "debug.h" #endif Loading Loading @@ -312,12 +315,13 @@ void ivas_binaural_reverb_setReverbTimes( } hReverb->binauralCoherenceDirectGains[bin] = sqrtf( 1.0f - fabsf( tmpVal ) ); #ifndef SRAM_REDUCTION_BINRENDERER_ROOM /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long * but not excessively long loops to generate reverberation. */ /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); #endif /* Determine attenuation factor that generates the appropriate energy decay according to reverberation time */ attenuationFactorPerSample = powf( 10.0f, -3.0f * ( 1.0f / ( (float) CLDFB_SLOTS_PER_SECOND * revTimes[bin] ) ) ); hReverb->loopAttenuationFactor[bin] = powf( attenuationFactorPerSample, hReverb->loopBufLength[bin] ); Loading Loading @@ -371,6 +375,144 @@ void ivas_binaural_reverb_setReverbTimes( * Allocate and initialize binaural room reverberator handle *------------------------------------------------------------------------*/ #ifdef SRAM_REDUCTION_BINRENDERER_ROOM ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type /* i : renderer type */ ) { int16_t bin, chIdx, k, len; REVERB_STRUCT_HANDLE hReverb; const float *revTimes; float t60[CLDFB_NO_CHANNELS_MAX]; float ene[CLDFB_NO_CHANNELS_MAX]; if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) count_malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } hReverb = *hReverbPr; hReverb->useBinauralCoherence = 1; hReverb->preDelayBufferLength = 1; hReverb->preDelayBufferIndex = 0; hReverb->numBins = numBins; hReverb->blockSize = numCldfbSlotsPerFrame; for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) { set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); } if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { if ( !roomAcoustics->override ) { revTimes = fastconvReverberationTimes; } else { revTimes = (float *) sampling_rate; } } else { revTimes = parametricReverberationTimes; } for ( bin = 0; bin < hReverb->numBins; bin++ ) { /* Loop Buffer */ hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; if ( ( hReverb->loopBufReal[bin] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } if ( ( hReverb->loopBufImag[bin] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_f( hReverb->loopBufReal[bin], 0.0f, len ); set_f( hReverb->loopBufImag[bin], 0.0f, len ); /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long * but not excessively long loops to generate reverberation. */ /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); /* Sparse Filter Tap Locations */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { len = hReverb->loopBufLength[bin]; if ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (int16_t *) count_malloc( len * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_s( hReverb->tapPhaseShiftType[bin][chIdx], 0, len ); if ( ( hReverb->tapPointersReal[bin][chIdx] = (float **) count_malloc( len * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } if ( ( hReverb->tapPointersImag[bin][chIdx] = (float **) count_malloc( len * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } len = hReverb->blockSize; if ( ( hReverb->outputBufferReal[bin][chIdx] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } if ( ( hReverb->outputBufferImag[bin][chIdx] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_f( hReverb->outputBufferReal[bin][chIdx], 0.0f, len ); set_f( hReverb->outputBufferImag[bin][chIdx], 0.0f, len ); } } if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { if ( !roomAcoustics->override ) { ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, fastconvReverberationTimes, fastconvReverberationEneCorrections ); ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } else { ivas_reverb_prepare_cldfb_params( roomAcoustics, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); } } else { ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, parametricReverberationTimes, parametricReverberationEneCorrections ); ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } return IVAS_ERR_OK; } #else ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ Loading Loading @@ -459,7 +601,7 @@ ivas_error ivas_binaural_reverb_open( return IVAS_ERR_OK; } #endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_close() Loading lib_dec/ivas_dirac_dec_binaural_functions.c +18 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,22 @@ ivas_error ivas_dirac_dec_init_binaural_data( else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { mvr2r( parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); #ifdef SRAM_REDUCTION_BINRENDERER_ROOM if ( hBinaural->useSubframeMode ) { if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) { return error; } } else { if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) { return error; } } #else if ( hBinaural->useSubframeMode ) { if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK ) Loading @@ -202,9 +218,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } } ivas_binaural_reverb_setReverbTimes( hBinaural->hReverb, output_Fs, parametricReverberationTimes, parametricReverberationEneCorrections ); hBinaural->hReverb->useBinauralCoherence = 1; ivas_binaural_reverb_setPreDelay( hBinaural->hReverb, 10 ); #endif } else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) { Loading Loading
lib_com/ivas_prot.h +13 −2 Original line number Diff line number Diff line Loading @@ -3240,12 +3240,23 @@ void ivas_dirac_dec_binaural( const int16_t nchan_transport /* i : number of transport channels */ ); #ifdef SRAM_REDUCTION_BINRENDERER_ROOM ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame /* i : number of CLDFB slots per frame, i.e., reverberator block size */ const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type /* i : renderer type */ ); #else ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame /* i : number of CLDFB slots per frame */ ); #endif void ivas_binaural_reverb_close( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ); Loading
lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ #define DRAM_REDUCTION_MCT_IGF /* Issue 121: reduce dynamic RAM consumption in MCT IGF */ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ #define SRAM_REDUCTION_BINRENDERER /* Issue 145: reduction of static RAM usage in fastconv binaural renderer */ #define SRAM_REDUCTION_BINRENDERER_ROOM /* Issue 145: reduction of static RAM usage in fastconv binaural room renderer */ /* ################## End DEVELOPMENT switches ######################### */ Loading
lib_dec/ivas_binauralRenderer.c +14 −0 Original line number Diff line number Diff line Loading @@ -378,6 +378,9 @@ static void ivas_binaural_obtain_DMX( { int16_t chIdx, bandIdx, k; #ifdef SRAM_REDUCTION_BINRENDERER_ROOM // ToDo: hBinRenderer->ivas_format is never set to ISM_FORMAT -> TBV #endif if ( hBinRenderer->ivas_format == MC_FORMAT || hBinRenderer->ivas_format == ISM_FORMAT ) { /* Obtain the downmix */ Loading Loading @@ -493,8 +496,10 @@ ivas_error ivas_binRenderer_open( { BINAURAL_RENDERER_HANDLE hBinRenderer; int16_t convBand, chIdx, k; #ifndef SRAM_REDUCTION_BINRENDERER_ROOM float t60[CLDFB_NO_CHANNELS_MAX]; float ene[CLDFB_NO_CHANNELS_MAX]; #endif ivas_error error; error = IVAS_ERR_OK; Loading Loading @@ -588,10 +593,17 @@ ivas_error ivas_binRenderer_open( /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { #ifdef SRAM_REDUCTION_BINRENDERER_ROOM if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV_ROOM ) ) != IVAS_ERR_OK ) { return error; } #else if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots ) ) != IVAS_ERR_OK ) { return error; } if ( !st_ivas->hRenderConfig->roomAcoustics.override ) { ivas_binaural_reverb_setReverbTimes( hBinRenderer->hReverb, st_ivas->hDecoderConfig->output_Fs, fastconvReverberationTimes, fastconvReverberationEneCorrections ); Loading @@ -605,6 +617,8 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hReverb->useBinauralCoherence = 1; #endif /* initialize the dmx matrix */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { Loading
lib_dec/ivas_binaural_reverb.c +144 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ #include "ivas_prot.h" #include "prot.h" #include "ivas_rom_com.h" #ifdef SRAM_REDUCTION_BINRENDERER_ROOM #include "ivas_rom_binauralRenderer.h" #endif #ifdef DEBUGGING #include "debug.h" #endif Loading Loading @@ -312,12 +315,13 @@ void ivas_binaural_reverb_setReverbTimes( } hReverb->binauralCoherenceDirectGains[bin] = sqrtf( 1.0f - fabsf( tmpVal ) ); #ifndef SRAM_REDUCTION_BINRENDERER_ROOM /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long * but not excessively long loops to generate reverberation. */ /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); #endif /* Determine attenuation factor that generates the appropriate energy decay according to reverberation time */ attenuationFactorPerSample = powf( 10.0f, -3.0f * ( 1.0f / ( (float) CLDFB_SLOTS_PER_SECOND * revTimes[bin] ) ) ); hReverb->loopAttenuationFactor[bin] = powf( attenuationFactorPerSample, hReverb->loopBufLength[bin] ); Loading Loading @@ -371,6 +375,144 @@ void ivas_binaural_reverb_setReverbTimes( * Allocate and initialize binaural room reverberator handle *------------------------------------------------------------------------*/ #ifdef SRAM_REDUCTION_BINRENDERER_ROOM ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type /* i : renderer type */ ) { int16_t bin, chIdx, k, len; REVERB_STRUCT_HANDLE hReverb; const float *revTimes; float t60[CLDFB_NO_CHANNELS_MAX]; float ene[CLDFB_NO_CHANNELS_MAX]; if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) count_malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } hReverb = *hReverbPr; hReverb->useBinauralCoherence = 1; hReverb->preDelayBufferLength = 1; hReverb->preDelayBufferIndex = 0; hReverb->numBins = numBins; hReverb->blockSize = numCldfbSlotsPerFrame; for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) { set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); } if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { if ( !roomAcoustics->override ) { revTimes = fastconvReverberationTimes; } else { revTimes = (float *) sampling_rate; } } else { revTimes = parametricReverberationTimes; } for ( bin = 0; bin < hReverb->numBins; bin++ ) { /* Loop Buffer */ hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; if ( ( hReverb->loopBufReal[bin] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } if ( ( hReverb->loopBufImag[bin] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_f( hReverb->loopBufReal[bin], 0.0f, len ); set_f( hReverb->loopBufImag[bin], 0.0f, len ); /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long * but not excessively long loops to generate reverberation. */ /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); /* Sparse Filter Tap Locations */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { len = hReverb->loopBufLength[bin]; if ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (int16_t *) count_malloc( len * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_s( hReverb->tapPhaseShiftType[bin][chIdx], 0, len ); if ( ( hReverb->tapPointersReal[bin][chIdx] = (float **) count_malloc( len * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } if ( ( hReverb->tapPointersImag[bin][chIdx] = (float **) count_malloc( len * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } len = hReverb->blockSize; if ( ( hReverb->outputBufferReal[bin][chIdx] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } if ( ( hReverb->outputBufferImag[bin][chIdx] = (float *) count_malloc( len * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); } set_f( hReverb->outputBufferReal[bin][chIdx], 0.0f, len ); set_f( hReverb->outputBufferImag[bin][chIdx], 0.0f, len ); } } if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { if ( !roomAcoustics->override ) { ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, fastconvReverberationTimes, fastconvReverberationEneCorrections ); ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } else { ivas_reverb_prepare_cldfb_params( roomAcoustics, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); } } else { ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, parametricReverberationTimes, parametricReverberationEneCorrections ); ivas_binaural_reverb_setPreDelay( hReverb, 10 ); } return IVAS_ERR_OK; } #else ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ Loading Loading @@ -459,7 +601,7 @@ ivas_error ivas_binaural_reverb_open( return IVAS_ERR_OK; } #endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_close() Loading
lib_dec/ivas_dirac_dec_binaural_functions.c +18 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,22 @@ ivas_error ivas_dirac_dec_init_binaural_data( else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { mvr2r( parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); #ifdef SRAM_REDUCTION_BINRENDERER_ROOM if ( hBinaural->useSubframeMode ) { if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) { return error; } } else { if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) { return error; } } #else if ( hBinaural->useSubframeMode ) { if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK ) Loading @@ -202,9 +218,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } } ivas_binaural_reverb_setReverbTimes( hBinaural->hReverb, output_Fs, parametricReverberationTimes, parametricReverberationEneCorrections ); hBinaural->hReverb->useBinauralCoherence = 1; ivas_binaural_reverb_setPreDelay( hBinaural->hReverb, 10 ); #endif } else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) { Loading