Loading apps/decoder.c +27 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,29 @@ int main( fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT uint32_t aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) { IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAE = malloc( aeCount * sizeof( IVAS_ROOM_ACOUSTICS_CONFIG_DATA ) ); uint32_t n; if ( ( error = RenderConfigReader_getAcousticEnvironments( renderConfigReader, &pAE ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error while getting acoustic environments\n\n" ); goto cleanup; } for ( n = 0; n < aeCount; n++ ) { if ( ( error = IVAS_DEC_AddAcousticEnvironment( hIvasDec, pAE[n] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to add acoustic environments\n\n" ); goto cleanup; } } } #endif if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) { Loading Loading @@ -674,7 +697,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { Loading lib_dec/ivas_init_dec.c +4 −0 Original line number Diff line number Diff line Loading @@ -2631,6 +2631,10 @@ void ivas_initialize_handles_dec( st_ivas->hRenderConfig = NULL; st_ivas->hExtOrientationData = NULL; st_ivas->hCombinedOrientationData = NULL; #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT st_ivas->acousticEnvironmentsCount = 0; st_ivas->pAcousticEnvironments = NULL; #endif st_ivas->hSplitBinRend = NULL; for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) Loading lib_dec/ivas_stat_dec.h +4 −0 Original line number Diff line number Diff line Loading @@ -1128,6 +1128,10 @@ typedef struct Decoder_Struct MASA_ISM_DATA_HANDLE hMasaIsmData; /* OMASA rendering handle */ SBA_ISM_DATA_HANDLE hSbaIsmData; /* OSBA rendering handle */ #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcousticEnvironments; /* Acoustic environment array */ uint16_t acousticEnvironmentsCount; /* Number of acoustic environments in the array*/ #endif int16_t flag_omasa_brate; ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; /* ISAR split binaural rendering handle */ Loading lib_dec/lib_dec.c +176 −21 Original line number Diff line number Diff line Loading @@ -3181,6 +3181,138 @@ ivas_error IVAS_DEC_HRTF_binary_close( return IVAS_ERR_OK; } #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT /*---------------------------------------------------------------------* * IVAS_DEC_AddAcousticEnvironment( ) * * Adds acoustic environment configuration *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_AddAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcousticsConfig /* i : Room acoustic configuration */ ) { uint16_t n; Decoder_Struct *st_ivas; IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAE = NULL; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || ( hIvasDec->st_ivas->acousticEnvironmentsCount > 0 && hIvasDec->st_ivas->pAcousticEnvironments == NULL ) ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } st_ivas = hIvasDec->st_ivas; /* Check if already there */ for ( n = 0; n < st_ivas->acousticEnvironmentsCount; n++ ) { if ( st_ivas->pAcousticEnvironments[n].aeID == roomAcousticsConfig.aeID ) { pAE = &st_ivas->pAcousticEnvironments[n]; break; } } /* If not found */ if ( pAE == NULL ) { IVAS_ROOM_ACOUSTICS_CONFIG_DATA *ppAE = realloc( st_ivas->pAcousticEnvironments, ( st_ivas->acousticEnvironmentsCount + 1 ) * sizeof( IVAS_ROOM_ACOUSTICS_CONFIG_DATA ) ); if ( ppAE == NULL ) { return IVAS_ERR_FAILED_ALLOC; } st_ivas->pAcousticEnvironments = ppAE; n = st_ivas->acousticEnvironmentsCount++; pAE = &st_ivas->pAcousticEnvironments[n]; } pAE->aeID = roomAcousticsConfig.aeID; pAE->nBands = roomAcousticsConfig.nBands; pAE->acousticPreDelay = roomAcousticsConfig.acousticPreDelay; pAE->inputPreDelay = roomAcousticsConfig.inputPreDelay; mvr2r( roomAcousticsConfig.pFc_input, pAE->pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( roomAcousticsConfig.pAcoustic_rt60, pAE->pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( roomAcousticsConfig.pAcoustic_dsr, pAE->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); if ( pAE->use_er == 1 ) { pAE->use_er = roomAcousticsConfig.use_er; pAE->lowComplexity = roomAcousticsConfig.lowComplexity; pAE->dimensions = roomAcousticsConfig.dimensions; pAE->ListenerOrigin = roomAcousticsConfig.ListenerOrigin; mvr2r( roomAcousticsConfig.AbsCoeff, pAE->AbsCoeff, IVAS_ROOM_ABS_COEFF ); } return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetAcousticEnvironment( ) * * Gets acoustic environment configuration with a given ID *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t aeID, /* i : Acoustic environment ID */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcEnv /* o : Room acoustic environment data pointer */ ) { uint16_t n, m; uint16_t found = 0; Decoder_Struct *st_ivas; if ( hIvasDec == NULL || pAcEnv == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } st_ivas = hIvasDec->st_ivas; for ( n = 0; n < st_ivas->acousticEnvironmentsCount; n++ ) { IVAS_ROOM_ACOUSTICS_CONFIG_DATA ae = st_ivas->pAcousticEnvironments[n]; if ( aeID == ae.aeID ) { found = 1; pAcEnv->aeID = aeID; pAcEnv->nBands = ae.nBands; pAcEnv->inputPreDelay = ae.inputPreDelay; for ( m = 0; m < pAcEnv->nBands; m++ ) { pAcEnv->pFc_input[m] = ae.pFc_input[m]; pAcEnv->pAcoustic_rt60[m] = ae.pAcoustic_rt60[m]; pAcEnv->pAcoustic_dsr[m] = ae.pAcoustic_dsr[m]; } /* If ER are allocated then propagate parameters */ pAcEnv->use_er = ae.use_er; if ( ae.use_er != 0 ) { pAcEnv->lowComplexity = ae.lowComplexity; pAcEnv->dimensions.x = ae.dimensions.x; pAcEnv->dimensions.y = ae.dimensions.y; pAcEnv->dimensions.z = ae.dimensions.z; pAcEnv->ListenerOrigin.x = ae.ListenerOrigin.x; pAcEnv->ListenerOrigin.y = ae.ListenerOrigin.y; pAcEnv->ListenerOrigin.z = ae.ListenerOrigin.z; for ( m = 0; m < IVAS_ROOM_ABS_COEFF; m++ ) { pAcEnv->AbsCoeff[m] = ae.AbsCoeff[m]; } } } } return found ? IVAS_ERR_OK : IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; } #endif /*---------------------------------------------------------------------* * copyRendererConfigStruct( ) Loading Loading @@ -3434,20 +3566,32 @@ static ivas_error IVAS_DEC_FeedAcousticEnvPI( hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; } #endif hRenderConfig->roomAcoustics.aeID = hAcoustEnvPI.aeid; hRenderConfig->roomAcoustics.nBands = IVAS_PI_AE_NUM_BANDS; hRenderConfig->roomAcoustics.pFc_input[IVAS_PI_AE_LOW] = IVAS_PI_AE_LOW_FREQ; hRenderConfig->roomAcoustics.pFc_input[IVAS_PI_AE_MID] = IVAS_PI_AE_MID_FREQ; hRenderConfig->roomAcoustics.pFc_input[IVAS_PI_AE_HIGH] = IVAS_PI_AE_HIGH_FREQ; hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_LOW] = hAcoustEnvPI.rt60[IVAS_PI_AE_LOW]; hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_MID] = hAcoustEnvPI.rt60[IVAS_PI_AE_MID]; hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_HIGH] = hAcoustEnvPI.rt60[IVAS_PI_AE_HIGH]; hRenderConfig->roomAcoustics.inputPreDelay = (float)(0.1 * hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_MID]); hRenderConfig->roomAcoustics.pAcoustic_dsr[IVAS_PI_AE_LOW] = hAcoustEnvPI.dsr[IVAS_PI_AE_LOW]; hRenderConfig->roomAcoustics.pAcoustic_dsr[IVAS_PI_AE_MID] = hAcoustEnvPI.dsr[IVAS_PI_AE_MID]; hRenderConfig->roomAcoustics.pAcoustic_dsr[IVAS_PI_AE_HIGH] = hAcoustEnvPI.dsr[IVAS_PI_AE_HIGH]; hRenderConfig->roomAcoustics.use_er = hAcoustEnvPI.availEarlyReflections; /* Ignore if AE ID already in use */ if ( hRenderConfig->roomAcoustics.aeID == hAcoustEnvPI.aeid ) { return IVAS_ERR_OK; } /* Attempt to load the one already available */ if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, hAcoustEnvPI.aeid, &hRenderConfig->roomAcoustics ) ) == IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING ) { /* Add the new compact room environment */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA acEnv; acEnv.aeID = hAcoustEnvPI.aeid; acEnv.nBands = IVAS_PI_AE_NUM_BANDS; acEnv.pFc_input[IVAS_PI_AE_LOW] = IVAS_PI_AE_LOW_FREQ; acEnv.pFc_input[IVAS_PI_AE_MID] = IVAS_PI_AE_MID_FREQ; acEnv.pFc_input[IVAS_PI_AE_HIGH] = IVAS_PI_AE_HIGH_FREQ; acEnv.pAcoustic_rt60[IVAS_PI_AE_LOW] = hAcoustEnvPI.rt60[IVAS_PI_AE_LOW]; acEnv.pAcoustic_rt60[IVAS_PI_AE_MID] = hAcoustEnvPI.rt60[IVAS_PI_AE_MID]; acEnv.pAcoustic_rt60[IVAS_PI_AE_HIGH] = hAcoustEnvPI.rt60[IVAS_PI_AE_HIGH]; acEnv.inputPreDelay = (float) ( 0.1 * hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_MID] ); acEnv.pAcoustic_dsr[IVAS_PI_AE_LOW] = hAcoustEnvPI.dsr[IVAS_PI_AE_LOW]; acEnv.pAcoustic_dsr[IVAS_PI_AE_MID] = hAcoustEnvPI.dsr[IVAS_PI_AE_MID]; acEnv.pAcoustic_dsr[IVAS_PI_AE_HIGH] = hAcoustEnvPI.dsr[IVAS_PI_AE_HIGH]; acEnv.use_er = hAcoustEnvPI.availEarlyReflections; if ( hAcoustEnvPI.availEarlyReflections ) { Loading @@ -3457,6 +3601,17 @@ static ivas_error IVAS_DEC_FeedAcousticEnvPI( mvr2r( hAcoustEnvPI.absorbCoeffs, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); } if ( ( error = IVAS_DEC_AddAcousticEnvironment( hIvasDec, acEnv ) ) != IVAS_ERR_OK ) { return error; } if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, hAcoustEnvPI.aeid, &hRenderConfig->roomAcoustics ) ) != IVAS_ERR_OK ) { return error; } } /* Re-initialize reverb instance if already available */ /* TD renderer Jot reverberator */ Loading lib_dec/lib_dec.h +13 −0 Original line number Diff line number Diff line Loading @@ -475,6 +475,19 @@ ivas_error IVAS_DEC_HRTF_binary_close( const IVAS_BIN_RENDERER_TYPE binaural_renderer_old /* i : previous binaural renderer type */ ); #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT ivas_error IVAS_DEC_AddAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcousticsConfig /* i : Room acoustic configuration */ ); ivas_error IVAS_DEC_GetAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t aeID, /* i : Acoustic environment ID */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcEnv /* o : Room acoustic environment data pointer */ ); #endif /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading Loading
apps/decoder.c +27 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,29 @@ int main( fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT uint32_t aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) { IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAE = malloc( aeCount * sizeof( IVAS_ROOM_ACOUSTICS_CONFIG_DATA ) ); uint32_t n; if ( ( error = RenderConfigReader_getAcousticEnvironments( renderConfigReader, &pAE ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error while getting acoustic environments\n\n" ); goto cleanup; } for ( n = 0; n < aeCount; n++ ) { if ( ( error = IVAS_DEC_AddAcousticEnvironment( hIvasDec, pAE[n] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to add acoustic environments\n\n" ); goto cleanup; } } } #endif if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) { Loading Loading @@ -674,7 +697,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { Loading
lib_dec/ivas_init_dec.c +4 −0 Original line number Diff line number Diff line Loading @@ -2631,6 +2631,10 @@ void ivas_initialize_handles_dec( st_ivas->hRenderConfig = NULL; st_ivas->hExtOrientationData = NULL; st_ivas->hCombinedOrientationData = NULL; #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT st_ivas->acousticEnvironmentsCount = 0; st_ivas->pAcousticEnvironments = NULL; #endif st_ivas->hSplitBinRend = NULL; for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) Loading
lib_dec/ivas_stat_dec.h +4 −0 Original line number Diff line number Diff line Loading @@ -1128,6 +1128,10 @@ typedef struct Decoder_Struct MASA_ISM_DATA_HANDLE hMasaIsmData; /* OMASA rendering handle */ SBA_ISM_DATA_HANDLE hSbaIsmData; /* OSBA rendering handle */ #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcousticEnvironments; /* Acoustic environment array */ uint16_t acousticEnvironmentsCount; /* Number of acoustic environments in the array*/ #endif int16_t flag_omasa_brate; ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; /* ISAR split binaural rendering handle */ Loading
lib_dec/lib_dec.c +176 −21 Original line number Diff line number Diff line Loading @@ -3181,6 +3181,138 @@ ivas_error IVAS_DEC_HRTF_binary_close( return IVAS_ERR_OK; } #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT /*---------------------------------------------------------------------* * IVAS_DEC_AddAcousticEnvironment( ) * * Adds acoustic environment configuration *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_AddAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcousticsConfig /* i : Room acoustic configuration */ ) { uint16_t n; Decoder_Struct *st_ivas; IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAE = NULL; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || ( hIvasDec->st_ivas->acousticEnvironmentsCount > 0 && hIvasDec->st_ivas->pAcousticEnvironments == NULL ) ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } st_ivas = hIvasDec->st_ivas; /* Check if already there */ for ( n = 0; n < st_ivas->acousticEnvironmentsCount; n++ ) { if ( st_ivas->pAcousticEnvironments[n].aeID == roomAcousticsConfig.aeID ) { pAE = &st_ivas->pAcousticEnvironments[n]; break; } } /* If not found */ if ( pAE == NULL ) { IVAS_ROOM_ACOUSTICS_CONFIG_DATA *ppAE = realloc( st_ivas->pAcousticEnvironments, ( st_ivas->acousticEnvironmentsCount + 1 ) * sizeof( IVAS_ROOM_ACOUSTICS_CONFIG_DATA ) ); if ( ppAE == NULL ) { return IVAS_ERR_FAILED_ALLOC; } st_ivas->pAcousticEnvironments = ppAE; n = st_ivas->acousticEnvironmentsCount++; pAE = &st_ivas->pAcousticEnvironments[n]; } pAE->aeID = roomAcousticsConfig.aeID; pAE->nBands = roomAcousticsConfig.nBands; pAE->acousticPreDelay = roomAcousticsConfig.acousticPreDelay; pAE->inputPreDelay = roomAcousticsConfig.inputPreDelay; mvr2r( roomAcousticsConfig.pFc_input, pAE->pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( roomAcousticsConfig.pAcoustic_rt60, pAE->pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( roomAcousticsConfig.pAcoustic_dsr, pAE->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); if ( pAE->use_er == 1 ) { pAE->use_er = roomAcousticsConfig.use_er; pAE->lowComplexity = roomAcousticsConfig.lowComplexity; pAE->dimensions = roomAcousticsConfig.dimensions; pAE->ListenerOrigin = roomAcousticsConfig.ListenerOrigin; mvr2r( roomAcousticsConfig.AbsCoeff, pAE->AbsCoeff, IVAS_ROOM_ABS_COEFF ); } return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetAcousticEnvironment( ) * * Gets acoustic environment configuration with a given ID *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t aeID, /* i : Acoustic environment ID */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcEnv /* o : Room acoustic environment data pointer */ ) { uint16_t n, m; uint16_t found = 0; Decoder_Struct *st_ivas; if ( hIvasDec == NULL || pAcEnv == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } st_ivas = hIvasDec->st_ivas; for ( n = 0; n < st_ivas->acousticEnvironmentsCount; n++ ) { IVAS_ROOM_ACOUSTICS_CONFIG_DATA ae = st_ivas->pAcousticEnvironments[n]; if ( aeID == ae.aeID ) { found = 1; pAcEnv->aeID = aeID; pAcEnv->nBands = ae.nBands; pAcEnv->inputPreDelay = ae.inputPreDelay; for ( m = 0; m < pAcEnv->nBands; m++ ) { pAcEnv->pFc_input[m] = ae.pFc_input[m]; pAcEnv->pAcoustic_rt60[m] = ae.pAcoustic_rt60[m]; pAcEnv->pAcoustic_dsr[m] = ae.pAcoustic_dsr[m]; } /* If ER are allocated then propagate parameters */ pAcEnv->use_er = ae.use_er; if ( ae.use_er != 0 ) { pAcEnv->lowComplexity = ae.lowComplexity; pAcEnv->dimensions.x = ae.dimensions.x; pAcEnv->dimensions.y = ae.dimensions.y; pAcEnv->dimensions.z = ae.dimensions.z; pAcEnv->ListenerOrigin.x = ae.ListenerOrigin.x; pAcEnv->ListenerOrigin.y = ae.ListenerOrigin.y; pAcEnv->ListenerOrigin.z = ae.ListenerOrigin.z; for ( m = 0; m < IVAS_ROOM_ABS_COEFF; m++ ) { pAcEnv->AbsCoeff[m] = ae.AbsCoeff[m]; } } } } return found ? IVAS_ERR_OK : IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; } #endif /*---------------------------------------------------------------------* * copyRendererConfigStruct( ) Loading Loading @@ -3434,20 +3566,32 @@ static ivas_error IVAS_DEC_FeedAcousticEnvPI( hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; } #endif hRenderConfig->roomAcoustics.aeID = hAcoustEnvPI.aeid; hRenderConfig->roomAcoustics.nBands = IVAS_PI_AE_NUM_BANDS; hRenderConfig->roomAcoustics.pFc_input[IVAS_PI_AE_LOW] = IVAS_PI_AE_LOW_FREQ; hRenderConfig->roomAcoustics.pFc_input[IVAS_PI_AE_MID] = IVAS_PI_AE_MID_FREQ; hRenderConfig->roomAcoustics.pFc_input[IVAS_PI_AE_HIGH] = IVAS_PI_AE_HIGH_FREQ; hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_LOW] = hAcoustEnvPI.rt60[IVAS_PI_AE_LOW]; hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_MID] = hAcoustEnvPI.rt60[IVAS_PI_AE_MID]; hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_HIGH] = hAcoustEnvPI.rt60[IVAS_PI_AE_HIGH]; hRenderConfig->roomAcoustics.inputPreDelay = (float)(0.1 * hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_MID]); hRenderConfig->roomAcoustics.pAcoustic_dsr[IVAS_PI_AE_LOW] = hAcoustEnvPI.dsr[IVAS_PI_AE_LOW]; hRenderConfig->roomAcoustics.pAcoustic_dsr[IVAS_PI_AE_MID] = hAcoustEnvPI.dsr[IVAS_PI_AE_MID]; hRenderConfig->roomAcoustics.pAcoustic_dsr[IVAS_PI_AE_HIGH] = hAcoustEnvPI.dsr[IVAS_PI_AE_HIGH]; hRenderConfig->roomAcoustics.use_er = hAcoustEnvPI.availEarlyReflections; /* Ignore if AE ID already in use */ if ( hRenderConfig->roomAcoustics.aeID == hAcoustEnvPI.aeid ) { return IVAS_ERR_OK; } /* Attempt to load the one already available */ if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, hAcoustEnvPI.aeid, &hRenderConfig->roomAcoustics ) ) == IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING ) { /* Add the new compact room environment */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA acEnv; acEnv.aeID = hAcoustEnvPI.aeid; acEnv.nBands = IVAS_PI_AE_NUM_BANDS; acEnv.pFc_input[IVAS_PI_AE_LOW] = IVAS_PI_AE_LOW_FREQ; acEnv.pFc_input[IVAS_PI_AE_MID] = IVAS_PI_AE_MID_FREQ; acEnv.pFc_input[IVAS_PI_AE_HIGH] = IVAS_PI_AE_HIGH_FREQ; acEnv.pAcoustic_rt60[IVAS_PI_AE_LOW] = hAcoustEnvPI.rt60[IVAS_PI_AE_LOW]; acEnv.pAcoustic_rt60[IVAS_PI_AE_MID] = hAcoustEnvPI.rt60[IVAS_PI_AE_MID]; acEnv.pAcoustic_rt60[IVAS_PI_AE_HIGH] = hAcoustEnvPI.rt60[IVAS_PI_AE_HIGH]; acEnv.inputPreDelay = (float) ( 0.1 * hRenderConfig->roomAcoustics.pAcoustic_rt60[IVAS_PI_AE_MID] ); acEnv.pAcoustic_dsr[IVAS_PI_AE_LOW] = hAcoustEnvPI.dsr[IVAS_PI_AE_LOW]; acEnv.pAcoustic_dsr[IVAS_PI_AE_MID] = hAcoustEnvPI.dsr[IVAS_PI_AE_MID]; acEnv.pAcoustic_dsr[IVAS_PI_AE_HIGH] = hAcoustEnvPI.dsr[IVAS_PI_AE_HIGH]; acEnv.use_er = hAcoustEnvPI.availEarlyReflections; if ( hAcoustEnvPI.availEarlyReflections ) { Loading @@ -3457,6 +3601,17 @@ static ivas_error IVAS_DEC_FeedAcousticEnvPI( mvr2r( hAcoustEnvPI.absorbCoeffs, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); } if ( ( error = IVAS_DEC_AddAcousticEnvironment( hIvasDec, acEnv ) ) != IVAS_ERR_OK ) { return error; } if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, hAcoustEnvPI.aeid, &hRenderConfig->roomAcoustics ) ) != IVAS_ERR_OK ) { return error; } } /* Re-initialize reverb instance if already available */ /* TD renderer Jot reverberator */ Loading
lib_dec/lib_dec.h +13 −0 Original line number Diff line number Diff line Loading @@ -475,6 +475,19 @@ ivas_error IVAS_DEC_HRTF_binary_close( const IVAS_BIN_RENDERER_TYPE binaural_renderer_old /* i : previous binaural renderer type */ ); #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT ivas_error IVAS_DEC_AddAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcousticsConfig /* i : Room acoustic configuration */ ); ivas_error IVAS_DEC_GetAcousticEnvironment( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t aeID, /* i : Acoustic environment ID */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcEnv /* o : Room acoustic environment data pointer */ ); #endif /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading