Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ #define FIX_632_USAN_ERROR_NULL_POINTER /* FhG: issue 632 USAN offset to null pointer proto_diffuse_buffer_f in dirac rendering*/ #define FIX_759_CODE_COVERAGE_OSBA /* VA: issue 759: remove obsolete code in the OSBA encoder */ #define FIX_708_AEID_COMMAND_LINE /* VA: issue 708: improve AEID command-line robustness */ #define FIX_518_ISM_BRIR_EXTREND /* FhG: fix issue #518, cleanup ISM to BINAURAL_ROOM_IR rendering in the external renderer */ /* #################### End BE switches ################################## */ Loading lib_rend/lib_rend.c +227 −31 Original line number Diff line number Diff line Loading @@ -138,6 +138,10 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; #ifdef FIX_518_ISM_BRIR_EXTREND pan_vector prev_pan_gains; int8_t firstFrameRendered; #endif #ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ #endif Loading Loading @@ -1209,6 +1213,15 @@ static IVAS_REND_AudioObjectPosition defaultObjectPosition( return pos; } #ifdef FIX_518_ISM_BRIR_EXTREND static int8_t checkObjectPositionChanged( IVAS_REND_AudioObjectPosition *currentPos, IVAS_REND_AudioObjectPosition *previousPos ) { return !( fabs( currentPos->azimuth - previousPos->azimuth ) < EPSILON && fabs( currentPos->elevation - previousPos->elevation ) < EPSILON ); } #endif static rendering_context getRendCtx( IVAS_REND_HANDLE hIvasRend ) Loading Loading @@ -1341,12 +1354,19 @@ static ivas_error setRendInputActiveIsm( } initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); #ifdef FIX_518_ISM_BRIR_EXTREND inputIsm->firstFrameRendered = FALSE; #endif inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); inputIsm->crendWrapper = NULL; inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); #ifdef FIX_518_ISM_BRIR_EXTREND set_zero( inputIsm->prev_pan_gains, MAX_OUTPUT_CHANNELS ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) Loading Loading @@ -5852,7 +5872,10 @@ static ivas_error renderIsmToBinauralRoom( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { int16_t i; #ifdef FIX_518_ISM_BRIR_EXTREND int16_t position_changed; #endif int16_t i, j; int16_t azi_rot, ele_rot; int16_t subframe_idx; int16_t tmp; Loading @@ -5860,12 +5883,16 @@ static ivas_error renderIsmToBinauralRoom( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; pan_vector currentPanGains; #ifndef FIX_518_ISM_BRIR_EXTREND pan_vector previousPanGains; #endif IVAS_REND_AudioBuffer tmpMcBuffer; #ifdef FIX_518_ISM_BRIR_EXTREND IVAS_REND_AudioObjectPosition rotatedPosPrev; #endif IVAS_REND_AudioObjectPosition rotatedPos; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; int8_t combinedOrientationEnabled; int16_t j; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) Loading @@ -5875,6 +5902,9 @@ static ivas_error renderIsmToBinauralRoom( push_wmops( "renderIsmToBinauralRoom" ); #ifdef FIX_518_ISM_BRIR_EXTREND rotatedPosPrev = defaultObjectPosition(); #endif rotatedPos = defaultObjectPosition(); hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; Loading Loading @@ -5915,6 +5945,7 @@ static ivas_error renderIsmToBinauralRoom( } } #ifndef FIX_518_ISM_BRIR_EXTREND /* TODO tmu : see issue #518 */ /* Possible optimization: less processing needed if position didn't change * needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ Loading @@ -5933,27 +5964,67 @@ static ivas_error renderIsmToBinauralRoom( { return error; } #else /* get previous position */ if ( combinedOrientationEnabled ) { rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); rotatedPosPrev.azimuth = (float) azi_rot; rotatedPosPrev.elevation = (float) ele_rot; } else { rotatedPosPrev.azimuth = ismInput->previousPos.azimuth; rotatedPosPrev.elevation = ismInput->previousPos.elevation; } #endif /* current position gains */ /* get current position */ if ( combinedOrientationEnabled ) { rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); rotatedPos.azimuth = (float) azi_rot; rotatedPos.elevation = (float) ele_rot; } #ifdef FIX_518_ISM_BRIR_EXTREND else { rotatedPos.azimuth = ismInput->currentPos.azimuth; rotatedPos.elevation = ismInput->currentPos.elevation; } position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &rotatedPos, &rotatedPosPrev ); /* set previous gains if this is the first frame */ if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, rotatedPosPrev.azimuth, rotatedPosPrev.elevation, ismInput->prev_pan_gains ) ) != IVAS_ERR_OK ) { return error; } /* compute gains only if position changed */ if ( position_changed ) { #endif if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, #ifdef FIX_518_ISM_BRIR_EXTREND rotatedPos.azimuth, rotatedPos.elevation, #else ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, #endif currentPanGains ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < 3; i++ ) { mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); #ifdef FIX_518_ISM_BRIR_EXTREND } #endif /* intermediate rendering to 7_1_4 */ tmpMcBuffer = ismInput->base.inputBuffer; Loading @@ -5967,10 +6038,31 @@ static ivas_error renderIsmToBinauralRoom( tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, #ifdef FIX_518_ISM_BRIR_EXTREND position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else currentPanGains, previousPanGains, #endif tmpMcBuffer ); copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); /* save gains for next frame */ for ( i = 0; i < 3; i++ ) { mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); } #ifdef FIX_518_ISM_BRIR_EXTREND if ( position_changed ) { mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } #endif /* render 7_1_4 with BRIRs */ if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) Loading Loading @@ -6028,37 +6120,66 @@ static ivas_error renderIsmToBinauralReverb( static ivas_error renderIsmToMc( const input_ism *ismInput, #ifndef FIX_518_ISM_BRIR_EXTREND const #endif input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) { #ifdef FIX_518_ISM_BRIR_EXTREND int8_t position_changed; #endif pan_vector currentPanGains; #ifndef FIX_518_ISM_BRIR_EXTREND pan_vector previousPanGains; #endif ivas_error error; push_wmops( "renderIsmToMc" ); #ifdef FIX_518_ISM_BRIR_EXTREND position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); #else /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ #endif if ( *ismInput->base.ctx.pOutConfig == AUDIO_CONFIG_STEREO ) { if ( ismInput->nonDiegeticPan ) { #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; ismInput->prev_pan_gains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; #else previousPanGains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; previousPanGains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; error = IVAS_ERR_OK; #endif } else { set_zero( currentPanGains, 16 ); set_zero( currentPanGains, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, ¤tPanGains[0], ¤tPanGains[1] ); set_zero( previousPanGains, 16 ); #ifdef FIX_518_ISM_BRIR_EXTREND set_zero( ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &ismInput->prev_pan_gains[0], &ismInput->prev_pan_gains[1] ); #else set_zero( previousPanGains, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &previousPanGains[0], &previousPanGains[1] ); #endif } } else { #ifdef FIX_518_ISM_BRIR_EXTREND /* compute gains only if position changed */ if ( position_changed ) { #endif // TODO tmu review when #215 is resolved if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), Loading @@ -6067,20 +6188,49 @@ static ivas_error renderIsmToMc( { return error; } #ifdef FIX_518_ISM_BRIR_EXTREND } /* set previous gains if this is the first frame */ if ( !ismInput->firstFrameRendered ) { #endif // TODO tmu review when #215 is resolved if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), previousPanGains ) ) != IVAS_ERR_OK ) #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains #else previousPanGains #endif ) ) != IVAS_ERR_OK ) { return error; } #ifdef FIX_518_ISM_BRIR_EXTREND } #endif } /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, #ifdef FIX_518_ISM_BRIR_EXTREND position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else currentPanGains, previousPanGains, #endif outAudio ); #ifdef FIX_518_ISM_BRIR_EXTREND if ( position_changed ) { mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } #endif pop_wmops(); Loading @@ -6089,14 +6239,22 @@ static ivas_error renderIsmToMc( static ivas_error renderIsmToSba( const input_ism *ismInput, #ifndef FIX_518_ISM_BRIR_EXTREND const #endif input_ism *ismInput, const AUDIO_CONFIG outConfig, const IVAS_REND_AudioBuffer outAudio ) { #ifdef FIX_518_ISM_BRIR_EXTREND int8_t position_changed; #endif int16_t ambiOrderOut; int16_t numOutChannels; pan_vector currentPanGains; #ifndef FIX_518_ISM_BRIR_EXTREND pan_vector previousPanGains; #endif ivas_error error; error = IVAS_ERR_OK; Loading @@ -6112,11 +6270,30 @@ static ivas_error renderIsmToSba( return error; } #ifdef FIX_518_ISM_BRIR_EXTREND position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); /* set previous gains if this is the first frame */ if ( !ismInput->firstFrameRendered ) { #endif // TODO tmu review when #215 is resolved ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains, #else previousPanGains, #endif ambiOrderOut ); #ifdef FIX_518_ISM_BRIR_EXTREND } /* compute gains only if position changed */ if ( position_changed ) { #else if ( ( ismInput->currentPos.azimuth == ismInput->previousPos.azimuth ) && ( ismInput->currentPos.elevation == ismInput->previousPos.elevation ) ) Loading @@ -6125,6 +6302,7 @@ static ivas_error renderIsmToSba( } else { #endif // TODO tmu review when #215 is resolved ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ), Loading @@ -6134,8 +6312,22 @@ static ivas_error renderIsmToSba( /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, #ifdef FIX_518_ISM_BRIR_EXTREND position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else currentPanGains, previousPanGains, #endif outAudio ); #ifdef FIX_518_ISM_BRIR_EXTREND if ( position_changed ) { mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } #endif pop_wmops(); return error; Loading Loading @@ -6337,6 +6529,10 @@ static ivas_error renderInputIsm( return error; } #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->firstFrameRendered = TRUE; #endif return error; } Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ #define FIX_632_USAN_ERROR_NULL_POINTER /* FhG: issue 632 USAN offset to null pointer proto_diffuse_buffer_f in dirac rendering*/ #define FIX_759_CODE_COVERAGE_OSBA /* VA: issue 759: remove obsolete code in the OSBA encoder */ #define FIX_708_AEID_COMMAND_LINE /* VA: issue 708: improve AEID command-line robustness */ #define FIX_518_ISM_BRIR_EXTREND /* FhG: fix issue #518, cleanup ISM to BINAURAL_ROOM_IR rendering in the external renderer */ /* #################### End BE switches ################################## */ Loading
lib_rend/lib_rend.c +227 −31 Original line number Diff line number Diff line Loading @@ -138,6 +138,10 @@ typedef struct CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; #ifdef FIX_518_ISM_BRIR_EXTREND pan_vector prev_pan_gains; int8_t firstFrameRendered; #endif #ifdef SPLIT_REND_WITH_HEAD_ROT TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */ #endif Loading Loading @@ -1209,6 +1213,15 @@ static IVAS_REND_AudioObjectPosition defaultObjectPosition( return pos; } #ifdef FIX_518_ISM_BRIR_EXTREND static int8_t checkObjectPositionChanged( IVAS_REND_AudioObjectPosition *currentPos, IVAS_REND_AudioObjectPosition *previousPos ) { return !( fabs( currentPos->azimuth - previousPos->azimuth ) < EPSILON && fabs( currentPos->elevation - previousPos->elevation ) < EPSILON ); } #endif static rendering_context getRendCtx( IVAS_REND_HANDLE hIvasRend ) Loading Loading @@ -1341,12 +1354,19 @@ static ivas_error setRendInputActiveIsm( } initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); #ifdef FIX_518_ISM_BRIR_EXTREND inputIsm->firstFrameRendered = FALSE; #endif inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); inputIsm->crendWrapper = NULL; inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); #ifdef FIX_518_ISM_BRIR_EXTREND set_zero( inputIsm->prev_pan_gains, MAX_OUTPUT_CHANNELS ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) Loading Loading @@ -5852,7 +5872,10 @@ static ivas_error renderIsmToBinauralRoom( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { int16_t i; #ifdef FIX_518_ISM_BRIR_EXTREND int16_t position_changed; #endif int16_t i, j; int16_t azi_rot, ele_rot; int16_t subframe_idx; int16_t tmp; Loading @@ -5860,12 +5883,16 @@ static ivas_error renderIsmToBinauralRoom( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; pan_vector currentPanGains; #ifndef FIX_518_ISM_BRIR_EXTREND pan_vector previousPanGains; #endif IVAS_REND_AudioBuffer tmpMcBuffer; #ifdef FIX_518_ISM_BRIR_EXTREND IVAS_REND_AudioObjectPosition rotatedPosPrev; #endif IVAS_REND_AudioObjectPosition rotatedPos; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; int8_t combinedOrientationEnabled; int16_t j; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) Loading @@ -5875,6 +5902,9 @@ static ivas_error renderIsmToBinauralRoom( push_wmops( "renderIsmToBinauralRoom" ); #ifdef FIX_518_ISM_BRIR_EXTREND rotatedPosPrev = defaultObjectPosition(); #endif rotatedPos = defaultObjectPosition(); hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; Loading Loading @@ -5915,6 +5945,7 @@ static ivas_error renderIsmToBinauralRoom( } } #ifndef FIX_518_ISM_BRIR_EXTREND /* TODO tmu : see issue #518 */ /* Possible optimization: less processing needed if position didn't change * needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ Loading @@ -5933,27 +5964,67 @@ static ivas_error renderIsmToBinauralRoom( { return error; } #else /* get previous position */ if ( combinedOrientationEnabled ) { rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); rotatedPosPrev.azimuth = (float) azi_rot; rotatedPosPrev.elevation = (float) ele_rot; } else { rotatedPosPrev.azimuth = ismInput->previousPos.azimuth; rotatedPosPrev.elevation = ismInput->previousPos.elevation; } #endif /* current position gains */ /* get current position */ if ( combinedOrientationEnabled ) { rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); rotatedPos.azimuth = (float) azi_rot; rotatedPos.elevation = (float) ele_rot; } #ifdef FIX_518_ISM_BRIR_EXTREND else { rotatedPos.azimuth = ismInput->currentPos.azimuth; rotatedPos.elevation = ismInput->currentPos.elevation; } position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &rotatedPos, &rotatedPosPrev ); /* set previous gains if this is the first frame */ if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, rotatedPosPrev.azimuth, rotatedPosPrev.elevation, ismInput->prev_pan_gains ) ) != IVAS_ERR_OK ) { return error; } /* compute gains only if position changed */ if ( position_changed ) { #endif if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, #ifdef FIX_518_ISM_BRIR_EXTREND rotatedPos.azimuth, rotatedPos.elevation, #else ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, #endif currentPanGains ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < 3; i++ ) { mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); #ifdef FIX_518_ISM_BRIR_EXTREND } #endif /* intermediate rendering to 7_1_4 */ tmpMcBuffer = ismInput->base.inputBuffer; Loading @@ -5967,10 +6038,31 @@ static ivas_error renderIsmToBinauralRoom( tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, #ifdef FIX_518_ISM_BRIR_EXTREND position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else currentPanGains, previousPanGains, #endif tmpMcBuffer ); copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); /* save gains for next frame */ for ( i = 0; i < 3; i++ ) { mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); } #ifdef FIX_518_ISM_BRIR_EXTREND if ( position_changed ) { mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } #endif /* render 7_1_4 with BRIRs */ if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) Loading Loading @@ -6028,37 +6120,66 @@ static ivas_error renderIsmToBinauralReverb( static ivas_error renderIsmToMc( const input_ism *ismInput, #ifndef FIX_518_ISM_BRIR_EXTREND const #endif input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) { #ifdef FIX_518_ISM_BRIR_EXTREND int8_t position_changed; #endif pan_vector currentPanGains; #ifndef FIX_518_ISM_BRIR_EXTREND pan_vector previousPanGains; #endif ivas_error error; push_wmops( "renderIsmToMc" ); #ifdef FIX_518_ISM_BRIR_EXTREND position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); #else /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ #endif if ( *ismInput->base.ctx.pOutConfig == AUDIO_CONFIG_STEREO ) { if ( ismInput->nonDiegeticPan ) { #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; ismInput->prev_pan_gains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; #else previousPanGains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; previousPanGains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; error = IVAS_ERR_OK; #endif } else { set_zero( currentPanGains, 16 ); set_zero( currentPanGains, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, ¤tPanGains[0], ¤tPanGains[1] ); set_zero( previousPanGains, 16 ); #ifdef FIX_518_ISM_BRIR_EXTREND set_zero( ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &ismInput->prev_pan_gains[0], &ismInput->prev_pan_gains[1] ); #else set_zero( previousPanGains, MAX_OUTPUT_CHANNELS ); ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &previousPanGains[0], &previousPanGains[1] ); #endif } } else { #ifdef FIX_518_ISM_BRIR_EXTREND /* compute gains only if position changed */ if ( position_changed ) { #endif // TODO tmu review when #215 is resolved if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), Loading @@ -6067,20 +6188,49 @@ static ivas_error renderIsmToMc( { return error; } #ifdef FIX_518_ISM_BRIR_EXTREND } /* set previous gains if this is the first frame */ if ( !ismInput->firstFrameRendered ) { #endif // TODO tmu review when #215 is resolved if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), previousPanGains ) ) != IVAS_ERR_OK ) #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains #else previousPanGains #endif ) ) != IVAS_ERR_OK ) { return error; } #ifdef FIX_518_ISM_BRIR_EXTREND } #endif } /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, #ifdef FIX_518_ISM_BRIR_EXTREND position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else currentPanGains, previousPanGains, #endif outAudio ); #ifdef FIX_518_ISM_BRIR_EXTREND if ( position_changed ) { mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } #endif pop_wmops(); Loading @@ -6089,14 +6239,22 @@ static ivas_error renderIsmToMc( static ivas_error renderIsmToSba( const input_ism *ismInput, #ifndef FIX_518_ISM_BRIR_EXTREND const #endif input_ism *ismInput, const AUDIO_CONFIG outConfig, const IVAS_REND_AudioBuffer outAudio ) { #ifdef FIX_518_ISM_BRIR_EXTREND int8_t position_changed; #endif int16_t ambiOrderOut; int16_t numOutChannels; pan_vector currentPanGains; #ifndef FIX_518_ISM_BRIR_EXTREND pan_vector previousPanGains; #endif ivas_error error; error = IVAS_ERR_OK; Loading @@ -6112,11 +6270,30 @@ static ivas_error renderIsmToSba( return error; } #ifdef FIX_518_ISM_BRIR_EXTREND position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); /* set previous gains if this is the first frame */ if ( !ismInput->firstFrameRendered ) { #endif // TODO tmu review when #215 is resolved ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ), #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains, #else previousPanGains, #endif ambiOrderOut ); #ifdef FIX_518_ISM_BRIR_EXTREND } /* compute gains only if position changed */ if ( position_changed ) { #else if ( ( ismInput->currentPos.azimuth == ismInput->previousPos.azimuth ) && ( ismInput->currentPos.elevation == ismInput->previousPos.elevation ) ) Loading @@ -6125,6 +6302,7 @@ static ivas_error renderIsmToSba( } else { #endif // TODO tmu review when #215 is resolved ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), (int16_t) floorf( ismInput->currentPos.elevation + 0.5f ), Loading @@ -6134,8 +6312,22 @@ static ivas_error renderIsmToSba( /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); renderBufferChannelLerp( ismInput->base.inputBuffer, 0, #ifdef FIX_518_ISM_BRIR_EXTREND position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else currentPanGains, previousPanGains, #endif outAudio ); #ifdef FIX_518_ISM_BRIR_EXTREND if ( position_changed ) { mvr2r( currentPanGains, ismInput->prev_pan_gains, MAX_OUTPUT_CHANNELS ); } #endif pop_wmops(); return error; Loading Loading @@ -6337,6 +6529,10 @@ static ivas_error renderInputIsm( return error; } #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->firstFrameRendered = TRUE; #endif return error; } Loading