diff --git a/lib_com/fill_spectrum.c b/lib_com/fill_spectrum.c index c1837d5140b2d468d632c56ecbe4d2b804c84b43..a3dbcf304b640025fe0ebb48970a45c796946fdf 100644 --- a/lib_com/fill_spectrum.c +++ b/lib_com/fill_spectrum.c @@ -90,18 +90,10 @@ void fill_spectrum( const int16_t element_mode /* i : element mode */ ) { -#ifdef FIX_I178_HQ_BUFFER_OVERRUN float CodeBook[L_SPEC48k_EXT]; -#else - float CodeBook[FREQ_LENGTH]; -#endif int16_t cb_size = 0; int16_t last_sfm; -#ifdef FIX_I178_HQ_BUFFER_OVERRUN float CodeBook_mod[L_SPEC48k_EXT]; -#else - float CodeBook_mod[FREQ_LENGTH]; -#endif float norm_adj[NB_SFM]; int16_t high_sfm = 23; int16_t flag_32K_env_hangover; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 0512cf27e6e4f8004af29f667e3097e234dd26a0..abf0e1f663a0076bc04cee7d25dcdb4a8ccda9e1 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1319,11 +1319,7 @@ typedef enum #define PANNING_ELE_RESOLUTION 5 #define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */ -#ifdef ALLRAD_OPTIM #define EFAP_MAX_POLY_SET 50 /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */ -#else -#define EFAP_MAX_POLY_SET 70 /* Upper bound on number of polygons; with a Speaker setup of 26.0, we obtain 54 polygons/triangles in the matlab implementation. */ -#endif #define EFAP_MODE_EFAP 0 /* EFAP Panning */ #define EFAP_MODE_EFIP 1 /* EFIP Panning */ diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 00158712871c6b35dcbbb73aa274f4d0ae4c057d..eaaec6a9821d9b554aa7e1f63cd7a1207aa796e0 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -169,36 +169,22 @@ void ivas_spar_covar_smooth_enc_close( static void ivas_compute_smooth_cov( ivas_cov_smooth_state_t *hCovState, -#ifndef SBA_SPAR_HARM - ivas_cov_smooth_in_buf_t *pIn_buf, -#endif ivas_filterbank_t *pFb, float *pCov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *pPrior_cov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const float fac, const int16_t start_band, - const int16_t end_band -#ifdef SBA_SPAR_HARM - , + const int16_t end_band, const int16_t num_ch, - const int16_t transient_det -#endif -) + const int16_t transient_det ) { int16_t i, j, k; int16_t prev_idx = hCovState->prior_bank_idx; -#ifndef SBA_SPAR_HARM - int16_t num_ch = pIn_buf->num_ch; -#endif float factor = 0; assert( end_band <= pFb->filterbank_num_bands ); -#ifdef SBA_SPAR_HARM if ( prev_idx == -1 || transient_det == 1 ) -#else - if ( prev_idx == -1 || pIn_buf->reset_cov == 1 ) -#endif { for ( i = 0; i < num_ch; i++ ) { @@ -243,42 +229,23 @@ static void ivas_compute_smooth_cov( void ivas_cov_smooth_process( ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ -#ifdef SBA_SPAR_HARM float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#else - ivas_cov_smooth_in_buf_t *pIn_buf, -#endif ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t start_band, - const int16_t end_band -#ifdef SBA_SPAR_HARM - , + const int16_t end_band, const int16_t num_ch, - const int16_t transient_det -#endif -) + const int16_t transient_det ) { int16_t i, j; -#ifndef SBA_SPAR_HARM - int16_t num_ch = pIn_buf->num_ch; -#endif int16_t num_bands = end_band - start_band; -#ifdef SBA_SPAR_HARM ivas_compute_smooth_cov( hCovState, pFb, cov_real, hCovState->pPrior_cov_real, 1e-20f, start_band, end_band, num_ch, transient_det ); -#else - ivas_compute_smooth_cov( hCovState, pIn_buf, pFb, pIn_buf->cov_real, hCovState->pPrior_cov_real, 1e-20f, start_band, end_band ); -#endif for ( i = 0; i < num_ch; i++ ) { for ( j = 0; j < num_ch; j++ ) { -#ifdef SBA_SPAR_HARM mvr2r( &cov_real[i][j][start_band], &hCovState->pPrior_cov_real[i][j][start_band], num_bands ); -#else - mvr2r( &pIn_buf->cov_real[i][j][start_band], &hCovState->pPrior_cov_real[i][j][start_band], num_bands ); -#endif } } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 50f0bba4fb6b802a3f43044ff01126da1aeb7184..dcf94d576149ce7d60badaba28a76a2f5228a2f8 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -125,14 +125,12 @@ void ivas_mct_enc_close( MCT_ENC_HANDLE hMCT /* i/o: MCT encoder structure */ ); -#ifdef CORECODER_BITRATE_SWITCHING ivas_error ivas_corecoder_enc_reconfig( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t nSCE_old, /* i : number of SCEs in previous frame */ const int16_t nCPE_old, /* i : number of CPEs in previous frame */ const int16_t nchan_transport_old /* i : number of TCs in previous frame */ ); -#endif ivas_error ivas_sce_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ @@ -206,9 +204,7 @@ ivas_error pre_proc_ivas( Encoder_State *st, /* i/o: encoder state structure */ const int16_t last_element_mode, /* i : last element mode */ const int32_t element_brate, /* i : element bitrate */ -#ifdef CORECODER_BITRATE_SWITCHING const int32_t last_element_brate, /* i : last element bitrate */ -#endif const int16_t input_frame, /* i : frame length */ float old_inp_12k8[], /* i/o: buffer of old input signal */ float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ @@ -333,7 +329,6 @@ void ivas_mct_dec_close( MCT_DEC_HANDLE *hMCT /* i/o: MCT decoder structure */ ); -#ifdef CORECODER_BITRATE_SWITCHING ivas_error ivas_corecoder_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSCE_old, /* i : number of SCEs in previous frame */ @@ -346,7 +341,6 @@ ivas_error ivas_hp20_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_hp20_old /* i : number of HP20 filters in previous frame*/ ); -#endif ivas_error ivas_sce_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -418,9 +412,7 @@ ivas_error ivas_core_enc( float enerBuffer[CPE_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : energy buffer */ float fft_buff[CPE_CHANNELS][2 * L_FFT], /* i : FFT buffer */ const int16_t tdm_SM_flag, /* i : channel combination scheme flag */ -#ifdef CORECODER_BITRATE_SWITCHING const int16_t ivas_format, /* i : IVAS format */ -#endif const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); @@ -2169,12 +2161,8 @@ void stereo_decoder_tcx( const int16_t core_l, /* i : core for left channel (TCX20/TCX10) */ const int16_t core_r, /* i : core for right channel (TCX20/TCX10) */ const int16_t igf, /* i : flag for IGF activity */ -#ifdef FIX_TCX10_STEREO_PROC const int16_t L_frameTCX_l, /* i : TCX frame length of left channel */ const int16_t L_frameTCX_r, /* i : TCX frame length of right channel */ -#else - const int16_t L_frame, /* i : TCX frame length */ -#endif const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ const int16_t last_core_l, /* i : last core for left channel */ const int16_t last_core_r, /* i : last core for right channel */ @@ -3030,10 +3018,8 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame -#ifdef SBA_HOA_HBR_IMPROV , const SBA_MODE sba_mode -#endif ); /*----------------------------------------------------------------------------------* @@ -3093,13 +3079,11 @@ int16_t ivas_sba_get_nchan_metadata( const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -#ifdef SBA_HOA_HBR_IMPROV /*! r: flag indicating to code SPAR HOA MD for all bands */ int16_t ivas_sba_get_spar_hoa_md_flag( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); -#endif void ivas_sba_zero_vert_comp( float sba_data[][L_FRAME48k], /* i/o: SBA data frame */ @@ -3919,19 +3903,11 @@ void ivas_spar_md_enc_close( ivas_error ivas_spar_md_enc_process( ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ -#ifdef SBA_SPAR_HARM float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#else - ivas_spar_md_enc_in_buf_t *pIn_buf, -#endif BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ -#ifdef SBA_SPAR_HARM int16_t dtx_vad, const int16_t nchan_inp, -#else - const int16_t dtx_silence_mode, -#endif const int16_t sba_order /* i : Ambisonic (SBA) order */ ); @@ -3995,10 +3971,8 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ -#ifdef SBA_HOA_HBR_IMPROV , const int16_t sba_order /* i : SBA order */ -#endif ); void ivas_spar_md_dec_close( @@ -4071,24 +4045,16 @@ void ivas_spar_covar_enc_close( void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ -#ifdef SBA_SPAR_HARM float **ppIn_FR_real, float **ppIn_FR_imag, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#else - ivas_enc_cov_handler_in_buf_t *pIn_buf, - float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#endif ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t start_band, const int16_t end_band -#ifdef SBA_SPAR_HARM ,const int16_t nchan_inp, const int16_t dtx_vad, const int16_t transient_det -#endif ); ivas_error ivas_spar_covar_smooth_enc_open( @@ -4105,19 +4071,13 @@ void ivas_spar_covar_smooth_enc_close( void ivas_cov_smooth_process( ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ -#ifdef SBA_SPAR_HARM float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#else - ivas_cov_smooth_in_buf_t *pIn_buf, -#endif ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t start_band, const int16_t end_band -#ifdef SBA_SPAR_HARM , const int16_t num_ch, const int16_t transient_det -#endif ); /* Transient detector module */ @@ -4846,10 +4806,8 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands /* i : Number of frequency bands */ -#ifdef SBA_HOA_HBR_IMPROV , const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index cf22cf38ff3fe3cc2838c8730c51fb7d552e3c81..29c0ca6617d18532e49845a19699f0e8213b14ad 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -281,7 +281,6 @@ int16_t ivas_sba_get_nchan_metadata( return ( nb_channels ); } -#ifdef SBA_HOA_HBR_IMPROV /*-------------------------------------------------------------------* * ivas_sba_get_spar_hoa_md_flag() * @@ -307,7 +306,6 @@ int16_t ivas_sba_get_spar_hoa_md_flag( return spar_hoa_md_flag; } -#endif /*-------------------------------------------------------------------* * ivas_sba_zero_vert_comp() diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index b5821e4632c2f60be4ca7b67ee6522a5efe7df62..fa5e65460eab83d197a4b3e103b1ae288092e4ec 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1737,11 +1737,6 @@ void ivas_get_spar_md_from_dirac( /*SPAR from DirAC*/ set_f( response_avg, 0.0f, MAX_OUTPUT_CHANNELS ); -#ifndef SBA_HOA_HBR_IMPROV - set_f( hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].pred_re, 0.0f, IVAS_SPAR_MAX_CH - 1 ); - set_f( &hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].C_re[0][0], 0.0f, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); - set_f( &hSpar_md->band_coeffs[band + i_ts * IVAS_MAX_NUM_BANDS].P_re[0], 0.0f, ( IVAS_SPAR_MAX_CH - 1 ) ); -#endif if ( n_ts > 1 ) { ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][i_ts], (int16_t) ele_dirac[band][i_ts], response_avg, order ); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 026191559b76eff0d360e4b8ba50fa047242a3c6..b275d2d6eb9a720db470193b35700fbdef0d143f 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -352,15 +352,6 @@ typedef struct ivas_cov_smooth_cfg_t } ivas_cov_smooth_cfg_t; -#ifndef SBA_SPAR_HARM -typedef struct ivas_cov_smooth_in_buf_t -{ - float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - int16_t num_ch; - int16_t reset_cov; - -} ivas_cov_smooth_in_buf_t; -#endif /* SPAR bitrate constant table structure */ typedef struct ivas_spar_br_table_t diff --git a/lib_com/ivas_stereo_psychlpc_com.c b/lib_com/ivas_stereo_psychlpc_com.c index 3cbca73cc066e1298db27a9e393265232b96f2c0..8a50caaa29ce34a5b8eadd8fb577f926a276cd3e 100644 --- a/lib_com/ivas_stereo_psychlpc_com.c +++ b/lib_com/ivas_stereo_psychlpc_com.c @@ -68,14 +68,14 @@ static void SpectrumWeighting_Init( * initialize a PsychoacousticParameters structure *-------------------------------------------------------------------*/ - ivas_error - PsychoacousticParameters_Init( - const int32_t sr_core, /* i : sampling rate of core-coder */ - const int16_t nBins, /* i : Number of bins (spectral lines) */ - const int8_t nBands, /* i : Number of spectrum subbands */ - const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ - const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */ - PsychoacousticParameters *pPsychParams ) +ivas_error +PsychoacousticParameters_Init( + const int32_t sr_core, /* i : sampling rate of core-coder */ + const int16_t nBins, /* i : Number of bins (spectral lines) */ + const int8_t nBands, /* i : Number of spectrum subbands */ + const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ + const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */ + PsychoacousticParameters *pPsychParams ) { if ( pPsychParams == NULL ) diff --git a/lib_com/options.h b/lib_com/options.h index 0a58d7d06f97d0656ba9161ce741d03739fb71dc..3c41d7d271c0d558ebbc19c1356d267ddc011055 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -143,21 +143,8 @@ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ /*#define FIX_I1_113*/ /* under review : MCT bit distribution optimization for SBA high bitrates*/ - -#define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ -#define FIX_TCX10_STEREO_PROC /* Issue 11 */ -#define CORECODER_BITRATE_SWITCHING /* Issue 133: support bitrate switching in core-coder */ -#define ISM_BITRATE_SWITCHING /* Issue 115: Support for Bitrate Switching in ISM */ -#define SBA_SPAR_HARM /* Issue 92: maintenance of the SBA SPAR functions */ -#define FIX_155_HP20_ISSUE /* Issue 155: apply hp20 on all input channels instead of just 2 channels */ -#define EFAP_FIX_POLY /* Issue 167: fix bug in EFAP polygon selection */ -#define SBA_HOA_HBR_IMPROV /* issue 91: Improvements to SBA high bitrate HOA3 coding */ -#define ALLRAD_OPTIM /* Issue 159: Optimize memory allocation for ALLRAD */ -#define FIX_I178_HQ_BUFFER_OVERRUN /* issue 178: Buffer overrun in HQ core decoder -- spectral filling buffer did not account for extended transition frame in IVAS */ #define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */ - #define SPAR_STEREO_NO_DIRAC /* Issue 180: skip DirAC processing channels for stereo output */ - #define AGC_TUNING_IMPROVEMENT /* Issue 168: Enable AGC for low bit rate (1 TC) */ #ifdef AGC_TUNING_IMPROVEMENT #define AGC_ENABLE_FOR_LBR /* Issue 168: Enable AGC for low bit rate (1 TC) */ diff --git a/lib_com/vlpc_2st_com.c b/lib_com/vlpc_2st_com.c index f027ecd8ea0448889afd92be1aa2f1dbfbd251a6..86fdf68c5ff96114e7cc32be3f1f420811c94d25 100644 --- a/lib_com/vlpc_2st_com.c +++ b/lib_com/vlpc_2st_com.c @@ -52,8 +52,7 @@ void lsf_weight_2st( const float *lsfq, float *w, const int16_t mode, - const int32_t sr_core -) + const int32_t sr_core ) { int16_t i; float d[M + 1]; diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index c74564e1f70f6022720ba92225910a80460e24cb..904e1178513ab66c956966235378bf1642c585a0 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1465,12 +1465,6 @@ void decoder_tcx_tns( isTCX5 = 1; tcx5SpectrumDeinterleaving( L >> 1, x ); -#ifndef FIX_I13_TCX_TNS_ISSUE - if ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 && tnsData->tnsOnWhitenedSpectra == whitenedDomain ) - { - tcx5TnsGrouping( L >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x ); - } -#endif } } @@ -1488,12 +1482,10 @@ void decoder_tcx_tns( /* Apply TNS to get the reconstructed signal */ SetTnsConfig( hTcxCfg, L_frame_glob == st->L_frame, ( st->last_core == ACELP_CORE ) && ( frame_cnt == 0 ) ); -#ifdef FIX_I13_TCX_TNS_ISSUE if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 ) { tcx5TnsGrouping( L >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x ); } -#endif ApplyTnsFilter( hTcxCfg->pCurrentTnsConfig, tnsData, x, 0 ); #ifdef DEBUG_PLOT @@ -1502,9 +1494,6 @@ void decoder_tcx_tns( if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 ) { -#ifndef FIX_I13_TCX_TNS_ISSUE - tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC ); -#else if ( st->element_mode == EVS_MONO || L_spec < L_frameTCX ) /* TBC: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ { tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC ); @@ -1513,7 +1502,6 @@ void decoder_tcx_tns( { tcx5TnsUngrouping( L >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC ); } -#endif } } diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index f876391b2de67b8f1d0cc71e8d7ae73605ebe5bf..2cded759289c48a02e4c4c646508ea48e834d7a6 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -679,8 +679,8 @@ static void IGF_appl( float *pSpectralData, /* i/o: Q31 | MDCT spectrum */ const float *igf_spec, /* i : Q31 | prepared IGF spectrum */ float *virtualSpec, /* o : Q31 | virtual IGF spectrum, used for temp flattening */ - int16_t *flag_sparse, /* o : Q0 | temp flattening indicator */ - const int16_t bfi_apply_damping /* i : flag to indicate if damping for lost frames should be applied */ + int16_t *flag_sparse, /* o : Q0 | temp flattening indicator */ + const int16_t bfi_apply_damping /* i : flag to indicate if damping for lost frames should be applied */ ) { H_IGF_GRID hGrid; @@ -1240,8 +1240,7 @@ void IGFDecApplyStereo( const int16_t *coreMsMask, const int16_t restrict_hopsize, const int16_t bfi, /* i : frame loss == 1, frame good == 0 */ - const int16_t bfi_apply_damping -) + const int16_t bfi_apply_damping ) { IGF_DEC_PRIVATE_DATA_HANDLE hPrivateDataL, hPrivateDataR; H_IGF_GRID hGrid; diff --git a/lib_dec/ivas_allrad_dec.c b/lib_dec/ivas_allrad_dec.c index 13e4f3c2410bae840e59d1d2908bb83012764c94..ab1402a452d0583910381e4f1da3bb636fd848b3 100644 --- a/lib_dec/ivas_allrad_dec.c +++ b/lib_dec/ivas_allrad_dec.c @@ -108,11 +108,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( /* Allocate memory */ assert( *hoa_dec_mtx == NULL && "hoa_dec_mtx != NULL" ); -#ifdef ALLRAD_OPTIM if ( ( *hoa_dec_mtx = (float *) count_malloc( SBA_NHARM_HOA3 * ( hOutSetup.nchan_out_woLFE ) * sizeof( float ) ) ) == NULL ) -#else - if ( ( *hoa_dec_mtx = (float *) count_malloc( SBA_NHARM_HOA3 * MAX_OUTPUT_CHANNELS * sizeof( float ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "ALLRAD: Cannot allocate memory!" ) ); } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index fd5d5b3c1ef70f169c4ebe65f2ab2f82a6802e57..e18f0e3e5db2f8bb869ac20949eec75cf949bb38 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -186,8 +186,8 @@ ivas_error ivas_core_dec( { float gain; - gain = ( st->element_mode == IVAS_CPE_MDCT ) ? st->hTcxDec->conceal_eof_gain : - ( st->hPlcInfo != NULL ) ? st->hPlcInfo->recovery_gain : 0.0f; + gain = ( st->element_mode == IVAS_CPE_MDCT ) ? st->hTcxDec->conceal_eof_gain : ( st->hPlcInfo != NULL ) ? st->hPlcInfo->recovery_gain + : 0.0f; if ( ( st->element_mode == IVAS_CPE_MDCT && hMCT == NULL ) || ( st->hPlcInfo != NULL ) ) { diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index cebd17010080f95798a969f1aae612c5e2f4b9cb..b11ba6cd396164ad19265c11ddd5dab15c0c4edc 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -46,7 +46,6 @@ #include "wmops.h" -#ifdef CORECODER_BITRATE_SWITCHING /*-------------------------------------------------------------------* * ivas_corecoder_dec_reconfig() * @@ -272,9 +271,7 @@ ivas_error ivas_corecoder_dec_reconfig( *-----------------------------------------------------------------*/ /// VE: this could be merged with part of ivas_init_decoder() -#ifdef ISM_BITRATE_SWITCHING if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) { @@ -401,4 +398,3 @@ ivas_error ivas_hp20_dec_reconfig( return error; } -#endif diff --git a/lib_dec/ivas_efap.c b/lib_dec/ivas_efap.c index bbb464b292ceb80ef9731c2664c052caf8fa4e2d..788eb58f33766140d654ca22ff0786738009f87e 100644 --- a/lib_dec/ivas_efap.c +++ b/lib_dec/ivas_efap.c @@ -100,9 +100,7 @@ static float vertex_distance( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGL static float point_plane_distance( const float P1[3], const float P2[3], const float P3[3], const float X[3] ); -#ifdef EFAP_FIX_POLY static float point_poly_distance( const EFAP_POLYSET poly, const float X[3] ); -#endif static void efap_crossp( const float *v1, const float *v2, float *v ); static int16_t find_int_in_tri( const EFAP_LS_TRIANGLE *tri, const int16_t n, const int16_t r, int16_t *pos ); @@ -127,9 +125,7 @@ static int16_t in_poly( const float P[2], const EFAP_POLYSET poly ); static int16_t in_tri( float A[2], float B[2], float C[2], float P_minus_A[2] ); -#ifdef EFAP_FIX_POLY static void sph2cart( const float azi, const float ele, float *pos ); -#endif /*-----------------------------------------------------------------------* * Global function definitions @@ -1502,13 +1498,7 @@ static void add_vertex( vtxArray[pos].ele = ( ( -180.0f > tmp ) ? -180.0f : tmp ); /* Converting spherical coordinates to cartesians, assuming radius = 1 */ -#ifdef EFAP_FIX_POLY sph2cart( vtxArray[pos].azi, vtxArray[pos].ele, &vtxArray[pos].pos[0] ); -#else - vtxArray[pos].pos[0] = cosf( vtxArray[pos].azi * PI_OVER_180 ) * cosf( vtxArray[pos].ele * PI_OVER_180 ); - vtxArray[pos].pos[1] = sinf( vtxArray[pos].azi * PI_OVER_180 ) * cosf( vtxArray[pos].ele * PI_OVER_180 ); - vtxArray[pos].pos[2] = sinf( vtxArray[pos].ele * PI_OVER_180 ); -#endif /* Computing the index defined by idx = idxAziTmp + 181 * idxEleTmp */ @@ -1600,7 +1590,6 @@ static float vertex_distance( return point_plane_distance( A, B, C, P ); } -#ifdef EFAP_FIX_POLY /*-------------------------------------------------------------------------* * point_poly_distance() * @@ -1620,7 +1609,6 @@ static float point_poly_distance( return point_plane_distance( P1, P2, P3, X ); } -#endif /*-------------------------------------------------------------------------* * point_plane_distance() @@ -2112,7 +2100,6 @@ static int16_t get_poly_num( ) { int16_t i; -#ifdef EFAP_FIX_POLY int16_t num_poly, found_poly; int16_t poly_tmp[EFAP_MAX_CHAN_NUM]; float poly_dist[EFAP_MAX_CHAN_NUM]; @@ -2125,12 +2112,10 @@ static int16_t get_poly_num( sph2cart( P[0], P[1], &pos[0] ); /* Filter the polygon list with a fast 2d check */ -#endif for ( i = 0; i < polyData->numPoly; ++i ) { if ( in_poly( P, polyData->polysetArray[i] ) ) { -#ifdef EFAP_FIX_POLY /* select only polygons which are visible from the point */ dist_tmp = point_poly_distance( polyData->polysetArray[i], pos ); if ( dist_tmp == 0 ) @@ -2143,12 +2128,8 @@ static int16_t get_poly_num( poly_dist[num_poly] = dist_tmp; num_poly++; } -#else - return i; -#endif } } -#ifdef EFAP_FIX_POLY if ( num_poly == 0 ) { return -1; @@ -2167,9 +2148,6 @@ static int16_t get_poly_num( } return found_poly; -#else - return -1; -#endif } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3250fe05cbc889f52c0500ef11582c5eedfb7d77..30b96a25c823febddf1ebd26fe95ecc1fb148626 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -792,10 +792,9 @@ ivas_error ivas_init_decoder( if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA #ifdef SPAR_STEREO_NO_DIRAC - && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO - && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO + && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO #endif - ) + ) { if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -892,9 +891,7 @@ ivas_error ivas_init_decoder( } st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ -#ifdef CORECODER_BITRATE_SWITCHING st_ivas->hCPE[0]->hCoreCoder[1] = NULL; -#endif } if ( st_ivas->nCPE > 1 ) @@ -1092,9 +1089,7 @@ ivas_error ivas_init_decoder( } st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ -#ifdef CORECODER_BITRATE_SWITCHING st_ivas->hCPE[0]->hCoreCoder[1] = NULL; -#endif } /* set CNA/CNG flags */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index c6c1f99c9c960aab46001c9e640f0ea98c7c1892..8ebf27afb5b31c8fe665286a4f716d39e6e39c44 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1004,7 +1004,6 @@ void ivas_param_ism_params_to_masa_param_mapping( } -#ifdef ISM_BITRATE_SWITCHING /*-------------------------------------------------------------------------* * ivas_ism_bitrate_switching() * @@ -1018,9 +1017,6 @@ static ivas_error ivas_ism_bitrate_switching( const int16_t num_obj /* i : number of objects in the bitstream */ ) { -#ifndef CORECODER_BITRATE_SWITCHING - int16_t sce_id; -#endif ivas_error error; int32_t element_brate_tmp[MAX_NUM_OBJECTS]; @@ -1029,85 +1025,9 @@ static ivas_error ivas_ism_bitrate_switching( ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); st_ivas->nSCE = st_ivas->nchan_transport; -#ifdef CORECODER_BITRATE_SWITCHING ivas_corecoder_dec_reconfig( st_ivas, nchan_transport_old, 0, nchan_transport_old, 0 ); -#else - if ( st_ivas->nchan_transport > nchan_transport_old ) - { - /* Initialize for new bitrate */ - for ( sce_id = 0; sce_id < nchan_transport_old; sce_id++ ) - { - st_ivas->hSCE[sce_id]->element_brate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - /* Initialize some memories */ - for ( sce_id = nchan_transport_old; sce_id < st_ivas->nchan_transport; sce_id++ ) - { - if ( ( error = create_sce_dec( st_ivas, sce_id, element_brate_tmp[sce_id] ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else - { - /* Initialize for new bitrate */ - for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) - { - st_ivas->hSCE[sce_id]->element_brate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - - /* Destroy the core coder memory */ - for ( ; sce_id < nchan_transport_old; sce_id++ ) - { - destroy_sce_dec( st_ivas->hSCE[sce_id] ); - st_ivas->hSCE[sce_id] = NULL; - } - } -#endif - -#ifdef CORECODER_BITRATE_SWITCHING ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ); -#else - /* destroy the memory of hp20*/ - if ( st_ivas->mem_hp20_out != NULL ) - { - for ( sce_id = 0; sce_id < nchan_transport_old; sce_id++ ) - { - count_free( st_ivas->mem_hp20_out[sce_id] ); - st_ivas->mem_hp20_out[sce_id] = NULL; - } - count_free( st_ivas->mem_hp20_out ); - st_ivas->mem_hp20_out = NULL; - } - - /* re initialize the memory of hp20 */ - /* set number of input channels used for analysis/coding */ - - if ( st_ivas->nchan_transport > 0 ) - { - if ( ( st_ivas->mem_hp20_out = (float **) count_malloc( st_ivas->nchan_transport * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } - else - { - st_ivas->mem_hp20_out = NULL; - } - - for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) - { - if ( ( st_ivas->mem_hp20_out[sce_id] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_out[sce_id], 0.0f, L_HP20_MEM ); - } -#endif /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */ @@ -1215,7 +1135,6 @@ static ivas_error ivas_ism_bitrate_switching( return error; } -#endif /*------------------------------------------------------------------------- * ivas_ism_dec_config() @@ -1233,9 +1152,7 @@ ivas_error ivas_ism_dec_config( int32_t ivas_total_brate; ISM_MODE last_ism_mode; ivas_error error; -#ifdef ISM_BITRATE_SWITCHING int16_t nchan_transport_old; -#endif error = IVAS_ERR_OK; @@ -1243,14 +1160,12 @@ ivas_error ivas_ism_dec_config( /* store last frame ISM mode */ last_ism_mode = st_ivas->ism_mode; -#ifdef ISM_BITRATE_SWITCHING /* Assumes that num of input objects are constant */ nchan_transport_old = num_obj; if ( last_ism_mode == ISM_MODE_PARAM ) { nchan_transport_old = 2; } -#endif if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) { @@ -1269,7 +1184,6 @@ ivas_error ivas_ism_dec_config( if ( st_ivas->ini_active_frame != 0 ) { -#ifdef ISM_BITRATE_SWITCHING /* ISM bit-rate switching */ if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA ) { @@ -1278,14 +1192,6 @@ ivas_error ivas_ism_dec_config( ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ); } } -#else - /* ISM format switching */ - if ( st_ivas->ism_mode != last_ism_mode ) - { - /*ivas_ism_dec_reconfigure( st_ivas );*/ - return IVAS_ERROR( IVAS_ERR_RECONFIGURE_NOT_SUPPORTED, "\n\n!!! Error: ISM format switching not supported yet!!!\n\n" ); - } -#endif } } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) diff --git a/lib_dec/ivas_mct_dec_mct.c b/lib_dec/ivas_mct_dec_mct.c index 2dd7b18d529363d5d1f162377aad10ead2073b71..6b8f9b74fab3437b960e24438bb59b975fcf5e9c 100644 --- a/lib_dec/ivas_mct_dec_mct.c +++ b/lib_dec/ivas_mct_dec_mct.c @@ -220,11 +220,7 @@ void apply_MCT_dec( { hBlock = hMCT->hBlockData[pair]; -#ifdef FIX_TCX10_STEREO_PROC stereo_decoder_tcx( hBlock->hStereoMdct, hBlock->mask, &x[hBlock->ch2][0], &x[hBlock->ch1][0], &x[hBlock->ch2][0], hBlock->hStereoMdct->mdct_stereo_mode, sts[hBlock->ch1]->core, sts[hBlock->ch2]->core, sts[0]->igf, sts[0]->hTcxDec->L_frameTCX, sts[1]->hTcxDec->L_frameTCX, 1, TCX_20_CORE, TCX_20_CORE, 0 ); -#else - stereo_decoder_tcx( hBlock->hStereoMdct, hBlock->mask, &x[hBlock->ch2][0], &x[hBlock->ch1][0], &x[hBlock->ch2][0], hBlock->hStereoMdct->mdct_stereo_mode, sts[hBlock->ch1]->core, sts[hBlock->ch2]->core, sts[0]->igf, sts[0]->hTcxDec->L_frameTCX, 1, TCX_20_CORE, TCX_20_CORE, 0 ); -#endif } applyGlobalILD( sts, hMCT, x ); diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 748475dc5c9379536682365c7fda3ded85bd7110..3e186d61b8be5920ca39a0942985c8ccc2379ac5 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -494,16 +494,10 @@ void ivas_mdct_core_invQ( if ( bfi && !MCT_flag && ( hCPE->hStereoMdct->mdct_stereo_mode[0] > SMDCT_DUAL_MONO || hCPE->hStereoMdct->mdct_stereo_mode[1] > SMDCT_DUAL_MONO ) ) { L_frameTCX[0] = sts[0]->L_frameTCX_past; -#ifdef FIX_TCX10_STEREO_PROC L_frameTCX[1] = sts[1]->L_frameTCX_past; -#endif mvr2r( sts[0]->hTonalMDCTConc->lastBlockData.spectralData, tmp_ms_sig[0], L_frameTCX[0] ); mvr2r( sts[1]->hTonalMDCTConc->lastBlockData.spectralData, tmp_ms_sig[1], L_frameTCX[0] ); -#ifdef FIX_TCX10_STEREO_PROC stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], &sts[0]->hTonalMDCTConc->lastBlockData.spectralData, &sts[1]->hTonalMDCTConc->lastBlockData.spectralData, &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 1 ); -#else - stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], &sts[0]->hTonalMDCTConc->lastBlockData.spectralData, &sts[1]->hTonalMDCTConc->lastBlockData.spectralData, &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], 0, sts[0]->last_core, sts[1]->last_core, 1 ); -#endif } if ( bfi ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 2180cb79a31b039e4ee6bde871dc6068b9fa5a86..3d91d6834de503faafa4bbf5616ca71a7132de9a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -347,15 +347,9 @@ ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifdef CORECODER_BITRATE_SWITCHING int16_t i; int16_t nchan_transport, nchan_transport_old; int16_t nSCE_old, nCPE_old, nchan_hp20_old; -#else - int16_t i, n, sce_id, cpe_id; - int16_t nchan_transport, nchan_transport_old; - int16_t nSCE_old, nCPE_old; -#endif AUDIO_CONFIG intern_config_old; int16_t numCldfbAnalyses_old, numCldfbAnalyses, numCldfbSyntheses, numCldfbSyntheses_old; int16_t sba_dirac_stereo_flag_old; @@ -374,9 +368,7 @@ ivas_error ivas_sba_dec_reconfigure( ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); numCldfbAnalyses = 0; -#ifdef CORECODER_BITRATE_SWITCHING nchan_hp20_old = getNumChanSynthesis( st_ivas ); -#endif nSCE_old = st_ivas->nSCE; nCPE_old = st_ivas->nCPE; @@ -456,7 +448,6 @@ ivas_error ivas_sba_dec_reconfigure( * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ -#ifdef CORECODER_BITRATE_SWITCHING ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old ); /*-----------------------------------------------------------------* @@ -464,251 +455,6 @@ ivas_error ivas_sba_dec_reconfigure( *-----------------------------------------------------------------*/ ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ); -#else - - if ( nchan_transport == nchan_transport_old ) - { - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - st_ivas->hSCE[sce_id]->element_brate = ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - st_ivas->hCPE[cpe_id]->element_brate = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - } - - if ( st_ivas->nCPE > 1 ) - { - if ( ( error = mct_dec_reconfigure( st_ivas, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else - { - int16_t nSCE_existing; - int16_t nCPE_existing; - - nSCE_existing = min( nSCE_old, st_ivas->nSCE ); - nCPE_existing = min( nCPE_old, st_ivas->nCPE ); - - /* destroy superfluous core coder elements */ - for ( sce_id = st_ivas->nSCE; sce_id < nSCE_old; sce_id++ ) - { - destroy_sce_dec( st_ivas->hSCE[sce_id] ); - st_ivas->hSCE[sce_id] = NULL; - - /* remove dummy CPE needed for 1TC->Stereo rendering via DFT stereo*/ - if ( sba_dirac_stereo_flag_old ) - { -#ifdef DEBUGGING - assert( st_ivas->hCPE[0] ); -#endif - st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hCPE[0]->hCoreCoder[1] = NULL; - destroy_cpe_dec( st_ivas->hCPE[0] ); - st_ivas->hCPE[0] = NULL; - } - } - - for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ ) - { - destroy_cpe_dec( st_ivas->hCPE[cpe_id] ); - st_ivas->hCPE[cpe_id] = NULL; - } - - if ( st_ivas->nCPE <= 1 && st_ivas->hMCT != NULL ) - { - ivas_mct_dec_close( &st_ivas->hMCT ); - } - - /* special case, if we have MCT now and had a single CPE before, remove the MDCT Stereo handles from the first CPE*/ - if ( st_ivas->nCPE > 1 && nCPE_old == 1 ) - { - count_free( st_ivas->hCPE[0]->hStereoMdct ); - st_ivas->hCPE[0]->hStereoMdct = NULL; - } - - for ( sce_id = 0; sce_id < nSCE_existing; sce_id++ ) - { - st_ivas->hSCE[sce_id]->element_brate = ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - for ( ; sce_id < st_ivas->nSCE; sce_id++ ) - { - if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) - { - st_ivas->hCPE[cpe_id]->element_brate = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - } - for ( ; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* create CPE element for DFT Stereo like upmix */ - if ( st_ivas->sba_dirac_stereo_flag ) - { - if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ - } - - if ( st_ivas->nCPE > 1 && nCPE_old <= 1 ) - { - if ( nCPE_old == 1 ) - { - /* set correct nominal bitrates and igf config already here, needed for the correct init of the MDCT Stereo handles for MCT */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->total_brate = st_ivas->hCPE[0]->element_brate; - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); - st_ivas->hCPE[0]->hCoreCoder[n]->igf = 0; - } - } - - if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 ) - { - if ( ( error = mct_dec_reconfigure( st_ivas, st_ivas->nCPE != nCPE_old ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* special case, if we have a single CPE and had MCT before we need to init the MDCT stereo handles here */ - if ( st_ivas->nCPE == 1 && nCPE_old > 1 ) - { - if ( ( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct = (STEREO_MDCT_DEC_DATA_HANDLE) count_malloc( sizeof( STEREO_MDCT_DEC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); - } - - st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->use_itd = 0; - st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->reverse_dmx = 0; - st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->smooth_ratio = 1.f; - - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - /* reset mct_chan_mode */ - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - } - } - - /*-----------------------------------------------------------------* - * HP20 memories - *-----------------------------------------------------------------*/ - - if ( nchan_transport > nchan_transport_old ) - { - /* create additional hp20 memories */ - float **old_mem_hp20_out; - uint16_t n_old; - - if ( sba_dirac_stereo_flag_old ) - { - n_old = CPE_CHANNELS; - } - else - { - n_old = nchan_transport_old; - } - n = st_ivas->nchan_transport; - - /* save old mem_hp_20 pointer */ - old_mem_hp20_out = st_ivas->mem_hp20_out; - st_ivas->mem_hp20_out = NULL; - if ( ( st_ivas->mem_hp20_out = (float **) count_malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - for ( i = 0; i < n_old; i++ ) - { - st_ivas->mem_hp20_out[i] = old_mem_hp20_out[i]; - old_mem_hp20_out[i] = NULL; - } - for ( ; i < nchan_transport; i++ ) - { - if ( ( st_ivas->mem_hp20_out[i] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); - } - - count_free( old_mem_hp20_out ); - old_mem_hp20_out = NULL; - } - else if ( nchan_transport < nchan_transport_old ) - { - /* remove superfluous hp20 memories */ - float **old_mem_hp20_out; - - if ( st_ivas->sba_dirac_stereo_flag ) - { - n = CPE_CHANNELS; - } - else - { - n = st_ivas->nchan_transport; - } - - /* save old mem_hp_20 pointer */ - old_mem_hp20_out = st_ivas->mem_hp20_out; - st_ivas->mem_hp20_out = NULL; - if ( ( st_ivas->mem_hp20_out = (float **) count_malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - for ( i = 0; i < n; i++ ) - - { - st_ivas->mem_hp20_out[i] = old_mem_hp20_out[i]; - old_mem_hp20_out[i] = NULL; - } - for ( ; i < nchan_transport_old; i++ ) - { - count_free( old_mem_hp20_out[i] ); - old_mem_hp20_out[i] = NULL; - } - - count_free( old_mem_hp20_out ); - old_mem_hp20_out = NULL; - } - } -#endif /*-----------------------------------------------------------------* * CLDFB instances @@ -769,49 +515,6 @@ ivas_error ivas_sba_dec_reconfigure( } } -#ifndef CORECODER_BITRATE_SWITCHING - /*-----------------------------------------------------------------* - * Set CNA/CNG flags - *-----------------------------------------------------------------*/ - - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) - { - /* skip as done in init function */ - } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; - } - else if ( st_ivas->nchan_transport == 2 ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; - st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - else - { - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cna_dirac_flag = 0; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 0; - } - } - } - - /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */ - if ( last_ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE >= 1 ) - { - if ( ( error = initMdctStereoDtxData( st_ivas->hCPE[0] ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif /*-------------------------------------------------------------------* * Reallocate and initialize binaural rendering handles diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index a51e941548654f7c345afd82041ee7e811fa5a14..444a14457e633a15f47a9e5ef613b02bb1b89c0c 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -89,12 +89,8 @@ ivas_error ivas_spar_dec_open( } /* MD handle */ - if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal -#ifdef SBA_HOA_HBR_IMPROV - , - sba_order_internal -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, + sba_order_internal ) ) != IVAS_ERR_OK ) { return error; } @@ -649,13 +645,11 @@ static void ivas_spar_dec_MD( { ivas_parse_spar_header( hDecoderConfig->ivas_total_brate, sba_order, st0, &table_idx ); -#ifdef SBA_HOA_HBR_IMPROV if ( hSpar->hMdDec->spar_hoa_md_flag ) { hSpar->hMdDec->spar_md.num_bands = IVAS_MAX_NUM_BANDS; } else -#endif { hSpar->hMdDec->spar_md.num_bands = min( SPAR_DIRAC_SPLIT_START_BAND, IVAS_MAX_NUM_BANDS ); } @@ -801,11 +795,7 @@ void ivas_spar_get_parameters( weight = ivas_spar_get_cldfb_slot_gain( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms ); -#ifdef SBA_HOA_HBR_IMPROV split_band = hSpar->hMdDec->spar_md.num_bands; -#else - split_band = SPAR_DIRAC_SPLIT_START_BAND; -#endif for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { @@ -1146,12 +1136,11 @@ void ivas_spar_dec_upmixer( } } - if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_FOA + if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_FOA #ifdef SPAR_STEREO_NO_DIRAC - && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO - && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO + && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO #endif - ) + ) { ivas_dirac_dec( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im, i_sf ); } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 3d5f03b2087cde099c7f145eb6d8fe0f53cbe6c8..5d39aee9a01da10c64dcbd2e9490a79de6d5c753 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -250,10 +250,8 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ -#ifdef SBA_HOA_HBR_IMPROV , const int16_t sba_order /* i : SBA order */ -#endif ) { ivas_spar_md_dec_state_t *hMdDec; @@ -271,9 +269,7 @@ ivas_error ivas_spar_md_dec_open( return error; } -#ifdef SBA_HOA_HBR_IMPROV hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); -#endif hMdDec->table_idx = 0; /* just to initialize state variables*/ if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels ) ) != IVAS_ERR_OK ) @@ -446,19 +442,10 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_md_cfg.gen_bs = 1; // VE2DB : always 1 - can it be removed? -#ifdef SBA_HOA_HBR_IMPROV hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); -#else - hMdDec->spar_md.num_bands = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); -#endif ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, -#ifdef SBA_HOA_HBR_IMPROV - hMdDec->spar_md.num_bands -#else - min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ) -#endif - ); + hMdDec->spar_md.num_bands ); nchan_transport = hMdDec->spar_md_cfg.nchan_transport; @@ -684,33 +671,20 @@ void ivas_spar_md_dec_process( } #endif -#ifndef SBA_SPAR_HARM - /* SPAR to DirAC and DirAC to SPAR conversion */ // VE2DB: -> "DirAC to SPAR conversion" only? - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) // VE2DB: this looks obsolete - { -#else /* SPAR to DirAC conversion */ -#endif - ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out ); + ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out ); - /* set correct number of bands*/ - nB = IVAS_MAX_NUM_BANDS; - if ( bw == IVAS_RED_BAND_FACT ) - { - nB = nB >> 1; - } -#ifndef SBA_SPAR_HARM + /* set correct number of bands*/ + nB = IVAS_MAX_NUM_BANDS; + if ( bw == IVAS_RED_BAND_FACT ) + { + nB = nB >> 1; } -#endif /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) { -#ifdef SBA_HOA_HBR_IMPROV for ( b = 0; b < hMdDec->spar_md.num_bands; b++ ) -#else - for ( b = 0; b < min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); b++ ) -#endif { for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { @@ -1419,7 +1393,7 @@ void ivas_spar_dec_gen_umx_mat( } } } - + #ifdef DEBUG_SBA_MD_DUMP { static FILE *f_mat = 0; @@ -1791,7 +1765,6 @@ static void ivas_decode_arith_bs( ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; pred_cell_dims[i].dim1 = ndm + ndec - 1; -#ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) @@ -1799,7 +1772,6 @@ static void ivas_decode_arith_bs( pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); } } -#endif pred_cell_dims[i].dim2 = 1; drct_cell_dims[i].dim1 = ndec; drct_cell_dims[i].dim2 = ndm - 1; @@ -1820,7 +1792,6 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { -#ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { int16_t j; @@ -1836,7 +1807,6 @@ static void ivas_decode_arith_bs( } } } -#endif ivas_copy_band_coeffs_idx_to_arr( hMdDec->spar_md_prev.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); } @@ -1845,7 +1815,6 @@ static void ivas_decode_arith_bs( ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); -#ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { int16_t j; @@ -1865,7 +1834,6 @@ static void ivas_decode_arith_bs( } } } -#endif if ( any_diff == 1 ) { @@ -2115,7 +2083,6 @@ static void ivas_decode_huffman_bs( drct_dim = ndec * ( ndm - 1 ); decd_dim = ndec; pred_offset = 0; -#ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) @@ -2123,7 +2090,6 @@ static void ivas_decode_huffman_bs( pred_offset = FOA_CHANNELS - 1; } } -#endif for ( j = pred_offset; j < pred_dim; j++ ) { @@ -2131,7 +2097,6 @@ static void ivas_decode_huffman_bs( &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); } -#ifdef SBA_HOA_HBR_IMPROV if ( hMdDec->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) @@ -2142,7 +2107,6 @@ static void ivas_decode_huffman_bs( } } } -#endif for ( j = 0; j < drct_dim; j++ ) { @@ -2796,11 +2760,7 @@ void ivas_spar_to_dirac( { ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, -#ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, -#else - sba_order_internal, -#endif dtx_vad, NULL ); /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ @@ -2815,11 +2775,7 @@ void ivas_spar_to_dirac( ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, MAX_PARAM_SPATIAL_SUBFRAMES, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, -#ifdef SBA_HOA_HBR_IMPROV ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, -#else - sba_order_internal, -#endif dtx_vad, NULL ); /* expand DirAC TC 20ms MD for residual channels to all subframes*/ diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 765770f0c093228fd15e7888f7e4f600067cc2f1..b2e8940b8cef48189d1b11aeca81b516e8f008b5 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -803,9 +803,7 @@ typedef struct ivas_spar_md_dec_state_t ivas_huff_coeffs_t huff_coeffs; int16_t table_idx; int16_t dtx_vad; -#ifdef SBA_HOA_HBR_IMPROV int16_t spar_hoa_md_flag; -#endif } ivas_spar_md_dec_state_t; diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 82ad3fc95b2190c9cb6d318c554e6f6d966bdba3..d0d05f1fa0d66b593f6126fa67dafa95a417953d 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -340,11 +340,7 @@ void stereo_mdct_core_dec( #ifdef DEBUGGING assert( ( sts[0]->core == sts[1]->core ) || ( ( hCPE->hStereoMdct->mdct_stereo_mode[0] == SMDCT_DUAL_MONO ) && ( hCPE->hStereoMdct->mdct_stereo_mode[1] == SMDCT_DUAL_MONO ) ) ); #endif -#ifdef FIX_TCX10_STEREO_PROC stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], x[0], x[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); -#else - stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], x[0], x[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], 0, sts[0]->last_core, sts[1]->last_core, 0 ); -#endif } ivas_mdct_core_tns_ns( hCPE, 0, fUseTns, tnsData, x, Aq, 0 ); diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 1bdbb5eda7a84d3469fbc5a726ba3a1a6964ca06..67b893a9f21729bc2f88a3c6a2015aac04dac89b 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -214,12 +214,8 @@ void stereo_decoder_tcx( const int16_t core_l, /* i : core for left channel (TCX20/TCX10) */ const int16_t core_r, /* i : core for right channel (TCX20/TCX10) */ const int16_t igf, /* i : flag for IGF activity */ -#ifdef FIX_TCX10_STEREO_PROC const int16_t L_frameTCX_l, /* i : TCX frame length of left channel */ const int16_t L_frameTCX_r, /* i : TCX frame length of right channel */ -#else - const int16_t L_frame, /* i : TCX frame length */ -#endif const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ const int16_t last_core_l, /* i : last core for left channel */ const int16_t last_core_r, /* i : last core for right channel */ @@ -333,19 +329,11 @@ void stereo_decoder_tcx( if ( ( nrgRatio > 1.0f ) && ( k < ( ( core_r == TCX_20_CORE ) ? 1 : NB_DIV ) ) ) { -#ifdef FIX_TCX10_STEREO_PROC v_multc( spec_r[k], nrgRatio, spec_r[k], L_frameTCX_r ); -#else - v_multc( spec_r[k], nrgRatio, spec_r[k], L_frame / ( ( core_r == TCX_20_CORE ) ? 1 : NB_DIV ) ); -#endif } else if ( ( nrgRatio < 1.0f ) && ( k < ( ( core_l == TCX_20_CORE ) ? 1 : NB_DIV ) ) ) { -#ifdef FIX_TCX10_STEREO_PROC v_multc( spec_l[k], 1.0f / nrgRatio, spec_l[k], L_frameTCX_l ); -#else - v_multc( spec_l[k], 1.0f / nrgRatio, spec_l[k], L_frame / ( ( core_l == TCX_20_CORE ) ? 1 : NB_DIV ) ); -#endif } } } /* for k */ diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c old mode 100755 new mode 100644 index 6050354a8f8ad25637b1b9583f17fe430c0226a1..e355cd2083872b56e454db3a66d7591c118c281c --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -462,7 +462,7 @@ static void IGF_CalculateEnvelope( float diffSFM; float shiftedSFM = 0.f; - tmp_tb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] ) / IGF_getCrest_new( hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] ); + tmp_tb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] ) / IGF_getCrest_new( hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] ); tmp_sb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, tmp, strt_cpy ) / IGF_getCrest_new( hPrivateData->logSpec, tmp, strt_cpy ); if ( last_core_acelp || hPrivateData->wasTransient ) @@ -494,12 +494,12 @@ static void IGF_CalculateEnvelope( if ( slope < -threshold ) { int16_t shift = width >> 1; - shiftedSFM = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ) / IGF_getCrest_new ( hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ); + shiftedSFM = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ) / IGF_getCrest_new( hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ); } else if ( ( slope > 1.f * threshold ) && ( sfb != hGrid->sfbWrap[hGrid->nTiles] - 1 ) ) { int16_t shift = width >> 1; - shiftedSFM = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ) / IGF_getCrest_new ( hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ); + shiftedSFM = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ) / IGF_getCrest_new( hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ); } if ( shiftedSFM > 0.04f ) diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index 0f3274f43c3d3b616c61b3901cb9720efd647592..b0012ee46924aca1ff37034cdbf48f7467a77672 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -74,8 +74,8 @@ int16_t ivas_agc_enc_get_enablement_flag( int16_t nchan_transport ) { return (int16_t) ( ( agc_configuration == IVAS_ENC_AGC_UNDEFINED ) - ? ( nchan_transport == 1 ) - : agc_configuration ); + ? ( nchan_transport == 1 ) + : agc_configuration ); } #endif diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 597f1d585452321b57d805030c505263ac049192..b863944b57afca08eac72862eee77b85a415478e 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -79,10 +79,8 @@ ivas_error ivas_core_enc( float enerBuffer[CPE_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : energy buffer */ float fft_buff[CPE_CHANNELS][2 * L_FFT], /* i : FFT buffer */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ -#ifdef CORECODER_BITRATE_SWITCHING - const int16_t ivas_format, /* i : IVAS format */ -#endif - const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ + const int16_t ivas_format, /* i : IVAS format */ + const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ) { int16_t n, input_frame; @@ -104,11 +102,7 @@ ivas_error ivas_core_enc( int16_t unbits[CPE_CHANNELS]; float tdm_lspQ_PCh[M], tdm_lsfQ_PCh[M]; int16_t last_element_mode, tdm_Pitch_reuse_flag; -#ifdef CORECODER_BITRATE_SWITCHING int32_t element_brate, last_element_brate, input_Fs; -#else - int32_t element_brate, input_Fs; -#endif ivas_error error; wmops_sub_start( "ivas_core_enc" ); @@ -127,9 +121,7 @@ ivas_error ivas_core_enc( hStereoTD = NULL; hStereoICBWE = NULL; element_brate = hSCE->element_brate; -#ifdef CORECODER_BITRATE_SWITCHING last_element_brate = hSCE->last_element_brate; -#endif last_element_mode = IVAS_SCE; tdm_Pitch_reuse_flag = -1; } @@ -144,9 +136,7 @@ ivas_error ivas_core_enc( sts = hCPE->hCoreCoder; hStereoICBWE = hCPE->hStereoICBWE; element_brate = hCPE->element_brate; -#ifdef CORECODER_BITRATE_SWITCHING last_element_brate = hCPE->last_element_brate; -#endif last_element_mode = hCPE->last_element_mode; if ( hCPE->hStereoTD != NULL ) @@ -187,11 +177,7 @@ ivas_error ivas_core_enc( * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ -#ifdef CORECODER_BITRATE_SWITCHING if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, ivas_format == SBA_FORMAT ? last_element_brate : element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], MCT_flag, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) -#else - if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], MCT_flag, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 3cc206e65eb2bf433f485d2d33d0930e5882a66b..acbacc09e0a266da989089bf1a8d6bee139076a5 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -52,12 +52,10 @@ *--------------------------------------------------------------------*/ ivas_error pre_proc_ivas( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t element_brate, /* i : element bitrate */ -#ifdef CORECODER_BITRATE_SWITCHING - const int32_t last_element_brate, /* i : last element bitrate */ -#endif + Encoder_State *st, /* i/o: encoder state structure */ + const int16_t last_element_mode, /* i : last element mode */ + const int32_t element_brate, /* i : element bitrate */ + const int32_t last_element_brate, /* i : last element bitrate */ const int16_t input_frame, /* i : frame length */ float old_inp_12k8[], /* i/o: buffer of old input signal */ float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ @@ -278,12 +276,10 @@ ivas_error pre_proc_ivas( { st->hTcxEnc->tfm_mem = 0.75f; } -#ifdef CORECODER_BITRATE_SWITCHING else if ( element_brate != last_element_brate ) { SetModeIndex( st, st->bits_frame_nominal * FRAMES_PER_SEC, element_mode, MCT_flag ); } -#endif /*-----------------------------------------------------------------* diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index f4b302eefd69a6f0b04dab44d94d2141e3271551..dffd53bb93c0cdc7225a60c10a40553fdbeb8c1a 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -43,7 +43,6 @@ #include "wmops.h" -#ifdef CORECODER_BITRATE_SWITCHING /*-------------------------------------------------------------------* * ivas_corecoder_enc_reconfig() * @@ -393,4 +392,3 @@ ivas_error ivas_corecoder_enc_reconfig( return error; } -#endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 491a9ab3586fa620fb63e12027a890e25baed9c8..e047defac67d161a2df175a6645e23735b1e979f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -612,11 +612,7 @@ ivas_error ivas_cpe_enc( * Core Encoder *----------------------------------------------------------------*/ -#ifdef CORECODER_BITRATE_SWITCHING if ( ( error = ivas_core_enc( NULL, hCPE, st_ivas->hMCT, n_CoreChannels, old_inp_12k8, old_inp_16k, Etot, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, realBuffer, imagBuffer, old_wsp, loc_harm, cor_map_sum, vad_flag_dtx, enerBuffer, fft_buff, tdm_SM_or_LRTD_Pri, ivas_format, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_core_enc( NULL, hCPE, st_ivas->hMCT, n_CoreChannels, old_inp_12k8, old_inp_16k, Etot, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, realBuffer, imagBuffer, old_wsp, loc_harm, cor_map_sum, vad_flag_dtx, enerBuffer, fft_buff, tdm_SM_or_LRTD_Pri, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 6d281256d922b65396da08f7c498964a205bb7be..96a005a0b3370d56b1e52f39f0c253293c55ad74 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -334,12 +334,8 @@ void ivas_dirac_enc( set_zero( data_f[2], input_frame ); } - ivas_dirac_param_est_enc( hDirAC, &( hQMetaData->q_direction[0] ), hQMetaData->useLowerRes, data_f, NULL, NULL, input_frame -#ifdef SBA_HOA_HBR_IMPROV - , - SBA_MODE_DIRAC -#endif - ); + ivas_dirac_param_est_enc( hDirAC, &( hQMetaData->q_direction[0] ), hQMetaData->useLowerRes, data_f, NULL, NULL, input_frame, + SBA_MODE_DIRAC ); /* encode parameters */ if ( sba_planar || hQMetaData->useLowerRes ) { @@ -457,7 +453,6 @@ void ivas_dirac_enc_spar_delay_synchro( { int16_t ch_idx; float tmp_buffer[L_FRAME48k]; -#ifdef CORECODER_BITRATE_SWITCHING Encoder_State *sts[MCT_MAX_BLOCKS]; int16_t sce_id, cpe_id, i_chan; @@ -487,7 +482,6 @@ void ivas_dirac_enc_spar_delay_synchro( mvr2r( sts[ch_idx]->input, st_ivas->hDirAC->sba_synchro_buffer[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); } } -#endif for ( ch_idx = 0; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) { @@ -514,18 +508,14 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands /* i : Number of frequency bands */ -#ifdef SBA_HOA_HBR_IMPROV , const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t brange[2]; int16_t ch_idx, i, j; -#ifdef SBA_HOA_HBR_IMPROV float reference_power_W[DIRAC_MAX_NBANDS]; -#endif for ( i = 0; i < num_freq_bands; i++ ) { @@ -533,19 +523,13 @@ void computeReferencePower_enc( brange[1] = band_grouping[i + enc_param_start_band + 1]; reference_power[i] = 0; -#ifdef SBA_HOA_HBR_IMPROV reference_power_W[i] = 0; for ( j = brange[0]; j < brange[1]; j++ ) { reference_power_W[i] += ( Cldfb_RealBuffer[0][j] * Cldfb_RealBuffer[0][j] ) + ( Cldfb_ImagBuffer[0][j] * Cldfb_ImagBuffer[0][j] ); } reference_power[i] += reference_power_W[i]; -#endif -#ifdef SBA_HOA_HBR_IMPROV for ( ch_idx = 1; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) -#else - for ( ch_idx = 0; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) -#endif { /* abs()^2 */ for ( j = brange[0]; j < brange[1]; j++ ) @@ -556,7 +540,6 @@ void computeReferencePower_enc( } v_multc( reference_power, 0.5f, reference_power, num_freq_bands ); -#ifdef SBA_HOA_HBR_IMPROV if ( sba_mode == SBA_MODE_SPAR ) { for ( i = 0; i < num_freq_bands; i++ ) @@ -564,7 +547,6 @@ void computeReferencePower_enc( reference_power[i] = max( reference_power[i], reference_power_W[i] ); } } -#endif return; } @@ -583,12 +565,8 @@ void ivas_dirac_param_est_enc( float data_f[][L_FRAME48k], float **pp_fr_real, float **pp_fr_imag, - const int16_t input_frame -#ifdef SBA_HOA_HBR_IMPROV - , - const SBA_MODE sba_mode -#endif -) + const int16_t input_frame, + const SBA_MODE sba_mode ) { int16_t i, d, ts, index, l_ts, num_freq_bands; int16_t band_m_idx, block_m_idx; @@ -686,12 +664,8 @@ void ivas_dirac_param_est_enc( Cldfb_ImagBuffer, reference_power[ts], hDirAC->hConfig->enc_param_start_band, - num_freq_bands -#ifdef SBA_HOA_HBR_IMPROV - , - sba_mode -#endif - ); + num_freq_bands, + sba_mode ); computeIntensityVector_enc( hDirAC, diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 907b8c5908b0b2b03423107c664a35d26db229f0..933c2c5de9b5a7185169fe7beb82396b379808a9 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -141,44 +141,23 @@ void ivas_spar_covar_enc_close( void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ -#ifdef SBA_SPAR_HARM float **ppIn_FR_real, float **ppIn_FR_imag, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#else - ivas_enc_cov_handler_in_buf_t *pIn_buf, - float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#endif ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t start_band, - const int16_t end_band -#ifdef SBA_SPAR_HARM - , + const int16_t end_band, const int16_t num_ch, const int16_t dtx_vad, - const int16_t transient_det -#endif -) + const int16_t transient_det ) { int16_t i, j; -#ifdef SBA_SPAR_HARM int16_t dtx_cov_flag; dtx_cov_flag = ( dtx_vad == 1 ) ? 0 : 1; -#else - ivas_cov_smooth_in_buf_t pCov_in_buf; - int16_t num_ch = pIn_buf->num_ch; - - pCov_in_buf.num_ch = num_ch; -#endif -#ifdef SBA_SPAR_HARM ivas_band_cov( ppIn_FR_real, ppIn_FR_imag, num_ch, hCovEnc->num_bins, -#else - ivas_band_cov( pIn_buf->ppIn_FR_real, pIn_buf->ppIn_FR_imag, pIn_buf->num_ch, hCovEnc->num_bins, -#endif pFb->fb_bin_to_band.short_stride, pFb->fb_bin_to_band.pp_short_stride_bin_to_band, pFb->fb_bin_to_band.p_short_stride_start_bin_per_band, @@ -213,36 +192,20 @@ void ivas_enc_cov_handler_process( { for ( j = 0; j < num_ch; j++ ) { -#ifndef SBA_SPAR_HARM - pCov_in_buf.cov_real[i][j] = cov_real[i][j]; -#endif mvr2r( cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); } } -#ifdef SBA_SPAR_HARM ivas_cov_smooth_process( hCovEnc->pCov_state, cov_real, pFb, start_band, end_band, num_ch, transient_det ); -#else - ivas_cov_smooth_process( hCovEnc->pCov_state, &pCov_in_buf, pFb, start_band, end_band ); -#endif -#ifdef SBA_SPAR_HARM if ( dtx_cov_flag == 0 ) -#else - if ( pIn_buf->dtx_cov_flag == 0 ) -#endif { for ( i = 0; i < num_ch; i++ ) { for ( j = 0; j < num_ch; j++ ) { -#ifdef SBA_SPAR_HARM mvr2r( cov_real[i][j], hCovEnc->pCov_dtx_state->pPrior_cov_real[i][j], pFb->filterbank_num_bands ); mvr2r( cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); -#else - mvr2r( pCov_in_buf.cov_real[i][j], hCovEnc->pCov_dtx_state->pPrior_cov_real[i][j], pFb->filterbank_num_bands ); - mvr2r( pCov_in_buf.cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); -#endif } } @@ -250,46 +213,16 @@ void ivas_enc_cov_handler_process( } else { -#ifdef SBA_SPAR_HARM if ( transient_det == 0 ) -#else - if ( pIn_buf->transient_det == 0 ) -#endif { -#ifdef SBA_SPAR_HARM ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, cov_dtx_real, pFb, start_band, end_band, num_ch, transient_det ); -#else - for ( i = 0; i < num_ch; i++ ) - { - for ( j = 0; j < num_ch; j++ ) - { - pCov_in_buf.cov_real[i][j] = cov_dtx_real[i][j]; - } - } - - pCov_in_buf.reset_cov = 0; - ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, &pCov_in_buf, pFb, start_band, end_band ); -#endif hCovEnc->prior_dtx_present = 1; } else { if ( hCovEnc->prior_dtx_present == 0 ) { -#ifdef SBA_SPAR_HARM ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, cov_dtx_real, pFb, start_band, end_band, num_ch, transient_det ); -#else - for ( i = 0; i < num_ch; i++ ) - { - for ( j = 0; j < num_ch; j++ ) - { - pCov_in_buf.cov_real[i][j] = cov_dtx_real[i][j]; - } - } - - pCov_in_buf.reset_cov = 1; - ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, &pCov_in_buf, pFb, start_band, end_band ); -#endif hCovEnc->prior_dtx_present = 1; } else diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c index 7f5ab7b996377bfbf38fb605194570e6afaed33a..a3714821f373f3aed82085d2ff2be94466494d23 100644 --- a/lib_enc/ivas_entropy_coder.c +++ b/lib_enc/ivas_entropy_coder.c @@ -316,17 +316,13 @@ void ivas_arith_encode_cmplx_cell_array( int16_t input[IVAS_MAX_INPUT_LEN]; ivas_cell_dim_t cell_dim[IVAS_MAX_NUM_BANDS], cell_dim_diff[IVAS_MAX_NUM_BANDS]; int16_t len, idx, i, j, idx1; -#ifdef SBA_HOA_HBR_IMPROV int16_t total_len; -#endif idx1 = 0; if ( any_diff == 1 ) { idx = 0; -#ifdef SBA_HOA_HBR_IMPROV total_len = 0; -#endif for ( i = 0; i < nB; i++ ) { len = ( pCell_dims[i].dim1 * pCell_dims[i].dim2 ); @@ -334,13 +330,8 @@ void ivas_arith_encode_cmplx_cell_array( { for ( j = 0; j < len; j++ ) { -#ifdef SBA_HOA_HBR_IMPROV input_old[idx] = pSymbol_old_re[total_len + j]; input_new[idx++] = pSymbol_re[total_len + j]; -#else - input_old[idx] = pSymbol_old_re[i * len + j]; - input_new[idx++] = pSymbol_re[i * len + j]; -#endif } cell_dim_diff[i].dim1 = pCell_dims[i].dim1; cell_dim_diff[i].dim2 = pCell_dims[i].dim2; @@ -351,20 +342,14 @@ void ivas_arith_encode_cmplx_cell_array( { for ( j = 0; j < len; j++ ) { -#ifdef SBA_HOA_HBR_IMPROV input[idx1++] = pSymbol_re[total_len + j]; -#else - input[idx1++] = pSymbol_re[i * len + j]; -#endif } cell_dim_diff[i].dim1 = 0; cell_dim_diff[i].dim2 = 0; cell_dim[i].dim1 = pCell_dims[i].dim1; cell_dim[i].dim2 = pCell_dims[i].dim2; } -#ifdef SBA_HOA_HBR_IMPROV total_len += len; -#endif } #ifdef SPAR_HOA_DBG /*if ( 0 )*/ /*(pCell_dims[0].dim1 == 12)*/ diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8d79594c7e34de35d1dd37a544f7c683fd4d7a4a..18280a60e2258262f799042a73963b71bbab9c2b 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -190,12 +190,10 @@ int16_t getNumChanAnalysis( { n = st_ivas->hEncoderConfig->nchan_inp; } -#ifdef FIX_155_HP20_ISSUE else if ( st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) { n = st_ivas->hEncoderConfig->nchan_inp; } -#endif return n; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 2122dcf87416d4ee3737895a0a0038d67a871bcf..3c8a1f04b38e7b69cc37cdd3928c3d0177da7d65 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -262,11 +262,7 @@ ivas_error ivas_ism_enc( * Encoder *----------------------------------------------------------------*/ -#ifdef CORECODER_BITRATE_SWITCHING if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8[sce_id], old_inp_16k[sce_id], Etot[sce_id], ener[sce_id], A[sce_id], Aw[sce_id], epsP[sce_id], lsp_new[sce_id], lsp_mid[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer[sce_id], imagBuffer[sce_id], old_wsp[sce_id], loc_harm[sce_id], cor_map_sum[sce_id], vad_flag_dtx[sce_id], enerBuffer[sce_id], fft_buff[sce_id], 0, ISM_FORMAT, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8[sce_id], old_inp_16k[sce_id], Etot[sce_id], ener[sce_id], A[sce_id], Aw[sce_id], epsP[sce_id], lsp_new[sce_id], lsp_mid[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer[sce_id], imagBuffer[sce_id], old_wsp[sce_id], loc_harm[sce_id], cor_map_sum[sce_id], vad_flag_dtx[sce_id], enerBuffer[sce_id], fft_buff[sce_id], 0, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 3358e41e21be9ec9248b80cd5a8d9e2e33a3c240..8dcdef30b50c3169fa74697896f5f0372dee114e 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -41,11 +41,6 @@ #include "ivas_rom_com.h" #include "wmops.h" -#ifndef FIX_155_HP20_ISSUE -#ifdef CORECODER_BITRATE_SWITCHING -static ivas_error ivas_hp20_reconfig( Encoder_Struct *st_ivas, const int16_t nchan_hp20_old ); -#endif -#endif /*------------------------------------------------------------------------- * Local function definitions *------------------------------------------------------------------------*/ @@ -419,14 +414,7 @@ ivas_error ivas_ism_enc_config( { ivas_error error; ISM_MODE last_ism_mode; -#ifdef ISM_BITRATE_SWITCHING -#ifdef CORECODER_BITRATE_SWITCHING int16_t nchan_transport_old; -#else - int16_t nSCE_old, nchan_transport_old; - int16_t sce_id, n; -#endif -#endif error = IVAS_ERR_OK; last_ism_mode = st_ivas->ism_mode; @@ -434,18 +422,11 @@ ivas_error ivas_ism_enc_config( /* select ISM format mode */ st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->hEncoderConfig->nchan_inp, st_ivas->hEncoderConfig->ivas_total_brate ); -#ifdef ISM_BITRATE_SWITCHING /* ISM bit-rate switching */ if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hEncoderConfig->ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) ) { int32_t element_brate_tmp[MAX_NUM_OBJECTS]; -#ifndef CORECODER_BITRATE_SWITCHING - Indice *ind_list_sce, *ind_list_metadata; -#endif -#ifndef CORECODER_BITRATE_SWITCHING - nSCE_old = st_ivas->nSCE; -#endif nchan_transport_old = st_ivas->nchan_transport; /* Reset and Initialize */ @@ -463,60 +444,7 @@ ivas_error ivas_ism_enc_config( ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); -#ifdef CORECODER_BITRATE_SWITCHING ivas_corecoder_enc_reconfig( st_ivas, nchan_transport_old, 0, nchan_transport_old ); -#else - if ( st_ivas->nSCE > nSCE_old ) - { - /* Reconfigure the core coders */ - for ( sce_id = 0; sce_id < nSCE_old; sce_id++ ) - { - copy_encoder_config( st_ivas, st_ivas->hSCE[sce_id]->hCoreCoder[0], 0 ); - st_ivas->hSCE[sce_id]->element_brate = st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - - /* Initialize the extra required memory */ - ind_list_sce = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->ind_list; - ind_list_metadata = st_ivas->hSCE[0]->hMetaData->ind_list; - - for ( sce_id = nSCE_old; sce_id < st_ivas->nSCE; sce_id++ ) - { - /* Initialize the Core Coder */ - if ( ( error = create_sce_enc( st_ivas, sce_id, element_brate_tmp[sce_id] ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list_sce + ( sce_id * MAX_NUM_INDICES ); - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata + ( sce_id * MAX_BITS_METADATA ); - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); - } - } - else - { - /* Reconfigure the Core Coders */ - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - copy_encoder_config( st_ivas, st_ivas->hSCE[sce_id]->hCoreCoder[0], 0 ); - st_ivas->hSCE[sce_id]->element_brate = st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - - /* Delete the extra memory */ - for ( sce_id = st_ivas->nSCE; sce_id < nSCE_old; sce_id++ ) - { - if ( st_ivas->hSCE[sce_id] != NULL ) - { - destroy_sce_enc( st_ivas->hSCE[sce_id] ); - st_ivas->hSCE[sce_id] = NULL; - } - } - } -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) { @@ -533,147 +461,7 @@ ivas_error ivas_ism_enc_config( ivas_param_ism_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); st_ivas->hDirAC = NULL; } - -#ifndef FIX_155_HP20_ISSUE -#ifdef CORECODER_BITRATE_SWITCHING - ivas_hp20_reconfig( st_ivas, nchan_transport_old ); -#else - /* destroy the memory of hp20*/ - if ( st_ivas->mem_hp20_in != NULL ) - { - for ( sce_id = 0; sce_id < nSCE_old; sce_id++ ) - { - count_free( st_ivas->mem_hp20_in[sce_id] ); - st_ivas->mem_hp20_in[sce_id] = NULL; - } - count_free( st_ivas->mem_hp20_in ); - st_ivas->mem_hp20_in = NULL; - } - - /* re initialize the memory of hp20 */ - /* set number of input channels used for analysis/coding */ - n = getNumChanAnalysis( st_ivas ); - - if ( n > 0 ) - { - if ( ( st_ivas->mem_hp20_in = (float **) count_malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } - else - { - st_ivas->mem_hp20_in = NULL; - } - - for ( sce_id = 0; sce_id < n; sce_id++ ) - { - if ( ( st_ivas->mem_hp20_in[sce_id] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_in[sce_id], 0.0f, L_HP20_MEM ); - } -#endif -#endif } -#else - /* ISM format switching */ - if ( st_ivas->ism_mode != last_ism_mode ) - { - /*ivas_ism_dec_reconfigure( st_ivas );*/ - return IVAS_ERROR( IVAS_ERR_RECONFIGURE_NOT_SUPPORTED, "Error: ISM format switching not supported yet!!!\n\n" ); - } -#endif return error; } - -#ifndef FIX_155_HP20_ISSUE -#ifdef CORECODER_BITRATE_SWITCHING -// VE: this is the same function as at the decoder -> harmonize them to a new file ivas_corecoder_reconfig.c -/*-------------------------------------------------------------------* - * ivas_hp20_dec_reconfig() - * - * Allocate, initialize, and configure HP20 memory handles in case of bitrate switching - *-------------------------------------------------------------------*/ - -static ivas_error ivas_hp20_reconfig( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t nchan_hp20_old /* i : number of HP20 filters in previous frame */ -) -{ - int16_t i, nchan_hp20; - float **old_mem_hp20_out; - ivas_error error; - - error = IVAS_ERR_OK; - - /*-----------------------------------------------------------------* - * HP20 memories - *-----------------------------------------------------------------*/ - - nchan_hp20 = getNumChanAnalysis( st_ivas ); - - if ( nchan_hp20 > nchan_hp20_old ) - { - /* save old mem_hp_20 pointer */ - old_mem_hp20_out = st_ivas->mem_hp20_in; - st_ivas->mem_hp20_in = NULL; - - if ( ( st_ivas->mem_hp20_in = (float **) count_malloc( nchan_hp20 * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - for ( i = 0; i < nchan_hp20_old; i++ ) - { - st_ivas->mem_hp20_in[i] = old_mem_hp20_out[i]; - old_mem_hp20_out[i] = NULL; - } - /* create additional hp20 memories */ - for ( ; i < nchan_hp20; i++ ) - { - if ( ( st_ivas->mem_hp20_in[i] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_in[i], 0.0f, L_HP20_MEM ); - } - - count_free( old_mem_hp20_out ); - old_mem_hp20_out = NULL; - } - else if ( nchan_hp20 < nchan_hp20_old ) - { - /* save old mem_hp_20 pointer */ - old_mem_hp20_out = st_ivas->mem_hp20_in; - st_ivas->mem_hp20_in = NULL; - - if ( ( st_ivas->mem_hp20_in = (float **) count_malloc( nchan_hp20 * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - for ( i = 0; i < nchan_hp20; i++ ) - { - st_ivas->mem_hp20_in[i] = old_mem_hp20_out[i]; - old_mem_hp20_out[i] = NULL; - } - /* remove superfluous hp20 memories */ - for ( ; i < nchan_hp20_old; i++ ) - { - count_free( old_mem_hp20_out[i] ); - old_mem_hp20_out[i] = NULL; - } - - count_free( old_mem_hp20_out ); - old_mem_hp20_out = NULL; - } - - return error; -} -#endif -#endif diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 1329e572ae694805eefad324fa3159ec9dfbfd08..de816f3bf77f0308e8de426956d3821bda5c58d5 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -892,12 +892,8 @@ void ivas_mcmasa_param_est_enc( intensity_even_real ); computeReferencePower_enc( hMcMasa->band_grouping, FoaEven_RealBuffer, FoaEven_ImagBuffer, reference_power[ts], 0, - num_freq_bands -#ifdef SBA_HOA_HBR_IMPROV - , - SBA_MODE_NONE -#endif - ); + num_freq_bands, + SBA_MODE_NONE ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hMcMasa->index_buffer_intensity = ( hMcMasa->index_buffer_intensity % hMcMasa->no_col_avg_diff ) + 1; /* averaging_length = 32 */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index f682a380f75bf69512075841b4c85f2db915a897..30e7022698dfdb4a9ed14b0e8e99cb263b1643b2 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -178,7 +178,6 @@ static void AdjustChannelRatios( } chBitRatios[1] += ratio_diff; -#ifdef SBA_HOA_HBR_IMPROV /* make sure final ratios are within range*/ sum_ratio = 0.0f; for ( i = 0; i < nChannels; i++ ) @@ -190,7 +189,6 @@ static void AdjustChannelRatios( cur_ratio = chBitRatios[i] / sum_ratio; chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * cur_ratio + 0.5f ) ) ); } -#endif return; } diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index d4c7c70b2187eff07bbc58daccca0228300699fc..ed51037dcfdff417f08fc8a364930c29deb40fdc 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -105,10 +105,6 @@ ivas_error ivas_sba_enc_reconfigure( ) { int16_t nSCE_old, nCPE_old, nchan_transport_old; -#ifndef CORECODER_BITRATE_SWITCHING - int16_t n, sce_id, cpe_id; - Indice *ind_list_metadata; -#endif int32_t ivas_total_brate; ivas_error error; @@ -121,301 +117,17 @@ ivas_error ivas_sba_enc_reconfigure( nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; -#ifndef CORECODER_BITRATE_SWITCHING - ind_list_metadata = NULL; -#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); ivas_dirac_enc_reconfigure( st_ivas ); -#ifdef CORECODER_BITRATE_SWITCHING /*-----------------------------------------------------------------* * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old ); -#else - - if ( hEncoderConfig->nchan_transport == nchan_transport_old ) - { - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - copy_encoder_config( st_ivas, st_ivas->hSCE[sce_id]->hCoreCoder[0], 0 ); - st_ivas->hSCE[sce_id]->element_brate = ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - st_ivas->hCPE[cpe_id]->element_brate = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - copy_encoder_config( st_ivas, st_ivas->hCPE[cpe_id]->hCoreCoder[n], 0 ); - - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - } - - if ( st_ivas->nCPE > 1 ) - { - if ( ( error = mct_enc_reconfigure( st_ivas, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else - { - Indice *ind_list; - int16_t nb_bits_tot; - int16_t next_ind; - int16_t last_ind; - BSTR_ENC_HANDLE hBstr; - BSTR_ENC_HANDLE hMetaData; - - ind_list = NULL; - hBstr = NULL; - hMetaData = NULL; - - /* get the index list pointers */ - if ( nSCE_old ) - { - hBstr = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr; - hMetaData = st_ivas->hSCE[0]->hMetaData; - } - else if ( nCPE_old ) - { - hBstr = st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; - hMetaData = st_ivas->hCPE[nCPE_old - 1]->hMetaData; - } -#ifdef DEBUGGING - else - { - assert( 0 && "At least one SCE or one CPE should have existed before!\n" ); - } -#endif - - /* save bitstream information */ - ind_list = hBstr->ind_list; - nb_bits_tot = hBstr->nb_bits_tot; - next_ind = hBstr->next_ind; - last_ind = hBstr->last_ind; - ind_list_metadata = hMetaData->ind_list; - - /* destroy superfluous core coder elements */ - for ( sce_id = st_ivas->nSCE; sce_id < nSCE_old; sce_id++ ) - { - destroy_sce_enc( st_ivas->hSCE[sce_id] ); - st_ivas->hSCE[sce_id] = NULL; - } - - for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ ) - { - destroy_cpe_enc( st_ivas->hCPE[cpe_id] ); - st_ivas->hCPE[cpe_id] = NULL; - } - - if ( st_ivas->nCPE <= 1 && st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } - - /* special case, if we have MCT now and had a single CPE before, remove the MDCT Stereo handles */ - if ( st_ivas->nCPE > 1 && nCPE_old == 1 ) - { - count_free( st_ivas->hCPE[0]->hStereoMdct ); - st_ivas->hCPE[0]->hStereoMdct = NULL; - } - - /* create missing core coder elements and set element bitrates for alrady existing ones */ - if ( st_ivas->nSCE > 0 ) - { - int16_t nSCE_existing; - nSCE_existing = min( nSCE_old, st_ivas->nSCE ); - for ( sce_id = 0; sce_id < nSCE_existing; sce_id++ ) - { - copy_encoder_config( st_ivas, st_ivas->hSCE[sce_id]->hCoreCoder[0], 0 ); - st_ivas->hSCE[sce_id]->element_brate = ivas_total_brate / st_ivas->nchan_transport; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->total_brate = st_ivas->hSCE[sce_id]->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - for ( sce_id = nSCE_existing; sce_id < st_ivas->nSCE; sce_id++ ) - { - if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; - - /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ - if ( sce_id > 0 ) - { - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - } - else - { - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->last_ind = last_ind; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->nb_bits_tot = nb_bits_tot; - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->next_ind = next_ind; - } - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); - } - } - - if ( st_ivas->nCPE > 0 ) - { - int16_t nCPE_existing; - nCPE_existing = min( nCPE_old, st_ivas->nCPE ); - for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) - { - st_ivas->hCPE[cpe_id]->element_brate = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS; - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - copy_encoder_config( st_ivas, st_ivas->hCPE[cpe_id]->hCoreCoder[n], 0 ); - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->total_brate = st_ivas->hCPE[cpe_id]->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - } - } - - for ( cpe_id = nCPE_existing; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n ) * MAX_NUM_INDICES; - if ( cpe_id * CPE_CHANNELS + n > 0 ) - { - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - } - else - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->last_ind = last_ind; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_bits_tot = nb_bits_tot; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->next_ind = next_ind; - } - - if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - } - } - - if ( st_ivas->nCPE > 1 && nCPE_old <= 1 ) - { - if ( nCPE_old == 1 ) - { - /* set correct nominal bitrates and igf config already here, needed for the correct init of the MDCT Stereo handles for MCT */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->total_brate = st_ivas->hCPE[0]->element_brate; - - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); - st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode ); - - if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) - { - IGFEncSetMode( st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, - st_ivas->hCPE[0]->element_brate, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); - } - } - } - - if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 ) - { - if ( ( error = mct_enc_reconfigure( st_ivas, st_ivas->nCPE != nCPE_old ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* metadata handling for CPEs */ - if ( st_ivas->nCPE > 0 ) - { - if ( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData == NULL ) - { - if ( ( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData = (BSTR_ENC_HANDLE) count_malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MetaData structure\n" ) ); - } - } - - st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->ind_list = ind_list_metadata; - reset_indices_enc( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, MAX_BITS_METADATA ); - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE - 1; cpe_id++ ) - { - if ( st_ivas->hCPE[cpe_id]->hMetaData != NULL ) - { - count_free( st_ivas->hCPE[cpe_id]->hMetaData ); - st_ivas->hCPE[cpe_id]->hMetaData = NULL; - } - } - } - - /* special case, if we have a single CPE and had MCT before we need to init the MDCT stereo handles here */ - if ( st_ivas->nCPE == 1 && nCPE_old > 1 ) - { - if ( ( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct = (STEREO_MDCT_ENC_DATA_HANDLE) count_malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MDCT Stereo \n" ) ); - } - - /* set correct nominal bitrates and igf config already here, needed for the correct init of the MDCT Stereo handle */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->total_brate = st_ivas->hCPE[0]->element_brate; - - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[0]->element_brate / FRAMES_PER_SEC ); - st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode ); - - if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) - { - IGFEncSetMode( st_ivas->hCPE[0]->hCoreCoder[n]->hIGFEnc, - st_ivas->hCPE[0]->element_brate, - st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); - } - /* reset mct_chan_mode */ - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - } - - initMdctStereoEncData( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct, st_ivas->hEncoderConfig->ivas_format, st_ivas->hCPE[st_ivas->nCPE - 1]->element_mode, st_ivas->hCPE[st_ivas->nCPE - 1]->element_brate, st_ivas->hEncoderConfig->max_bwidth, 0, NULL, 1 ); - st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->isSBAStereoMode = ( ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); - } - } -#endif } return error; diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 2592b578f680c36a3af687a072f39b523e391633..0b49c56854976eb2b1b50d7da86fd68c14d4c25c 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -166,15 +166,11 @@ ivas_error ivas_sce_enc( st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; /* set flag for sampling rate of OL S/M classifier */ -#ifdef CORECODER_BITRATE_SWITCHING // VE2EF: TBV whether it can be done more efficiently flag_16k_smc = 0; if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT && ( st_ivas->hEncoderConfig->ivas_total_brate == IVAS_24k4 || st_ivas->hEncoderConfig->ivas_total_brate == IVAS_32k ) && hSCE->element_brate == hSCE->last_element_brate ) { flag_16k_smc = 1; } -#else - flag_16k_smc = ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT && ( st_ivas->hEncoderConfig->ivas_total_brate == IVAS_24k4 || st_ivas->hEncoderConfig->ivas_total_brate == IVAS_32k ) ); -#endif #ifdef DEBUG_MODE_INFO dbgwrite( st->input - NS2SA( st->input_Fs, ACELP_LOOK_NS ), sizeof( float ), input_frame, 1, "res/input_DMX" ); @@ -241,11 +237,7 @@ ivas_error ivas_sce_enc( * Encoder *----------------------------------------------------------------*/ -#ifdef CORECODER_BITRATE_SWITCHING if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8, old_inp_16k, Etot, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, realBuffer, imagBuffer, old_wsp, loc_harm, cor_map_sum, vad_flag_dtx, enerBuffer, fft_buff, 0, ivas_format, flag_16k_smc ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8, old_inp_16k, Etot, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, realBuffer, imagBuffer, old_wsp, loc_harm, cor_map_sum, vad_flag_dtx, enerBuffer, fft_buff, 0, flag_16k_smc ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -257,9 +249,7 @@ ivas_error ivas_sce_enc( /* update input samples buffer */ mvr2r( st->input, st->old_input_signal, input_frame ); -#ifdef CORECODER_BITRATE_SWITCHING hSCE->last_element_brate = hSCE->element_brate; -#endif #ifdef DEBUG_MODE_INFO { @@ -307,9 +297,7 @@ ivas_error create_sce_enc( hSCE->sce_id = sce_id; hSCE->element_brate = element_brate; -#ifdef CORECODER_BITRATE_SWITCHING hSCE->last_element_brate = hSCE->element_brate; -#endif /*-----------------------------------------------------------------* * Metadata: allocate and initialize diff --git a/lib_enc/ivas_sns_enc.c b/lib_enc/ivas_sns_enc.c index 6790f0cf6d0993f2fd518729f5e716a0119b0ab0..45c04ac9ea083618f1195a4621213403fd4c48dc 100644 --- a/lib_enc/ivas_sns_enc.c +++ b/lib_enc/ivas_sns_enc.c @@ -44,7 +44,6 @@ #include "wmops.h" - /*------------------------------------------------------------------- * sns_1st_cod() * diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index b5f00848a8bcfcaee0ba95b7d4bd7c97d3bcb593..7e2d49310fb16dd3ba68fd0463db4ee2d7d5e9e5 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -319,69 +319,6 @@ ivas_error ivas_spar_enc( return error; } -#ifndef SBA_SPAR_HARM -/*-----------------------------------------------------------------------------------------* - * Function ivas_spar_enc_get_windowed_fr() - * - * Get windowed FRs - *-----------------------------------------------------------------------------------------*/ - -static void ivas_spar_enc_get_windowed_fr( - IVAS_FB_MIXER_HANDLE hFbMixer, - float *pIn_blocks[IVAS_SPAR_MAX_CH], - ivas_enc_cov_handler_in_buf_t *pCov_in_buf, - const int16_t input_frame, - const int16_t nchan_inp, - const int16_t num_past_samples ) -{ - int16_t i, j, rev_offset; - - for ( i = 0; i < nchan_inp; i++ ) - { - const int16_t stride = hFbMixer->pFb->fb_bin_to_band.short_stride; - float tmp_buf[MDFT_FB_BANDS_240 * 2]; - int16_t win_len = (int16_t) hFbMixer->ana_window_offset; - float *mdft_in_ptr = tmp_buf + stride - win_len; - float tmp_in_block[L_FRAME48k + MDFT_FB_BANDS_240]; - float *data_ptr = tmp_in_block; - float *fr_re_ptr = pCov_in_buf->ppIn_FR_real[i]; - float *fr_im_ptr = pCov_in_buf->ppIn_FR_imag[i]; - - set_f( tmp_buf, 0, MDFT_FB_BANDS_240 * 2 ); - - /* copy input data, because pIn_blocks and fr_re_ptr + fr_im_ptr use the same memory */ - mvr2r( &pIn_blocks[i][input_frame - num_past_samples], tmp_in_block, input_frame + win_len ); - - for ( int16_t blk = 0; blk < input_frame / stride; blk++ ) - { - - for ( j = 0; j < win_len; j++ ) - { - mdft_in_ptr[j] = data_ptr[j] * hFbMixer->pAna_window[j]; - } - - for ( j = win_len; j < stride; j++ ) - { - mdft_in_ptr[j] = data_ptr[j]; - } - - rev_offset = win_len - 1; - for ( j = stride; j < stride + win_len; j++ ) - { - mdft_in_ptr[j] = data_ptr[j] * hFbMixer->pAna_window[rev_offset--]; - } - - ivas_mdft( tmp_buf, fr_re_ptr, fr_im_ptr, stride << 1, stride ); - - data_ptr += stride; - fr_re_ptr += stride; - fr_im_ptr += stride; - } - } - - return; -} -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_spar_enc_process() @@ -399,24 +336,11 @@ static ivas_error ivas_spar_enc_process( { float pcm_tmp[IVAS_SPAR_MAX_CH][L_FRAME48k * 2]; float *p_pcm_tmp[IVAS_SPAR_MAX_CH]; -#ifdef SBA_SPAR_HARM int16_t i, j, b, i_ts, input_frame, transient_det, dtx_vad; -#else - int16_t i, j, k, b, i_ts, input_frame, num_bands_bw; - int16_t dtx_vad, dtx_cov_flag, dtx_silence_mode; -#endif int32_t ivas_total_brate, input_Fs; -#ifndef SBA_SPAR_HARM - ivas_enc_cov_handler_in_buf_t cov_in_buf; -#endif float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; -#ifdef SBA_SPAR_HARM int16_t nchan_inp, nchan_transport, sba_order; -#else - ivas_spar_md_enc_in_buf_t md_in_buf; - int16_t nchan_inp, nchan_transport, bwidth, sba_order; -#endif int16_t table_idx; int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; ivas_error error; @@ -451,19 +375,12 @@ static ivas_error ivas_spar_enc_process( mvr2r( data_f[HOA_keep_ind[i]], data_f[i], input_frame ); } -#ifndef SBA_SPAR_HARM - table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); -#endif /*-----------------------------------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------------------------------*/ -#ifdef SBA_SPAR_HARM transient_det = ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame ); -#else - cov_in_buf.transient_det = ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame ); -#endif /* store previous input samples for W in local buffer */ assert( num_del_samples <= IVAS_FB_1MS_48K_SAMP ); @@ -482,27 +399,12 @@ static ivas_error ivas_spar_enc_process( ivas_fb_mixer_pcm_ingest( hSpar->hFbMixer, data_f, p_pcm_tmp, input_frame ); /* prepare Parameter MDFT analysis */ -#ifdef SBA_SPAR_HARM for ( i = 0; i < nchan_inp; i++ ) { ppIn_FR_real[i] = p_pcm_tmp[i]; ppIn_FR_imag[i] = p_pcm_tmp[i] + input_frame; p_pcm_tmp[i] = &data_f[i][0]; } -#else - for ( i = 0; i < nchan_inp; i++ ) - { - cov_in_buf.ppIn_FR_real[i] = p_pcm_tmp[i]; - cov_in_buf.ppIn_FR_imag[i] = p_pcm_tmp[i] + input_frame; - } - - for ( i = 0; i < nchan_inp; i++ ) - { - p_pcm_tmp[i] = &data_f[i][0]; - ppIn_FR_real[i] = cov_in_buf.ppIn_FR_real[i]; - ppIn_FR_imag[i] = cov_in_buf.ppIn_FR_imag[i]; - } -#endif l_ts = input_frame / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -522,16 +424,11 @@ static ivas_error ivas_spar_enc_process( /* turn pointers back to the local buffer, needed for the following processing */ for ( i = 0; i < nchan_inp; i++ ) { -#ifdef SBA_SPAR_HARM ppIn_FR_real[i] = pcm_tmp[i]; ppIn_FR_imag[i] = pcm_tmp[i] + input_frame; -#endif p_pcm_tmp[i] = pcm_tmp[i]; } -#ifndef SBA_SPAR_HARM - cov_in_buf.num_ch = nchan_inp; -#endif dtx_vad = ( hEncoderConfig->Opt_DTX_ON == 1 ) ? front_vad_flag : 1; @@ -539,23 +436,9 @@ static ivas_error ivas_spar_enc_process( * DirAC encoding *-----------------------------------------------------------------------------------------*/ -#ifdef SBA_SPAR_HARM - ivas_dirac_param_est_enc( st_ivas->hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, - data_f, ppIn_FR_real, ppIn_FR_imag, input_frame -#ifdef SBA_HOA_HBR_IMPROV - , - st_ivas->sba_mode -#endif - ); -#else ivas_dirac_param_est_enc( st_ivas->hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, - data_f, cov_in_buf.ppIn_FR_real, cov_in_buf.ppIn_FR_imag, input_frame -#ifdef SBA_HOA_HBR_IMPROV - , - st_ivas->sba_mode -#endif - ); -#endif + data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, + st_ivas->sba_mode ); if ( hQMetaData->q_direction->cfg.nbands > 0 ) @@ -641,26 +524,11 @@ static ivas_error ivas_spar_enc_process( } } -#ifndef SBA_SPAR_HARM - /*-----------------------------------------------------------------------------------------* - * Pre-proc flags - *-----------------------------------------------------------------------------------------*/ - - /* use just VAD function to get VAD flags */ - dtx_vad = ( hEncoderConfig->Opt_DTX_ON == 1 ) ? front_vad_flag : 1; - dtx_cov_flag = ( dtx_vad == 1 ) ? 0 : 1; - dtx_silence_mode = 0; // VE2DB: this variable is always 0 - please review or remove it - bwidth = ivas_get_bw_idx_from_sample_rate( input_Fs ); - bwidth = min( bwidth, hEncoderConfig->max_bwidth ); -#endif /*-----------------------------------------------------------------------------------------* * Covariance process *-----------------------------------------------------------------------------------------*/ -#ifndef SBA_SPAR_HARM - cov_in_buf.num_ch = nchan_inp; -#endif for ( i = 0; i < nchan_inp; i++ ) { for ( j = 0; j < nchan_inp; j++ ) @@ -670,104 +538,32 @@ static ivas_error ivas_spar_enc_process( } } -#ifdef SBA_SPAR_HARM ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det ); -#else - cov_in_buf.dtx_cov_flag = dtx_cov_flag; - - ivas_enc_cov_handler_process( hSpar->hCovEnc, &cov_in_buf, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands ); -#endif /*-----------------------------------------------------------------------------------------* * Set SPAR bitrates *-----------------------------------------------------------------------------------------*/ -#ifdef SBA_SPAR_HARM table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); -#endif if ( hSpar->hMdEnc->table_idx != table_idx ) { hSpar->hMdEnc->table_idx = table_idx; ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, -#ifdef SBA_HOA_HBR_IMPROV - ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND -#else - SPAR_DIRAC_SPLIT_START_BAND -#endif - ); + ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND ); } -#ifdef SBA_SPAR_HARM nchan_transport = st_ivas->nchan_transport; -#else - nchan_transport = hSpar->hMdEnc->spar_md_cfg.nchan_transport; -#endif /*-----------------------------------------------------------------------------------------* * MetaData encoder *-----------------------------------------------------------------------------------------*/ -#ifdef SBA_SPAR_HARM -#ifdef SBA_HOA_HBR_IMPROV if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) -#endif { ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); } -#else - num_bands_bw = ivas_get_num_bands_from_bw_idx( bwidth ); - - if ( dtx_vad == 0 ) - { - for ( i = 0; i < nchan_inp; i++ ) - { - for ( j = 0; j < nchan_inp; j++ ) - { - md_in_buf.cov_real[i][j] = cov_dtx_real[i][j]; - for ( k = num_bands_bw; k < IVAS_MAX_NUM_BANDS; k++ ) - { - md_in_buf.cov_real[i][j][k] = 0; - } - } - } - } - else - { - for ( i = 0; i < nchan_inp; i++ ) - { - for ( j = 0; j < nchan_inp; j++ ) - { - md_in_buf.cov_real[i][j] = cov_real[i][j]; - for ( k = num_bands_bw; k < IVAS_MAX_NUM_BANDS; k++ ) - { - md_in_buf.cov_real[i][j][k] = 0; - } - } - } - } - md_in_buf.num_bands = ivas_get_num_bands_from_bw_idx( SPAR_CONFIG_BW ); -#ifdef SBA_HOA_HBR_IMPROV - if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) -#endif - { - md_in_buf.num_bands = min( md_in_buf.num_bands, SPAR_DIRAC_SPLIT_START_BAND ); - } - - md_in_buf.dtx_vad = dtx_vad; - -#ifdef SBA_HOA_HBR_IMPROV - if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) -#endif - { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, &md_in_buf, hMetaData, dtx_silence_mode, sba_order ); - } -#endif - -#ifndef SBA_SPAR_HARM - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) // VE2DB: this looks obsolete -#endif { float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -800,11 +596,7 @@ static ivas_error ivas_spar_enc_process( Wscale_d[b] = 1.0f; for ( i = 1; i < nchan_inp; i++ ) { -#ifdef SBA_SPAR_HARM Wscale_d[b] += cov_real[i][i][b] / max( EPSILON, cov_real[0][0][b] ); -#else - Wscale_d[b] += md_in_buf.cov_real[i][i][b] / max( EPSILON, md_in_buf.cov_real[0][0][b] ); -#endif } Wscale_d[b] = Wscale_d[b] / ( 1.0f + (float) sba_order ); /*DirAC normalized signal variance sums to 1 + order*/ Wscale_d[b] = sqrtf( Wscale_d[b] ); @@ -813,20 +605,14 @@ static ivas_error ivas_spar_enc_process( ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, -#ifdef SBA_HOA_HBR_IMPROV ( hSpar->hMdEnc->spar_hoa_md_flag ) ? 1 : sba_order, -#else - sba_order, -#endif dtx_vad, Wscale_d ); } -#ifdef SBA_HOA_HBR_IMPROV if ( hSpar->hMdEnc->spar_hoa_md_flag ) { ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); } -#endif /*-----------------------------------------------------------------------------------------* * FB mixer diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 263d32292af2cf43eb273e542b1ffae753d5747c..4bd23dee47a9b403a450c82acbaf2f9dcb65c06c 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -121,9 +121,7 @@ ivas_error ivas_spar_md_enc_open( num_channels = 2 * sba_order + 2; -#ifdef SBA_HOA_HBR_IMPROV hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); -#endif if ( ( hMdEnc->spar_md.band_coeffs = (ivas_band_coeffs_t *) count_malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { @@ -325,12 +323,7 @@ static ivas_error ivas_spar_md_enc_init( hMdEnc->spar_md_cfg.gen_bs = 1; ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, -#ifdef SBA_HOA_HBR_IMPROV - ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND -#else - SPAR_DIRAC_SPLIT_START_BAND -#endif - ); + ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND ); /* get FB coefficients */ for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) @@ -562,35 +555,20 @@ static void write_metadata_buffer( ivas_error ivas_spar_md_enc_process( ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ -#ifdef SBA_SPAR_HARM float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -#else - ivas_spar_md_enc_in_buf_t *pIn_buf, -#endif BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ -#ifdef SBA_SPAR_HARM int16_t dtx_vad, const int16_t nchan_inp, -#else - const int16_t dtx_silence_mode, -#endif const int16_t sba_order /* i : Ambisonic (SBA) order */ ) { float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; -#ifdef SBA_HOA_HBR_IMPROV float pred_coeffs_re_local[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; -#endif int16_t i, b, qsi, ndm, ndec, num_ch, num_quant_strats; int16_t j, planarCP; -#ifdef SBA_SPAR_HARM int16_t k, bwidth, num_bands, num_bands_full, num_bands_bw; -#else - int16_t num_bands = pIn_buf->num_bands; - int16_t dtx_vad = pIn_buf->dtx_vad; -#endif int16_t active_w, nchan_transport, dmx_switch, strat; int16_t nB, bands_bw, packed_ok = 0; ivas_strats_t cs[MAX_CODING_STRATS]; @@ -605,14 +583,11 @@ ivas_error ivas_spar_md_enc_process( active_w = hMdEnc->spar_md_cfg.active_w; nchan_transport = hMdEnc->spar_md_cfg.nchan_transport; -#ifdef SBA_SPAR_HARM bwidth = ivas_get_bw_idx_from_sample_rate( hEncoderConfig->input_Fs ); bwidth = min( bwidth, hEncoderConfig->max_bwidth ); num_bands = ivas_get_num_bands_from_bw_idx( SPAR_CONFIG_BW ); -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag == 0 ) -#endif { num_bands = min( num_bands, SPAR_DIRAC_SPLIT_START_BAND ); } @@ -647,7 +622,6 @@ ivas_error ivas_spar_md_enc_process( } } } -#endif if ( hEncoderConfig->ivas_total_brate == BRATE_SPAR_Q_STRAT && sba_order == 1 ) { @@ -662,12 +636,6 @@ ivas_error ivas_spar_md_enc_process( next_ind_start = hMetaData->next_ind; last_ind_start = hMetaData->last_ind; -#ifndef SBA_SPAR_HARM - if ( hEncoderConfig->Opt_DTX_ON == 0 ) - { - dtx_vad = 1; - } -#endif dmx_switch = 0; @@ -676,11 +644,7 @@ ivas_error ivas_spar_md_enc_process( nB = SPAR_DTX_BANDS; bands_bw = num_bands / nB; -#ifdef SBA_SPAR_HARM ivas_band_mixer( cov_real, num_ch, &num_bands, bands_bw ); -#else - ivas_band_mixer( pIn_buf->cov_real, num_ch, &num_bands, bands_bw ); -#endif } else { @@ -688,7 +652,6 @@ ivas_error ivas_spar_md_enc_process( bands_bw = 1; } -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag ) { for ( b = SPAR_DIRAC_SPLIT_START_BAND; b < num_bands; b++ ) @@ -700,15 +663,9 @@ ivas_error ivas_spar_md_enc_process( } } } -#endif -#ifdef SBA_SPAR_HARM ivas_compute_spar_params( cov_real, dm_fv_re, 0, hMdEnc->mixer_mat, 0, nB, dtx_vad, num_ch, bands_bw, active_w, &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0 ); -#else - ivas_compute_spar_params( pIn_buf->cov_real, dm_fv_re, 0, hMdEnc->mixer_mat, 0, nB, dtx_vad, num_ch, - bands_bw, active_w, &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0 ); -#endif for ( i = 0; i < num_ch; i++ ) { @@ -755,11 +712,7 @@ ivas_error ivas_spar_md_enc_process( if ( ndm != num_ch ) { -#ifdef SBA_SPAR_HARM ivas_calc_c_p_coeffs( &hMdEnc->spar_md, cov_real, 0, hMdEnc->mixer_mat_local, num_ch, ndm, b, dtx_vad, 1, planarCP ); -#else - ivas_calc_c_p_coeffs( &hMdEnc->spar_md, pIn_buf->cov_real, 0, hMdEnc->mixer_mat_local, num_ch, ndm, b, dtx_vad, 1, planarCP ); -#endif } } } @@ -838,7 +791,6 @@ ivas_error ivas_spar_md_enc_process( } } -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag ) { for ( b = SPAR_DIRAC_SPLIT_START_BAND; b < num_bands; b++ ) @@ -852,7 +804,6 @@ ivas_error ivas_spar_md_enc_process( } } } -#endif ivas_create_fullr_dmx_mat( pred_coeffs_re, dm_fv_re, hMdEnc->mixer_mat, num_ch, 0, num_bands, active_w, &hMdEnc->spar_md_cfg ); @@ -868,11 +819,7 @@ ivas_error ivas_spar_md_enc_process( if ( ( ndm != num_ch ) && ( ndm != 1 ) ) { -#ifdef SBA_SPAR_HARM ivas_calc_c_p_coeffs( &hMdEnc->spar_md, cov_real, 0, hMdEnc->mixer_mat, num_ch, ndm, b, dtx_vad, 0, planarCP ); -#else - ivas_calc_c_p_coeffs( &hMdEnc->spar_md, pIn_buf->cov_real, 0, hMdEnc->mixer_mat, num_ch, ndm, b, dtx_vad, 0, planarCP ); -#endif #ifdef SPAR_HOA_DBG /*fprintf(stderr, "\n\n C coefficients: band %d\n", b); @@ -933,11 +880,7 @@ ivas_error ivas_spar_md_enc_process( /* band mixing */ if ( bands_bw > 1 ) { -#ifdef SBA_SPAR_HARM ivas_band_mixing( hMdEnc, num_ch, num_bands, nchan_transport, num_bands_full ); -#else - ivas_band_mixing( hMdEnc, num_ch, num_bands, nchan_transport, pIn_buf->num_bands ); -#endif } if ( hMdEnc->spar_md_cfg.gen_bs == 0 ) @@ -1355,7 +1298,6 @@ static void ivas_get_huffman_coded_bs( pred_coeff_dim = ndm + ndec - 1; pred_offset = 0; -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) @@ -1363,7 +1305,6 @@ static void ivas_get_huffman_coded_bs( pred_offset = FOA_CHANNELS - 1; } } -#endif if ( planarCP ) { @@ -1446,7 +1387,6 @@ static void ivas_get_arith_coded_bs( ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; ndec = hMdEnc->spar_md_cfg.num_decorr_per_band[bands_bw * i]; pred_cell_dims[i].dim1 = ndm + ndec - 1; -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) @@ -1454,7 +1394,6 @@ static void ivas_get_arith_coded_bs( pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); } } -#endif pred_cell_dims[i].dim2 = 1; drct_cell_dims[i].dim1 = ndec; drct_cell_dims[i].dim2 = ndm - 1; @@ -1473,7 +1412,6 @@ static void ivas_get_arith_coded_bs( break; } } -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag ) { int16_t j; @@ -1494,7 +1432,6 @@ static void ivas_get_arith_coded_bs( } } } -#endif ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); if ( any_diff == 1 ) @@ -1506,7 +1443,6 @@ static void ivas_get_arith_coded_bs( ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, pred_cell_dims, hMetaData, any_diff ); -#ifdef SBA_HOA_HBR_IMPROV if ( hMdEnc->spar_hoa_md_flag ) { int16_t j; @@ -1526,7 +1462,6 @@ static void ivas_get_arith_coded_bs( } } } -#endif #ifdef SPAR_HOA_DBG /*fprintf(stderr, "\n\n band_indexes:\n"); diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 531e69d85a55ddcca2d14de9765ea56752267a1f..1a8f595bd0f2dd6f5edacf770590f2746d82dcfe 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -631,17 +631,6 @@ typedef struct ivas_enc_cov_handler_state_t } ivas_enc_cov_handler_state_t; -#ifndef SBA_SPAR_HARM -typedef struct ivas_enc_cov_handler_in_buf_t -{ - float *ppIn_FR_real[IVAS_SPAR_MAX_CH]; - float *ppIn_FR_imag[IVAS_SPAR_MAX_CH]; - int16_t num_ch; - int16_t transient_det; - int16_t dtx_cov_flag; - -} ivas_enc_cov_handler_in_buf_t; -#endif /* SPAR MD structures */ typedef struct ivas_spar_md_enc_state_t @@ -659,20 +648,9 @@ typedef struct ivas_spar_md_enc_state_t ivas_arith_coeffs_t arith_coeffs; ivas_huff_coeffs_t huff_coeffs; int16_t table_idx; -#ifdef SBA_HOA_HBR_IMPROV int16_t spar_hoa_md_flag; -#endif } ivas_spar_md_enc_state_t; -#ifndef SBA_SPAR_HARM -typedef struct ivas_spar_md_enc_in_buf_t -{ - float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - int16_t num_bands; - int16_t dtx_vad; - -} ivas_spar_md_enc_in_buf_t; -#endif /* PCA structure */ typedef struct { @@ -850,11 +828,9 @@ typedef struct stereo_cng_enc typedef struct sce_enc_data_structure { - int16_t sce_id; /* SCE # identifier */ - int32_t element_brate; /* SCE element total bitrate in bps */ -#ifdef CORECODER_BITRATE_SWITCHING + int16_t sce_id; /* SCE # identifier */ + int32_t element_brate; /* SCE element total bitrate in bps */ int32_t last_element_brate; /* last SCE element bitrate in bps */ -#endif BSTR_ENC_HANDLE hMetaData; /* Metadata bitstream handle */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index d6aa8a54f1837943315a2b1c351bf8c89610c4ec..4be84480fec73cfc8188ae9301c775fbde6484b2 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -78,9 +78,7 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); -#ifdef ISM_BITRATE_SWITCHING static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ); -#endif static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); @@ -772,29 +770,10 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { -#ifdef ISM_BITRATE_SWITCHING if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); - } - if ( hEncoderConfig->ivas_total_brate < IVAS_16k4 && hEncoderConfig->nchan_inp == 2 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 2 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); - } - if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 3 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 3 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); - } - if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 4 ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); - } -#endif } else if ( hEncoderConfig->ivas_format == SBA_FORMAT ) { @@ -1669,9 +1648,7 @@ static ivas_error setBitrate( { Encoder_Struct *st_ivas; ENCODER_CONFIG_HANDLE hEncoderConfig; -#ifdef ISM_BITRATE_SWITCHING ivas_error error; -#endif st_ivas = hIvasEnc->st_ivas; hEncoderConfig = st_ivas->hEncoderConfig; @@ -1718,7 +1695,6 @@ static ivas_error setBitrate( } } -#ifdef ISM_BITRATE_SWITCHING if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) @@ -1726,7 +1702,6 @@ static ivas_error setBitrate( return error; } } -#endif st_ivas->codec_mode = MODE1; @@ -1954,7 +1929,6 @@ static ivas_error sanitizeBandwidth( } -#ifdef ISM_BITRATE_SWITCHING /*---------------------------------------------------------------------* * sanitizeBitrateISM() * @@ -1986,7 +1960,6 @@ static ivas_error sanitizeBitrateISM( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------*