Loading lib_com/ivas_prot.h +0 −9 Original line number Diff line number Diff line Loading @@ -5400,15 +5400,6 @@ ivas_error ivas_rend_crendProcess( EFAP_HANDLE hEFAPdata, float output[][L_FRAME48k], /* i/o: input/output audio channels */ const int32_t output_Fs ); ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], const int32_t output_Fs, const int16_t i_ts ); #endif /*----------------------------------------------------------------------------------* Loading lib_dec/ivas_sba_dec.c +5 −5 Original line number Diff line number Diff line Loading @@ -502,16 +502,16 @@ ivas_error ivas_sba_dec_reinit( st_ivas->hRenderConfig, t_ivas->hDecoderConfig->Opt_Headrotation, st_ivas->hDecoderConfig->output_Fs ) != IVAS_ERR_OK ) ) #else if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) #endif { #ifdef FIX_197_CREND_INTERFACE return error; } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; #else if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); #endif } #endif } ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); Loading lib_rend/ivas_crend.c +161 −0 Original line number Diff line number Diff line Loading @@ -1911,6 +1911,163 @@ ivas_error ivas_rend_closeCrend( #endif } #ifdef FIX_197_CREND_INTERFACE /*-----------------------------------------------------------------------------------------* * Function ivas_crend_convolver() * * Convolver block *-----------------------------------------------------------------------------------------*/ static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig, float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], const int32_t output_Fs, const int16_t i_ts ) { int16_t i, j, k, m; int16_t subframe_length, idx_in; int16_t lfe_idx_in; int16_t offset, offset_in, offset_diffuse; int16_t nchan_in, nchan_out; float *pIn; float *pFreq_buf_re, *pFreq_buf_im; float *pFreq_filt_re, *pFreq_filt_im; float pOut[L_FRAME48k * 2]; float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; getAudioConfigNumChannels( inConfig, &nchan_in ); getAudioConfigNumChannels( outConfig, &nchan_out ); subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; lfe_idx_in = -1; if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { lfe_idx_in = LFE_CHANNEL; } else { assert( 0 && "Custom LS not supported in CRend" ); } } offset = pCrend->hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ offset_diffuse = pCrend->hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { set_zero( &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); set_zero( &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); } i = 0; for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) { pIn = &pcm_in[idx_in][i_ts * subframe_length]; if ( idx_in != lfe_idx_in ) { if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; pFreq_filt_re = &pCrend->hCrend->freq_buffer_re[i][offset]; pFreq_filt_im = &pCrend->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[i]; pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[i]; } } pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset]; ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); i++; } } for ( j = 0; j < nchan_out; j++ ) { set_zero( tmp_out_re, subframe_length ); set_zero( tmp_out_im, subframe_length ); i = 0; for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) { if ( idx_in != lfe_idx_in ) { offset = 0; for ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ ) { offset_in = ( pCrend->hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 ); offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations ); offset_in = offset_in * subframe_length; pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset_in]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset_in]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_re[i][j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_im[i][j][offset]; for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ ) { tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; } offset = offset + k; } i++; } } offset = 0; for ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ ) { offset_diffuse = ( pCrend->hCrend->diffuse_delay_line_rw_index + m + 1 ); offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0]; offset_diffuse = offset_diffuse * subframe_length; pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re[j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im[j][offset]; for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max_diffuse[j][m]; k++ ) { tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; } offset = offset + k; } ivas_imdft( tmp_out_re, tmp_out_im, pOut, subframe_length ); pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; for ( k = 0; k < subframe_length; k++ ) { pFreq_buf_re[k] = pOut[k] + pCrend->hCrend->prev_out_buffer[j][k]; pCrend->hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; } } pCrend->hCrend->delay_line_rw_index++; pCrend->hCrend->delay_line_rw_index = pCrend->hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { pCrend->hCrend->diffuse_delay_line_rw_index++; pCrend->hCrend->diffuse_delay_line_rw_index = pCrend->hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); } return IVAS_ERR_OK; } #endif /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crend_Process() * Loading Loading @@ -2022,6 +2179,8 @@ ivas_error ivas_rend_crendProcess( return IVAS_ERR_OK; } #ifndef FIX_197_CREND_INTERFACE /*-----------------------------------------------------------------------------------------* * Function ivas_crend_convolver() * Loading Loading @@ -2174,3 +2333,5 @@ ivas_error ivas_rend_crendConvolver( return IVAS_ERR_OK; } #endif lib_rend/lib_rend.c +13 −6 Original line number Diff line number Diff line Loading @@ -3580,6 +3580,10 @@ ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st, st->rendererConfigEnabled = 0; } #ifdef FIX_197_CREND_INTERFACE if ( rendererConfigEnabled ) { #endif if ( ( error = ivas_render_config_open( &( st->hRendererConfig ) ) ) != IVAS_ERR_OK ) { return error; Loading @@ -3589,6 +3593,9 @@ ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st, { return IVAS_ERR_INTERNAL_FATAL; } #ifdef FIX_197_CREND_INTERFACE } #endif return IVAS_ERR_OK; } Loading Loading
lib_com/ivas_prot.h +0 −9 Original line number Diff line number Diff line Loading @@ -5400,15 +5400,6 @@ ivas_error ivas_rend_crendProcess( EFAP_HANDLE hEFAPdata, float output[][L_FRAME48k], /* i/o: input/output audio channels */ const int32_t output_Fs ); ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], const int32_t output_Fs, const int16_t i_ts ); #endif /*----------------------------------------------------------------------------------* Loading
lib_dec/ivas_sba_dec.c +5 −5 Original line number Diff line number Diff line Loading @@ -502,16 +502,16 @@ ivas_error ivas_sba_dec_reinit( st_ivas->hRenderConfig, t_ivas->hDecoderConfig->Opt_Headrotation, st_ivas->hDecoderConfig->output_Fs ) != IVAS_ERR_OK ) ) #else if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) #endif { #ifdef FIX_197_CREND_INTERFACE return error; } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; #else if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); #endif } #endif } ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); Loading
lib_rend/ivas_crend.c +161 −0 Original line number Diff line number Diff line Loading @@ -1911,6 +1911,163 @@ ivas_error ivas_rend_closeCrend( #endif } #ifdef FIX_197_CREND_INTERFACE /*-----------------------------------------------------------------------------------------* * Function ivas_crend_convolver() * * Convolver block *-----------------------------------------------------------------------------------------*/ static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig, float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], const int32_t output_Fs, const int16_t i_ts ) { int16_t i, j, k, m; int16_t subframe_length, idx_in; int16_t lfe_idx_in; int16_t offset, offset_in, offset_diffuse; int16_t nchan_in, nchan_out; float *pIn; float *pFreq_buf_re, *pFreq_buf_im; float *pFreq_filt_re, *pFreq_filt_im; float pOut[L_FRAME48k * 2]; float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; getAudioConfigNumChannels( inConfig, &nchan_in ); getAudioConfigNumChannels( outConfig, &nchan_out ); subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; lfe_idx_in = -1; if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { lfe_idx_in = LFE_CHANNEL; } else { assert( 0 && "Custom LS not supported in CRend" ); } } offset = pCrend->hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ offset_diffuse = pCrend->hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { set_zero( &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); set_zero( &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); } i = 0; for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) { pIn = &pcm_in[idx_in][i_ts * subframe_length]; if ( idx_in != lfe_idx_in ) { if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; pFreq_filt_re = &pCrend->hCrend->freq_buffer_re[i][offset]; pFreq_filt_im = &pCrend->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[i]; pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[i]; } } pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset]; ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); i++; } } for ( j = 0; j < nchan_out; j++ ) { set_zero( tmp_out_re, subframe_length ); set_zero( tmp_out_im, subframe_length ); i = 0; for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) { if ( idx_in != lfe_idx_in ) { offset = 0; for ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ ) { offset_in = ( pCrend->hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 ); offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations ); offset_in = offset_in * subframe_length; pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset_in]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset_in]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_re[i][j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_im[i][j][offset]; for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ ) { tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; } offset = offset + k; } i++; } } offset = 0; for ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ ) { offset_diffuse = ( pCrend->hCrend->diffuse_delay_line_rw_index + m + 1 ); offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0]; offset_diffuse = offset_diffuse * subframe_length; pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re[j][offset]; pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im[j][offset]; for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max_diffuse[j][m]; k++ ) { tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; } offset = offset + k; } ivas_imdft( tmp_out_re, tmp_out_im, pOut, subframe_length ); pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; for ( k = 0; k < subframe_length; k++ ) { pFreq_buf_re[k] = pOut[k] + pCrend->hCrend->prev_out_buffer[j][k]; pCrend->hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; } } pCrend->hCrend->delay_line_rw_index++; pCrend->hCrend->delay_line_rw_index = pCrend->hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) { pCrend->hCrend->diffuse_delay_line_rw_index++; pCrend->hCrend->diffuse_delay_line_rw_index = pCrend->hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); } return IVAS_ERR_OK; } #endif /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crend_Process() * Loading Loading @@ -2022,6 +2179,8 @@ ivas_error ivas_rend_crendProcess( return IVAS_ERR_OK; } #ifndef FIX_197_CREND_INTERFACE /*-----------------------------------------------------------------------------------------* * Function ivas_crend_convolver() * Loading Loading @@ -2174,3 +2333,5 @@ ivas_error ivas_rend_crendConvolver( return IVAS_ERR_OK; } #endif
lib_rend/lib_rend.c +13 −6 Original line number Diff line number Diff line Loading @@ -3580,6 +3580,10 @@ ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st, st->rendererConfigEnabled = 0; } #ifdef FIX_197_CREND_INTERFACE if ( rendererConfigEnabled ) { #endif if ( ( error = ivas_render_config_open( &( st->hRendererConfig ) ) ) != IVAS_ERR_OK ) { return error; Loading @@ -3589,6 +3593,9 @@ ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st, { return IVAS_ERR_INTERNAL_FATAL; } #ifdef FIX_197_CREND_INTERFACE } #endif return IVAS_ERR_OK; } Loading