diff --git a/apps/decoder.c b/apps/decoder.c index 4ceb112ff49150d6207ba095e3d54bb44e17e534..8c7c2c99f34f11aa7edd2eb8ea32f35081684a87 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -447,6 +447,14 @@ int main( fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); goto cleanup; } +#ifdef IVAS_FLOAT_FIXED + FOR( Word16 i = 0; i < 4; i++ ) + { + renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) ); + renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) ); + renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( 1u << 15 ) ); + } +#endif // IVAS_FLOAT_FIXED if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { @@ -622,7 +630,7 @@ cleanup: destroy_SetOfHRTF( hSetOfHRTF ); } - IVAS_DEC_Close( &hIvasDec ); + IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); RotationFileReader_close( &headRotReader ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index acbce6db694cf4de48777e405cc648749db0dfbe..a786807cb085dd751b6621a6ff42fc4c15ddff8e 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1859,7 +1859,7 @@ typedef enum #define ER_RADIUS_FX (1* ONE_IN_Q30) //Q2.30 #define ER_LIST_ORIGIN_X_FX (0) #define ER_LIST_ORIGIN_Y_FX (0) -#define ER_LIST_HEIGHT_FX (1.6 *ONE_IN_Q22) //Q.22 +#define ER_LIST_HEIGHT_FX (6710886) /* 1.6 in Q.22 */ #endif // IVAS_FLOAT_FIXED diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index 55e47f45308a8132da7610641563d1215594649d..74868513059e2b90f0aba9066e9c6ec0ad4b7f93 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -406,6 +406,12 @@ static int16_t decode_indexes_ivas_fx( { // set_f(x_lvq, 0.0f, 2 * LATTICE_DIM); set_s( x_lvq, 0, 2 * LATTICE_DIM ); +#ifdef MSAN_FIX + scales_mslvq[0] = 0; + move16(); + scales_mslvq[1] = 0; + move16(); +#endif index[i] = 0; return 1; } @@ -430,6 +436,10 @@ static int16_t decode_indexes_ivas_fx( { // x_lvq[i] = 0.0; x_lvq[i] = 0; +#ifdef MSAN_FIX + scales_mslvq[0] = 0; + move16(); +#endif } } else @@ -439,6 +449,12 @@ static int16_t decode_indexes_ivas_fx( /* safety check in case of bit errors */ // set_f(x_lvq, 0.0f, 2 * LATTICE_DIM); set_s( x_lvq, 0, 2 * LATTICE_DIM ); +#ifdef MSAN_FIX + scales_mslvq[0] = 0; + move16(); + scales_mslvq[1] = 0; + move16(); +#endif return 1; } @@ -476,6 +492,10 @@ static int16_t decode_indexes_ivas_fx( // x_lvq[i] = 0.0; x_lvq[i] = 0; } +#ifdef MSAN_FIX + scales_mslvq[1] = 0; + move16(); +#endif } else { diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 078ec95e4c918c72fa03ba461596f2fa526f6dab..e3d00c4f5c6c4593522c392d58652a4610d17fd0 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1681,10 +1681,16 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real); } Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1) +#ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1); +#endif cldfbSynthesis_ivas_fx(realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn); +#ifdef MSAN_FIX + Scale_sig32(synth_fx, output_frame, -(Q_real - 1)); +#else Scale_sig32(synth_fx, L_FRAME48k, -(Q_real - 1)); +#endif Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1)); //Q10 } @@ -1879,7 +1885,11 @@ ivas_error acelp_core_dec_ivas_fx( if (save_hb_synth_fx16) { Copy_Scale_sig_32_16(save_hb_synth_fx, save_hb_synth_fx16, L_FRAME48k, 0); } +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_fx, synth_fx16, output_frame, 0); +#else Copy_Scale_sig_32_16(synth_fx, synth_fx16, L_FRAME48k, 0); +#endif if (st->hFdCngDec) { st->hFdCngDec->hFdCngCom->A_cng[0] = ONE_IN_Q12; diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index d033fdef08cb32da075f2a45dce31d71c29e6f9d..ffcbef5120bbbf29052fd2a89a31374762a6db41 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -956,7 +956,9 @@ void ivas_hq_core_dec_fx( index = tcx_cfg->tcx_last_overlap_mode; move16(); +#ifndef MSAN_FIX Copy_Scale_sig_32_16( wtda_audio, wtda_audio_16, 2 * L_FRAME48k, -13 ); +#endif /* LB synthesis */ E_audio = 31 - Q_audio; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 25e7078cbfeae675676bb5a3e3f5d2afbaab5457..fd83492fd092efe9383e9917f646e05bab152878 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -555,7 +555,11 @@ ivas_error ivas_core_dec( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32(output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_output); +#ifdef MSAN_FIX + Scale_sig(synth_16_fx[n], output_frame, -Q_synth); +#else Scale_sig(synth_16_fx[n], L_FRAME48k, -Q_synth); +#endif Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED @@ -697,8 +701,13 @@ ivas_error ivas_core_dec( } } +#ifdef MSAN_FIX + Scale_sig( synth_16_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX, e_sig - 15 ); + Scale_sig( synth_16_fx[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX, e_sig - 15 ); +#else Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); Scale_sig(synth_16_fx[1],L_FRAME48k,e_sig - 15); +#endif #endif } } @@ -927,7 +936,11 @@ ivas_error ivas_core_dec( } /*-------------------cldfb-end---------------------------*/ +#ifdef MSAN_FIX + Scale_sig(synth_16_fx[n], output_frame, negate(Q_synth)); +#else Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); +#endif IF(st->hHQ_core != NULL) { @@ -1096,7 +1109,11 @@ ivas_error ivas_core_dec( Word16 synth_fxl[960]; /* Q-2 */ Word16 q = 2; Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -(Q11 + q)); +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, output_frame, -(Q11 + q)); +#else Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, L_FRAME48k, -(Q11 + q)); +#endif Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, (Q8 - st->prev_Q_bwe_syn)); Scale_sig32(st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, (st->prev_Q_bwe_syn2 - Q11)); Copy_Scale_sig_32_16(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, 2 * ALLPASSSECTIONS_STEEP, (st->prev_Q_bwe_syn2 - Q11)); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 8ca1cca1b45b9831bbe33daa84b9a48db85de7d2..4923fa24181ecd62da743785391e1634f489993b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -5394,6 +5394,17 @@ void ivas_dirac_dec_render_sf_fx( size = hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands; size_ho = ( hodirac_flag ) ? size * DIRAC_HO_NUMSECTORS : size; +#ifdef MSAN_FIX + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + } +#else IF( hDirACRend->hOutSetup.is_loudspeaker_setup && hDirACRend->hoa_decoder != NULL ) { FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) @@ -5436,6 +5447,7 @@ void ivas_dirac_dec_render_sf_fx( } #endif } +#endif hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); @@ -5591,6 +5603,17 @@ void ivas_dirac_dec_render_sf_fx( #endif #ifdef IVAS_FLOAT_FIXED +#ifdef MSAN_FIX + FOR( ch = 0; ch < nchan_transport; ch++ ) + { + floatToFixed_arrL( Cldfb_RealBuffer[ch][0], Cldfb_RealBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( Cldfb_ImagBuffer[ch][0], Cldfb_ImagBuffer_fx[ch][0], + Q6, + hSpatParamRendCom->num_freq_bands ); + } +#else FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) @@ -5603,6 +5626,7 @@ void ivas_dirac_dec_render_sf_fx( hSpatParamRendCom->num_freq_bands ); } } +#endif hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q = Q31; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0e9a1d5289a8cfd73ba3be3d006fdffad409d5e8..79a4cb73505fb75cf629ae6d505415e9abf319e7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -70,34 +70,6 @@ ivas_error ivas_dec_setup( Word16 *data /* o : output synthesis signal */ ) { -#ifdef IVAS_FLOAT_FIXED/*TODO:To be removed later*/ - RENDER_CONFIG_DATA *hRendCfg = st_ivas->hRenderConfig; - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif Word16 k, idx, num_bits_read; Word16 nchan_ism, element_mode_flag; Decoder_State *st; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index f0cb016a49fb3ec5b0c93dc916f5ca794f03cbf4..89128520fa47b6f64f72d8de78777fc2cfd9119d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -636,7 +636,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { +#ifndef MSAN_FIX_ scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); +#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; } @@ -654,7 +656,14 @@ ivas_error ivas_jbm_dec_tc( scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; } +#ifdef MSAN_FIX + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + { + Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), hCPE->q_prev_synth_fx - 11 ); + } +#else Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), hCPE->q_prev_synth_fx - 11 ); +#endif ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, st_ivas->ivas_format == MC_FORMAT ); @@ -662,7 +671,14 @@ ivas_error ivas_jbm_dec_tc( { Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); } +#ifdef MSAN_FIX + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) + { + Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), 11 - hCPE->q_prev_synth_fx ); + } +#else Scale_sig32( &hCPE->prev_synth_fx[0][0], sizeof( hCPE->prev_synth_fx ) / sizeof( hCPE->prev_synth_fx[0][0] ), 11 - hCPE->q_prev_synth_fx ); +#endif scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(Q11, hCPE->hStereoDft->q_dft)); FOR( i = 0; i < CPE_CHANNELS; ++i ) @@ -678,7 +694,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { +#ifndef MSAN_FIX_ scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); +#endif scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index de9b4c93219e0da7a961ee515e3ace26a117a4dd..9bccd4b8117ea1c0b49db103ccc2a1f3a9dfa721 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -576,7 +576,11 @@ ivas_error ivas_mct_dec_fx( Copy_Scale_sig_16_32(synth_fx[n], synth_fx_32[n], L_FRAME48k, sub(Q11, 0)); Copy_Scale_sig_16_32(hCPE->hCoreCoder[n]->hHQ_core->old_out_fx, hCPE->hCoreCoder[n]->hHQ_core->oldOut_fx, output_frame, Q11); ivas_post_proc_fx( NULL, hCPE, n, synth_fx_32[n], NULL, output_frame, 1 ); +#ifdef MSAN_FIX + Copy_Scale_sig_32_16(synth_fx_32[n], synth_fx[n], output_frame, sub(0, Q11)); +#else Copy_Scale_sig_32_16(synth_fx_32[n], synth_fx[n], L_FRAME48k, sub(0, Q11)); +#endif } @@ -3212,31 +3216,6 @@ static ivas_error ivas_mc_dec_reconfig( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s, 31 ); hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa2->latency_s, 31 ); } - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } #endif // 1 if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index d13d7eab92344e587ade8b64d4a064ecd99b8962..2d0aa25e53cfc9c576f3e35c0c91cdaf501e82df 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1264,7 +1264,11 @@ void ivas_sba_dirac_stereo_dec_fx( q_dft[0] = hCPE->hStereoDft->q_dft; q_dft[1] = hCPE->hStereoDft->q_dft; +#ifdef MSAN_FIX + Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); +#else Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); +#endif IF( hSCE != NULL ) { Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) ); @@ -1373,7 +1377,11 @@ void ivas_sba_dirac_stereo_dec_fx( set_val_Word32( output[ch], 0, output_frame ); } +#ifdef MSAN_FIX + Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); +#else Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); +#endif IF( hSCE != NULL ) { Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_fx2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), ( Q11 - hCPE->hStereoDft->q_dft ) ); diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 5b479f344deb81c9b2b5aee4de8a16eaa2b89ecb..07119019b40c348fc31d257b261c724927b4a001 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -272,7 +272,7 @@ void ivas_mc2sba_fx( return; } -#endif // IVAS_FLOAT_FIXED +#else void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ @@ -349,7 +349,7 @@ void ivas_mc2sba( return; } - +#endif /*-------------------------------------------------------------------------* * ivas_param_mc_mc2sba_cldfb() diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index ef3222b475d74dacc6c16530f9c7629abe177bde..1e250a383e674158cf5632503d660018b78bba2f 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -3237,6 +3237,16 @@ void ivas_spar_dec_upmixer_sf_fx( } } } +#ifdef MSAN_FIX + FOR( out_ch = 0; out_ch < st_ivas->hOutSetup.nchan_out_woLFE; out_ch++ ) + { + FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + floatToFixed_arrL( cldfb_in_ts_re[out_ch][ts], cldfb_in_ts_re_fx[out_ch][ts], Q6, num_cldfb_bands ); + floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, num_cldfb_bands ); + } + } +#else FOR( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) @@ -3245,6 +3255,7 @@ void ivas_spar_dec_upmixer_sf_fx( floatToFixed_arrL( cldfb_in_ts_im[out_ch][ts], cldfb_in_ts_im_fx[out_ch][ts], Q6, 60 ); } } +#endif /*------------------------------------------------------------------ends*/ IF ( st_ivas->hDirAC != NULL ) { diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index f5e7626eb4f5c19a13d450952423c90e6b0abced..6f38cbe7735a41a58a9b48b47a6c339bb430bed4 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1796,15 +1796,18 @@ static ivas_error copyRendererConfigStruct( hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; - hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; - hRCout->roomAcoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; + hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; + hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; - mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS ); + Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX); + Copy32(hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX); + Copy32(hRCin->roomAcoustics.pAcoustic_dsr_fx, hRCout->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX); + Copy(hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS ); hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; +#if 1 // To be removed + mvr2r(hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS); +#endif return IVAS_ERR_OK; } @@ -1876,8 +1879,8 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig = hIvasDec->st_ivas->hRenderConfig; hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; - hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; - hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.roomAcoustics.inputPreDelay; + hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; + hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx; hRenderConfig->roomAcoustics.use_er = 0; IF( EQ_16( renderConfig.roomAcoustics.use_er, 1 ) ) @@ -1887,15 +1890,17 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; - mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); + Copy32( renderConfig.roomAcoustics.AbsCoeff_fx, hRenderConfig->roomAcoustics.AbsCoeff_fx, IVAS_ROOM_ABS_COEFF ); } - mvr2r( renderConfig.roomAcoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); - - mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); + Copy32( renderConfig.roomAcoustics.pFc_input_fx, hRenderConfig->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); + Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS ); +#if 1 // To be removed + mvr2r(renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS); +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 0fbaf4ec29efe2e8d06151b6b42e061cefef2583..cbc7f732bb3868653de31978246274cffb7fde1d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1122,12 +1122,32 @@ static void ivas_dirac_dec_binaural_internal( #if 1 double maxim = 0; Word16 q_input = 11; +#ifdef MSAN_FIX_ + Word16 nchan_tc; + + nchan_tc = 0; + move16(); + IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) + { + IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) + { + nchan_tc = st_ivas->nchan_ism; + move16(); + } + } + nchan_tc = add( nchan_tc, ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); +#endif + IF( st_ivas->hTcBuffer->tc[nchan_transport] ) FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[1]->no_channels * st_ivas->cldfbAnaDec[1]->no_col; ind++ ) { st_ivas->hTcBuffer->tc_fx[nchan_transport][ind] = (Word32) ( st_ivas->hTcBuffer->tc[nchan_transport][ind] * ( 1 << q_input ) ); } +#ifdef MSAN_FIX_ + FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) +#endif { FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->n_samples_available; ind++ ) IF( st_ivas->hTcBuffer->tc[cha] ) @@ -1136,7 +1156,11 @@ static void ivas_dirac_dec_binaural_internal( } } +#ifdef MSAN_FIX_ + FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) +#endif { IF( st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state ) FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++ ) @@ -1535,7 +1559,11 @@ static void ivas_dirac_dec_binaural_internal( } fixedToFloat_arrL( hDiracDecBin->frameMeanDiffuseness_fx, hDiracDecBin->frameMeanDiffuseness, 29, CLDFB_NO_CHANNELS_MAX ); +#ifdef MSAN_FIX_ + FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) +#else FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) +#endif IF( st_ivas->cldfbAnaDec[cha] && st_ivas->cldfbAnaDec[cha]->cldfb_state ) FOR( Word16 ind = 0; ind < st_ivas->cldfbAnaDec[cha]->cldfb_state_length; ind++ ) { diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 412da0468b13d1730baa3cd264aa097bb2e72963..b6511652a2966c6184ab11854ed3ebd721c8935b 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -1274,8 +1274,22 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub( 31, h_freq_domain_decorr_ap_state->q_direct_energy_smooth ); // scaling to get max precision for aux_buffer values// +#ifdef MSAN_FIX_ + q_shift = Q31; + move16(); + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + q_shift = s_min( q_shift, + L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ) ); + } + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + } +#else q_shift = L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ); Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); +#endif q_frame_f = add( q_frame_f, q_shift ); @@ -1348,8 +1362,23 @@ void ivas_dirac_dec_decorr_process_fx( e_direct_energy_smooth = sub(31 , h_freq_domain_decorr_ap_state->q_direct_energy_smooth); // this step is b/c we are left shifting frame_dec_fx at the end of below for loop/ +#ifdef MSAN_FIX_ + q_shift = Q31; + move16(); + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + q_shift = s_min( q_shift, + sub( L_norm_arr( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ) ), + Q2 ) ); + } + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + } +#else q_shift = sub( L_norm_arr( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels ), 2 ); Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); +#endif q_frame_f = add( q_frame_f, q_shift ); FOR( ch_idx = 0; ch_idx < num_channels; ch_idx++ ) @@ -1410,7 +1439,15 @@ void ivas_dirac_dec_decorr_process_fx( *-----------------------------------------------------------------*/ q_shift = q_input_frame - q_frame_f; +#ifdef MSAN_FIX_ + // scaling it to input q + FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) + { + Scale_sig32( &frame_dec_fx[2 * ch_idx * num_freq_bands], shl( max_band_decorr, 1 ), q_shift ); + } +#else Scale_sig32( frame_dec_fx, ( 2 * max_band_decorr + incr_aux ) * num_channels, q_shift ); // scaling it to input q +#endif q_frame_f = q_input_frame; diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 10c54d1fe2d0e89d96e41d16f8a5c88fbe628a43..6ae3e7f7dd3c05dab0846f0ed437f61306a6dfa1 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1590,13 +1590,21 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero( hDirAC_mem->cy_cross_dir_smooth, size_ho ); +#else set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); +#endif #ifdef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->cy_cross_dir_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size_ho ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } +#ifdef MSAN_FIX + set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size_ho ); +#else set_zero_fx( hDirAC_mem->cy_cross_dir_smooth_fx, size ); +#endif #endif if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index fb788fa4e0f4f94738a13a2a8b8bd14f8d515333..eb451e6bb394914520e8b71d85676143f3b55aea 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -44,7 +44,9 @@ *-----------------------------------------------------------------------*/ #define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f +#define IVAS_REVERB_DEFAULT_PRE_DELAY_FX 2147484 #define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f +#define IVAS_REVERB_DEFAULT_INPUT_DELAY_FX 13421773 #define IVAS_REVERB_DEFAULT_USE_ER 0 @@ -142,8 +144,8 @@ ivas_error ivas_render_config_init_from_rom_fx( } ( *hRenderConfig )->roomAcoustics.override = FALSE; ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; - ( *hRenderConfig )->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_PRE_DELAY; - ( *hRenderConfig )->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_INPUT_DELAY; + ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_PRE_DELAY_FX; + ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_INPUT_DELAY_FX; ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; set32_fx( &( *hRenderConfig )->roomAcoustics.pFc_input_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( &( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 528f6c433bf089bd0482c1d842c6712de284d4d4..36ef7a5393c176d05bd69c5a03903f12102068eb 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -96,37 +96,29 @@ ivas_error ivas_reverb_prepare_cldfb_params( fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) ); } #ifdef IVAS_FLOAT_FIXED - Word32* pFc_input_fx = (Word32*)malloc(60 * sizeof(Word32*)); - Word32* pAcoustic_rt60_fx = (Word32*)malloc(60 * sizeof(Word32*)); - Word32* pAcoustic_dsr_fx = (Word32*)malloc(60 * sizeof(Word32*)); - Word32* fc_fx = (Word32*)malloc(pInput_params->nBands * sizeof(Word32*)); Word32* pOutput_t60_fx = (Word32*)malloc(pInput_params->nBands * sizeof(Word32*)); Word16* pOutput_t60_e = (Word16*)malloc(pInput_params->nBands * sizeof(Word16*)); Word32* pOutput_ene_fx = (Word32*)malloc(pInput_params->nBands * sizeof(Word32*)); Word16* pOutput_ene_e = (Word16*)malloc(pInput_params->nBands * sizeof(Word16*)); - - for (int i = 0; i < 60; i++) - { - pFc_input_fx[i] = (Word32)pInput_params->pFc_input[i] * ONE_IN_Q16; - pAcoustic_rt60_fx[i] = (Word32)(pInput_params->pAcoustic_rt60[i]) * ONE_IN_Q26; - pAcoustic_dsr_fx[i] = (Word32)pInput_params->pAcoustic_dsr[i] * ONE_IN_Q30; - } + Word32 delay_diff_fx; for (int i = 0; i < pInput_params->nBands; i++) { fc_fx[i] = (Word32)fc[i] * ONE_IN_Q16; } - ivas_reverb_interpolate_acoustic_data_fx(pInput_params->nBands, pFc_input_fx, pAcoustic_rt60_fx, pAcoustic_dsr_fx, + ivas_reverb_interpolate_acoustic_data_fx(pInput_params->nBands, pInput_params->pFc_input_fx, pInput_params->pAcoustic_rt60_fx, pInput_params->pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX, fc_fx, pOutput_t60_fx, pOutput_ene_fx, pOutput_t60_e, pOutput_ene_e); + + /* adjust DSR for the delay difference */ + delay_diff_fx = L_sub(pInput_params->inputPreDelay_fx, pInput_params->acousticPreDelay_fx); + + delay_diff = (float)delay_diff_fx / ONE_IN_Q27; for (int i = 0; i < pInput_params->nBands; i++) { pOutput_t60[i] = (float)fabs(me2f(pOutput_t60_fx[i], pOutput_t60_e[i])); pOutput_ene[i] = (float)fabs(me2f(pOutput_ene_fx[i], pOutput_ene_e[i])); } - free(pFc_input_fx); - free(pAcoustic_rt60_fx); - free(pAcoustic_dsr_fx); free(fc_fx); free(pOutput_t60_fx); free(pOutput_t60_e); @@ -134,9 +126,9 @@ ivas_error ivas_reverb_prepare_cldfb_params( free(pOutput_ene_e); #else ivas_reverb_interpolate_acoustic_data( pInput_params->nBands, pInput_params->pFc_input, pInput_params->pAcoustic_rt60, pInput_params->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX, fc, pOutput_t60, pOutput_ene ); -#endif /* adjust DSR for the delay difference */ delay_diff = pInput_params->inputPreDelay - pInput_params->acousticPreDelay; +#endif ln_1e6_inverted = 1.0f / logf( 1e06f ); for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index 4b00e46d007381c58f3aea0ac5636e5703a3d203..97bed6db4b84e5a8fde2f65c018660f1ccf0d666 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -1077,28 +1077,28 @@ const Word32 ivas_reverb_default_fc_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q16*/ = 1048576000 , 1310720000 }; -const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = +const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q26*/ = { - 1462651136 , 1555422464 , 1413903232 , 1695116160 , 1585487232 , - 1498299392 , 1383945856 , 1445471232 , 1155238784 , - 1116798848 , 1177894784 , 1165009920 , 1171452288 , - 1117121024 , 1127321600 , 1148796416 , 1184122496 , - 1257781120 , 1184015104 , 1145252992 , 1132797568 , - 1133119744 , 1129683712 , 1134837760 , 1118946304 , - 1050355712 , 864222592 , 815442496 , 772503552 , - 662305408 , 644577984 + 91415696, 97213904, 88368952, 105944760, + 99092952, 93643712, 86496616, 90341952, + 72202424, 69799928, 73618424, 72813120, + 73215768, 69820064, 70457600, 71799776, + 74007656, 78611320, 74000944, 71578312, + 70799848, 70819984, 70605232, 70927360, + 69934144, 65647232, 54013912, 50965156, + 48281472, 41394088, 40286124 }; -const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q0*/ = +const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = { - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , - 0 , 0 , 0 + 20, 23, 15, 16, + 13, 20, 25, 42, + 96, 204, 397, 658, + 766, 701, 494, 587, + 753, 736, 763, 747, + 568, 611, 663, 617, + 512, 292, 146, 117, + 66, 30, 28 }; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7793b192ca88d3b5065632f9c41898daf54deeb7..c406220d30adf6c2f41d22397e6b2db164155727 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -269,7 +269,7 @@ typedef struct typedef struct { input_base base; - pan_matrix hoaDecMtx; + //pan_matrix hoaDecMtx; pan_matrix_fx hoaDecMtx_fx; CREND_WRAPPER_HANDLE crendWrapper; rotation_gains rot_gains_prev; @@ -1601,32 +1601,32 @@ static ivas_error initEfap( /*To be replaced with pointers*/ Word32 azimuths_fx[MAX_OUTPUT_CHANNELS]; Word32 elevations_fx[MAX_OUTPUT_CHANNELS]; - int16_t numNonLfeChannels; + Word16 numNonLfeChannels; - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { pEfapWrapper->speakerConfig = IVAS_AUDIO_CONFIG_7_1_4; } - else + ELSE { pEfapWrapper->speakerConfig = outConfig; } pEfapWrapper->pCustomLsSetup = pCustomLsOut; /* If re-initializing, free existing EFAP handle. */ - if ( pEfapWrapper->hEfap != NULL ) + IF ( pEfapWrapper->hEfap != NULL ) { efap_free_data( &pEfapWrapper->hEfap ); } /* Only initialize EFAP handle if output config is channel-based */ - if ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF ( getAudioConfigType( pEfapWrapper->speakerConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { pEfapWrapper->hEfap = NULL; return IVAS_ERR_OK; } - if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + IF ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { /*float2fix block: to be removed*/ floatToFixed_arrL( (float *) pCustomLsOut->ls_azimuth, (Word32 *) pCustomLsOut->ls_azimuth_fx, Q22, pCustomLsOut->num_spk ); @@ -1637,19 +1637,19 @@ static ivas_error initEfap( return error; } } - else + ELSE { - if ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) + IF ( ( error = getSpeakerAzimuths( pEfapWrapper->speakerConfig, &azimuths ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) + IF ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) + IF ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) { return error; } @@ -1658,7 +1658,7 @@ static ivas_error initEfap( floatToFixed_arrL( (float *) azimuths, azimuths_fx, Q22, numNonLfeChannels ); floatToFixed_arrL( (float *) elevations, elevations_fx, Q22, numNonLfeChannels ); /*float2fix block end*/ - if ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths_fx, elevations_fx, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + IF ( ( error = efap_init_data_fx( &pEfapWrapper->hEfap, azimuths_fx, elevations_fx, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } @@ -2053,7 +2053,7 @@ static void initRendInputBase_fx( inputBase->inputBuffer.config.numSamplesPerChannel = 0; inputBase->inputBuffer.config.numChannels = 0; inputBase->inputBuffer.data_fx = dataBuf; - IF( inputBase->inputBuffer.data != NULL ) + IF( inputBase->inputBuffer.data_fx != NULL ) { set_val_Word32( inputBase->inputBuffer.data_fx, 0, dataBufSize ); } @@ -2266,33 +2266,6 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -2315,17 +2288,6 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO:To be removed later*/ - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - for ( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); -#endif if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL,inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -3753,17 +3715,6 @@ static ivas_error initMcBinauralRendering( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { #ifdef IVAS_FLOAT_FIXED -#if 1 /*TODO:To be removed later*/ - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - for ( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); -#endif if ( ( error = ivas_reverb_open_fx( &( inputMc->hReverb ), outConfig, NULL,inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -3789,33 +3740,6 @@ static ivas_error initMcBinauralRendering( else if ( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ -#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -4244,34 +4168,33 @@ static ivas_error initSbaPanGainsForMcOut( const AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) { - int16_t ambiOrderIn; - int16_t chInIdx, chOutIdx; -#ifndef IVAS_FLOAT_FIXED - float *tmpDecMtx, *readPtr; -#else + Word16 ambiOrderIn; + Word16 chInIdx, chOutIdx; Word32 *tmpDecMtx, *readPtr; -#endif IVAS_OUTPUT_SETUP hOutSetup; ivas_error error; - if ( ( error = getAmbisonicsOrder( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) + IF( ( error = getAmbisonicsOrder_fx( inputSba->base.inConfig, &ambiOrderIn ) ) != IVAS_ERR_OK ) { return error; } - if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { assert( !"Invalid configuration" ); return IVAS_ERR_WRONG_PARAMS; } - switch ( outConfig ) + SWITCH ( outConfig ) { case IVAS_AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; hOutSetup.ls_elevation = ls_elevation_CICP1; + + hOutSetup.ls_azimuth_fx = ls_azimuth_CICP1_fx; + hOutSetup.ls_elevation_fx = ls_elevation_CICP1_fx; ivas_output_init( &hOutSetup, outConfig ); - break; + BREAK; case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_5_1: case IVAS_AUDIO_CONFIG_7_1: @@ -4279,10 +4202,11 @@ static ivas_error initSbaPanGainsForMcOut( case IVAS_AUDIO_CONFIG_5_1_4: case IVAS_AUDIO_CONFIG_7_1_4: ivas_output_init( &hOutSetup, outConfig ); - break; + BREAK; case IVAS_AUDIO_CONFIG_LS_CUSTOM: - ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); - break; + //ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); + ivas_ls_custom_setup_fx( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); + BREAK; default: assert( !"Invalid speaker config" ); return IVAS_ERR_WRONG_PARAMS; @@ -4290,26 +4214,21 @@ static ivas_error initSbaPanGainsForMcOut( /* obtain and copy over HOA decoding matrix */ tmpDecMtx = NULL; - if ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( hOutSetup, &tmpDecMtx, ambiOrderIn ) ) != IVAS_ERR_OK ) { return error; } readPtr = &tmpDecMtx[0]; - for ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) + FOR ( chOutIdx = 0; chOutIdx < hOutSetup.nchan_out_woLFE + hOutSetup.num_lfe; ++chOutIdx ) { - for ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) + FOR ( chInIdx = 0; chInIdx < SBA_NHARM_HOA3; ++chInIdx ) { - if ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) + IF ( hOutSetup.num_lfe > 0 && chOutIdx == hOutSetup.index_lfe[0] ) { continue; /* nothing to be rendered to LFE */ } -#ifndef IVAS_FLOAT_FIXED - inputSba->hoaDecMtx[chInIdx][chOutIdx] = *readPtr++; -#else - inputSba->hoaDecMtx_fx[chInIdx][chOutIdx] = ( ( *readPtr ) == ONE_IN_Q29 ) ? ONE_IN_Q31 : *readPtr << 2; - inputSba->hoaDecMtx[chInIdx][chOutIdx] = ( (float) *readPtr++ ) / ONE_IN_Q29; -#endif + inputSba->hoaDecMtx_fx[chInIdx][chOutIdx] = L_shl_sat( *readPtr++, 2 ); } } free( tmpDecMtx ); @@ -4431,89 +4350,62 @@ static ivas_error updateSbaPanGains( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { -#if 1 /*Cleanup changes: float to fixed*/ - IF( hRendCfg ) - { - hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); - FOR( int i = 0; i < 60; i++ ) - { - hRendCfg->roomAcoustics.pFc_input_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pFc_input[i] * ONE_IN_Q16 ); - hRendCfg->roomAcoustics.pAcoustic_rt60_fx[i] = (Word32) ( ( hRendCfg->roomAcoustics.pAcoustic_rt60[i] ) * ONE_IN_Q26 ); - hRendCfg->roomAcoustics.pAcoustic_dsr_fx[i] = (Word32) ( hRendCfg->roomAcoustics.pAcoustic_dsr[i] * ONE_IN_Q30 ); - } - - hRendCfg->roomAcoustics.inputPreDelay_fx = (Word32) ( hRendCfg->roomAcoustics.inputPreDelay * ONE_IN_Q27 ); - hRendCfg->roomAcoustics.dimensions.x_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.x * 4194304 ); // Q10.22, min value:1, max :999.0 - hRendCfg->roomAcoustics.dimensions.y_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.y * 4194304 ); // Q10.22 - hRendCfg->roomAcoustics.dimensions.z_fx = (Word32) ( hRendCfg->roomAcoustics.dimensions.z * 4194304 ); // Q10.22 - - - FOR( int ii = 0; ii < 6; ii++ ) - { - hRendCfg->roomAcoustics.AbsCoeff_fx[ii] = (Word32) ( hRendCfg->roomAcoustics.AbsCoeff[ii] * 1073741824 ); // Q2.30 min :0 max 1 - } - - hRendCfg->roomAcoustics.ListenerOrigin.x_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.x * 4194304 ); //( 2147483648 >> 2 ); - hRendCfg->roomAcoustics.ListenerOrigin.y_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.y * ( 4194304 ) ); - hRendCfg->roomAcoustics.ListenerOrigin.z_fx = (Word32) ( hRendCfg->roomAcoustics.ListenerOrigin.z * ( 4194304 ) ); - } -#endif // 1 ivas_error error; AUDIO_CONFIG inConfig; rendering_context rendCtx; /* Reset to all zeros - some functions below only write non-zero elements. */ - setZeroPanMatrix( inputSba->hoaDecMtx ); + //setZeroPanMatrix( inputSba->hoaDecMtx ); setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); inConfig = inputSba->base.inConfig; rendCtx = inputSba->base.ctx; - switch ( getAudioConfigType( outConfig ) ) + SWITCH ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: error = initSbaPanGainsForMcOut( inputSba, outConfig, inputSba->base.ctx.pCustomLsOut ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: error = initSbaPanGainsForSbaOut( inputSba, outConfig ); - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: - switch ( outConfig ) + SWITCH ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: { - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - break; + BREAK; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + IF ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } - break; + BREAK; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - break; + BREAK; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: error = IVAS_ERR_OK; - break; /* Do nothing */ + BREAK; /* Do nothing */ default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) + IF ( error != IVAS_ERR_OK ) { return error; } @@ -4630,7 +4522,7 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; - if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + IF ( !isIoConfigPairSupported( inConfig, outConfig ) ) { return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } @@ -4639,28 +4531,28 @@ static ivas_error setRendInputActiveSba( { return error; } - if ( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + IF ( ( error = allocateInputBaseBufferData_fx( &inputSba->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); initRendInputBase_fx( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData_fx, MAX_BUFFER_LENGTH ); - setZeroPanMatrix( inputSba->hoaDecMtx ); + setZeroPanMatrix_fx( inputSba->hoaDecMtx_fx ); inputSba->crendWrapper = NULL; inputSba->hDirAC = NULL; initRotGains_fx( inputSba->rot_gains_prev_fx ); - if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) + IF ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) { - if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + IF ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } - if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + IF ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) { return error; } @@ -5361,7 +5253,6 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( /* Input inactive, skip. */ continue; } - if ( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; @@ -6947,7 +6838,7 @@ ivas_error IVAS_REND_InitConfig( return IVAS_ERR_OK; } - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IVAS_REND_GetRenderConfig() * @@ -7027,7 +6918,87 @@ int16_t IVAS_REND_FeedRenderConfig( return IVAS_ERR_OK; } +#else +/*-------------------------------------------------------------------* + * IVAS_REND_GetRenderConfig() + * + * + *-------------------------------------------------------------------*/ + +int16_t IVAS_REND_GetRenderConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ +) +{ + RENDER_CONFIG_HANDLE hRCin; + + IF ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL || hRCout == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + hRCin = hIvasRend->hRendererConfig; + hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; + hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; + hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx; + hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx; + Copy( hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS ); + + Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( hRCin->roomAcoustics.pAcoustic_dsr_fx, hRCout->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); + + + hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; + hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; + + return IVAS_ERR_OK; +} + +/*-------------------------------------------------------------------* + * IVAS_REND_FeedRenderConfig() + * + * + *-------------------------------------------------------------------*/ + +int16_t IVAS_REND_FeedRenderConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ +) +{ + RENDER_CONFIG_HANDLE hRenderConfig; + + if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + hRenderConfig = hIvasRend->hRendererConfig; + + hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; + hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; + hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx; + hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx; + Copy32( renderConfig.roomAcoustics.pFc_input_fx, hRenderConfig->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); + Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); + Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS ); + + hRenderConfig->roomAcoustics.use_er = 0; + if ( renderConfig.roomAcoustics.use_er == 1 ) + { + hRenderConfig->roomAcoustics.use_er = renderConfig.roomAcoustics.use_er; + hRenderConfig->roomAcoustics.lowComplexity = renderConfig.roomAcoustics.lowComplexity; + hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; + hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; + + Copy32( renderConfig.roomAcoustics.AbsCoeff_fx, hRenderConfig->roomAcoustics.AbsCoeff_fx, IVAS_ROOM_ABS_COEFF ); + } + + + return IVAS_ERR_OK; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_SetHeadRotation() @@ -7599,7 +7570,7 @@ static void renderBufferChannel_fx( return; } -#endif +#else /* Take one channel from input buffer and copy it to each channel in output buffer, with different gain applied per output channel */ @@ -7613,7 +7584,7 @@ static void renderBufferChannel( return; } - +#endif #ifndef IVAS_FLOAT_FIXED static ivas_error chooseCrossfade( @@ -9087,7 +9058,7 @@ static ivas_error renderLfeToBinaural_fx( return IVAS_ERR_OK; } -#endif +#else static ivas_error renderLfeToBinaural( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) @@ -9149,7 +9120,7 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } - +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error renderMcToBinaural( input_mc *mcInput, diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 9e85b3551df951010e81a05b5f299b896deed382..bb708094ffc444a24707eb397931e285b85bf9d0 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -57,6 +57,7 @@ #define ACOUSTIC_DSR_MIN ( 0.0f ) #define ACOUSTIC_DSR_MAX ( 1.0e+2f ) #define ACOUSTIC_DSR_EPSILON ( 1.0e-15f ) +#define ACOUSTIC_DSR_EPSILON_FX ( 1 ) #define ACOUSTICPREDELAY_JOTREV_MIN ( SHORTEST_REV_DEL_LINE ) #define ACOUSTICPREDELAY_JOTREV_MAX ( SHORTEST_REV_DEL_LINE + 1.0f / (float) FRAMES_PER_SEC ) #define ACOUSTICPREDELAY_FDREV_MIN ( 1.0f / (float) ( 16 * FRAMES_PER_SEC ) ) @@ -65,9 +66,13 @@ #define INPUTPREDELAY_MAX ( 1.0e+2f ) #define ER_MIN_ROOM_DIMENSION ( 1.0f ) +#define ER_MIN_ROOM_DIMENSION_FX ( 4194304 ) #define ER_MAX_ROOM_DIMENSION ( 999.0f ) +#define ER_MAX_ROOM_DIMENSION_FX ( 2095054848 ) #define ER_MIN_ABS_COEFF ( 0.0f ) +#define ER_MIN_ABS_COEFF_FX ( 0 ) #define ER_MAX_ABS_COEFF ( 1.0f ) +#define ER_MAX_ABS_COEFF_FX ( 1073741824 ) /*------------------------------------------------------------------------------------------* * Local Type definitions @@ -1114,7 +1119,7 @@ static int32_t errorHandler( * * Verifies if the configuration parameters lie within acceptable limits *------------------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error RenderConfigReader_checkValues( IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ ) @@ -1227,7 +1232,129 @@ ivas_error RenderConfigReader_checkValues( return IVAS_ERR_OK; } +#else +ivas_error RenderConfigReader_checkValues( + IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ +) +{ + int16_t band_idx, tab_value_err_count; + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoom_acoustics; + pRoom_acoustics = &hRenderConfig->roomAcoustics; + tab_value_err_count = 0; + int16_t wall_idx; + + + /* Verify the number of frequency bands in the config input data */ + if ( ( pRoom_acoustics->nBands > N_BANDS_MAX ) || ( pRoom_acoustics->nBands < N_BANDS_MIN ) ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + /* Verify input pre-delay value */ + if ( ( pRoom_acoustics->inputPreDelay > INPUTPREDELAY_MAX ) || ( pRoom_acoustics->inputPreDelay < INPUTPREDELAY_MIN ) ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + /* Verify data per band in the acoustic properties table */ + for ( band_idx = 0; band_idx < pRoom_acoustics->nBands; band_idx++ ) + { + /* Verify if the frequencies are in the ascending order (required for interpolation) */ + if ( band_idx != 0 ) + { + if ( pRoom_acoustics->pFc_input[band_idx] <= pRoom_acoustics->pFc_input[band_idx - 1] ) + { + tab_value_err_count++; + } + } + + /* Check the input frequencies */ + if ( ( pRoom_acoustics->pFc_input[band_idx] > FC_INPUT_MAX ) || ( pRoom_acoustics->pFc_input[band_idx] < FC_INPUT_MIN ) ) + { + tab_value_err_count++; + } + + /* Check the input RT60 values */ + if ( ( pRoom_acoustics->pAcoustic_rt60[band_idx] > ACOUSTIC_RT60_MAX ) || ( pRoom_acoustics->pAcoustic_rt60[band_idx] < ACOUSTIC_RT60_MIN ) ) + { + tab_value_err_count++; + } + + /* Check the input DSR values */ + if ( ( pRoom_acoustics->pAcoustic_dsr[band_idx] > ACOUSTIC_DSR_MAX ) || ( pRoom_acoustics->pAcoustic_dsr[band_idx] < ACOUSTIC_DSR_MIN ) ) + { + tab_value_err_count++; + } + + /* Replace zero DSR values with very small positive values, to avoid issues with coloration filter design */ + if ( pRoom_acoustics->pAcoustic_dsr[band_idx] <= 0.0f ) + { + pRoom_acoustics->pAcoustic_dsr[band_idx] = ACOUSTIC_DSR_EPSILON; + pRoom_acoustics->pAcoustic_dsr_fx[band_idx] = ACOUSTIC_DSR_EPSILON_FX; + } + } + + if ( tab_value_err_count != 0 ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + + + if ( pRoom_acoustics->use_er == 1 ) + { + /* Room dimensions */ + if ( pRoom_acoustics->dimensions.x < ER_MIN_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.x = ER_MIN_ROOM_DIMENSION; + pRoom_acoustics->dimensions.x_fx = ER_MIN_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.x > ER_MAX_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.x = ER_MAX_ROOM_DIMENSION; + pRoom_acoustics->dimensions.x_fx = ER_MAX_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.y < ER_MIN_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.y = ER_MIN_ROOM_DIMENSION; + pRoom_acoustics->dimensions.y_fx = ER_MIN_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.y > ER_MAX_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.y = ER_MAX_ROOM_DIMENSION; + pRoom_acoustics->dimensions.y_fx = ER_MAX_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.z < ER_MIN_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.z = ER_MIN_ROOM_DIMENSION; + pRoom_acoustics->dimensions.z_fx = ER_MIN_ROOM_DIMENSION_FX; + } + if ( pRoom_acoustics->dimensions.z > ER_MAX_ROOM_DIMENSION ) + { + pRoom_acoustics->dimensions.z = ER_MAX_ROOM_DIMENSION; + pRoom_acoustics->dimensions.z_fx = ER_MAX_ROOM_DIMENSION_FX; + } + + /* Abs Coeff */ + for ( wall_idx = 0; wall_idx < IVAS_ROOM_ABS_COEFF; wall_idx++ ) + { + if ( pRoom_acoustics->AbsCoeff[wall_idx] < ER_MIN_ABS_COEFF ) + { + pRoom_acoustics->AbsCoeff[wall_idx] = ER_MIN_ABS_COEFF; + pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MIN_ABS_COEFF_FX; + } + if ( pRoom_acoustics->AbsCoeff[wall_idx] > ER_MAX_ABS_COEFF ) + { + pRoom_acoustics->AbsCoeff[wall_idx] = ER_MAX_ABS_COEFF; + pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MAX_ABS_COEFF_FX; + } + } + } + + return IVAS_ERR_OK; +} +#endif /*------------------------------------------------------------------------------------------* * RenderConfigReader_open() @@ -2217,6 +2344,9 @@ ivas_error RenderConfigReader_read( { errorHandler( item, ERROR_VALUE_INVALID ); } +#ifdef IVAS_FLOAT_FIXED + hRenderConfig->roomAcoustics.acousticPreDelay_fx = (Word32) ( hRenderConfig->roomAcoustics.acousticPreDelay * ONE_IN_Q27 ); +#endif // IVAS_FLOAT_FIXED } /* Pre-delay */ else if ( strcmp( item, "PREDELAY" ) == 0 ) @@ -2484,7 +2614,7 @@ ivas_error RenderConfigReader_read( } return IVAS_ERR_OK; } - +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * RenderConfigReader_getEnvironment() * @@ -2552,7 +2682,88 @@ ivas_error RenderConfigReader_getAcousticEnvironment( } return IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; } +#else +ivas_error RenderConfigReader_getAcousticEnvironment( + RenderConfigReader *pRenderConfigReader, /* i : RenderConfigReader handle */ + uint16_t id, /* i : Acoustic environment ID */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pAcEnv /* o : Target acoustic environment pointer */ +) +{ + uint16_t n, m; + uint16_t j; + + if ( pRenderConfigReader == NULL || pAcEnv == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* case when -aeid is not specified, select first ID from config file */ + if ( id == 65535 && pRenderConfigReader->nAE > 0 ) + { + id = (uint16_t) pRenderConfigReader->pAE[0].id; + } + for ( n = 0; n < pRenderConfigReader->nAE; n++ ) + { + if ( id == pRenderConfigReader->pAE[n].id ) + { + pAcEnv->nBands = (int16_t) pRenderConfigReader->pAE[n].pFG->nrBands; + pAcEnv->inputPreDelay = pRenderConfigReader->pAE[n].preDelay; + pAcEnv->inputPreDelay_fx = (Word32) ( pRenderConfigReader->pAE[n].preDelay * ONE_IN_Q27 ); + for ( m = 0; m < pAcEnv->nBands; m++ ) + { + pAcEnv->pFc_input[m] = pRenderConfigReader->pAE[n].pFG->pFc[m]; + pAcEnv->pAcoustic_rt60[m] = pRenderConfigReader->pAE[n].pRT60[m]; + pAcEnv->pAcoustic_dsr[m] = pRenderConfigReader->pAE[n].pDSR[m]; + pAcEnv->pFc_input_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pFG->pFc[m] * ONE_IN_Q16 ); + pAcEnv->pAcoustic_rt60_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pRT60[m] * ONE_IN_Q26 ); + pAcEnv->pAcoustic_dsr_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pDSR[m] * ONE_IN_Q30 ); + } + + /* If ER are allocated then propagate parameters */ + if ( pRenderConfigReader->pAE[n].pEarlyReflections != 0 ) + { + pAcEnv->use_er = pRenderConfigReader->pAE[n].pEarlyReflections->use_er; /* ER activation flag */ + pAcEnv->lowComplexity = pRenderConfigReader->pAE[n].pEarlyReflections->lowComplexity; /* Low complexity flag */ + pAcEnv->dimensions = pRenderConfigReader->pAE[n].pEarlyReflections->dimensions; + pAcEnv->dimensions.x_fx = (Word32)(pRenderConfigReader->pAE[n].pEarlyReflections->dimensions.x * ONE_IN_Q22); + pAcEnv->dimensions.y_fx = (Word32)(pRenderConfigReader->pAE[n].pEarlyReflections->dimensions.y * ONE_IN_Q22); + pAcEnv->dimensions.z_fx = (Word32)(pRenderConfigReader->pAE[n].pEarlyReflections->dimensions.z * ONE_IN_Q22); + /* Use default listener origin position if non provided */ + if ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin == NULL ) + { + if ( ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin = malloc( sizeof( IVAS_VECTOR3 ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = ER_LIST_ORIGIN_X; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = ER_LIST_ORIGIN_Y; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = ER_LIST_HEIGHT; + + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x_fx = ER_LIST_ORIGIN_X_FX; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y_fx = ER_LIST_ORIGIN_Y_FX; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z_fx = ER_LIST_HEIGHT_FX; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->q_fact = Q22; + } + else + { + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x_fx = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x * ONE_IN_Q22 ); + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y_fx = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y * ONE_IN_Q22 ); + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z_fx = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z * ONE_IN_Q22 ); + } + pAcEnv->ListenerOrigin = *pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin; + for ( j = 0; j < IVAS_ROOM_ABS_COEFF; j++ ) + { + pAcEnv->AbsCoeff[j] = pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j]; + pAcEnv->AbsCoeff_fx[j] = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j] * ONE_IN_Q30 ); + } + } + return IVAS_ERR_OK; + } + } + return IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; +} +#endif /*------------------------------------------------------------------------------------------* * RenderConfigReader_getDirectivity()