Skip to content
......@@ -354,7 +354,11 @@ ivas_error ivas_spar_dec(
/* read DirAC bitstream */
if ( st_ivas->hQMetaData != NULL )
{
#ifdef NONBE_FIX_1052_SBA_EXT
ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->nchan_transport, st_ivas->hSpar->dirac_to_spar_md_bands );
#else
ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands );
#endif
}
if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
......@@ -368,7 +372,11 @@ ivas_error ivas_spar_dec(
if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 )
{
#ifdef NONBE_FIX_1052_SBA_EXT
last_bit_pos -= ( SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS );
#else
last_bit_pos -= SID_FORMAT_NBITS;
#endif
}
nb_bits_read_orig = *nb_bits_read;
last_bit_pos -= nb_bits_read_orig;
......@@ -403,7 +411,11 @@ ivas_error ivas_spar_dec(
if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 )
{
int16_t zero_pad_bits;
#ifdef NONBE_FIX_1052_SBA_EXT
*nb_bits_read += SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS;
#else
*nb_bits_read += SID_FORMAT_NBITS;
#endif
zero_pad_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - *nb_bits_read;
assert( zero_pad_bits <= 1 );
*nb_bits_read += zero_pad_bits;
......@@ -1565,6 +1577,7 @@ void ivas_spar_dec_upmixer_sf(
{
md_idx = hSpar->render_to_md_map[ts + slot_idx_start];
ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat );
if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) )
{
for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
......
......@@ -2385,6 +2385,9 @@ static void ivas_parse_parameter_bitstream_dtx(
float pr_min_max[2];
int16_t pr_q_lvls, pr, pd, pd_q_lvls, pr_pd_bits;
int16_t zero_pad_bits, sid_bits_len;
#ifdef NONBE_FIX_1052_SBA_EXT
int16_t sba_spar_bitlen;
#endif
sid_bits_len = st0->next_bit_pos;
pr_min_max[0] = pSpar_md->min_max[0];
......@@ -2443,7 +2446,12 @@ static void ivas_parse_parameter_bitstream_dtx(
}
sid_bits_len = st0->next_bit_pos - sid_bits_len;
#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen( num_dmx_per_band[0] );
zero_pad_bits = sba_spar_bitlen - sid_bits_len;
#else
zero_pad_bits = ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - sid_bits_len;
#endif
assert( zero_pad_bits >= 0 );
if ( num_dmx_per_band[0] == 2 )
{
......
......@@ -866,7 +866,7 @@ typedef struct
ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/
int16_t numTdSamplesPerChannelCached;
} ISAR_DEC_SPLIT_REND_WRAPPER;
} ISAR_DEC_SPLIT_REND_WRAPPER, *ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE;
#endif
/*----------------------------------------------------------------------------------*
......@@ -1139,7 +1139,7 @@ typedef struct Decoder_Struct
int16_t flag_omasa_brate;
#ifdef SPLIT_REND_WITH_HEAD_ROT
ISAR_DEC_SPLIT_REND_WRAPPER hSplitBinRend; /* ISAR split binaural rendering handle */
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; /* ISAR split binaural rendering handle */
BINAURAL_TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1];
#endif
......
......@@ -128,6 +128,8 @@ static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType
static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset );
static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int16_t nZeroSamples );
static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
#endif
static int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered );
......@@ -347,6 +349,11 @@ void IVAS_DEC_Close(
( *phIvasDec )->hVoIP = NULL;
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
/* destroy Split binaural renderer (ISAR) handle */
ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend );
#endif
if ( ( *phIvasDec )->st_ivas )
{
ivas_destroy_dec( ( *phIvasDec )->st_ivas );
......@@ -511,6 +518,17 @@ ivas_error IVAS_DEC_Configure(
return error;
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
/* create ISAR handle */
if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
if ( ( error = ivas_create_handle_isar( &st_ivas->hSplitBinRend ) ) != IVAS_ERR_OK )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for ISAR handle" );
}
}
#endif
if ( hIvasDec->mode == IVAS_DEC_MODE_EVS )
{
hIvasDec->st_ivas->ivas_format = MONO_FORMAT;
......@@ -937,7 +955,7 @@ ivas_error IVAS_DEC_GetSamples(
if ( hIvasDec->st_ivas->hCombinedOrientationData != NULL && ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
isar_set_split_rend_ht_setup( &hIvasDec->st_ivas->hSplitBinRend.splitrend, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions, hIvasDec->st_ivas->hCombinedOrientationData->Rmat );
isar_set_split_rend_ht_setup( &hIvasDec->st_ivas->hSplitBinRend->splitrend, hIvasDec->st_ivas->hCombinedOrientationData->Quaternions, hIvasDec->st_ivas->hCombinedOrientationData->Rmat );
}
#endif
......@@ -1105,7 +1123,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
int16_t numSamplesPerChannelToDecode;
int16_t i, j;
ivas_error error;
ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend;
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
int16_t max_band;
int16_t pcm_out_flag;
int16_t td_input;
......@@ -1121,7 +1139,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
numSamplesPerChannelToDecode = (int16_t) ( output_Fs / FRAMES_PER_SEC );
*needNewFrame = false;
hSplitBinRend = &st_ivas->hSplitBinRend;
hSplitBinRend = st_ivas->hSplitBinRend;
if ( ( error = isar_set_split_rend_setup( hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK )
{
......@@ -1267,7 +1285,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
ivas_syn_output( pOutput, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out );
}
free( st_ivas->hSplitBinRend.hMultiBinCldfbData );
free( st_ivas->hSplitBinRend->hMultiBinCldfbData );
return error;
}
......@@ -2307,6 +2325,9 @@ ivas_error IVAS_DEC_FeedRenderConfig(
#endif
mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS );
#ifdef CONF_DISTATT
mvr2r( renderConfig.distAtt, hRenderConfig->distAtt, 3 );
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
hRenderConfig->split_rend_config = renderConfig.split_rend_config;
......@@ -3864,24 +3885,24 @@ ivas_error IVAS_DEC_GetCldfbSamples(
int16_t *nOutSamples /* o : number of samples per channel written to output buffer */
)
{
Decoder_Struct *st_ivas;
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
int16_t ch, b, slot_idx, num_chs, maxBand, num_samples;
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hSplitBinRend == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
st_ivas = hIvasDec->st_ivas;
hSplitBinRend = hIvasDec->st_ivas->hSplitBinRend;
num_samples = 0;
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
if ( hSplitBinRend->hCldfbDataOut != NULL )
{
*audio_config = st_ivas->hSplitBinRend.hCldfbDataOut->config;
if ( st_ivas->hSplitBinRend.hCldfbDataOut->config != IVAS_AUDIO_CONFIG_INVALID )
*audio_config = hSplitBinRend->hCldfbDataOut->config;
if ( hSplitBinRend->hCldfbDataOut->config != IVAS_AUDIO_CONFIG_INVALID )
{
num_chs = audioCfg2channels( st_ivas->hSplitBinRend.hCldfbDataOut->config );
maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 );
num_chs = audioCfg2channels( hSplitBinRend->hCldfbDataOut->config );
maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * hIvasDec->st_ivas->hDecoderConfig->output_Fs ) / 48000 );
for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ )
{
......@@ -3889,8 +3910,8 @@ ivas_error IVAS_DEC_GetCldfbSamples(
{
for ( ch = 0; ch < num_chs; ch++ )
{
*out_real++ = st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx][b];
*out_imag++ = st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx][b];
*out_real++ = hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx][b];
*out_imag++ = hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx][b];
}
}
}
......@@ -3999,6 +4020,60 @@ PCM_RESOLUTION pcm_type_API_to_internal(
}
/*-------------------------------------------------------------------*
* ivas_create_handle_isar()
*
* Initialize IVAS decoder split rend handle
*-------------------------------------------------------------------*/
static ivas_error ivas_create_handle_isar(
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out /* o : ISAR split binaural rendering handle */
)
{
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
if ( ( hSplitBinRend = (ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_WRAPPER ) ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS decoder handle" );
}
isar_init_split_rend_handles( &hSplitBinRend->splitrend );
hSplitBinRend->hMultiBinCldfbData = NULL;
hSplitBinRend->hCldfbDataOut = NULL;
hSplitBinRend->numTdSamplesPerChannelCached = 0;
*hSplitBinRend_out = hSplitBinRend;
return IVAS_ERR_OK;
}
/*-------------------------------------------------------------------*
* ivas_destroy_handle_isar()
*
* destroy IVAS decoder split rend handle
*-------------------------------------------------------------------*/
static void ivas_destroy_handle_isar(
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend /* i/o: ISAR split binaural rendering handle */
)
{
if ( *hSplitBinRend != NULL )
{
ISAR_PRE_REND_close( &( *hSplitBinRend )->splitrend, NULL );
if ( ( *hSplitBinRend )->hCldfbDataOut != NULL )
{
free( ( *hSplitBinRend )->hCldfbDataOut );
( *hSplitBinRend )->hCldfbDataOut = NULL;
}
}
return;
}
/*---------------------------------------------------------------------*
* IVAS_DEC_is_split_rendering_enabled()
*
......
......@@ -600,6 +600,16 @@ ivas_error ivas_cpe_enc(
if ( sts[0]->core_brate == SID_2k40 )
{
ivas_write_format_sid( ivas_format, hCPE->element_mode, sts[0]->hBstr );
#ifdef NONBE_FIX_1052_SBA_EXT
if ( ivas_format == SBA_FORMAT )
{
/* Write SBA planar flag */
push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS );
/* Write SBA order */
push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS );
}
#endif
}
/*----------------------------------------------------------------*
......
......@@ -291,6 +291,9 @@ ivas_error ivas_dirac_enc(
const int16_t input_frame, /* i : input frame length */
const int16_t dtx_vad, /* i : DTX vad flag */
const IVAS_FORMAT ivas_format, /* i : ivas format */
#ifdef NONBE_FIX_1052_SBA_EXT
const int16_t nchan_transport, /* i : number of transport channels */
#endif
const int16_t hodirac_flag /* i : hodirac flag */
)
{
......@@ -367,7 +370,11 @@ ivas_error ivas_dirac_enc(
push_next_indice( hMetaData, 1, 1 );
/* encode SID parameters */
#ifdef NONBE_FIX_1052_SBA_EXT
ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, nchan_transport, SBA_FORMAT );
#else
ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT );
#endif
}
for ( b = hQMetaData->q_direction->cfg.start_band; b < hQMetaData->q_direction->cfg.nbands; b++ )
......
......@@ -596,7 +596,11 @@ ivas_error ivas_masa_encode(
free( h_orig_metadata );
#ifdef NONBE_FIX_1052_SBA_EXT
ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, masa_sid_descriptor, 0, ivas_format );
#else
ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format );
#endif
/* restore old values */
hMasa->config.numCodingBands = numCodingBands;
......
......@@ -955,6 +955,9 @@ void ivas_qmetadata_enc_sid_encode(
BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */
IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */
const int16_t masa_sid_descriptor, /* i : description of MASA SID coding structure */
#ifdef NONBE_FIX_1052_SBA_EXT
const int16_t nchan_transport, /* i : number of transport channels */
#endif
const int16_t ivas_format /* i : IVAS format */
)
{
......@@ -968,10 +971,18 @@ void ivas_qmetadata_enc_sid_encode(
float avg_elevation[MASA_MAXIMUM_CODING_SUBBANDS];
int16_t bits_dir, bits_diff, bits_delta;
int16_t metadata_sid_bits; /* bits allocated to SID for metadata */
#ifdef NONBE_FIX_1052_SBA_EXT
int16_t sba_spar_bitlen;
#endif
if ( ivas_format == SBA_FORMAT )
{
#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen( nchan_transport );
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - sba_spar_bitlen - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/
#else
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/
#endif
}
else
{
......@@ -1250,7 +1261,11 @@ void reset_metadata_spatial(
assert( hMetaData->ind_list[0].nb_bits == 1 );
#endif
hMetaData->ind_list[0].value = 1;
#ifdef NONBE_FIX_1052_SBA_EXT
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_PLANAR_BITS - SBA_ORDER_BITS;
#else
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
#endif
while ( hMetaData->nb_bits_tot < metadata_sid_bits )
{
......
......@@ -224,6 +224,16 @@ ivas_error ivas_sce_enc(
if ( st->core_brate == SID_2k40 )
{
ivas_write_format_sid( ivas_format, IVAS_SCE, st->hBstr );
#ifdef NONBE_FIX_1052_SBA_EXT
if ( ivas_format == SBA_FORMAT )
{
/* Write SBA planar flag */
push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS );
/* Write SBA order */
push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS );
}
#endif
}
/*----------------------------------------------------------------*
......
......@@ -699,10 +699,18 @@ static ivas_error ivas_spar_enc_process(
hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order );
#ifdef NONBE_FIX_1052_SBA_EXT
if ( ( error = ivas_dirac_enc( st_ivas->hDirAC, hQMetaData, hMetaData, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, dtx_vad, hEncoderConfig->ivas_format, nchan_transport, hodirac_flag ) ) != IVAS_ERR_OK )
{
return error;
}
#else
if ( ( error = ivas_dirac_enc( st_ivas->hDirAC, hQMetaData, hMetaData, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, dtx_vad, hEncoderConfig->ivas_format, hodirac_flag ) ) != IVAS_ERR_OK )
{
return error;
}
#endif
/* Set Energy Ratio to 0.0 if the mono flag has been set */
if ( hQMetaData->dirac_mono_flag )
......
......@@ -1716,6 +1716,9 @@ static void ivas_write_parameter_bitstream_dtx(
int16_t idx;
float pr_min_max[2];
int16_t zero_pad_bits, sid_bits_len;
#ifdef NONBE_FIX_1052_SBA_EXT
int16_t sba_spar_bitlen;
#endif
sid_bits_len = hMetaData->nb_bits_tot;
pr_min_max[0] = pSpar_md->min_max[0];
pr_min_max[1] = pSpar_md->min_max[1];
......@@ -1771,7 +1774,12 @@ static void ivas_write_parameter_bitstream_dtx(
}
sid_bits_len = hMetaData->nb_bits_tot - sid_bits_len;
#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen( num_dmx[0] );
zero_pad_bits = sba_spar_bitlen - sid_bits_len;
#else
zero_pad_bits = ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - sid_bits_len;
#endif
assert( zero_pad_bits >= 0 );
if ( num_dmx[0] == 2 )
{
......
......@@ -154,9 +154,15 @@ ivas_error ivas_dirac_dec_init_binaural_data(
ivas_error error;
float frequency_axis[CLDFB_NO_CHANNELS_MAX];
#ifdef SPLIT_REND_WITH_HEAD_ROT
int16_t pos_idx;
int16_t num_poses, pos_idx;
num_poses = 1;
if ( st_ivas->hSplitBinRend != NULL )
{
num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
}
for ( pos_idx = 0; pos_idx < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
{
hDiracDecBin = st_ivas->hDiracDecBin[pos_idx];
#else
......@@ -819,7 +825,11 @@ static void ivas_dirac_dec_binaural_internal(
hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, nchanSeparateChannels, st_ivas->hMasaIsmData );
#ifdef SPLIT_REND_WITH_HEAD_ROT
pMultiBinPoseData = &st_ivas->hSplitBinRend.splitrend.multiBinPoseData;
pMultiBinPoseData = NULL;
if ( st_ivas->hSplitBinRend != NULL )
{
pMultiBinPoseData = &st_ivas->hSplitBinRend->splitrend.multiBinPoseData;
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
......@@ -835,8 +845,8 @@ static void ivas_dirac_dec_binaural_internal(
{
for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ )
{
mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
}
}
}
......@@ -908,8 +918,8 @@ static void ivas_dirac_dec_binaural_internal(
{
for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ )
{
mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
}
}
......
......@@ -66,6 +66,9 @@ ivas_error ivas_td_binaural_open_unwrap(
const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */
const AUDIO_CONFIG transport_config, /* i : Transport configuration */
const float *directivity, /* i : Directivity pattern (used for ISM) */
#ifdef CONF_DISTATT
const float *distAtt, /* i : Distance attenuation (used for ISM) */
#endif
const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */
BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */
int32_t *binaural_latency_ns /* i : Binauralization delay */
......@@ -79,6 +82,9 @@ ivas_error ivas_td_binaural_open_unwrap(
float Pos[3];
float Dir[3];
TDREND_DirAtten_t *DirAtten_p;
#ifdef CONF_DISTATT
TDREND_DistAtten_t DistAtten;
#endif
int16_t nchan_rend;
ivas_error error;
......@@ -184,6 +190,13 @@ ivas_error ivas_td_binaural_open_unwrap(
DirAtten_p->ConeOuterAngle = 360.0f;
DirAtten_p->ConeOuterGain = 1.0f;
#ifdef CONF_DISTATT
DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED;
DistAtten.MaxDist = 15.75f;
DistAtten.RefDist = 1.0f;
DistAtten.RollOffFactor = 1.0f;
#endif
if ( ( error = TDREND_MIX_SRC_SetPos( pBinRendTd, nS, Pos ) ) != IVAS_ERR_OK )
{
return error;
......@@ -203,6 +216,12 @@ ivas_error ivas_td_binaural_open_unwrap(
{
return error;
}
#ifdef CONF_DISTATT
if ( ( error = TDREND_MIX_SRC_SetDistAtten( pBinRendTd, nS, &DistAtten ) ) != IVAS_ERR_OK )
{
return error;
}
#endif
}
}
......@@ -224,11 +243,32 @@ ivas_error ivas_td_binaural_open_unwrap(
DirAtten_p->ConeOuterAngle = directivity[nS * 3 + 1];
DirAtten_p->ConeOuterGain = directivity[nS * 3 + 2];
}
#ifdef CONF_DISTATT
if ( NULL == distAtt )
{
DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED;
DistAtten.MaxDist = 15.75f;
DistAtten.RefDist = 1.0f;
DistAtten.RollOffFactor = 1.0f;
}
else
{
DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED;
DistAtten.MaxDist = distAtt[0];
DistAtten.RefDist = distAtt[1];
DistAtten.RollOffFactor = distAtt[2];
}
#endif
if ( ( error = TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ) ) != IVAS_ERR_OK )
{
return error;
}
#ifdef CONF_DISTATT
if ( ( error = TDREND_MIX_SRC_SetDistAtten( pBinRendTd, nS, &DistAtten ) ) != IVAS_ERR_OK )
{
return error;
}
#endif
}
}
......@@ -638,6 +678,9 @@ ivas_error ivas_td_binaural_open_ext(
IVAS_OUTPUT_SETUP hTransSetup;
ivas_error error;
#ifdef CONF_DISTATT
float *distAtt = NULL;
#endif
float *directivity = NULL;
if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM )
......@@ -667,9 +710,16 @@ ivas_error ivas_td_binaural_open_ext(
if ( NULL != hRendCfg )
{
directivity = hRendCfg->directivity;
#ifdef CONF_DISTATT
distAtt = hRendCfg->distAtt;
#endif
}
#ifdef CONF_DISTATT
return ivas_td_binaural_open_unwrap( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, distAtt, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns );
#else
return ivas_td_binaural_open_unwrap( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns );
#endif
}
......
......@@ -51,6 +51,10 @@ static void TDREND_SRC_SPATIAL_Init( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const T
static void TDREND_SRC_SPATIAL_SetDirAtten( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DirAtten_t *DirAtten_p );
#ifdef CONF_DISTATT
static void TDREND_SRC_SPATIAL_SetDistAtten( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DistAtten_t *DistAtten_p );
#endif
static float TDREND_SRC_SPATIAL_GetDirGain( const TDREND_DirAtten_t *DirAtten_p, const float *Front_p, const float *RelPos_p );
static float TDREND_SRC_SPATIAL_GetDistGain( const TDREND_DistAtten_t *DistAtten_p, const float Dist );
......@@ -153,6 +157,33 @@ ivas_error TDREND_MIX_SRC_SetDirAtten(
return IVAS_ERR_OK;
}
#ifdef CONF_DISTATT
/*-------------------------------------------------------------------*
* TDREND_MIX_SRC_SetDistAtten()
*
* Set distance attenuation for the mixer.
--------------------------------------------------------------------*/
ivas_error TDREND_MIX_SRC_SetDistAtten(
BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */
const int16_t SrcInd, /* i : Source index */
const TDREND_DistAtten_t *DistAtten_p /* i : Distance attenuation specifier */
)
{
TDREND_SRC_SPATIAL_t *SrcSpatial_p;
if ( SrcInd > hBinRendererTd->MaxSrcInd )
{
return ( IVAS_ERROR( IVAS_ERR_INVALID_INDEX, "Index exceeds max index\n" ) );
}
else
{
SrcSpatial_p = hBinRendererTd->Sources[SrcInd]->SrcSpatial_p;
TDREND_SRC_SPATIAL_SetDistAtten( SrcSpatial_p, DistAtten_p );
}
return IVAS_ERR_OK;
}
#endif
/*-------------------------------------------------------------------*
* TDREND_MIX_SRC_SetPlayState()
......@@ -483,7 +514,27 @@ static void TDREND_SRC_SPATIAL_SetDirAtten(
return;
}
#ifdef CONF_DISTATT
/*-------------------------------------------------------------------*
* TDREND_SRC_SPATIAL_SetDistAtten()
*
* Sets the distance attenuation.
--------------------------------------------------------------------*/
static void TDREND_SRC_SPATIAL_SetDistAtten(
TDREND_SRC_SPATIAL_t *SrcSpatial_p,
const TDREND_DistAtten_t *DistAtten_p )
{
/* Set distance attenuation */
SrcSpatial_p->DistAttenEnabled = TRUE;
SrcSpatial_p->DistAtten.DistAttenModel = DistAtten_p->DistAttenModel;
SrcSpatial_p->DistAtten.MaxDist = DistAtten_p->MaxDist;
SrcSpatial_p->DistAtten.RefDist = DistAtten_p->RefDist;
SrcSpatial_p->DistAtten.RollOffFactor = DistAtten_p->RollOffFactor;
return;
}
#endif
/*-------------------------------------------------------------------*
* TDREND_SRC_SPATIAL_GetDirGain()
*
......@@ -557,7 +608,11 @@ static float TDREND_SRC_SPATIAL_GetDistGain(
switch ( DistAtten_p->DistAttenModel )
{
case TDREND_DIST_ATTEN_MODEL_INV_DIST:
#ifdef CONF_DISTATT
DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor );
#else
DistGain = DistAtten_p->RefDist / ( DistAtten_p->RefDist + DistAtten_p->RollOffFactor * ( Dist2 - DistAtten_p->RefDist ) );
#endif
break;
case TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED:
......@@ -570,8 +625,11 @@ static float TDREND_SRC_SPATIAL_GetDistGain(
{
Dist2 = DistAtten_p->MaxDist;
}
#ifdef CONF_DISTATT
DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor );
#else
DistGain = DistAtten_p->RefDist / ( DistAtten_p->RefDist + DistAtten_p->RollOffFactor * ( Dist2 - DistAtten_p->RefDist ) );
#endif
break;
}
......
......@@ -408,7 +408,11 @@ int16_t ivas_get_nchan_buffers_dec(
{
nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe );
}
#ifdef FIX_1052_EXT_OUTPUT
else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
else
#endif
{
nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) );
nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) );
......@@ -418,7 +422,7 @@ int16_t ivas_get_nchan_buffers_dec(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
}
#endif
......
......@@ -634,6 +634,9 @@ ivas_error ivas_td_binaural_open_unwrap(
const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */
const AUDIO_CONFIG transport_config, /* i : Transport configuration */
const float *directivity, /* i : Directivity pattern (used for ISM) */
#ifdef CONF_DISTATT
const float *distAtt, /* i : Distance attenuation (used for ISM) */
#endif
const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */
BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */
int32_t *binaural_latency_ns /* i : Binauralization delay */
......@@ -722,7 +725,13 @@ ivas_error TDREND_MIX_SRC_SetDirAtten(
const int16_t SrcInd, /* i : Source index */
const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */
);
#ifdef CONF_DISTATT
ivas_error TDREND_MIX_SRC_SetDistAtten(
BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */
const int16_t SrcInd, /* i : Source index */
const TDREND_DistAtten_t *DistAtten_p /* i : Distance attenuation specifier */
);
#endif
ivas_error TDREND_MIX_SRC_SetPlayState(
BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */
const int16_t SrcInd, /* i : Source index */
......
......@@ -131,6 +131,11 @@ ivas_error ivas_render_config_init_from_rom(
( *hRenderConfig )->directivity[i * 3 + 1] = 360.0f; /* Back cone */
( *hRenderConfig )->directivity[i * 3 + 2] = 1.0f; /* Back attenuation */
}
#ifdef CONF_DISTATT
( *hRenderConfig )->distAtt[0] = 15.75f; /* Default max dist */
( *hRenderConfig )->distAtt[1] = 1.0f; /* Default ref dist */
( *hRenderConfig )->distAtt[2] = 1.0f; /* Default rolloff factor */
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
( *hRenderConfig )->split_rend_config.splitRendBitRate = SPLIT_REND_768k;
( *hRenderConfig )->split_rend_config.dof = 3;
......
......@@ -124,6 +124,9 @@ struct RenderConfigReader
AcousticEnv *pAE; /* Acoustic environments */
uint32_t nDP; /* Number of directivity patterns */
DirectrivityPat *pDP; /* Directivity Pattern */
#ifdef CONF_DISTATT
float distAtt[3]; /* [MaxDist, RefDist, Rolloff] */
#endif
};
......@@ -996,6 +999,77 @@ static ivas_error get_bin_outer_attenuation(
return IVAS_ERR_OK;
}
#ifdef CONF_DISTATT
/*-----------------------------------------------------------------------------------------*
* Function get_bin_max_dist ()
* Gets a Maximum Distance value [1.0, 64.0]
*-----------------------------------------------------------------------------------------*/
static ivas_error get_bin_max_dist(
RenderConfigReader *this, /* i/o : Render config reader handle */
float *pResult /* o : Attenuation value */
)
{
ivas_error error;
uint32_t value;
if ( ( error = read_bin_bits( this, &value, 6 ) ) != IVAS_ERR_OK )
{
return error;
}
*pResult = usdequant( (int16_t) value, 1.0f, 1.0f );
return IVAS_ERR_OK;
}
/*-----------------------------------------------------------------------------------------*
* Function get_bin_ref_dist ()
* Gets a Reference Distance value [0.1, 6.4]
*-----------------------------------------------------------------------------------------*/
static ivas_error get_bin_ref_dist(
RenderConfigReader *this, /* i/o : Render config reader handle */
float *pResult /* o : Attenuation value */
)
{
ivas_error error;
uint32_t value;
if ( ( error = read_bin_bits( this, &value, 6 ) ) != IVAS_ERR_OK )
{
return error;
}
*pResult = usdequant( (int16_t) value, 0.1f, 0.1f );
return IVAS_ERR_OK;
}
/*-----------------------------------------------------------------------------------------*
* Function get_bin_rolloff ()
* Gets a Rollof Factor [0.0, 4.0]
*-----------------------------------------------------------------------------------------*/
static ivas_error get_bin_rolloff(
RenderConfigReader *this, /* i/o : Render config reader handle */
float *pResult /* o : Attenuation value */
)
{
ivas_error error;
uint32_t value;
if ( ( error = read_bin_bits( this, &value, 6 ) ) != IVAS_ERR_OK )
{
return error;
}
*pResult = usdequant( (int16_t) value, 0.0f, 0.1f );
return IVAS_ERR_OK;
}
#endif
/*-----------------------------------------------------------------------------------------*
* Function read_txt_vector()
......@@ -1128,6 +1202,9 @@ ivas_error RenderConfigReader_checkValues(
pRoom_acoustics = &hRenderConfig->roomAcoustics;
tab_value_err_count = 0;
int16_t wall_idx;
#ifdef CONF_DISTATT
int16_t i;
#endif
/* Verify the number of frequency bands in the config input data */
......@@ -1245,6 +1322,22 @@ ivas_error RenderConfigReader_checkValues(
pRoom_acoustics->AbsCoeff[wall_idx] = ER_MAX_ABS_COEFF;
}
}
#ifdef CONF_DISTATT
/* Verify range of distance attenuation parameters: 0.1 <= distAtt[0] <= distAtt[1] */
/* 0.0 <= distAtt[2] <= 10.0 */
hRenderConfig->distAtt[0] = max( 0.1f, hRenderConfig->distAtt[0] );
hRenderConfig->distAtt[1] = max( hRenderConfig->distAtt[0], hRenderConfig->distAtt[1] );
hRenderConfig->distAtt[2] = max( 0.0f, min( 10.0f, hRenderConfig->distAtt[2] ) );
/* Verify range of directivity patterns */
for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
{
hRenderConfig->directivity[i * 3] = max( 0.0f, min( 360.0f, hRenderConfig->directivity[i * 3] ) );
hRenderConfig->directivity[i * 3 + 1] = max( 0.0f, min( 360.0f, hRenderConfig->directivity[i * 3 + 1] ) );
hRenderConfig->directivity[i * 3 + 2] = max( 0.0f, min( 1.0f, hRenderConfig->directivity[i * 3 + 2] ) );
}
#endif
}
......@@ -1287,6 +1380,9 @@ ivas_error RenderConfigReader_open(
pSelf->pAE = NULL;
pSelf->nDP = 0;
pSelf->pDP = NULL;
#ifdef CONF_DISTATT
pSelf->distAtt[0] = -1;
#endif
*ppRenderConfigReader = pSelf;
return IVAS_ERR_OK;
......@@ -1806,6 +1902,36 @@ static ivas_error RenderConfigReader_readBinary(
}
}
}
#ifdef CONF_DISTATT
/**********************************/
/* Read the distance attenuation */
/**********************************/
/* Has distance attenuation */
if ( ( error = read_bin_bool( pRenderConfigReader, &value ) ) != IVAS_ERR_OK )
{
return error;
}
if ( value == true )
{
/* Read the Max Distance */
if ( ( error = get_bin_max_dist( pRenderConfigReader, &pRenderConfigReader->distAtt[0] ) ) != IVAS_ERR_OK )
{
return error;
}
/* Read the Ref Distance */
if ( ( error = get_bin_ref_dist( pRenderConfigReader, &pRenderConfigReader->distAtt[1] ) ) != IVAS_ERR_OK )
{
return error;
}
/* Read the Rolloff Facto r*/
if ( ( error = get_bin_rolloff( pRenderConfigReader, &pRenderConfigReader->distAtt[2] ) ) != IVAS_ERR_OK )
{
return error;
}
}
#endif
/* Cleanup */
free( pRenderConfigReader->pBitstream );
......@@ -2662,6 +2788,54 @@ ivas_error RenderConfigReader_read(
free( pValue );
accDPIdx++;
}
#ifdef CONF_DISTATT
else if ( strcmp( chapter, "DISTANCEATTENUATION" ) == 0 )
{
params_idx = 0;
pValue = (char *) calloc( strlen( pParams ), sizeof( char ) );
/* Set default values if parameters are only partially specified */
pRenderConfigReader->distAtt[0] = 15.75f;
pRenderConfigReader->distAtt[1] = 1.0f;
pRenderConfigReader->distAtt[2] = 1.0f;
while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 )
{
params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 );
if ( strcmp( item, "MAXDIST" ) == 0 )
{
/* Read the Maximum distance */
if ( !sscanf( pValue, "%f", &pRenderConfigReader->distAtt[0] ) )
{
errorHandler( item, ERROR_VALUE_INVALID );
return IVAS_ERR_INVALID_RENDER_CONFIG;
}
}
if ( strcmp( item, "REFDIST" ) == 0 )
{
/* Read the Reference distance */
if ( !sscanf( pValue, "%f", &pRenderConfigReader->distAtt[1] ) )
{
errorHandler( item, ERROR_VALUE_INVALID );
return IVAS_ERR_INVALID_RENDER_CONFIG;
}
}
if ( strcmp( item, "ROLLOFFFACTOR" ) == 0 )
{
/* Read the Rolloff Factor */
if ( !sscanf( pValue, "%f", &pRenderConfigReader->distAtt[2] ) )
{
errorHandler( item, ERROR_VALUE_INVALID );
return IVAS_ERR_INVALID_RENDER_CONFIG;
}
}
}
free( pValue );
}
#endif
else if ( strcmp( chapter, "GENERAL" ) == 0 && strlen( pParams ) != 0 )
{
params_idx = 0;
......@@ -2918,6 +3092,34 @@ ivas_error RenderConfigReader_getDirectivity(
return IVAS_ERR_OK;
}
#ifdef CONF_DISTATT
/*------------------------------------------------------------------------------------------*
* RenderConfigReader_getDistanceAttenuation()
*
* Gets Distance Attenuation
*------------------------------------------------------------------------------------------*/
ivas_error RenderConfigReader_getDistanceAttenuation(
RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */
float *distAtt /* o : Distance attenuation */
)
{
if ( pRenderConfigReader->distAtt[0] == -1 )
{
distAtt[0] = 15.75f;
distAtt[1] = 1.0f;
distAtt[2] = 1.0f;
}
else
{
distAtt[0] = pRenderConfigReader->distAtt[0];
distAtt[1] = pRenderConfigReader->distAtt[1];
distAtt[2] = pRenderConfigReader->distAtt[2];
}
return IVAS_ERR_OK;
}
#endif
/*------------------------------------------------------------------------------------------*
* RenderConfigReader_close()
......
......@@ -62,6 +62,12 @@ ivas_error RenderConfigReader_getDirectivity(
uint16_t *pId, /* i : Directivity pattern ID */
float *directivity /* o : Target directivity */
);
#ifdef CONF_DISTATT
ivas_error RenderConfigReader_getDistanceAttenuation(
RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */
float *distAtt /* o : Distance attenuation */
);
#endif
/* Verifies configuration parameters */
ivas_error RenderConfigReader_checkValues(
IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */
......
#!/usr/bin/env python3
from pathlib import Path
import os
import glob
files = ['Readme_IVAS_JBM_dec.txt','Readme_IVAS_dec.txt','Readme_IVAS_enc.txt','Readme_IVAS_rend.txt'];
used_files = []
kept = 0
removed = 0
# Input files explicitly listed in scripts
for file in files:
with open(file,"r") as fp:
for line in fp:
for item in line.split():
if "$TESTV_PATH" in item or "$REF_PATH" in item:
used_files.append(Path(item).name)
# All .dat files in testv (binary render config files listed via txt config file)
for file in glob.glob("testvec/testv/*.dat"):
used_files.append(Path(file).name)
# All .met, .csv and .wav files in .txt configuration files
for file in glob.glob("testvec/testv/*.txt"):
with open(file,"r") as fp:
for line in fp:
if any(x in line for x in [".met",".csv",".wav"]):
used_files.append(Path(line).name.strip())
# Remove duplicates
used_files = list(dict.fromkeys(used_files))
for dirpath, subdirs, files in os.walk("testvec"):
for file in files:
if file in used_files:
kept = kept + 1
else:
removed = removed + 1
os.remove(os.path.join(dirpath, file))
print(f"Identified {len(used_files)} files from scripts")
print(f"Removed {removed} files")
print(f"Kept {kept} files")