Loading lib_com/cnst.h +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,14 @@ /* clang-format off */ #ifdef IVAS_FLOAT_FIXED #define MATRIX_CONSTANT (759250113) #define L_SUBFRAME_48k (240) #define L_SUBFRAME_32k (180) #define L_SUBFRAME_16k (80) #define L_SUBFRAME_8k (40) #define Q31_BY_SUB_FRAME_240 ( 8985287 ) #define Q31_BY_SUB_FRAME_180 ( 11997115 ) #define Q31_BY_SUB_FRAME_80 ( 27183337 ) #define Q31_BY_SUB_FRAME_40 ( 55063683 ) #endif Loading lib_dec/ivas_objectRenderer_internal.c +3 −18 Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ ivas_error ivas_td_binaural_renderer_sf( if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_FLOAT_FIXED Word16 i,j, k,exp; Word16 i,j,exp; Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; Loading Loading @@ -260,25 +260,10 @@ ivas_error ivas_td_binaural_renderer_sf( for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { pcm_out_fx[i][0 * hReverb->full_block_size + j] = (Word32) float_to_fix( p_reverb_signal[i][0 * hReverb->full_block_size + j], ( exp - 2 ) ); } } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) ( hReverb->t60[i].CoefA[k] * ONE_IN_Q30 ); hReverb->t60[i].CoefB_fx[k] = (Word32) ( hReverb->t60[i].CoefB[k] * ONE_IN_Q30 ); } pcm_out_fx[i][0 * hReverb->full_block_size + j] = (Word32) float_to_fix( p_reverb_signal[i][0 * hReverb->full_block_size + j], ( exp ) ); } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31 ); } if ( ( error = ivas_reverb_process_fx( st_ivas->hReverb, st_ivas->transport_config, 0, pcm_in_fx, pcm_out_fx, 0 ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_reverb_process( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local, p_reverb_signal, 0 ) ) != IVAS_ERR_OK ) Loading lib_rend/ivas_crend.c +95 −157 Original line number Diff line number Diff line Loading @@ -2100,7 +2100,6 @@ ivas_error ivas_rend_initCrendWrapper( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hHrtfCrend = NULL; Loading Loading @@ -2416,7 +2415,6 @@ void ivas_rend_closeCrend( free( hCrend->freq_buffer_re_diffuse_fx ); hCrend->freq_buffer_re_diffuse_fx = NULL; } if ( hCrend->freq_buffer_im_diffuse_fx != NULL ) { free( hCrend->freq_buffer_im_diffuse_fx ); Loading Loading @@ -2445,7 +2443,6 @@ void ivas_rend_closeCrend( free( hCrend->reflections ); hCrend->reflections = NULL; } free( hCrend ); hCrend = NULL; ( *pCrend )->hCrend = hCrend; Loading Loading @@ -2724,7 +2721,6 @@ void ivas_rend_closeCrend( #endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendConvolver() Loading Loading @@ -2896,6 +2892,7 @@ static ivas_error ivas_rend_crendConvolver( return IVAS_ERR_OK; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendConvolver() Loading Loading @@ -3082,22 +3079,17 @@ ivas_error ivas_rend_crendProcess( 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, const int16_t num_subframes /* i : number of subframes to render */ Word32 *output_fx[], /* i/o: input/output audio channels */ const Word32 output_Fs, const Word16 num_subframes /* i : number of subframes to render */ ) { int16_t i, subframe_idx, subframe_len; Word16 j; int16_t nchan_out, nchan_in;//TODO:nchan_in will remove later for temporary conversion float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; Word16 i, subframe_idx, subframe_len; Word16 nchan_out; Word32 pcm_tmp_fx[BINAURAL_CHANNELS][L_FRAME48k]; float *p_pcm_tmp[BINAURAL_CHANNELS]; Word32 *p_pcm_tmp_fx[BINAURAL_CHANNELS]; Word32 output_buffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 *output_fx[MAX_OUTPUT_CHANNELS]; IVAS_REND_AudioConfigType inConfigType; int8_t combinedOrientationEnabled; Word8 combinedOrientationEnabled; ivas_error error; CREND_HANDLE hCrend; Loading @@ -3106,12 +3098,12 @@ ivas_error ivas_rend_crendProcess( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) FOR ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { if ( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 ) IF( NE_16(hCombinedOrientationData->enableCombinedOrientation[subframe_idx] , 0) ) { combinedOrientationEnabled = 1; break; BREAK; } } } Loading @@ -3119,64 +3111,49 @@ ivas_error ivas_rend_crendProcess( push_wmops( "ivas_rend_crendProcess" ); inConfigType = getAudioConfigType( inConfig ); if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) IF ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) { return error; } // TODO:will remove later for temporary conversion; not there in the float code code if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) subframe_len = L_SUBFRAME_48k; move16(); SWITCH( output_Fs ) { return error; case 48000: subframe_len = L_SUBFRAME_48k; BREAK; case 32000: subframe_len = L_SUBFRAME_32k; BREAK; case 16000: subframe_len = L_SUBFRAME_16k; BREAK; case 8000: subframe_len = L_SUBFRAME_8k; BREAK; default: BREAK; } 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 ( i = 0; i < BINAURAL_CHANNELS; i++ ) FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) { p_pcm_tmp_fx[i] = pcm_tmp_fx[i]; move32(); } for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { output_fx[i] = output_buffer_fx[i]; } Word16 gd_bits = find_guarded_bits_fx( subframe_len ); Word16 exp = 15; exp -= gd_bits; for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) 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 ) { for ( i = 0; i < hCrend->reflections->shoebox_data.n_sources + 1; i++ ) test(); IF( EQ_16( hCrend->reflections->use_er, 1 ) && EQ_16(hCrend->reflections->is_ready , 1) ) { for ( j = 0; j < L_FRAME48k; j++ ) { output_fx[i][j] = (Word32) float_to_fix( output[i][j], exp ); } } for ( i = 0; i < 150; i++ ) { hCrend->reflections->shoebox_data.gains.data_fx[i] = (Word32) float_to_fix( hCrend->reflections->shoebox_data.gains.data[i], 15 ); } if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) IF ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < hCrend->reflections->shoebox_data.n_sources + 1; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) { output[i][j] = fix_to_float( output_fx[i][j], exp ); } } } } Loading @@ -3188,102 +3165,44 @@ ivas_error ivas_rend_crendProcess( 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 ) test(); IF ( EQ_16(inConfig ,IVAS_AUDIO_CONFIG_FOA) || EQ_16(inConfig , IVAS_AUDIO_CONFIG_HOA2) || EQ_16(inConfig , IVAS_AUDIO_CONFIG_HOA3) ) { rotateFrame_shd( hCombinedOrientationData, output, subframe_len, *hIntSetup, subframe_idx ); rotateFrame_shd( hCombinedOrientationData, output_fx, 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 ) { for ( i = 0; i < nchan_in; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) ELSE IF ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { rotateFrame_sd( hCombinedOrientationData, output_fx, subframe_len, *hIntSetup, hEFAPdata, subframe_idx ); output_fx[i][j] = (Word32) float_to_fix( output[i][j], exp ); } } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) test(); IF ( EQ_16(inConfigType ,IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED) || EQ_16(inConfigType , IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS) ) { p_pcm_tmp_fx[i][j] = (Word32) float_to_fix( p_pcm_tmp[i][j], exp ); } } if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) IF ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) IF( hCrend->hReverb != NULL ) { p_pcm_tmp[i][j] = fix_to_float( p_pcm_tmp_fx[i][j], exp ); } } if ( hCrend->hReverb != NULL ) { Word16 k; REVERB_HANDLE hReverb = pCrend->hCrend->hReverb; for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { p_pcm_tmp_fx[i][subframe_idx * hReverb->full_block_size + j] = (Word32)float_to_fix( p_pcm_tmp[i][subframe_idx * hReverb->full_block_size + j], ( exp - 2 ) ); } } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) ( hReverb->t60[i].CoefA[k] * ONE_IN_Q30 ); hReverb->t60[i].CoefB_fx[k] = (Word32) ( hReverb->t60[i].CoefB[k] * ONE_IN_Q30 ); } } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31 ); } if ( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ) != IVAS_ERR_OK ) IF( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { p_pcm_tmp[i][subframe_idx * hReverb->full_block_size + j] = fix_to_float( p_pcm_tmp_fx[i][subframe_idx * hReverb->full_block_size + j], (exp - 2) ); } } } } else ELSE { return IVAS_ERR_INVALID_INPUT_FORMAT; } } /* move to output */ for ( i = 0; i < nchan_out; i++ ) FOR ( i = 0; i < nchan_out; i++ ) { mvr2r( pcm_tmp[i], output[i], num_subframes * subframe_len ); mvr2r_Word32( pcm_tmp_fx[i], output_fx[i], num_subframes * subframe_len ); } pop_wmops(); Loading Loading @@ -3437,7 +3356,7 @@ ivas_error ivas_rend_crendProcessSubframe( const int32_t output_Fs /* i : output sampling rate */ ) { int16_t subframe_idx, subframe_len; int16_t subframe_idx, subframe_len, n; Word16 i, j; int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render; float *tc_local[MAX_OUTPUT_CHANNELS]; Loading Loading @@ -3552,12 +3471,46 @@ ivas_error ivas_rend_crendProcessSubframe( */ if ( inConfig == IVAS_AUDIO_CONFIG_FOA || inConfig == IVAS_AUDIO_CONFIG_HOA2 || inConfig == IVAS_AUDIO_CONFIG_HOA3 ) { rotateFrame_shd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, 0 ); rotateFrame_shd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, 0 ); } /* Rotation in SD for MC -> BINAURAL_ROOM */ else if ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { rotateFrame_sd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, hEFAPdata, 0 ); Word16 nchan; nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; for ( i = 0; i < nchan; i++ ) { for ( j = 0; j < subframe_len; j++ ) { tc_local_fx[i][j] = (Word32) float_to_fix( tc_local[i][j], exp ); } } for ( n = 0; n < 3; n++ ) { for ( i = 0; i < 3; i++ ) { hCombinedOrientationData->Rmat_prev_fx[n][i] = (Word32) ( hCombinedOrientationData->Rmat_prev[n][i] * ONE_IN_Q30 ); hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][n][i] = (Word32) ( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][n][i] * ONE_IN_Q30 ); } } rotateFrame_sd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, hEFAPdata, 0 ); for ( i = 0; i < nchan; i++ ) { for ( j = 0; j < subframe_len; j++ ) { tc_local[i][j] = (float) fix_to_float( tc_local_fx[i][j], ( exp - 3 ) ); } } for ( n = 0; n < 3; n++ ) { for ( i = 0; i < 3; i++ ) { hCombinedOrientationData->Rmat_prev[n][i] = (float) ( hCombinedOrientationData->Rmat_prev_fx[n][i] ) / ONE_IN_Q30; hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][n][i] = (float) ( hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][n][i] ) / ONE_IN_Q30; } } } } Loading Loading @@ -3594,7 +3547,6 @@ ivas_error ivas_rend_crendProcessSubframe( } if ( pCrend->hCrend->hReverb != NULL ) { Word16 k; REVERB_HANDLE hReverb = pCrend->hCrend->hReverb; for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { Loading @@ -3602,24 +3554,10 @@ ivas_error ivas_rend_crendProcessSubframe( for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { p_pcm_tmp_fx[i][j] = (Word32) float_to_fix( p_pcm_tmp[i][j], ( exp - 2 ) ); } } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) (hReverb->t60[i].CoefA[k] * ONE_IN_Q30); hReverb->t60[i].CoefB_fx[k] = (Word32) (hReverb->t60[i].CoefB[k] * ONE_IN_Q30); } p_pcm_tmp_fx[i][j] = (Word32) float_to_fix( p_pcm_tmp[i][j], ( exp ) ); } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31); } if ( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ) != IVAS_ERR_OK ) { return error; Loading lib_rend/ivas_objectRenderer.c +2 −18 Original line number Diff line number Diff line Loading @@ -353,7 +353,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( hReverb != NULL ) { #ifdef IVAS_FLOAT_FIXED Word16 i, j, k, exp; Word16 i, j, exp; Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; Loading Loading @@ -382,24 +382,8 @@ ivas_error ivas_td_binaural_renderer_unwrap( for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { pcm_out_fx[i][j] = (Word32) float_to_fix( p_reverb_signal[i][j], ( exp - 2 ) ); } pcm_out_fx[i][j] = (Word32) float_to_fix( p_reverb_signal[i][j], ( exp ) ); } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) ( hReverb->t60[i].CoefA[k] * ONE_IN_Q30 ); hReverb->t60[i].CoefB_fx[k] = (Word32) ( hReverb->t60[i].CoefB[k] * ONE_IN_Q30 ); } } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31 ); } if ( ( error = ivas_reverb_process_fx( hReverb, transport_config, 0, pcm_in_fx, pcm_out_fx, subframe_idx) ) != IVAS_ERR_OK ) #else Loading lib_rend/ivas_prot_rend.h +52 −8 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
lib_com/cnst.h +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,14 @@ /* clang-format off */ #ifdef IVAS_FLOAT_FIXED #define MATRIX_CONSTANT (759250113) #define L_SUBFRAME_48k (240) #define L_SUBFRAME_32k (180) #define L_SUBFRAME_16k (80) #define L_SUBFRAME_8k (40) #define Q31_BY_SUB_FRAME_240 ( 8985287 ) #define Q31_BY_SUB_FRAME_180 ( 11997115 ) #define Q31_BY_SUB_FRAME_80 ( 27183337 ) #define Q31_BY_SUB_FRAME_40 ( 55063683 ) #endif Loading
lib_dec/ivas_objectRenderer_internal.c +3 −18 Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ ivas_error ivas_td_binaural_renderer_sf( if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef IVAS_FLOAT_FIXED Word16 i,j, k,exp; Word16 i,j,exp; Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; Loading Loading @@ -260,25 +260,10 @@ ivas_error ivas_td_binaural_renderer_sf( for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { pcm_out_fx[i][0 * hReverb->full_block_size + j] = (Word32) float_to_fix( p_reverb_signal[i][0 * hReverb->full_block_size + j], ( exp - 2 ) ); } } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) ( hReverb->t60[i].CoefA[k] * ONE_IN_Q30 ); hReverb->t60[i].CoefB_fx[k] = (Word32) ( hReverb->t60[i].CoefB[k] * ONE_IN_Q30 ); } pcm_out_fx[i][0 * hReverb->full_block_size + j] = (Word32) float_to_fix( p_reverb_signal[i][0 * hReverb->full_block_size + j], ( exp ) ); } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31 ); } if ( ( error = ivas_reverb_process_fx( st_ivas->hReverb, st_ivas->transport_config, 0, pcm_in_fx, pcm_out_fx, 0 ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_reverb_process( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local, p_reverb_signal, 0 ) ) != IVAS_ERR_OK ) Loading
lib_rend/ivas_crend.c +95 −157 Original line number Diff line number Diff line Loading @@ -2100,7 +2100,6 @@ ivas_error ivas_rend_initCrendWrapper( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hHrtfCrend = NULL; Loading Loading @@ -2416,7 +2415,6 @@ void ivas_rend_closeCrend( free( hCrend->freq_buffer_re_diffuse_fx ); hCrend->freq_buffer_re_diffuse_fx = NULL; } if ( hCrend->freq_buffer_im_diffuse_fx != NULL ) { free( hCrend->freq_buffer_im_diffuse_fx ); Loading Loading @@ -2445,7 +2443,6 @@ void ivas_rend_closeCrend( free( hCrend->reflections ); hCrend->reflections = NULL; } free( hCrend ); hCrend = NULL; ( *pCrend )->hCrend = hCrend; Loading Loading @@ -2724,7 +2721,6 @@ void ivas_rend_closeCrend( #endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendConvolver() Loading Loading @@ -2896,6 +2892,7 @@ static ivas_error ivas_rend_crendConvolver( return IVAS_ERR_OK; } #else /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendConvolver() Loading Loading @@ -3082,22 +3079,17 @@ ivas_error ivas_rend_crendProcess( 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, const int16_t num_subframes /* i : number of subframes to render */ Word32 *output_fx[], /* i/o: input/output audio channels */ const Word32 output_Fs, const Word16 num_subframes /* i : number of subframes to render */ ) { int16_t i, subframe_idx, subframe_len; Word16 j; int16_t nchan_out, nchan_in;//TODO:nchan_in will remove later for temporary conversion float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; Word16 i, subframe_idx, subframe_len; Word16 nchan_out; Word32 pcm_tmp_fx[BINAURAL_CHANNELS][L_FRAME48k]; float *p_pcm_tmp[BINAURAL_CHANNELS]; Word32 *p_pcm_tmp_fx[BINAURAL_CHANNELS]; Word32 output_buffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 *output_fx[MAX_OUTPUT_CHANNELS]; IVAS_REND_AudioConfigType inConfigType; int8_t combinedOrientationEnabled; Word8 combinedOrientationEnabled; ivas_error error; CREND_HANDLE hCrend; Loading @@ -3106,12 +3098,12 @@ ivas_error ivas_rend_crendProcess( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) FOR ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) { if ( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 ) IF( NE_16(hCombinedOrientationData->enableCombinedOrientation[subframe_idx] , 0) ) { combinedOrientationEnabled = 1; break; BREAK; } } } Loading @@ -3119,64 +3111,49 @@ ivas_error ivas_rend_crendProcess( push_wmops( "ivas_rend_crendProcess" ); inConfigType = getAudioConfigType( inConfig ); if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) IF ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) { return error; } // TODO:will remove later for temporary conversion; not there in the float code code if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) subframe_len = L_SUBFRAME_48k; move16(); SWITCH( output_Fs ) { return error; case 48000: subframe_len = L_SUBFRAME_48k; BREAK; case 32000: subframe_len = L_SUBFRAME_32k; BREAK; case 16000: subframe_len = L_SUBFRAME_16k; BREAK; case 8000: subframe_len = L_SUBFRAME_8k; BREAK; default: BREAK; } 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 ( i = 0; i < BINAURAL_CHANNELS; i++ ) FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) { p_pcm_tmp_fx[i] = pcm_tmp_fx[i]; move32(); } for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { output_fx[i] = output_buffer_fx[i]; } Word16 gd_bits = find_guarded_bits_fx( subframe_len ); Word16 exp = 15; exp -= gd_bits; for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) 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 ) { for ( i = 0; i < hCrend->reflections->shoebox_data.n_sources + 1; i++ ) test(); IF( EQ_16( hCrend->reflections->use_er, 1 ) && EQ_16(hCrend->reflections->is_ready , 1) ) { for ( j = 0; j < L_FRAME48k; j++ ) { output_fx[i][j] = (Word32) float_to_fix( output[i][j], exp ); } } for ( i = 0; i < 150; i++ ) { hCrend->reflections->shoebox_data.gains.data_fx[i] = (Word32) float_to_fix( hCrend->reflections->shoebox_data.gains.data[i], 15 ); } if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) IF ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < hCrend->reflections->shoebox_data.n_sources + 1; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) { output[i][j] = fix_to_float( output_fx[i][j], exp ); } } } } Loading @@ -3188,102 +3165,44 @@ ivas_error ivas_rend_crendProcess( 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 ) test(); IF ( EQ_16(inConfig ,IVAS_AUDIO_CONFIG_FOA) || EQ_16(inConfig , IVAS_AUDIO_CONFIG_HOA2) || EQ_16(inConfig , IVAS_AUDIO_CONFIG_HOA3) ) { rotateFrame_shd( hCombinedOrientationData, output, subframe_len, *hIntSetup, subframe_idx ); rotateFrame_shd( hCombinedOrientationData, output_fx, 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 ) { for ( i = 0; i < nchan_in; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) ELSE IF ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { rotateFrame_sd( hCombinedOrientationData, output_fx, subframe_len, *hIntSetup, hEFAPdata, subframe_idx ); output_fx[i][j] = (Word32) float_to_fix( output[i][j], exp ); } } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) test(); IF ( EQ_16(inConfigType ,IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED) || EQ_16(inConfigType , IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS) ) { p_pcm_tmp_fx[i][j] = (Word32) float_to_fix( p_pcm_tmp[i][j], exp ); } } if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) IF ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) IF( hCrend->hReverb != NULL ) { p_pcm_tmp[i][j] = fix_to_float( p_pcm_tmp_fx[i][j], exp ); } } if ( hCrend->hReverb != NULL ) { Word16 k; REVERB_HANDLE hReverb = pCrend->hCrend->hReverb; for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { p_pcm_tmp_fx[i][subframe_idx * hReverb->full_block_size + j] = (Word32)float_to_fix( p_pcm_tmp[i][subframe_idx * hReverb->full_block_size + j], ( exp - 2 ) ); } } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) ( hReverb->t60[i].CoefA[k] * ONE_IN_Q30 ); hReverb->t60[i].CoefB_fx[k] = (Word32) ( hReverb->t60[i].CoefB[k] * ONE_IN_Q30 ); } } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31 ); } if ( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ) != IVAS_ERR_OK ) IF( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ) != IVAS_ERR_OK ) { return error; } for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { p_pcm_tmp[i][subframe_idx * hReverb->full_block_size + j] = fix_to_float( p_pcm_tmp_fx[i][subframe_idx * hReverb->full_block_size + j], (exp - 2) ); } } } } else ELSE { return IVAS_ERR_INVALID_INPUT_FORMAT; } } /* move to output */ for ( i = 0; i < nchan_out; i++ ) FOR ( i = 0; i < nchan_out; i++ ) { mvr2r( pcm_tmp[i], output[i], num_subframes * subframe_len ); mvr2r_Word32( pcm_tmp_fx[i], output_fx[i], num_subframes * subframe_len ); } pop_wmops(); Loading Loading @@ -3437,7 +3356,7 @@ ivas_error ivas_rend_crendProcessSubframe( const int32_t output_Fs /* i : output sampling rate */ ) { int16_t subframe_idx, subframe_len; int16_t subframe_idx, subframe_len, n; Word16 i, j; int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render; float *tc_local[MAX_OUTPUT_CHANNELS]; Loading Loading @@ -3552,12 +3471,46 @@ ivas_error ivas_rend_crendProcessSubframe( */ if ( inConfig == IVAS_AUDIO_CONFIG_FOA || inConfig == IVAS_AUDIO_CONFIG_HOA2 || inConfig == IVAS_AUDIO_CONFIG_HOA3 ) { rotateFrame_shd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, 0 ); rotateFrame_shd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, 0 ); } /* Rotation in SD for MC -> BINAURAL_ROOM */ else if ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { rotateFrame_sd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, hEFAPdata, 0 ); Word16 nchan; nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; for ( i = 0; i < nchan; i++ ) { for ( j = 0; j < subframe_len; j++ ) { tc_local_fx[i][j] = (Word32) float_to_fix( tc_local[i][j], exp ); } } for ( n = 0; n < 3; n++ ) { for ( i = 0; i < 3; i++ ) { hCombinedOrientationData->Rmat_prev_fx[n][i] = (Word32) ( hCombinedOrientationData->Rmat_prev[n][i] * ONE_IN_Q30 ); hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][n][i] = (Word32) ( hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][n][i] * ONE_IN_Q30 ); } } rotateFrame_sd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, hEFAPdata, 0 ); for ( i = 0; i < nchan; i++ ) { for ( j = 0; j < subframe_len; j++ ) { tc_local[i][j] = (float) fix_to_float( tc_local_fx[i][j], ( exp - 3 ) ); } } for ( n = 0; n < 3; n++ ) { for ( i = 0; i < 3; i++ ) { hCombinedOrientationData->Rmat_prev[n][i] = (float) ( hCombinedOrientationData->Rmat_prev_fx[n][i] ) / ONE_IN_Q30; hCombinedOrientationData->Rmat[hCombinedOrientationData->subframe_idx][n][i] = (float) ( hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx][n][i] ) / ONE_IN_Q30; } } } } Loading Loading @@ -3594,7 +3547,6 @@ ivas_error ivas_rend_crendProcessSubframe( } if ( pCrend->hCrend->hReverb != NULL ) { Word16 k; REVERB_HANDLE hReverb = pCrend->hCrend->hReverb; for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { Loading @@ -3602,24 +3554,10 @@ ivas_error ivas_rend_crendProcessSubframe( for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { p_pcm_tmp_fx[i][j] = (Word32) float_to_fix( p_pcm_tmp[i][j], ( exp - 2 ) ); } } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) (hReverb->t60[i].CoefA[k] * ONE_IN_Q30); hReverb->t60[i].CoefB_fx[k] = (Word32) (hReverb->t60[i].CoefB[k] * ONE_IN_Q30); } p_pcm_tmp_fx[i][j] = (Word32) float_to_fix( p_pcm_tmp[i][j], ( exp ) ); } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) (hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31); } if ( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ) != IVAS_ERR_OK ) { return error; Loading
lib_rend/ivas_objectRenderer.c +2 −18 Original line number Diff line number Diff line Loading @@ -353,7 +353,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( hReverb != NULL ) { #ifdef IVAS_FLOAT_FIXED Word16 i, j, k, exp; Word16 i, j, exp; Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; Loading Loading @@ -382,24 +382,8 @@ ivas_error ivas_td_binaural_renderer_unwrap( for ( j = 0; j < ( hReverb->full_block_size ); j++ ) { pcm_out_fx[i][j] = (Word32) float_to_fix( p_reverb_signal[i][j], ( exp - 2 ) ); } pcm_out_fx[i][j] = (Word32) float_to_fix( p_reverb_signal[i][j], ( exp ) ); } for ( i = 0; i < hReverb->nr_of_branches; i++ ) { for ( k = 0; k < IVAS_REV_MAX_IIR_FILTER_LENGTH; k++ ) { hReverb->t60[i].CoefA_fx[k] = (Word32) ( hReverb->t60[i].CoefA[k] * ONE_IN_Q30 ); hReverb->t60[i].CoefB_fx[k] = (Word32) ( hReverb->t60[i].CoefB[k] * ONE_IN_Q30 ); } } for ( k = 0; k < hReverb->fft_filter_ols.fft_size; k++ ) { hReverb->fft_filter_correl_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_0.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_0.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_correl_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_correl_1.fft_spectrum[k] * ONE_IN_Q31 ); hReverb->fft_filter_color_1.fft_spectrum_fx[k] = (Word32) ( hReverb->fft_filter_color_1.fft_spectrum[k] * ONE_IN_Q31 ); } if ( ( error = ivas_reverb_process_fx( hReverb, transport_config, 0, pcm_in_fx, pcm_out_fx, subframe_idx) ) != IVAS_ERR_OK ) #else Loading
lib_rend/ivas_prot_rend.h +52 −8 File changed.Preview size limit exceeded, changes collapsed. Show changes