diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 49ca422052a11a9df44008e9498868ee9b5f0522..0ee9b40ae09e458616a1d87ab84898f087ca08e4 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -165,9 +165,9 @@ int16_t get_codec_mode( int16_t getTcxonly( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ - , - const int16_t is_ism_format ) + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ + const int16_t is_ism_format /* i : flag indicating ISM format */ +) { int16_t tcxonly = 0; @@ -353,12 +353,11 @@ int16_t sr2fscale( *-------------------------------------------------------------------*/ int32_t getCoreSamplerateMode2( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ - const int16_t rf_mode /* i : flag to signal the RF mode */ - , + const int16_t element_mode, /* i : IVAS element mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t bwidth, /* i : audio bandwidth */ + const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ + const int16_t rf_mode, /* i : flag to signal the RF mode */ const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ ) { diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 85370e3596a1ef25743b872faaf3fe75f6ea5bfd..20f4b24953afe5d8b4e1215337347c016327c1ac 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -94,10 +94,8 @@ ivas_error ivas_dirac_config( ivas_error error; int16_t spar_dirac_split_band; IVAS_FB_MIXER_HANDLE hFbMdft; - int16_t *dirac_to_spar_md_bands; - error = IVAS_ERR_OK; if ( enc_dec == ENC ) @@ -176,7 +174,6 @@ ivas_error ivas_dirac_config( hConfig->enc_param_start_band = hQMetaData->q_direction[0].cfg.start_band + spar_dirac_split_band; } - hConfig->dec_param_estim = TRUE; if ( hConfig->dec_param_estim == TRUE ) { @@ -452,6 +449,7 @@ ivas_error ivas_dirac_sba_config( return error; } } + ivas_get_dirac_sba_max_md_bits( sba_total_brate, &hQMetaData->bits_frame_nominal, &hQMetaData->metadata_max_bits, &hQMetaData->qmetadata_max_bit_req, hQMetaData->q_direction[0].cfg.nbands ); return error; diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 80247804b0d84b0ce12032de7faecf59845f8bff..b95de4327a976db15d8f73ce5952f14de85b9403 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -64,7 +64,7 @@ static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_ * Get number of bands from BW index *-----------------------------------------------------------------------------------------*/ -/* !r: number of spectral bands */ +/*! r: number of spectral bands */ int16_t ivas_get_num_bands_from_bw_idx( const int16_t bwidth /* i : audio bandwidth */ ) diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 8c821d99fd1613ce762508911878e4992baf5b2c..b1a6c256d2a0eaf785e58ebadcc74dde392fd337 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -324,7 +324,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const uint8_t maxBand, /* i : max band */ - uint8_t is_encoder, /* i: signals if called at encoder */ + uint8_t is_encoder, /* i : signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { @@ -332,7 +332,6 @@ void masa_sample_rate_band_correction( int16_t highBand; uint8_t numBands48k; - numBands48k = config->numCodingBands; for ( band = 1; band < config->numCodingBands + 1; band++ ) @@ -343,6 +342,7 @@ void masa_sample_rate_band_correction( { config->numCodingBands = band; hQMetaData->numCodingBands = band; + if ( is_encoder ) { if ( hQMetaData->q_direction->cfg.nbands > band ) @@ -354,7 +354,9 @@ void masa_sample_rate_band_correction( hQMetaData->q_direction[1].cfg.nbands = band; } } + band_mapping[band] = maxBand; + break; } } @@ -396,6 +398,7 @@ void masa_sample_rate_band_correction( hQMetaData->twoDirBands[band] = 0; } } + if ( hExtOutMeta != NULL ) { /* in decoder, zero the EXT out MASA meta buffer */ @@ -637,11 +640,7 @@ void deindex_sph_idx( int16_t id_phi; int16_t no_th = gridData->no_theta; const int16_t *n = gridData->no_phi; - const float ba[3] = { - 2.137991118026424e+02f, - 1.244854404591542e+02f, - 1.228408647140870e+02f, - }; + const float ba[3] = { 2.137991118026424e+02f, 1.244854404591542e+02f, 1.228408647140870e+02f }; const float del[3] = { 7.998262115303199e+05f, 1.300883976959332e+06f, 1.424072242426373e+06f }; const float div[3] = { -0.237662341081474f, -0.100938185496887f, -0.092050209205032f }; const float a4[3] = { -8.415300425381099f, -19.814106922515204f, -21.727272727270197f }; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7e95c097e440489ce0f2198ccba45d54ac2e52ce..ba48326231950e68ded7fda43eadec34f782e4c3 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1213,8 +1213,8 @@ float stereo_dft_enc_synthesize( void stereo_dft_enc_process( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const int16_t vad_flag_dtx[], /* i: VAD dtx flags */ - const int16_t vad_hover_flag[], /* i: VAD hangover flags */ + const int16_t vad_flag_dtx[], /* i : VAD dtx flags */ + const int16_t vad_hover_flag[], /* i : VAD hangover flags */ const int16_t input_frame /* i : input frame length */ ); @@ -2135,8 +2135,8 @@ void deindex_lvq_SHB( void stereo_td_itd_mdct_stereo( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder handle */ - const int16_t vad_flag_dtx[], /* i: VAD dtx flags */ - const int16_t vad_hover_flag[], /* i: VAD hangover flags */ + const int16_t vad_flag_dtx[], /* i : VAD dtx flags */ + const int16_t vad_hover_flag[], /* i : VAD hangover flags */ const int16_t input_frame /* i : frame length */ ); @@ -3154,7 +3154,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ uint16_t *bitstream, /* i : bitstream */ int16_t *index, /* i/o: bitstream position */ - const SPHERICAL_GRID_DATA *sph_grid16, /* i: spherical grid for deindexing */ + const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ const int16_t bits_sph_idx, const int16_t bits_sp_coh, const uint8_t ncoding_bands_config @@ -3176,7 +3176,7 @@ void ivas_qmetadata_to_dirac( MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -5111,7 +5111,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const uint8_t maxBand, /* i : max band */ - uint8_t is_encoder, /* i: signals if called at encoder */ + uint8_t is_encoder, /* i : signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ); @@ -5173,7 +5173,7 @@ void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ int16_t subframe_idx, /* i : subframe index */ - const int16_t numTimeSlots, /* i: : number of time slots to process */ + const int16_t numTimeSlots, /* i : number of time slots to process */ float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index c56421103deaac3387275e153fd2f52430b35daf..ebc9c894665ae17a7d395cd66d4457af85eb7473 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1675,18 +1675,15 @@ void ivas_get_spar_md_from_dirac( float **ppMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH]; float *pMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; float en_ratio_fac, diff_norm_order1, diff_norm_order2, diff_norm_order3; - int16_t ndm, foa_ch, hoa2_ch; float P_dir_fact[IVAS_SPAR_MAX_CH - 1]; const int16_t *remix_order; remix_order = remix_order_set[hSpar_md_cfg->remix_unmix_order]; - num_ch = ivas_sba_get_nchan_metadata( order, IVAS_256k /*dummy value as order is always 1 in this function*/ - ); + num_ch = ivas_sba_get_nchan_metadata( order, IVAS_256k /*dummy value as order is always 1 in this function*/ ); - hoa2_ch = ivas_sba_get_nchan_metadata( SBA_HOA2_ORDER, IVAS_256k /*dummy value as order is always 1 in this function*/ - ); + hoa2_ch = ivas_sba_get_nchan_metadata( SBA_HOA2_ORDER, IVAS_256k /*dummy value as order is always 1 in this function*/ ); foa_ch = FOA_CHANNELS; diff_norm_order1 = 3.0f; @@ -1835,67 +1832,66 @@ void ivas_get_spar_md_from_dirac( en_ratio_fac = ( 1.0f - diffuseness[band] ); + + for ( i = 0; i < num_ch; i++ ) { - for ( i = 0; i < num_ch; i++ ) + for ( j = 0; j < num_ch; j++ ) { - for ( j = 0; j < num_ch; j++ ) + if ( i == j ) { - if ( i == j ) + if ( i == 0 ) { - if ( i == 0 ) - { - cov_real_dirac[i][i][band] = 1.0f; - } - else + cov_real_dirac[i][i][band] = 1.0f; + } + else + { + cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; + + if ( hSpar_md_cfg->nchan_transport <= 2 ) { - cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; - if ( hSpar_md_cfg->nchan_transport <= 2 ) + cov_real_dirac[i][j][band] *= en_ratio_fac; + if ( ( i >= ndm ) && ( dtx_vad == 1 ) ) { - - cov_real_dirac[i][j][band] *= en_ratio_fac; - if ( ( i >= ndm ) && ( dtx_vad == 1 ) ) - { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) * P_dir_fact[i - ndm]; - } - else - { - if ( i < foa_ch ) - { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order1; - } - else if ( i < hoa2_ch ) - { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order2; - } - else - { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order3; - } - } + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) * P_dir_fact[i - ndm]; } else { if ( i < foa_ch ) { - cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order1; + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order1; } else if ( i < hoa2_ch ) { - cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order2; + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order2; } else { - cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order3; + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order3; } } } - } - else - { - cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; + else + { + if ( i < foa_ch ) + { + cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order1; + } + else if ( i < hoa2_ch ) + { + cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order2; + } + else + { + cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order3; + } + } } } + else + { + cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; + } } } } @@ -2138,7 +2134,6 @@ void ivas_spar_set_bitrate_config( int16_t quant_strat; int16_t bands_bw; - pSpar_md_cfg->nchan_transport = ivas_spar_br_table_consts[table_idx].nchan_transport; for ( i = 0; i < pSpar_md_cfg->nchan_transport; i++ ) @@ -2257,6 +2252,7 @@ void ivas_spar_set_bitrate_config( { pca_bits = 0; } + pSpar_md_cfg->max_md_bits_spar = pSpar_md_cfg->max_bits_per_blk + agc_bits + pca_bits; } diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 4f40b8301550461f90bb78a3c18d32ac1a1b0186..2f22dafa6135f48ddd03510c23b0eb4916774246 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2107,7 +2107,7 @@ void msvq_dec( const int16_t maxN, /* i : Codebook dimension */ const int16_t Idx[], /* i : Indices */ const int16_t applyIDCT_flag, /* i : applyIDCT flag */ - const float *invTrfMatrix, /* i: matrix for IDCT synthesis */ + const float *invTrfMatrix, /* i : matrix for IDCT synthesis */ float *uq, /* o : quantized vector */ Word16 *uq_ind /* o : quantized vector (fixed point) */ ) diff --git a/lib_com/prot.h b/lib_com/prot.h index be0469650a53d5bd999bbf008c8ebc297f51cc83..f49582849863e45d1ba4b92b4b9233e416046d62 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -9768,9 +9768,9 @@ int16_t get_codec_mode( int16_t getTcxonly( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ - , - const int16_t is_ism_format ); + const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ + const int16_t is_ism_format /* i : flag indicating ISM format */ +); int16_t getTnsAllowed( const int32_t total_brate, /* i : total bitrate */ @@ -9802,12 +9802,11 @@ int16_t sr2fscale( ); int32_t getCoreSamplerateMode2( - const int16_t element_mode, /* i : IVAS element mode */ - const int32_t total_brate, /* i : total bitrate */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ - const int16_t rf_mode /* i : flag to signal the RF mode */ - , + const int16_t element_mode, /* i : IVAS element mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t bwidth, /* i : audio bandwidth */ + const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ + const int16_t rf_mode, /* i : flag to signal the RF mode */ const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ ); diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 9b29ba03ab1b1eb3b4774117e7d384810cdf8277..3ceee9a2f46d465d13864514de93c0d733e3b466 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -74,8 +74,7 @@ void open_decoder_LPD( st->fscale_old = st->fscale; } - st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, - st->is_ism_format ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); st->fscale = sr2fscale( st->sr_core ); fscaleFB = sr2fscale( st->output_Fs ); @@ -94,8 +93,7 @@ void open_decoder_LPD( } } - st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag, - st->is_ism_format ); + st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag, st->is_ism_format ); /* the TD TCX PLC in MODE1 still runs with 80ms subframes */ if ( ( st->element_mode == EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= ACELP_32k ) || ( st->element_mode > EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= MAX_ACELP_BRATE ) || ( st->tcxonly && ( st->sr_core == 32000 || st->sr_core == 16000 ) ) ) diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index 60859a20fb2e91c27797c5ebf0b83c08a1d6bf61..16519aec47c268d53c8771c4389a43846d20a805 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -72,8 +72,7 @@ void mode_switch_decoder_LPD( { bSwitchFromAmrwbIO = 1; } - sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, - st->is_ism_format ); + sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); fscale = sr2fscale( sr_core ); /* set number of coded lines */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 78ce9522766eeb875e9f206277aebd5bf104008e..35bdc6041f1b24226662332e9a277b7464a24da5 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -107,8 +107,7 @@ void decoder_tcx( decoder_tcx_tns( st, L_frame_glob, L_spec, L_frame, L_frameTCX, &x[0], fUseTns, &tnsData, bfi, frame_cnt, 0 ); decoder_tcx_imdct( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x[0], &xn_buf[0], MDCT_IV, - fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, - sba_dirac_stereo_flag ); + fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, sba_dirac_stereo_flag ); return; } @@ -286,6 +285,7 @@ void decoder_tcx_post( return; } + /*-------------------------------------------------------------------* * IMDCT() * @@ -336,8 +336,7 @@ void IMDCT( v_multc( old_syn_overl, hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, old_syn_overl, overlap ); } - if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && - ( st->tcxonly ) ) + if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && st->tcxonly ) { /* Mode decision in PLC @@ -374,7 +373,9 @@ void IMDCT( TCX_MDXT_Inverse( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, kernel_type ); } else + { TCX_MDCT_Inverse( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, st->element_mode ); + } tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core_bfi, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); @@ -554,8 +555,7 @@ void IMDCT( /* Window and overlap-add past frame if past frame is TCX */ if ( ( frame_cnt != 0 ) || ( st->last_core_bfi > ACELP_CORE ) ) { - if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && - ( st->tcxonly ) ) || + if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) ) || ( hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ) { if ( !bfi && ( frame_cnt > 0 ) && ( index == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) && ( st->last_core != ACELP_CORE ) ) @@ -723,7 +723,6 @@ void decoder_tcx_invQ( TCX_DEC_HANDLE hTcxDec = st->hTcxDec; TCX_CONFIG_HANDLE hTcxCfg = st->hTcxCfg; - tnsSize = 0; prm_target = NULL; /* just to suppress MSVC warnigs */ @@ -1692,9 +1691,7 @@ void decoder_tcx_imdct( if ( st->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) { - IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, - hTcxCfg->tcx_aldo_window_1_trunc, - hTcxCfg->tcx_aldo_window_2, + IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_outLB, 0, st, 0, acelp_zir ); } @@ -1715,8 +1712,7 @@ void decoder_tcx_imdct( if ( st->element_mode != EVS_MONO ) { - IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, - hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, + IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); } @@ -1948,6 +1944,7 @@ void decoder_tcx_IGF_stereo( { sfbConf = &hStereoMdct->stbParamsTCX20afterACELP; } + /* create line wise ms mask for the core bands */ set_s( coreMsMask, 0, N_MAX ); diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 45ab2e343576d088ab1a7eeebcc5277f7f847c79..5e36f024f8507f402390b9863c88408ffbc90bb3 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1360,7 +1360,7 @@ void generate_comfort_noise_dec_hf( { seed2 = &( hFdCngCom->seed3 ); - c1 = (float) sqrt( hFdCngCom->coherence ); // VE!!!!! all occurences of "(float) sqrt()" should be replaced by "sqrtf()" + c1 = (float) sqrt( hFdCngCom->coherence ); c2 = (float) sqrt( 1 - hFdCngCom->coherence ); } diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 9061f3f39c51d71b2921fd4d5665cab5ee40cf10..5bd09236e0e40471c499b7d55495a096578e0c4f 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1120,14 +1120,14 @@ void ivas_binaural_cldfb_sf( *-------------------------------------------------------------------------*/ void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ - int16_t subframe_idx, /* i : subframe index */ - const int16_t numTimeSlots, /* i : number of time slots to render*/ - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ + int16_t subframe_idx, /* i : subframe index */ + const int16_t numTimeSlots, /* i : number of time slots to render */ + float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ) { int16_t chIdx, k; diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index a2683860dfefd9eddbabeec53d8f99063324b7ca..6ca33fcf5e83538e7fddeb7cf607a253b9f3b3d6 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,8 +405,7 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, - MAX_PARAM_SPATIAL_SUBFRAMES ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } /* synthesis iFFT */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 622d314181956d3fa96a143d4d35e7490ae99f39..fc24c8bdef5353e73c4054ba018fa4096713ed1a 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -851,15 +851,8 @@ ivas_error ivas_dirac_dec_config( /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, - output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), &( hDirAC->h_freq_domain_decorr_ap_state ), hDirAC->num_freq_bands, hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, hDirAC->synthesisConf, hDirAC->frequency_axis, nchan_transport > 2 ? 4 : nchan_transport, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -869,8 +862,7 @@ ivas_error ivas_dirac_dec_config( /* output synthesis */ if ( flag_config == DIRAC_OPEN ) { - if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, - hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -880,8 +872,7 @@ ivas_error ivas_dirac_dec_config( { ivas_dirac_dec_output_synthesis_close( hDirAC ); - if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, - hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs, hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -975,16 +966,14 @@ ivas_error ivas_dirac_dec_config( } /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE, - hodirac_flag ); + ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE, hodirac_flag ); /* Allocate stack memory */ if ( flag_config != DIRAC_OPEN ) { ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); } - if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ), - hodirac_flag ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ), hodirac_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -1060,6 +1049,7 @@ ivas_error ivas_dirac_dec_config( hDirAC->dithering_seed = DIRAC_DITH_SEED; st_ivas->hDirAC = hDirAC; } + /* allocate transport channels*/ if ( flag_config == DIRAC_OPEN ) { @@ -1160,7 +1150,6 @@ void ivas_dirac_dec_close( hDirAC->proto_index_dir = NULL; } - /* States */ /* free prototype signal buffers */ @@ -1720,8 +1709,7 @@ void ivas_dirac_dec_read_BS( hQMetaData->q_direction[0].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; } - *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), - hodirac_flag ); + *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), hodirac_flag ); } #ifdef DEBUGGING @@ -1736,6 +1724,7 @@ void ivas_dirac_dec_read_BS( /* subtract mode signaling bits, since bitstream was moved after mode reading */ st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); + /* 1 bit flag for SPAR/DirAC, already read in read format function */ b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; @@ -1779,9 +1768,7 @@ void ivas_dirac_dec_read_BS( if ( hDirAC != NULL ) { - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, SBA_FORMAT, - hodirac_flag, - dirac_to_spar_md_bands ); + ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); } return; @@ -1795,13 +1782,13 @@ void ivas_dirac_dec_read_BS( *-----------------------------------------------------------------------*/ void ivas_qmetadata_to_dirac( - const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ - MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ + DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ + MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t block, band; @@ -1935,8 +1922,7 @@ void ivas_qmetadata_to_dirac( hDirAC->hConfig->nbands = q_direction->cfg.nbands; } - ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, - dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft ); + ivas_dirac_config_bands( hDirAC->band_grouping, hDirAC->hConfig->nbands, nbands, dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hDirAC->hConfig->enc_param_start_band, hDirAC->hFbMdft ); nbands = hDirAC->hConfig->nbands; if ( hQMetaData->q_direction[0].cfg.nblocks == 0 ) @@ -2005,7 +1991,6 @@ void ivas_qmetadata_to_dirac( { int16_t block_qmetadata; - block_qmetadata = min( block, nblocks - 1 ); block_qmetadata = max( block_qmetadata, 0 ); @@ -2046,7 +2031,6 @@ void ivas_qmetadata_to_dirac( ele = max( -90, ele ); } - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) { hDirAC->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; @@ -2067,7 +2051,6 @@ void ivas_qmetadata_to_dirac( hDirAC->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; if ( hodirac_flag ) @@ -2123,6 +2106,7 @@ void ivas_qmetadata_to_dirac( /* update buffer write index */ hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + return; } @@ -2255,10 +2239,12 @@ void ivas_dirac_dec( { st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; } + for ( n = 0; n < nchan_transport; n++ ) { st_ivas->hTcBuffer->tc[n] = NULL; } + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) { st_ivas->hTcBuffer->tc[nchan_transport] = NULL; @@ -2324,6 +2310,7 @@ void ivas_dirac_dec_render( output_f_local[ch] += n_samples_sf; } } + if ( hDirAC->slots_rendered == hDirAC->num_slots ) { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) @@ -2437,7 +2424,7 @@ void ivas_dirac_dec_render_sf( { md_idx = hDirAC->render_to_md_map[slot_idx_start]; } - /* Another workaround for self test BE */ + /* ToDo: Another workaround for self test BE */ /* copy parameters into local buffers*/ if ( hDirAC->hConfig->dec_param_estim == FALSE ) @@ -2719,6 +2706,7 @@ void ivas_dirac_dec_render_sf( hDirAC->buffer_intensity_real[0][index - 1], hDirAC->buffer_intensity_real[1][index - 1], hDirAC->buffer_intensity_real[2][index - 1] ); + computeDirectionAngles( hDirAC->buffer_intensity_real[0][index - 1], hDirAC->buffer_intensity_real[1][index - 1], hDirAC->buffer_intensity_real[2][index - 1], @@ -2728,10 +2716,7 @@ void ivas_dirac_dec_render_sf( mvr2r( reference_power, &( hDirAC->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - computeDiffuseness( hDirAC->buffer_intensity_real, - hDirAC->buffer_energy, - num_freq_bands, - hDirAC->diffuseness_vector[md_idx] ); + computeDiffuseness( hDirAC->buffer_intensity_real, hDirAC->buffer_energy, num_freq_bands, hDirAC->diffuseness_vector[md_idx] ); } #ifdef DEBUG_MODE_DIRAC @@ -2867,9 +2852,7 @@ void ivas_dirac_dec_render_sf( hDirAC->hOutSetup, nchan_transport, md_idx, - hodirac_flag - - ); + hodirac_flag ); } else { diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index f1a5597175182d1af3a31ee746d2c9c50e040a02..4f25d5a465f606d87e22439f962df2a2a1fd1fb3 100755 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -1134,9 +1134,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( * Copy output or HOA decoder *-----------------------------------------------------------------*/ - if ( hDirAC->hOutSetup.is_loudspeaker_setup && hDirAC->hoa_decoder != NULL - - ) + if ( hDirAC->hOutSetup.is_loudspeaker_setup && hDirAC->hoa_decoder != NULL ) { float *p_real, *p_imag; const float *hoa_decoder; @@ -1266,6 +1264,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*-----------------------------------------------------------------* * compute target PSDs *-----------------------------------------------------------------*/ + if ( hDirAC->hConfig->enc_param_start_band == 0 ) { diff_start_band = h_dirac_output_synthesis_params->use_onset_filters == 1 ? h_dirac_output_synthesis_params->max_band_decorr : 0; @@ -1293,6 +1292,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->cy_auto_diff_smooth ); } + /*-----------------------------------------------------------------* * compute variables for stereo transport signal type detection *-----------------------------------------------------------------*/ @@ -1491,6 +1491,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*-----------------------------------------------------------------* * gain interpolation and output streams *-----------------------------------------------------------------*/ + for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) { g1 = h_dirac_output_synthesis_params->interpolator[buf_idx]; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 45bbac0faba3b13b3587bd1f0ed540349bb0840b..3c0370c8801e60052171394187e2f1ac1ef7423e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -920,12 +920,7 @@ ivas_error ivas_init_decoder( } } - if ( ( error = ivas_dirac_sba_config( - st_ivas->hQMetaData, - &st_ivas->element_mode_init, - ivas_total_brate, - st_ivas->sba_analysis_order, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) { return error; } @@ -2081,6 +2076,7 @@ void ivas_init_dec_get_num_cldfb_instances( default: assert( 0 && "Renderer not handled for CLDFB reservation." ); } + if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) { *numCldfbAnalyses = max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbAnalyses ); diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c index 7e63c2d539ad965107966cecc3e676a167e96c69..e89453686feeee5ac20a55f1ebf14bdb9245027f 100644 --- a/lib_dec/ivas_lfe_plc.c +++ b/lib_dec/ivas_lfe_plc.c @@ -167,7 +167,7 @@ static void d_autocorr( * of input signal *---------------------------------------------------------------------*/ -/* !r: energy of prediction error */ +/*! r: energy of prediction error */ static int16_t d_lev_dur( double *a, /* o : LP coefficients (a[0] = 1.0) */ const double *r, /* i : vector of autocorrelations */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 45f56875ff24dfe627a6bc679cabe59cac766aaf..0576fe8121f4d2ae294dca9dd52348f1ef128684 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -133,6 +133,7 @@ ivas_error ivas_masa_decode( /* the number of MASA transport channels was read in ivas_dec_setup() */ st->next_bit_pos -= MASA_TRANSP_BITS; *nb_bits_read += MASA_TRANSP_BITS; + /* Placeholder for descriptive metadata content */ byteBuffer = st->bit_stream[( st->next_bit_pos )--]; byteBuffer += st->bit_stream[( st->next_bit_pos )--]; @@ -195,19 +196,16 @@ ivas_error ivas_masa_decode( { if ( ivas_total_brate >= IVAS_512k ) { - *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4, - hMasa->config.numCodingBands ); + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4, hMasa->config.numCodingBands ); } else { - *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3, - hMasa->config.numCodingBands ); + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3, hMasa->config.numCodingBands ); } } else { - *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos, - 0 ); + *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos, 0 ); } /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ @@ -243,8 +241,7 @@ ivas_error ivas_masa_decode( return error; } - ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, - hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); hQMetaData->metadata_max_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; @@ -290,10 +287,7 @@ ivas_error ivas_masa_decode( } if ( st_ivas->hDirAC != NULL ) { - ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, - ivas_format, - 0, - 0 ); + ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, ivas_format, 0, 0 ); } st->next_bit_pos = next_bit_pos_orig; diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index 6c5e6575a68a95f7771c605fdddc785335a3e4fc..8309c9874dea415cf4288a06c88f2bafd2903eac 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -233,8 +233,7 @@ void ivas_mct_core_dec( { st = sts[ch]; - if ( - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ { continue; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index c37bd781258f777b5f29be2a0ed96732ab2430a8..51d685698730d797bb6b9c4e09460cdcf947eab9 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -358,9 +358,9 @@ ivas_error create_mct_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } } + /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE ) % - 2 ) + if ( hMCT->nchan_out_woLFE % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -403,6 +403,7 @@ ivas_error create_mct_dec( *-----------------------------------------------------------------*/ hMCT->currBlockDataCnt = 0; + /*Initialize bits required to signal channel-pair index*/ hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); @@ -468,13 +469,13 @@ ivas_error mct_dec_reconfigure( } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE ) % - 2 ) + if ( hMCT->nchan_out_woLFE % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; + /* set correct nominal bitrates and igf config already here, otherwise we * run into a number of problems */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) @@ -486,8 +487,7 @@ ivas_error mct_dec_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - if ( !( - ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); @@ -524,6 +524,7 @@ ivas_error mct_dec_reconfigure( } } } + initMdctStereoDecData( hMCT->hBlockData[n]->hStereoMdct, st_ivas->hCPE[0]->hCoreCoder[0]->igf, st_ivas->hCPE[0]->hCoreCoder[0]->hIGFDec->igfData.igfInfo.grid, cp_bitrate, st_ivas->hCPE[0]->hCoreCoder[0]->bwidth ); hMCT->hBlockData[n]->hStereoMdct->use_itd = 0; } @@ -744,6 +745,7 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } + /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv render what still fits in the new granularity */ tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->hDecoderConfig->output_Fs ); @@ -815,7 +817,6 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; if ( last_mc_mode != MC_MODE_PARAMUPMIX ) - /* This should always be the case, only supporting one bitrate currently */ { /*De-allocate handles for other MC modes*/ if ( st_ivas->hParamMC != NULL ) @@ -843,10 +844,12 @@ static ivas_error ivas_mc_dec_reconfig( return error; } } +#ifdef DEBUGGING else { assert( 0 ); } +#endif } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { @@ -910,7 +913,7 @@ static ivas_error ivas_mc_dec_reconfig( return error; } - /* ls conversion */ + /* LS conversion */ if ( st_ivas->hLsSetUpConversion != NULL ) { ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); @@ -1077,7 +1080,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } - set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); } @@ -1129,6 +1131,7 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } + if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) { ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); @@ -1203,12 +1206,7 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), - st_ivas->intern_config, - st_ivas->hDecoderConfig->output_config, - st_ivas->hRenderConfig, - st_ivas->hSetOfHRTF, - st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index becf11e070428610fdc436ab17ac3a884021c195..deb62940661183ffd59ad804b8a7b930f79a0820 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -328,6 +328,7 @@ void ivas_mdct_dec_side_bits_frame_channel( { continue; } + st = sts[ch]; if ( MCT_flag ) { @@ -421,6 +422,7 @@ void ivas_mdct_dec_side_bits_frame_channel( nStages = SNS_MSVQ_NSTAGES_SIDE; bits = ( nSubframes == 1 ) ? ivas_sns_cdbks_side_tcx20_bits : ivas_sns_cdbks_side_tcx10_bits; } + for ( int16_t j = 0; j < nStages; ++j ) { /* plus one in index for stereo mode storage! */ @@ -661,6 +663,7 @@ void ivas_mdct_core_invQ( sts[1]->core = sts[1]->last_core; } } + mvr2r( tmp_ms_sig[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[0] ); mvr2r( tmp_ms_sig[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[0] ); } @@ -854,11 +857,9 @@ void ivas_mdct_core_reconstruct( if ( !skip_decoding ) { - decoder_tcx_imdct( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], - tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], &x[ch][k][0], xn_buf, + decoder_tcx_imdct( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], &x[ch][k][0], xn_buf, ( ( hCPE->nchan_out == 1 && st->hTcxDec->kernel_type[k] == MDST_IV ) || st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ? MDCT_IV : st->hTcxDec->kernel_type[k], - fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, - 0 ); + fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, 0 ); } else { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 4c7414555c464127094100d57e81d9996d897253..487f6c704b34a9680129ab0d233cff3ac04184ff 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -270,7 +270,6 @@ int16_t ivas_qmetadata_dec_decode( dir2ratio = ( 1.0f - diffRatio ) - dir1ratio; } - /* Requantize the 1 - dirRatio separately for each direction to obtain inverted dirRatio index. These are used in further decoding. */ hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0] = masa_sq( 1.0f - dir1ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); if ( hodirac_flag ) @@ -337,8 +336,7 @@ int16_t ivas_qmetadata_dec_decode( index_dirRatio1Inv = hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0]; index_dirRatio2Inv = hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0]; - masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, - hodirac_flag ); + masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, hodirac_flag ); for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) { @@ -439,8 +437,7 @@ int16_t ivas_qmetadata_dec_decode( if ( all_coherence_zero == 0 ) { - bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d, - 0 ); + bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d, 0 ); } else { @@ -488,13 +485,11 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[0] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band, - 0 ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band, 0 ); } else { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band, - 0 ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band, 0 ); } } /* Decode quantized directions band-wise */ @@ -514,8 +509,7 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b, - 0 ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b, 0 ); } else { @@ -559,8 +553,7 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] ) { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b, - 0 ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b, 0 ); } } } @@ -594,8 +587,7 @@ int16_t ivas_qmetadata_dec_decode( { if ( nblocks > 1 ) { - decode_spread_coherence( hQMetaData, d, nblocks, - 0 ); + decode_spread_coherence( hQMetaData, d, nblocks, 0 ); } } else @@ -3255,8 +3247,7 @@ static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: quantized metadata structure */ int16_t idx_d, /* i : direction index */ const int16_t no_frames, /* i : number of time subframes */ - - const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ + const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ ) { int16_t i, j; @@ -3938,6 +3929,7 @@ static int16_t read_surround_coherence( uint16_t idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; int16_t min_index; + coding_subbands = hQMetaData->q_direction[0].cfg.nbands; q_direction = hQMetaData->q_direction; @@ -3986,6 +3978,7 @@ static int16_t read_surround_coherence( } } } + return bits_sur_coherence; } @@ -4031,6 +4024,7 @@ static int16_t read_surround_coherence( { hQMetaData->surcoh_band_data[j].sur_coherence_index = idx_sur_coh[j]; } + hQMetaData->surcoh_band_data[j].surround_coherence[0] = sur_coherence_cb_masa[idx_cb_sur_coh_masa[idx_ER[j]] * MASA_MAX_NO_CV_SUR_COH + hQMetaData->surcoh_band_data[j].sur_coherence_index]; } } @@ -4124,7 +4118,6 @@ static int16_t read_surround_coherence_hr( error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } - if ( error_ratio_surr <= 0 ) { error_ratio_surr = 0; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 429916d17e4a72b7bdfcbc3a3f5b4e65456cb316..22258a93658c1a4dbe219e21ac09eb3505e8fbd4 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -288,12 +288,7 @@ ivas_error ivas_sba_dec_reconfigure( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - if ( ( error = ivas_dirac_sba_config( - st_ivas->hQMetaData, - &st_ivas->element_mode_init, - ivas_total_brate, - st_ivas->sba_analysis_order, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index f42f309ac9d366297aa17d8d94684e228eb639ad..7f76bbbb3735f021b118dde384a61310db8be6cc 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -248,8 +248,8 @@ ivas_error ivas_sce_dec( { int32_t output_Fs; - output_Fs = st_ivas->hDecoderConfig->output_Fs; + /*----------------------------------------------------------------* * LB synthesis synchronization between IVAS formats *----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index b80cc08684e8afda05b017e1c28ea47bf0a55572..9d4d67393fb8716a8e3a028879298891ceab2d29 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -321,8 +321,7 @@ ivas_error ivas_spar_dec( if ( st_ivas->hQMetaData != NULL ) { ivas_dirac_dec_read_BS( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hQMetaData, nb_bits_read, - ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), - st_ivas->hSpar->dirac_to_spar_md_bands ); + ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); } last_bit_pos = (int16_t) ( ( hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ad767f0e308c3d94707125b0792dc7f675fce887..315cfbad668d813f787933ea38d810ec8daed60d 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1318,8 +1318,8 @@ typedef struct Decoder_Struct EFAP_HANDLE hEFAPdata; /* EFAP structure */ VBAP_HANDLE hVBAPdata; /* VBAP structure */ MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ - CREND_WRAPPER_HANDLE hCrendWrapper; - REVERB_HANDLE hReverb; /* Reverb handle */ + CREND_WRAPPER_HANDLE hCrendWrapper; /* Crend handle */ + REVERB_HANDLE hReverb; /* Reverb handle */ HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 9508a539825b2f28c3a9bd469663863b5e2bec50..1019868229ad8d7ccdfb5612080c181ead59d50e 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -126,7 +126,6 @@ static void stereo_mdct_dec_stereo( sts[0]->bits_frame_channel += sts[0]->core * SMDCT_MINIMUM_ARITH_BITS; sts[1]->bits_frame_channel += sts[1]->core * SMDCT_MINIMUM_ARITH_BITS; - sts[1]->bit_stream = &sts[0]->bit_stream[sts[0]->next_bit_pos + sts[0]->bits_frame_channel + sts[0]->core * NF_GAIN_BITS]; return; @@ -513,6 +512,7 @@ static void apply_dmx_weights( } } } + /* apply weights to channels with their original frequency resolutions */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -571,6 +571,7 @@ static void apply_dmx_weights( return; } + /*-------------------------------------------------------------------* * run_min_stats() * diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index efc9ebe845d7fffafea2ff96565a9f82de09aa64..76f740d6c6f4cf24bbdc1dded6b083f345eba3d4 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -139,7 +139,6 @@ void parse_stereo_from_bitstream( if ( st0->igf ) { - mdct_stereo_mode = get_next_indice( st0, 1 ); if ( mdct_stereo_mode ) { @@ -469,6 +468,7 @@ ivas_error initMdctStereoDtxData( /* Init FD-CNG */ initFdCngDec( st ); } + if ( st->first_CNG == 0 ) { if ( ch == 1 && st->cng_sba_flag ) diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index e1105bce9d752c653bbcb8c22202f52d178a3fca..37af3fb124aec05cc875c2bba60cab432d22b9fc 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -171,7 +171,7 @@ void svdMat2mat( * perform a singular value decomposition X=USV of a matrix X *-------------------------------------------------------------------------*/ -/* !r: error or success */ +/*! r: error or success */ int16_t svd( float InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) */ float singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 2617be5f2a1023507b04b645532310c0572ed86b..b5b61c2f1cc8a2ae2ffcc73fe16c1d1bf1f27b57 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -73,8 +73,7 @@ void stereo_tcx_init_dec( st->core_brate = st->total_brate; /*sampling rate*/ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag, - st->is_ism_format ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); st->fscale = sr2fscale( st->sr_core ); /*frame size*/ @@ -108,8 +107,7 @@ void stereo_tcx_init_dec( if ( st->element_mode == IVAS_SCE ) { - st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag, - st->is_ism_format ); + st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag, st->is_ism_format ); /* LPC quantization */ if ( st->sr_core <= INT_FS_16k && st->tcxonly == 0 ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f06a107065f2036c805a327f01183f65f9899a86..5cc4bdd9b9a5d1b8f5fb9f9ffa075f1a3855fffc 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -871,9 +871,9 @@ ivas_error IVAS_DEC_GetTcSamples( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_RendererFeedTcSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o : IVAS decoder handle */ - const int16_t nSamplesForRendering, /* i: : number of TC samples wanted from the renderer */ - int16_t *nSamplesResidual, /* o: : number of samples not fitting into the renderer grid and buffer for the next call*/ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const int16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ + int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call */ float *pcmBuf /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ ) { @@ -906,10 +906,10 @@ ivas_error IVAS_DEC_RendererFeedTcSamples( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetRenderedSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o : IVAS decoder handle */ - const uint16_t nSamplesForRendering, /* i: : number of TC samples wanted from the renderer */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ int16_t *pcmBuf /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ ) { diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 9db7119aa22d1ce5d4258a9f5f3c277b66e41517..119cf7ecf2ef39767141bbbb27d2540c26004489 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -286,9 +286,9 @@ void lsf_end_dec( nBits = nBits_in; *nb_indices = 0; - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ - ) + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && st->idchan == 0 ) { + /* this bit is used only for primary channel or mono */ coder_type = get_next_indice( st, 1 ); coder_type += 2; if ( coder_type == GENERIC || ( coder_type == VOICED && flag_1bit_gran == 1 ) ) diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 041e3a3d2fa493f5b9d66325cfc9baad7e59ef1a..86340ab181f6abf6af3116cb377064c773865a63 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -421,10 +421,10 @@ void TonalMDCTConceal_Detect( int16_t nBands; nSamples = hTonalMDCTConc->nSamples; - if ( hTonalMDCTConc->lastBlockData.blockIsValid && hTonalMDCTConc->secondLastBlockData.blockIsValid && ( hTonalMDCTConc->lastBlockData.nSamples == nSamples ) && ( hTonalMDCTConc->secondLastBlockData.nSamples == nSamples ) && ( !hTonalMDCTConc->secondLastBlockData.blockIsConcealed || hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive || ( pitchLag != 0 ) ) - /* Safety if the second last frame was concealed and tonal concealment was inactive */ - ) + if ( hTonalMDCTConc->lastBlockData.blockIsValid && hTonalMDCTConc->secondLastBlockData.blockIsValid && ( hTonalMDCTConc->lastBlockData.nSamples == nSamples ) && ( hTonalMDCTConc->secondLastBlockData.nSamples == nSamples ) && ( !hTonalMDCTConc->secondLastBlockData.blockIsConcealed || hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive || ( pitchLag != 0 ) ) ) { + /* Safety if the second last frame was concealed and tonal concealment was inactive */ + if ( !hTonalMDCTConc->lastBlockData.blockIsConcealed ) { if ( !hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index e3faed3d7a6eb480197c4a7d2d95a2258b8be51c..b307e0361d600db278ef3c98645bd9164670b172 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -72,12 +72,10 @@ void init_coder_ace_plus( int16_t L_subfr; /* Bitrate */ - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag, - st->is_ism_format ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); /* Core Sampling Rate */ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, - st->is_ism_format ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); st->fscale = sr2fscale( st->sr_core ); /* Narrowband? */ diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index e6433bc89adbab2898869dc8a181b1c7e5ae3811..44952cc1daab965d2eea5d3264c8e6889c5ab396 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -69,8 +69,7 @@ void core_coder_mode_switch( } /* force active frame for the first frame when switching from high bitrates when DTX is enabled*/ - sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, - st->is_ism_format ); + sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); fscale = sr2fscale( sr_core ); @@ -80,8 +79,7 @@ void core_coder_mode_switch( switchWB = 1; /*force init when coming from MODE1*/ } - tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag, - st->is_ism_format ); + tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); if ( tcxonly_tmp != st->tcxonly ) { @@ -93,8 +91,7 @@ void core_coder_mode_switch( st->sr_core = sr_core; st->L_frame = (int16_t) ( sr_core / FRAMES_PER_SEC ); - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag, - st->is_ism_format ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 6536ee333eb4f1b071af67c0fe64eac4b3124fc8..f8c33ea62d3c318f1c23dddfc63d402b93aa4c60 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -279,8 +279,7 @@ ivas_error ivas_core_enc( if ( MCT_flag ) { ivas_mdct_core_whitening_enc( hCPE, old_inp_16k, old_wsp, pitch_buf, hMCT->p_mdst_spectrum_long[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, - 1, hMCT->nchan_out_woLFE ); + hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE ); } else { diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 9c4942314d6eab281c3032e769f512aa470209e4..51b757fef43c554a0a38624616cab9935803ac63 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -245,8 +245,7 @@ ivas_error pre_proc_ivas( st->total_brate = st->bits_frame_nominal * FRAMES_PER_SEC; SetModeIndex( st, st->last_bits_frame_nominal * FRAMES_PER_SEC, last_element_mode, MCT_flag ); - st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, - st->is_ism_format ); + st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); st->total_brate = total_brate_tmp; st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index f00e8187ce3d9d50405c9271167477f49d91284d..9887372ee7877be4e07b01a08a557782106bca94 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -384,10 +384,7 @@ ivas_error ivas_cpe_enc( { int32_t internal_Fs; - internal_Fs = getTcxonly( IVAS_CPE_MDCT, sts[0]->bits_frame_nominal * FRAMES_PER_SEC, 0, - sts[0]->is_ism_format ) == 0 - ? INT_FS_16k - : max( INT_FS_16k, sts[0]->sr_core ); + internal_Fs = getTcxonly( IVAS_CPE_MDCT, sts[0]->bits_frame_nominal * FRAMES_PER_SEC, 0, sts[0]->is_ism_format ) == 0 ? INT_FS_16k : max( INT_FS_16k, sts[0]->sr_core ); /* iDFT at input sampling rate */ stereo_dft_enc_synthesize( hCPE->hStereoDft, sts[0]->input, 0, input_Fs, input_Fs, 0 ); diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 65f16a4a28915bceb4f91693abc45c998fbde692..9c938e0a1a5ba16d5265f6ea9305e7422929d5c4 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -277,8 +277,7 @@ void ivas_decision_matrix_enc( if ( st->total_brate >= MIN_BRATE_SWB_BWE /*&& (*coder_type != AUDIO || st->total_brate >= (MIN_BWE_PRI_BRATE+600))*/ || ( st->total_brate >= MIN_MIN_BRATE_LRTD_SWB_BWE && st->element_mode == IVAS_CPE_TD && st->bwidth == SWB && st->tdm_LRTD_flag ) || ( element_brate < IVAS_16k4 && st->total_brate >= MIN_MIN_BRATE_LRTD_SWB_BWE && st->element_mode == IVAS_CPE_TD && st->bwidth == SWB ) ) { - if ( ( ( ( st->sp_aud_decision1 == 1 && st->sp_aud_decision2 == 0 ) || st->coder_type == INACTIVE ) && !st->GSC_noisy_speech ) /* Note: SWB BWE is not used for GSC noisy speech */ - ) + if ( ( ( ( st->sp_aud_decision1 == 1 && st->sp_aud_decision2 == 0 ) || st->coder_type == INACTIVE ) && !st->GSC_noisy_speech ) /* Note: SWB BWE is not used for GSC noisy speech */ ) { st->extl = SWB_BWE; st->extl_brate = SWB_BWE_1k6; diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 802654c02c8cf1b0bc7d8355dc6e0ee9d3df119d..ec8c22bcd9d52bc3ce6047bcd9014350e329e51c 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -73,6 +73,7 @@ static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); static void masa_metadata_direction_alignment( MASA_ENCODER_HANDLE hMasa ); + /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ @@ -125,8 +126,7 @@ ivas_error ivas_masa_enc_open( } } - ivas_masa_set_elements( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, - st_ivas->hQMetaData, &hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + ivas_masa_set_elements( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); @@ -176,7 +176,6 @@ void ivas_masa_enc_close( deleteCldfb( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } - free( ( *hMasa ) ); ( *hMasa ) = NULL; @@ -327,8 +326,7 @@ ivas_error ivas_masa_encode( } else { - ivas_qmetadata_enc_encode( hMetaData, hQMetaData, - 0 ); + ivas_qmetadata_enc_encode( hMetaData, hQMetaData, 0 ); } *nb_bits_metadata = hMetaData->nb_bits_tot; @@ -463,7 +461,6 @@ void ivas_masa_estimate_energy( } } - return; } @@ -497,8 +494,7 @@ ivas_error ivas_masa_enc_config( ivas_format = st_ivas->hEncoderConfig->ivas_format; ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; - ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, - hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); + ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->hEncoderConfig->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); hQMetaData->is_masa_ivas_format = 1; if ( ivas_format == MASA_FORMAT ) @@ -509,11 +505,8 @@ ivas_error ivas_masa_enc_config( if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { - /* average over sub-frames */ - average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy, - &( hMasa->data.Sph_Grid16 ), - ivas_total_brate == IVAS_512k ? TRUE : FALSE ); + average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy, &( hMasa->data.Sph_Grid16 ), ivas_total_brate == IVAS_512k ? TRUE : FALSE ); } /* Inspect metadata for parameter changes that affect coding. */ @@ -2184,7 +2177,6 @@ static void masa_metadata_direction_alignment( ) { uint8_t band, n_dirs; - MASA_DIR_ALIGN_HANDLE hAlignState; MASA_METADATA_HANDLE hMeta; diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 3bafe7ceab7853045570c7e71880158740cdfc36..9dbdbcab15b3f7de1c47813293cc4ef21573ec4b 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -1458,7 +1458,7 @@ static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], - const int16_t enc_param_start_band, /* i: first band to process */ + const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ) { diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 5298e39f39c41401c8899a058247f941c9ef0dd7..94f61730929db46de54270304839d180a63edfa1 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -303,8 +303,7 @@ void ivas_mct_core_enc( { st = sts[ch]; - if ( - st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -382,8 +381,7 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -459,8 +457,7 @@ void ivas_mct_core_enc( { st = sts[ch]; - if ( - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -475,8 +472,7 @@ void ivas_mct_core_enc( write_mct_bitstream( sts, hMCT, nChannels ); - FindChannelRatio( - sts, chBitRatios, nChannels ); + FindChannelRatio( sts, chBitRatios, nChannels ); nAvailBits = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - NBITS_BWIDTH - hMCT->nBitsMCT - lfe_bits ); @@ -525,8 +521,7 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { - if ( - sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 5fb0561797102fdb98f085866e34e37f983c917c..89ddfd0ceb11457370c40be8e3cc60f694a63f91 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -104,8 +104,8 @@ static void set_mct_enc_params( static void map_input_to_cpe_channels( const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - float *pdata[MAX_INPUT_CHANNELS], /* o: mapped input pointers */ - float data[MCT_MAX_CHANNELS][L_FRAME48k] /* i: input channel data */ + float *pdata[MAX_INPUT_CHANNELS], /* o : mapped input pointers */ + float data[MCT_MAX_CHANNELS][L_FRAME48k] /* i : input channel data */ ) { int16_t i, n; @@ -226,6 +226,7 @@ ivas_error ivas_mct_enc( /*for MC and MCT remove pointer to LFE input that has been processed seperately */ map_input_to_cpe_channels( st_ivas, pdata, data ); + /* pre-processing */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { @@ -337,7 +338,7 @@ ivas_error create_mct_enc( } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE ) % 2 ) + if ( hMCT->nchan_out_woLFE % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -453,8 +454,7 @@ ivas_error mct_enc_reconfigure( } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE ) % - 2 ) + if ( hMCT->nchan_out_woLFE % 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -471,8 +471,7 @@ ivas_error mct_enc_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - if ( !( - ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); @@ -638,8 +637,8 @@ ivas_error ivas_mc_enc_config( *-------------------------------------------------------------------------*/ static ivas_error ivas_mc_enc_reconfig( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t last_mc_mode /* i: last frame mc mode */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const int16_t last_mc_mode /* i : last frame mc mode */ ) { int16_t nchan_transport_old, nSCE_old, nCPE_old; @@ -670,6 +669,7 @@ static ivas_error ivas_mc_enc_reconfig( /* LFE handle */ ivas_lfe_enc_close( &( st_ivas->hLFE ) ); } + /* create LFE handle */ if ( ( error = ivas_create_lfe_enc( &st_ivas->hLFE, st_ivas->hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { @@ -710,17 +710,18 @@ static ivas_error ivas_mc_enc_reconfig( } if ( last_mc_mode != MC_MODE_PARAMUPMIX ) - /* This should always be the case, only supporting one bitrate currently */ { if ( ( error = ivas_mc_paramupmix_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } } +#ifdef DEBUGGING else { assert( 0 ); } +#endif /*De-allocate handles for other MC modes*/ ivas_param_mc_enc_close( &st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 4239973c25d5b9fde734f8ca79e203b1aca9c465..87d330f2f0f7037ba65bd058977a3cc3b63e3c63 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -882,8 +882,7 @@ void ivas_mdct_core_whitening_enc( } /* MCT: detect whether there are silent channels and set mct_chan_mode accordingly */ - if ( - mct_on ) + if ( mct_on ) { chE_tot = sum_f( chE, NB_DIV ); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index e70cf79c5d5d839355ab902f6805c5feff39b16e..6d44723dc7006439f08af7f53f40a96000a4ae35 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -51,7 +51,6 @@ static float direction_distance( float elevation[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float azimuth[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], IVAS_QDIRECTION *q_direction, const int16_t dim1, const int16_t dim2, float mat_dist[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] ); #endif - static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits, const int16_t hodirac_flag ); static int16_t ivas_qmetadata_entropy_encode_diffuseness( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); @@ -138,9 +137,9 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( IVAS_QMETADATA *hQMetaD *-----------------------------------------------------------------------*/ ivas_error ivas_qmetadata_enc_encode( - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ - IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode*/ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t i, bit_pos_start, bit_pos_start_coh; @@ -265,8 +264,7 @@ ivas_error ivas_qmetadata_enc_encode( } /*Quantization of the Diffuseness */ - ivas_qmetadata_quantize_diffuseness_nrg_ratios( hQMetaData, bits_dir_raw_pre, bits_diff, dfRatio_bits, - hodirac_flag ); + ivas_qmetadata_quantize_diffuseness_nrg_ratios( hQMetaData, bits_dir_raw_pre, bits_diff, dfRatio_bits, hodirac_flag ); bits_diff_sum = 0; bits_diff[0] = ivas_qmetadata_entropy_encode_diffuseness( hMetaData, &( hQMetaData->q_direction[0] ), &diffuseness_index_max_ec_frame_pre[0] ); @@ -405,8 +403,7 @@ ivas_error ivas_qmetadata_enc_encode( if ( all_coherence_zero == 0 ) { - bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence, - 0 ); + bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence, 0 ); } if ( q_direction->cfg.mc_ls_setup == MC_LS_SETUP_5_1 || q_direction->cfg.mc_ls_setup == MC_LS_SETUP_7_1 ) @@ -418,8 +415,7 @@ ivas_error ivas_qmetadata_enc_encode( else { /* Quantize directions*/ - quantize_direction_frame( q_direction, azimuth_orig, elevation_orig, - 0 ); + quantize_direction_frame( q_direction, azimuth_orig, elevation_orig, 0 ); } /* Signalling 2D*/ @@ -452,9 +448,7 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir_bands[0] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, q_direction->cfg.nbands, q_direction->cfg.start_band ); reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) - 1 ) : MASA_MAX_BITS; - bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, - q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits, - 0 ); + bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits, 0 ); if ( bits_ec < 0 ) { @@ -508,8 +502,7 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir_bands[i] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, i + 1, i ); /* Write ec bits */ - bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS, - 0 ); + bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS, 0 ); if ( bits_ec >= 0 ) { @@ -612,8 +605,7 @@ ivas_error ivas_qmetadata_enc_encode( { bit_pos_start = hMetaData->nb_bits_tot; hMetaData->nb_bits_tot = bit_pos_start_coh; - ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence, - 0 ); + ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence, 0 ); hMetaData->nb_bits_tot = bit_pos_start; } @@ -963,6 +955,7 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( } } } + if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { hQMetaData->q_direction[0].cfg.nbands += hQMetaData->q_direction->cfg.inactiveBands; @@ -971,6 +964,7 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands += hQMetaData->q_direction->cfg.inactiveBands; } } + return error; } @@ -1203,6 +1197,7 @@ void ivas_qmetadata_enc_sid_encode( return; } + /*------------------------------------------------------------------------- * reset_metadata_spatial() * @@ -1222,7 +1217,6 @@ void reset_metadata_spatial( #ifdef IND_LIST_DYN int16_t j; #endif - int16_t metadata_sid_bits; if ( core_brate == SID_2k40 || core_brate == FRAME_NO_DATA ) @@ -1458,8 +1452,7 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( * fact that with 2dir data, it is harder to achieve separate high direct-to-total ratio values * which are assumed by the direction quantization system. In practice, this improves direction * accuracy when it is perceptual meaningful. */ - masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, - 0 ); + masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, 0 ); for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) { @@ -1799,8 +1792,7 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( * fact that with 2dir data, it is harder to achieve separate high direct-to-total ratio values * which are assumed by the direction quantization system. In practice, this improves direction * accuracy when it is perceptual meaningful. */ - masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, - hodirac_flag ); + masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, hodirac_flag ); for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) { @@ -2567,8 +2559,7 @@ static int16_t ivas_qmetadata_entropy_encode_dir( { for ( j = 0; j < nblocks; j++ ) { - direction_bits_ec += ivas_qmetadata_encode_quasi_uniform_length( - q_direction->band_data[i].azimuth_index[j], q_direction->band_data[i].azimuth_m_alphabet[j] ); + direction_bits_ec += ivas_qmetadata_encode_quasi_uniform_length( q_direction->band_data[i].azimuth_index[j], q_direction->band_data[i].azimuth_m_alphabet[j] ); } } } @@ -2646,7 +2637,6 @@ static int16_t ivas_qmetadata_entropy_encode_dir( avg_elevation_index_best = -1; /* out of range value */ gr_param_elevation_best = -1; /* out of range value */ - for ( avg_elevation_offset = 0; avg_elevation_offset < q_direction->cfg.search_effort; avg_elevation_offset++ ) { if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) @@ -3604,6 +3594,7 @@ static int16_t common_direction( return 0; } + if ( bits_allowed <= len + 1 ) { set_f( q_direction->band_data[band_idx].elevation, 0.0f, len ); @@ -5474,10 +5465,10 @@ static void dct4_transform( *-------------------------------------------------------------------*/ static int16_t ivas_qmetadata_quantize_coherence_hr_512( - IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata */ - const int16_t idx_d, /* i : current direction index */ - const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ - BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata */ + const int16_t idx_d, /* i : current direction index */ + const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ + BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ const int16_t bits_coh ) { int16_t j, k; @@ -5518,7 +5509,6 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( } } - nbits0 = 0; nbits1 = 0; for ( j = 0; j < nbands; j++ ) @@ -5536,6 +5526,7 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( { GR_param = 1; } + GR_param_av = 1; nbits_av = mean_removed_GR_new( idx_coh, cbsize, nbands, 1, &GR_param_av, &av, mr_idx ); @@ -5543,12 +5534,16 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( { nbits1 = nbits_av; GR_param = GR_param_av; + /* use average removed */ push_next_indice( hMetaData, 1, 1 ); + /* write average */ push_next_indice( hMetaData, av, bits_coh ); + /* write GR param */ push_next_indice( hMetaData, GR_param, 1 ); + for ( j = 0; j < nbands; j++ ) { ivas_qmetadata_encode_extended_gr( hMetaData, mr_idx[j], 2 * cbsize, GR_param ); @@ -5558,10 +5553,13 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( { /* use min removed */ push_next_indice( hMetaData, 0, 1 ); + /* write min index */ push_next_indice( hMetaData, min_idx, bits_coh ); + /* write GR param */ push_next_indice( hMetaData, GR_param, 1 ); + for ( j = 0; j < nbands; j++ ) { ivas_qmetadata_encode_extended_gr( hMetaData, idx_coh[j], cbsize - min_idx, GR_param ); @@ -5616,8 +5614,7 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( hQMetaData->q_direction[idx_d].cfg.nblocks == 1 ) { - nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData, - hrmasa_flag ); + nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData, hrmasa_flag ); return nbits; } @@ -5686,8 +5683,7 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( write_flag ) { /* quantize first DCT parameter */ - dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j], - hrmasa_flag ); + dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j], hrmasa_flag ); } if ( coding_subbands < coding_subbands_0 ) diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 014f23ed9f72e40ea0b4072473001cc0bf0113eb..dfa4118b09614a077ce944fd0dfcdc13fe3d9369 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -1237,10 +1237,10 @@ float stereo_dft_enc_synthesize( *-------------------------------------------------------------------------*/ void stereo_dft_enc_process( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const int16_t vad_flag_dtx[], /* i: VAD dtx flags */ - const int16_t vad_hover_flag[], /* i: VAD hangover flags */ - const int16_t input_frame /* i : input frame length */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const int16_t vad_flag_dtx[], /* i : VAD dtx flags */ + const int16_t vad_hover_flag[], /* i : VAD hangover flags */ + const int16_t input_frame /* i : input frame length */ ) { int16_t i, j, b; @@ -3246,7 +3246,7 @@ static void res_pred_gain_mode_decision( *------------------------------------------------------------------------*/ static float stereo_dft_calc_mean_bipd( - float *pIpd, /* i: current bandwise IPD */ + float *pIpd, /* i : current bandwise IPD */ float ipd_buf[STEREO_DFT_IPD_BUF_LEN] /* i/o: previous bandwise IPDs */ ) { @@ -3311,9 +3311,9 @@ static float stereo_dft_calc_mean_bipd( *------------------------------------------------------------------------*/ static float stereo_dft_calc_mean_ipd_change( - float *pIpd, /* i: bandwise IPDs */ - float *ipd_smooth, /* i: mean of previous bandwise IPDs */ - int16_t gipd_band_max /* i: number of IPD bands */ + float *pIpd, /* i : bandwise IPDs */ + float *ipd_smooth, /* i : mean of previous bandwise IPDs */ + int16_t gipd_band_max /* i : number of IPD bands */ ) { int16_t b; @@ -3349,8 +3349,8 @@ static float stereo_dft_calc_mean_ipd_change( static void stereo_dft_gipd_stabilization( float *pgIpd, /* i/o: global IPD to be stabilized */ - float prev_gipd, /* i: previous global IPD */ - float ipd_mean_change /* i: mean of previous bandwise IPDs */ + float prev_gipd, /* i : previous global IPD */ + float ipd_mean_change /* i : mean of previous bandwise IPDs */ ) { float diff_gipd; diff --git a/lib_enc/ivas_stereo_dft_td_itd.c b/lib_enc/ivas_stereo_dft_td_itd.c index 613fd3342429a9cf6ffe1a62f2313712ac6d0610..9fbe5e273a7d9347023f580dc0dc4d4f7238235c 100644 --- a/lib_enc/ivas_stereo_dft_td_itd.c +++ b/lib_enc/ivas_stereo_dft_td_itd.c @@ -388,10 +388,10 @@ void stereo_td_itd( * ---------------------------------------------------------------*/ void stereo_td_itd_mdct_stereo( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder handle */ - const int16_t vad_flag_dtx[], /* i: VAD dtx flags */ - const int16_t vad_hover_flag[], /* i: VAD hangover flags */ - const int16_t input_frame /* i : frame length */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder handle */ + const int16_t vad_flag_dtx[], /* i : VAD dtx flags */ + const int16_t vad_hover_flag[], /* i : VAD hangover flags */ + const int16_t input_frame /* i : frame length */ ) { int16_t i; diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 0db97b28d106d879795d39fbf202de0c95eb8133..46014fded0c1682f938fa56b8c41ca457275d048 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -175,7 +175,7 @@ void estimate_itd_wnd_fft( static void calc_poc( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o : correlation filter structure */ + STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o : correlation filter structure */ const float wnd[], /* i : window coef */ const float rfft_coef[], /* i : RFFT coef */ const float specLr[], /* i : Lch real-part spectra */ @@ -390,7 +390,7 @@ static void calc_poc( freq_8k = L_FRAME16k / 2; freq_ipd_max = (int16_t) ( freq_8k * 5000.0f / ( 8000.0f * STEREO_DMX_EVS_SUBBAND_SIZE ) ); - // Memorize the filters N-1 + /* Memorize the filters N-1 */ for ( n = 0; n < CPE_CHANNELS; n++ ) { if ( hPHA->p_curr_taps[n] ) @@ -404,7 +404,7 @@ static void calc_poc( } } - // ISD + /* ISD */ isd_cnt_l = 0; isd_cnt_h = 0; for ( i = 1; i <= freq_8k; i++ ) @@ -484,17 +484,17 @@ static void calc_poc( for ( j = 0; j < STEREO_DMX_EVS_SUBBAND_SIZE; j++, i++ ) { - // Energy + /* Energy */ tEl[n] += specLr[i] * specLr[i] + specLi[i] * specLi[i]; tEr[n] += specRr[i] * specRr[i] + specRi[i] * specRi[i]; - // IPD + /* IPD */ IPDr = specLr[i] * specRr[i] + specLi[i] * specRi[i]; IPDi = specLi[i] * specRr[i] - specLr[i] * specRi[i]; tPr += IPDr; tPi += IPDi; - // ICCr + /* ICCr */ Pn = (float) inv_sqrt( ( IPDr * IPDr + IPDi * IPDi ) + EPSILON ); IPDr *= Pn; IPDi *= Pn; @@ -575,7 +575,7 @@ static void calc_poc( { if ( ( hPHA->iccr_s < STEREO_DMX_EVS_ICCR_HYST_L ) || ( ( hPHA->iccr_s < STEREO_DMX_EVS_ICCR_HYST_H ) && ( hPHA->p_curr_taps[0] != NULL ) ) ) { - // IPDn + /* IPDn */ set_f( &( Pr[freq_ipd_max] ), 1.0f, ( nsbd - freq_ipd_max ) ); set_f( &( Pi[freq_ipd_max] ), 0.0f, ( nsbd - freq_ipd_max ) ); @@ -625,7 +625,7 @@ static void calc_poc( rfft( rfft_pha_buf, hPHA->rfft_ipd_coef, input_frame_pha, +1 ); mvr2r( rfft_pha_buf, hPHA->p_curr_taps[1], hPHA->pha_len ); - // PHA L2R + /* PHA L2R */ p_curr_taps = hPHA->p_curr_taps[0]; p_curr_taps[0] = rfft_pha_buf[0]; for ( i = 1; i < hPHA->pha_len; i++ ) @@ -877,7 +877,7 @@ static float find_poc_peak( static ivas_error estimate_itd( float *corr, /* o : correlation */ STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o : correlation filter structure */ + STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const float srcL[], /* i : Lch input signal */ const float srcR[], /* i : Rch input signal */ float itd[], /* o : estimated itd */ @@ -1113,9 +1113,9 @@ static void create_M_signal( *-------------------------------------------------------------------*/ void stereo_dmx_evs_enc( - STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS, /* i/o: Stereo downmix for EVS encoder handle */ - const int32_t input_Fs, /* i : input sampling rate */ - int16_t data[CPE_CHANNELS * L_FRAME48k], /* i/o: input signal */ + STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS, /* i/o: Stereo downmix for EVS encoder handle */ + const int32_t input_Fs, /* i : input sampling rate */ + int16_t data[CPE_CHANNELS * L_FRAME48k], /* i/o: input signal */ const int16_t n_samples, /* i : number of input samples */ const bool is_binaural /* i : indication that input is binaural audio */ ) @@ -1195,7 +1195,7 @@ void stereo_dmx_evs_enc( estimate_itd( &corr, hStereoDmxEVS->hPOC, hStereoDmxEVS->hPHA, data_f[0], data_f[1], &hStereoDmxEVS->itd, input_frame ); - // poc + /* poc */ if ( hStereoDmxEVS->itd ) { @@ -1209,7 +1209,7 @@ void stereo_dmx_evs_enc( create_M_signal( data_f[0], data_f[1], dmx_poc_data, dmx_weight, input_frame, hStereoDmxEVS->s_wnd, hStereoDmxEVS->dmx_weight, hStereoDmxEVS->pre_dmx_energy, hStereoDmxEVS->aux_dmx_energy ); - // pha + /* pha */ pha_len = hStereoDmxEVS->hPHA->pha_len; fad_len = hStereoDmxEVS->hPHA->fad_len; @@ -1273,7 +1273,7 @@ void stereo_dmx_evs_enc( dmx_pha_data[n] += ( mem_prev[n] ) * fad_g[m]; } - // prc switch + /* prc switch */ curr_prc = hStereoDmxEVS->hPHA->curr_prc; if ( abs( (int16_t) hStereoDmxEVS->itd ) > hStereoDmxEVS->hPHA->prc_thres ) @@ -1543,10 +1543,10 @@ ivas_error stereo_dmx_evs_init_encoder( hStereoDmxEVS->hPHA->prev_pha = STEREO_DMX_EVS_PHA_IPD; hStereoDmxEVS->hPHA->pha_hys_cnt = 0; - // Compute the forgetting factor + /* Compute the forgetting factor */ a_min = 0.8576958985908941f; a_max = 0.9440608762859234f; - itrh = (int16_t) ( ( 3000 * input_frame ) / ( input_Fs * STEREO_DMX_EVS_SUBBAND_SIZE ) ); // 3kHz + itrh = (int16_t) ( ( 3000 * input_frame ) / ( input_Fs * STEREO_DMX_EVS_SUBBAND_SIZE ) ); /* 3kHz */ n0 = L_FRAME16k / ( 2 * STEREO_DMX_EVS_SUBBAND_SIZE ); a_step = ( a_min - a_max ) / ( n0 + 1 - itrh ); ipd_ff = hStereoDmxEVS->hPHA->ipd_ff; @@ -1554,7 +1554,7 @@ ivas_error stereo_dmx_evs_init_encoder( { ipd_ff[n] = a_max; } - for ( ; n < ( n0 + 1 ); n++ ) // 8kHz + for ( ; n < ( n0 + 1 ); n++ ) /* 8kHz */ { ipd_ff[n] = a_max + ( n - itrh ) * a_step; } diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 3c274b149e725423799c4d19b75ca0f766856eac..46bc5fbf9a8a9739f2ab1869316b033620e2158e 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -72,9 +72,8 @@ static void sync_tcx_mode( } } - if ( - ( prevAccNrg0 * 25.0f > prevAccNrg1 ) && ( prevAccNrg1 * 25.0f > prevAccNrg0 ) && /* 14 dB */ - ( lastAccNrg0 * 16.0f > lastAccNrg1 ) && ( lastAccNrg1 * 16.0f > lastAccNrg0 ) ) /* 12 dB */ + if ( ( prevAccNrg0 * 25.0f > prevAccNrg1 ) && ( prevAccNrg1 * 25.0f > prevAccNrg0 ) && /* 14 dB */ + ( lastAccNrg0 * 16.0f > lastAccNrg1 ) && ( lastAccNrg1 * 16.0f > lastAccNrg0 ) ) /* 12 dB */ { st[0]->hTcxEnc->tcxMode = st[1]->hTcxEnc->tcxMode = max( st[0]->hTcxEnc->tcxMode, st[1]->hTcxEnc->tcxMode ); /* synchronize TCX mode of both channels */ @@ -167,7 +166,6 @@ void stereo_mdct_core_enc( meta_bits = hCPE->hMetaData->nb_bits_tot; signal_bits = hBstr->nb_bits_tot; - /*--------------------------------------------------------------* * Initialization *---------------------------------------------------------------*/ @@ -199,6 +197,7 @@ void stereo_mdct_core_enc( #ifdef DEBUGGING hCPE->hStereoMdct->mdct_stereo_mode_cmdl = orig_mdct_stereo_mode_cmdl; #endif + stereo_mdct_init_igf_start_band( &( hCPE->hStereoMdct->stbParamsTCX20 ), 1.0f, hCPE->hCoreCoder[0]->bwidth, hCPE->element_brate ); stereo_mdct_init_igf_start_band( &( hCPE->hStereoMdct->stbParamsTCX10 ), 0.5f, hCPE->hCoreCoder[0]->bwidth, hCPE->element_brate ); stereo_mdct_init_igf_start_band( &( hCPE->hStereoMdct->stbParamsTCX20afterACELP ), 1.25f, hCPE->hCoreCoder[0]->bwidth, hCPE->element_brate ); @@ -227,7 +226,6 @@ void stereo_mdct_core_enc( sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; } - /*--------------------------------------------------------------* * MDCT core preprocessing: * - initialization @@ -237,8 +235,7 @@ void stereo_mdct_core_enc( *---------------------------------------------------------------*/ ivas_mdct_core_whitening_enc( hCPE, new_samples, old_wsp, pitch_buf, p_mdst_spectrum_long, - tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, - 0, CPE_CHANNELS ); + tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, 0, CPE_CHANNELS ); for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -257,6 +254,7 @@ void stereo_mdct_core_enc( /*--------------------------------------------------------------* * Stereo Processing *---------------------------------------------------------------*/ + if ( !hStereoMdct->isSBAStereoMode ) { stereo_coder_tcx( hStereoMdct, sts, ms_mask, mdst_spectrum, inv_spectrum, inv_mdst_spectrum, 0 ); @@ -335,8 +333,7 @@ void stereo_mdct_core_enc( *-----------------------------------------------------------*/ ComputeSpectrumNoiseMeasure( powerSpec[ch], L_subframeTCX, st->hTcxEnc->nmStartLine * ( L_subframeTCX / st->hTcxEnc->L_frameTCX ), - ( st->L_frame * st->last_sr_core != st->L_frame_past * st->sr_core ) || ( st->last_core != TCX_20_CORE ), - st->hTcxEnc->memQuantZeros, L_subframeTCX ); + ( st->L_frame * st->last_sr_core != st->L_frame_past * st->sr_core ) || ( st->last_core != TCX_20_CORE ), st->hTcxEnc->memQuantZeros, L_subframeTCX ); } st->hTcxEnc->measuredBwRatio = 1.f; /* No bandwidth limit for the noise filling */ @@ -354,9 +351,7 @@ void stereo_mdct_core_enc( nSubframes = ( sts[0]->hTcxEnc->tcxMode == TCX_20 || sts[1]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; for ( n = 0; n < nSubframes; n++ ) { - if ( ( hStereoMdct->mdct_stereo_mode[n] != hStereoMdct->IGFStereoMode[n] || - hStereoMdct->mdct_stereo_mode[n] == SMDCT_BW_MS ) && - !hStereoMdct->isSBAStereoMode ) + if ( ( hStereoMdct->mdct_stereo_mode[n] != hStereoMdct->IGFStereoMode[n] || hStereoMdct->mdct_stereo_mode[n] == SMDCT_BW_MS ) && !hStereoMdct->isSBAStereoMode ) { p_powerSpec[0] = powerSpec[0]; p_powerSpec[1] = powerSpec[1]; @@ -384,6 +379,7 @@ void stereo_mdct_core_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; + #ifdef IND_LIST_DYN /* update the pointer to the buffer of indices of the second channel */ if ( ch == 1 ) @@ -391,6 +387,7 @@ void stereo_mdct_core_enc( st->hBstr->ind_list = sts[0]->hBstr->ind_list + sts[0]->hBstr->nb_ind_tot; } #endif + nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; if ( st->igf ) { @@ -427,6 +424,7 @@ void stereo_mdct_core_enc( { stereo_bits = 0; } + /*--------------------------------------------------------------* * Split available bits between channels *---------------------------------------------------------------*/ @@ -468,8 +466,7 @@ void stereo_mdct_core_enc( } #endif - ivas_mdct_quant_coder( hCPE, - tnsBits, tnsSize, p_param, 0 ); + ivas_mdct_quant_coder( hCPE, tnsBits, tnsSize, p_param, 0 ); pop_wmops(); diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index fa21a17943e61fde0ad8b47d3a6f56d1d20dbeee..7bcd80301ad575b1710cc32e3a6d6ab5f8a6f990 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -79,8 +79,7 @@ void stereo_tcx_init_enc( } /*sampling rate*/ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_mode, - st->is_ism_format ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); st->fscale = sr2fscale( st->sr_core ); /*frame size*/ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 8316fd381dd15fb00df653430e4175e5a4739677..b0e9b6724fd5d32cde85c45c2fa8fc466c058b73 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -897,9 +897,8 @@ static ivas_error configureEncoder( } if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done - hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD - ) ) + ( ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || + hEncoderConfig->ivas_format == MC_FORMAT ) ) { return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 47d9d83a8a3a022b20a31c4c32e8a7bdfcef4a31..349fb4f60ff5dcfaad6df0a2c91416cef1fbaa04 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -439,24 +439,9 @@ void msvq_enc( assert( N == FDCNG_VQ_MAX_LEN || N == FDCNG_VQ_MAX_LEN_WB ); /* 21 and 24 allowed */ assert( maxC == 2 * FDCNG_VQ_DCT_NSEGM ); - p_max = msvq_stage1_dct_search( u, FDCNG_VQ_MAX_LEN, maxC, - DCT_T2_24_XX, - FDCNG_VQ_DCT_MAXTRUNC, - invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ - cdk1r_tr_midQ_truncQ, /* i: midQ vector */ - fdcng_dct_invScaleF, /* i: global inv scale factors*/ - fdcng_dct_scaleF, /* i: global scale factors*/ - FDCNG_VQ_DCT_NSEGM, /* i: number of segments */ - cdk1_ivas_cols_per_segment, /* i: remaining length per segment */ - cdk1_ivas_trunc_dct_cols_per_segment, /* i: trunc length per segment */ - cdk1_ivas_entries_per_segment, /* i: number of rows per segment */ - cdk1_ivas_cum_entries_per_segment, /* i: number of cumulative entries */ - cdk_37bits_ivas_stage1_W8Qx_dct_sections, /*i: Word8(byte) segment table ptrs */ - stage1_dct_col_syn_shift, /*i: columnwise syn shift tables */ - cdk1_ivas_segm_neighbour_fwd, /*i: circular neighbour list fwd */ - cdk1_ivas_segm_neighbour_rev, /*i: circular neighbour list reverse */ - FDCNG_VQ_DCT_NPOST, /*i: number of circ. neigbours to post check */ - st1_mse_ptr, indices_st1_local, st1_syn_vec_ptr, dist[1] ); + p_max = msvq_stage1_dct_search( u, FDCNG_VQ_MAX_LEN, maxC, DCT_T2_24_XX, FDCNG_VQ_DCT_MAXTRUNC, invTrfMatrix, cdk1r_tr_midQ_truncQ, fdcng_dct_invScaleF, fdcng_dct_scaleF, FDCNG_VQ_DCT_NSEGM, + cdk1_ivas_cols_per_segment, cdk1_ivas_trunc_dct_cols_per_segment, cdk1_ivas_entries_per_segment, cdk1_ivas_cum_entries_per_segment, cdk_37bits_ivas_stage1_W8Qx_dct_sections, + stage1_dct_col_syn_shift, cdk1_ivas_segm_neighbour_fwd, cdk1_ivas_segm_neighbour_rev, FDCNG_VQ_DCT_NPOST, st1_mse_ptr, indices_st1_local, st1_syn_vec_ptr, dist[1] ); /* move established stage#1 indices to the global MSVQ list structure */ @@ -469,8 +454,7 @@ void msvq_enc( /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ { - /* This loop is identical to the one below, except, that the inner - loop over c=0..m is hardcoded to c=0, since m=1. */ + /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ /* dist[0][0] */ for ( j = 0; j < levels[s]; j++ ) { diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index a0ce86050622e2913e1d85e60e2ac23ae1b8776d..cd492b8d4c393a6f9ced1351f5db10d3f9b7f4fa 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -603,8 +603,7 @@ void pre_proc( else { SetModeIndex( st, st->last_total_brate, EVS_MONO, 0 ); - st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, - 0 ); + st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0 ); st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); st->encoderLookahead_enc = NS2SA( st->sr_core, ACELP_LOOK_NS ); st->encoderPastSamples_enc = ( st->L_frame * 9 ) >> 4; diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index b958d544f41da10a26e48f5e030df5330a42523a..5cc66667fe26bbc55e9eaeab117e1fb405370bd0 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -393,8 +393,7 @@ void updt_enc_common( { st->codec_mode = MODE2; - st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, - 0 ); + st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0 ); st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index d0bb2a3899e45cc077a33c0daa233102819a4a2e..6d2b8861bb66a3054d4afed3d2b452e318236a20 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -61,7 +61,7 @@ static void ivas_dirac_dmx( float data_in_f[][L_FRAME48k], const int16_t input_f ivas_error ivas_dirac_ana_open( DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ - int32_t input_Fs /* i: Sampling frequency */ + int32_t input_Fs /* i : Sampling frequency */ ) { int16_t i, j; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 2b4643c8b4cae0d91337eba57622960034642aab..4616993f79b1219ae3da63bb3ac564d7d97341e1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -79,11 +79,7 @@ typedef struct hrtfGainCache * Local function prototypes *------------------------------------------------------------------------*/ -static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, - float *output_f[], - const int16_t nchan_transport, - const int16_t subframe ); +static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); @@ -93,23 +89,12 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struc static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); -static void adaptTransportSignalsHeadtracked( - COMBINED_ORIENTATION_HANDLE hHeadTrackData, - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const int16_t nBins, - const int16_t nSlots, - float Rmat[3][3] ); +static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( - COMBINED_ORIENTATION_HANDLE hHeadTrackData, - float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - const int16_t nBins, - const int16_t nSlots, - float Rmat[3][3] ); +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); + static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t useCachedValue ); static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t isHeadtracked ); @@ -451,7 +436,7 @@ void ivas_dirac_dec_binaural_gain( void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ ) diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c index 7e4ad1ae37e1e5b3d02b402fdd0c6473df5a9402..4e6a292feaf9955256dc4263d422cd47ac457981 100644 --- a/lib_rend/ivas_masa_merge.c +++ b/lib_rend/ivas_masa_merge.c @@ -40,34 +40,28 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "wmc_auto.h" -static void copy_masa_meta_tile( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: metadata to be written */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i: input metadata */ - const uint8_t sf, /* i: sub-frame index */ - const uint8_t band /* i: band index */ -); - -static void full_stream_merge( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: Merged metadata output */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i: Input metadata 1 */ - float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i: Input metadata 2 */ - float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: TF-energy of input 2 */ -); - -static void diffuse_meta_merge_1x1( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: Merged metadata output */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i: Input metadata 1 */ - float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ - MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, /* i: Input metadata 2 */ - float inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: TF-energy of input 2 */ -); +/*---------------------------------------------------------------------* + * Local function prototypes + *---------------------------------------------------------------------*/ + +static void copy_masa_meta_tile( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, const uint8_t sf, const uint8_t band ); + +static void full_stream_merge( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); + +static void diffuse_meta_merge_1x1( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, float inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] ); + + +/*---------------------------------------------------------------------* + * copy_masa_meta_tile() + * + * + *---------------------------------------------------------------------*/ void copy_masa_meta_tile( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: metadata to be written */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i: input metadata */ - const uint8_t sf, /* i: sub-frame index */ - const uint8_t band /* i: band index */ + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : metadata to be written */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : input metadata */ + const uint8_t sf, /* i : sub-frame index */ + const uint8_t band /* i : band index */ ) { outMeta->directionIndex[0][sf][band] = inMeta->directionIndex[0][sf][band]; @@ -94,9 +88,16 @@ void copy_masa_meta_tile( return; } + +/*---------------------------------------------------------------------* + * copy_masa_descriptive_meta() + * + * + *---------------------------------------------------------------------*/ + void copy_masa_descriptive_meta( - MASA_DECRIPTIVE_META *outMeta, /* o: metadata to be written */ - MASA_DECRIPTIVE_META *inMeta /* i: input metadata */ + MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ + MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ ) { uint8_t char_idx; @@ -111,14 +112,23 @@ void copy_masa_descriptive_meta( outMeta->channelAngle = inMeta->channelAngle; outMeta->channelDistance = inMeta->channelDistance; outMeta->channelLayout = inMeta->channelLayout; + + return; } + +/*---------------------------------------------------------------------* + * diffuse_meta_merge_1x1() + * + * + *---------------------------------------------------------------------*/ + void diffuse_meta_merge_1x1( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: Merged metadata output */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i: Input metadata 1 */ - float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: TF-energy of input 1 */ - MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, /* i: Input metadata 2 */ - float inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: TF-energy of input 2 */ + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta, /* i : Input metadata 1 */ + float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : TF-energy of input 1 */ + MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, /* i : Input metadata 2 */ + float inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : TF-energy of input 2 */ ) { int8_t sf, band; @@ -186,12 +196,19 @@ void diffuse_meta_merge_1x1( return; } + +/*---------------------------------------------------------------------* + * full_stream_merge() + * + * + *---------------------------------------------------------------------*/ + void full_stream_merge( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: Merged metadata output */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i: Input metadata 1 */ - float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i: Input metadata 2 */ - float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: TF-energy of input 2 */ + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ + float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i : Input metadata 2 */ + float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : TF-energy of input 2 */ ) { float dir_nrg_1, dir_nrg_2; @@ -251,14 +268,21 @@ void full_stream_merge( return; } + +/*---------------------------------------------------------------------* + * ivas_prerend_merge_masa_metadata() + * + * + *---------------------------------------------------------------------*/ + void ivas_prerend_merge_masa_metadata( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: Merged metadata output */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i: Input metadata 1 */ - IVAS_REND_AudioConfigType inType1, /* i: Type of input 1 */ - float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i: Input metadata 2 */ - IVAS_REND_AudioConfigType inType2, /* i: Type of input 2 */ - float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: TF-energy of input 2 */ + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ + IVAS_REND_AudioConfigType inType1, /* i : Type of input 1 */ + float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i : Input metadata 2 */ + IVAS_REND_AudioConfigType inType2, /* i : Type of input 2 */ + float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : TF-energy of input 2 */ ) { /* mixing ISMs with non-ISM use different merge */ @@ -280,10 +304,17 @@ void ivas_prerend_merge_masa_metadata( return; } + +/*---------------------------------------------------------------------* + * masaPrerendOpen() + * + * + *---------------------------------------------------------------------*/ + ivas_error masaPrerendOpen( - MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o: handle to the opened prerenderer */ - int16_t numTransports, /* i: number of transport channels */ - int32_t input_Fs /* i: signal sampling rate */ + MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ + int16_t numTransports, /* i : number of transport channels */ + int32_t input_Fs /* i : signal sampling rate */ ) { MASA_PREREND_HANDLE hMasaPrerend; @@ -330,6 +361,13 @@ ivas_error masaPrerendOpen( return error; } + +/*---------------------------------------------------------------------* + * masaPrerendClose() + * + * + *---------------------------------------------------------------------*/ + void masaPrerendClose( MASA_PREREND_HANDLE *hMasaPrerendPtr /* i/o: prerenderer handle to be closed */ ) diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index ba5380a09d5c856c153c6546dbe0412ab3fcbd2d..b90b02ed14ee5cfa2325f35ede25880b38f8b314 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -84,8 +84,8 @@ static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, ivas_error ivas_mcmasa_ana_open( MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ - const IVAS_REND_AudioConfig inConfig, /* i: Input config */ - int32_t input_Fs /* i: Sampling frequency */ + const IVAS_REND_AudioConfig inConfig, /* i : Input config */ + int32_t input_Fs /* i : Sampling frequency */ ) { int16_t i, j; @@ -179,11 +179,17 @@ ivas_error ivas_mcmasa_ana_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hMcMasa->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hMcMasa->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); } } @@ -192,20 +198,27 @@ ivas_error ivas_mcmasa_ana_open( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); } } for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_intensity_real_vert[j], MASA_FREQUENCY_BANDS ); } set_zero( hMcMasa->buffer_energy, DIRAC_NO_COL_AVG_DIFF * MASA_FREQUENCY_BANDS ); computeEvenLayout( ls_azimuth, ls_azimuth_even, hMcMasa->numHorizontalChannels ); + if ( !hMcMasa->isHorizontalSetup ) { computeEvenLayout( &ls_azimuth[hMcMasa->numHorizontalChannels], &ls_azimuth_even[hMcMasa->numHorizontalChannels], numAnalysisChannels - hMcMasa->numHorizontalChannels ); @@ -1035,15 +1048,22 @@ static void computeEvenLayout( return; } + +/*------------------------------------------------------------------------- + * ivas_create_masa_out_meta() + * + * + *------------------------------------------------------------------------*/ + void ivas_create_masa_out_meta( MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ - SPHERICAL_GRID_DATA *Sph_Grid16, /* i: Spherical grid */ - const int16_t nchan_transport, /* i: Number of transport channels */ - float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated elevation */ - float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated azimuth */ - float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated direct-to-total ratio */ - float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated spread coherence */ - float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: Estimated surround coherence */ + SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ + const int16_t nchan_transport, /* i : Number of transport channels */ + float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated elevation */ + float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated azimuth */ + float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated direct-to-total ratio */ + float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated spread coherence */ + float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */ ) { const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ @@ -1052,7 +1072,6 @@ void ivas_create_masa_out_meta( uint8_t numDirections; uint16_t spherical_index; - numDirections = 1; numFrequencyBands = MASA_FREQUENCY_BANDS; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 86ec0125d5afb63e4fc81c064a94d7c98b8d753b..2ba225b2f15723187a77c6c8ca5404f7526e366b 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -48,7 +48,6 @@ * Local function prototypes *---------------------------------------------------------------------*/ - static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); static void angles_to_vec( const float radius, const float azimuth, const float elevation, float *vec ); @@ -263,8 +262,8 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t *enableCombinedOrientation, /* i : Combined orientation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ - const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) { diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index d988ad53d2ac65baf5a69da192b9261b6efe7d22..679887b3ecfdc233aa5c554141b9af9bd475897e 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -57,13 +57,13 @@ static void sincResample( const float *input, float *output, const int16_t lengt * Apply ITD by delaying late channel *---------------------------------------------------------------------*/ void TDREND_Apply_ITD( - float *input, /* i: Input subframe to be time adjusted */ - float *out_left, /* o: Output left channel with ITD applied */ - float *out_right, /* o: Output right channel with ITD applied */ - int16_t *previtd, /*i/o: Previous ITD value */ - const int16_t itd, /* i: Current subframe ITD value */ - float *mem_itd, /*i/o: ITD buffer memory */ - const int16_t length /* i: Subframe length */ + float *input, /* i : Input subframe to be time adjusted */ + float *out_left, /* o : Output left channel with ITD applied */ + float *out_right, /* o : Output right channel with ITD applied */ + int16_t *previtd, /* i/o: Previous ITD value */ + const int16_t itd, /* i : Current subframe ITD value */ + float *mem_itd, /* i/o: ITD buffer memory */ + const int16_t length /* i : Subframe length */ ) { int16_t transition_len; diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 456b406b1d6ff39b8b9d7a023b2d961f1504b784..8debd6619bc341bc6a55f83b8ff28bc239403bd5 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -247,18 +247,18 @@ static void TDREND_SRC_REND_Init( --------------------------------------------------------------------*/ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ - TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ - float *hrf_left_prev, /* o: Left filter */ - float *hrf_right_prev, /* o: Right filter */ - float *hrf_left_delta, /* o: Left filter interpolation delta */ - float *hrf_right_delta, /* o: Right filter interpolation delta */ - int16_t *intp_count, /* o: Interpolation count */ - int16_t *filterlength, /* o: Length of filters */ - int16_t *itd, /* o: ITD value */ - float *Gain, /* o: Gain value */ - TDREND_SRC_t *Src_p, /* i/o: Source pointer */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ + TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ + float *hrf_left_prev, /* o : Left filter */ + float *hrf_right_prev, /* o : Right filter */ + float *hrf_left_delta, /* o : Left filter interpolation delta */ + float *hrf_right_delta, /* o : Right filter interpolation delta */ + int16_t *intp_count, /* o : Interpolation count */ + int16_t *filterlength, /* o : Length of filters */ + int16_t *itd, /* o : ITD value */ + float *Gain, /* o : Gain value */ + TDREND_SRC_t *Src_p, /* i/o: Source pointer */ const int16_t subframe_update_flag ) { TDREND_MIX_Listener_t *Listener_p; diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index c13815be3cf97f3319617eaeb531e8b44766e1b1..eeed6a8253cce3146db337b57c3858c48cc60387 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -62,8 +62,8 @@ static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], const int16_t input_f ivas_error ivas_omasa_ana_open( OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ - int32_t input_Fs, /* i: Sampling frequency */ - uint16_t total_num_objects /* i: Number of objects */ + int32_t input_Fs, /* i : Sampling frequency */ + uint16_t total_num_objects /* i : Number of objects */ ) { int16_t i, j; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 9594cf0b92db6133b435c6bc8beff08378ebc5e0..803a612502e88c4edc139db1c8c7dbf2bd704748 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -325,9 +325,9 @@ void HRTF_model_precalc( ivas_error TDREND_REND_RenderSourceHRFilt( TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ - const float *hrf_left_delta, /* i: Left filter interpolation delta */ - const float *hrf_right_delta, /* i: Right filter interpolation delta */ - const int16_t intp_count, /* i: Interpolation count */ + const float *hrf_left_delta, /* i : Left filter interpolation delta */ + const float *hrf_right_delta, /* i : Right filter interpolation delta */ + const int16_t intp_count, /* i : Interpolation count */ float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ const int16_t subframe_length /* i : Subframe length in use */ ); @@ -362,14 +362,14 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ - float *hrf_left_prev, /* o: Left filter */ - float *hrf_right_prev, /* o: Right filter */ - float *hrf_left_delta, /* o: Left filter interpolation delta */ - float *hrf_right_delta, /* o: Right filter interpolation delta */ - int16_t *intp_count, /* o: Interpolation count */ - int16_t *filterlength, /* o: Length of filters */ - int16_t *itd, /* o: ITD value */ - float *Gain, /* o: Gain value */ + float *hrf_left_prev, /* o : Left filter */ + float *hrf_right_prev, /* o : Right filter */ + float *hrf_left_delta, /* o : Left filter interpolation delta */ + float *hrf_right_delta, /* o : Right filter interpolation delta */ + int16_t *intp_count, /* o : Interpolation count */ + int16_t *filterlength, /* o : Length of filters */ + int16_t *itd, /* o : ITD value */ + float *Gain, /* o : Gain value */ TDREND_SRC_t *Src_p, const int16_t subframe_update_flag /* i : Flag to determine update subframe idx */ ); @@ -463,13 +463,13 @@ ivas_error TDREND_MIX_Init( /* ----- Object renderer - sfx ----- */ void TDREND_Apply_ITD( - float *input, /* i: Input SCE subframe to be time adjusted */ - float *out_left, /* o: Output left channels with ITD applied */ - float *out_right, /* o: Output right channels with ITD applied */ - int16_t *previtd, /*i/o: Previous ITD value */ - const int16_t itd, /* i: Current subframe ITD value */ - float *mem_itd, /*i/o: ITD buffer memory */ - const int16_t length /* i: Subframe length */ + float *input, /* i : Input SCE subframe to be time adjusted */ + float *out_left, /* o : Output left channels with ITD applied */ + float *out_right, /* o : Output right channels with ITD applied */ + int16_t *previtd, /* i/o: Previous ITD value */ + const int16_t itd, /* i : Current subframe ITD value */ + float *mem_itd, /* i/o: ITD buffer memory */ + const int16_t length /* i : Subframe length */ ); void TDREND_firfilt( @@ -562,7 +562,6 @@ void ivas_binaural_reverb_processSubframe( float outImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* o : output CLDFB data imag */ ); - ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ @@ -591,7 +590,7 @@ void ivas_rev_delay_line_init( const uint16_t maxdelay /* i : maximum delay to be supported */ ); -/* !r: sample gotten out of delay line, and amplified by set gain */ +/*! r: sample gotten out of delay line, and amplified by set gain */ float ivas_rev_delay_line_get_sample( ivas_rev_delay_line_t *pDelay /* i/o: the delay line */ ); @@ -803,7 +802,7 @@ void SHrotmatgen( void rotateFrame_shd( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : head and external orientation combined handle */ - float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ + float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const int16_t subframe_idx /* i : subframe index */ @@ -860,31 +859,11 @@ ivas_error combine_external_and_head_orientations_dec( ); ivas_error combine_external_and_head_orientations_rend( - IVAS_REND_HeadRotData *hHeadTrackData, /* i : head track handle */ - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ -); - -ivas_error combine_external_and_head_orientations( - IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ - IVAS_VECTOR3 *listenerPos, /* i : listener position */ - int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ + IVAS_REND_HeadRotData *hHeadTrackData, /* i : head track handle */ + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ); -void external_target_interpolation( - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ - const int16_t i -); - -bool are_orientations_same( - const IVAS_QUATERNION *orientation1, - const IVAS_QUATERNION *orientation2 -); - - /*----------------------------------------------------------------------------------* * Renderer configuration *----------------------------------------------------------------------------------*/ @@ -971,39 +950,39 @@ ivas_error ivas_orient_trk_Process( *----------------------------------------------------------------------------------*/ ivas_error ivas_mcmasa_ana_open( - MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ - const IVAS_REND_AudioConfig inConfig, /* i: Input config */ - int32_t input_Fs /* i: Sampling frequency */ + MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ + const IVAS_REND_AudioConfig inConfig, /* i : Input config */ + int32_t input_Fs /* i : Sampling frequency */ ); void ivas_mcmasa_ana( - MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ - float data_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const int16_t nchan_inp /* i : Number of input channels */ + MCMASA_ANA_HANDLE hMcMasa, /* i/o: McMASA encoder handle */ + float data_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_inp /* i : Number of input channels */ ); void ivas_mcmasa_ana_close( - MCMASA_ANA_HANDLE *hMcMasa /* i/o: analysis McMASA handle */ + MCMASA_ANA_HANDLE *hMcMasa /* i/o: analysis McMASA handle */ ); ivas_error ivas_omasa_ana_open( - OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ - int32_t input_Fs, /* i: Sampling frequency */ - uint16_t total_num_objects /* i: Number of objects */ + OMASA_ANA_HANDLE *hOMasaPtr, /* i/o: OMASA data handle pointer */ + int32_t input_Fs, /* i : Sampling frequency */ + uint16_t total_num_objects /* i : Number of objects */ ); void ivas_omasa_ana( - OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ - float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const int16_t nchan_ism /* i : Number of objects for parameter analysis */ + OMASA_ANA_HANDLE hOMasa, /* i/o: OMASA analysis handle */ + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_ism /* i : Number of objects for parameter analysis*/ ); void ivas_omasa_ana_close( - OMASA_ANA_HANDLE *hOMasa /* i/o: analysis OMASA handle */ + OMASA_ANA_HANDLE *hOMasa /* i/o: analysis OMASA handle */ ); void computeIntensityVector_ana( @@ -1024,50 +1003,50 @@ void computeReferencePower_ana( void ivas_create_masa_out_meta( MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: MASA metadata handle */ - SPHERICAL_GRID_DATA *Sph_Grid16, /* i: Spherical grid */ - const int16_t nchan_transport, /* i: Number of transport channels */ - float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated elevation */ - float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated azimuth */ - float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated direct-to-total ratio */ - float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: Estimated spread coherence */ - float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: Estimated surround coherence */ + SPHERICAL_GRID_DATA *Sph_Grid16, /* i : Spherical grid */ + const int16_t nchan_transport, /* i : Number of transport channels */ + float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated elevation */ + float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated azimuth */ + float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated direct-to-total ratio */ + float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Estimated spread coherence */ + float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : Estimated surround coherence */ ); ivas_error ivas_dirac_ana_open( - DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ + DIRAC_ANA_HANDLE *hDirACPtr, /* i/o: DIRAC data handle pointer */ int32_t input_Fs ); void ivas_dirac_ana( - DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ - float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport /* i : Number of transport channels */ + DIRAC_ANA_HANDLE hDirAC, /* i/o: DIRAC analysis handle */ + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport /* i : Number of transport channels */ ); void ivas_dirac_ana_close( - DIRAC_ANA_HANDLE ( *hDirAC ) /* i/o: analysis DIRAC handle */ + DIRAC_ANA_HANDLE ( *hDirAC ) /* i/o: analysis DIRAC handle */ ); void ivas_prerend_merge_masa_metadata( - MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o: Merged metadata output */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i: Input metadata 1 */ - IVAS_REND_AudioConfigType inType1, /* i: Type of input 1 */ - float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ - MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i: Input metadata 2 */ - IVAS_REND_AudioConfigType inType2, /* i: Type of input 2 */ - float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i: TF-energy of input 2 */ + MASA_DECODER_EXT_OUT_META_HANDLE outMeta, /* o : Merged metadata output */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, /* i : Input metadata 1 */ + IVAS_REND_AudioConfigType inType1, /* i : Type of input 1 */ + float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */ + MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, /* i : Input metadata 2 */ + IVAS_REND_AudioConfigType inType2, /* i : Type of input 2 */ + float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i : TF-energy of input 2 */ ); void copy_masa_descriptive_meta( - MASA_DECRIPTIVE_META *outMeta, /* o: metadata to be written */ - MASA_DECRIPTIVE_META *inMeta /* i: input metadata */ + MASA_DECRIPTIVE_META *outMeta, /* o : metadata to be written */ + MASA_DECRIPTIVE_META *inMeta /* i : input metadata */ ); ivas_error masaPrerendOpen( - MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o: handle to the opened prerenderer */ - int16_t numTransports, /* i: number of transport channels */ - int32_t input_Fs /* i: signal sampling rate */ + MASA_PREREND_HANDLE *hMasaPrerendPtr, /* o : handle to the opened prerenderer */ + int16_t numTransports, /* i : number of transport channels */ + int32_t input_Fs /* i : signal sampling rate */ ); void masaPrerendClose( diff --git a/lib_rend/ivas_reverb_delay_line.c b/lib_rend/ivas_reverb_delay_line.c index 892a0d21c9854000fce1f913f16ff88ac3f3a7d8..a91551f71d63d0edf763ba24077ad3e3a34126e9 100644 --- a/lib_rend/ivas_reverb_delay_line.c +++ b/lib_rend/ivas_reverb_delay_line.c @@ -160,7 +160,7 @@ void ivas_rev_delay_line_feed_sample_blk( * NOTE: get a sample out of the line before feeding the next *-----------------------------------------------------------------------------------------*/ -/* !r: sample gotten out of delay line, and amplified by set gain */ +/*! r: sample gotten out of delay line, and amplified by set gain */ float ivas_rev_delay_line_get_sample( ivas_rev_delay_line_t *pDelay /* i/o: the delay line */ ) diff --git a/lib_rend/ivas_reverb_fft_filter.c b/lib_rend/ivas_reverb_fft_filter.c index 725f5e6bc14dc5a43eecb292e2e23745d85c2be5..8b14d2d41ed9ef41881162e79a3e2e8fb5950845 100644 --- a/lib_rend/ivas_reverb_fft_filter.c +++ b/lib_rend/ivas_reverb_fft_filter.c @@ -58,7 +58,7 @@ static void ifft_wrapper_2ch( float *buffer_L, float *buffer_R, const int16_t ff * NOT valid for integers thar are NOT a power of 2 *-----------------------------------------------------------------------------------------*/ -/* !r: integer log2 */ +/*! r: integer log2 */ uint16_t int_log2( uint32_t powerOf2 ) { diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index f1677def687efd3bc5aa0a65e48e64c581a0f612..2cd2744b5ab8e04baa373b461073442f2d21e6b5 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -44,6 +44,17 @@ #include "wmc_auto.h" +/*-----------------------------------------------------------------------* + * Local funtion declarations + *-----------------------------------------------------------------------*/ + +static ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, IVAS_VECTOR3 *listenerPos, int16_t numHeadRotQuaternions, EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); + +static void external_target_interpolation( EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, const int16_t i ); + +static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); + + /*-----------------------------------------------------------------------* * ivas_headTrack_open() * @@ -208,7 +219,7 @@ void rotateAziEle( int16_t *azi, /* o : rotated azimuth */ int16_t *ele, /* o : rotated elevation */ float Rmat[3][3], /* i : real-space rotation matrix */ - const int16_t isPlanar /* i : is rotation planar and elevation meaningless? */ + const int16_t isPlanar /* i : is rotation planar and elevation meaningless? */ ) { int16_t n; @@ -249,11 +260,11 @@ void rotateAziEle( *------------------------------------------------------------------------*/ void rotateFrame_shd( - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : head and external orientation combined handle */ - float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const int16_t subframe_idx /* i : subframe index */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : head and external orientation combined handle */ + float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, l, n, m; @@ -350,12 +361,12 @@ void rotateFrame_shd( *------------------------------------------------------------------------*/ void rotateFrame_sd( - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : head and external orientation combined handle */ - float *output[], /* i/o: unrotated SD signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t subframe_idx /* i : subframe index */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : head and external orientation combined handle */ + float *output[], /* i/o: unrotated SD signal buffer in TD */ + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, j; @@ -582,7 +593,7 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t numTimeSlots, /* i : number of time slots to process */ + const int16_t numTimeSlots, /* i : number of time slots to process */ const int16_t nb_band /* i : number of CLDFB bands to process */ ) { @@ -745,7 +756,7 @@ void ivas_external_orientation_close( *-----------------------------------------------------------------------*/ ivas_error ivas_combined_orientation_open( - COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* o : combined orientation handle */ + COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* o : combined orientation handle */ ) { int16_t i, j; @@ -811,7 +822,7 @@ ivas_error ivas_combined_orientation_open( *-----------------------------------------------------------------------*/ void ivas_combined_orientation_close( - COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* i/o: combined orientation handle */ + COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* i/o: combined orientation handle */ ) { if ( hCombinedOrientationData == NULL || *hCombinedOrientationData == NULL ) @@ -833,9 +844,9 @@ void ivas_combined_orientation_close( *------------------------------------------------------------------------*/ ivas_error combine_external_and_head_orientations_dec( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { IVAS_QUATERNION *headRotQuaternions = NULL; @@ -863,9 +874,9 @@ ivas_error combine_external_and_head_orientations_dec( *------------------------------------------------------------------------*/ ivas_error combine_external_and_head_orientations_rend( - IVAS_REND_HeadRotData *hHeadTrackData, /* i : head track handle */ - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ + IVAS_REND_HeadRotData *hHeadTrackData, /* i : head track handle */ + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { IVAS_QUATERNION *headRotQuaternions = NULL; @@ -904,12 +915,12 @@ ivas_error combine_external_and_head_orientations_rend( * NOTE that the external orientations are inversed. *------------------------------------------------------------------------*/ -ivas_error combine_external_and_head_orientations( - IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ - IVAS_VECTOR3 *listenerPos, /* i : listener position */ - int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ +static ivas_error combine_external_and_head_orientations( + IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ + int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) { int16_t i, j; @@ -1158,9 +1169,9 @@ ivas_error combine_external_and_head_orientations( * *------------------------------------------------------------------------*/ -void external_target_interpolation( - EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ +static void external_target_interpolation( + EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ const int16_t i ) { /* Sanity check for number of frames */ @@ -1198,6 +1209,8 @@ void external_target_interpolation( hCombinedOrientationData->interpolationIncrement = 1.0f; hCombinedOrientationData->Quaternions[i] = hExtOrientationData->Quaternions[i]; } + + return; } @@ -1207,12 +1220,13 @@ void external_target_interpolation( * *------------------------------------------------------------------------*/ -bool are_orientations_same( +static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ) { bool orientationsAreSame = true; float error_margin = 0.05f; + if ( fabsf( orientation1->w - orientation2->w ) > error_margin || fabsf( orientation1->x - orientation2->x ) > error_margin || fabsf( orientation1->y - orientation2->y ) > error_margin || diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index d8d6127b20875a1862e53635b0f6c84c324613ba..88e96d29163fa21347d37c2fea20aeacf20f985c 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -309,13 +309,13 @@ ivas_error IVAS_REND_MergeMasaMetadata( ); ivas_error IVAS_REND_SetTotalNumberOfObjects( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const uint16_t total_num_objects /* i: total number of objects */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const uint16_t total_num_objects /* i : total number of objects */ ); ivas_error IVAS_REND_GetNumAllObjects( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ - int16_t *numChannels /* o : number of all objects */ + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + int16_t *numChannels /* o : number of all objects */ ); ivas_error IVAS_REND_GetSamples( diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index eadcc9e1da98dae0f01b030bcbe106d0455f00dc..e2181ca6e161dfa01782eb1b87605056565db857 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -727,8 +727,8 @@ static ivas_error ivas_hrtf_init( *---------------------------------------------------------------------*/ static ivas_error create_HRTF_from_rawdata( - HRTFS_HANDLE *hHRTF, /* i/o: HRTF CRend handle */ - char *hrtf_data /* i: pointer to binary file */ + HRTFS_HANDLE *hHRTF, /* i/o: HRTF CRend handle */ + char *hrtf_data /* i : pointer to binary file */ ) { int16_t i, j, k; diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index 2b59c3150b25c054aaaece41fc1829a8fc781f84..a731416570963abdfddd88e2234f8a17df278d6f 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -86,9 +86,9 @@ ivas_error load_HRTF_binary( *---------------------------------------------------------------------*/ ivas_error create_SetOfHRTF_from_binary( - IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF, /* i/o: Set of HRTF CRend handle */ - const hrtfFileReader *hrtfReader, /* i: pointer to hrtfFileReader handle */ - int32_t output_Fs /* i: Output sampling frequency */ + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF, /* i/o: Set of HRTF CRend handle */ + const hrtfFileReader *hrtfReader, /* i : pointer to hrtfFileReader handle */ + int32_t output_Fs /* i : Output sampling frequency */ ); @@ -110,7 +110,7 @@ ivas_error destroy_SetOfHRTF( *---------------------------------------------------------------------*/ ivas_error load_fastconv_HRTF_from_binary( - IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv, /* i/o: FastConv HRTF handle */ + IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv, /* i/o: FastConv HRTF handle */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ); @@ -122,7 +122,7 @@ ivas_error load_fastconv_HRTF_from_binary( *---------------------------------------------------------------------*/ ivas_error load_parambin_HRTF_from_binary( - IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin, /* i/o: Parambin HRTF handle */ + IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin, /* i/o: Parambin HRTF handle */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ); diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index d9477ad9dc3c3e3decf2f1e03f18c52d6bbd33fb..a3b04563e4e62141f8ed937b110ecad6b27c3522 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -40,7 +40,7 @@ /*------------------------------------------------------------------------------------------* - * PreProc Macros + * PreProc Local Macros *------------------------------------------------------------------------------------------*/ #define MAX_LINE_LENGTH ( 1024 ) @@ -65,7 +65,7 @@ #define INPUTPREDELAY_MAX ( 1.0e+2f ) /*------------------------------------------------------------------------------------------* - * Type definitions + * Local Type definitions *------------------------------------------------------------------------------------------*/ struct RenderConfigReader @@ -76,10 +76,11 @@ struct RenderConfigReader /*-----------------------------------------------------------------------------------------* * Function read_bool() + * * Reads a boolean value from a line *-----------------------------------------------------------------------------------------*/ -/* !r: false on success, true on failure */ +/*! r: false on success, true on failure */ static int16_t read_bool( const char *pLine, /* i : String to read from */ int16_t *pTarget /* o : Output pointer (int16_t type used instead of bool because of coding rules/specs) */ @@ -193,7 +194,7 @@ static void strip_spaces_upper( * Prints error message and exits *-----------------------------------------------------------------------------------------*/ -/* !r: error accumulation */ +/*! r: error accumulation */ static int32_t errorHandler( const char *badStr, /* i : String to complain about */ const ERROR_CODES_t error )