Skip to content
......@@ -160,7 +160,11 @@ void ivas_renderer_select(
{
*internal_config = IVAS_AUDIO_CONFIG_HOA3;
#ifdef NONBE_FIX_935_SBA_REVERB
if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL
#else
if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
|| output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM
#endif
......@@ -371,7 +375,11 @@ void ivas_renderer_select(
{
*internal_config = IVAS_AUDIO_CONFIG_HOA3;
}
#ifdef FIX_959_MASA_LINEAR_REND
*renderer_type = RENDERER_SBA_LINEAR_DEC;
#else
st_ivas->renderer_type = RENDERER_SBA_LINEAR_DEC;
#endif
}
else if ( ( ivas_format == MASA_FORMAT && output_config == IVAS_AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ||
( ivas_format == SBA_FORMAT && ( output_config == IVAS_AUDIO_CONFIG_STEREO || output_config == IVAS_AUDIO_CONFIG_MONO ) ) )
......
......@@ -194,7 +194,11 @@ ivas_error ivas_sba_dec_reconfigure(
}
else
{
#ifdef NONBE_FIX_935_SBA_REVERB
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL
#else
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
|| st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM
#endif
......
......@@ -249,7 +249,13 @@ ivas_error ivas_spar_dec_open(
nchan_to_allocate = 2 * BINAURAL_CHANNELS;
}
if ( st_ivas->ivas_format == SBA_ISM_FORMAT && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
if ( st_ivas->ivas_format == SBA_ISM_FORMAT &&
#ifdef NONBE_FIX_935_SBA_REVERB
st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL &&
#else
( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) &&
#endif
st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
/* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */
granularity = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) );
......
......@@ -216,6 +216,7 @@ ivas_error IVAS_DEC_Open(
st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID;
st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID;
st_ivas->writeFECoffset = 0;
hIvasDec->hasDecodedFirstGoodFrame = true; /* Functionality to suppress output for initial lost frames is disabled in EVS operation */
return IVAS_ERR_OK;
}
......@@ -1051,6 +1052,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
int16_t pcm_out_flag;
int16_t td_input;
int16_t numPoses;
int16_t ro_md_flag;
error = IVAS_ERR_OK;
st_ivas = hIvasDec->st_ivas;
......@@ -1153,6 +1155,15 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
pcm_out_flag = ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
td_input = st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC;
if ( st_ivas->hBinRendererTd != NULL )
{
ro_md_flag = 1;
}
else
{
ro_md_flag = 0;
}
if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend,
st_ivas->hHeadTrackData->Quaternions[0],
st_ivas->hRenderConfig->split_rend_config.splitRendBitRate,
......@@ -1161,7 +1172,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
hSplitBinRend->hSplitRendBits,
hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural,
hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural,
max_band, pOutput, 1, !td_input, pcm_out_flag ) ) != IVAS_ERR_OK )
max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK )
{
return error;
}
......@@ -1871,7 +1882,11 @@ ivas_error IVAS_DEC_FeedCustomLsData(
ivas_error IVAS_DEC_GetHrtfHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */
#else
IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */
#endif
)
{
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfTD == NULL )
......@@ -1879,7 +1894,11 @@ ivas_error IVAS_DEC_GetHrtfHandle(
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
*hHrtfTD = &hIvasDec->st_ivas->hHrtfTD;
#else
*hHrtfTD = hIvasDec->st_ivas->hHrtfTD;
#endif
return IVAS_ERR_OK;
}
......@@ -1893,7 +1912,11 @@ ivas_error IVAS_DEC_GetHrtfHandle(
ivas_error IVAS_DEC_GetHrtfCRendHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */
#else
IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* o : Set of HRTF handle */
#endif
)
{
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hSetOfHRTF == NULL )
......@@ -1901,7 +1924,11 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle(
return IVAS_ERR_WRONG_PARAMS;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
*hSetOfHRTF = &hIvasDec->st_ivas->hSetOfHRTF;
#else
*hSetOfHRTF = hIvasDec->st_ivas->hSetOfHRTF;
#endif
return IVAS_ERR_OK;
}
......@@ -1915,7 +1942,11 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle(
ivas_error IVAS_DEC_GetHrtfFastConvHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */
#else
IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* o : FASTCONV HRTF handle */
#endif
)
{
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfFastConv == NULL )
......@@ -1923,7 +1954,11 @@ ivas_error IVAS_DEC_GetHrtfFastConvHandle(
return IVAS_ERR_WRONG_PARAMS;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
*hHrtfFastConv = &hIvasDec->st_ivas->hHrtfFastConv;
#else
*hHrtfFastConv = hIvasDec->st_ivas->hHrtfFastConv;
#endif
return IVAS_ERR_OK;
}
......@@ -1937,7 +1972,11 @@ ivas_error IVAS_DEC_GetHrtfFastConvHandle(
ivas_error IVAS_DEC_GetHrtfParamBinHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */
#else
IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */
#endif
)
{
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfParambin == NULL )
......@@ -1945,7 +1984,11 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle(
return IVAS_ERR_WRONG_PARAMS;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
*hHrtfParambin = &hIvasDec->st_ivas->hHrtfParambin;
#else
*hHrtfParambin = hIvasDec->st_ivas->hHrtfParambin;
#endif
return IVAS_ERR_OK;
}
......@@ -3699,6 +3742,7 @@ static ivas_error set_pcm_buffer_to_zero(
{
ivas_error error;
error = IVAS_ERR_OK;
switch ( pcmType )
{
case IVAS_DEC_PCM_FLOAT:
......
......@@ -406,23 +406,39 @@ ivas_error IVAS_DEC_FeedCustomLsData(
/*! r: error code */
ivas_error IVAS_DEC_GetHrtfHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */
#else
IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */
#endif
);
/*! r: error code */
ivas_error IVAS_DEC_GetHrtfCRendHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */
#else
IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* o : Set of HRTF handle */
#endif
);
ivas_error IVAS_DEC_GetHrtfFastConvHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv/* o : FASTCONV HRTF handle */
#else
IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* o : FASTCONV HRTF handle */
#endif
);
ivas_error IVAS_DEC_GetHrtfParamBinHandle(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin/* o : Parametric binauralizer HRTF handle */
#else
IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */
#endif
);
......
......@@ -242,10 +242,6 @@ void transf_cdbk_enc(
x_tran[i] = (float) ( x_norm[i] );
}
#ifndef FIX_938_GCC_12_WARNINGS
set_f( x_tran + Nsv * WIDTH_BAND, 0.0f, L_SUBFR - WIDTH_BAND * Nsv );
#endif
if ( st->coder_type != INACTIVE && st->core_brate >= MIN_BRATE_AVQ_EXC && st->core_brate <= MAX_BRATE_AVQ_EXC_TD && !harm_flag_acelp )
{
mvr2r( x_tran, code_preQ, L_SUBFR );
......
......@@ -519,22 +519,6 @@ ivas_error ivas_cpe_enc(
* Core codec configuration
*----------------------------------------------------------------*/
#ifndef NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW
/* IGF reconfiguration */
for ( n = 0; n < n_CoreChannels; n++ )
{
if ( ( hCPE->last_element_brate != hCPE->element_brate || hCPE->element_mode != hCPE->last_element_mode || ( hCPE->element_mode == IVAS_CPE_TD && sts[0]->bits_frame_nominal != last_bits_frame_nominal ) || sts[n]->last_bwidth != sts[n]->bwidth ) && ( n == 0 || hCPE->element_mode == IVAS_CPE_MDCT ) )
{
int16_t igf;
igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->rf_mode );
if ( ( error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK )
{
return error;
}
}
}
#endif
if ( hCPE->element_mode == IVAS_CPE_MDCT && st_ivas->hMCT == NULL )
{
/* set coded BW for MDCT stereo */
......@@ -556,7 +540,6 @@ ivas_error ivas_cpe_enc(
}
}
#ifdef NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW
/* IGF reconfiguration */
for ( n = 0; n < n_CoreChannels; n++ )
{
......@@ -570,7 +553,6 @@ ivas_error ivas_cpe_enc(
}
}
}
#endif
/* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */
for ( n = 0; n < n_CoreChannels; n++ )
......
......@@ -275,7 +275,6 @@ ivas_error ivas_enc(
else if ( ivas_format == MASA_ISM_FORMAT )
{
float *data_separated_object;
int16_t idx_separated_object;
int16_t flag_omasa_ener_brate;
......
......@@ -55,7 +55,6 @@
#define ISM_MAX_ELEVATION_DIFF_IDX ( ISM_ELEVATION_NBITS - 1 /*zero*/ - 1 /*sign*/ )
#define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ )
#define ISM_FEC_MAX 10
#define ISM_MD_FEC_DIFF 10
#define ISM_MD_INC_DIFF_CNT_MAX 6
#define ISM_MD_FEC_CNT_MAX 25
......@@ -429,6 +428,7 @@ ivas_error ivas_ism_metadata_enc(
}
idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS );
encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, 0, &flag_abs_azimuth[ch], NULL );
}
else
......@@ -443,6 +443,7 @@ ivas_error ivas_ism_metadata_enc(
idx_angle1_abs = hParamIsm->azi_index[ch];
idx_angle2_abs = hParamIsm->ele_index[ch];
}
encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] );
/*----------------------------------------------------------------*
......
......@@ -45,6 +45,12 @@
#include "wmc_auto.h"
/*-------------------------------------------------------------------------
* Local constants
*------------------------------------------------------------------------*/
#define OMASA_FEC_MAX 5
/*-------------------------------------------------------------------------
* Local function prototypes
*------------------------------------------------------------------------*/
......@@ -133,6 +139,7 @@ ivas_error ivas_omasa_enc_open(
set_zero( hOMasa->broadband_energy_prev, MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS );
hOMasa->prev_selected_object = 0;
hOMasa->changing_object = 0;
hOMasa->since_obj_change_cnt = 0;
input_frame = (int16_t) ( st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC );
for ( i = 0; i < input_frame; i++ )
......@@ -495,6 +502,22 @@ void ivas_omasa_enc(
{
hOMasa->broadband_energy_prev[i] = broadband_energy[i];
}
/* force absolute MD coding in case of change of separated object */
if ( hOMasa->prev_selected_object != selected_object )
{
hOMasa->since_obj_change_cnt = 0;
hIsmMeta[0]->position_angle.angle1_diff_cnt = ISM_FEC_MAX;
}
else
{
hOMasa->since_obj_change_cnt++;
hOMasa->since_obj_change_cnt = min( OMASA_FEC_MAX, hOMasa->since_obj_change_cnt );
if ( hOMasa->since_obj_change_cnt < OMASA_FEC_MAX )
{
hIsmMeta[0]->position_angle.angle1_diff_cnt = ISM_FEC_MAX;
}
}
hOMasa->prev_selected_object = selected_object;
/* Separate the selected object */
......
......@@ -72,7 +72,11 @@ static void ivas_merge_sba_transports(
{
for ( j = 0; j < input_frame; j++ )
{
#ifdef NONBE_FIX_977_OSBA_GAIN_MISMATCH
data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] );
#else
data_out_f[i][j] = ( data_in_f1[i][j] + data_in_f2[i][j] );
#endif
}
}
......@@ -443,7 +447,9 @@ static void ivas_osba_render_ism_to_sba(
int16_t azimuth, elevation;
float gains[MAX_INPUT_CHANNELS];
float g1, g2;
#ifndef NONBE_FIX_977_OSBA_GAIN_MISMATCH
float output_gain;
#endif
int16_t nchan_sba;
......@@ -478,6 +484,7 @@ static void ivas_osba_render_ism_to_sba(
}
/* Gain with loudness-matching gains */
#ifndef NONBE_FIX_977_OSBA_GAIN_MISMATCH
output_gain = 0.7499f;
for ( j = 0; j < nchan_sba; j++ )
{
......@@ -486,6 +493,7 @@ static void ivas_osba_render_ism_to_sba(
data_out_f[j][k] *= output_gain;
}
}
#endif
return;
}
......@@ -788,6 +788,7 @@ typedef struct ivas_omasa_enc_state_structure
float broadband_energy_prev[MAX_NUM_OBJECTS + MASA_MAX_TRANSPORT_CHANNELS];
int16_t prev_selected_object;
uint8_t changing_object;
int16_t since_obj_change_cnt;
float fade_out_gain[L_FRAME48k];
float fade_in_gain[L_FRAME48k];
......
......@@ -69,12 +69,20 @@ ivas_error ivas_hrtf_init(
hHrtf->max_num_iterations = 0;
hHrtf->gain_lfe = 0;
hHrtf->index_frequency_max_diffuse = 0;
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->same_inv_diffuse_weight = 1;
#endif
for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = 0;
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = 0;
#endif
hHrtf->num_iterations[i][j] = 0;
hHrtf->pIndex_frequency_max[i][j] = NULL;
hHrtf->pOut_to_bin_re[i][j] = NULL;
......@@ -90,6 +98,10 @@ ivas_error ivas_hrtf_init(
hHrtf->pOut_to_bin_diffuse_im[j] = NULL;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
hHrtf->init_from_rom = 1;
#endif
return IVAS_ERR_OK;
}
......@@ -207,8 +219,21 @@ static ivas_error ivas_rend_initCrend(
return IVAS_ERR_INTERNAL_FATAL;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( ( hSetOfHRTF == NULL ) ||
( ( hSetOfHRTF->hHRTF_hrir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ||
( ( hSetOfHRTF->hHRTF_hrir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL ) ) ||
( ( hSetOfHRTF->hHRTF_brir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) ||
( ( hSetOfHRTF->hHRTF_hrir_foa == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_FOA ) ) ||
( ( hSetOfHRTF->hHRTF_hrir_hoa2 == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_HOA2 ) ) ||
( ( hSetOfHRTF->hHRTF_hrir_hoa3 == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_HOA3 ) ) )
#else
if ( hSetOfHRTF == NULL )
#endif
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
hHrtf->init_from_rom = 1;
#endif
if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
{
hHrtf->max_num_ir -= 1; /* subtract LFE */
......@@ -347,6 +372,7 @@ static ivas_error ivas_rend_initCrend(
if ( output_Fs == 48000 )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[tmp];
......@@ -355,11 +381,14 @@ static ivas_error ivas_rend_initCrend(
{
hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[tmp];
}
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[j][tmp];
#endif
hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz[tmp][j];
......@@ -367,6 +396,9 @@ static ivas_error ivas_rend_initCrend(
}
else
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[j][tmp];
#endif
hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_48kHz[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz[tmp][j];
......@@ -376,6 +408,7 @@ static ivas_error ivas_rend_initCrend(
}
else if ( output_Fs == 32000 )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[tmp];
......@@ -384,11 +417,14 @@ static ivas_error ivas_rend_initCrend(
{
hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[tmp];
}
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[j][tmp];
#endif
hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz[tmp][j];
......@@ -396,6 +432,9 @@ static ivas_error ivas_rend_initCrend(
}
else
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[j][tmp];
#endif
hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_32kHz[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz[tmp][j];
......@@ -405,6 +444,7 @@ static ivas_error ivas_rend_initCrend(
}
else if ( output_Fs == 16000 )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[tmp];
......@@ -413,11 +453,14 @@ static ivas_error ivas_rend_initCrend(
{
hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[tmp];
}
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[j][tmp];
#endif
hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz[tmp][j];
......@@ -425,6 +468,9 @@ static ivas_error ivas_rend_initCrend(
}
else
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[j][tmp];
#endif
hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_16kHz[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz[tmp][j];
......@@ -450,10 +496,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j];
......@@ -476,10 +526,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j];
......@@ -503,10 +557,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j];
......@@ -537,10 +595,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_48kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz[i][j];
......@@ -563,10 +625,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_32kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz[i][j];
......@@ -590,10 +656,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_16kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz[i][j];
......@@ -624,10 +694,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_48kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz[i][j];
......@@ -650,10 +724,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_32kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz[i][j];
......@@ -677,10 +755,14 @@ static ivas_error ivas_rend_initCrend(
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz[j][i];
#endif
hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_16kHz[i][j];
hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[i][j];
hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz[i][j];
......@@ -713,6 +795,9 @@ static ivas_error ivas_rend_initCrend(
}
else
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
hHrtf->init_from_rom = 0;
#endif
if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
{
hHrtf->max_num_ir -= 1; /* subtract LFE */
......@@ -720,12 +805,24 @@ static ivas_error ivas_rend_initCrend(
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( hSetOfHRTF->hHRTF_brir_combined == NULL )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " );
}
#endif
hHrtf->latency_s = hSetOfHRTF->hHRTF_brir_combined->latency_s;
hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_brir_combined->max_num_iterations;
hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_brir_combined->index_frequency_max_diffuse;
}
else
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( hSetOfHRTF->hHRTF_hrir_combined == NULL )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters" );
}
#endif
hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_combined->latency_s;
hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_combined->max_num_iterations;
hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_combined->index_frequency_max_diffuse;
......@@ -775,7 +872,7 @@ static ivas_error ivas_rend_initCrend(
{
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" );
}
#ifndef FIX_INV_DIFFUSE_WEIGHT
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight[tmp];
......@@ -784,11 +881,15 @@ static ivas_error ivas_rend_initCrend(
{
hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_combined->inv_diffuse_weight[tmp];
}
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight[j][tmp];
#endif
hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_re[tmp][j];
......@@ -796,6 +897,9 @@ static ivas_error ivas_rend_initCrend(
}
else
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = hSetOfHRTF->hHRTF_hrir_combined->inv_diffuse_weight[j][tmp];
#endif
hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_combined->num_iterations[tmp][j];
hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pIndex_frequency_max[tmp][j];
hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_re[tmp][j];
......@@ -808,16 +912,26 @@ static ivas_error ivas_rend_initCrend(
{
if ( inConfig == IVAS_AUDIO_CONFIG_HOA3 )
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( hSetOfHRTF->hHRTF_hrir_hoa3 == NULL )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters" );
}
#endif
hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa3->latency_s;
hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa3->max_num_iterations;
hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa3->index_frequency_max_diffuse;
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_hoa3->inv_diffuse_weight[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = hSetOfHRTF->hHRTF_hrir_hoa3->inv_diffuse_weight[j][i];
#endif
hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->num_iterations[i][j];
hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pIndex_frequency_max[i][j];
hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_re[i][j];
......@@ -834,16 +948,26 @@ static ivas_error ivas_rend_initCrend(
}
else if ( inConfig == IVAS_AUDIO_CONFIG_HOA2 )
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( hSetOfHRTF->hHRTF_hrir_hoa2 == NULL )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters" );
}
#endif
hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa2->latency_s;
hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa2->max_num_iterations;
hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa2->index_frequency_max_diffuse;
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_hoa2->inv_diffuse_weight[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = hSetOfHRTF->hHRTF_hrir_hoa2->inv_diffuse_weight[j][i];
#endif
hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->num_iterations[i][j];
hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pIndex_frequency_max[i][j];
hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_re[i][j];
......@@ -860,16 +984,26 @@ static ivas_error ivas_rend_initCrend(
}
else if ( inConfig == IVAS_AUDIO_CONFIG_FOA )
{
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( hSetOfHRTF->hHRTF_hrir_foa == NULL )
{
return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters" );
}
#endif
hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_foa->latency_s;
hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_foa->max_num_iterations;
hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_foa->index_frequency_max_diffuse;
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
#ifndef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_foa->inv_diffuse_weight[i];
#endif
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->inv_diffuse_weight[j][i] = hSetOfHRTF->hHRTF_hrir_foa->inv_diffuse_weight[j][i];
#endif
hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_foa->num_iterations[i][j];
hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pIndex_frequency_max[i][j];
hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_re[i][j];
......@@ -891,6 +1025,20 @@ static ivas_error ivas_rend_initCrend(
}
}
#ifdef FIX_INV_DIFFUSE_WEIGHT
hHrtf->same_inv_diffuse_weight = 1;
for ( i = 0; i < hHrtf->max_num_ir; i++ )
{
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
if ( hHrtf->inv_diffuse_weight[0][i] != hHrtf->inv_diffuse_weight[1][i] )
{
hHrtf->same_inv_diffuse_weight = 0;
}
}
}
#endif
pCrend->hHrtfCrend = hHrtf;
return IVAS_ERR_OK;
......@@ -1175,8 +1323,15 @@ ivas_error ivas_rend_initCrendWrapper(
hCrend->prev_out_buffer[i] = NULL;
}
#ifdef FIX_INV_DIFFUSE_WEIGHT
hCrend->freq_buffer_re_diffuse[0] = NULL;
hCrend->freq_buffer_re_diffuse[1] = NULL;
hCrend->freq_buffer_im_diffuse[0] = NULL;
hCrend->freq_buffer_im_diffuse[1] = NULL;
#else
hCrend->freq_buffer_re_diffuse = NULL;
hCrend->freq_buffer_im_diffuse = NULL;
#endif
hCrend->hReverb = NULL;
hCrend->reflections = NULL;
hCrend->delay_line_rw_index = 0;
......@@ -1320,22 +1475,81 @@ ivas_error ivas_rend_openCrend(
if ( max_total_ir_len > 0 )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
if ( ( hCrend->freq_buffer_re_diffuse[0] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
}
if ( hHrtf->same_inv_diffuse_weight == 0 )
{
if ( ( hCrend->freq_buffer_re_diffuse[1] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
}
}
else
{
hCrend->freq_buffer_re_diffuse[1] = NULL;
}
#else
if ( ( hCrend->freq_buffer_re_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
}
#endif
#ifdef FIX_INV_DIFFUSE_WEIGHT
set_zero_l( hCrend->freq_buffer_re_diffuse[0], max_total_ir_len );
if ( hCrend->freq_buffer_re_diffuse[1] != NULL )
{
set_zero_l( hCrend->freq_buffer_re_diffuse[1], max_total_ir_len );
}
#else
set_zero_l( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
#endif
#ifdef FIX_INV_DIFFUSE_WEIGHT
if ( ( hCrend->freq_buffer_im_diffuse[0] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
}
if ( hHrtf->same_inv_diffuse_weight == 0 )
{
if ( ( hCrend->freq_buffer_im_diffuse[1] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
}
}
else
{
hCrend->freq_buffer_im_diffuse[1] = NULL;
}
#else
if ( ( hCrend->freq_buffer_im_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
}
#endif
#ifdef FIX_INV_DIFFUSE_WEIGHT
set_zero_l( hCrend->freq_buffer_im_diffuse[0], max_total_ir_len );
if ( hCrend->freq_buffer_im_diffuse[1] != NULL )
{
set_zero_l( hCrend->freq_buffer_im_diffuse[1], max_total_ir_len );
}
#else
set_zero_l( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
#endif
}
else
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
hCrend->freq_buffer_re_diffuse[0] = NULL;
hCrend->freq_buffer_im_diffuse[0] = NULL;
hCrend->freq_buffer_re_diffuse[1] = NULL;
hCrend->freq_buffer_im_diffuse[1] = NULL;
#else
hCrend->freq_buffer_re_diffuse = NULL;
hCrend->freq_buffer_im_diffuse = NULL;
#endif
}
max_total_ir_len = (int16_t) ( hHrtf->latency_s * output_Fs + 0.5f ) + subframe_length;
......@@ -1483,7 +1697,31 @@ void ivas_rend_closeCrend(
free( hCrend->lfe_delay_line );
hCrend->lfe_delay_line = NULL;
}
#ifdef FIX_INV_DIFFUSE_WEIGHT
if ( hCrend->freq_buffer_re_diffuse[0] != NULL )
{
free( hCrend->freq_buffer_re_diffuse[0] );
hCrend->freq_buffer_re_diffuse[0] = NULL;
}
if ( hCrend->freq_buffer_im_diffuse[0] != NULL )
{
free( hCrend->freq_buffer_im_diffuse[0] );
hCrend->freq_buffer_im_diffuse[0] = NULL;
}
if ( hCrend->freq_buffer_re_diffuse[1] != NULL )
{
free( hCrend->freq_buffer_re_diffuse[1] );
hCrend->freq_buffer_re_diffuse[1] = NULL;
}
if ( hCrend->freq_buffer_im_diffuse[1] != NULL )
{
free( hCrend->freq_buffer_im_diffuse[1] );
hCrend->freq_buffer_im_diffuse[1] = NULL;
}
#else
if ( hCrend->freq_buffer_re_diffuse != NULL )
{
free( hCrend->freq_buffer_re_diffuse );
......@@ -1495,6 +1733,7 @@ void ivas_rend_closeCrend(
free( hCrend->freq_buffer_im_diffuse );
hCrend->freq_buffer_im_diffuse = NULL;
}
#endif
if ( hCrend->hTrack != NULL )
{
......@@ -1592,6 +1831,9 @@ static ivas_error ivas_rend_crendConvolver(
int16_t nchan_in, nchan_out;
const float *pIn;
float *pFreq_buf_re, *pFreq_buf_im;
#ifdef FIX_INV_DIFFUSE_WEIGHT
float *pFreq_buf2_re, *pFreq_buf2_im;
#endif
const float *pFreq_filt_re, *pFreq_filt_im;
float pOut[L_FRAME48k * 2];
float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k];
......@@ -1634,8 +1876,18 @@ static ivas_error ivas_rend_crendConvolver(
if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
set_zero( &hCrend->freq_buffer_re_diffuse[0][offset_diffuse], subframe_length );
set_zero( &hCrend->freq_buffer_im_diffuse[0][offset_diffuse], subframe_length );
if ( pCrend->hHrtfCrend->same_inv_diffuse_weight == 0 )
{
set_zero( &hCrend->freq_buffer_re_diffuse[1][offset_diffuse], subframe_length );
set_zero( &hCrend->freq_buffer_im_diffuse[1][offset_diffuse], subframe_length );
}
#else
set_zero( &hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length );
set_zero( &hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length );
#endif
}
i = 0;
......@@ -1644,6 +1896,41 @@ static ivas_error ivas_rend_crendConvolver(
pIn = &pcm_in[idx_in][i_ts * subframe_length];
if ( idx_in != lfe_idx_in )
{
#ifdef FIX_INV_DIFFUSE_WEIGHT
if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
{
if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
{
pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
pFreq_filt_re = &hCrend->freq_buffer_re[i][offset];
pFreq_filt_im = &hCrend->freq_buffer_im[i][offset];
for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ )
{
pFreq_buf_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
}
}
else
{
pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
pFreq_buf2_re = &hCrend->freq_buffer_re_diffuse[1][offset_diffuse];
pFreq_buf2_im = &hCrend->freq_buffer_im_diffuse[1][offset_diffuse];
pFreq_filt_re = &hCrend->freq_buffer_re[i][offset];
pFreq_filt_im = &hCrend->freq_buffer_im[i][offset];
for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ )
{
pFreq_buf_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
pFreq_buf2_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[1][i];
pFreq_buf2_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[1][i];
}
}
}
#else
if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
{
pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[offset_diffuse];
......@@ -1657,6 +1944,7 @@ static ivas_error ivas_rend_crendConvolver(
pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[i];
}
}
#endif
pFreq_buf_re = &hCrend->freq_buffer_re[i][offset];
pFreq_buf_im = &hCrend->freq_buffer_im[i][offset];
......@@ -1704,8 +1992,21 @@ static ivas_error ivas_rend_crendConvolver(
offset_diffuse = ( hCrend->diffuse_delay_line_rw_index + m + 1 );
offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0];
offset_diffuse = offset_diffuse * subframe_length;
#ifdef FIX_INV_DIFFUSE_WEIGHT
if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
{
pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
}
else
{
pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[j][offset_diffuse];
pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[j][offset_diffuse];
}
#else
pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[offset_diffuse];
pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[offset_diffuse];
#endif
pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re[j][offset];
pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im[j][offset];
......@@ -1738,149 +2039,6 @@ static ivas_error ivas_rend_crendConvolver(
return IVAS_ERR_OK;
}
#ifndef FIX_911_REMOVE_CREND_DUPLICATION
/*-----------------------------------------------------------------------------------------*
* Function ivas_rend_crendProcess()
*
* Process call for IVAS Crend renderer
*-----------------------------------------------------------------------------------------*/
ivas_error ivas_rend_crendProcess(
const CREND_WRAPPER *pCrend,
const AUDIO_CONFIG inConfig,
const AUDIO_CONFIG outConfig,
DECODER_CONFIG_HANDLE hDecoderConfig,
COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
EFAP_HANDLE hEFAPdata,
float *output[], /* i/o: input/output audio channels */
const int32_t output_Fs,
#ifdef SPLIT_REND_WITH_HEAD_ROT
const int16_t num_subframes /* i : number of subframes to render */,
const int16_t pos_idx
#else
const int16_t num_subframes /* i : number of subframes to render */
#endif
)
{
int16_t i, subframe_idx, subframe_len;
int16_t nchan_out;
float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k];
float *p_pcm_tmp[BINAURAL_CHANNELS];
IVAS_REND_AudioConfigType inConfigType;
int8_t combinedOrientationEnabled;
ivas_error error;
CREND_HANDLE hCrend;
#ifdef SPLIT_REND_WITH_HEAD_ROT
hCrend = pCrend->hCrend[pos_idx];
#else
hCrend = pCrend->hCrend;
#endif
combinedOrientationEnabled = 0;
if ( hCombinedOrientationData != NULL )
{
for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ )
{
if ( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 )
{
combinedOrientationEnabled = 1;
break;
}
}
}
push_wmops( "ivas_rend_crendProcess" );
inConfigType = getAudioConfigType( inConfig );
if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK )
{
return error;
}
subframe_len = (int16_t) ( output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) );
for ( i = 0; i < BINAURAL_CHANNELS; i++ )
{
p_pcm_tmp[i] = pcm_tmp[i];
}
for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ )
{
/* Early Reflections */
if ( hCrend->reflections != NULL )
{
if ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 )
{
if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output, inConfig ) ) != IVAS_ERR_OK )
{
return error;
}
}
}
if ( hDecoderConfig && combinedOrientationEnabled )
{
/* Orientation tracking */
/* Rotation in SHD for:
MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL
SBA SPAR -> BINAURAL or BINAURAL_ROOM
*/
if ( inConfig == IVAS_AUDIO_CONFIG_FOA || inConfig == IVAS_AUDIO_CONFIG_HOA2 || inConfig == IVAS_AUDIO_CONFIG_HOA3 )
{
rotateFrame_shd( hCombinedOrientationData, output, subframe_len, *hIntSetup, subframe_idx );
}
/* Rotation in SD for MC -> BINAURAL_ROOM */
else if ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup )
{
rotateFrame_sd( hCombinedOrientationData, output, subframe_len, *hIntSetup, hEFAPdata, subframe_idx );
}
}
if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED || inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, p_pcm_tmp, output_Fs, subframe_idx, pos_idx ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, p_pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
if ( hCrend->hReverb != NULL )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_reverb_process( pCrend->hCrend[pos_idx]->hReverb, inConfig, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, inConfig, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
}
/* update combined orientation access index */
ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len );
}
else
{
return IVAS_ERR_INVALID_INPUT_FORMAT;
}
}
/* move to output */
for ( i = 0; i < nchan_out; i++ )
{
mvr2r( pcm_tmp[i], output[i], num_subframes * subframe_len );
}
pop_wmops();
return IVAS_ERR_OK;
}
#endif
/*-----------------------------------------------------------------------------------------*
* Function ivas_rend_crendProcessSubframe()
......@@ -1955,10 +2113,8 @@ ivas_error ivas_rend_crendProcessSubframe(
p_pcm_tmp[ch] = pcm_tmp[ch];
}
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
if ( hTcBuffer != NULL )
{
#endif
slot_size = hTcBuffer->n_samples_granularity;
/* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
......@@ -1971,7 +2127,6 @@ ivas_error ivas_rend_crendProcessSubframe(
slots_to_render -= hTcBuffer->subframe_nbslots[last_sf];
last_sf++;
}
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
subframe_len = -1; /* will be set later */
}
else
......@@ -1980,18 +2135,13 @@ ivas_error ivas_rend_crendProcessSubframe(
first_sf = 0;
last_sf = n_samples_to_render / subframe_len;
}
#endif
for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
{
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
if ( hTcBuffer != NULL )
{
#endif
subframe_len = hTcBuffer->subframe_nbslots[subframe_idx] * hTcBuffer->n_samples_granularity;
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
}
#endif
/* Early Reflections */
if ( hCrend->reflections != NULL )
......@@ -2061,14 +2211,10 @@ ivas_error ivas_rend_crendProcessSubframe(
p_pcm_tmp[ch] += subframe_len;
}
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
if ( hTcBuffer != NULL )
{
#endif
hTcBuffer->slots_rendered += hTcBuffer->subframe_nbslots[subframe_idx];
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
}
#endif
}
else
{
......@@ -2085,14 +2231,10 @@ ivas_error ivas_rend_crendProcessSubframe(
mvr2r( pcm_tmp[ch], output[ch], n_samples_to_render );
}
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
if ( hTcBuffer != NULL )
{
#endif
hTcBuffer->subframes_rendered = last_sf;
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
}
#endif
pop_wmops();
......@@ -2201,12 +2343,8 @@ ivas_error ivas_rend_crendProcessSplitBin(
mvr2r( hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 );
}
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
if ( ( error = ivas_rend_crendProcessSubframe( pCrend, inConfig, outConfig, hDecoderConfig, pCombinedOrientationDataLocal, hIntSetup, hEFAPdata,
NULL, p_tmpInputBuffer, p_tmpInputBuffer, output_frame, output_Fs, pos_idx ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_rend_crendProcess( pCrend, inConfig, outConfig, hDecoderConfig, pCombinedOrientationDataLocal, hIntSetup, hEFAPdata, p_tmpInputBuffer, output_Fs, hCombinedOrientationData->num_subframes, pos_idx ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......
......@@ -54,6 +54,10 @@ ivas_error ivas_HRTF_binary_open(
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" );
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
set_c( (int8_t *) ( *hHrtfTD ), 0, (int32_t) sizeof( TDREND_HRFILT_FiltSet_t ) );
#endif
return IVAS_ERR_OK;
}
......@@ -183,6 +187,10 @@ ivas_error ivas_HRTF_parambin_binary_open(
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" );
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
set_c( (int8_t *) ( *hHrtfParambin ), 0, (int32_t) sizeof( HRTFS_PARAMBIN ) );
#endif
return IVAS_ERR_OK;
}
......
......@@ -672,7 +672,11 @@ ivas_error ivas_td_binaural_open_ext(
directivity = hRendCfg->directivity;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
return ivas_td_binaural_open_unwrap( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, 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
}
......
......@@ -38,6 +38,9 @@
#include "ivas_error.h"
#include "wmc_auto.h"
#include "ivas_rom_rend.h"
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
#include "ivas_rom_binaural_crend_head.h"
#endif
#ifdef DEBUGGING
#include "debug.h"
#endif
......@@ -144,7 +147,11 @@ void TDREND_MIX_Dealloc(
hBinRendererTd->Listener_p = NULL;
}
/* Dealloc HR filter set */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( ( *hBinRendererTd->pHrFiltSet_p != NULL ) && ( hBinRendererTd->HrFiltSet_p != NULL ) )
#else
if ( hBinRendererTd->HrFiltSet_p != NULL )
#endif
{
if ( hBinRendererTd->HrFiltSet_p->FilterMethod == TDREND_HRFILT_Method_BSplineModel )
{
......@@ -174,8 +181,17 @@ void TDREND_MIX_Dealloc(
}
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
if ( hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == 1 )
{
free( hBinRendererTd->HrFiltSet_p );
hBinRendererTd->HrFiltSet_p = NULL;
*hBinRendererTd->pHrFiltSet_p = NULL;
}
#else
free( hBinRendererTd->HrFiltSet_p );
hBinRendererTd->HrFiltSet_p = NULL;
#endif
}
return;
......@@ -239,6 +255,10 @@ ivas_error TDREND_MIX_Init(
hBinRendererTd->HrFiltSet_p = *hHrtfTD;
}
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
hBinRendererTd->pHrFiltSet_p = hHrtfTD;
#endif
if ( hBinRendererTd->HrFiltSet_p->SampleRate != output_Fs )
{
return ( IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "The sampling rate for the HR filter set does not match the output sampling rate.\n" ) );
......
......@@ -545,7 +545,7 @@ ivas_error ivas_orient_trk_SetReferenceVector(
case IVAS_HEAD_ORIENT_TRK_REF:
case IVAS_HEAD_ORIENT_TRK_AVG:
case IVAS_HEAD_ORIENT_TRK_REF_VEC:
acousticFrontVector = VectorSubtract( listenerPos, refPos );
acousticFrontVector = VectorSubtract( refPos, listenerPos );
break;
case IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV:
/* ignore the height difference between listener position and reference position */
......@@ -554,7 +554,7 @@ ivas_error ivas_orient_trk_SetReferenceVector(
listenerPosLevel.y = listenerPos.y;
refPosLevel.x = refPos.x;
refPosLevel.y = refPos.y;
acousticFrontVector = VectorSubtract( listenerPosLevel, refPosLevel );
acousticFrontVector = VectorSubtract( refPosLevel, listenerPosLevel );
break;
default:
return IVAS_ERR_WRONG_PARAMS;
......@@ -568,7 +568,7 @@ ivas_error ivas_orient_trk_SetReferenceVector(
return IVAS_ERR_WRONG_PARAMS;
}
ivasForwardVector.x = -1.0f;
ivasForwardVector.x = 1.0f;
ivasForwardVector.y = 0.0f;
ivasForwardVector.z = 0.0f;
VectorRotationToQuaternion( ivasForwardVector, acousticFrontVector, &pOTR->refRot );
......
......@@ -918,26 +918,6 @@ ivas_error ivas_rend_initCrendWrapper(
#endif
);
#ifndef FIX_911_REMOVE_CREND_DUPLICATION
ivas_error ivas_rend_crendProcess(
const CREND_WRAPPER *pCrend,
const AUDIO_CONFIG inConfig,
const AUDIO_CONFIG outConfig,
DECODER_CONFIG_HANDLE hDecoderConfig,
COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
EFAP_HANDLE hEFAPdata,
float *output[], /* i/o: input/output audio channels */
const int32_t output_Fs,
#ifdef SPLIT_REND_WITH_HEAD_ROT
const int16_t num_subframes, /* i : number of subframes to render */
const int16_t pos_idx /* i : pose index */
#else
const int16_t num_subframes /* i : number of subframes to render */
#endif
);
#endif
ivas_error ivas_rend_crendProcessSubframe(
const CREND_WRAPPER *pCrend, /* i/o: Crend wrapper handle */
const AUDIO_CONFIG inConfig, /* i : input audio configuration */
......@@ -1587,7 +1567,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
float *output[],
const int16_t low_res_pre_rend_rot,
const int16_t cldfb_in_flag,
const int16_t pcm_out_flag
const int16_t pcm_out_flag,
const int16_t ro_md_flag
);
void ivas_rend_CldfbSplitPreRendProcess(
......@@ -1598,7 +1579,8 @@ void ivas_rend_CldfbSplitPreRendProcess(
float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
IVAS_SPLIT_REND_BITS_HANDLE pBits,
const int32_t target_md_bits,
const int16_t low_res_pre_rend_rot
const int16_t low_res_pre_rend_rot,
const int16_t ro_md_flag
);
void ivas_rend_CldfbSplitPostRendProcess(
......@@ -1677,7 +1659,8 @@ void ivas_SplitRenderer_GetRotMd(
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
const int16_t low_res
const int16_t low_res,
const int16_t ro_md_flag
);
void ivas_SplitRenderer_PostRenderer(
......
......@@ -59,10 +59,17 @@ static uint16_t LC_mixing_7_1[7] = { 0, 1, 2, 3, 4, 3, 4 };
static uint16_t LC_mixing_5_1_2[7] = { 0, 1, 2, 3, 4, 0, 1 };
#ifdef NONBE_FIX_935_EARLY_REFLECTIONS_WRONG_ORDER
static uint16_t LC_mixing_5_1_4[9] = { 0, 1, 2, 3, 4, 0, 1, 3, 4 };
#else
static uint16_t LC_mixing_5_1_4[9] = { 0, 1, 2, 3, 4, 0, 1, 2, 3 };
#endif
#ifdef NONBE_FIX_935_EARLY_REFLECTIONS_WRONG_ORDER
static uint16_t LC_mixing_7_1_4[11] = { 0, 1, 2, 3, 4, 3, 4, 0, 1, 3, 4 };
#else
static uint16_t LC_mixing_7_1_4[11] = { 0, 1, 2, 3, 4, 3, 4, 0, 1, 2, 3 };
#endif
/*-----------------------------------------------------------------------------------------*
* Function ivas_er_init()
......
......@@ -714,6 +714,14 @@ void ivas_reverb_get_hrtf_set_properties(
const float norm_freq = out_freq_step * out_bin_idx;
/* Computing the bin index in the source data */
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
if ( in_freq_count == out_freq_count )
{
base_idx = out_bin_idx;
}
else
{
#endif
const float tbl_index = ( norm_freq - inp_freq_offset ) / inp_freq_step;
if ( tbl_index <= 0.0f ) /* In case of extrapolation (below 1st bin), choose nearest */
......@@ -731,6 +739,9 @@ void ivas_reverb_get_hrtf_set_properties(
relative_pos = 1.0f;
}
}
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
}
#endif
/* Computing 2 bins data for later interpolation */
......