Loading lib_com/ivas_fb_mixer.c +121 −3 Original line number Diff line number Diff line Loading @@ -527,8 +527,8 @@ ivas_error ivas_FB_mixer_open_fx( { if ( fb_cfg->num_out_chans == 0 ) { hFbMixer->ppFilterbank_inFR_re[i] = NULL; hFbMixer->ppFilterbank_inFR_im[i] = NULL; hFbMixer->ppFilterbank_inFR_re_fx[i] = NULL; hFbMixer->ppFilterbank_inFR_im_fx[i] = NULL; } else { Loading Loading @@ -650,7 +650,7 @@ ivas_error ivas_FB_mixer_open_fx( for ( j = start_diff_band_non48k; j < num_bands; j++ ) { #if 1 ////////////////////////////////// FLOAT //////////////////////// #if 0 ////////////////////////////////// FLOAT //////////////////////// if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); Loading Loading @@ -995,6 +995,124 @@ void ivas_FB_mixer_close( return; } #ifdef IVAS_FLOAT_FIXED void ivas_FB_mixer_close_fx( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate in Hz */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { IVAS_FB_MIXER_HANDLE hFbMixer; IVAS_FB_CFG *fb_cfg; int16_t i, j, num_bands; int16_t num_chs_alloc; hFbMixer = *hFbMixer_in; fb_cfg = hFbMixer->fb_cfg; IF( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; } ELSE IF( fb_cfg->active_w_mixing ) { num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); } ELSE { num_chs_alloc = 1; /* only W channel processed for predicting YZX */ } IF( hFbMixer != NULL ) { FOR( i = 0; i < num_chs_alloc; i++ ) { IF( fb_cfg->num_out_chans > 0 ) { j = fb_cfg->remix_order[i]; free( hFbMixer->ppFilterbank_inFR_re_fx[j] ); hFbMixer->ppFilterbank_inFR_re_fx[j] = NULL; free( hFbMixer->ppFilterbank_inFR_im_fx[j] ); hFbMixer->ppFilterbank_inFR_im_fx[j] = NULL; } } IF( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; } ELSE { num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); } FOR( i = 0; i < num_chs_alloc; i++ ) { free( hFbMixer->ppFilterbank_prior_input_fx[i] ); hFbMixer->ppFilterbank_prior_input_fx[i] = NULL; } IF( ( fb_cfg->active_w_mixing != -1 ) && ( fb_cfg->num_out_chans > 0 ) ) { free( hFbMixer->prior_mixer_fx[0][0] ); hFbMixer->prior_mixer_fx[0][0] = NULL; } IF( !spar_reconfig_flag ) { IF( fb_cfg->num_out_chans > 0 ) { num_bands = hFbMixer->pFb->filterbank_num_bands; IF( fb_cfg->active_w_mixing != -1 ) { FOR( i = 0; i < num_bands; i++ ) { free( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[i] ); hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[i] = NULL; } } IF( sampling_rate != 48000 ) { int16_t start_diff_band_non48k; start_diff_band_non48k = num_bands - hFbMixer->num_diff_bands; FOR( j = start_diff_band_non48k; j < num_bands; j++ ) { free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j] ); hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j] = NULL; free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[1][j] ); hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[1][j] = NULL; } } } IF( hFbMixer->pFb != NULL ) { free( hFbMixer->pFb ); hFbMixer->pFb = NULL; } } IF( hFbMixer->fb_cfg != NULL ) { free( hFbMixer->fb_cfg ); hFbMixer->fb_cfg = NULL; } IF( !spar_reconfig_flag ) { free( hFbMixer ); hFbMixer = NULL; } } return; } #endif /*-----------------------------------------------------------------------------------------* * Function ivas_fb_mixer_pcm_ingest() Loading lib_com/ivas_masa_com.c +36 −101 Original line number Diff line number Diff line Loading @@ -58,13 +58,13 @@ * Local prototypes *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat ); #ifdef IVAS_FLOAT_FIXED static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); #endif static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n ); #ifdef IVAS_FLOAT_FIXED #else static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); static int16_t quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); #endif Loading @@ -75,6 +75,7 @@ static int16_t quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, * Set-up MASA coding elements and bitrates *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void ivas_masa_set_elements( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t mc_mode, /* i : MC format mode */ Loading Loading @@ -164,7 +165,7 @@ void ivas_masa_set_elements( return; } #else void ivas_masa_set_elements_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 mc_mode, /* i : MC format mode */ Loading Loading @@ -282,6 +283,8 @@ void ivas_masa_set_elements_fx( return; } #endif /*--------------------------------------------------------------- * generate_gridEq() Loading @@ -289,6 +292,7 @@ void ivas_masa_set_elements_fx( * generate Spherical grid *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void generate_gridEq( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ) Loading Loading @@ -322,8 +326,7 @@ void generate_gridEq( return; } #ifdef IVAS_FLOAT_FIXED #else void generate_gridEq_fx( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ) Loading Loading @@ -355,6 +358,7 @@ void generate_gridEq_fx( * and other metadata properties. *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void ivas_masa_set_coding_config( MASA_CODEC_CONFIG *config, /* i/o: MASA coding config structure */ int16_t *band_mapping, /* o : Band mapping used */ Loading Loading @@ -484,15 +488,7 @@ void ivas_masa_set_coding_config( return; } #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * ivas_masa_set_coding_config_fx() * * Sets MASA codec parameters based on bitrate, number of directions, * and other metadata properties. *---------------------------------------------------------------*/ #else void ivas_masa_set_coding_config_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA coding config structure */ Word16 *band_mapping, /* o : Band mapping used */ Loading Loading @@ -654,6 +650,7 @@ void ivas_masa_set_coding_config_fx( * *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void masa_sample_rate_band_correction( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ int16_t *band_mapping, /* i/o: Band mapping used and modified */ Loading Loading @@ -702,17 +699,9 @@ void masa_sample_rate_band_correction( for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { hQMetaData->q_direction[0].band_data[band].azimuth[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = 0; #endif hQMetaData->q_direction[0].band_data[band].elevation[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = 0; #endif hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = 0; #endif if ( hQMetaData->coherence_flag && hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = 0u; Loading @@ -721,17 +710,8 @@ void masa_sample_rate_band_correction( if ( hQMetaData->no_directions == 2 ) { hQMetaData->q_direction[1].band_data[band].azimuth[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[1].band_data[band].azimuth_fx[sf] = 0; #endif hQMetaData->q_direction[1].band_data[band].elevation[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[1].band_data[band].elevation_fx[sf] = 0; #endif hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[1].band_data[band].energy_ratio_fx[sf] = 0; #endif if ( hQMetaData->coherence_flag && hQMetaData->q_direction[1].coherence_band_data != NULL ) { Loading Loading @@ -774,8 +754,7 @@ void masa_sample_rate_band_correction( return; } #ifdef IVAS_FLOAT_FIXED #else void masa_sample_rate_band_correction_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ Word16 *band_mapping, /* i/o: Band mapping used and modified */ Loading Loading @@ -899,6 +878,7 @@ void masa_sample_rate_band_correction_fx( *------------------------------------------------------------------------*/ /*! r: output index for direction */ #ifndef IVAS_FLOAT_FIXED uint16_t index_theta_phi_16( float *p_theta, /* i/o: input elevation to be indexed */ float *p_phi, /* i/o: input azimuth to be indexed */ Loading Loading @@ -988,15 +968,7 @@ uint16_t index_theta_phi_16( return idx_sph; } #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * index_theta_phi_16_fx() * * *------------------------------------------------------------------------*/ /*! r: output index for direction */ #else UWord16 index_theta_phi_16_fx( Word32 *p_theta, /* i/o: input elevation to be indexed */ Word32 *p_phi, /* i/o: input azimuth to be indexed */ Loading Loading @@ -1102,6 +1074,7 @@ UWord16 index_theta_phi_16_fx( } #endif /*------------------------------------------------------------------------- * quantize_phi_masa() * Loading @@ -1109,6 +1082,7 @@ UWord16 index_theta_phi_16_fx( *------------------------------------------------------------------------*/ /*! r: output index */ #ifndef IVAS_FLOAT_FIXED static int16_t quantize_theta_masa( float x, /* i : theta value to be quantized */ const int16_t no_cb, /* i : number of codewords */ Loading Loading @@ -1142,15 +1116,7 @@ static int16_t quantize_theta_masa( return imin; } #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * quantize_theta_masa_fx() * * *------------------------------------------------------------------------*/ /*! r: output index */ #else static Word16 quantize_theta_masa_fx( const Word32 x_fx, /* i : theta value to be quantized */ const Word16 no_cb, /* i : number of codewords */ Loading Loading @@ -1186,6 +1152,7 @@ static Word16 quantize_theta_masa_fx( } #endif /*------------------------------------------------------------------------- * quantize_phi_masa() * Loading @@ -1193,6 +1160,7 @@ static Word16 quantize_theta_masa_fx( *------------------------------------------------------------------------*/ /*! r: index azimuth */ #ifndef IVAS_FLOAT_FIXED static int16_t quantize_phi_masa( float phi, /* i : azimuth value */ const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ Loading Loading @@ -1238,15 +1206,7 @@ static int16_t quantize_phi_masa( return id_phi; } #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * quantize_phi_masa_fx() * * *------------------------------------------------------------------------*/ /*! r: index azimuth */ #else static Word16 quantize_phi_masa_fx( const Word32 phi_fx, /* i : azimuth value */ const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ Loading Loading @@ -1301,9 +1261,9 @@ static Word16 quantize_phi_masa_fx( return id_phi; } #endif /*------------------------------------------------------------------------- * deindex_sph_idx() * Loading Loading @@ -1614,6 +1574,7 @@ void deindex_sph_idx_fx( *---------------------------------------------------------------*/ /*! r: valid or not 1/0 */ #ifndef IVAS_FLOAT_FIXED int16_t valid_ratio_index( int16_t index, /* i : index to be checked */ const int16_t K, /* i : L1 norm to check against */ Loading Loading @@ -1650,8 +1611,7 @@ int16_t valid_ratio_index( return out; } #ifdef IVAS_FLOAT_FIXED #else Word16 valid_ratio_index_fx( Word16 index, /* i : index to be checked */ const Word16 K, /* i : L1 norm to check against */ Loading Loading @@ -1708,6 +1668,7 @@ Word16 valid_ratio_index_fx( * Obtains ISM ratio values from the quantized indexes *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void reconstruct_ism_ratios( int16_t *ratio_ism_idx, /* i : index vector */ const int16_t nchan_ism, /* i : number of components/objects */ Loading @@ -1734,14 +1695,7 @@ void reconstruct_ism_ratios( return; } /*--------------------------------------------------------------- * reconstruct_ism_ratios_fx() * * Obtains ISM ratio values from the quantized indexes *---------------------------------------------------------------*/ #else void reconstruct_ism_ratios_fx( Word16 *ratio_ism_idx, /* i : index vector Q0 */ const Word16 nchan_ism, /* i : number of components/objects Q0 */ Loading Loading @@ -1774,6 +1728,7 @@ void reconstruct_ism_ratios_fx( return; } #endif /*--------------------------------------------------------------- Loading @@ -1783,6 +1738,7 @@ void reconstruct_ism_ratios_fx( * to the total audio scene *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void ivas_omasa_modify_masa_energy_ratios( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] ) Loading Loading @@ -1811,15 +1767,7 @@ void ivas_omasa_modify_masa_energy_ratios( return; } #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * ivas_omasa_modify_masa_energy_ratios_fx() * * Updates energy ratios by taking into account the MASA content contribution * to the total audio scene *---------------------------------------------------------------*/ #else void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] /* Q30 */ ) Loading Loading @@ -1863,6 +1811,7 @@ void ivas_omasa_modify_masa_energy_ratios_fx( * Obtain ISM ratio indexes for even content distribution bbetween objects *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void distribute_evenly_ism( int16_t *idx, /* o : index values */ const int16_t K, /* i : sum of indexes */ Loading Loading @@ -1895,14 +1844,7 @@ void distribute_evenly_ism( return; } #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * distribute_evenly_ism_fx() * * Obtain ISM ratio indexes for even content distribution bbetween objects *---------------------------------------------------------------*/ #else void distribute_evenly_ism_fx( Word16 *idx, /* o : index values */ const Word16 K, /* i : sum of indexes */ Loading Loading @@ -1959,6 +1901,7 @@ void distribute_evenly_ism_fx( *---------------------------------------------------------------*/ /*! r: CPE bitrate value */ #ifndef IVAS_FLOAT_FIXED int32_t calculate_cpe_brate_MASA_ISM( const ISM_MODE ism_mode, /* i : ism mode */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Loading Loading @@ -1994,16 +1937,7 @@ int32_t calculate_cpe_brate_MASA_ISM( return cpe_brate; } /*--------------------------------------------------------------- * calculate_cpe_brate_MASA_ISM_fx() * * Calculates bitrate for MASA_ISM mode that is not used for separated objects, * * but for the CPE part (metadata included) *---------------------------------------------------------------*/ /*! r: CPE bitrate value */ #else Word32 calculate_cpe_brate_MASA_ISM_fx( const ISM_MODE ism_mode, /* i : ism mode */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Loading Loading @@ -2044,3 +1978,4 @@ Word32 calculate_cpe_brate_MASA_ISM_fx( return cpe_brate; } #endif lib_com/ivas_prot.h +4 −3 Original line number Diff line number Diff line Loading @@ -5264,7 +5264,8 @@ void ivas_sba_mix_matrix_determiner_fx( const Word16 bfi, /* i : BFI flag */ const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ const Word16 output_frame, /* i : output frame length */ const Word16 num_md_sub_frames /* i : number of subframes in mixing matrix */ const Word16 num_md_sub_frames, /* i : number of subframes in mixing matrix */ const Word16 Q_p_Output /* i : number of subframes in mixing matrix */ ); #endif // IVAS_FLOAT_FIXED Loading Loading @@ -7379,7 +7380,7 @@ ivas_error ivas_omasa_ism_metadata_dec( const int16_t dirac_bs_md_write_idx, /* i : DirAC bitstream write index */ int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); #ifndef IVAS_FLOAT_FIXED ivas_error ivas_omasa_dirac_td_binaural_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of samples requested */ Loading @@ -7388,7 +7389,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( const int16_t nchan_transport, /* i : number of transport channels */ float *output_f[] /* o : rendered time signal */ ); #endif void ivas_omasa_rearrange_channels( float *output[], /* o : output synthesis signal */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ Loading lib_com/ivas_prot_fx.h +36 −0 Original line number Diff line number Diff line Loading @@ -2223,6 +2223,12 @@ ivas_error ivas_FB_mixer_open_fx( const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_FB_mixer_close_fx( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate in Hz */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_fb_mixer_cross_fading_fx( IVAS_FB_MIXER_HANDLE hFbMixer, Word32 **ppOut_pcm_fx, Loading @@ -2232,4 +2238,34 @@ void ivas_fb_mixer_cross_fading_fx( const int16_t frame_len, const int16_t cf_offset ); // ivas_omasa_dec.c ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const UWord16 nSamplesAsked, /* i : number of samples requested */ UWord16 *nSamplesRendered, /* o : number of samples rendered */ UWord16 *nSamplesAvailable, /* o : number of samples still to render */ const Word16 nchan_transport, /* i : number of transport channels */ Word32 *output_fx[] /* o : rendered time signal */ ); Word16 ivas_sba_get_analysis_order_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 sba_order /* i : Ambisonic (SBA) order */ ); Word16 ivas_sba_get_nchan_metadata_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_sba_get_spar_hoa_ch_ind_fx( const Word16 num_md_chs, /* i : number of MD channels */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] ); void ivas_sba_get_spar_hoa_md_flag_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Word16 *spar_hoa_md_flag, Word16 *spar_hoa_dirac2spar_md_flag ); #endif lib_com/ivas_sba_config.c +113 −14 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
lib_com/ivas_fb_mixer.c +121 −3 Original line number Diff line number Diff line Loading @@ -527,8 +527,8 @@ ivas_error ivas_FB_mixer_open_fx( { if ( fb_cfg->num_out_chans == 0 ) { hFbMixer->ppFilterbank_inFR_re[i] = NULL; hFbMixer->ppFilterbank_inFR_im[i] = NULL; hFbMixer->ppFilterbank_inFR_re_fx[i] = NULL; hFbMixer->ppFilterbank_inFR_im_fx[i] = NULL; } else { Loading Loading @@ -650,7 +650,7 @@ ivas_error ivas_FB_mixer_open_fx( for ( j = start_diff_band_non48k; j < num_bands; j++ ) { #if 1 ////////////////////////////////// FLOAT //////////////////////// #if 0 ////////////////////////////////// FLOAT //////////////////////// if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); Loading Loading @@ -995,6 +995,124 @@ void ivas_FB_mixer_close( return; } #ifdef IVAS_FLOAT_FIXED void ivas_FB_mixer_close_fx( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate in Hz */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { IVAS_FB_MIXER_HANDLE hFbMixer; IVAS_FB_CFG *fb_cfg; int16_t i, j, num_bands; int16_t num_chs_alloc; hFbMixer = *hFbMixer_in; fb_cfg = hFbMixer->fb_cfg; IF( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; } ELSE IF( fb_cfg->active_w_mixing ) { num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); } ELSE { num_chs_alloc = 1; /* only W channel processed for predicting YZX */ } IF( hFbMixer != NULL ) { FOR( i = 0; i < num_chs_alloc; i++ ) { IF( fb_cfg->num_out_chans > 0 ) { j = fb_cfg->remix_order[i]; free( hFbMixer->ppFilterbank_inFR_re_fx[j] ); hFbMixer->ppFilterbank_inFR_re_fx[j] = NULL; free( hFbMixer->ppFilterbank_inFR_im_fx[j] ); hFbMixer->ppFilterbank_inFR_im_fx[j] = NULL; } } IF( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; } ELSE { num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); } FOR( i = 0; i < num_chs_alloc; i++ ) { free( hFbMixer->ppFilterbank_prior_input_fx[i] ); hFbMixer->ppFilterbank_prior_input_fx[i] = NULL; } IF( ( fb_cfg->active_w_mixing != -1 ) && ( fb_cfg->num_out_chans > 0 ) ) { free( hFbMixer->prior_mixer_fx[0][0] ); hFbMixer->prior_mixer_fx[0][0] = NULL; } IF( !spar_reconfig_flag ) { IF( fb_cfg->num_out_chans > 0 ) { num_bands = hFbMixer->pFb->filterbank_num_bands; IF( fb_cfg->active_w_mixing != -1 ) { FOR( i = 0; i < num_bands; i++ ) { free( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[i] ); hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[i] = NULL; } } IF( sampling_rate != 48000 ) { int16_t start_diff_band_non48k; start_diff_band_non48k = num_bands - hFbMixer->num_diff_bands; FOR( j = start_diff_band_non48k; j < num_bands; j++ ) { free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j] ); hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j] = NULL; free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[1][j] ); hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[1][j] = NULL; } } } IF( hFbMixer->pFb != NULL ) { free( hFbMixer->pFb ); hFbMixer->pFb = NULL; } } IF( hFbMixer->fb_cfg != NULL ) { free( hFbMixer->fb_cfg ); hFbMixer->fb_cfg = NULL; } IF( !spar_reconfig_flag ) { free( hFbMixer ); hFbMixer = NULL; } } return; } #endif /*-----------------------------------------------------------------------------------------* * Function ivas_fb_mixer_pcm_ingest() Loading
lib_com/ivas_masa_com.c +36 −101 Original line number Diff line number Diff line Loading @@ -58,13 +58,13 @@ * Local prototypes *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat ); #ifdef IVAS_FLOAT_FIXED static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); #endif static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n ); #ifdef IVAS_FLOAT_FIXED #else static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); static int16_t quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); #endif Loading @@ -75,6 +75,7 @@ static int16_t quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, * Set-up MASA coding elements and bitrates *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void ivas_masa_set_elements( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t mc_mode, /* i : MC format mode */ Loading Loading @@ -164,7 +165,7 @@ void ivas_masa_set_elements( return; } #else void ivas_masa_set_elements_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 mc_mode, /* i : MC format mode */ Loading Loading @@ -282,6 +283,8 @@ void ivas_masa_set_elements_fx( return; } #endif /*--------------------------------------------------------------- * generate_gridEq() Loading @@ -289,6 +292,7 @@ void ivas_masa_set_elements_fx( * generate Spherical grid *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void generate_gridEq( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ) Loading Loading @@ -322,8 +326,7 @@ void generate_gridEq( return; } #ifdef IVAS_FLOAT_FIXED #else void generate_gridEq_fx( SPHERICAL_GRID_DATA *data /* o : data structure for grid */ ) Loading Loading @@ -355,6 +358,7 @@ void generate_gridEq_fx( * and other metadata properties. *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void ivas_masa_set_coding_config( MASA_CODEC_CONFIG *config, /* i/o: MASA coding config structure */ int16_t *band_mapping, /* o : Band mapping used */ Loading Loading @@ -484,15 +488,7 @@ void ivas_masa_set_coding_config( return; } #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * ivas_masa_set_coding_config_fx() * * Sets MASA codec parameters based on bitrate, number of directions, * and other metadata properties. *---------------------------------------------------------------*/ #else void ivas_masa_set_coding_config_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA coding config structure */ Word16 *band_mapping, /* o : Band mapping used */ Loading Loading @@ -654,6 +650,7 @@ void ivas_masa_set_coding_config_fx( * *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void masa_sample_rate_band_correction( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ int16_t *band_mapping, /* i/o: Band mapping used and modified */ Loading Loading @@ -702,17 +699,9 @@ void masa_sample_rate_band_correction( for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { hQMetaData->q_direction[0].band_data[band].azimuth[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = 0; #endif hQMetaData->q_direction[0].band_data[band].elevation[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = 0; #endif hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[0].band_data[band].energy_ratio_fx[sf] = 0; #endif if ( hQMetaData->coherence_flag && hQMetaData->q_direction[0].coherence_band_data != NULL ) { hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = 0u; Loading @@ -721,17 +710,8 @@ void masa_sample_rate_band_correction( if ( hQMetaData->no_directions == 2 ) { hQMetaData->q_direction[1].band_data[band].azimuth[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[1].band_data[band].azimuth_fx[sf] = 0; #endif hQMetaData->q_direction[1].band_data[band].elevation[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[1].band_data[band].elevation_fx[sf] = 0; #endif hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = 0.0f; #ifdef IVAS_FLOAT_FIXED hQMetaData->q_direction[1].band_data[band].energy_ratio_fx[sf] = 0; #endif if ( hQMetaData->coherence_flag && hQMetaData->q_direction[1].coherence_band_data != NULL ) { Loading Loading @@ -774,8 +754,7 @@ void masa_sample_rate_band_correction( return; } #ifdef IVAS_FLOAT_FIXED #else void masa_sample_rate_band_correction_fx( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ Word16 *band_mapping, /* i/o: Band mapping used and modified */ Loading Loading @@ -899,6 +878,7 @@ void masa_sample_rate_band_correction_fx( *------------------------------------------------------------------------*/ /*! r: output index for direction */ #ifndef IVAS_FLOAT_FIXED uint16_t index_theta_phi_16( float *p_theta, /* i/o: input elevation to be indexed */ float *p_phi, /* i/o: input azimuth to be indexed */ Loading Loading @@ -988,15 +968,7 @@ uint16_t index_theta_phi_16( return idx_sph; } #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * index_theta_phi_16_fx() * * *------------------------------------------------------------------------*/ /*! r: output index for direction */ #else UWord16 index_theta_phi_16_fx( Word32 *p_theta, /* i/o: input elevation to be indexed */ Word32 *p_phi, /* i/o: input azimuth to be indexed */ Loading Loading @@ -1102,6 +1074,7 @@ UWord16 index_theta_phi_16_fx( } #endif /*------------------------------------------------------------------------- * quantize_phi_masa() * Loading @@ -1109,6 +1082,7 @@ UWord16 index_theta_phi_16_fx( *------------------------------------------------------------------------*/ /*! r: output index */ #ifndef IVAS_FLOAT_FIXED static int16_t quantize_theta_masa( float x, /* i : theta value to be quantized */ const int16_t no_cb, /* i : number of codewords */ Loading Loading @@ -1142,15 +1116,7 @@ static int16_t quantize_theta_masa( return imin; } #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * quantize_theta_masa_fx() * * *------------------------------------------------------------------------*/ /*! r: output index */ #else static Word16 quantize_theta_masa_fx( const Word32 x_fx, /* i : theta value to be quantized */ const Word16 no_cb, /* i : number of codewords */ Loading Loading @@ -1186,6 +1152,7 @@ static Word16 quantize_theta_masa_fx( } #endif /*------------------------------------------------------------------------- * quantize_phi_masa() * Loading @@ -1193,6 +1160,7 @@ static Word16 quantize_theta_masa_fx( *------------------------------------------------------------------------*/ /*! r: index azimuth */ #ifndef IVAS_FLOAT_FIXED static int16_t quantize_phi_masa( float phi, /* i : azimuth value */ const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ Loading Loading @@ -1238,15 +1206,7 @@ static int16_t quantize_phi_masa( return id_phi; } #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * quantize_phi_masa_fx() * * *------------------------------------------------------------------------*/ /*! r: index azimuth */ #else static Word16 quantize_phi_masa_fx( const Word32 phi_fx, /* i : azimuth value */ const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ Loading Loading @@ -1301,9 +1261,9 @@ static Word16 quantize_phi_masa_fx( return id_phi; } #endif /*------------------------------------------------------------------------- * deindex_sph_idx() * Loading Loading @@ -1614,6 +1574,7 @@ void deindex_sph_idx_fx( *---------------------------------------------------------------*/ /*! r: valid or not 1/0 */ #ifndef IVAS_FLOAT_FIXED int16_t valid_ratio_index( int16_t index, /* i : index to be checked */ const int16_t K, /* i : L1 norm to check against */ Loading Loading @@ -1650,8 +1611,7 @@ int16_t valid_ratio_index( return out; } #ifdef IVAS_FLOAT_FIXED #else Word16 valid_ratio_index_fx( Word16 index, /* i : index to be checked */ const Word16 K, /* i : L1 norm to check against */ Loading Loading @@ -1708,6 +1668,7 @@ Word16 valid_ratio_index_fx( * Obtains ISM ratio values from the quantized indexes *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void reconstruct_ism_ratios( int16_t *ratio_ism_idx, /* i : index vector */ const int16_t nchan_ism, /* i : number of components/objects */ Loading @@ -1734,14 +1695,7 @@ void reconstruct_ism_ratios( return; } /*--------------------------------------------------------------- * reconstruct_ism_ratios_fx() * * Obtains ISM ratio values from the quantized indexes *---------------------------------------------------------------*/ #else void reconstruct_ism_ratios_fx( Word16 *ratio_ism_idx, /* i : index vector Q0 */ const Word16 nchan_ism, /* i : number of components/objects Q0 */ Loading Loading @@ -1774,6 +1728,7 @@ void reconstruct_ism_ratios_fx( return; } #endif /*--------------------------------------------------------------- Loading @@ -1783,6 +1738,7 @@ void reconstruct_ism_ratios_fx( * to the total audio scene *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void ivas_omasa_modify_masa_energy_ratios( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] ) Loading Loading @@ -1811,15 +1767,7 @@ void ivas_omasa_modify_masa_energy_ratios( return; } #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * ivas_omasa_modify_masa_energy_ratios_fx() * * Updates energy ratios by taking into account the MASA content contribution * to the total audio scene *---------------------------------------------------------------*/ #else void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] /* Q30 */ ) Loading Loading @@ -1863,6 +1811,7 @@ void ivas_omasa_modify_masa_energy_ratios_fx( * Obtain ISM ratio indexes for even content distribution bbetween objects *---------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED void distribute_evenly_ism( int16_t *idx, /* o : index values */ const int16_t K, /* i : sum of indexes */ Loading Loading @@ -1895,14 +1844,7 @@ void distribute_evenly_ism( return; } #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * distribute_evenly_ism_fx() * * Obtain ISM ratio indexes for even content distribution bbetween objects *---------------------------------------------------------------*/ #else void distribute_evenly_ism_fx( Word16 *idx, /* o : index values */ const Word16 K, /* i : sum of indexes */ Loading Loading @@ -1959,6 +1901,7 @@ void distribute_evenly_ism_fx( *---------------------------------------------------------------*/ /*! r: CPE bitrate value */ #ifndef IVAS_FLOAT_FIXED int32_t calculate_cpe_brate_MASA_ISM( const ISM_MODE ism_mode, /* i : ism mode */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ Loading Loading @@ -1994,16 +1937,7 @@ int32_t calculate_cpe_brate_MASA_ISM( return cpe_brate; } /*--------------------------------------------------------------- * calculate_cpe_brate_MASA_ISM_fx() * * Calculates bitrate for MASA_ISM mode that is not used for separated objects, * * but for the CPE part (metadata included) *---------------------------------------------------------------*/ /*! r: CPE bitrate value */ #else Word32 calculate_cpe_brate_MASA_ISM_fx( const ISM_MODE ism_mode, /* i : ism mode */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Loading Loading @@ -2044,3 +1978,4 @@ Word32 calculate_cpe_brate_MASA_ISM_fx( return cpe_brate; } #endif
lib_com/ivas_prot.h +4 −3 Original line number Diff line number Diff line Loading @@ -5264,7 +5264,8 @@ void ivas_sba_mix_matrix_determiner_fx( const Word16 bfi, /* i : BFI flag */ const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ const Word16 output_frame, /* i : output frame length */ const Word16 num_md_sub_frames /* i : number of subframes in mixing matrix */ const Word16 num_md_sub_frames, /* i : number of subframes in mixing matrix */ const Word16 Q_p_Output /* i : number of subframes in mixing matrix */ ); #endif // IVAS_FLOAT_FIXED Loading Loading @@ -7379,7 +7380,7 @@ ivas_error ivas_omasa_ism_metadata_dec( const int16_t dirac_bs_md_write_idx, /* i : DirAC bitstream write index */ int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); #ifndef IVAS_FLOAT_FIXED ivas_error ivas_omasa_dirac_td_binaural_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of samples requested */ Loading @@ -7388,7 +7389,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( const int16_t nchan_transport, /* i : number of transport channels */ float *output_f[] /* o : rendered time signal */ ); #endif void ivas_omasa_rearrange_channels( float *output[], /* o : output synthesis signal */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ Loading
lib_com/ivas_prot_fx.h +36 −0 Original line number Diff line number Diff line Loading @@ -2223,6 +2223,12 @@ ivas_error ivas_FB_mixer_open_fx( const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_FB_mixer_close_fx( IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate in Hz */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_fb_mixer_cross_fading_fx( IVAS_FB_MIXER_HANDLE hFbMixer, Word32 **ppOut_pcm_fx, Loading @@ -2232,4 +2238,34 @@ void ivas_fb_mixer_cross_fading_fx( const int16_t frame_len, const int16_t cf_offset ); // ivas_omasa_dec.c ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const UWord16 nSamplesAsked, /* i : number of samples requested */ UWord16 *nSamplesRendered, /* o : number of samples rendered */ UWord16 *nSamplesAvailable, /* o : number of samples still to render */ const Word16 nchan_transport, /* i : number of transport channels */ Word32 *output_fx[] /* o : rendered time signal */ ); Word16 ivas_sba_get_analysis_order_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ const Word16 sba_order /* i : Ambisonic (SBA) order */ ); Word16 ivas_sba_get_nchan_metadata_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_sba_get_spar_hoa_ch_ind_fx( const Word16 num_md_chs, /* i : number of MD channels */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] ); void ivas_sba_get_spar_hoa_md_flag_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ Word16 *spar_hoa_md_flag, Word16 *spar_hoa_dirac2spar_md_flag ); #endif
lib_com/ivas_sba_config.c +113 −14 File changed.Preview size limit exceeded, changes collapsed. Show changes