Loading lib_com/ivas_lfe_com.c +46 −27 Original line number Diff line number Diff line Loading @@ -41,6 +41,9 @@ #include "cnst.h" #include <assert.h> #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif /*-----------------------------------------------------------------------------------------* Loading Loading @@ -153,7 +156,8 @@ void ivas_lfe_lpf_select_filt_coeff_fx( * Initialize LFE window *-----------------------------------------------------------------------------------------*/ void ivas_lfe_window_init( #ifdef IVAS_FLOAT_FIXED void ivas_lfe_window_init_fx( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const Word32 sampling_rate, /* i : sampling rate */ const Word16 frame_len /* i : frame length in samples */ Loading @@ -162,27 +166,15 @@ void ivas_lfe_window_init( /* Set window coefficients */ IF( EQ_32( sampling_rate, 48000 ) ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k; #ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_48k_fx; #endif } ELSE IF( EQ_32( sampling_rate, 32000 ) ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k; #ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_32k_fx; #endif } ELSE IF( EQ_32( sampling_rate, 16000 ) ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k; #ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_16k_fx; #endif } ELSE { Loading @@ -192,18 +184,45 @@ void ivas_lfe_window_init( /* 10ms stride, MDCT will be done in two iterations */ hLFEWindow->dct_len = shr( frame_len, 1 ); hLFEWindow->fade_len = NS2SA(sampling_rate, IVAS_LFE_FADE_NS); #ifdef IVAS_FLOAT_FIXED /* 8ms of latency */ hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS ); hLFEWindow->zero_pad_len = ( mult( IVAS_ZERO_PAD_LEN_MULT_FAC_fx, sub( hLFEWindow->dct_len, hLFEWindow->fade_len ) ) ); hLFEWindow->full_len = add( add( hLFEWindow->zero_pad_len, hLFEWindow->fade_len ), hLFEWindow->dct_len ); #else hLFEWindow->zero_pad_len = (int16_t)(IVAS_ZERO_PAD_LEN_MULT_FAC * (hLFEWindow->dct_len - hLFEWindow->fade_len)); hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len; return; } #endif void ivas_lfe_window_init( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const int32_t sampling_rate, /* i : sampling rate */ const int16_t frame_len /* i : frame length in samples */ ) { /* Set window coefficients */ if ( sampling_rate == 48000 ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k; } else if ( sampling_rate == 32000 ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k; } else if ( sampling_rate == 16000 ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k; } else { assert( !"8kHz LFE Window not supported" ); } /* 10ms stride, MDCT will be done in two iterations */ hLFEWindow->dct_len = frame_len >> 1; /* 8ms of latency */ hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS ); hLFEWindow->zero_pad_len = (int16_t) ( IVAS_ZERO_PAD_LEN_MULT_FAC * ( hLFEWindow->dct_len - hLFEWindow->fade_len ) ); hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len; return; } lib_com/ivas_prot.h +2 −2 Original line number Diff line number Diff line Loading @@ -7002,8 +7002,8 @@ void ivas_lfe_tdplc( void ivas_lfe_window_init( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const Word32 sampling_rate, /* i : sampling rate */ const Word16 frame_len /* i : frame length in samples */ const int32_t sampling_rate, /* i : sampling rate */ const int16_t frame_len /* i : frame length in samples */ ); void ivas_lfe_lpf_select_filt_coeff( Loading lib_com/ivas_prot_fx.h +10 −4 Original line number Diff line number Diff line Loading @@ -2203,4 +2203,10 @@ ivas_error ivas_mc_dec_config_fx( UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ Word16 *data /* o : output synthesis signal */ ); void ivas_lfe_window_init_fx( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const Word32 sampling_rate, /* i : sampling rate */ const Word16 frame_len /* i : frame length in samples */ ); #endif lib_dec/ivas_dirac_dec.c +1 −83 Original line number Diff line number Diff line Loading @@ -330,25 +330,12 @@ static ivas_error ivas_dirac_rend_config_fx( IF( EQ_16( flag_config, DIRAC_OPEN ) ) { #ifdef TRUE /*TODO : remove float code*/ if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); #endif IF( ( hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set16_fx( hDirACRend->frequency_axis_fx, 0, hSpatParamRendCom->num_freq_bands ); ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { hDirACRend->frequency_axis[i] = (float) hDirACRend->frequency_axis_fx[i]; } } IF( ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) && EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) && EQ_16( nchan_transport, 2 ) ) Loading Loading @@ -550,13 +537,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* direct/diffuse responses */ IF( EQ_16( flag_config, DIRAC_OPEN ) ) { #ifdef TRUE /*Todo : to clean up float code*/ IF( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } #endif IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); Loading @@ -565,15 +545,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* reallocate static memory */ ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && NE_16( hDirACRend->num_outputs_dir, num_outputs_dir_old ) ) { #ifdef TRUE /*Todo : Remove float code*/ free( hDirACRend->diffuse_response_function ); hDirACRend->diffuse_response_function = NULL; IF( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } #endif free( hDirACRend->diffuse_response_function_fx ); hDirACRend->diffuse_response_function_fx = NULL; IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) Loading @@ -586,44 +557,15 @@ static ivas_error ivas_dirac_rend_config_fx( initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) { hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], 15 ); } } ELSE { initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, IVAS_AUDIO_CONFIG_FOA, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) { hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], 15 ); } } IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { #ifdef TRUE /*TODO : to remove float code*/ if ( EQ_16( flag_config, DIRAC_OPEN ) ) { if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } else if ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) { free( hDirACRend->hoa_encoder ); hDirACRend->hoa_encoder = NULL; if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); #endif IF( EQ_16( flag_config, DIRAC_OPEN ) ) { IF( ( hDirACRend->hoa_encoder_fx = (Word32 *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( Word32 ) ) ) == NULL ) Loading @@ -631,7 +573,7 @@ static ivas_error ivas_dirac_rend_config_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder_fx && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) { free( hDirACRend->hoa_encoder_fx ); hDirACRend->hoa_encoder_fx = NULL; Loading @@ -641,24 +583,10 @@ static ivas_error ivas_dirac_rend_config_fx( } } set32_fx( hDirACRend->hoa_encoder_fx, 0, nchan_out_woLFE * hDirACRend->num_outputs_diff ); hDirACRend->hoa_encoder_len = nchan_out_woLFE * hDirACRend->num_outputs_diff; compute_hoa_encoder_mtx_fx( ls_azimuth_fx, ls_elevation_fx, hDirACRend->hoa_encoder_fx, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); FOR( i = 0; i < nchan_out_woLFE * hDirACRend->num_outputs_diff; i++ ) { hDirACRend->hoa_encoder[i] = fix_to_float( hDirACRend->hoa_encoder_fx[i], Q29 ); } } ELSE { #ifdef TRUE /*todo: clean up float code*/ IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder ) { free( hDirACRend->hoa_encoder ); } hDirACRend->hoa_encoder = NULL; #endif IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder_fx ) { free( hDirACRend->hoa_encoder_fx ); Loading Loading @@ -3635,7 +3563,6 @@ void ivas_dirac_dec_render_sf_fx( { IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) { floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); } Loading Loading @@ -3871,9 +3798,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); hDirACRend->diffuse_response_function_q = Q15; floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, hDirACRend->diffuse_response_function_q, hDirACRend->num_outputs_dir ); } ELSE { Loading Loading @@ -4720,10 +4644,6 @@ void ivas_dirac_dec_render_sf_fx( { Scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ) ); } IF( NE_16( hDirACRend->diffuse_response_function_q, Q15 ) ) { Scale_sig( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, sub( Q15, hDirACRend->diffuse_response_function_q ) ); } IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, Q26 ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, i_mult( hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth ) ); Loading Loading @@ -5505,8 +5425,6 @@ void ivas_dirac_dec_render_sf_fx( fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); } fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); Loading lib_dec/ivas_dirac_output_synthesis_cov.c +4 −35 Original line number Diff line number Diff line Loading @@ -194,14 +194,13 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } for ( idx = 1; idx <= interp_length; ++idx ) FOR( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator_fx[idx - 1] = div_s( idx, interp_length ); } Copy32( proto_matrix, h_dirac_output_synthesis_params->proto_matrix_fx, nchan_in * nchan_out ); #if 1 /*TODO: To be removed later***************************************************************************************/ h_dirac_output_synthesis_params->alpha_synthesis = NULL; if ( ( h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); Loading Loading @@ -234,22 +233,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; } /*-----------------------------------------------------------------* * prepare processing parameters *-----------------------------------------------------------------*/ /* compute interpolator */ if ( ( h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } for ( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) interp_length; } #endif return IVAS_ERR_OK; } Loading Loading @@ -369,6 +352,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } #endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator_fx() Loading @@ -394,9 +378,7 @@ void ivas_dirac_dec_output_synthesis_get_interpolator_fx( return; } #endif #else /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator() * Loading @@ -417,6 +399,7 @@ void ivas_dirac_dec_output_synthesis_get_interpolator( return; } #endif /*-------------------------------------------------------------------* Loading Loading @@ -617,20 +600,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( h_dirac_output_synthesis_state->mixing_matrix_res_exp = NULL; } #if 1/*TODO: To be removed later(floating point dealloc)*/ /* free interpolator */ IF ( h_dirac_output_synthesis_params->interpolator != NULL ) { free( h_dirac_output_synthesis_params->interpolator ); h_dirac_output_synthesis_params->interpolator = NULL; } /* free alpha */ IF ( h_dirac_output_synthesis_params->alpha_synthesis != NULL ) { free( h_dirac_output_synthesis_params->alpha_synthesis ); h_dirac_output_synthesis_params->alpha_synthesis = NULL; } /* free proto_matrix */ IF ( h_dirac_output_synthesis_params->proto_matrix != NULL ) { Loading Loading
lib_com/ivas_lfe_com.c +46 −27 Original line number Diff line number Diff line Loading @@ -41,6 +41,9 @@ #include "cnst.h" #include <assert.h> #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif /*-----------------------------------------------------------------------------------------* Loading Loading @@ -153,7 +156,8 @@ void ivas_lfe_lpf_select_filt_coeff_fx( * Initialize LFE window *-----------------------------------------------------------------------------------------*/ void ivas_lfe_window_init( #ifdef IVAS_FLOAT_FIXED void ivas_lfe_window_init_fx( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const Word32 sampling_rate, /* i : sampling rate */ const Word16 frame_len /* i : frame length in samples */ Loading @@ -162,27 +166,15 @@ void ivas_lfe_window_init( /* Set window coefficients */ IF( EQ_32( sampling_rate, 48000 ) ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k; #ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_48k_fx; #endif } ELSE IF( EQ_32( sampling_rate, 32000 ) ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k; #ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_32k_fx; #endif } ELSE IF( EQ_32( sampling_rate, 16000 ) ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k; #ifdef IVAS_FLOAT_FIXED hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_16k_fx; #endif } ELSE { Loading @@ -192,18 +184,45 @@ void ivas_lfe_window_init( /* 10ms stride, MDCT will be done in two iterations */ hLFEWindow->dct_len = shr( frame_len, 1 ); hLFEWindow->fade_len = NS2SA(sampling_rate, IVAS_LFE_FADE_NS); #ifdef IVAS_FLOAT_FIXED /* 8ms of latency */ hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS ); hLFEWindow->zero_pad_len = ( mult( IVAS_ZERO_PAD_LEN_MULT_FAC_fx, sub( hLFEWindow->dct_len, hLFEWindow->fade_len ) ) ); hLFEWindow->full_len = add( add( hLFEWindow->zero_pad_len, hLFEWindow->fade_len ), hLFEWindow->dct_len ); #else hLFEWindow->zero_pad_len = (int16_t)(IVAS_ZERO_PAD_LEN_MULT_FAC * (hLFEWindow->dct_len - hLFEWindow->fade_len)); hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len; return; } #endif void ivas_lfe_window_init( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const int32_t sampling_rate, /* i : sampling rate */ const int16_t frame_len /* i : frame length in samples */ ) { /* Set window coefficients */ if ( sampling_rate == 48000 ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k; } else if ( sampling_rate == 32000 ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k; } else if ( sampling_rate == 16000 ) { hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k; } else { assert( !"8kHz LFE Window not supported" ); } /* 10ms stride, MDCT will be done in two iterations */ hLFEWindow->dct_len = frame_len >> 1; /* 8ms of latency */ hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS ); hLFEWindow->zero_pad_len = (int16_t) ( IVAS_ZERO_PAD_LEN_MULT_FAC * ( hLFEWindow->dct_len - hLFEWindow->fade_len ) ); hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len; return; }
lib_com/ivas_prot.h +2 −2 Original line number Diff line number Diff line Loading @@ -7002,8 +7002,8 @@ void ivas_lfe_tdplc( void ivas_lfe_window_init( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const Word32 sampling_rate, /* i : sampling rate */ const Word16 frame_len /* i : frame length in samples */ const int32_t sampling_rate, /* i : sampling rate */ const int16_t frame_len /* i : frame length in samples */ ); void ivas_lfe_lpf_select_filt_coeff( Loading
lib_com/ivas_prot_fx.h +10 −4 Original line number Diff line number Diff line Loading @@ -2203,4 +2203,10 @@ ivas_error ivas_mc_dec_config_fx( UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ Word16 *data /* o : output synthesis signal */ ); void ivas_lfe_window_init_fx( LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */ const Word32 sampling_rate, /* i : sampling rate */ const Word16 frame_len /* i : frame length in samples */ ); #endif
lib_dec/ivas_dirac_dec.c +1 −83 Original line number Diff line number Diff line Loading @@ -330,25 +330,12 @@ static ivas_error ivas_dirac_rend_config_fx( IF( EQ_16( flag_config, DIRAC_OPEN ) ) { #ifdef TRUE /*TODO : remove float code*/ if ( ( hDirACRend->frequency_axis = (float *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirACRend->frequency_axis, 0.0f, hSpatParamRendCom->num_freq_bands ); #endif IF( ( hDirACRend->frequency_axis_fx = (Word16 *) malloc( hSpatParamRendCom->num_freq_bands * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set16_fx( hDirACRend->frequency_axis_fx, 0, hSpatParamRendCom->num_freq_bands ); ivas_dirac_dec_get_frequency_axis_fx( hDirACRend->frequency_axis_fx, output_Fs, hSpatParamRendCom->num_freq_bands ); FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { hDirACRend->frequency_axis[i] = (float) hDirACRend->frequency_axis_fx[i]; } } IF( ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) && EQ_16( hDirACRend->panningConf, DIRAC_PANNING_HOA3 ) && EQ_16( nchan_transport, 2 ) ) Loading Loading @@ -550,13 +537,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* direct/diffuse responses */ IF( EQ_16( flag_config, DIRAC_OPEN ) ) { #ifdef TRUE /*Todo : to clean up float code*/ IF( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } #endif IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); Loading @@ -565,15 +545,6 @@ static ivas_error ivas_dirac_rend_config_fx( /* reallocate static memory */ ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && NE_16( hDirACRend->num_outputs_dir, num_outputs_dir_old ) ) { #ifdef TRUE /*Todo : Remove float code*/ free( hDirACRend->diffuse_response_function ); hDirACRend->diffuse_response_function = NULL; IF( ( hDirACRend->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirACRend->num_outputs_dir ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } #endif free( hDirACRend->diffuse_response_function_fx ); hDirACRend->diffuse_response_function_fx = NULL; IF( ( hDirACRend->diffuse_response_function_fx = (Word16 *) malloc( sizeof( Word16 ) * hDirACRend->num_outputs_dir ) ) == NULL ) Loading @@ -586,44 +557,15 @@ static ivas_error ivas_dirac_rend_config_fx( initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, nchan_out_woLFE, hDirACRend->hOutSetup.output_config, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, st_ivas->transport_config ); FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) { hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], 15 ); } } ELSE { initDiffuseResponses_fx( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, IVAS_AUDIO_CONFIG_FOA, hDirACRend->hOutSetup, hDirACRend->hOutSetup.ambisonics_order, st_ivas->ivas_format, &hDirACRend->num_ele_spk_no_diffuse_rendering, IVAS_AUDIO_CONFIG_INVALID ); FOR( i = 0; i < hDirACRend->num_outputs_dir; i++ ) { hDirACRend->diffuse_response_function[i] = fix16_to_float( hDirACRend->diffuse_response_function_fx[i], 15 ); } } IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) { #ifdef TRUE /*TODO : to remove float code*/ if ( EQ_16( flag_config, DIRAC_OPEN ) ) { if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } else if ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) { free( hDirACRend->hoa_encoder ); hDirACRend->hoa_encoder = NULL; if ( ( hDirACRend->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } set_f( hDirACRend->hoa_encoder, 0.0f, nchan_out_woLFE * hDirACRend->num_outputs_diff ); #endif IF( EQ_16( flag_config, DIRAC_OPEN ) ) { IF( ( hDirACRend->hoa_encoder_fx = (Word32 *) malloc( nchan_out_woLFE * hDirACRend->num_outputs_diff * sizeof( Word32 ) ) ) == NULL ) Loading @@ -631,7 +573,7 @@ static ivas_error ivas_dirac_rend_config_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } } ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) ELSE IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder_fx && ( NE_16( hDirACRend->num_outputs_diff, num_outputs_diff_old ) ) ) { free( hDirACRend->hoa_encoder_fx ); hDirACRend->hoa_encoder_fx = NULL; Loading @@ -641,24 +583,10 @@ static ivas_error ivas_dirac_rend_config_fx( } } set32_fx( hDirACRend->hoa_encoder_fx, 0, nchan_out_woLFE * hDirACRend->num_outputs_diff ); hDirACRend->hoa_encoder_len = nchan_out_woLFE * hDirACRend->num_outputs_diff; compute_hoa_encoder_mtx_fx( ls_azimuth_fx, ls_elevation_fx, hDirACRend->hoa_encoder_fx, hDirACRend->num_outputs_diff, hDirACRend->hOutSetup.ambisonics_order ); FOR( i = 0; i < nchan_out_woLFE * hDirACRend->num_outputs_diff; i++ ) { hDirACRend->hoa_encoder[i] = fix_to_float( hDirACRend->hoa_encoder_fx[i], Q29 ); } } ELSE { #ifdef TRUE /*todo: clean up float code*/ IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder ) { free( hDirACRend->hoa_encoder ); } hDirACRend->hoa_encoder = NULL; #endif IF( EQ_16( flag_config, DIRAC_RECONFIGURE ) && hDirACRend->hoa_encoder_fx ) { free( hDirACRend->hoa_encoder_fx ); Loading Loading @@ -3635,7 +3563,6 @@ void ivas_dirac_dec_render_sf_fx( { IF( EQ_16( hSpatParamRendCom->numParametricDirections, 2 ) ) { floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, Q15, hDirACRend->num_outputs_dir ); floatToFixed_arrL32( hSpatParamRendCom->energy_ratio1[md_idx], hSpatParamRendCom->energy_ratio1_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( hSpatParamRendCom->energy_ratio2[md_idx], hSpatParamRendCom->energy_ratio2_fx[md_idx], Q30, hSpatParamRendCom->num_freq_bands ); } Loading Loading @@ -3871,9 +3798,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); hDirACRend->diffuse_response_function_q = Q15; floatToFixed_arr( hDirACRend->diffuse_response_function, hDirACRend->diffuse_response_function_fx, hDirACRend->diffuse_response_function_q, hDirACRend->num_outputs_dir ); } ELSE { Loading Loading @@ -4720,10 +4644,6 @@ void ivas_dirac_dec_render_sf_fx( { Scale_sig32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr, sub( Q31, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ) ); } IF( NE_16( hDirACRend->diffuse_response_function_q, Q15 ) ) { Scale_sig( hDirACRend->diffuse_response_function_fx, hDirACRend->num_outputs_dir, sub( Q15, hDirACRend->diffuse_response_function_q ) ); } IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, Q26 ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, i_mult( hDirACRend->num_outputs_diff, hDirACRend->h_output_synthesis_psd_params.max_band_decorr ), sub( Q26, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth ) ); Loading Loading @@ -5505,8 +5425,6 @@ void ivas_dirac_dec_render_sf_fx( fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); } fixedToFloat_arr( hDirACRend->h_output_synthesis_psd_params.interpolator_fx, hDirACRend->h_output_synthesis_psd_params.interpolator, Q15, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); Loading
lib_dec/ivas_dirac_output_synthesis_cov.c +4 −35 Original line number Diff line number Diff line Loading @@ -194,14 +194,13 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } for ( idx = 1; idx <= interp_length; ++idx ) FOR( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator_fx[idx - 1] = div_s( idx, interp_length ); } Copy32( proto_matrix, h_dirac_output_synthesis_params->proto_matrix_fx, nchan_in * nchan_out ); #if 1 /*TODO: To be removed later***************************************************************************************/ h_dirac_output_synthesis_params->alpha_synthesis = NULL; if ( ( h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); Loading Loading @@ -234,22 +233,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; } /*-----------------------------------------------------------------* * prepare processing parameters *-----------------------------------------------------------------*/ /* compute interpolator */ if ( ( h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } for ( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) interp_length; } #endif return IVAS_ERR_OK; } Loading Loading @@ -369,6 +352,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } #endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator_fx() Loading @@ -394,9 +378,7 @@ void ivas_dirac_dec_output_synthesis_get_interpolator_fx( return; } #endif #else /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator() * Loading @@ -417,6 +399,7 @@ void ivas_dirac_dec_output_synthesis_get_interpolator( return; } #endif /*-------------------------------------------------------------------* Loading Loading @@ -617,20 +600,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( h_dirac_output_synthesis_state->mixing_matrix_res_exp = NULL; } #if 1/*TODO: To be removed later(floating point dealloc)*/ /* free interpolator */ IF ( h_dirac_output_synthesis_params->interpolator != NULL ) { free( h_dirac_output_synthesis_params->interpolator ); h_dirac_output_synthesis_params->interpolator = NULL; } /* free alpha */ IF ( h_dirac_output_synthesis_params->alpha_synthesis != NULL ) { free( h_dirac_output_synthesis_params->alpha_synthesis ); h_dirac_output_synthesis_params->alpha_synthesis = NULL; } /* free proto_matrix */ IF ( h_dirac_output_synthesis_params->proto_matrix != NULL ) { Loading