diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index e2492dd53598c690bf9ab7b948434f320fc4f8bd..9bc253776da52a8e80ea43224cf48643136b72d4 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -109,9 +109,9 @@ ivas_error mct_enc_reconfigure( ivas_error ivas_spar_md_enc_init ( - ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ); ivas_error ivas_sba_enc_reconfigure( @@ -785,8 +785,8 @@ ivas_error ivas_jbm_dec_flush_renderer( ivas_error ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ - int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ + const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ + int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ float *data /* i/o: transport channels/output synthesis signal */ ); @@ -1051,8 +1051,8 @@ void ivas_ism_dec_digest_tc( void ivas_param_ism_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); void ivas_param_ism_dec_render( @@ -3491,7 +3491,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ ); void ivas_sba2mc_cldfb( @@ -3527,12 +3527,12 @@ void ivas_dirac_enc( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ float data_f[][L_FRAME48k], /* i/o: SBA channels */ - float **ppIn_FR_real, /* o : real freq domain values */ - float **ppIn_FR_imag, /* o : imag freq domain values */ - const int16_t input_frame, /* i : input frame length */ - const int16_t dtx_vad, /* i : DTX vad flag */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - int16_t hodirac_flag /* i : hodirac flag */ + float **ppIn_FR_real, /* o : real freq domain values */ + float **ppIn_FR_imag, /* o : imag freq domain values */ + const int16_t input_frame, /* i : input frame length */ + const int16_t dtx_vad, /* i : DTX vad flag */ + const IVAS_FORMAT ivas_format, /* i : ivas format */ + int16_t hodirac_flag /* i : hodirac flag */ ); ivas_error ivas_dirac_config( void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ @@ -3758,8 +3758,8 @@ void ivas_dirac_dec_output_synthesis_process_slot( ); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nbslots, /* i : number of slots to process */ @@ -3769,11 +3769,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( ); void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nbslots, /* i : number of slots to process */ - float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ + const int16_t nbslots, /* i : number of slots to process */ + float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ float *reference_power_smooth, float qualityBasedSmFactor ); @@ -3829,52 +3829,52 @@ void ivas_dirac_dec_get_frequency_axis( void calculate_hodirac_sector_parameters( DIRAC_ENC_HANDLE hDirAC, - float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ - float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ - const float beta, /* i : forgetting factor for average filtering */ - const int16_t *band_grouping, /* i : indices of band groups */ - const int16_t N_bands, /* i : number of bands (groups) */ - const int16_t enc_param_start_band, /* i : first band to process */ - float *azi, /* o : array of sector azimuth angles, flat */ - float *ele, /* o : array of sector elevation angles, flat */ - float *diff, /* o : array of sector diffuseness values, flat */ - float *ene /* o : array of sector energy values, flat */ + float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ + float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ + const float beta, /* i : forgetting factor for average filtering */ + const int16_t *band_grouping, /* i : indices of band groups */ + const int16_t N_bands, /* i : number of bands (groups) */ + const int16_t enc_param_start_band, /* i : first band to process */ + float *azi, /* o : array of sector azimuth angles, flat */ + float *ele, /* o : array of sector elevation angles, flat */ + float *diff, /* o : array of sector diffuseness values, flat */ + float *ene /* o : array of sector energy values, flat */ ); void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ + const int16_t input_frame /* i : input frame length */ ); ivas_error ivas_mc_paramupmix_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); void ivas_mc_paramupmix_enc_close( - MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ const int32_t input_Fs /* i : input sampling rate */ ); void ivas_mc_paramupmix_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); ivas_error ivas_mc_paramupmix_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_mc_paramupmix_dec_close( - MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ ); void ivas_mc_paramupmix_dec_read_BS( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Decoder_State *st, /* i/o: decoder state structure */ - MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ - int16_t *nb_bits /* o : number of bits written */ + Decoder_State *st, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ ); void ivas_param_mc_metadata_open( @@ -3921,7 +3921,7 @@ void ivas_param_mc_enc_close( void ivas_param_mc_enc( Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ const int16_t input_frame /* i : input frame length */ ); @@ -3946,8 +3946,8 @@ void ivas_param_mc_dec_read_BS( void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output*/ ); void ivas_param_mc_dec_render( @@ -4522,9 +4522,11 @@ void ivas_get_spar_md_from_dirac( const int16_t active_w_vlbr ); +/*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int32_t ivas_total_brate ); + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +); ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ @@ -4567,7 +4569,7 @@ void ivas_spar_to_dirac( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t bw /* i : band joining factor */ + const int16_t bw /* i : band joining factor */ ); void ivas_spar_update_md_hist( @@ -4577,13 +4579,13 @@ void ivas_spar_update_md_hist( void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_setup_md_smoothing( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t num_md_sub_frames /* i : number of metadata subframes */ + const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); void ivas_spar_dec_gen_umx_mat( @@ -4600,7 +4602,7 @@ ivas_error ivas_spar_covar_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp, /* i : number of input channels */ - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -4661,7 +4663,7 @@ void ivas_transient_det_close( void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len, /* i : frame length in samples */ + const int16_t frame_len, /* i : frame length in samples */ int16_t transient_det[2] /* o : transient det outputs */ ); @@ -5010,7 +5012,7 @@ ivas_error ivas_masa_enc_open( ); void ivas_masa_enc_close( - MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); void ivas_masa_enc_reconfigure( @@ -5447,27 +5449,29 @@ void ivas_lfe_synth_with_filters( const int16_t lfeChannelIndex /* i : LFE channel index */ ); + #ifdef FIX_572_LFE_LPF_ENC /*----------------------------------------------------------------------------------* * LFE encoder low pass filter prototypes *----------------------------------------------------------------------------------*/ ivas_error ivas_create_lfe_lpf_enc( - ivas_filters_process_state_t **ph_lfe_lpf_filter_state, /* o : IVAS LFE encoder structure */ - const int32_t input_Fs /* i : input sampling rate */ + ivas_filters_process_state_t **hLfeLpf, /* o : LFE LPF handle */ + const int32_t input_Fs /* i : input sampling rate */ ); void ivas_lfe_lpf_enc_close( - ivas_filters_process_state_t **ph_lfe_lpf_filter_state /* i/o: LFE encoder handle */ + ivas_filters_process_state_t **hLfeLpf /* i/o: LFE LPF handle */ ); void ivas_lfe_lpf_enc_apply( - ivas_filters_process_state_t *h_lfe_lpf_filter_state, /* i/o: LFE encoder handle */ - float data_lfe_ch[], /* i : input LFE signal */ - const int16_t input_frame /* i : input frame length per channel */ + ivas_filters_process_state_t *hLfeLpf, /* i/o: LFE LPF handle */ + float data_lfe_ch[], /* i/o: LFE signal */ + const int16_t input_frame /* i : input frame length per channel */ ); #endif + /*----------------------------------------------------------------------------------* * LFE Coding prototypes *----------------------------------------------------------------------------------*/ diff --git a/lib_com/options.h b/lib_com/options.h index d4d5d09613da07fe7f8a44ca1b51fb4b40f713ba..44ebea512895c0fb67488b0d0a2ad787561cb770 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,7 +99,7 @@ /*MCT Debug switches*/ /*#define DEBUG_FORCE_MCT_CP*/ /* force MCT Stereo pairs for verification with SPAR */ #ifdef DEBUG_FORCE_MCT_CP -/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel seperately */ +/*#define DEBUG_SINGLE_CODE_OMNI*/ /* force 3 TC SBA always code W channel separately */ #endif /*PLC Debug switches*/ @@ -125,7 +125,7 @@ #endif /*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ -//#define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ +/*#define DEBUG_AGC_ENCODER_CMD_OPTION*/ /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ #define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ @@ -158,6 +158,7 @@ #define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 35bdc6041f1b24226662332e9a277b7464a24da5..bc10986256c13b76a1acd56240dacd8423bdaa59 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1592,8 +1592,7 @@ void decoder_tcx_imdct( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } - if ( - st->igf ) + if ( st->igf ) { proc = st->hIGFDec->flatteningTrigger; diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 6ca33fcf5e83538e7fddeb7cf607a253b9f3b3d6..9096843e9c6c6b3fccdba1c51df0ff9ee7a368ad 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -828,7 +828,6 @@ void destroy_cpe_dec( int16_t n; Decoder_State *st; - for ( n = 0; n < CPE_CHANNELS; n++ ) { st = hCPE->hCoreCoder[n]; @@ -929,7 +928,6 @@ static void read_stereo_mode_and_bwidth( if ( st_ivas->bfi || st_ivas->hDecoderConfig->ivas_total_brate < IVAS_SID_5k2 ) { - hCPE->element_mode = hCPE->last_element_mode; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 02c74efa37839cdeab97c2a89ddaa104b65ac170..439a90fb2c5cf291ad0206e248c167cd46aa404e 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -108,8 +108,7 @@ ivas_error ivas_dec( * Combine orientations *----------------------------------------------------------------*/ - if ( ( error = combine_external_and_head_orientations_dec( st_ivas->hHeadTrackData, st_ivas->hExtOrientationData, - st_ivas->hCombinedOrientationData ) ) != IVAS_ERR_OK ) + if ( ( error = combine_external_and_head_orientations_dec( st_ivas->hHeadTrackData, st_ivas->hExtOrientationData, st_ivas->hCombinedOrientationData ) ) != IVAS_ERR_OK ) { return error; } @@ -261,18 +260,12 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, - AUDIO_CONFIG_7_1_4, - AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, - NULL, - NULL, - NULL, - p_output, - output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, + NULL, NULL, NULL, p_output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); } #ifdef DEBUGGING @@ -299,7 +292,6 @@ ivas_error ivas_dec( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; @@ -387,7 +379,6 @@ ivas_error ivas_dec( nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) - { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } @@ -486,8 +477,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -545,8 +535,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index e62ba65ce0a967a3d9998b785a869b7f9bececfb..f3ea6912f32005efd1ec1d658363fc71a270bd22 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -421,14 +421,12 @@ ivas_error ivas_dirac_dec_config( return IVAS_ERR_OK; } - if ( nchan_transport_orig > 2 && hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC && !hodirac_flag ) { hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirAC->panningConf = DIRAC_PANNING_VBAP; } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || - st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; hDirAC->panningConf = DIRAC_PANNING_VBAP; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 94b3e94d8d8cb653de8b604bf333fd5e75651e1a..ff28af051a4766c6fd72627e7951768322bcd596 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -195,6 +195,7 @@ ivas_error ivas_jbm_dec_tc( { return error; } + #ifdef FIX_470_MASA_JBM_EXT if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { @@ -204,7 +205,6 @@ ivas_error ivas_jbm_dec_tc( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; @@ -320,6 +320,7 @@ ivas_error ivas_jbm_dec_tc( { st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; } + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); } @@ -340,6 +341,7 @@ ivas_error ivas_jbm_dec_tc( hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } } + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) <= ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) ) @@ -347,6 +349,7 @@ ivas_error ivas_jbm_dec_tc( ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); } } + if ( ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) >= ( st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ) ) { if ( st_ivas->renderer_type == RENDERER_MC ) @@ -808,8 +811,7 @@ ivas_error ivas_jbm_dec_render( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -1030,8 +1032,7 @@ ivas_error ivas_jbm_dec_flush_renderer( { if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV || renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 37fb66a2aab341688a1c73b55c5df56663a00dce..e67e96307df1ea0bfdbfeece7ebbc45bab264ec3 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1286,7 +1286,6 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } - if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) { int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; @@ -1387,9 +1386,9 @@ void ivas_param_mc_dec_read_BS( *------------------------------------------------------------------------*/ void ivas_param_mc_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ) { PARAM_MC_DEC_HANDLE hParamMC; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 51d685698730d797bb6b9c4e09460cdcf947eab9..7742656899b573b0cc86254b5cf43ebc76661131 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1057,7 +1057,7 @@ static ivas_error ivas_mc_dec_reconfig( /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded seperately after the allocation of the core coders + * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index d3f9bb29e2c3fbd1b289087c3c3a1e0c2d9d26cd..9e2d01f4dd40a6e0d3e9c24a1ba670e84a35da66 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1254,6 +1254,7 @@ int16_t ivas_qmetadata_dec_sid_decode( { q_direction->not_in_2D = 1; } + #ifdef FIX_QMETA_SID_5k2 bits_dir = 0; if ( ivas_format != SBA_FORMAT ) @@ -1283,6 +1284,7 @@ int16_t ivas_qmetadata_dec_sid_decode( } } } + if ( q_direction->not_in_2D == 0 ) { for ( b = start_band; b < nbands; b++ ) @@ -1303,6 +1305,7 @@ int16_t ivas_qmetadata_dec_sid_decode( q_direction->band_data[b].bits_sph_idx[0]--; } } + if ( q_direction->not_in_2D == 0 ) { for ( b = start_band; b < nbands; b++ ) @@ -1328,6 +1331,7 @@ int16_t ivas_qmetadata_dec_sid_decode( #ifdef FIX_QMETA_SID_5k2 } #endif + for ( b = start_band; b < nbands; b++ ) { q_direction->band_data[b].energy_ratio[0] = 1.0f - diffuseness_reconstructions[diffuseness_index[b]]; @@ -1358,11 +1362,13 @@ int16_t ivas_qmetadata_dec_sid_decode( ivas_qmetadata_azimuth_elevation_to_direction_vector( avg_azimuth, avg_elevation, avg_direction_vector ); ivas_qmetadata_azimuth_elevation_to_direction_vector( q_direction->band_data[b].azimuth[nblocks - 1], q_direction->band_data[b].elevation[nblocks - 1], direction_vector ); + for ( m = 0; m < nblocks - 1; m++ ) { v_add( direction_vector, avg_direction_vector, direction_vector, 3 ); ivas_qmetadata_direction_vector_to_azimuth_elevation( direction_vector, &q_direction->band_data[b].azimuth[m], &q_direction->band_data[b].elevation[m] ); } + ivas_qmetadata_direction_vector_to_azimuth_elevation( avg_direction_vector, &q_direction->band_data[b].azimuth[nblocks - 1], &q_direction->band_data[b].elevation[nblocks - 1] ); } } @@ -1378,6 +1384,7 @@ int16_t ivas_qmetadata_dec_sid_decode( #ifdef FIX_QMETA_SID_5k2 } #endif + q_direction->band_data[b].azimuth_index[0] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, q_direction->band_data[b].azimuth_m_alphabet[0] ); q_direction->band_data[b].azimuth_index[0] = ivas_qmetadata_dereorder_generic( q_direction->band_data[b].azimuth_index[0] ) + ( q_direction->band_data[b].azimuth_m_alphabet[0] >> 1 ); avg_azimuth = 360.0f / (float) ( q_direction->band_data[b].azimuth_m_alphabet[0] ) * q_direction->band_data[b].azimuth_index[0] - 180; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index df60adb8c1fb8eecbfbd84915a2ebd5cdd2a4fc3..906a73b31730d63c67fed8184637fa8f4a5e3532 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -967,6 +967,7 @@ static void ivas_spar_get_skip_mat( break; } } + if ( skip_mat[out_ch][in_ch] == 1 ) { for ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) @@ -1014,6 +1015,7 @@ static void ivas_spar_calc_smooth_facs( { break; } + /* calculate band-wise subframe energies */ subframe_band_nrg[b] = 0.f; while ( b == bin2band->p_cldfb_map_to_spar_band[bin] ) @@ -1045,8 +1047,10 @@ static void ivas_spar_calc_smooth_facs( /* calculate smoothing factor based on energy averages */ /* reduce factor for higher short-term energy */ smooth_fac[b] = min( 1.f, smooth_long_avg[b] / smooth_short_avg[b] ); + /* map factor to range [0;1] */ smooth_fac[b] = max( 0.f, smooth_fac[b] - (float) SBA_DIRAC_NRG_SMOOTH_SHORT / SBA_DIRAC_NRG_SMOOTH_LONG ) * ( (float) SBA_DIRAC_NRG_SMOOTH_LONG / ( SBA_DIRAC_NRG_SMOOTH_LONG - SBA_DIRAC_NRG_SMOOTH_SHORT ) ); + /* compress factor (higher compression in lowest bands) */ if ( b < 2 ) { @@ -1361,6 +1365,7 @@ void ivas_spar_dec_upmixer( for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); + for ( n = 0; n < nchan_out; n++ ) { output_f_local[n] += n_samples_sf; @@ -1493,7 +1498,6 @@ void ivas_spar_dec_upmixer_sf( hSpar->pca_ingest_channels = num_in_ingest; #endif - hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; @@ -1526,7 +1530,6 @@ void ivas_spar_dec_upmixer_sf( } } - /*---------------------------------------------------------------------* * CLDFB Processing and Synthesis *---------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 92e18c5c2c56a735f1f3ed1c5939ab4bcc082228..e83aa7e6174a85bb02b6be3cb08d87c7034d8c2c 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -96,7 +96,8 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder static ivas_error ivas_spar_md_dec_matrix_open( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_channels, /* i : number of internal channels */ - const int16_t num_md_sub_frames ) + const int16_t num_md_sub_frames /* i : number of MD subframes */ +) { int16_t i, j; @@ -240,11 +241,21 @@ static ivas_error ivas_spar_md_dec_matrix_open( return IVAS_ERR_OK; } + +/*------------------------------------------------------------------------- + * ivas_get_spar_dec_md_num_subframes() + * + * return number of MD subframes + *------------------------------------------------------------------------*/ + +/*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( - const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int32_t ivas_total_brate ) + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +) { int16_t num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( sba_order > SBA_FOA_ORDER ) { @@ -253,9 +264,11 @@ int16_t ivas_get_spar_dec_md_num_subframes( num_subframes = 1; } } + return ( num_subframes ); } + /*------------------------------------------------------------------------- * ivas_spar_md_dec_open() * @@ -282,8 +295,8 @@ ivas_error ivas_spar_md_dec_open( } num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate ); - if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, - num_md_sub_frames ) ) != IVAS_ERR_OK ) + + if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) { return error; } @@ -673,10 +686,8 @@ void ivas_spar_md_dec_process( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); - ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, - st_ivas->last_active_ivas_total_brate ); + ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode, st_ivas->last_active_ivas_total_brate ); #if 0 { @@ -950,6 +961,7 @@ void ivas_spar_md_dec_process( } }*/ #endif + /* expand DirAC MD to all time slots */ for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) { @@ -1158,7 +1170,8 @@ void ivas_spar_setup_md_smoothing( *-----------------------------------------------------------------------------------------*/ void ivas_spar_update_md_hist( - ivas_spar_md_dec_state_t *hMdDec ) + ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ +) { int16_t num_channels, i, j, k; @@ -1888,8 +1901,7 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { - ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, - strat, ivas_total_brate ); + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, strat, ivas_total_brate ); } else { @@ -2395,8 +2407,7 @@ static void ivas_decode_huffman_bs( for ( j = pred_offset; j < pred_dim; j++ ) { - ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, - &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); + ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); } if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) @@ -2873,6 +2884,7 @@ void ivas_spar_to_dirac( int16_t *dirac_to_spar_md_bands; int16_t enc_param_start_band; int16_t active_w_vlbr; + int16_t i, num_subframes; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); start_band = 0; @@ -3045,7 +3057,6 @@ void ivas_spar_to_dirac( dirac_band_idx = dirac_to_spar_md_bands[band] - enc_param_start_band; - int16_t num_subframes; num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hQMetaData->useLowerRes ) { @@ -3068,8 +3079,8 @@ void ivas_spar_to_dirac( /* DirAC MD averaged over 4 subframes and converted to SPAR format similar to encoder processing */ if ( hMdDec->spar_md_cfg.nchan_transport > 1 ) { - 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, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, - st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); + 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, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) @@ -3080,12 +3091,13 @@ void ivas_spar_to_dirac( } } } - int16_t num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; if ( st_ivas->hQMetaData->useLowerRes ) { num_subframes = 1; } + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_subframes, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); @@ -3095,11 +3107,11 @@ void ivas_spar_to_dirac( { for ( block = 1; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { - for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + for ( i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ { hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[i] = hMdDec->spar_md.band_coeffs[band].pred_re[i]; } - for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + for ( i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ { hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].P_re[i] = hMdDec->spar_md.band_coeffs[band].P_re[i]; } diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index b5b61c2f1cc8a2ae2ffcc73fe16c1d1bf1f27b57..f40b313125079ed9d7926152eb591c329b1facd6 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -569,7 +569,7 @@ void stereo_tcx_core_dec( /* note: the classifier needs the pitch only for tcx_only == 0, i.e. not for TCX10 */ set_f( pitch_C, floorf( st->old_fpitch + 0.5f ), 4 ); - /* note: codec_mode is foced to MODE2, since FEC_clas_estim() considers only TCX being in Mode2*/ + /* note: codec_mode is forced to MODE2, since FEC_clas_estim() considers only TCX being in Mode2*/ FEC_clas_estim( synth, pitch_C, st->L_frame, st->tcxonly ? GENERIC : st->core_ext_mode, MODE2, st->mem_syn_clas_estim, &st->clas_dec, &st->lp_ener_bfi, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : -1.0f, st->narrowBand, CLASSIFIER_TCX, bfi, st->preemph_fac, st->tcxonly, st->last_core_brate, -1 ); } } diff --git a/lib_enc/FEC_enc.c b/lib_enc/FEC_enc.c index 5bf8d1f1f40ad22daf5caf15e6570cfaf9a00d74..9b753c97b82ac3fb515fe8a241d42c34fe2dd742 100644 --- a/lib_enc/FEC_enc.c +++ b/lib_enc/FEC_enc.c @@ -133,8 +133,7 @@ void FEC_encode( { /* retrieve the last glottal pulse position of the previous frame */ /* use the current pitch information to scale or not the quantization */ - tmp_FER_pitch = (int16_t) ( fpit[0] ); /* take the 1st subframe pitch, since it is easier to retieve it on decoder side */ - + tmp_FER_pitch = (int16_t) ( fpit[0] ); /* take the 1st subframe pitch, since it is easier to retrieve it on decoder side */ sign = 0; maxi = *last_pulse_pos; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 325b21456a8182d689b888237c74485ba7018dcc..3c1d7a61c6832d086d73e5164c577dfa950f2b2f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -278,6 +278,7 @@ ivas_error ivas_cpe_enc( stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } } + if ( hCPE->element_mode == IVAS_CPE_TD ) { if ( hCPE->hStereoTD->tdm_LRTD_flag ) @@ -431,11 +432,9 @@ ivas_error ivas_cpe_enc( for ( n = 0; n < n_CoreChannels; n++ ) { error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], - &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], - &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], - fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, - ivas_format, - ivas_total_brate ); + &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], + realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], + fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -830,9 +829,8 @@ ivas_error create_cpe_enc( copy_encoder_config( st_ivas, st, 1 ); st->total_brate = hCPE->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( error = init_encoder( st, - st_ivas, - n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + + if ( ( error = init_encoder( st, st_ivas, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index eb7537e282278f824520cd0f299e9d72ef73b03d..854354ceb8f1b2c2c1214d6be98ecc36dd7295c7 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -136,7 +136,7 @@ ivas_error ivas_enc( { hp20( data_f[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } - else if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ + else if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) { hp20( data_f[i], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } @@ -278,7 +278,7 @@ ivas_error ivas_enc( #ifdef FIX_572_LFE_LPF_ENC /* LFE low pass filter */ - ivas_lfe_lpf_enc_apply( st_ivas->lfe_lpf_state, data_f[LFE_CHANNEL], input_frame ); + ivas_lfe_lpf_enc_apply( st_ivas->hLfeLpf, data_f[LFE_CHANNEL], input_frame ); #endif /* LFE channel encoder */ @@ -298,7 +298,6 @@ ivas_error ivas_enc( } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - /* encode MC ParamUpmix parameters and write bitstream */ ivas_mc_paramupmix_enc( st_ivas, hMetaData, data_f, input_frame ); diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 14920e4ac19a4b96e9b7897d6a044fd364b2eb09..fcf2efc6c293b5e8fd24ec16342dabff6ea2e153 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -63,11 +63,11 @@ static void ivas_band_cov( float **ppIn_FR_real, float **ppIn_FR_imag, const int *------------------------------------------------------------------------*/ ivas_error ivas_spar_covar_enc_open( - ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp, /* i : number of input channels */ - COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 9d8b575b852690f9e10af38cab370311cea665eb..fdb562243c3d4586725a49bb6b542a424a9a4340 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -315,8 +315,8 @@ void ivas_initialize_handles_enc( st_ivas->hLFE = NULL; #ifdef FIX_572_LFE_LPF_ENC - /* LFE low pass filter state */ - st_ivas->lfe_lpf_state = NULL; + /* LFE low pass filter handle */ + st_ivas->hLfeLpf = NULL; #endif return; @@ -482,8 +482,8 @@ ivas_error ivas_init_encoder( if ( ivas_format == SBA_FORMAT ) { - st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); + if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; @@ -497,6 +497,7 @@ ivas_error ivas_init_encoder( else { st_ivas->nchan_transport = hEncoderConfig->nchan_inp; + if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -510,7 +511,6 @@ ivas_error ivas_init_encoder( return error; } - if ( ivas_format == SBA_FORMAT && st_ivas->hEncoderConfig->Opt_DTX_ON ) { st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; @@ -549,7 +549,10 @@ ivas_error ivas_init_encoder( hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); #ifdef FIX_572_LFE_LPF_ENC - ivas_create_lfe_lpf_enc( &st_ivas->lfe_lpf_state, hEncoderConfig->input_Fs ); + if ( ( error = ivas_create_lfe_lpf_enc( &st_ivas->hLfeLpf, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } #endif if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -955,7 +958,7 @@ void ivas_destroy_enc( #ifdef FIX_572_LFE_LPF_ENC /* LFE low pass filter state */ - ivas_lfe_lpf_enc_close( &( st_ivas->lfe_lpf_state ) ); + ivas_lfe_lpf_enc_close( &( st_ivas->hLfeLpf ) ); #endif /* Param-Upmix MC handle */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 91ccdcbe0f5270d30022d28489709e337b5c5f36..558455f017ce43db2b4cdf4cf1bdfadd0c87bf86 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -160,12 +160,9 @@ ivas_error ivas_ism_enc( *----------------------------------------------------------------*/ error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8[sce_id][0], old_inp_16k[sce_id][0], - &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], - &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], - fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, - ISM_FORMAT, - - st_ivas->hEncoderConfig->ivas_total_brate ); + &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], + realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], + fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, ISM_FORMAT, st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index ff64bb3487720fe692518c8ad36b35cf2fefa3e5..61072cc1872212f424a15b3c834be118c48b8bb9 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -497,13 +497,13 @@ void ivas_lfe_enc_close( *-------------------------------------------------------------------------*/ ivas_error ivas_create_lfe_lpf_enc( - ivas_filters_process_state_t **ph_lfe_lpf_filter_state, /* o : IVAS LFE encoder structure */ - const int32_t input_Fs /* i : input sampling rate */ + ivas_filters_process_state_t **hLfeLpf, /* o : LFE LPF handle */ + const int32_t input_Fs /* i : input sampling rate */ ) { const float *filt_coeff; - if ( ph_lfe_lpf_filter_state == NULL ) + if ( hLfeLpf == NULL ) { return ( IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Can not allocate memory for LFE LPF\n" ) ); } @@ -512,14 +512,14 @@ ivas_error ivas_create_lfe_lpf_enc( * Allocate LFE LPF handle *-----------------------------------------------------------------*/ - if ( ( *ph_lfe_lpf_filter_state = (ivas_filters_process_state_t *) malloc( sizeof( ivas_filters_process_state_t ) ) ) == NULL ) + if ( ( *hLfeLpf = (ivas_filters_process_state_t *) malloc( sizeof( ivas_filters_process_state_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LFE LPF\n" ) ); } - ivas_lfe_lpf_select_filt_coeff( input_Fs, IVAS_FILTER_ORDER_4, &filt_coeff ); - ivas_filters_init( *ph_lfe_lpf_filter_state, filt_coeff, IVAS_FILTER_ORDER_4 ); + + ivas_filters_init( *hLfeLpf, filt_coeff, IVAS_FILTER_ORDER_4 ); return IVAS_ERR_OK; } @@ -532,19 +532,21 @@ ivas_error ivas_create_lfe_lpf_enc( *-------------------------------------------------------------------------*/ void ivas_lfe_lpf_enc_close( - ivas_filters_process_state_t **ph_lfe_lpf_filter_state /* i/o: LFE encoder handle */ + ivas_filters_process_state_t **hLfeLpf /* i/o: LFE LPF handle */ ) { - if ( ph_lfe_lpf_filter_state == NULL || *ph_lfe_lpf_filter_state == NULL ) + if ( hLfeLpf == NULL || *hLfeLpf == NULL ) { return; } - free( ( *ph_lfe_lpf_filter_state ) ); - ( *ph_lfe_lpf_filter_state ) = NULL; + free( ( *hLfeLpf ) ); + ( *hLfeLpf ) = NULL; + return; } + /*------------------------------------------------------------------------- * ivas_lfe_lpf_enc_apply() * @@ -552,12 +554,13 @@ void ivas_lfe_lpf_enc_close( *-------------------------------------------------------------------------*/ void ivas_lfe_lpf_enc_apply( - ivas_filters_process_state_t *h_lfe_lpf_filter_state, /* i/o: LFE encoder handle */ - float data_lfe_ch[], /* i : input LFE signal */ - const int16_t input_frame /* i : input frame length per channel */ + ivas_filters_process_state_t *hLfeLpf, /* i/o: LFE LPF handle */ + float data_lfe_ch[], /* i/o: LFE signal */ + const int16_t input_frame /* i : input frame length per channel */ ) { + ivas_filter_process( hLfeLpf, data_lfe_ch, input_frame ); - ivas_filter_process( h_lfe_lpf_filter_state, data_lfe_ch, input_frame ); + return; } #endif diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 461d878ec2739e07d3c729daa2ed89def94ee208..66ca82b4cf88399ec66b79256eaa99e201e3063f 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -386,10 +386,10 @@ void ivas_param_mc_enc_close( *------------------------------------------------------------------------*/ void ivas_param_mc_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ + const int16_t input_frame /* i : input frame length */ ) { int16_t k; @@ -1235,7 +1235,6 @@ static void ivas_param_mc_quantize_ilds( v_multc( Nrg, limit_fac, Nrg, num_ilds_to_code ); } - /* limit ILD jumps in non-tranient frames */ tot_ener = 0.0f; dmx_ener = 0.0f; @@ -1269,6 +1268,7 @@ static void ivas_param_mc_quantize_ilds( } hParamMC->ener_fac[freq_idx] = ener_fac; + #ifdef FIX_563_PARAMMC_LIMITER /* update also combined bands ener_fac when in transient frame */ if ( hParamMC->hMetadataPMC.bAttackPresent && ( ( freq_idx + 1 ) < hParamMC->hMetadataPMC.nbands_coded ) ) diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index f29b152838a0142c56818f62a9507ad7999010ce..5c50c3d6bdd6946ff42c6dca80a34e953cf3fbc2 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -79,10 +79,10 @@ static void quantize_pars( const int16_t nv, const float *v, const int16_t nq, c *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: MC data */ + const int16_t input_frame /* i : input frame length */ ) { MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 0f20a03768afff45a63526cb801d5a628a481722..42ce327a4c47ea85b0f53df6a61a4a4bf336f632 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -224,7 +224,7 @@ ivas_error ivas_mct_enc( /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); - /*for MC and MCT remove pointer to LFE input that has been processed seperately */ + /*for MC and MCT remove pointer to LFE input that has been processed separately */ map_input_to_cpe_channels( st_ivas, pdata, data ); /* pre-processing */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index c540c3c263e5e86dbc7f0b7414a6e10ec573b4c6..3355db5b66cb7c450957fd479c3da9d160433763 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -850,6 +850,7 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* do the quantization */ quantize_direction_frame( q_direction, azimuth_orig, elevation_orig, 1 ); } + for ( i = start_band; i < nbands; i++ ) { for ( j = 0; j < nblocks; j++ ) @@ -983,8 +984,8 @@ void ivas_qmetadata_enc_sid_encode( } else { - /* TODO: still use old sid frame size to keep bitexactness */ #ifdef FIX_QMETA_SID_5k2 + /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; #else metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; @@ -1079,6 +1080,7 @@ void ivas_qmetadata_enc_sid_encode( } } } + if ( q_direction->not_in_2D == 0 ) { for ( b = start_band; b < nbands; b++ ) @@ -1170,22 +1172,13 @@ void ivas_qmetadata_enc_sid_encode( if ( q_direction->not_in_2D == 0 ) { avg_elevation[b] = 0; - q_direction->band_data[b].spherical_index[0] = quantize_direction2D( avg_azimuth[b], - q_direction->band_data[b].azimuth_m_alphabet[0], - &avg_azimuth[b], - &q_direction->band_data[b].azimuth_index[0], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[b].spherical_index[0] = quantize_direction2D( avg_azimuth[b], q_direction->band_data[b].azimuth_m_alphabet[0], &avg_azimuth[b], + &q_direction->band_data[b].azimuth_index[0], q_direction->cfg.mc_ls_setup ); } else { - q_direction->band_data[b].spherical_index[0] = quantize_direction( avg_elevation[b], - avg_azimuth[b], - q_direction->band_data[b].bits_sph_idx[0], - &avg_elevation[b], - &avg_azimuth[b], - &q_direction->band_data[b].elevation_index[0], - &q_direction->band_data[b].azimuth_index[0], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[b].spherical_index[0] = quantize_direction( avg_elevation[b], avg_azimuth[b], q_direction->band_data[b].bits_sph_idx[0], &avg_elevation[b], &avg_azimuth[b], + &q_direction->band_data[b].elevation_index[0], &q_direction->band_data[b].azimuth_index[0], q_direction->cfg.mc_ls_setup ); } /* Save quantized DOAs */ @@ -3837,14 +3830,8 @@ static int16_t encode_directions_subband( for ( k = 0; k < no_subframes; k++ ) { /* requantize the direction */ - q_direction->band_data[j].spherical_index[k] = quantize_direction( elevation_orig[k], - azimuth_orig[k], - q_direction->band_data[j].bits_sph_idx[k], - &q_direction->band_data[j].elevation[k], - &q_direction->band_data[j].azimuth[k], - &q_direction->band_data[j].elevation_index[k], - &q_direction->band_data[j].azimuth_index[k], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[j].spherical_index[k] = quantize_direction( elevation_orig[k], azimuth_orig[k], q_direction->band_data[j].bits_sph_idx[k], &q_direction->band_data[j].elevation[k], &q_direction->band_data[j].azimuth[k], + &q_direction->band_data[j].elevation_index[k], &q_direction->band_data[j].azimuth_index[k], q_direction->cfg.mc_ls_setup ); } if ( allowed_bits > 0 ) @@ -3869,14 +3856,8 @@ static int16_t encode_directions_subband( for ( k = 0; k < no_subframes; k++ ) { /* requantize the direction */ - q_direction->band_data[j].spherical_index[k] = quantize_direction( elevation_orig[k], - azimuth_orig[k], - q_direction->band_data[j].bits_sph_idx[k], - &q_direction->band_data[j].elevation[k], - &q_direction->band_data[j].azimuth[k], - &q_direction->band_data[j].elevation_index[k], - &q_direction->band_data[j].azimuth_index[k], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[j].spherical_index[k] = quantize_direction( elevation_orig[k], azimuth_orig[k], q_direction->band_data[j].bits_sph_idx[k], &q_direction->band_data[j].elevation[k], &q_direction->band_data[j].azimuth[k], + &q_direction->band_data[j].elevation_index[k], &q_direction->band_data[j].azimuth_index[k], q_direction->cfg.mc_ls_setup ); } if ( allowed_bits > 0 ) @@ -3902,14 +3883,8 @@ static int16_t encode_directions_subband( for ( k = 0; k < no_subframes; k++ ) { /* requantize the direction */ - q_direction->band_data[j].spherical_index[k] = quantize_direction( elevation_orig[k], - azimuth_orig[k], - q_direction->band_data[j].bits_sph_idx[k], - &q_direction->band_data[j].elevation[k], - &q_direction->band_data[j].azimuth[k], - &q_direction->band_data[j].elevation_index[k], - &q_direction->band_data[j].azimuth_index[k], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[j].spherical_index[k] = quantize_direction( elevation_orig[k], azimuth_orig[k], q_direction->band_data[j].bits_sph_idx[k], &q_direction->band_data[j].elevation[k], &q_direction->band_data[j].azimuth[k], + &q_direction->band_data[j].elevation_index[k], &q_direction->band_data[j].azimuth_index[k], q_direction->cfg.mc_ls_setup ); } if ( allowed_bits > 0 ) @@ -4109,11 +4084,8 @@ static ivas_error requantize_direction_EC_3( for ( k = 0; k < no_subframes; k++ ) { /* requantize the direction */ - q_direction->band_data[j].spherical_index[k] = quantize_direction2D( azimuth_orig[j][k], - 1 << q_direction->band_data[j].bits_sph_idx[k], - &q_direction->band_data[j].azimuth[k], - &q_direction->band_data[j].azimuth_index[k], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[j].spherical_index[k] = quantize_direction2D( azimuth_orig[j][k], 1 << q_direction->band_data[j].bits_sph_idx[k], &q_direction->band_data[j].azimuth[k], + &q_direction->band_data[j].azimuth_index[k], q_direction->cfg.mc_ls_setup ); q_direction->band_data[j].elevation_index[k] = 0; } nbits += write_fixed_rate_direction( hMetaData, q_direction, j, no_subframes ); @@ -4169,7 +4141,7 @@ static int16_t write_fixed_rate_direction( static void joint_encoding( IVAS_QDIRECTION *q_direction, /* i/o: quantized directional parameters */ const int16_t j, /* i : subband index */ - const int16_t next_j, /* i : next subband index */ + const int16_t next_j, /* i : next subband index */ const int16_t coding_subbands, /* i : total number of subband */ int16_t *bits_dir0, /* i/o: number of bits for each tile in each subband */ const int16_t allowed_bits, /* i : maximum number of bits available for the current subband */ @@ -4191,11 +4163,8 @@ static void joint_encoding( q_direction->band_data[j].bits_sph_idx[k] = bits_dir0[k]; /* requantize the direction */ - q_direction->band_data[j].spherical_index[k] = quantize_direction( q_direction->band_data[j].elevation[k], q_direction->band_data[j].azimuth[k], - q_direction->band_data[j].bits_sph_idx[k], &q_direction->band_data[j].elevation[k], - &q_direction->band_data[j].azimuth[k], &q_direction->band_data[j].elevation_index[k], - &q_direction->band_data[j].azimuth_index[k], - q_direction->cfg.mc_ls_setup ); + q_direction->band_data[j].spherical_index[k] = quantize_direction( q_direction->band_data[j].elevation[k], q_direction->band_data[j].azimuth[k], q_direction->band_data[j].bits_sph_idx[k], &q_direction->band_data[j].elevation[k], + &q_direction->band_data[j].azimuth[k], &q_direction->band_data[j].elevation_index[k], &q_direction->band_data[j].azimuth_index[k], q_direction->cfg.mc_ls_setup ); if ( bits_dir0[k] >= 3 ) { diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 0a16109e6ad359e16ef66d7f2812cbd91d43f665..97992ecb9f4b223f3dd3443e0756a6eb25e9c1a0 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -181,12 +181,10 @@ ivas_error ivas_sce_enc( *----------------------------------------------------------------*/ error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata, input_frame, 0, old_inp_12k8[0], old_inp_16k[0], - &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], - &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], + &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], &vad_hover_flag[0], &attack_flag[0], + realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, - ivas_format, - st_ivas->hEncoderConfig->ivas_total_brate ); + st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -339,9 +337,7 @@ ivas_error create_sce_enc( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( error = init_encoder( st, - st_ivas, - 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 444d613e299510e7309aac5a42db96742302bc3c..5f382c4719882668e0f9892202e80d1b2c07d9a1 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -225,9 +225,7 @@ ivas_error ivas_spar_enc_open( hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, - st_ivas, - 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( hSpar->hCoreCoderVAD, st_ivas, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 90480d6ad9490cdd44a8cc738acd8298b7502d34..295c8ed8388f7b562b733e0dd8d472f2778466aa 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1142,9 +1142,6 @@ typedef struct int16_t codec_mode; /* Mode1 or Mode2 of core codec */ int16_t last_codec_mode; /* previous frame Mode 1 or 2 */ float **mem_hp20_in; /* input signals HP filter memories */ -#ifdef FIX_572_LFE_LPF_ENC - ivas_filters_process_state_t *lfe_lpf_state; /* low pass filter state for LFE */ -#endif /* core-encoder modules */ int16_t nSCE; /* number of total SCEs */ @@ -1164,6 +1161,9 @@ typedef struct MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; /* MC Param-Upmix handle */ MCMASA_ENC_HANDLE hMcMasa; /* Multi-channel MASA data handle */ LFE_ENC_HANDLE hLFE; /* LFE data handle */ +#ifdef FIX_572_LFE_LPF_ENC + ivas_filters_process_state_t *hLfeLpf; /* low pass filter state for LFE */ +#endif ISM_MODE ism_mode; /* ISM format mode */ MC_MODE mc_mode; /* MC format mode */ diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 46014fded0c1682f938fa56b8c41ca457275d048..e2b1c09a340aec032cbe232169cd8468228cf18c 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -1470,7 +1470,6 @@ ivas_error stereo_dmx_evs_init_encoder( hStereoDmxEVS->hPOC->confidence = 0.0f; - hStereoDmxEVS->hPHA = NULL; if ( ( hStereoDmxEVS->hPHA = (STEREO_DMX_EVS_PHA_HANDLE) malloc( sizeof( STEREO_DMX_EVS_PHA_DATA ) ) ) == NULL ) { @@ -1617,7 +1616,6 @@ ivas_error stereo_dmx_evs_init_encoder( hStereoDmxEVS->hPHA->trns_aux_energy[n] = 0.0f; } - *hStereoDmxEVS_out = hStereoDmxEVS; return IVAS_ERR_OK; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 58a010ff7e6f0af108e55ad8bf9f1008dcf34bf4..18cfb9247d3df5f5e6c988b0e462bc0477692a7b 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -904,7 +904,6 @@ static ivas_error configureEncoder( return error; } - if ( hEncoderConfig->ivas_format == MONO_FORMAT ) { hIvasEnc->hCoreCoder = st_ivas->hSCE[0]->hCoreCoder[0]; /* Note: this is needed for switching in EVS mono */ diff --git a/lib_enc/lsf_enc.c b/lib_enc/lsf_enc.c index 968a9a0d25e555e7539cdb0ca0556f8abefcf9df..61a81ffec8fcccb536d323af3fb4d52cc75e9fd9 100644 --- a/lib_enc/lsf_enc.c +++ b/lib_enc/lsf_enc.c @@ -479,8 +479,7 @@ void lsf_end_enc( flag_1bit_gran = ( st->element_mode > EVS_MONO ); nBits = nBits_in; - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ - ) + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ ) { if ( coder_type_raw == VOICED ) { @@ -734,9 +733,7 @@ void lsf_end_enc( if ( st->codec_mode == MODE1 && st->core == ACELP_CORE ) { /* write coder_type bit for VOICED@16kHz or GENERIC@16kHz */ - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->idchan == 0 - - ) + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->idchan == 0 ) { /* VOICED =2 and GENERIC=3, so "coder_type-2" means VOICED =0 and GENERIC=1*/ push_indice( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, coder_type - 2, 1 );